├── .gitignore
├── README.md
├── __init__.py
├── __init__.pyc
├── bin
├── compiler.jar
├── compiler_config_sample.json
├── jsbcc
├── jsbcc.exe
├── linux
│ ├── jsbcc_x64
│ └── jsbcc_x86
└── mozjs-33.dll
└── jsbcc_source
├── README
├── jsbcc-vc2012.sln
├── jsbcc-vc2012.vcxproj
├── jsbcc-vc2012.vcxproj.filters
├── jsbcc-vc2012.vcxproj.user
├── jsbcc.xcodeproj
├── project.pbxproj
├── project.xcworkspace
│ └── contents.xcworkspacedata
└── xcuserdata
│ └── panda.xcuserdatad
│ └── xcschemes
│ ├── jsbcc.xcscheme
│ └── xcschememanagement.plist
├── spidermonkey-linux
├── include
│ ├── js-config.h
│ ├── js.msg
│ ├── js
│ │ ├── Anchor.h
│ │ ├── CallArgs.h
│ │ ├── CallNonGenericMethod.h
│ │ ├── CharacterEncoding.h
│ │ ├── Class.h
│ │ ├── Date.h
│ │ ├── GCAPI.h
│ │ ├── HashTable.h
│ │ ├── HeapAPI.h
│ │ ├── Id.h
│ │ ├── LegacyIntTypes.h
│ │ ├── MemoryMetrics.h
│ │ ├── OldDebugAPI.h
│ │ ├── Principals.h
│ │ ├── ProfilingStack.h
│ │ ├── PropertyKey.h
│ │ ├── RequiredDefines.h
│ │ ├── RootingAPI.h
│ │ ├── SliceBudget.h
│ │ ├── StructuredClone.h
│ │ ├── TracingAPI.h
│ │ ├── TypeDecls.h
│ │ ├── UbiNode.h
│ │ ├── UbiNodeTraverse.h
│ │ ├── Utility.h
│ │ ├── Value.h
│ │ ├── Vector.h
│ │ └── WeakMapPtr.h
│ ├── jsalloc.h
│ ├── jsapi.h
│ ├── jsbytecode.h
│ ├── jsclist.h
│ ├── jscpucfg.h
│ ├── jsfriendapi.h
│ ├── jsperf.h
│ ├── jsprf.h
│ ├── jsprototypes.h
│ ├── jsproxy.h
│ ├── jspubtd.h
│ ├── jstypes.h
│ ├── jsversion.h
│ ├── jswrapper.h
│ └── mozilla
│ │ ├── Alignment.h
│ │ ├── AllocPolicy.h
│ │ ├── Array.h
│ │ ├── ArrayUtils.h
│ │ ├── Assertions.h
│ │ ├── Atomics.h
│ │ ├── Attributes.h
│ │ ├── BinarySearch.h
│ │ ├── BloomFilter.h
│ │ ├── Casting.h
│ │ ├── ChaosMode.h
│ │ ├── Char16.h
│ │ ├── CheckedInt.h
│ │ ├── Compiler.h
│ │ ├── Compression.h
│ │ ├── Constants.h
│ │ ├── DebugOnly.h
│ │ ├── Decimal.h
│ │ ├── Endian.h
│ │ ├── EnumSet.h
│ │ ├── EnumeratedArray.h
│ │ ├── FloatingPoint.h
│ │ ├── GuardObjects.h
│ │ ├── HashFunctions.h
│ │ ├── IntegerPrintfMacros.h
│ │ ├── IntegerTypeTraits.h
│ │ ├── Likely.h
│ │ ├── LinkedList.h
│ │ ├── LinuxSignal.h
│ │ ├── MSIntTypes.h
│ │ ├── MacroArgs.h
│ │ ├── MacroForEach.h
│ │ ├── MathAlgorithms.h
│ │ ├── Maybe.h
│ │ ├── MaybeOneOf.h
│ │ ├── MemoryChecking.h
│ │ ├── MemoryReporting.h
│ │ ├── Move.h
│ │ ├── NullPtr.h
│ │ ├── NumericLimits.h
│ │ ├── Pair.h
│ │ ├── PodOperations.h
│ │ ├── Poison.h
│ │ ├── Range.h
│ │ ├── RangedPtr.h
│ │ ├── ReentrancyGuard.h
│ │ ├── RefCountType.h
│ │ ├── RefPtr.h
│ │ ├── RollingMean.h
│ │ ├── SHA1.h
│ │ ├── Scoped.h
│ │ ├── SplayTree.h
│ │ ├── TaggedAnonymousMemory.h
│ │ ├── TemplateLib.h
│ │ ├── ThreadLocal.h
│ │ ├── ToString.h
│ │ ├── TypeTraits.h
│ │ ├── TypedEnum.h
│ │ ├── TypedEnumBits.h
│ │ ├── TypedEnumInternal.h
│ │ ├── Types.h
│ │ ├── UniquePtr.h
│ │ ├── Vector.h
│ │ └── WeakPtr.h
└── lib
│ ├── 32-bit
│ └── libjs_static.a
│ └── 64-bit
│ └── libjs_static.a
├── spidermonkey-mac
├── include
│ ├── fdlibm.h
│ ├── jemalloc_types.h
│ ├── js-config.h
│ ├── js.msg
│ ├── js
│ │ ├── CallArgs.h
│ │ ├── CallNonGenericMethod.h
│ │ ├── CharacterEncoding.h
│ │ ├── Class.h
│ │ ├── Conversions.h
│ │ ├── Date.h
│ │ ├── Debug.h
│ │ ├── GCAPI.h
│ │ ├── GCAnnotations.h
│ │ ├── GCHashTable.h
│ │ ├── GCPolicyAPI.h
│ │ ├── GCVariant.h
│ │ ├── GCVector.h
│ │ ├── HashTable.h
│ │ ├── HeapAPI.h
│ │ ├── Id.h
│ │ ├── Initialization.h
│ │ ├── LegacyIntTypes.h
│ │ ├── MemoryMetrics.h
│ │ ├── Principals.h
│ │ ├── ProfilingFrameIterator.h
│ │ ├── ProfilingStack.h
│ │ ├── Proxy.h
│ │ ├── Realm.h
│ │ ├── RequiredDefines.h
│ │ ├── RootingAPI.h
│ │ ├── SliceBudget.h
│ │ ├── StructuredClone.h
│ │ ├── SweepingAPI.h
│ │ ├── TraceKind.h
│ │ ├── TracingAPI.h
│ │ ├── TrackedOptimizationInfo.h
│ │ ├── TypeDecls.h
│ │ ├── UbiNode.h
│ │ ├── UbiNodeBreadthFirst.h
│ │ ├── UbiNodeCensus.h
│ │ ├── UbiNodeDominatorTree.h
│ │ ├── UbiNodePostOrder.h
│ │ ├── UbiNodeShortestPaths.h
│ │ ├── UniquePtr.h
│ │ ├── Utility.h
│ │ ├── Value.h
│ │ ├── Vector.h
│ │ └── WeakMapPtr.h
│ ├── jsalloc.h
│ ├── jsapi.h
│ ├── jsbytecode.h
│ ├── jsclist.h
│ ├── jscpucfg.h
│ ├── jsfriendapi.h
│ ├── jsperf.h
│ ├── jsprf.h
│ ├── jsprototypes.h
│ ├── jspubtd.h
│ ├── jstypes.h
│ ├── jsversion.h
│ ├── jswrapper.h
│ ├── mozilla
│ │ ├── Alignment.h
│ │ ├── AllocPolicy.h
│ │ ├── AlreadyAddRefed.h
│ │ ├── Array.h
│ │ ├── ArrayUtils.h
│ │ ├── Assertions.h
│ │ ├── Atomics.h
│ │ ├── Attributes.h
│ │ ├── BinarySearch.h
│ │ ├── BloomFilter.h
│ │ ├── BufferList.h
│ │ ├── Casting.h
│ │ ├── ChaosMode.h
│ │ ├── Char16.h
│ │ ├── CheckedInt.h
│ │ ├── Compiler.h
│ │ ├── Compression.h
│ │ ├── DebugOnly.h
│ │ ├── Decimal.h
│ │ ├── EndianUtils.h
│ │ ├── EnumSet.h
│ │ ├── EnumTypeTraits.h
│ │ ├── EnumeratedArray.h
│ │ ├── EnumeratedRange.h
│ │ ├── FastBernoulliTrial.h
│ │ ├── FloatingPoint.h
│ │ ├── Function.h
│ │ ├── GuardObjects.h
│ │ ├── HashFunctions.h
│ │ ├── IndexSequence.h
│ │ ├── IntegerPrintfMacros.h
│ │ ├── IntegerRange.h
│ │ ├── IntegerTypeTraits.h
│ │ ├── JSONWriter.h
│ │ ├── Likely.h
│ │ ├── LinkedList.h
│ │ ├── MacroArgs.h
│ │ ├── MacroForEach.h
│ │ ├── MathAlgorithms.h
│ │ ├── Maybe.h
│ │ ├── MaybeOneOf.h
│ │ ├── MemoryChecking.h
│ │ ├── MemoryReporting.h
│ │ ├── Move.h
│ │ ├── NotNull.h
│ │ ├── NullPtr.h
│ │ ├── Opaque.h
│ │ ├── OperatorNewExtensions.h
│ │ ├── Pair.h
│ │ ├── PodOperations.h
│ │ ├── Poison.h
│ │ ├── Range.h
│ │ ├── RangedArray.h
│ │ ├── RangedPtr.h
│ │ ├── ReentrancyGuard.h
│ │ ├── RefCountType.h
│ │ ├── RefCounted.h
│ │ ├── RefPtr.h
│ │ ├── ReverseIterator.h
│ │ ├── RollingMean.h
│ │ ├── SHA1.h
│ │ ├── Saturate.h
│ │ ├── ScopeExit.h
│ │ ├── Scoped.h
│ │ ├── SegmentedVector.h
│ │ ├── SizePrintfMacros.h
│ │ ├── SplayTree.h
│ │ ├── Sprintf.h
│ │ ├── StackWalk.h
│ │ ├── StaticAnalysisFunctions.h
│ │ ├── TaggedAnonymousMemory.h
│ │ ├── TemplateLib.h
│ │ ├── ThreadLocal.h
│ │ ├── TimeStamp.h
│ │ ├── ToString.h
│ │ ├── Tuple.h
│ │ ├── TypeTraits.h
│ │ ├── TypedEnumBits.h
│ │ ├── Types.h
│ │ ├── UniquePtr.h
│ │ ├── UniquePtrExtensions.h
│ │ ├── Unused.h
│ │ ├── Variant.h
│ │ ├── Vector.h
│ │ ├── WeakPtr.h
│ │ ├── XorShift128PlusRNG.h
│ │ ├── double-conversion.h
│ │ ├── fallible.h
│ │ ├── mozalloc.h
│ │ ├── mozalloc_abort.h
│ │ ├── mozalloc_oom.h
│ │ └── utils.h
│ ├── mozmemory.h
│ └── mozmemory_wrap.h
└── lib
│ ├── libjs_static.a
│ └── libmozglue.a
├── spidermonkey-win32
├── include
│ ├── js-config.h
│ ├── js.msg
│ ├── js
│ │ ├── Anchor.h
│ │ ├── CallArgs.h
│ │ ├── CallNonGenericMethod.h
│ │ ├── CharacterEncoding.h
│ │ ├── Class.h
│ │ ├── Date.h
│ │ ├── GCAPI.h
│ │ ├── HashTable.h
│ │ ├── HeapAPI.h
│ │ ├── Id.h
│ │ ├── LegacyIntTypes.h
│ │ ├── MemoryMetrics.h
│ │ ├── OldDebugAPI.h
│ │ ├── Principals.h
│ │ ├── ProfilingStack.h
│ │ ├── PropertyKey.h
│ │ ├── RequiredDefines.h
│ │ ├── RootingAPI.h
│ │ ├── SliceBudget.h
│ │ ├── StructuredClone.h
│ │ ├── TracingAPI.h
│ │ ├── TypeDecls.h
│ │ ├── UbiNode.h
│ │ ├── UbiNodeTraverse.h
│ │ ├── Utility.h
│ │ ├── Value.h
│ │ ├── Vector.h
│ │ └── WeakMapPtr.h
│ ├── jsalloc.h
│ ├── jsapi.h
│ ├── jsbytecode.h
│ ├── jsclist.h
│ ├── jscpucfg.h
│ ├── jsfriendapi.h
│ ├── jsperf.h
│ ├── jsprf.h
│ ├── jsprototypes.h
│ ├── jsproxy.h
│ ├── jspubtd.h
│ ├── jstypes.h
│ ├── jsversion.h
│ ├── jswrapper.h
│ ├── mozilla
│ │ ├── Alignment.h
│ │ ├── AllocPolicy.h
│ │ ├── Array.h
│ │ ├── ArrayUtils.h
│ │ ├── Assertions.h
│ │ ├── Atomics.h
│ │ ├── Attributes.h
│ │ ├── BinarySearch.h
│ │ ├── BloomFilter.h
│ │ ├── Casting.h
│ │ ├── ChaosMode.h
│ │ ├── CheckedInt.h
│ │ ├── Compiler.h
│ │ ├── Compression.h
│ │ ├── Constants.h
│ │ ├── DebugOnly.h
│ │ ├── Decimal.h
│ │ ├── Endian.h
│ │ ├── EnumSet.h
│ │ ├── EnumeratedArray.h
│ │ ├── FloatingPoint.h
│ │ ├── GuardObjects.h
│ │ ├── HashFunctions.h
│ │ ├── IntegerPrintfMacros.h
│ │ ├── IntegerTypeTraits.h
│ │ ├── Likely.h
│ │ ├── LinkedList.h
│ │ ├── MSIntTypes.h
│ │ ├── MacroArgs.h
│ │ ├── MacroForEach.h
│ │ ├── MathAlgorithms.h
│ │ ├── Maybe.h
│ │ ├── MaybeOneOf.h
│ │ ├── MemoryChecking.h
│ │ ├── MemoryReporting.h
│ │ ├── Move.h
│ │ ├── NullPtr.h
│ │ ├── NumericLimits.h
│ │ ├── Pair.h
│ │ ├── PodOperations.h
│ │ ├── Poison.h
│ │ ├── Range.h
│ │ ├── RangedPtr.h
│ │ ├── ReentrancyGuard.h
│ │ ├── RefCountType.h
│ │ ├── RefPtr.h
│ │ ├── RollingMean.h
│ │ ├── SHA1.h
│ │ ├── Scoped.h
│ │ ├── SplayTree.h
│ │ ├── TaggedAnonymousMemory.h
│ │ ├── TemplateLib.h
│ │ ├── ThreadLocal.h
│ │ ├── ToString.h
│ │ ├── TypeTraits.h
│ │ ├── TypedEnum.h
│ │ ├── TypedEnumBits.h
│ │ ├── TypedEnumInternal.h
│ │ ├── Types.h
│ │ ├── UniquePtr.h
│ │ ├── Vector.h
│ │ ├── WeakPtr.h
│ │ ├── WindowsVersion.h
│ │ └── char16.h
│ ├── mozzconf.h
│ ├── zconf.h
│ └── zlib.h
└── lib
│ ├── mozjs-33.dll
│ └── mozjs-33.lib
└── src
├── jsbcc
├── main.cpp
└── makefile
/.gitignore:
--------------------------------------------------------------------------------
1 | # Ignore files build by xcode
2 | *.mode*v*
3 | *.pbxuser
4 | *.xcbkptlist
5 | *.xcworkspacedata
6 | *.xcuserstate
7 | *.xccheckout
8 | xcschememanagement.plist
9 | .DS_Store
10 | ._.*
11 | xcuserdata/
12 | DerivedData/
--------------------------------------------------------------------------------
/README.md:
--------------------------------------------------------------------------------
1 | JSCompiler
2 | ==========
3 |
4 | JavaScript Compiler for Cocos2d-x JavaScript Bindings.
5 |
--------------------------------------------------------------------------------
/__init__.pyc:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/cocos2d-html5/JSCompiler/ec3d96770ab6548378bb6979a0182b4404e4a18c/__init__.pyc
--------------------------------------------------------------------------------
/bin/compiler.jar:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/cocos2d-html5/JSCompiler/ec3d96770ab6548378bb6979a0182b4404e4a18c/bin/compiler.jar
--------------------------------------------------------------------------------
/bin/compiler_config_sample.json:
--------------------------------------------------------------------------------
1 | {
2 | "pre_order":
3 | [
4 | "script/jsb_cocos2d_constants.js",
5 | "script/jsb_cocos2d.js",
6 | "script/jsb_cocos2d_extension.js",
7 | "script/jsb_chipmunk_constants.js",
8 | "script/jsb_chipmunk.js",
9 | "script/jsb_opengl_constants.js",
10 | "script/jsb_opengl.js",
11 | "script/jsb_cocosbuilder.js",
12 | "script/jsb_sys.js",
13 | "script/jsb_cocos2d_studio.js",
14 | "script/jsb_cocos2d_gui.js",
15 | "script/jsb.js",
16 | "tests/tests_resources-jsb.js",
17 | "tests/tests-main.js",
18 | "tests/BaseTestLayer/BaseTestLayer.js",
19 | "tests/PerformanceTest/PerformanceTest.js",
20 | "tests/tests-boot-jsb.js"
21 | ],
22 | "post_order":
23 | [
24 |
25 | ],
26 | "skip":
27 | [
28 | "tests/main.js",
29 | "tests/tests_resources-html5.js",
30 | "tests/tests-boot-html5.js",
31 | "tests/AdvanceCompiler",
32 | "script/jsb_debugger.js",
33 | "script/debugger/"
34 | ],
35 | "closure_params": ""
36 | }
37 |
--------------------------------------------------------------------------------
/bin/jsbcc:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/cocos2d-html5/JSCompiler/ec3d96770ab6548378bb6979a0182b4404e4a18c/bin/jsbcc
--------------------------------------------------------------------------------
/bin/jsbcc.exe:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/cocos2d-html5/JSCompiler/ec3d96770ab6548378bb6979a0182b4404e4a18c/bin/jsbcc.exe
--------------------------------------------------------------------------------
/bin/linux/jsbcc_x64:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/cocos2d-html5/JSCompiler/ec3d96770ab6548378bb6979a0182b4404e4a18c/bin/linux/jsbcc_x64
--------------------------------------------------------------------------------
/bin/linux/jsbcc_x86:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/cocos2d-html5/JSCompiler/ec3d96770ab6548378bb6979a0182b4404e4a18c/bin/linux/jsbcc_x86
--------------------------------------------------------------------------------
/bin/mozjs-33.dll:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/cocos2d-html5/JSCompiler/ec3d96770ab6548378bb6979a0182b4404e4a18c/bin/mozjs-33.dll
--------------------------------------------------------------------------------
/jsbcc_source/README:
--------------------------------------------------------------------------------
1 | jsbcc stands for JavasSript Byte Code Compiler.
2 | It compiles javascript files to SpiderMonkey byte code files. It supports Mac and win32 now.
3 | Usage:
4 | jsbcc input_js_file [byte_code_file]
5 |
6 |
--------------------------------------------------------------------------------
/jsbcc_source/jsbcc-vc2012.sln:
--------------------------------------------------------------------------------
1 |
2 | Microsoft Visual Studio Solution File, Format Version 11.00
3 | # Visual Studio 2010
4 | Project("{8BC9CEB8-8B4A-11D0-8D11-00A0C91BC942}") = "jsbcc", "jsbcc-vc2012.vcxproj", "{BD6738AE-6468-4881-B32B-5749DCF95511}"
5 | EndProject
6 | Global
7 | GlobalSection(SolutionConfigurationPlatforms) = preSolution
8 | Debug|Win32 = Debug|Win32
9 | Release|Win32 = Release|Win32
10 | EndGlobalSection
11 | GlobalSection(ProjectConfigurationPlatforms) = postSolution
12 | {BD6738AE-6468-4881-B32B-5749DCF95511}.Debug|Win32.ActiveCfg = Debug|Win32
13 | {BD6738AE-6468-4881-B32B-5749DCF95511}.Debug|Win32.Build.0 = Debug|Win32
14 | {BD6738AE-6468-4881-B32B-5749DCF95511}.Release|Win32.ActiveCfg = Release|Win32
15 | {BD6738AE-6468-4881-B32B-5749DCF95511}.Release|Win32.Build.0 = Release|Win32
16 | EndGlobalSection
17 | GlobalSection(SolutionProperties) = preSolution
18 | HideSolutionNode = FALSE
19 | EndGlobalSection
20 | EndGlobal
21 |
--------------------------------------------------------------------------------
/jsbcc_source/jsbcc-vc2012.vcxproj.filters:
--------------------------------------------------------------------------------
1 |
2 |
3 |
4 |
5 | {4FC737F1-C7A5-4376-A066-2A32D752A2FF}
6 | cpp;c;cc;cxx;def;odl;idl;hpj;bat;asm;asmx
7 |
8 |
9 | {93995380-89BD-4b04-88EB-625FBE52EBFB}
10 | h;hpp;hxx;hm;inl;inc;xsd
11 |
12 |
13 | {67DA6AB6-F800-4c08-8B7A-83BB121AAD01}
14 | rc;ico;cur;bmp;dlg;rc2;rct;bin;rgs;gif;jpg;jpeg;jpe;resx;tiff;tif;png;wav;mfcribbon-ms
15 |
16 |
17 |
18 |
19 | Source Files
20 |
21 |
22 |
--------------------------------------------------------------------------------
/jsbcc_source/jsbcc-vc2012.vcxproj.user:
--------------------------------------------------------------------------------
1 |
2 |
3 |
--------------------------------------------------------------------------------
/jsbcc_source/jsbcc.xcodeproj/project.xcworkspace/contents.xcworkspacedata:
--------------------------------------------------------------------------------
1 |
2 |
4 |
6 |
7 |
8 |
--------------------------------------------------------------------------------
/jsbcc_source/jsbcc.xcodeproj/xcuserdata/panda.xcuserdatad/xcschemes/xcschememanagement.plist:
--------------------------------------------------------------------------------
1 |
2 |
3 |
4 |
5 | SchemeUserState
6 |
7 | jsbcc.xcscheme
8 |
9 | orderHint
10 | 0
11 |
12 |
13 | SuppressBuildableAutocreation
14 |
15 | 65797506172D6EBE000DDA7A
16 |
17 | primary
18 |
19 |
20 |
21 |
22 |
23 |
--------------------------------------------------------------------------------
/jsbcc_source/spidermonkey-linux/include/js-config.h:
--------------------------------------------------------------------------------
1 | /* -*- Mode: C; tab-width: 8; indent-tabs-mode: nil; c-basic-offset: 4 -*-
2 | * vim: set ts=8 sw=4 et tw=78:
3 | *
4 | * This Source Code Form is subject to the terms of the Mozilla Public
5 | * License, v. 2.0. If a copy of the MPL was not distributed with this
6 | * file, You can obtain one at http://mozilla.org/MPL/2.0/. */
7 |
8 | #ifndef js_config_h
9 | #define js_config_h
10 |
11 | /* Definitions set at build time that affect SpiderMonkey's public API.
12 | This header file is generated by the SpiderMonkey configure script,
13 | and installed along with jsapi.h. */
14 |
15 | /* Define to 1 if SpiderMonkey is in debug mode. */
16 | /* #undef JS_DEBUG */
17 |
18 | /* Define to 1 if SpiderMonkey should not use struct types in debug builds. */
19 | /* #undef JS_NO_JSVAL_JSID_STRUCT_TYPES */
20 |
21 | /* Define to 1 if SpiderMonkey should support multi-threaded clients. */
22 | /* #undef JS_THREADSAFE */
23 |
24 | /* Define to 1 if SpiderMonkey should include ctypes support. */
25 | /* #undef JS_HAS_CTYPES */
26 |
27 | /* Define to 1 if SpiderMonkey should support the ability to perform
28 | entirely too much GC. */
29 | /* #undef JS_GC_ZEAL */
30 |
31 | /* Define to 1 if the header is present and
32 | useable. See jscpucfg.h. */
33 | #define JS_HAVE_ENDIAN_H 1
34 |
35 | /* Define to 1 if the header is present and
36 | useable. See jscpucfg.h. */
37 | /* #undef JS_HAVE_MACHINE_ENDIAN_H */
38 |
39 | /* Define to 1 if the header is present and
40 | useable. See jscpucfg.h. */
41 | /* #undef JS_HAVE_SYS_ISA_DEFS_H */
42 |
43 | /* Define to 1 if SpiderMonkey is in NUNBOX32 mode. */
44 | /* #undef JS_NUNBOX32 */
45 |
46 | /* Define to 1 if SpiderMonkey is in PUNBOX64 mode. */
47 | #define JS_PUNBOX64 1
48 |
49 | /* MOZILLA JSAPI version number components */
50 | #define MOZJS_MAJOR_VERSION 33
51 | #define MOZJS_MINOR_VERSION 1
52 |
53 | #endif /* js_config_h */
54 |
--------------------------------------------------------------------------------
/jsbcc_source/spidermonkey-linux/include/js/Date.h:
--------------------------------------------------------------------------------
1 | /* -*- Mode: C++; tab-width: 8; indent-tabs-mode: nil; c-basic-offset: 4 -*- */
2 | /* This Source Code Form is subject to the terms of the Mozilla Public
3 | * License, v. 2.0. If a copy of the MPL was not distributed with this
4 | * file, You can obtain one at http://mozilla.org/MPL/2.0/. */
5 |
6 | #ifndef js_Date_h
7 | #define js_Date_h
8 |
9 | #include "jstypes.h"
10 |
11 | namespace JS {
12 |
13 | // Year is a year, month is 0-11, day is 1-based. The return value is
14 | // a number of milliseconds since the epoch. Can return NaN.
15 | JS_PUBLIC_API(double)
16 | MakeDate(double year, unsigned month, unsigned day);
17 |
18 | // Takes an integer number of milliseconds since the epoch and returns the
19 | // year. Can return NaN, and will do so if NaN is passed in.
20 | JS_PUBLIC_API(double)
21 | YearFromTime(double time);
22 |
23 | // Takes an integer number of milliseconds since the epoch and returns the
24 | // month (0-11). Can return NaN, and will do so if NaN is passed in.
25 | JS_PUBLIC_API(double)
26 | MonthFromTime(double time);
27 |
28 | // Takes an integer number of milliseconds since the epoch and returns the
29 | // day (1-based). Can return NaN, and will do so if NaN is passed in.
30 | JS_PUBLIC_API(double)
31 | DayFromTime(double time);
32 |
33 | } // namespace JS
34 |
35 | #endif /* js_Date_h */
36 |
--------------------------------------------------------------------------------
/jsbcc_source/spidermonkey-linux/include/js/LegacyIntTypes.h:
--------------------------------------------------------------------------------
1 | /* -*- Mode: C++; tab-width: 8; indent-tabs-mode: nil; c-basic-offset: 4 -*-
2 | * vim: set ts=8 sts=4 et sw=4 tw=99:
3 | * This Source Code Form is subject to the terms of the Mozilla Public
4 | * License, v. 2.0. If a copy of the MPL was not distributed with this
5 | * file, You can obtain one at http://mozilla.org/MPL/2.0/. */
6 |
7 | /*
8 | * This section typedefs the old 'native' types to the new types.
9 | * These redefinitions are provided solely to allow JSAPI users to more easily
10 | * transition to types. They are not to be used in the JSAPI, and
11 | * new JSAPI user code should not use them. This mapping file may eventually
12 | * be removed from SpiderMonkey, so don't depend on it in the long run.
13 | */
14 |
15 | /*
16 | * BEWARE: Comity with other implementers of these types is not guaranteed.
17 | * Indeed, if you use this header and third-party code defining these
18 | * types, *expect* to encounter either compile errors or link errors,
19 | * depending how these types are used and on the order of inclusion.
20 | * It is safest to use only the types.
21 | */
22 | #ifndef js_LegacyIntTypes_h
23 | #define js_LegacyIntTypes_h
24 |
25 | #include
26 |
27 | #include "js-config.h"
28 |
29 | typedef uint8_t uint8;
30 | typedef uint16_t uint16;
31 | typedef uint32_t uint32;
32 | typedef uint64_t uint64;
33 |
34 | /*
35 | * On AIX 4.3, sys/inttypes.h (which is included by sys/types.h, a very
36 | * common header file) defines the types int8, int16, int32, and int64.
37 | * So we don't define these four types here to avoid conflicts in case
38 | * the code also includes sys/types.h.
39 | */
40 | #if defined(AIX) && defined(HAVE_SYS_INTTYPES_H)
41 | #include
42 | #else
43 | typedef int8_t int8;
44 | typedef int16_t int16;
45 | typedef int32_t int32;
46 | typedef int64_t int64;
47 | #endif /* AIX && HAVE_SYS_INTTYPES_H */
48 |
49 | typedef uint8_t JSUint8;
50 | typedef uint16_t JSUint16;
51 | typedef uint32_t JSUint32;
52 | typedef uint64_t JSUint64;
53 |
54 | typedef int8_t JSInt8;
55 | typedef int16_t JSInt16;
56 | typedef int32_t JSInt32;
57 | typedef int64_t JSInt64;
58 |
59 | #endif /* js_LegacyIntTypes_h */
60 |
--------------------------------------------------------------------------------
/jsbcc_source/spidermonkey-linux/include/js/PropertyKey.h:
--------------------------------------------------------------------------------
1 | /* -*- Mode: C++; tab-width: 8; indent-tabs-mode: nil; c-basic-offset: 4 -*-
2 | * vim: set ts=8 sts=4 et sw=4 tw=99:
3 | * This Source Code Form is subject to the terms of the Mozilla Public
4 | * License, v. 2.0. If a copy of the MPL was not distributed with this
5 | * file, You can obtain one at http://mozilla.org/MPL/2.0/. */
6 |
7 | /* JS::PropertyKey implementation. */
8 |
9 | #ifndef js_PropertyKey_h
10 | #define js_PropertyKey_h
11 |
12 | #include "js/TypeDecls.h"
13 | #include "js/Value.h"
14 |
15 | namespace JS {
16 |
17 | class PropertyKey;
18 |
19 | namespace detail {
20 |
21 | extern JS_PUBLIC_API(bool)
22 | ToPropertyKeySlow(JSContext *cx, HandleValue v, PropertyKey *key);
23 |
24 | } // namespace detail
25 |
26 | /*
27 | * A PropertyKey is a key used to access some property on an object. It is a
28 | * natural way to represent a property accessed using a JavaScript value.
29 | *
30 | * PropertyKey can represent indexes, named properties, and ES6 symbols. The
31 | * latter aren't implemented in SpiderMonkey yet, but PropertyKey carves out
32 | * space for them.
33 | */
34 | class PropertyKey
35 | {
36 | Value v;
37 | friend JS_PUBLIC_API(bool) detail::ToPropertyKeySlow(JSContext *cx, HandleValue v, PropertyKey *key);
38 |
39 | public:
40 | explicit PropertyKey(uint32_t index) : v(PrivateUint32Value(index)) {}
41 |
42 | /*
43 | * An index is a string property name whose characters exactly spell out an
44 | * unsigned 32-bit integer in decimal: "0", "1", "2", ...., "4294967294",
45 | * "4294967295".
46 | */
47 | bool isIndex(uint32_t *index) {
48 | // The implementation here assumes that private uint32_t are stored
49 | // using the int32_t representation. This is purely an implementation
50 | // detail: embedders must not rely upon this!
51 | if (!v.isInt32())
52 | return false;
53 | *index = v.toPrivateUint32();
54 | return true;
55 | }
56 |
57 | /*
58 | * A name is a string property name which is *not* an index. Note that by
59 | * the ECMAScript language grammar, any dotted property access |obj.prop|
60 | * will access a named property.
61 | */
62 | bool isName(JSString **str) {
63 | uint32_t dummy;
64 | if (isIndex(&dummy))
65 | return false;
66 | *str = v.toString();
67 | return true;
68 | }
69 |
70 | /*
71 | * A symbol is a property name that's a Symbol, a particular kind of object
72 | * in ES6. It is the only kind of property name that's not a string.
73 | *
74 | * SpiderMonkey doesn't yet implement symbols, but we're carving out API
75 | * space for them in advance.
76 | */
77 | bool isSymbol() {
78 | return false;
79 | }
80 | };
81 |
82 | inline bool
83 | ToPropertyKey(JSContext *cx, HandleValue v, PropertyKey *key)
84 | {
85 | if (v.isInt32() && v.toInt32() >= 0) {
86 | *key = PropertyKey(uint32_t(v.toInt32()));
87 | return true;
88 | }
89 |
90 | return detail::ToPropertyKeySlow(cx, v, key);
91 | }
92 |
93 | } // namespace JS
94 |
95 | #endif /* js_PropertyKey_h */
96 |
--------------------------------------------------------------------------------
/jsbcc_source/spidermonkey-linux/include/js/RequiredDefines.h:
--------------------------------------------------------------------------------
1 | /* -*- Mode: C++; tab-width: 8; indent-tabs-mode: nil; c-basic-offset: 4 -*-
2 | * vim: set ts=8 sts=4 et sw=4 tw=99:
3 | * This Source Code Form is subject to the terms of the Mozilla Public
4 | * License, v. 2.0. If a copy of the MPL was not distributed with this
5 | * file, You can obtain one at http://mozilla.org/MPL/2.0/. */
6 |
7 | /*
8 | * Various #defines required to build SpiderMonkey. Embedders should add this
9 | * file to the start of the command line via -include or a similar mechanism,
10 | * or SpiderMonkey public headers may not work correctly.
11 | */
12 |
13 | #ifndef js_RequiredDefines_h
14 | #define js_RequiredDefines_h
15 |
16 | /*
17 | * The c99 defining the limit macros (UINT32_MAX for example), says:
18 | *
19 | * C++ implementations should define these macros only when
20 | * __STDC_LIMIT_MACROS is defined before is included.
21 | *
22 | * The same also occurs with __STDC_CONSTANT_MACROS for the constant macros
23 | * (INT8_C for example) used to specify a literal constant of the proper type,
24 | * and with __STDC_FORMAT_MACROS for the format macros (PRId32 for example) used
25 | * with the fprintf function family.
26 | */
27 | #define __STDC_LIMIT_MACROS
28 | #define __STDC_CONSTANT_MACROS
29 | #define __STDC_FORMAT_MACROS
30 |
31 | /* Also define a char16_t type if not provided by the compiler. */
32 | #include "mozilla/Char16.h"
33 |
34 | #endif /* js_RequiredDefines_h */
35 |
--------------------------------------------------------------------------------
/jsbcc_source/spidermonkey-linux/include/js/SliceBudget.h:
--------------------------------------------------------------------------------
1 | /* -*- Mode: C++; tab-width: 8; indent-tabs-mode: nil; c-basic-offset: 4 -*-
2 | * vim: set ts=8 sts=4 et sw=4 tw=99:
3 | * This Source Code Form is subject to the terms of the Mozilla Public
4 | * License, v. 2.0. If a copy of the MPL was not distributed with this
5 | * file, You can obtain one at http://mozilla.org/MPL/2.0/. */
6 |
7 | #ifndef js_SliceBudget_h
8 | #define js_SliceBudget_h
9 |
10 | #include
11 |
12 | namespace js {
13 |
14 | /*
15 | * This class records how much work has been done in a given collection slice, so that
16 | * we can return before pausing for too long. Some slices are allowed to run for
17 | * unlimited time, and others are bounded. To reduce the number of gettimeofday
18 | * calls, we only check the time every 1000 operations.
19 | */
20 | struct JS_PUBLIC_API(SliceBudget)
21 | {
22 | int64_t deadline; /* in microseconds */
23 | intptr_t counter;
24 |
25 | static const intptr_t CounterReset = 1000;
26 |
27 | static const int64_t Unlimited = 0;
28 | static int64_t TimeBudget(int64_t millis);
29 | static int64_t WorkBudget(int64_t work);
30 |
31 | /* Equivalent to SliceBudget(UnlimitedBudget). */
32 | SliceBudget();
33 |
34 | /* Instantiate as SliceBudget(Time/WorkBudget(n)). */
35 | explicit SliceBudget(int64_t budget);
36 |
37 | void reset() {
38 | deadline = unlimitedDeadline;
39 | counter = unlimitedStartCounter;
40 | }
41 |
42 | void step(intptr_t amt = 1) {
43 | counter -= amt;
44 | }
45 |
46 | bool checkOverBudget();
47 |
48 | bool isOverBudget() {
49 | if (counter >= 0)
50 | return false;
51 | return checkOverBudget();
52 | }
53 |
54 | bool isUnlimited() {
55 | return deadline == unlimitedDeadline;
56 | }
57 |
58 | private:
59 | static const int64_t unlimitedDeadline = INT64_MAX;
60 | static const intptr_t unlimitedStartCounter = INTPTR_MAX;
61 |
62 | };
63 |
64 | } // namespace js
65 |
66 | #endif /* js_SliceBudget_h */
67 |
--------------------------------------------------------------------------------
/jsbcc_source/spidermonkey-linux/include/js/TypeDecls.h:
--------------------------------------------------------------------------------
1 | /* -*- Mode: C++; tab-width: 8; indent-tabs-mode: nil; c-basic-offset: 4 -*-
2 | * vim: set ts=8 sts=4 et sw=4 tw=99:
3 | * This Source Code Form is subject to the terms of the Mozilla Public
4 | * License, v. 2.0. If a copy of the MPL was not distributed with this
5 | * file, You can obtain one at http://mozilla.org/MPL/2.0/. */
6 |
7 | // This file contains public type declarations that are used *frequently*. If
8 | // it doesn't occur at least 10 times in Gecko, it probably shouldn't be in
9 | // here.
10 | //
11 | // It includes only:
12 | // - forward declarations of structs and classes;
13 | // - typedefs;
14 | // - enums (maybe).
15 | // It does *not* contain any struct or class definitions.
16 |
17 | #ifndef js_TypeDecls_h
18 | #define js_TypeDecls_h
19 |
20 | #include
21 | #include
22 |
23 | #include "js-config.h"
24 |
25 | struct JSContext;
26 | class JSFunction;
27 | class JSObject;
28 | class JSScript;
29 | class JSString;
30 | class JSAddonId;
31 |
32 | struct jsid;
33 |
34 | typedef char16_t jschar;
35 |
36 | namespace JS {
37 |
38 | typedef unsigned char Latin1Char;
39 |
40 | class Symbol;
41 | class Value;
42 | template class Handle;
43 | template class MutableHandle;
44 | template class Rooted;
45 | template class PersistentRooted;
46 |
47 | typedef Handle HandleFunction;
48 | typedef Handle HandleId;
49 | typedef Handle HandleObject;
50 | typedef Handle HandleScript;
51 | typedef Handle HandleString;
52 | typedef Handle HandleSymbol;
53 | typedef Handle HandleValue;
54 |
55 | typedef MutableHandle MutableHandleFunction;
56 | typedef MutableHandle MutableHandleId;
57 | typedef MutableHandle MutableHandleObject;
58 | typedef MutableHandle MutableHandleScript;
59 | typedef MutableHandle MutableHandleString;
60 | typedef MutableHandle MutableHandleSymbol;
61 | typedef MutableHandle MutableHandleValue;
62 |
63 | typedef Rooted RootedObject;
64 | typedef Rooted RootedFunction;
65 | typedef Rooted RootedScript;
66 | typedef Rooted RootedString;
67 | typedef Rooted RootedSymbol;
68 | typedef Rooted RootedId;
69 | typedef Rooted RootedValue;
70 |
71 | typedef PersistentRooted PersistentRootedFunction;
72 | typedef PersistentRooted PersistentRootedId;
73 | typedef PersistentRooted PersistentRootedObject;
74 | typedef PersistentRooted PersistentRootedScript;
75 | typedef PersistentRooted PersistentRootedString;
76 | typedef PersistentRooted PersistentRootedSymbol;
77 | typedef PersistentRooted PersistentRootedValue;
78 |
79 | } // namespace JS
80 |
81 | #endif /* js_TypeDecls_h */
82 |
--------------------------------------------------------------------------------
/jsbcc_source/spidermonkey-linux/include/js/Vector.h:
--------------------------------------------------------------------------------
1 | /* -*- Mode: C++; tab-width: 8; indent-tabs-mode: nil; c-basic-offset: 4 -*-
2 | * vim: set ts=8 sts=4 et sw=4 tw=99:
3 | * This Source Code Form is subject to the terms of the Mozilla Public
4 | * License, v. 2.0. If a copy of the MPL was not distributed with this
5 | * file, You can obtain one at http://mozilla.org/MPL/2.0/. */
6 |
7 | #ifndef js_Vector_h
8 | #define js_Vector_h
9 |
10 | #include "mozilla/Vector.h"
11 |
12 | /* Silence dire "bugs in previous versions of MSVC have been fixed" warnings */
13 | #ifdef _MSC_VER
14 | #pragma warning(push)
15 | #pragma warning(disable:4345)
16 | #endif
17 |
18 | namespace js {
19 |
20 | class TempAllocPolicy;
21 |
22 | // If we had C++11 template aliases, we could just use this:
23 | //
24 | // template
27 | // using Vector = mozilla::Vector;
28 | //
29 | // ...and get rid of all the CRTP madness in mozilla::Vector(Base). But we
30 | // can't because compiler support's not up to snuff. (Template aliases are in
31 | // gcc 4.7 and clang 3.0 and are expected to be in MSVC 2013.) Instead, have a
32 | // completely separate class inheriting from mozilla::Vector, and throw CRTP at
33 | // the problem til things work.
34 | //
35 | // This workaround presents a couple issues. First, because js::Vector is a
36 | // distinct type from mozilla::Vector, overload resolution, method calls, etc.
37 | // are affected. *Hopefully* this won't be too bad in practice. (A bunch of
38 | // places had to be fixed when mozilla::Vector was introduced, but it wasn't a
39 | // crazy number.) Second, mozilla::Vector's interface has to be made subclass-
40 | // ready via CRTP -- or rather, via mozilla::VectorBase, which basically no one
41 | // should use. :-) Third, we have to redefine the constructors and the non-
42 | // inherited operators. Blech. Happily there aren't too many of these, so it
43 | // isn't the end of the world.
44 |
45 | template
48 | class Vector
49 | : public mozilla::VectorBase >
53 | {
54 | typedef typename mozilla::VectorBase Base;
55 |
56 | public:
57 | explicit Vector(AllocPolicy alloc = AllocPolicy()) : Base(alloc) {}
58 | Vector(Vector &&vec) : Base(mozilla::Move(vec)) {}
59 | Vector &operator=(Vector &&vec) {
60 | return Base::operator=(mozilla::Move(vec));
61 | }
62 | };
63 |
64 | } // namespace js
65 |
66 | #endif /* js_Vector_h */
67 |
--------------------------------------------------------------------------------
/jsbcc_source/spidermonkey-linux/include/js/WeakMapPtr.h:
--------------------------------------------------------------------------------
1 | /* -*- Mode: C++; tab-width: 8; indent-tabs-mode: nil; c-basic-offset: 4 -*-
2 | * vim: set ts=8 sts=4 et sw=4 tw=99:
3 | * This Source Code Form is subject to the terms of the Mozilla Public
4 | * License, v. 2.0. If a copy of the MPL was not distributed with this
5 | * file, You can obtain one at http://mozilla.org/MPL/2.0/. */
6 |
7 | #ifndef js_WeakMapPtr_h
8 | #define js_WeakMapPtr_h
9 |
10 | #include "jspubtd.h"
11 |
12 | #include "js/TypeDecls.h"
13 |
14 | namespace JS {
15 |
16 | // A wrapper around the internal C++ representation of SpiderMonkey WeakMaps,
17 | // usable outside the engine.
18 | //
19 | // The supported template specializations are enumerated in WeakMapPtr.cpp. If
20 | // you want to use this class for a different key/value combination, add it to
21 | // the list and the compiler will generate the relevant machinery.
22 | template
23 | class JS_PUBLIC_API(WeakMapPtr)
24 | {
25 | public:
26 | WeakMapPtr() : ptr(nullptr) {};
27 | bool init(JSContext *cx);
28 | bool initialized() { return ptr != nullptr; };
29 | void destroy();
30 | virtual ~WeakMapPtr() { MOZ_ASSERT(!initialized()); }
31 | void trace(JSTracer *tracer);
32 |
33 | V lookup(const K &key);
34 | bool put(JSContext *cx, const K &key, const V &value);
35 |
36 | static void keyMarkCallback(JSTracer *trc, K key, void *data);
37 |
38 | private:
39 | void *ptr;
40 |
41 | // WeakMapPtr is neither copyable nor assignable.
42 | WeakMapPtr(const WeakMapPtr &wmp) MOZ_DELETE;
43 | WeakMapPtr &operator=(const WeakMapPtr &wmp) MOZ_DELETE;
44 | };
45 |
46 | } /* namespace JS */
47 |
48 | #endif /* js_WeakMapPtr_h */
49 |
--------------------------------------------------------------------------------
/jsbcc_source/spidermonkey-linux/include/jsalloc.h:
--------------------------------------------------------------------------------
1 | /* -*- Mode: C++; tab-width: 8; indent-tabs-mode: nil; c-basic-offset: 4 -*-
2 | * vim: set ts=8 sts=4 et sw=4 tw=99:
3 | * This Source Code Form is subject to the terms of the Mozilla Public
4 | * License, v. 2.0. If a copy of the MPL was not distributed with this
5 | * file, You can obtain one at http://mozilla.org/MPL/2.0/. */
6 |
7 | /*
8 | * JS allocation policies.
9 | *
10 | * The allocators here are for system memory with lifetimes which are not
11 | * managed by the GC. See the comment at the top of vm/MallocProvider.h.
12 | */
13 |
14 | #ifndef jsalloc_h
15 | #define jsalloc_h
16 |
17 | #include "js/TypeDecls.h"
18 | #include "js/Utility.h"
19 |
20 | namespace js {
21 |
22 | struct ContextFriendFields;
23 |
24 | /* Policy for using system memory functions and doing no error reporting. */
25 | class SystemAllocPolicy
26 | {
27 | public:
28 | void *malloc_(size_t bytes) { return js_malloc(bytes); }
29 | void *calloc_(size_t bytes) { return js_calloc(bytes); }
30 | void *realloc_(void *p, size_t oldBytes, size_t bytes) { return js_realloc(p, bytes); }
31 | void free_(void *p) { js_free(p); }
32 | void reportAllocOverflow() const {}
33 | };
34 |
35 | /*
36 | * Allocation policy that calls the system memory functions and reports errors
37 | * to the context. Since the JSContext given on construction is stored for
38 | * the lifetime of the container, this policy may only be used for containers
39 | * whose lifetime is a shorter than the given JSContext.
40 | *
41 | * FIXME bug 647103 - rewrite this in terms of temporary allocation functions,
42 | * not the system ones.
43 | */
44 | class TempAllocPolicy
45 | {
46 | ContextFriendFields *const cx_;
47 |
48 | /*
49 | * Non-inline helper to call JSRuntime::onOutOfMemory with minimal
50 | * code bloat.
51 | */
52 | JS_FRIEND_API(void *) onOutOfMemory(void *p, size_t nbytes);
53 |
54 | public:
55 | MOZ_IMPLICIT TempAllocPolicy(JSContext *cx) : cx_((ContextFriendFields *) cx) {} // :(
56 | MOZ_IMPLICIT TempAllocPolicy(ContextFriendFields *cx) : cx_(cx) {}
57 |
58 | void *malloc_(size_t bytes) {
59 | void *p = js_malloc(bytes);
60 | if (MOZ_UNLIKELY(!p))
61 | p = onOutOfMemory(nullptr, bytes);
62 | return p;
63 | }
64 |
65 | void *calloc_(size_t bytes) {
66 | void *p = js_calloc(bytes);
67 | if (MOZ_UNLIKELY(!p))
68 | p = onOutOfMemory(nullptr, bytes);
69 | return p;
70 | }
71 |
72 | void *realloc_(void *p, size_t oldBytes, size_t bytes) {
73 | void *p2 = js_realloc(p, bytes);
74 | if (MOZ_UNLIKELY(!p2))
75 | p2 = onOutOfMemory(p2, bytes);
76 | return p2;
77 | }
78 |
79 | void free_(void *p) {
80 | js_free(p);
81 | }
82 |
83 | JS_FRIEND_API(void) reportAllocOverflow() const;
84 | };
85 |
86 | } /* namespace js */
87 |
88 | #endif /* jsalloc_h */
89 |
--------------------------------------------------------------------------------
/jsbcc_source/spidermonkey-linux/include/jsbytecode.h:
--------------------------------------------------------------------------------
1 | /* -*- Mode: C++; tab-width: 8; indent-tabs-mode: nil; c-basic-offset: 4 -*-
2 | * vim: set ts=8 sts=4 et sw=4 tw=99:
3 | * This Source Code Form is subject to the terms of the Mozilla Public
4 | * License, v. 2.0. If a copy of the MPL was not distributed with this
5 | * file, You can obtain one at http://mozilla.org/MPL/2.0/. */
6 |
7 | #ifndef jsbytecode_h
8 | #define jsbytecode_h
9 |
10 | #include
11 |
12 | typedef uint8_t jsbytecode;
13 |
14 | #endif /* jsbytecode_h */
15 |
--------------------------------------------------------------------------------
/jsbcc_source/spidermonkey-linux/include/jsprf.h:
--------------------------------------------------------------------------------
1 | /* -*- Mode: C++; tab-width: 8; indent-tabs-mode: nil; c-basic-offset: 4 -*-
2 | * vim: set ts=8 sts=4 et sw=4 tw=99:
3 | * This Source Code Form is subject to the terms of the Mozilla Public
4 | * License, v. 2.0. If a copy of the MPL was not distributed with this
5 | * file, You can obtain one at http://mozilla.org/MPL/2.0/. */
6 |
7 | #ifndef jsprf_h
8 | #define jsprf_h
9 |
10 | /*
11 | ** API for PR printf like routines. Supports the following formats
12 | ** %d - decimal
13 | ** %u - unsigned decimal
14 | ** %x - unsigned hex
15 | ** %X - unsigned uppercase hex
16 | ** %o - unsigned octal
17 | ** %hd, %hu, %hx, %hX, %ho - 16-bit versions of above
18 | ** %ld, %lu, %lx, %lX, %lo - 32-bit versions of above
19 | ** %lld, %llu, %llx, %llX, %llo - 64 bit versions of above
20 | ** %s - ascii string
21 | ** %hs - ucs2 string
22 | ** %c - character
23 | ** %p - pointer (deals with machine dependent pointer size)
24 | ** %f - float
25 | ** %g - float
26 | */
27 |
28 | #include
29 |
30 | #include "jstypes.h"
31 |
32 | /*
33 | ** sprintf into a fixed size buffer. Guarantees that a NUL is at the end
34 | ** of the buffer. Returns the length of the written output, NOT including
35 | ** the NUL, or (uint32_t)-1 if an error occurs.
36 | */
37 | extern JS_PUBLIC_API(uint32_t) JS_snprintf(char *out, uint32_t outlen, const char *fmt, ...);
38 |
39 | /*
40 | ** sprintf into a malloc'd buffer. Return a pointer to the malloc'd
41 | ** buffer on success, nullptr on failure. Call "JS_smprintf_free" to release
42 | ** the memory returned.
43 | */
44 | extern JS_PUBLIC_API(char*) JS_smprintf(const char *fmt, ...);
45 |
46 | /*
47 | ** Free the memory allocated, for the caller, by JS_smprintf
48 | */
49 | extern JS_PUBLIC_API(void) JS_smprintf_free(char *mem);
50 |
51 | /*
52 | ** "append" sprintf into a malloc'd buffer. "last" is the last value of
53 | ** the malloc'd buffer. sprintf will append data to the end of last,
54 | ** growing it as necessary using realloc. If last is nullptr, JS_sprintf_append
55 | ** will allocate the initial string. The return value is the new value of
56 | ** last for subsequent calls, or nullptr if there is a malloc failure.
57 | */
58 | extern JS_PUBLIC_API(char*) JS_sprintf_append(char *last, const char *fmt, ...);
59 |
60 | /*
61 | ** va_list forms of the above.
62 | */
63 | extern JS_PUBLIC_API(uint32_t) JS_vsnprintf(char *out, uint32_t outlen, const char *fmt, va_list ap);
64 | extern JS_PUBLIC_API(char*) JS_vsmprintf(const char *fmt, va_list ap);
65 | extern JS_PUBLIC_API(char*) JS_vsprintf_append(char *last, const char *fmt, va_list ap);
66 |
67 | #endif /* jsprf_h */
68 |
--------------------------------------------------------------------------------
/jsbcc_source/spidermonkey-linux/include/jsversion.h:
--------------------------------------------------------------------------------
1 | /* -*- Mode: C++; tab-width: 8; indent-tabs-mode: nil; c-basic-offset: 4 -*-
2 | * vim: set ts=8 sts=4 et sw=4 tw=99:
3 | * This Source Code Form is subject to the terms of the Mozilla Public
4 | * License, v. 2.0. If a copy of the MPL was not distributed with this
5 | * file, You can obtain one at http://mozilla.org/MPL/2.0/. */
6 |
7 | #ifndef jsversion_h
8 | #define jsversion_h
9 |
10 | /*
11 | * JS Capability Macros.
12 | */
13 | #define JS_HAS_STR_HTML_HELPERS 1 /* has str.anchor, str.bold, etc. */
14 | #define JS_HAS_OBJ_PROTO_PROP 1 /* has o.__proto__ etc. */
15 | #define JS_HAS_OBJ_WATCHPOINT 1 /* has o.watch and o.unwatch */
16 | #define JS_HAS_TOSOURCE 1 /* has Object/Array toSource method */
17 | #define JS_HAS_CATCH_GUARD 1 /* has exception handling catch guard */
18 | #define JS_HAS_UNEVAL 1 /* has uneval() top-level function */
19 | #define JS_HAS_CONST 1 /* has JS2 const as alternative var */
20 | #define JS_HAS_FUN_EXPR_STMT 1 /* has function expression statement */
21 | #define JS_HAS_NO_SUCH_METHOD 1 /* has o.__noSuchMethod__ handler */
22 | #define JS_HAS_FOR_EACH_IN 1 /* has for each (lhs in iterable) */
23 | #define JS_HAS_GENERATORS 1 /* has yield in generator function */
24 | #define JS_HAS_BLOCK_SCOPE 1 /* has block scope via let/arraycomp */
25 | #define JS_HAS_DESTRUCTURING 2 /* has [a,b] = ... or {p:a,q:b} = ... */
26 | #define JS_HAS_GENERATOR_EXPRS 1 /* has (expr for (lhs in iterable)) */
27 | #define JS_HAS_EXPR_CLOSURES 1 /* has function (formals) listexpr */
28 | #ifdef NIGHTLY_BUILD
29 | #define JS_HAS_TEMPLATE_STRINGS 1 /* has template string support */
30 | #endif
31 |
32 | /* Support for JS_NewGlobalObject. */
33 | #define JS_HAS_NEW_GLOBAL_OBJECT 1
34 |
35 | /* Support for JS_MakeSystemObject. */
36 | #define JS_HAS_MAKE_SYSTEM_OBJECT 1
37 |
38 | /* Feature-test macro for evolving destructuring support. */
39 | #define JS_HAS_DESTRUCTURING_SHORTHAND (JS_HAS_DESTRUCTURING == 2)
40 |
41 | /*
42 | * Feature for Object.prototype.__{define,lookup}{G,S}etter__ legacy support;
43 | * support likely to be made opt-in at some future time.
44 | */
45 | #define JS_OLD_GETTER_SETTER_METHODS 1
46 |
47 | /* Support for Symbols - Nightly-only for now. */
48 | #ifdef NIGHTLY_BUILD
49 | #define JS_HAS_SYMBOLS 1
50 | #endif
51 |
52 | #endif /* jsversion_h */
53 |
--------------------------------------------------------------------------------
/jsbcc_source/spidermonkey-linux/include/mozilla/AllocPolicy.h:
--------------------------------------------------------------------------------
1 | /* -*- Mode: C++; tab-width: 8; indent-tabs-mode: nil; c-basic-offset: 2 -*- */
2 | /* vim: set ts=8 sts=2 et sw=2 tw=80: */
3 | /* This Source Code Form is subject to the terms of the Mozilla Public
4 | * License, v. 2.0. If a copy of the MPL was not distributed with this
5 | * file, You can obtain one at http://mozilla.org/MPL/2.0/. */
6 |
7 | /*
8 | * An allocation policy concept, usable for structures and algorithms to
9 | * control how memory is allocated and how failures are handled.
10 | */
11 |
12 | #ifndef mozilla_AllocPolicy_h
13 | #define mozilla_AllocPolicy_h
14 |
15 | #include
16 | #include
17 |
18 | namespace mozilla {
19 |
20 | /*
21 | * Allocation policies are used to implement the standard allocation behaviors
22 | * in a customizable way. Additionally, custom behaviors may be added to these
23 | * behaviors, such as additionally reporting an error through an out-of-band
24 | * mechanism when OOM occurs. The concept modeled here is as follows:
25 | *
26 | * - public copy constructor, assignment, destructor
27 | * - void* malloc_(size_t)
28 | * Responsible for OOM reporting when null is returned.
29 | * - void* calloc_(size_t)
30 | * Responsible for OOM reporting when null is returned.
31 | * - void* realloc_(void*, size_t, size_t)
32 | * Responsible for OOM reporting when null is returned. The *used* bytes
33 | * of the previous buffer is passed in (rather than the old allocation
34 | * size), in addition to the *new* allocation size requested.
35 | * - void free_(void*)
36 | * - void reportAllocOverflow() const
37 | * Called on allocation overflow (that is, an allocation implicitly tried
38 | * to allocate more than the available memory space -- think allocating an
39 | * array of large-size objects, where N * size overflows) before null is
40 | * returned.
41 | *
42 | * mfbt provides (and typically uses by default) only MallocAllocPolicy, which
43 | * does nothing more than delegate to the malloc/alloc/free functions.
44 | */
45 |
46 | /*
47 | * A policy that straightforwardly uses malloc/calloc/realloc/free and adds no
48 | * extra behaviors.
49 | */
50 | class MallocAllocPolicy
51 | {
52 | public:
53 | void* malloc_(size_t aBytes)
54 | {
55 | return malloc(aBytes);
56 | }
57 |
58 | void* calloc_(size_t aBytes)
59 | {
60 | return calloc(aBytes, 1);
61 | }
62 |
63 | void* realloc_(void* aPtr, size_t aOldBytes, size_t aBytes)
64 | {
65 | return realloc(aPtr, aBytes);
66 | }
67 |
68 | void free_(void* aPtr)
69 | {
70 | free(aPtr);
71 | }
72 |
73 | void reportAllocOverflow() const
74 | {
75 | }
76 | };
77 |
78 | } // namespace mozilla
79 |
80 | #endif /* mozilla_AllocPolicy_h */
81 |
--------------------------------------------------------------------------------
/jsbcc_source/spidermonkey-linux/include/mozilla/Array.h:
--------------------------------------------------------------------------------
1 | /* -*- Mode: C++; tab-width: 8; indent-tabs-mode: nil; c-basic-offset: 2 -*- */
2 | /* vim: set ts=8 sts=2 et sw=2 tw=80: */
3 | /* This Source Code Form is subject to the terms of the Mozilla Public
4 | * License, v. 2.0. If a copy of the MPL was not distributed with this
5 | * file, You can obtain one at http://mozilla.org/MPL/2.0/. */
6 |
7 | /* A compile-time constant-length array with bounds-checking assertions. */
8 |
9 | #ifndef mozilla_Array_h
10 | #define mozilla_Array_h
11 |
12 | #include "mozilla/Assertions.h"
13 | #include "mozilla/Attributes.h"
14 |
15 | #include
16 |
17 | namespace mozilla {
18 |
19 | template
20 | class Array
21 | {
22 | T mArr[Length];
23 |
24 | public:
25 | T& operator[](size_t aIndex)
26 | {
27 | MOZ_ASSERT(aIndex < Length);
28 | return mArr[aIndex];
29 | }
30 |
31 | const T& operator[](size_t aIndex) const
32 | {
33 | MOZ_ASSERT(aIndex < Length);
34 | return mArr[aIndex];
35 | }
36 | };
37 |
38 | template
39 | class Array
40 | {
41 | public:
42 | T& operator[](size_t aIndex)
43 | {
44 | MOZ_CRASH("indexing into zero-length array");
45 | }
46 |
47 | const T& operator[](size_t aIndex) const
48 | {
49 | MOZ_CRASH("indexing into zero-length array");
50 | }
51 | };
52 |
53 | } /* namespace mozilla */
54 |
55 | #endif /* mozilla_Array_h */
56 |
--------------------------------------------------------------------------------
/jsbcc_source/spidermonkey-linux/include/mozilla/BinarySearch.h:
--------------------------------------------------------------------------------
1 | /* -*- Mode: C++; tab-width: 8; indent-tabs-mode: nil; c-basic-offset: 2 -*- */
2 | /* vim: set ts=8 sts=2 et sw=2 tw=80: */
3 | /* This Source Code Form is subject to the terms of the Mozilla Public
4 | * License, v. 2.0. If a copy of the MPL was not distributed with this
5 | * file, You can obtain one at http://mozilla.org/MPL/2.0/. */
6 |
7 | #ifndef mozilla_BinarySearch_h
8 | #define mozilla_BinarySearch_h
9 |
10 | #include "mozilla/Assertions.h"
11 |
12 | #include
13 |
14 | namespace mozilla {
15 |
16 | /*
17 | * The algorithm searches the given container |aContainer| over the sorted
18 | * index range [aBegin, aEnd) for an index |i| where |aContainer[i] == aTarget|.
19 | * If such an index |i| is found, BinarySearch returns |true| and the index is
20 | * returned via the outparam |aMatchOrInsertionPoint|. If no index is found,
21 | * BinarySearch returns |false| and the outparam returns the first index in
22 | * [aBegin, aEnd] where |aTarget| can be inserted to maintain sorted order.
23 | *
24 | * Example:
25 | *
26 | * Vector sortedInts = ...
27 | *
28 | * size_t match;
29 | * if (BinarySearch(sortedInts, 0, sortedInts.length(), 13, &match)) {
30 | * printf("found 13 at %lu\n", match);
31 | * }
32 | */
33 |
34 | template
35 | bool
36 | BinarySearch(const Container& aContainer, size_t aBegin, size_t aEnd,
37 | T aTarget, size_t* aMatchOrInsertionPoint)
38 | {
39 | MOZ_ASSERT(aBegin <= aEnd);
40 |
41 | size_t low = aBegin;
42 | size_t high = aEnd;
43 | while (low != high) {
44 | size_t middle = low + (high - low) / 2;
45 |
46 | // Allow any intermediate type so long as it provides a suitable ordering
47 | // relation.
48 | const auto& middleValue = aContainer[middle];
49 |
50 | MOZ_ASSERT(aContainer[low] <= aContainer[middle]);
51 | MOZ_ASSERT(aContainer[middle] <= aContainer[high - 1]);
52 | MOZ_ASSERT(aContainer[low] <= aContainer[high - 1]);
53 |
54 | if (aTarget == middleValue) {
55 | *aMatchOrInsertionPoint = middle;
56 | return true;
57 | }
58 |
59 | if (aTarget < middleValue) {
60 | high = middle;
61 | } else {
62 | low = middle + 1;
63 | }
64 | }
65 |
66 | *aMatchOrInsertionPoint = low;
67 | return false;
68 | }
69 |
70 | } // namespace mozilla
71 |
72 | #endif // mozilla_BinarySearch_h
73 |
--------------------------------------------------------------------------------
/jsbcc_source/spidermonkey-linux/include/mozilla/ChaosMode.h:
--------------------------------------------------------------------------------
1 | /* -*- Mode: C++; tab-width: 8; indent-tabs-mode: nil; c-basic-offset: 2 -*- */
2 | /* vim: set ts=8 sts=2 et sw=2 tw=80: */
3 | /* This Source Code Form is subject to the terms of the Mozilla Public
4 | * License, v. 2.0. If a copy of the MPL was not distributed with this
5 | * file, You can obtain one at http://mozilla.org/MPL/2.0/. */
6 |
7 | #ifndef mozilla_ChaosMode_h
8 | #define mozilla_ChaosMode_h
9 |
10 | #include
11 | #include
12 |
13 | namespace mozilla {
14 |
15 | /**
16 | * When "chaos mode" is activated, code that makes implicitly nondeterministic
17 | * choices is encouraged to make random and extreme choices, to test more
18 | * code paths and uncover bugs.
19 | */
20 | class ChaosMode
21 | {
22 | public:
23 | static bool isActive()
24 | {
25 | // Flip this to true to activate chaos mode
26 | return false;
27 | }
28 |
29 | /**
30 | * Returns a somewhat (but not uniformly) random uint32_t < aBound.
31 | * Not to be used for anything except ChaosMode, since it's not very random.
32 | */
33 | static uint32_t randomUint32LessThan(uint32_t aBound)
34 | {
35 | return uint32_t(rand()) % aBound;
36 | }
37 | };
38 |
39 | } /* namespace mozilla */
40 |
41 | #endif /* mozilla_ChaosMode_h */
42 |
--------------------------------------------------------------------------------
/jsbcc_source/spidermonkey-linux/include/mozilla/Constants.h:
--------------------------------------------------------------------------------
1 | /* -*- Mode: C++; tab-width: 8; indent-tabs-mode: nil; c-basic-offset: 2 -*- */
2 | /* vim: set ts=8 sts=2 et sw=2 tw=80: */
3 | /* This Source Code Form is subject to the terms of the Mozilla Public
4 | * License, v. 2.0. If a copy of the MPL was not distributed with this
5 | * file, You can obtain one at http://mozilla.org/MPL/2.0/. */
6 |
7 | /* mfbt math constants. */
8 |
9 | #ifndef mozilla_Constants_h
10 | #define mozilla_Constants_h
11 |
12 | #ifndef M_PI
13 | # define M_PI 3.14159265358979323846
14 | #endif
15 |
16 | #endif /* mozilla_Constants_h */
17 |
--------------------------------------------------------------------------------
/jsbcc_source/spidermonkey-linux/include/mozilla/DebugOnly.h:
--------------------------------------------------------------------------------
1 | /* -*- Mode: C++; tab-width: 8; indent-tabs-mode: nil; c-basic-offset: 2 -*- */
2 | /* vim: set ts=8 sts=2 et sw=2 tw=80: */
3 | /* This Source Code Form is subject to the terms of the Mozilla Public
4 | * License, v. 2.0. If a copy of the MPL was not distributed with this
5 | * file, You can obtain one at http://mozilla.org/MPL/2.0/. */
6 |
7 | /*
8 | * Provides DebugOnly, a type for variables used only in debug builds (i.e. by
9 | * assertions).
10 | */
11 |
12 | #ifndef mozilla_DebugOnly_h
13 | #define mozilla_DebugOnly_h
14 |
15 | #include "mozilla/Attributes.h"
16 |
17 | namespace mozilla {
18 |
19 | /**
20 | * DebugOnly contains a value of type T, but only in debug builds. In release
21 | * builds, it does not contain a value. This helper is intended to be used with
22 | * MOZ_ASSERT()-style macros, allowing one to write:
23 | *
24 | * DebugOnly check = func();
25 | * MOZ_ASSERT(check);
26 | *
27 | * more concisely than declaring |check| conditional on #ifdef DEBUG, but also
28 | * without allocating storage space for |check| in release builds.
29 | *
30 | * DebugOnly instances can only be coerced to T in debug builds. In release
31 | * builds they don't have a value, so type coercion is not well defined.
32 | *
33 | * Note that DebugOnly instances still take up one byte of space, plus padding,
34 | * when used as members of structs.
35 | */
36 | template
37 | class DebugOnly
38 | {
39 | public:
40 | #ifdef DEBUG
41 | T value;
42 |
43 | DebugOnly() { }
44 | MOZ_IMPLICIT DebugOnly(const T& aOther) : value(aOther) { }
45 | DebugOnly(const DebugOnly& aOther) : value(aOther.value) { }
46 | DebugOnly& operator=(const T& aRhs) {
47 | value = aRhs;
48 | return *this;
49 | }
50 |
51 | void operator++(int) { value++; }
52 | void operator--(int) { value--; }
53 |
54 | T* operator&() { return &value; }
55 |
56 | operator T&() { return value; }
57 | operator const T&() const { return value; }
58 |
59 | T& operator->() { return value; }
60 | const T& operator->() const { return value; }
61 |
62 | #else
63 | DebugOnly() { }
64 | MOZ_IMPLICIT DebugOnly(const T&) { }
65 | DebugOnly(const DebugOnly&) { }
66 | DebugOnly& operator=(const T&) { return *this; }
67 | void operator++(int) { }
68 | void operator--(int) { }
69 | #endif
70 |
71 | /*
72 | * DebugOnly must always have a destructor or else it will
73 | * generate "unused variable" warnings, exactly what it's intended
74 | * to avoid!
75 | */
76 | ~DebugOnly() {}
77 | };
78 |
79 | }
80 |
81 | #endif /* mozilla_DebugOnly_h */
82 |
--------------------------------------------------------------------------------
/jsbcc_source/spidermonkey-linux/include/mozilla/EnumeratedArray.h:
--------------------------------------------------------------------------------
1 | /* -*- Mode: C++; tab-width: 8; indent-tabs-mode: nil; c-basic-offset: 2 -*- */
2 | /* vim: set ts=8 sts=2 et sw=2 tw=80: */
3 | /* This Source Code Form is subject to the terms of the Mozilla Public
4 | * License, v. 2.0. If a copy of the MPL was not distributed with this
5 | * file, You can obtain one at http://mozilla.org/MPL/2.0/. */
6 |
7 | /* EnumeratedArray is like Array, but indexed by a typed enum. */
8 |
9 | #ifndef mozilla_EnumeratedArray_h
10 | #define mozilla_EnumeratedArray_h
11 |
12 | #include "mozilla/Array.h"
13 | #include "mozilla/TypedEnum.h"
14 |
15 | namespace mozilla {
16 |
17 | /**
18 | * EnumeratedArray is a fixed-size array container for use when an
19 | * array is indexed by a specific enum class, as currently implemented
20 | * by MOZ_BEGIN_ENUM_CLASS.
21 | *
22 | * This provides type safety by guarding at compile time against accidentally
23 | * indexing such arrays with unrelated values. This also removes the need
24 | * for manual casting when using a typed enum value to index arrays.
25 | *
26 | * Aside from the typing of indices, EnumeratedArray is similar to Array.
27 | *
28 | * Example:
29 | *
30 | * MOZ_BEGIN_ENUM_CLASS(AnimalSpecies)
31 | * Cow,
32 | * Sheep,
33 | * Count
34 | * MOZ_END_ENUM_CLASS(AnimalSpecies)
35 | *
36 | * EnumeratedArray headCount;
37 | *
38 | * headCount[AnimalSpecies::Cow] = 17;
39 | * headCount[AnimalSpecies::Sheep] = 30;
40 | *
41 | */
42 | template
45 | class EnumeratedArray
46 | {
47 | public:
48 | static const size_t kSize = size_t(SizeAsEnumValue);
49 |
50 | private:
51 | Array mArray;
52 |
53 | public:
54 | EnumeratedArray() {}
55 |
56 | explicit EnumeratedArray(const EnumeratedArray& aOther)
57 | {
58 | for (size_t i = 0; i < kSize; i++) {
59 | mArray[i] = aOther.mArray[i];
60 | }
61 | }
62 |
63 | ValueType& operator[](IndexType aIndex)
64 | {
65 | return mArray[size_t(aIndex)];
66 | }
67 |
68 | const ValueType& operator[](IndexType aIndex) const
69 | {
70 | return mArray[size_t(aIndex)];
71 | }
72 | };
73 |
74 | } // namespace mozilla
75 |
76 | #endif // mozilla_EnumeratedArray_h
77 |
--------------------------------------------------------------------------------
/jsbcc_source/spidermonkey-linux/include/mozilla/IntegerPrintfMacros.h:
--------------------------------------------------------------------------------
1 | /* -*- Mode: C++; tab-width: 8; indent-tabs-mode: nil; c-basic-offset: 2 -*- */
2 | /* vim: set ts=8 sts=2 et sw=2 tw=80: */
3 | /* This Source Code Form is subject to the terms of the Mozilla Public
4 | * License, v. 2.0. If a copy of the MPL was not distributed with this
5 | * file, You can obtain one at http://mozilla.org/MPL/2.0/. */
6 |
7 | /* Implements the C99 interface, minus the SCN* format macros. */
8 |
9 | #ifndef mozilla_IntegerPrintfMacros_h_
10 | #define mozilla_IntegerPrintfMacros_h_
11 |
12 | /*
13 | * MSVC++ doesn't include , even in versions shipping , so
14 | * we have to reimplement it there. Note: #includes .
15 | *
16 | * Note that this header DOES NOT implement 's scanf macros. MSVC's
17 | * scanf doesn't have sufficient format specifier support to implement them
18 | * (specifically, to implement scanning into an 8-bit location).
19 | *
20 | * http://stackoverflow.com/questions/3036396/scanfd-char-char-as-int-format-string
21 | *
22 | * Moreover, scanf is a footgun: if the input number exceeds the bounds of the
23 | * target type, behavior is undefined (in the compiler sense: that is, this code
24 | * could overwrite your hard drive with zeroes):
25 | *
26 | * uint8_t u;
27 | * sscanf("256", "%" SCNu8, &u); // BAD
28 | *
29 | * This header will sometimes provide SCN* macros, by dint of being implemented
30 | * using . But for these reasons, *never* use them!
31 | */
32 |
33 | #if defined(MOZ_CUSTOM_INTTYPES_H)
34 | # include MOZ_CUSTOM_INTTYPES_H
35 | #elif defined(_MSC_VER)
36 | # include "mozilla/MSIntTypes.h"
37 | #else
38 | # include
39 | #endif
40 |
41 | /*
42 | * Fix up Android's broken [u]intptr_t inttype macros. Android's PRI*PTR
43 | * macros are defined as "ld", but sizeof(long) is 8 and sizeof(intptr_t)
44 | * is 4 on 32-bit Android. TestTypeTraits.cpp asserts that these new macro
45 | * definitions match the actual type sizes seen at compile time.
46 | */
47 | #if defined(ANDROID) && !defined(__LP64__)
48 | # undef PRIdPTR /* intptr_t */
49 | # define PRIdPTR "d" /* intptr_t */
50 | # undef PRIiPTR /* intptr_t */
51 | # define PRIiPTR "i" /* intptr_t */
52 | # undef PRIoPTR /* uintptr_t */
53 | # define PRIoPTR "o" /* uintptr_t */
54 | # undef PRIuPTR /* uintptr_t */
55 | # define PRIuPTR "u" /* uintptr_t */
56 | # undef PRIxPTR /* uintptr_t */
57 | # define PRIxPTR "x" /* uintptr_t */
58 | # undef PRIXPTR /* uintptr_t */
59 | # define PRIXPTR "X" /* uintptr_t */
60 | #endif
61 |
62 | #endif /* mozilla_IntegerPrintfMacros_h_ */
63 |
--------------------------------------------------------------------------------
/jsbcc_source/spidermonkey-linux/include/mozilla/Likely.h:
--------------------------------------------------------------------------------
1 | /* -*- Mode: C++; tab-width: 8; indent-tabs-mode: nil; c-basic-offset: 2 -*- */
2 | /* vim: set ts=8 sts=2 et sw=2 tw=80: */
3 | /* This Source Code Form is subject to the terms of the Mozilla Public
4 | * License, v. 2.0. If a copy of the MPL was not distributed with this
5 | * file, You can obtain one at http://mozilla.org/MPL/2.0/. */
6 |
7 | /*
8 | * MOZ_LIKELY and MOZ_UNLIKELY macros to hint to the compiler how a
9 | * boolean predicate should be branch-predicted.
10 | */
11 |
12 | #ifndef mozilla_Likely_h
13 | #define mozilla_Likely_h
14 |
15 | #if defined(__clang__) || defined(__GNUC__)
16 | # define MOZ_LIKELY(x) (__builtin_expect(!!(x), 1))
17 | # define MOZ_UNLIKELY(x) (__builtin_expect(!!(x), 0))
18 | #else
19 | # define MOZ_LIKELY(x) (!!(x))
20 | # define MOZ_UNLIKELY(x) (!!(x))
21 | #endif
22 |
23 | #endif /* mozilla_Likely_h */
24 |
--------------------------------------------------------------------------------
/jsbcc_source/spidermonkey-linux/include/mozilla/LinuxSignal.h:
--------------------------------------------------------------------------------
1 | /* This Source Code Form is subject to the terms of the Mozilla Public
2 | * License, v. 2.0. If a copy of the MPL was not distributed with this
3 | * file, You can obtain one at http://mozilla.org/MPL/2.0/. */
4 |
5 | #ifndef mozilla_LinuxSignal_h
6 | #define mozilla_LinuxSignal_h
7 |
8 | namespace mozilla {
9 |
10 | #if defined(__arm__)
11 |
12 | // Some (old) Linux kernels on ARM have a bug where a signal handler
13 | // can be called without clearing the IT bits in CPSR first. The result
14 | // is that the first few instructions of the handler could be skipped,
15 | // ultimately resulting in crashes. To workaround this bug, the handler
16 | // on ARM is a trampoline that starts with enough NOP instructions, so
17 | // that even if the IT bits are not cleared, only the NOP instructions
18 | // will be skipped over.
19 |
20 | template
21 | __attribute__((naked)) void
22 | SignalTrampoline(int aSignal, siginfo_t* aInfo, void* aContext)
23 | {
24 | asm volatile (
25 | "nop; nop; nop; nop"
26 | : : : "memory");
27 |
28 | // Because the assembler may generate additional insturctions below, we
29 | // need to ensure NOPs are inserted first by separating them out above.
30 |
31 | asm volatile (
32 | "bx %0"
33 | :
34 | : "r"(H), "l"(aSignal), "l"(aInfo), "l"(aContext)
35 | : "memory");
36 | }
37 |
38 | # define MOZ_SIGNAL_TRAMPOLINE(h) (mozilla::SignalTrampoline)
39 |
40 | #else // __arm__
41 |
42 | # define MOZ_SIGNAL_TRAMPOLINE(h) (h)
43 |
44 | #endif // __arm__
45 |
46 | } // namespace mozilla
47 |
48 | #endif // mozilla_LinuxSignal_h
49 |
--------------------------------------------------------------------------------
/jsbcc_source/spidermonkey-linux/include/mozilla/MemoryChecking.h:
--------------------------------------------------------------------------------
1 | /* -*- Mode: C++; tab-width: 8; indent-tabs-mode: nil; c-basic-offset: 2 -*- */
2 | /* vim: set ts=8 sts=2 et sw=2 tw=80: */
3 | /* This Source Code Form is subject to the terms of the Mozilla Public
4 | * License, v. 2.0. If a copy of the MPL was not distributed with this
5 | * file, You can obtain one at http://mozilla.org/MPL/2.0/. */
6 |
7 | /*
8 | * Provides a common interface to the ASan (AddressSanitizer) and Valgrind
9 | * functions used to mark memory in certain ways. In detail, the following
10 | * three macros are provided:
11 | *
12 | * MOZ_MAKE_MEM_NOACCESS - Mark memory as unsafe to access (e.g. freed)
13 | * MOZ_MAKE_MEM_UNDEFINED - Mark memory as accessible, with content undefined
14 | * MOZ_MAKE_MEM_DEFINED - Mark memory as accessible, with content defined
15 | *
16 | * With Valgrind in use, these directly map to the three respective Valgrind
17 | * macros. With ASan in use, the NOACCESS macro maps to poisoning the memory,
18 | * while the UNDEFINED/DEFINED macros unpoison memory.
19 | *
20 | * With no memory checker available, all macros expand to the empty statement.
21 | */
22 |
23 | #ifndef mozilla_MemoryChecking_h
24 | #define mozilla_MemoryChecking_h
25 |
26 | #if defined(MOZ_VALGRIND)
27 | #include "valgrind/memcheck.h"
28 | #endif
29 |
30 | #if defined(MOZ_ASAN) || defined(MOZ_VALGRIND)
31 | #define MOZ_HAVE_MEM_CHECKS 1
32 | #endif
33 |
34 | #if defined(MOZ_ASAN)
35 | #include
36 |
37 | #include "mozilla/Types.h"
38 |
39 | extern "C" {
40 | /* These definitions are usually provided through the
41 | * sanitizer/asan_interface.h header installed by ASan.
42 | */
43 | void MOZ_EXPORT __asan_poison_memory_region(void const volatile *addr, size_t size);
44 | void MOZ_EXPORT __asan_unpoison_memory_region(void const volatile *addr, size_t size);
45 |
46 | #define MOZ_MAKE_MEM_NOACCESS(addr, size) \
47 | __asan_poison_memory_region((addr), (size))
48 |
49 | #define MOZ_MAKE_MEM_UNDEFINED(addr, size) \
50 | __asan_unpoison_memory_region((addr), (size))
51 |
52 | #define MOZ_MAKE_MEM_DEFINED(addr, size) \
53 | __asan_unpoison_memory_region((addr), (size))
54 | }
55 | #elif defined(MOZ_VALGRIND)
56 | #define MOZ_MAKE_MEM_NOACCESS(addr, size) \
57 | VALGRIND_MAKE_MEM_NOACCESS((addr), (size))
58 |
59 | #define MOZ_MAKE_MEM_UNDEFINED(addr, size) \
60 | VALGRIND_MAKE_MEM_UNDEFINED((addr), (size))
61 |
62 | #define MOZ_MAKE_MEM_DEFINED(addr, size) \
63 | VALGRIND_MAKE_MEM_DEFINED((addr), (size))
64 | #else
65 |
66 | #define MOZ_MAKE_MEM_NOACCESS(addr, size) do {} while (0)
67 | #define MOZ_MAKE_MEM_UNDEFINED(addr, size) do {} while (0)
68 | #define MOZ_MAKE_MEM_DEFINED(addr, size) do {} while (0)
69 |
70 | #endif
71 |
72 | #endif /* mozilla_MemoryChecking_h */
73 |
--------------------------------------------------------------------------------
/jsbcc_source/spidermonkey-linux/include/mozilla/MemoryReporting.h:
--------------------------------------------------------------------------------
1 | /* -*- Mode: C++; tab-width: 8; indent-tabs-mode: nil; c-basic-offset: 2 -*- */
2 | /* vim: set ts=8 sts=2 et sw=2 tw=80: */
3 | /* This Source Code Form is subject to the terms of the Mozilla Public
4 | * License, v. 2.0. If a copy of the MPL was not distributed with this
5 | * file, You can obtain one at http://mozilla.org/MPL/2.0/. */
6 |
7 | /* Memory reporting infrastructure. */
8 |
9 | #ifndef mozilla_MemoryReporting_h
10 | #define mozilla_MemoryReporting_h
11 |
12 | #include
13 |
14 | #ifdef __cplusplus
15 |
16 | namespace mozilla {
17 |
18 | /*
19 | * This is for functions that are like malloc_usable_size. Such functions are
20 | * used for measuring the size of data structures.
21 | */
22 | typedef size_t (*MallocSizeOf)(const void* p);
23 |
24 | } /* namespace mozilla */
25 |
26 | #endif /* __cplusplus */
27 |
28 | typedef size_t (*MozMallocSizeOf)(const void* p);
29 |
30 | #endif /* mozilla_MemoryReporting_h */
31 |
--------------------------------------------------------------------------------
/jsbcc_source/spidermonkey-linux/include/mozilla/NumericLimits.h:
--------------------------------------------------------------------------------
1 | /* -*- Mode: C++; tab-width: 8; indent-tabs-mode: nil; c-basic-offset: 2 -*- */
2 | /* vim: set ts=8 sts=2 et sw=2 tw=80: */
3 | /* This Source Code Form is subject to the terms of the Mozilla Public
4 | * License, v. 2.0. If a copy of the MPL was not distributed with this
5 | * file, You can obtain one at http://mozilla.org/MPL/2.0/. */
6 |
7 | /* Compatibility with std::numeric_limits. */
8 |
9 | #ifndef mozilla_NumericLimits_h
10 | #define mozilla_NumericLimits_h
11 |
12 | #include "mozilla/Char16.h"
13 |
14 | #include
15 | #include
16 |
17 | namespace mozilla {
18 |
19 | /**
20 | * The NumericLimits class provides a compatibility layer with
21 | * std::numeric_limits for char16_t, otherwise it is exactly the same as
22 | * std::numeric_limits. Code which does not need std::numeric_limits
23 | * should avoid using NumericLimits.
24 | */
25 | template
26 | class NumericLimits : public std::numeric_limits
27 | {
28 | };
29 |
30 | #ifdef MOZ_CHAR16_IS_NOT_WCHAR
31 | template<>
32 | class NumericLimits : public std::numeric_limits
33 | {
34 | // char16_t and uint16_t numeric limits should be exactly the same.
35 | };
36 | #endif
37 |
38 | } // namespace mozilla
39 |
40 | #endif /* mozilla_NumericLimits_h */
41 |
--------------------------------------------------------------------------------
/jsbcc_source/spidermonkey-linux/include/mozilla/Poison.h:
--------------------------------------------------------------------------------
1 | /* -*- Mode: C++; tab-width: 8; indent-tabs-mode: nil; c-basic-offset: 2 -*- */
2 | /* vim: set ts=8 sts=2 et sw=2 tw=80: */
3 | /* This Source Code Form is subject to the terms of the Mozilla Public
4 | * License, v. 2.0. If a copy of the MPL was not distributed with this
5 | * file, You can obtain one at http://mozilla.org/MPL/2.0/. */
6 |
7 | /*
8 | * A poison value that can be used to fill a memory space with
9 | * an address that leads to a safe crash when dereferenced.
10 | */
11 |
12 | #ifndef mozilla_Poison_h
13 | #define mozilla_Poison_h
14 |
15 | #include "mozilla/Assertions.h"
16 | #include "mozilla/Types.h"
17 |
18 | #include
19 |
20 | MOZ_BEGIN_EXTERN_C
21 |
22 | extern MFBT_DATA uintptr_t gMozillaPoisonValue;
23 |
24 | /**
25 | * @return the poison value.
26 | */
27 | inline uintptr_t mozPoisonValue()
28 | {
29 | return gMozillaPoisonValue;
30 | }
31 |
32 | /**
33 | * Overwrite the memory block of aSize bytes at aPtr with the poison value.
34 | * aPtr MUST be aligned at a sizeof(uintptr_t) boundary.
35 | * Only an even number of sizeof(uintptr_t) bytes are overwritten, the last
36 | * few bytes (if any) is not overwritten.
37 | */
38 | inline void mozWritePoison(void* aPtr, size_t aSize)
39 | {
40 | const uintptr_t POISON = mozPoisonValue();
41 | char* p = (char*)aPtr;
42 | char* limit = p + aSize;
43 | MOZ_ASSERT((uintptr_t)aPtr % sizeof(uintptr_t) == 0, "bad alignment");
44 | MOZ_ASSERT(aSize >= sizeof(uintptr_t), "poisoning this object has no effect");
45 | for (; p < limit; p += sizeof(uintptr_t)) {
46 | *((uintptr_t*)p) = POISON;
47 | }
48 | }
49 |
50 | /**
51 | * Initialize the poison value.
52 | * This should only be called once.
53 | */
54 | extern MFBT_API void mozPoisonValueInit();
55 |
56 | /* Values annotated by CrashReporter */
57 | extern MFBT_DATA uintptr_t gMozillaPoisonBase;
58 | extern MFBT_DATA uintptr_t gMozillaPoisonSize;
59 |
60 | MOZ_END_EXTERN_C
61 |
62 | #endif /* mozilla_Poison_h */
63 |
--------------------------------------------------------------------------------
/jsbcc_source/spidermonkey-linux/include/mozilla/Range.h:
--------------------------------------------------------------------------------
1 | /* -*- Mode: C++; tab-width: 8; indent-tabs-mode: nil; c-basic-offset: 2 -*- */
2 | /* vim: set ts=8 sts=2 et sw=2 tw=80: */
3 | /* This Source Code Form is subject to the terms of the Mozilla Public
4 | * License, v. 2.0. If a copy of the MPL was not distributed with this
5 | * file, You can obtain one at http://mozilla.org/MPL/2.0/. */
6 |
7 | #ifndef mozilla_Range_h
8 | #define mozilla_Range_h
9 |
10 | #include "mozilla/NullPtr.h"
11 | #include "mozilla/RangedPtr.h"
12 |
13 | #include
14 |
15 | namespace mozilla {
16 |
17 | // Range is a tuple containing a pointer and a length.
18 | template
19 | class Range
20 | {
21 | const RangedPtr mStart;
22 | const RangedPtr mEnd;
23 |
24 | typedef void (Range::* ConvertibleToBool)();
25 | void nonNull() {}
26 |
27 | public:
28 | Range() : mStart(nullptr, 0), mEnd(nullptr, 0) {}
29 | Range(T* aPtr, size_t aLength)
30 | : mStart(aPtr, aPtr, aPtr + aLength),
31 | mEnd(aPtr + aLength, aPtr, aPtr + aLength)
32 | {}
33 |
34 | RangedPtr start() const { return mStart; }
35 | RangedPtr end() const { return mEnd; }
36 | size_t length() const { return mEnd - mStart; }
37 |
38 | T& operator[](size_t aOffset) const { return mStart[aOffset]; }
39 |
40 | operator ConvertibleToBool() const { return mStart ? &Range::nonNull : 0; }
41 | };
42 |
43 | } // namespace mozilla
44 |
45 | #endif /* mozilla_Range_h */
46 |
--------------------------------------------------------------------------------
/jsbcc_source/spidermonkey-linux/include/mozilla/ReentrancyGuard.h:
--------------------------------------------------------------------------------
1 | /* -*- Mode: C++; tab-width: 8; indent-tabs-mode: nil; c-basic-offset: 2 -*- */
2 | /* vim: set ts=8 sts=2 et sw=2 tw=80: */
3 | /* This Source Code Form is subject to the terms of the Mozilla Public
4 | * License, v. 2.0. If a copy of the MPL was not distributed with this
5 | * file, You can obtain one at http://mozilla.org/MPL/2.0/. */
6 |
7 | /* Small helper class for asserting uses of a class are non-reentrant. */
8 |
9 | #ifndef mozilla_ReentrancyGuard_h
10 | #define mozilla_ReentrancyGuard_h
11 |
12 | #include "mozilla/Assertions.h"
13 | #include "mozilla/Attributes.h"
14 | #include "mozilla/GuardObjects.h"
15 |
16 | namespace mozilla {
17 |
18 | /* Useful for implementing containers that assert non-reentrancy */
19 | class ReentrancyGuard
20 | {
21 | MOZ_DECL_USE_GUARD_OBJECT_NOTIFIER
22 | #ifdef DEBUG
23 | bool& mEntered;
24 | #endif
25 |
26 | public:
27 | template
28 | #ifdef DEBUG
29 | ReentrancyGuard(T& aObj
30 | MOZ_GUARD_OBJECT_NOTIFIER_PARAM)
31 | : mEntered(aObj.mEntered)
32 | #else
33 | ReentrancyGuard(T&
34 | MOZ_GUARD_OBJECT_NOTIFIER_PARAM)
35 | #endif
36 | {
37 | MOZ_GUARD_OBJECT_NOTIFIER_INIT;
38 | #ifdef DEBUG
39 | MOZ_ASSERT(!mEntered);
40 | mEntered = true;
41 | #endif
42 | }
43 | ~ReentrancyGuard()
44 | {
45 | #ifdef DEBUG
46 | mEntered = false;
47 | #endif
48 | }
49 |
50 | private:
51 | ReentrancyGuard(const ReentrancyGuard&) MOZ_DELETE;
52 | void operator=(const ReentrancyGuard&) MOZ_DELETE;
53 | };
54 |
55 | } // namespace mozilla
56 |
57 | #endif /* mozilla_ReentrancyGuard_h */
58 |
--------------------------------------------------------------------------------
/jsbcc_source/spidermonkey-linux/include/mozilla/RefCountType.h:
--------------------------------------------------------------------------------
1 | /* -*- Mode: C++; tab-width: 8; indent-tabs-mode: nil; c-basic-offset: 2 -*- */
2 | /* vim: set ts=8 sts=2 et sw=2 tw=80: */
3 | /* This Source Code Form is subject to the terms of the Mozilla Public
4 | * License, v. 2.0. If a copy of the MPL was not distributed with this
5 | * file, You can obtain one at http://mozilla.org/MPL/2.0/. */
6 |
7 | #ifndef mozilla_RefCountType_h
8 | #define mozilla_RefCountType_h
9 |
10 | #include
11 |
12 | /**
13 | * MozRefCountType is Mozilla's reference count type.
14 | *
15 | * We use the same type to represent the refcount of RefCounted objects
16 | * as well, in order to be able to use the leak detection facilities
17 | * that are implemented by XPCOM.
18 | *
19 | * Note that this type is not in the mozilla namespace so that it is
20 | * usable for both C and C++ code.
21 | */
22 | typedef uintptr_t MozRefCountType;
23 |
24 | /*
25 | * This is the return type for AddRef() and Release() in nsISupports.
26 | * IUnknown of COM returns an unsigned long from equivalent functions.
27 | *
28 | * The following ifdef exists to maintain binary compatibility with
29 | * IUnknown, the base interface in Microsoft COM.
30 | */
31 | #ifdef XP_WIN
32 | typedef unsigned long MozExternalRefCountType;
33 | #else
34 | typedef uint32_t MozExternalRefCountType;
35 | #endif
36 |
37 | #endif
38 |
--------------------------------------------------------------------------------
/jsbcc_source/spidermonkey-linux/include/mozilla/SHA1.h:
--------------------------------------------------------------------------------
1 | /* -*- Mode: C++; tab-width: 8; indent-tabs-mode: nil; c-basic-offset: 2 -*- */
2 | /* vim: set ts=8 sts=2 et sw=2 tw=80: */
3 | /* This Source Code Form is subject to the terms of the Mozilla Public
4 | * License, v. 2.0. If a copy of the MPL was not distributed with this
5 | * file, You can obtain one at http://mozilla.org/MPL/2.0/. */
6 |
7 | /* Simple class for computing SHA1. */
8 |
9 | #ifndef mozilla_SHA1_h
10 | #define mozilla_SHA1_h
11 |
12 | #include "mozilla/Types.h"
13 |
14 | #include
15 | #include
16 |
17 | namespace mozilla {
18 |
19 | /**
20 | * This class computes the SHA1 hash of a byte sequence, or of the concatenation
21 | * of multiple sequences. For example, computing the SHA1 of two sequences of
22 | * bytes could be done as follows:
23 | *
24 | * void SHA1(const uint8_t* buf1, uint32_t size1,
25 | * const uint8_t* buf2, uint32_t size2,
26 | * SHA1Sum::Hash& hash)
27 | * {
28 | * SHA1Sum s;
29 | * s.update(buf1, size1);
30 | * s.update(buf2, size2);
31 | * s.finish(hash);
32 | * }
33 | *
34 | * The finish method may only be called once and cannot be followed by calls
35 | * to update.
36 | */
37 | class SHA1Sum
38 | {
39 | union
40 | {
41 | uint32_t mW[16]; /* input buffer */
42 | uint8_t mB[64];
43 | } mU;
44 | uint64_t mSize; /* count of hashed bytes. */
45 | unsigned mH[22]; /* 5 state variables, 16 tmp values, 1 extra */
46 | bool mDone;
47 |
48 | public:
49 | MFBT_API SHA1Sum();
50 |
51 | static const size_t kHashSize = 20;
52 | typedef uint8_t Hash[kHashSize];
53 |
54 | /* Add len bytes of dataIn to the data sequence being hashed. */
55 | MFBT_API void update(const void* aData, uint32_t aLength);
56 |
57 | /* Compute the final hash of all data into hashOut. */
58 | MFBT_API void finish(SHA1Sum::Hash& aHashOut);
59 | };
60 |
61 | } /* namespace mozilla */
62 |
63 | #endif /* mozilla_SHA1_h */
64 |
--------------------------------------------------------------------------------
/jsbcc_source/spidermonkey-linux/include/mozilla/TaggedAnonymousMemory.h:
--------------------------------------------------------------------------------
1 | /* -*- Mode: C++; tab-width: 8; indent-tabs-mode: nil; c-basic-offset: 2 -*- */
2 | /* vim: set ts=8 sts=2 et sw=2 tw=80: */
3 | /* This Source Code Form is subject to the terms of the Mozilla Public
4 | * License, v. 2.0. If a copy of the MPL was not distributed with this
5 | * file, You can obtain one at http://mozilla.org/MPL/2.0/. */
6 |
7 | // Some Linux kernels -- specifically, newer versions of Android and
8 | // some B2G devices -- have a feature for assigning names to ranges of
9 | // anonymous memory (i.e., memory that doesn't have a "name" in the
10 | // form of an underlying mapped file). These names are reported in
11 | // /proc//smaps alongside system-level memory usage information
12 | // such as Proportional Set Size (memory usage adjusted for sharing
13 | // between processes), which allows reporting this information at a
14 | // finer granularity than would otherwise be possible (e.g.,
15 | // separating malloc() heap from JS heap).
16 | //
17 | // Existing memory can be tagged with MozTagAnonymousMemory(); it will
18 | // tag the range of complete pages containing the given interval, so
19 | // the results may be inexact if the range isn't page-aligned.
20 | // MozTaggedAnonymousMmap() can be used like mmap() with an extra
21 | // parameter, and will tag the returned memory if the mapping was
22 | // successful (and if it was in fact anonymous).
23 | //
24 | // NOTE: The pointer given as the "tag" argument MUST remain valid as
25 | // long as the mapping exists. The referenced string is read when
26 | // /proc//smaps or /proc//maps is read, not when the tag is
27 | // established, so freeing it or changing its contents will have
28 | // unexpected results. Using a static string is probably best.
29 | //
30 | // Also note that this header can be used by both C and C++ code.
31 |
32 | #ifndef mozilla_TaggedAnonymousMemory_h
33 | #define mozilla_TaggedAnonymousMemory_h
34 |
35 | #ifndef XP_WIN
36 |
37 | #include
38 | #include
39 |
40 | #include "mozilla/Types.h"
41 |
42 | #ifdef ANDROID
43 |
44 | #ifdef __cplusplus
45 | extern "C" {
46 | #endif
47 |
48 | MFBT_API void
49 | MozTagAnonymousMemory(const void* aPtr, size_t aLength, const char* aTag);
50 |
51 | MFBT_API void*
52 | MozTaggedAnonymousMmap(void* aAddr, size_t aLength, int aProt, int aFlags,
53 | int aFd, off_t aOffset, const char* aTag);
54 |
55 | MFBT_API int
56 | MozTaggedMemoryIsSupported(void);
57 |
58 | #ifdef __cplusplus
59 | } // extern "C"
60 | #endif
61 |
62 | #else // ANDROID
63 |
64 | static inline void
65 | MozTagAnonymousMemory(const void* aPtr, size_t aLength, const char* aTag)
66 | {
67 | }
68 |
69 | static inline void*
70 | MozTaggedAnonymousMmap(void* aAddr, size_t aLength, int aProt, int aFlags,
71 | int aFd, off_t aOffset, const char* aTag)
72 | {
73 | return mmap(aAddr, aLength, aProt, aFlags, aFd, aOffset);
74 | }
75 |
76 | static inline int
77 | MozTaggedMemoryIsSupported(void)
78 | {
79 | return 0;
80 | }
81 |
82 | #endif // ANDROID
83 |
84 | #endif // !XP_WIN
85 |
86 | #endif // mozilla_TaggedAnonymousMemory_h
87 |
--------------------------------------------------------------------------------
/jsbcc_source/spidermonkey-linux/include/mozilla/ToString.h:
--------------------------------------------------------------------------------
1 | /* -*- Mode: C++; tab-width: 8; indent-tabs-mode: nil; c-basic-offset: 2 -*- */
2 | /* vim: set ts=8 sts=2 et sw=2 tw=80: */
3 | /* This Source Code Form is subject to the terms of the Mozilla Public
4 | * License, v. 2.0. If a copy of the MPL was not distributed with this
5 | * file, You can obtain one at http://mozilla.org/MPL/2.0/. */
6 |
7 | /* Utilities for converting an object to a string representation. */
8 |
9 | #ifndef mozilla_ToString_h
10 | #define mozilla_ToString_h
11 |
12 | #include
13 | #include
14 |
15 | namespace mozilla {
16 |
17 | /**
18 | * A convenience function for converting an object to a string representation.
19 | * Supports any object which can be streamed to an std::ostream.
20 | */
21 | template
22 | std::string
23 | ToString(const T& aValue)
24 | {
25 | std::ostringstream stream;
26 | stream << aValue;
27 | return stream.str();
28 | }
29 |
30 | } // namespace mozilla
31 |
32 | #endif /* mozilla_ToString_h */
33 |
--------------------------------------------------------------------------------
/jsbcc_source/spidermonkey-linux/lib/32-bit/libjs_static.a:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/cocos2d-html5/JSCompiler/ec3d96770ab6548378bb6979a0182b4404e4a18c/jsbcc_source/spidermonkey-linux/lib/32-bit/libjs_static.a
--------------------------------------------------------------------------------
/jsbcc_source/spidermonkey-linux/lib/64-bit/libjs_static.a:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/cocos2d-html5/JSCompiler/ec3d96770ab6548378bb6979a0182b4404e4a18c/jsbcc_source/spidermonkey-linux/lib/64-bit/libjs_static.a
--------------------------------------------------------------------------------
/jsbcc_source/spidermonkey-mac/include/fdlibm.h:
--------------------------------------------------------------------------------
1 | /*
2 | * ====================================================
3 | * Copyright (C) 1993 by Sun Microsystems, Inc. All rights reserved.
4 | *
5 | * Developed at SunPro, a Sun Microsystems, Inc. business.
6 | * Permission to use, copy, modify, and distribute this
7 | * software is freely granted, provided that this notice
8 | * is preserved.
9 | * ====================================================
10 | */
11 |
12 | /*
13 | * from: @(#)fdlibm.h 5.1 93/09/24
14 | * $FreeBSD$
15 | */
16 |
17 | #ifndef mozilla_imported_fdlibm_h
18 | #define mozilla_imported_fdlibm_h
19 |
20 | namespace fdlibm {
21 |
22 | double acos(double);
23 | double asin(double);
24 | double atan(double);
25 | double atan2(double, double);
26 |
27 | double cosh(double);
28 | double sinh(double);
29 | double tanh(double);
30 |
31 | double exp(double);
32 | double log(double);
33 | double log10(double);
34 |
35 | double pow(double, double);
36 | double sqrt(double);
37 | double fabs(double);
38 |
39 | double floor(double);
40 | double trunc(double);
41 | double ceil(double);
42 |
43 | double acosh(double);
44 | double asinh(double);
45 | double atanh(double);
46 | double cbrt(double);
47 | double expm1(double);
48 | double hypot(double, double);
49 | double log1p(double);
50 | double log2(double);
51 | double rint(double);
52 | double copysign(double, double);
53 | double nearbyint(double);
54 | double scalbn(double, int);
55 |
56 | float ceilf(float);
57 | float floorf(float);
58 |
59 | float nearbyintf(float);
60 | float rintf(float);
61 | float truncf(float);
62 |
63 | } /* namespace fdlibm */
64 |
65 | #endif /* mozilla_imported_fdlibm_h */
66 |
--------------------------------------------------------------------------------
/jsbcc_source/spidermonkey-mac/include/js-config.h:
--------------------------------------------------------------------------------
1 | /* -*- Mode: C; tab-width: 8; indent-tabs-mode: nil; c-basic-offset: 4 -*-
2 | * vim: set ts=8 sw=4 et tw=78:
3 | *
4 | * This Source Code Form is subject to the terms of the Mozilla Public
5 | * License, v. 2.0. If a copy of the MPL was not distributed with this
6 | * file, You can obtain one at http://mozilla.org/MPL/2.0/. */
7 |
8 | #ifndef js_config_h
9 | #define js_config_h
10 |
11 | /* Definitions set at build time that affect SpiderMonkey's public API.
12 | This header file is generated by the SpiderMonkey configure script,
13 | and installed along with jsapi.h. */
14 |
15 | /* Define to 1 if SpiderMonkey is in debug mode. */
16 | /* #undef JS_DEBUG */
17 |
18 | /*
19 | * NB: We have a special case for rust-bindgen, which wants to be able to
20 | * generate both debug and release bindings on a single objdir.
21 | */
22 | #ifdef JS_DEBUG
23 | #if !defined(DEBUG) && !defined(RUST_BINDGEN)
24 | # error "SpiderMonkey was configured with --enable-debug, so DEBUG must be defined when including this header"
25 | # endif
26 | #else
27 | # if defined(DEBUG) && !defined(RUST_BINDGEN)
28 | # error "SpiderMonkey was configured with --disable-debug, so DEBUG must be not defined when including this header"
29 | # endif
30 | #endif
31 |
32 | /* Define to 1 if SpiderMonkey should not use struct types in debug builds. */
33 | /* #undef JS_NO_JSVAL_JSID_STRUCT_TYPES */
34 |
35 | /* Define to 1 if SpiderMonkey should support multi-threaded clients. */
36 | /* #undef JS_THREADSAFE */
37 |
38 | /* Define to 1 if SpiderMonkey should include ctypes support. */
39 | /* #undef JS_HAS_CTYPES */
40 |
41 | /* Define to 1 if SpiderMonkey should support the ability to perform
42 | entirely too much GC. */
43 | /* #undef JS_GC_ZEAL */
44 |
45 | /* Define to 1 if SpiderMonkey should use small chunks. */
46 | /* #undef JS_GC_SMALL_CHUNK_SIZE */
47 |
48 | /* Define to 1 to perform extra assertions and heap poisoning. */
49 | /* #undef JS_CRASH_DIAGNOSTICS */
50 |
51 | /* Define to 1 if SpiderMonkey is in NUNBOX32 mode. */
52 | /* #undef JS_NUNBOX32 */
53 |
54 | /* Define to 1 if SpiderMonkey is in PUNBOX64 mode. */
55 | #define JS_PUNBOX64 1
56 |
57 | /* MOZILLA JSAPI version number components */
58 | #define MOZJS_MAJOR_VERSION 52
59 | #define MOZJS_MINOR_VERSION 0
60 |
61 | #endif /* js_config_h */
62 |
--------------------------------------------------------------------------------
/jsbcc_source/spidermonkey-mac/include/js/GCAnnotations.h:
--------------------------------------------------------------------------------
1 | /* -*- Mode: C++; tab-width: 8; indent-tabs-mode: nil; c-basic-offset: 4 -*-
2 | * vim: set ts=8 sts=4 et sw=4 tw=99:
3 | * This Source Code Form is subject to the terms of the Mozilla Public
4 | * License, v. 2.0. If a copy of the MPL was not distributed with this
5 | * file, You can obtain one at http://mozilla.org/MPL/2.0/. */
6 |
7 | #ifndef js_GCAnnotations_h
8 | #define js_GCAnnotations_h
9 |
10 | // Set of annotations for the rooting hazard analysis, used to categorize types
11 | // and functions.
12 | #ifdef XGILL_PLUGIN
13 |
14 | // Mark a type as being a GC thing (eg js::gc::Cell has this annotation).
15 | # define JS_HAZ_GC_THING __attribute__((tag("GC Thing")))
16 |
17 | // Mark a type as holding a pointer to a GC thing (eg JS::Value has this
18 | // annotation.)
19 | # define JS_HAZ_GC_POINTER __attribute__((tag("GC Pointer")))
20 |
21 | // Mark a type as a rooted pointer, suitable for use on the stack (eg all
22 | // Rooted instantiations should have this.)
23 | # define JS_HAZ_ROOTED __attribute__((tag("Rooted Pointer")))
24 |
25 | // Mark a type as something that should not be held live across a GC, but which
26 | // is not itself a GC pointer.
27 | # define JS_HAZ_GC_INVALIDATED __attribute__((tag("Invalidated by GC")))
28 |
29 | // Mark a type that would otherwise be considered a GC Pointer (eg because it
30 | // contains a JS::Value field) as a non-GC pointer. It is handled almost the
31 | // same in the analysis as a rooted pointer, except it will not be reported as
32 | // an unnecessary root if used across a GC call. This should rarely be used,
33 | // but makes sense for something like ErrorResult, which only contains a GC
34 | // pointer when it holds an exception (and it does its own rooting,
35 | // conditionally.)
36 | # define JS_HAZ_NON_GC_POINTER __attribute__((tag("Suppressed GC Pointer")))
37 |
38 | // Mark a function as something that runs a garbage collection, potentially
39 | // invalidating GC pointers.
40 | # define JS_HAZ_GC_CALL __attribute__((tag("GC Call")))
41 |
42 | // Mark an RAII class as suppressing GC within its scope.
43 | # define JS_HAZ_GC_SUPPRESSED __attribute__((tag("Suppress GC")))
44 |
45 | #else
46 |
47 | # define JS_HAZ_GC_THING
48 | # define JS_HAZ_GC_POINTER
49 | # define JS_HAZ_ROOTED
50 | # define JS_HAZ_GC_INVALIDATED
51 | # define JS_HAZ_NON_GC_POINTER
52 | # define JS_HAZ_GC_CALL
53 | # define JS_HAZ_GC_SUPPRESSED
54 |
55 | #endif
56 |
57 | #endif /* js_GCAnnotations_h */
58 |
--------------------------------------------------------------------------------
/jsbcc_source/spidermonkey-mac/include/js/LegacyIntTypes.h:
--------------------------------------------------------------------------------
1 | /* -*- Mode: C++; tab-width: 8; indent-tabs-mode: nil; c-basic-offset: 4 -*-
2 | * vim: set ts=8 sts=4 et sw=4 tw=99:
3 | * This Source Code Form is subject to the terms of the Mozilla Public
4 | * License, v. 2.0. If a copy of the MPL was not distributed with this
5 | * file, You can obtain one at http://mozilla.org/MPL/2.0/. */
6 |
7 | /*
8 | * This section typedefs the old 'native' types to the new types.
9 | * These redefinitions are provided solely to allow JSAPI users to more easily
10 | * transition to types. They are not to be used in the JSAPI, and
11 | * new JSAPI user code should not use them. This mapping file may eventually
12 | * be removed from SpiderMonkey, so don't depend on it in the long run.
13 | */
14 |
15 | /*
16 | * BEWARE: Comity with other implementers of these types is not guaranteed.
17 | * Indeed, if you use this header and third-party code defining these
18 | * types, *expect* to encounter either compile errors or link errors,
19 | * depending how these types are used and on the order of inclusion.
20 | * It is safest to use only the types.
21 | */
22 | #ifndef js_LegacyIntTypes_h
23 | #define js_LegacyIntTypes_h
24 |
25 | #include
26 |
27 | #include "js-config.h"
28 |
29 | typedef uint8_t uint8;
30 | typedef uint16_t uint16;
31 | typedef uint32_t uint32;
32 | typedef uint64_t uint64;
33 |
34 | /*
35 | * On AIX 4.3, sys/inttypes.h (which is included by sys/types.h, a very
36 | * common header file) defines the types int8, int16, int32, and int64.
37 | * So we don't define these four types here to avoid conflicts in case
38 | * the code also includes sys/types.h.
39 | */
40 | #if defined(AIX) && defined(HAVE_SYS_INTTYPES_H)
41 | #include
42 | #else
43 | typedef int8_t int8;
44 | typedef int16_t int16;
45 | typedef int32_t int32;
46 | typedef int64_t int64;
47 | #endif /* AIX && HAVE_SYS_INTTYPES_H */
48 |
49 | typedef uint8_t JSUint8;
50 | typedef uint16_t JSUint16;
51 | typedef uint32_t JSUint32;
52 | typedef uint64_t JSUint64;
53 |
54 | typedef int8_t JSInt8;
55 | typedef int16_t JSInt16;
56 | typedef int32_t JSInt32;
57 | typedef int64_t JSInt64;
58 |
59 | #endif /* js_LegacyIntTypes_h */
60 |
--------------------------------------------------------------------------------
/jsbcc_source/spidermonkey-mac/include/js/Realm.h:
--------------------------------------------------------------------------------
1 | /* -*- Mode: C++; tab-width: 8; indent-tabs-mode: nil; c-basic-offset: 4 -*-
2 | * vim: set ts=8 sts=4 et sw=4 tw=99:
3 | * This Source Code Form is subject to the terms of the Mozilla Public
4 | * License, v. 2.0. If a copy of the MPL was not distributed with this
5 | * file, You can obtain one at http://mozilla.org/MPL/2.0/. */
6 |
7 | /*
8 | * Ways to get various per-Realm objects. All the getters declared in this
9 | * header operate on the Realm corresponding to the current compartment on the
10 | * JSContext.
11 | */
12 |
13 | #ifndef js_Realm_h
14 | #define js_Realm_h
15 |
16 | #include "jstypes.h"
17 |
18 | struct JSContext;
19 | class JSObject;
20 |
21 | namespace JS {
22 |
23 | extern JS_PUBLIC_API(JSObject*)
24 | GetRealmObjectPrototype(JSContext* cx);
25 |
26 | extern JS_PUBLIC_API(JSObject*)
27 | GetRealmFunctionPrototype(JSContext* cx);
28 |
29 | extern JS_PUBLIC_API(JSObject*)
30 | GetRealmArrayPrototype(JSContext* cx);
31 |
32 | extern JS_PUBLIC_API(JSObject*)
33 | GetRealmErrorPrototype(JSContext* cx);
34 |
35 | extern JS_PUBLIC_API(JSObject*)
36 | GetRealmIteratorPrototype(JSContext* cx);
37 |
38 | } // namespace JS
39 |
40 | #endif // js_Realm_h
41 |
42 |
43 |
--------------------------------------------------------------------------------
/jsbcc_source/spidermonkey-mac/include/js/RequiredDefines.h:
--------------------------------------------------------------------------------
1 | /* -*- Mode: C++; tab-width: 8; indent-tabs-mode: nil; c-basic-offset: 4 -*-
2 | * vim: set ts=8 sts=4 et sw=4 tw=99:
3 | * This Source Code Form is subject to the terms of the Mozilla Public
4 | * License, v. 2.0. If a copy of the MPL was not distributed with this
5 | * file, You can obtain one at http://mozilla.org/MPL/2.0/. */
6 |
7 | /*
8 | * Various #defines required to build SpiderMonkey. Embedders should add this
9 | * file to the start of the command line via -include or a similar mechanism,
10 | * or SpiderMonkey public headers may not work correctly.
11 | */
12 |
13 | #ifndef js_RequiredDefines_h
14 | #define js_RequiredDefines_h
15 |
16 | /*
17 | * The c99 defining the limit macros (UINT32_MAX for example), says:
18 | *
19 | * C++ implementations should define these macros only when
20 | * __STDC_LIMIT_MACROS is defined before is included.
21 | *
22 | * The same also occurs with __STDC_CONSTANT_MACROS for the constant macros
23 | * (INT8_C for example) used to specify a literal constant of the proper type,
24 | * and with __STDC_FORMAT_MACROS for the format macros (PRId32 for example) used
25 | * with the fprintf function family.
26 | */
27 | #define __STDC_LIMIT_MACROS
28 | #define __STDC_CONSTANT_MACROS
29 | #define __STDC_FORMAT_MACROS
30 |
31 | /* Also define a char16_t type if not provided by the compiler. */
32 | #include "mozilla/Char16.h"
33 |
34 | #endif /* js_RequiredDefines_h */
35 |
--------------------------------------------------------------------------------
/jsbcc_source/spidermonkey-mac/include/js/SliceBudget.h:
--------------------------------------------------------------------------------
1 | /* -*- Mode: C++; tab-width: 8; indent-tabs-mode: nil; c-basic-offset: 4 -*-
2 | * vim: set ts=8 sts=4 et sw=4 tw=99:
3 | * This Source Code Form is subject to the terms of the Mozilla Public
4 | * License, v. 2.0. If a copy of the MPL was not distributed with this
5 | * file, You can obtain one at http://mozilla.org/MPL/2.0/. */
6 |
7 | #ifndef js_SliceBudget_h
8 | #define js_SliceBudget_h
9 |
10 | #include
11 |
12 | namespace js {
13 |
14 | struct JS_PUBLIC_API(TimeBudget)
15 | {
16 | int64_t budget;
17 |
18 | explicit TimeBudget(int64_t milliseconds) { budget = milliseconds; }
19 | };
20 |
21 | struct JS_PUBLIC_API(WorkBudget)
22 | {
23 | int64_t budget;
24 |
25 | explicit WorkBudget(int64_t work) { budget = work; }
26 | };
27 |
28 | /*
29 | * This class records how much work has been done in a given collection slice,
30 | * so that we can return before pausing for too long. Some slices are allowed
31 | * to run for unlimited time, and others are bounded. To reduce the number of
32 | * gettimeofday calls, we only check the time every 1000 operations.
33 | */
34 | class JS_PUBLIC_API(SliceBudget)
35 | {
36 | static const int64_t unlimitedDeadline = INT64_MAX;
37 | static const intptr_t unlimitedStartCounter = INTPTR_MAX;
38 |
39 | bool checkOverBudget();
40 |
41 | SliceBudget();
42 |
43 | public:
44 | // Memory of the originally requested budget. If isUnlimited, neither of
45 | // these are in use. If deadline==0, then workBudget is valid. Otherwise
46 | // timeBudget is valid.
47 | TimeBudget timeBudget;
48 | WorkBudget workBudget;
49 |
50 | int64_t deadline; /* in microseconds */
51 | intptr_t counter;
52 |
53 | static const intptr_t CounterReset = 1000;
54 |
55 | static const int64_t UnlimitedTimeBudget = -1;
56 | static const int64_t UnlimitedWorkBudget = -1;
57 |
58 | /* Use to create an unlimited budget. */
59 | static SliceBudget unlimited() { return SliceBudget(); }
60 |
61 | /* Instantiate as SliceBudget(TimeBudget(n)). */
62 | explicit SliceBudget(TimeBudget time);
63 |
64 | /* Instantiate as SliceBudget(WorkBudget(n)). */
65 | explicit SliceBudget(WorkBudget work);
66 |
67 | void makeUnlimited() {
68 | deadline = unlimitedDeadline;
69 | counter = unlimitedStartCounter;
70 | }
71 |
72 | void step(intptr_t amt = 1) {
73 | counter -= amt;
74 | }
75 |
76 | bool isOverBudget() {
77 | if (counter > 0)
78 | return false;
79 | return checkOverBudget();
80 | }
81 |
82 | bool isWorkBudget() const { return deadline == 0; }
83 | bool isTimeBudget() const { return deadline > 0 && !isUnlimited(); }
84 | bool isUnlimited() const { return deadline == unlimitedDeadline; }
85 |
86 | int describe(char* buffer, size_t maxlen) const;
87 | };
88 |
89 | } // namespace js
90 |
91 | #endif /* js_SliceBudget_h */
92 |
--------------------------------------------------------------------------------
/jsbcc_source/spidermonkey-mac/include/js/SweepingAPI.h:
--------------------------------------------------------------------------------
1 | /* -*- Mode: C++; tab-width: 8; indent-tabs-mode: nil; c-basic-offset: 4 -*-
2 | * vim: set ts=8 sts=4 et sw=4 tw=99:
3 | * This Source Code Form is subject to the terms of the Mozilla Public
4 | * License, v. 2.0. If a copy of the MPL was not distributed with this
5 | * file, You can obtain one at http://mozilla.org/MPL/2.0/. */
6 |
7 | #ifndef js_SweepingAPI_h
8 | #define js_SweepingAPI_h
9 |
10 | #include "js/HeapAPI.h"
11 |
12 | namespace js {
13 | template
14 | class WeakCacheBase {};
15 | } // namespace js
16 |
17 | namespace JS {
18 | template class WeakCache;
19 |
20 | namespace shadow {
21 | JS_PUBLIC_API(void)
22 | RegisterWeakCache(JS::Zone* zone, JS::WeakCache* cachep);
23 | } // namespace shadow
24 |
25 | // A WeakCache stores the given Sweepable container and links itself into a
26 | // list of such caches that are swept during each GC.
27 | template
28 | class WeakCache : public js::WeakCacheBase,
29 | private mozilla::LinkedListElement>
30 | {
31 | friend class mozilla::LinkedListElement>;
32 | friend class mozilla::LinkedList>;
33 |
34 | WeakCache() = delete;
35 | WeakCache(const WeakCache&) = delete;
36 |
37 | using SweepFn = void (*)(T*);
38 | SweepFn sweeper;
39 | T cache;
40 |
41 | public:
42 | using Type = T;
43 |
44 | template
45 | WeakCache(Zone* zone, U&& initial)
46 | : cache(mozilla::Forward(initial))
47 | {
48 | sweeper = GCPolicy::sweep;
49 | shadow::RegisterWeakCache(zone, reinterpret_cast*>(this));
50 | }
51 | WeakCache(WeakCache&& other)
52 | : sweeper(other.sweeper),
53 | cache(mozilla::Move(other.cache))
54 | {
55 | }
56 |
57 | const T& get() const { return cache; }
58 | T& get() { return cache; }
59 |
60 | void sweep() { sweeper(&cache); }
61 | };
62 |
63 | } // namespace JS
64 |
65 | #endif // js_SweepingAPI_h
66 |
--------------------------------------------------------------------------------
/jsbcc_source/spidermonkey-mac/include/js/TypeDecls.h:
--------------------------------------------------------------------------------
1 | /* -*- Mode: C++; tab-width: 8; indent-tabs-mode: nil; c-basic-offset: 4 -*-
2 | * vim: set ts=8 sts=4 et sw=4 tw=99:
3 | * This Source Code Form is subject to the terms of the Mozilla Public
4 | * License, v. 2.0. If a copy of the MPL was not distributed with this
5 | * file, You can obtain one at http://mozilla.org/MPL/2.0/. */
6 |
7 | // This file contains public type declarations that are used *frequently*. If
8 | // it doesn't occur at least 10 times in Gecko, it probably shouldn't be in
9 | // here.
10 | //
11 | // It includes only:
12 | // - forward declarations of structs and classes;
13 | // - typedefs;
14 | // - enums (maybe).
15 | // It does *not* contain any struct or class definitions.
16 |
17 | #ifndef js_TypeDecls_h
18 | #define js_TypeDecls_h
19 |
20 | #include
21 | #include
22 |
23 | #include "js-config.h"
24 |
25 | struct JSContext;
26 | class JSFunction;
27 | class JSObject;
28 | class JSScript;
29 | class JSString;
30 | class JSAddonId;
31 |
32 | struct jsid;
33 |
34 | namespace JS {
35 |
36 | typedef unsigned char Latin1Char;
37 |
38 | class Symbol;
39 | class Value;
40 | template class Handle;
41 | template class MutableHandle;
42 | template class Rooted;
43 | template class PersistentRooted;
44 |
45 | typedef Handle HandleFunction;
46 | typedef Handle HandleId;
47 | typedef Handle HandleObject;
48 | typedef Handle HandleScript;
49 | typedef Handle HandleString;
50 | typedef Handle HandleSymbol;
51 | typedef Handle HandleValue;
52 |
53 | typedef MutableHandle MutableHandleFunction;
54 | typedef MutableHandle MutableHandleId;
55 | typedef MutableHandle MutableHandleObject;
56 | typedef MutableHandle MutableHandleScript;
57 | typedef MutableHandle MutableHandleString;
58 | typedef MutableHandle MutableHandleSymbol;
59 | typedef MutableHandle MutableHandleValue;
60 |
61 | typedef Rooted RootedObject;
62 | typedef Rooted RootedFunction;
63 | typedef Rooted RootedScript;
64 | typedef Rooted RootedString;
65 | typedef Rooted RootedSymbol;
66 | typedef Rooted RootedId;
67 | typedef Rooted RootedValue;
68 |
69 | typedef PersistentRooted PersistentRootedFunction;
70 | typedef PersistentRooted PersistentRootedId;
71 | typedef PersistentRooted PersistentRootedObject;
72 | typedef PersistentRooted PersistentRootedScript;
73 | typedef PersistentRooted PersistentRootedString;
74 | typedef PersistentRooted PersistentRootedSymbol;
75 | typedef PersistentRooted PersistentRootedValue;
76 |
77 | } // namespace JS
78 |
79 | #endif /* js_TypeDecls_h */
80 |
--------------------------------------------------------------------------------
/jsbcc_source/spidermonkey-mac/include/js/UniquePtr.h:
--------------------------------------------------------------------------------
1 | /* -*- Mode: C++; tab-width: 8; indent-tabs-mode: nil; c-basic-offset: 4 -*-
2 | * vim: set ts=8 sts=4 et sw=4 tw=99:
3 | * This Source Code Form is subject to the terms of the Mozilla Public
4 | * License, v. 2.0. If a copy of the MPL was not distributed with this
5 | * file, You can obtain one at http://mozilla.org/MPL/2.0/. */
6 |
7 | #ifndef js_UniquePtr_h
8 | #define js_UniquePtr_h
9 |
10 | #include "mozilla/UniquePtr.h"
11 |
12 | #include "js/Utility.h"
13 |
14 | namespace js {
15 |
16 | // Replacement for mozilla::UniquePtr that defaults to js::DefaultDelete.
17 | template >
18 | using UniquePtr = mozilla::UniquePtr;
19 |
20 | namespace detail {
21 |
22 | template
23 | struct UniqueSelector
24 | {
25 | typedef UniquePtr SingleObject;
26 | };
27 |
28 | template
29 | struct UniqueSelector
30 | {
31 | typedef UniquePtr UnknownBound;
32 | };
33 |
34 | template
35 | struct UniqueSelector
36 | {
37 | typedef UniquePtr KnownBound;
38 | };
39 |
40 | } // namespace detail
41 |
42 | // Replacement for mozilla::MakeUnique that correctly calls js_new and produces
43 | // a js::UniquePtr.
44 | template
45 | typename detail::UniqueSelector::SingleObject
46 | MakeUnique(Args&&... aArgs)
47 | {
48 | return UniquePtr(js_new(mozilla::Forward(aArgs)...));
49 | }
50 |
51 | template
52 | typename detail::UniqueSelector::UnknownBound
53 | MakeUnique(decltype(sizeof(int)) aN) = delete;
54 |
55 | template
56 | typename detail::UniqueSelector::KnownBound
57 | MakeUnique(Args&&... aArgs) = delete;
58 |
59 | } // namespace js
60 |
61 | #endif /* js_UniquePtr_h */
62 |
--------------------------------------------------------------------------------
/jsbcc_source/spidermonkey-mac/include/js/Vector.h:
--------------------------------------------------------------------------------
1 | /* -*- Mode: C++; tab-width: 8; indent-tabs-mode: nil; c-basic-offset: 4 -*-
2 | * vim: set ts=8 sts=4 et sw=4 tw=99:
3 | * This Source Code Form is subject to the terms of the Mozilla Public
4 | * License, v. 2.0. If a copy of the MPL was not distributed with this
5 | * file, You can obtain one at http://mozilla.org/MPL/2.0/. */
6 |
7 | #ifndef js_Vector_h
8 | #define js_Vector_h
9 |
10 | #include "mozilla/Vector.h"
11 |
12 | /* Silence dire "bugs in previous versions of MSVC have been fixed" warnings */
13 | #ifdef _MSC_VER
14 | #pragma warning(push)
15 | #pragma warning(disable:4345)
16 | #endif
17 |
18 | namespace js {
19 |
20 | class TempAllocPolicy;
21 |
22 | namespace detail {
23 |
24 | template
25 | struct TypeIsGCThing : mozilla::FalseType
26 | {};
27 |
28 | // Uncomment this once we actually can assert it:
29 | //template <>
30 | //struct TypeIsGCThing : mozilla::TrueType
31 | //{};
32 |
33 | } // namespace detail
34 |
35 | template ::value>::Type
40 | >
41 | using Vector = mozilla::Vector;
42 |
43 | } // namespace js
44 |
45 | #endif /* js_Vector_h */
46 |
--------------------------------------------------------------------------------
/jsbcc_source/spidermonkey-mac/include/js/WeakMapPtr.h:
--------------------------------------------------------------------------------
1 | /* -*- Mode: C++; tab-width: 8; indent-tabs-mode: nil; c-basic-offset: 4 -*-
2 | * vim: set ts=8 sts=4 et sw=4 tw=99:
3 | * This Source Code Form is subject to the terms of the Mozilla Public
4 | * License, v. 2.0. If a copy of the MPL was not distributed with this
5 | * file, You can obtain one at http://mozilla.org/MPL/2.0/. */
6 |
7 | #ifndef js_WeakMapPtr_h
8 | #define js_WeakMapPtr_h
9 |
10 | #include "jspubtd.h"
11 |
12 | #include "js/TypeDecls.h"
13 |
14 | namespace JS {
15 |
16 | // A wrapper around the internal C++ representation of SpiderMonkey WeakMaps,
17 | // usable outside the engine.
18 | //
19 | // The supported template specializations are enumerated in WeakMapPtr.cpp. If
20 | // you want to use this class for a different key/value combination, add it to
21 | // the list and the compiler will generate the relevant machinery.
22 | template
23 | class JS_PUBLIC_API(WeakMapPtr)
24 | {
25 | public:
26 | WeakMapPtr() : ptr(nullptr) {}
27 | bool init(JSContext* cx);
28 | bool initialized() { return ptr != nullptr; }
29 | void destroy();
30 | virtual ~WeakMapPtr() { MOZ_ASSERT(!initialized()); }
31 | void trace(JSTracer* tracer);
32 |
33 | V lookup(const K& key);
34 | bool put(JSContext* cx, const K& key, const V& value);
35 |
36 | private:
37 | void* ptr;
38 |
39 | // WeakMapPtr is neither copyable nor assignable.
40 | WeakMapPtr(const WeakMapPtr& wmp) = delete;
41 | WeakMapPtr& operator=(const WeakMapPtr& wmp) = delete;
42 | };
43 |
44 | } /* namespace JS */
45 |
46 | #endif /* js_WeakMapPtr_h */
47 |
--------------------------------------------------------------------------------
/jsbcc_source/spidermonkey-mac/include/jsbytecode.h:
--------------------------------------------------------------------------------
1 | /* -*- Mode: C++; tab-width: 8; indent-tabs-mode: nil; c-basic-offset: 4 -*-
2 | * vim: set ts=8 sts=4 et sw=4 tw=99:
3 | * This Source Code Form is subject to the terms of the Mozilla Public
4 | * License, v. 2.0. If a copy of the MPL was not distributed with this
5 | * file, You can obtain one at http://mozilla.org/MPL/2.0/. */
6 |
7 | #ifndef jsbytecode_h
8 | #define jsbytecode_h
9 |
10 | #include
11 |
12 | typedef uint8_t jsbytecode;
13 |
14 | #endif /* jsbytecode_h */
15 |
--------------------------------------------------------------------------------
/jsbcc_source/spidermonkey-mac/include/jsclist.h:
--------------------------------------------------------------------------------
1 | /* -*- Mode: C++; tab-width: 8; indent-tabs-mode: nil; c-basic-offset: 4 -*-
2 | * vim: set ts=8 sts=4 et sw=4 tw=99:
3 | * This Source Code Form is subject to the terms of the Mozilla Public
4 | * License, v. 2.0. If a copy of the MPL was not distributed with this
5 | * file, You can obtain one at http://mozilla.org/MPL/2.0/. */
6 |
7 | #ifndef jsclist_h
8 | #define jsclist_h
9 |
10 | #include "jstypes.h"
11 |
12 | /*
13 | ** Circular linked list
14 | */
15 | typedef struct JSCListStr {
16 | struct JSCListStr* next;
17 | struct JSCListStr* prev;
18 | } JSCList;
19 |
20 | /*
21 | ** Insert element "_e" into the list, before "_l".
22 | */
23 | #define JS_INSERT_BEFORE(_e,_l) \
24 | JS_BEGIN_MACRO \
25 | (_e)->next = (_l); \
26 | (_e)->prev = (_l)->prev; \
27 | (_l)->prev->next = (_e); \
28 | (_l)->prev = (_e); \
29 | JS_END_MACRO
30 |
31 | /*
32 | ** Insert element "_e" into the list, after "_l".
33 | */
34 | #define JS_INSERT_AFTER(_e,_l) \
35 | JS_BEGIN_MACRO \
36 | (_e)->next = (_l)->next; \
37 | (_e)->prev = (_l); \
38 | (_l)->next->prev = (_e); \
39 | (_l)->next = (_e); \
40 | JS_END_MACRO
41 |
42 | /*
43 | ** Return the element following element "_e"
44 | */
45 | #define JS_NEXT_LINK(_e) \
46 | ((_e)->next)
47 | /*
48 | ** Return the element preceding element "_e"
49 | */
50 | #define JS_PREV_LINK(_e) \
51 | ((_e)->prev)
52 |
53 | /*
54 | ** Append an element "_e" to the end of the list "_l"
55 | */
56 | #define JS_APPEND_LINK(_e,_l) JS_INSERT_BEFORE(_e,_l)
57 |
58 | /*
59 | ** Insert an element "_e" at the head of the list "_l"
60 | */
61 | #define JS_INSERT_LINK(_e,_l) JS_INSERT_AFTER(_e,_l)
62 |
63 | /* Return the head/tail of the list */
64 | #define JS_LIST_HEAD(_l) (_l)->next
65 | #define JS_LIST_TAIL(_l) (_l)->prev
66 |
67 | /*
68 | ** Remove the element "_e" from it's circular list.
69 | */
70 | #define JS_REMOVE_LINK(_e) \
71 | JS_BEGIN_MACRO \
72 | (_e)->prev->next = (_e)->next; \
73 | (_e)->next->prev = (_e)->prev; \
74 | JS_END_MACRO
75 |
76 | /*
77 | ** Remove the element "_e" from it's circular list. Also initializes the
78 | ** linkage.
79 | */
80 | #define JS_REMOVE_AND_INIT_LINK(_e) \
81 | JS_BEGIN_MACRO \
82 | (_e)->prev->next = (_e)->next; \
83 | (_e)->next->prev = (_e)->prev; \
84 | (_e)->next = (_e); \
85 | (_e)->prev = (_e); \
86 | JS_END_MACRO
87 |
88 | /*
89 | ** Return non-zero if the given circular list "_l" is empty, zero if the
90 | ** circular list is not empty
91 | */
92 | #define JS_CLIST_IS_EMPTY(_l) \
93 | bool((_l)->next == (_l))
94 |
95 | /*
96 | ** Initialize a circular list
97 | */
98 | #define JS_INIT_CLIST(_l) \
99 | JS_BEGIN_MACRO \
100 | (_l)->next = (_l); \
101 | (_l)->prev = (_l); \
102 | JS_END_MACRO
103 |
104 | #define JS_INIT_STATIC_CLIST(_l) \
105 | {(_l), (_l)}
106 |
107 | #endif /* jsclist_h */
108 |
--------------------------------------------------------------------------------
/jsbcc_source/spidermonkey-mac/include/jscpucfg.h:
--------------------------------------------------------------------------------
1 | /* -*- Mode: C++; tab-width: 8; indent-tabs-mode: nil; c-basic-offset: 4 -*-
2 | * vim: set ts=8 sts=4 et sw=4 tw=99:
3 | * This Source Code Form is subject to the terms of the Mozilla Public
4 | * License, v. 2.0. If a copy of the MPL was not distributed with this
5 | * file, You can obtain one at http://mozilla.org/MPL/2.0/. */
6 |
7 | #ifndef jscpucfg_h
8 | #define jscpucfg_h
9 |
10 | #include "mozilla/EndianUtils.h"
11 |
12 | #ifndef JS_STACK_GROWTH_DIRECTION
13 | # ifdef __hppa
14 | # define JS_STACK_GROWTH_DIRECTION (1)
15 | # else
16 | # define JS_STACK_GROWTH_DIRECTION (-1)
17 | # endif
18 | #endif
19 |
20 | #endif /* jscpucfg_h */
21 |
--------------------------------------------------------------------------------
/jsbcc_source/spidermonkey-mac/include/jsprf.h:
--------------------------------------------------------------------------------
1 | /* -*- Mode: C++; tab-width: 8; indent-tabs-mode: nil; c-basic-offset: 4 -*-
2 | * vim: set ts=8 sts=4 et sw=4 tw=99:
3 | * This Source Code Form is subject to the terms of the Mozilla Public
4 | * License, v. 2.0. If a copy of the MPL was not distributed with this
5 | * file, You can obtain one at http://mozilla.org/MPL/2.0/. */
6 |
7 | #ifndef jsprf_h
8 | #define jsprf_h
9 |
10 | /*
11 | ** API for PR printf like routines. Supports the following formats
12 | ** %d - decimal
13 | ** %u - unsigned decimal
14 | ** %x - unsigned hex
15 | ** %X - unsigned uppercase hex
16 | ** %o - unsigned octal
17 | ** %hd, %hu, %hx, %hX, %ho - "short" versions of above
18 | ** %ld, %lu, %lx, %lX, %lo - "long" versions of above
19 | ** %lld, %llu, %llx, %llX, %llo - "long long" versions of above
20 | ** %zd, %zo, %zu, %zx, %zX - size_t versions of above
21 | ** %Id, %Io, %Iu, %Ix, %IX - size_t versions of above (for Windows compat)
22 | ** You should use PRI*SIZE macros instead
23 | ** %s - string
24 | ** %c - character
25 | ** %p - pointer (deals with machine dependent pointer size)
26 | ** %f - float
27 | ** %g - float
28 | */
29 |
30 | #include "mozilla/IntegerPrintfMacros.h"
31 | #include "mozilla/SizePrintfMacros.h"
32 |
33 | #include
34 |
35 | #include "jstypes.h"
36 |
37 | /*
38 | ** sprintf into a malloc'd buffer. Return a pointer to the malloc'd
39 | ** buffer on success, nullptr on failure. Call "JS_smprintf_free" to release
40 | ** the memory returned.
41 | */
42 | extern JS_PUBLIC_API(char*) JS_smprintf(const char* fmt, ...)
43 | MOZ_FORMAT_PRINTF(1, 2);
44 |
45 | /*
46 | ** Free the memory allocated, for the caller, by JS_smprintf
47 | */
48 | extern JS_PUBLIC_API(void) JS_smprintf_free(char* mem);
49 |
50 | /*
51 | ** "append" sprintf into a malloc'd buffer. "last" is the last value of
52 | ** the malloc'd buffer. sprintf will append data to the end of last,
53 | ** growing it as necessary using realloc. If last is nullptr, JS_sprintf_append
54 | ** will allocate the initial string. The return value is the new value of
55 | ** last for subsequent calls, or nullptr if there is a malloc failure.
56 | */
57 | extern JS_PUBLIC_API(char*) JS_sprintf_append(char* last, const char* fmt, ...)
58 | MOZ_FORMAT_PRINTF(2, 3);
59 |
60 | /*
61 | ** va_list forms of the above.
62 | */
63 | extern JS_PUBLIC_API(char*) JS_vsmprintf(const char* fmt, va_list ap);
64 | extern JS_PUBLIC_API(char*) JS_vsprintf_append(char* last, const char* fmt, va_list ap);
65 |
66 | #endif /* jsprf_h */
67 |
--------------------------------------------------------------------------------
/jsbcc_source/spidermonkey-mac/include/jsversion.h:
--------------------------------------------------------------------------------
1 | /* -*- Mode: C++; tab-width: 8; indent-tabs-mode: nil; c-basic-offset: 4 -*-
2 | * vim: set ts=8 sts=4 et sw=4 tw=99:
3 | * This Source Code Form is subject to the terms of the Mozilla Public
4 | * License, v. 2.0. If a copy of the MPL was not distributed with this
5 | * file, You can obtain one at http://mozilla.org/MPL/2.0/. */
6 |
7 | #ifndef jsversion_h
8 | #define jsversion_h
9 |
10 | /*
11 | * JS Capability Macros.
12 | */
13 | #define JS_HAS_STR_HTML_HELPERS 1 /* (no longer used) */
14 | #define JS_HAS_OBJ_PROTO_PROP 1 /* has o.__proto__ etc. */
15 | #define JS_HAS_OBJ_WATCHPOINT 1 /* has o.watch and o.unwatch */
16 | #define JS_HAS_TOSOURCE 1 /* has Object/Array toSource method */
17 | #define JS_HAS_CATCH_GUARD 1 /* has exception handling catch guard */
18 | #define JS_HAS_UNEVAL 1 /* has uneval() top-level function */
19 | #define JS_HAS_CONST 1 /* (no longer used) */
20 | #define JS_HAS_FUN_EXPR_STMT 1 /* (no longer used) */
21 | #define JS_HAS_FOR_EACH_IN 1 /* has for each (lhs in iterable) */
22 | #define JS_HAS_GENERATORS 1 /* (no longer used) */
23 | #define JS_HAS_BLOCK_SCOPE 1 /* (no longer used) */
24 | #define JS_HAS_DESTRUCTURING 2 /* (no longer used) */
25 | #define JS_HAS_GENERATOR_EXPRS 1 /* (no longer used) */
26 | #define JS_HAS_EXPR_CLOSURES 1 /* has function (formals) listexpr */
27 |
28 | /* (no longer used) */
29 | #define JS_HAS_NEW_GLOBAL_OBJECT 1
30 |
31 | /* (no longer used) */
32 | #define JS_HAS_DESTRUCTURING_SHORTHAND (JS_HAS_DESTRUCTURING == 2)
33 |
34 | /*
35 | * Feature for Object.prototype.__{define,lookup}{G,S}etter__ legacy support;
36 | * support likely to be made opt-in at some future time.
37 | */
38 | #define JS_OLD_GETTER_SETTER_METHODS 1
39 |
40 | #endif /* jsversion_h */
41 |
--------------------------------------------------------------------------------
/jsbcc_source/spidermonkey-mac/include/mozilla/Array.h:
--------------------------------------------------------------------------------
1 | /* -*- Mode: C++; tab-width: 8; indent-tabs-mode: nil; c-basic-offset: 2 -*- */
2 | /* vim: set ts=8 sts=2 et sw=2 tw=80: */
3 | /* This Source Code Form is subject to the terms of the Mozilla Public
4 | * License, v. 2.0. If a copy of the MPL was not distributed with this
5 | * file, You can obtain one at http://mozilla.org/MPL/2.0/. */
6 |
7 | /* A compile-time constant-length array with bounds-checking assertions. */
8 |
9 | #ifndef mozilla_Array_h
10 | #define mozilla_Array_h
11 |
12 | #include "mozilla/Assertions.h"
13 | #include "mozilla/Attributes.h"
14 | #include "mozilla/Move.h"
15 | #include "mozilla/ReverseIterator.h"
16 |
17 | #include
18 |
19 | namespace mozilla {
20 |
21 | template
22 | class Array
23 | {
24 | T mArr[Length];
25 |
26 | public:
27 | Array() {}
28 |
29 | template
30 | MOZ_IMPLICIT Array(Args&&... aArgs)
31 | : mArr{mozilla::Forward(aArgs)...}
32 | {
33 | static_assert(sizeof...(aArgs) == Length,
34 | "The number of arguments should be equal to the template parameter Length");
35 | }
36 |
37 | T& operator[](size_t aIndex)
38 | {
39 | MOZ_ASSERT(aIndex < Length);
40 | return mArr[aIndex];
41 | }
42 |
43 | const T& operator[](size_t aIndex) const
44 | {
45 | MOZ_ASSERT(aIndex < Length);
46 | return mArr[aIndex];
47 | }
48 |
49 | typedef T* iterator;
50 | typedef const T* const_iterator;
51 | typedef ReverseIterator reverse_iterator;
52 | typedef ReverseIterator const_reverse_iterator;
53 |
54 | // Methods for range-based for loops.
55 | iterator begin() { return mArr; }
56 | const_iterator begin() const { return mArr; }
57 | const_iterator cbegin() const { return begin(); }
58 | iterator end() { return mArr + Length; }
59 | const_iterator end() const { return mArr + Length; }
60 | const_iterator cend() const { return end(); }
61 |
62 | // Methods for reverse iterating.
63 | reverse_iterator rbegin() { return reverse_iterator(end()); }
64 | const_reverse_iterator rbegin() const { return const_reverse_iterator(end()); }
65 | const_reverse_iterator crbegin() const { return rbegin(); }
66 | reverse_iterator rend() { return reverse_iterator(begin()); }
67 | const_reverse_iterator rend() const { return const_reverse_iterator(begin()); }
68 | const_reverse_iterator crend() const { return rend(); }
69 | };
70 |
71 | template
72 | class Array
73 | {
74 | public:
75 | T& operator[](size_t aIndex)
76 | {
77 | MOZ_CRASH("indexing into zero-length array");
78 | }
79 |
80 | const T& operator[](size_t aIndex) const
81 | {
82 | MOZ_CRASH("indexing into zero-length array");
83 | }
84 | };
85 |
86 | } /* namespace mozilla */
87 |
88 | #endif /* mozilla_Array_h */
89 |
--------------------------------------------------------------------------------
/jsbcc_source/spidermonkey-mac/include/mozilla/ChaosMode.h:
--------------------------------------------------------------------------------
1 | /* -*- Mode: C++; tab-width: 8; indent-tabs-mode: nil; c-basic-offset: 2 -*- */
2 | /* vim: set ts=8 sts=2 et sw=2 tw=80: */
3 | /* This Source Code Form is subject to the terms of the Mozilla Public
4 | * License, v. 2.0. If a copy of the MPL was not distributed with this
5 | * file, You can obtain one at http://mozilla.org/MPL/2.0/. */
6 |
7 | #ifndef mozilla_ChaosMode_h
8 | #define mozilla_ChaosMode_h
9 |
10 | #include "mozilla/Atomics.h"
11 | #include "mozilla/EnumSet.h"
12 |
13 | #include
14 | #include
15 |
16 | namespace mozilla {
17 |
18 | enum ChaosFeature {
19 | None = 0x0,
20 | // Altering thread scheduling.
21 | ThreadScheduling = 0x1,
22 | // Altering network request scheduling.
23 | NetworkScheduling = 0x2,
24 | // Altering timer scheduling.
25 | TimerScheduling = 0x4,
26 | // Read and write less-than-requested amounts.
27 | IOAmounts = 0x8,
28 | // Iterate over hash tables in random order.
29 | HashTableIteration = 0x10,
30 | // Randomly refuse to use cached version of image (when allowed by spec).
31 | ImageCache = 0x20,
32 | Any = 0xffffffff,
33 | };
34 |
35 | namespace detail {
36 | extern MFBT_DATA Atomic gChaosModeCounter;
37 | extern MFBT_DATA ChaosFeature gChaosFeatures;
38 | } // namespace detail
39 |
40 | /**
41 | * When "chaos mode" is activated, code that makes implicitly nondeterministic
42 | * choices is encouraged to make random and extreme choices, to test more
43 | * code paths and uncover bugs.
44 | */
45 | class ChaosMode
46 | {
47 | public:
48 | static void SetChaosFeature(ChaosFeature aChaosFeature)
49 | {
50 | detail::gChaosFeatures = aChaosFeature;
51 | }
52 |
53 | static bool isActive(ChaosFeature aFeature)
54 | {
55 | if (detail::gChaosModeCounter > 0) {
56 | return true;
57 | }
58 | return detail::gChaosFeatures & aFeature;
59 | }
60 |
61 | /**
62 | * Increase the chaos mode activation level. An equivalent number of
63 | * calls to leaveChaosMode must be made in order to restore the original
64 | * chaos mode state. If the activation level is nonzero all chaos mode
65 | * features are activated.
66 | */
67 | static void enterChaosMode()
68 | {
69 | detail::gChaosModeCounter++;
70 | }
71 |
72 | /**
73 | * Decrease the chaos mode activation level. See enterChaosMode().
74 | */
75 | static void leaveChaosMode()
76 | {
77 | MOZ_ASSERT(detail::gChaosModeCounter > 0);
78 | detail::gChaosModeCounter--;
79 | }
80 |
81 | /**
82 | * Returns a somewhat (but not uniformly) random uint32_t < aBound.
83 | * Not to be used for anything except ChaosMode, since it's not very random.
84 | */
85 | static uint32_t randomUint32LessThan(uint32_t aBound)
86 | {
87 | MOZ_ASSERT(aBound != 0);
88 | return uint32_t(rand()) % aBound;
89 | }
90 | };
91 |
92 | } /* namespace mozilla */
93 |
94 | #endif /* mozilla_ChaosMode_h */
95 |
--------------------------------------------------------------------------------
/jsbcc_source/spidermonkey-mac/include/mozilla/EnumTypeTraits.h:
--------------------------------------------------------------------------------
1 | /* -*- Mode: C++; tab-width: 2; indent-tabs-mode: nil; c-basic-offset: 2 -*- */
2 | /* This Source Code Form is subject to the terms of the Mozilla Public
3 | * License, v. 2.0. If a copy of the MPL was not distributed with this
4 | * file, You can obtain one at http://mozilla.org/MPL/2.0/. */
5 |
6 | /* Type traits for enums. */
7 |
8 | #ifndef mozilla_EnumTypeTraits_h
9 | #define mozilla_EnumTypeTraits_h
10 |
11 | #include
12 |
13 | namespace mozilla {
14 |
15 | namespace detail {
16 |
17 | template
18 | struct EnumFitsWithinHelper;
19 |
20 | // Signed enum, signed storage.
21 | template
22 | struct EnumFitsWithinHelper
23 | : public std::integral_constant
24 | {};
25 |
26 | // Signed enum, unsigned storage.
27 | template
28 | struct EnumFitsWithinHelper
29 | : public std::integral_constant
30 | {};
31 |
32 | // Unsigned enum, signed storage.
33 | template
34 | struct EnumFitsWithinHelper
35 | : public std::integral_constant
36 | {};
37 |
38 | // Unsigned enum, unsigned storage.
39 | template
40 | struct EnumFitsWithinHelper
41 | : public std::integral_constant
42 | {};
43 |
44 | } // namespace detail
45 |
46 | /*
47 | * Type trait that determines whether the enum type T can fit within the
48 | * integral type Storage without data loss. This trait should be used with
49 | * caution with an enum type whose underlying type has not been explicitly
50 | * specified: for such enums, the C++ implementation is free to choose a type
51 | * no smaller than int whose range encompasses all possible values of the enum.
52 | * So for an enum with only small non-negative values, the underlying type may
53 | * be either int or unsigned int, depending on the whims of the implementation.
54 | */
55 | template
56 | struct EnumTypeFitsWithin
57 | : public detail::EnumFitsWithinHelper<
58 | sizeof(T),
59 | std::is_signed::type>::value,
60 | sizeof(Storage),
61 | std::is_signed::value
62 | >
63 | {
64 | static_assert(std::is_enum::value, "must provide an enum type");
65 | static_assert(std::is_integral::value, "must provide an integral type");
66 | };
67 |
68 | } // namespace mozilla
69 |
70 | #endif /* mozilla_EnumTypeTraits_h */
71 |
--------------------------------------------------------------------------------
/jsbcc_source/spidermonkey-mac/include/mozilla/IntegerPrintfMacros.h:
--------------------------------------------------------------------------------
1 | /* -*- Mode: C++; tab-width: 8; indent-tabs-mode: nil; c-basic-offset: 2 -*- */
2 | /* vim: set ts=8 sts=2 et sw=2 tw=80: */
3 | /* This Source Code Form is subject to the terms of the Mozilla Public
4 | * License, v. 2.0. If a copy of the MPL was not distributed with this
5 | * file, You can obtain one at http://mozilla.org/MPL/2.0/. */
6 |
7 | /* Implements the C99 interface. */
8 |
9 | #ifndef mozilla_IntegerPrintfMacros_h_
10 | #define mozilla_IntegerPrintfMacros_h_
11 |
12 | /*
13 | * These macros should not be used with the NSPR printf-like functions or their
14 | * users, e.g. mozilla/Logging.h. If you need to use NSPR's facilities, see the
15 | * comment on supported formats at the top of nsprpub/pr/include/prprf.h.
16 | */
17 |
18 | /*
19 | * scanf is a footgun: if the input number exceeds the bounds of the target
20 | * type, behavior is undefined (in the compiler sense: that is, this code
21 | * could overwrite your hard drive with zeroes):
22 | *
23 | * uint8_t u;
24 | * sscanf("256", "%" SCNu8, &u); // BAD
25 | *
26 | * For this reason, *never* use the SCN* macros provided by this header!
27 | */
28 |
29 | #include
30 |
31 | /*
32 | * Fix up Android's broken [u]intptr_t inttype macros. Android's PRI*PTR
33 | * macros are defined as "ld", but sizeof(long) is 8 and sizeof(intptr_t)
34 | * is 4 on 32-bit Android. TestTypeTraits.cpp asserts that these new macro
35 | * definitions match the actual type sizes seen at compile time.
36 | */
37 | #if defined(ANDROID) && !defined(__LP64__)
38 | # undef PRIdPTR /* intptr_t */
39 | # define PRIdPTR "d" /* intptr_t */
40 | # undef PRIiPTR /* intptr_t */
41 | # define PRIiPTR "i" /* intptr_t */
42 | # undef PRIoPTR /* uintptr_t */
43 | # define PRIoPTR "o" /* uintptr_t */
44 | # undef PRIuPTR /* uintptr_t */
45 | # define PRIuPTR "u" /* uintptr_t */
46 | # undef PRIxPTR /* uintptr_t */
47 | # define PRIxPTR "x" /* uintptr_t */
48 | # undef PRIXPTR /* uintptr_t */
49 | # define PRIXPTR "X" /* uintptr_t */
50 | #endif
51 |
52 | #endif /* mozilla_IntegerPrintfMacros_h_ */
53 |
--------------------------------------------------------------------------------
/jsbcc_source/spidermonkey-mac/include/mozilla/Likely.h:
--------------------------------------------------------------------------------
1 | /* -*- Mode: C++; tab-width: 8; indent-tabs-mode: nil; c-basic-offset: 2 -*- */
2 | /* vim: set ts=8 sts=2 et sw=2 tw=80: */
3 | /* This Source Code Form is subject to the terms of the Mozilla Public
4 | * License, v. 2.0. If a copy of the MPL was not distributed with this
5 | * file, You can obtain one at http://mozilla.org/MPL/2.0/. */
6 |
7 | /*
8 | * MOZ_LIKELY and MOZ_UNLIKELY macros to hint to the compiler how a
9 | * boolean predicate should be branch-predicted.
10 | */
11 |
12 | #ifndef mozilla_Likely_h
13 | #define mozilla_Likely_h
14 |
15 | #if defined(__clang__) || defined(__GNUC__)
16 | # define MOZ_LIKELY(x) (__builtin_expect(!!(x), 1))
17 | # define MOZ_UNLIKELY(x) (__builtin_expect(!!(x), 0))
18 | #else
19 | # define MOZ_LIKELY(x) (!!(x))
20 | # define MOZ_UNLIKELY(x) (!!(x))
21 | #endif
22 |
23 | #endif /* mozilla_Likely_h */
24 |
--------------------------------------------------------------------------------
/jsbcc_source/spidermonkey-mac/include/mozilla/MemoryReporting.h:
--------------------------------------------------------------------------------
1 | /* -*- Mode: C++; tab-width: 8; indent-tabs-mode: nil; c-basic-offset: 2 -*- */
2 | /* vim: set ts=8 sts=2 et sw=2 tw=80: */
3 | /* This Source Code Form is subject to the terms of the Mozilla Public
4 | * License, v. 2.0. If a copy of the MPL was not distributed with this
5 | * file, You can obtain one at http://mozilla.org/MPL/2.0/. */
6 |
7 | /* Memory reporting infrastructure. */
8 |
9 | #ifndef mozilla_MemoryReporting_h
10 | #define mozilla_MemoryReporting_h
11 |
12 | #include
13 |
14 | #ifdef __cplusplus
15 |
16 | namespace mozilla {
17 |
18 | /*
19 | * This is for functions that are like malloc_usable_size. Such functions are
20 | * used for measuring the size of data structures.
21 | */
22 | typedef size_t (*MallocSizeOf)(const void* p);
23 |
24 | } /* namespace mozilla */
25 |
26 | #endif /* __cplusplus */
27 |
28 | typedef size_t (*MozMallocSizeOf)(const void* p);
29 |
30 | #endif /* mozilla_MemoryReporting_h */
31 |
--------------------------------------------------------------------------------
/jsbcc_source/spidermonkey-mac/include/mozilla/NullPtr.h:
--------------------------------------------------------------------------------
1 | /* -*- Mode: C++; tab-width: 8; indent-tabs-mode: nil; c-basic-offset: 2 -*- */
2 | /* vim: set ts=8 sts=2 et sw=2 tw=80: */
3 | /* This Source Code Form is subject to the terms of the Mozilla Public
4 | * License, v. 2.0. If a copy of the MPL was not distributed with this
5 | * file, You can obtain one at http://mozilla.org/MPL/2.0/. */
6 |
7 | /* Implements a mozilla::IsNullPointer type trait. */
8 |
9 | #ifndef mozilla_NullPtr_h
10 | #define mozilla_NullPtr_h
11 |
12 | #include "mozilla/TypeTraits.h"
13 |
14 | namespace mozilla {
15 |
16 | /**
17 | * IsNullPointer::value is true iff T is decltype(nullptr).
18 | *
19 | * Ideally this would be in TypeTraits.h, but C++11 omitted std::is_null_pointer
20 | * (fixed in C++14), so in the interests of easing a switch to ,
21 | * this trait lives elsewhere.
22 | */
23 | template
24 | struct IsNullPointer : FalseType {};
25 |
26 | template<>
27 | struct IsNullPointer : TrueType {};
28 |
29 | } // namespace mozilla
30 |
31 | #endif /* mozilla_NullPtr_h */
32 |
--------------------------------------------------------------------------------
/jsbcc_source/spidermonkey-mac/include/mozilla/Opaque.h:
--------------------------------------------------------------------------------
1 | /* -*- Mode: C++; tab-width: 8; indent-tabs-mode: nil; c-basic-offset: 2 -*- */
2 | /* vim: set ts=8 sts=2 et sw=2 tw=80: */
3 | /* This Source Code Form is subject to the terms of the Mozilla Public
4 | * License, v. 2.0. If a copy of the MPL was not distributed with this
5 | * file, You can obtain one at http://mozilla.org/MPL/2.0/. */
6 |
7 | /* An opaque integral type supporting only comparison operators. */
8 |
9 | #ifndef mozilla_Opaque_h
10 | #define mozilla_Opaque_h
11 |
12 | #include "mozilla/TypeTraits.h"
13 |
14 | namespace mozilla {
15 |
16 | /**
17 | * Opaque is a replacement for integral T in cases where only comparisons
18 | * must be supported, and it's desirable to prevent accidental dependency on
19 | * exact values.
20 | */
21 | template
22 | class Opaque final
23 | {
24 | static_assert(mozilla::IsIntegral::value,
25 | "mozilla::Opaque only supports integral types");
26 |
27 | T mValue;
28 |
29 | public:
30 | Opaque() {}
31 | explicit Opaque(T aValue) : mValue(aValue) {}
32 |
33 | bool operator==(const Opaque& aOther) const {
34 | return mValue == aOther.mValue;
35 | }
36 |
37 | bool operator!=(const Opaque& aOther) const {
38 | return !(*this == aOther);
39 | }
40 | };
41 |
42 | } // namespace mozilla
43 |
44 | #endif /* mozilla_Opaque_h */
45 |
--------------------------------------------------------------------------------
/jsbcc_source/spidermonkey-mac/include/mozilla/OperatorNewExtensions.h:
--------------------------------------------------------------------------------
1 | /* -*- Mode: C++; tab-width: 8; indent-tabs-mode: nil; c-basic-offset: 2 -*- */
2 | /* vim: set ts=8 sts=2 et sw=2 tw=80: */
3 | /* This Source Code Form is subject to the terms of the Mozilla Public
4 | * License, v. 2.0. If a copy of the MPL was not distributed with this
5 | * file, You can obtain one at http://mozilla.org/MPL/2.0/. */
6 |
7 | /* A version of |operator new| that eschews mandatory null-checks. */
8 |
9 | #ifndef mozilla_OperatorNewExtensions_h
10 | #define mozilla_OperatorNewExtensions_h
11 |
12 | #include "mozilla/Assertions.h"
13 |
14 | // Credit goes to WebKit for this implementation, cf.
15 | // https://bugs.webkit.org/show_bug.cgi?id=74676
16 | namespace mozilla {
17 | enum NotNullTag {
18 | KnownNotNull,
19 | };
20 | } // namespace mozilla
21 |
22 | /*
23 | * The logic here is a little subtle. [expr.new] states that if the allocation
24 | * function being called returns null, then object initialization must not be
25 | * done, and the entirety of the new expression must return null. Non-throwing
26 | * (noexcept) functions are defined to return null to indicate failure. The
27 | * standard placement operator new is defined in such a way, and so it requires
28 | * a null check, even when that null check would be extraneous. Functions
29 | * declared without such a specification are defined to throw std::bad_alloc if
30 | * they fail, and return a non-null pointer otherwise. We compile without
31 | * exceptions, so any placement new overload we define that doesn't declare
32 | * itself as noexcept must therefore avoid generating a null check. Below is
33 | * just such an overload.
34 | *
35 | * You might think that MOZ_NONNULL might perform the same function, but
36 | * MOZ_NONNULL isn't supported on all of our compilers, and even when it is
37 | * supported, doesn't work on all the versions we support. And even keeping
38 | * those limitations in mind, we can't put MOZ_NONNULL on the global,
39 | * standardized placement new function in any event.
40 | *
41 | * We deliberately don't add MOZ_NONNULL(3) to tag |p| as non-null, to benefit
42 | * hypothetical static analyzers. Doing so makes |MOZ_ASSERT(p)|'s internal
43 | * test vacuous, and some compilers warn about such vacuous tests.
44 | */
45 | inline void*
46 | operator new(size_t, mozilla::NotNullTag, void* p)
47 | {
48 | MOZ_ASSERT(p);
49 | return p;
50 | }
51 |
52 | #endif // mozilla_OperatorNewExtensions_h
53 |
--------------------------------------------------------------------------------
/jsbcc_source/spidermonkey-mac/include/mozilla/Range.h:
--------------------------------------------------------------------------------
1 | /* -*- Mode: C++; tab-width: 8; indent-tabs-mode: nil; c-basic-offset: 2 -*- */
2 | /* vim: set ts=8 sts=2 et sw=2 tw=80: */
3 | /* This Source Code Form is subject to the terms of the Mozilla Public
4 | * License, v. 2.0. If a copy of the MPL was not distributed with this
5 | * file, You can obtain one at http://mozilla.org/MPL/2.0/. */
6 |
7 | #ifndef mozilla_Range_h
8 | #define mozilla_Range_h
9 |
10 | #include "mozilla/RangedPtr.h"
11 | #include "mozilla/TypeTraits.h"
12 |
13 | #include
14 |
15 | namespace mozilla {
16 |
17 | // Range is a tuple containing a pointer and a length.
18 | template
19 | class Range
20 | {
21 | const RangedPtr mStart;
22 | const RangedPtr mEnd;
23 |
24 | public:
25 | Range() : mStart(nullptr, 0), mEnd(nullptr, 0) {}
26 | Range(T* aPtr, size_t aLength)
27 | : mStart(aPtr, aPtr, aPtr + aLength),
28 | mEnd(aPtr + aLength, aPtr, aPtr + aLength)
29 | {}
30 | Range(const RangedPtr& aStart, const RangedPtr& aEnd)
31 | : mStart(aStart.get(), aStart.get(), aEnd.get()),
32 | mEnd(aEnd.get(), aStart.get(), aEnd.get())
33 | {
34 | // Only accept two RangedPtrs within the same range.
35 | aStart.checkIdenticalRange(aEnd);
36 | MOZ_ASSERT(aStart <= aEnd);
37 | }
38 |
39 | template::value,
41 | int>::Type>
42 | MOZ_IMPLICIT Range(const Range& aOther)
43 | : mStart(aOther.mStart),
44 | mEnd(aOther.mEnd)
45 | {}
46 |
47 | RangedPtr begin() const { return mStart; }
48 | RangedPtr end() const { return mEnd; }
49 | size_t length() const { return mEnd - mStart; }
50 |
51 | T& operator[](size_t aOffset) const { return mStart[aOffset]; }
52 |
53 | explicit operator bool() const { return mStart != nullptr; }
54 | };
55 |
56 | } // namespace mozilla
57 |
58 | #endif /* mozilla_Range_h */
59 |
--------------------------------------------------------------------------------
/jsbcc_source/spidermonkey-mac/include/mozilla/RangedArray.h:
--------------------------------------------------------------------------------
1 | /* -*- Mode: C++; tab-width: 8; indent-tabs-mode: nil; c-basic-offset: 2 -*- */
2 | /* vim: set ts=8 sts=2 et sw=2 tw=80: */
3 | /* This Source Code Form is subject to the terms of the Mozilla Public
4 | * License, v. 2.0. If a copy of the MPL was not distributed with this
5 | * file, You can obtain one at http://mozilla.org/MPL/2.0/. */
6 |
7 | /*
8 | * A compile-time constant-length array, with bounds-checking assertions -- but
9 | * unlike mozilla::Array, with indexes biased by a constant.
10 | *
11 | * Thus where mozilla::Array is a three-element array indexed by [0, 3),
12 | * mozilla::RangedArray is a three-element array indexed by [8, 11).
13 | */
14 |
15 | #ifndef mozilla_RangedArray_h
16 | #define mozilla_RangedArray_h
17 |
18 | #include "mozilla/Array.h"
19 |
20 | namespace mozilla {
21 |
22 | template
23 | class RangedArray
24 | {
25 | private:
26 | typedef Array ArrayType;
27 | ArrayType mArr;
28 |
29 | public:
30 | T& operator[](size_t aIndex)
31 | {
32 | MOZ_ASSERT(aIndex == MinIndex || aIndex > MinIndex);
33 | return mArr[aIndex - MinIndex];
34 | }
35 |
36 | const T& operator[](size_t aIndex) const
37 | {
38 | MOZ_ASSERT(aIndex == MinIndex || aIndex > MinIndex);
39 | return mArr[aIndex - MinIndex];
40 | }
41 |
42 | typedef typename ArrayType::iterator iterator;
43 | typedef typename ArrayType::const_iterator const_iterator;
44 | typedef typename ArrayType::reverse_iterator reverse_iterator;
45 | typedef typename ArrayType::const_reverse_iterator const_reverse_iterator;
46 |
47 | // Methods for range-based for loops.
48 | iterator begin() { return mArr.begin(); }
49 | const_iterator begin() const { return mArr.begin(); }
50 | const_iterator cbegin() const { return mArr.cbegin(); }
51 | iterator end() { return mArr.end(); }
52 | const_iterator end() const { return mArr.end(); }
53 | const_iterator cend() const { return mArr.cend(); }
54 |
55 | // Methods for reverse iterating.
56 | reverse_iterator rbegin() { return mArr.rbegin(); }
57 | const_reverse_iterator rbegin() const { return mArr.rbegin(); }
58 | const_reverse_iterator crbegin() const { return mArr.crbegin(); }
59 | reverse_iterator rend() { return mArr.rend(); }
60 | const_reverse_iterator rend() const { return mArr.rend(); }
61 | const_reverse_iterator crend() const { return mArr.crend(); }
62 | };
63 |
64 | } // namespace mozilla
65 |
66 | #endif // mozilla_RangedArray_h
67 |
--------------------------------------------------------------------------------
/jsbcc_source/spidermonkey-mac/include/mozilla/ReentrancyGuard.h:
--------------------------------------------------------------------------------
1 | /* -*- Mode: C++; tab-width: 8; indent-tabs-mode: nil; c-basic-offset: 2 -*- */
2 | /* vim: set ts=8 sts=2 et sw=2 tw=80: */
3 | /* This Source Code Form is subject to the terms of the Mozilla Public
4 | * License, v. 2.0. If a copy of the MPL was not distributed with this
5 | * file, You can obtain one at http://mozilla.org/MPL/2.0/. */
6 |
7 | /* Small helper class for asserting uses of a class are non-reentrant. */
8 |
9 | #ifndef mozilla_ReentrancyGuard_h
10 | #define mozilla_ReentrancyGuard_h
11 |
12 | #include "mozilla/Assertions.h"
13 | #include "mozilla/Attributes.h"
14 | #include "mozilla/GuardObjects.h"
15 |
16 | namespace mozilla {
17 |
18 | /* Useful for implementing containers that assert non-reentrancy */
19 | class MOZ_RAII ReentrancyGuard
20 | {
21 | MOZ_DECL_USE_GUARD_OBJECT_NOTIFIER
22 | #ifdef DEBUG
23 | bool& mEntered;
24 | #endif
25 |
26 | public:
27 | template
28 | #ifdef DEBUG
29 | explicit ReentrancyGuard(T& aObj
30 | MOZ_GUARD_OBJECT_NOTIFIER_PARAM)
31 | : mEntered(aObj.mEntered)
32 | #else
33 | explicit ReentrancyGuard(T&
34 | MOZ_GUARD_OBJECT_NOTIFIER_PARAM)
35 | #endif
36 | {
37 | MOZ_GUARD_OBJECT_NOTIFIER_INIT;
38 | #ifdef DEBUG
39 | MOZ_ASSERT(!mEntered);
40 | mEntered = true;
41 | #endif
42 | }
43 | ~ReentrancyGuard()
44 | {
45 | #ifdef DEBUG
46 | mEntered = false;
47 | #endif
48 | }
49 |
50 | private:
51 | ReentrancyGuard(const ReentrancyGuard&) = delete;
52 | void operator=(const ReentrancyGuard&) = delete;
53 | };
54 |
55 | } // namespace mozilla
56 |
57 | #endif /* mozilla_ReentrancyGuard_h */
58 |
--------------------------------------------------------------------------------
/jsbcc_source/spidermonkey-mac/include/mozilla/RefCountType.h:
--------------------------------------------------------------------------------
1 | /* -*- Mode: C++; tab-width: 8; indent-tabs-mode: nil; c-basic-offset: 2 -*- */
2 | /* vim: set ts=8 sts=2 et sw=2 tw=80: */
3 | /* This Source Code Form is subject to the terms of the Mozilla Public
4 | * License, v. 2.0. If a copy of the MPL was not distributed with this
5 | * file, You can obtain one at http://mozilla.org/MPL/2.0/. */
6 |
7 | #ifndef mozilla_RefCountType_h
8 | #define mozilla_RefCountType_h
9 |
10 | #include
11 |
12 | /**
13 | * MozRefCountType is Mozilla's reference count type.
14 | *
15 | * We use the same type to represent the refcount of RefCounted objects
16 | * as well, in order to be able to use the leak detection facilities
17 | * that are implemented by XPCOM.
18 | *
19 | * Note that this type is not in the mozilla namespace so that it is
20 | * usable for both C and C++ code.
21 | */
22 | typedef uintptr_t MozRefCountType;
23 |
24 | /*
25 | * This is the return type for AddRef() and Release() in nsISupports.
26 | * IUnknown of COM returns an unsigned long from equivalent functions.
27 | *
28 | * The following ifdef exists to maintain binary compatibility with
29 | * IUnknown, the base interface in Microsoft COM.
30 | */
31 | #ifdef XP_WIN
32 | typedef unsigned long MozExternalRefCountType;
33 | #else
34 | typedef uint32_t MozExternalRefCountType;
35 | #endif
36 |
37 | #endif
38 |
--------------------------------------------------------------------------------
/jsbcc_source/spidermonkey-mac/include/mozilla/SHA1.h:
--------------------------------------------------------------------------------
1 | /* -*- Mode: C++; tab-width: 8; indent-tabs-mode: nil; c-basic-offset: 2 -*- */
2 | /* vim: set ts=8 sts=2 et sw=2 tw=80: */
3 | /* This Source Code Form is subject to the terms of the Mozilla Public
4 | * License, v. 2.0. If a copy of the MPL was not distributed with this
5 | * file, You can obtain one at http://mozilla.org/MPL/2.0/. */
6 |
7 | /* Simple class for computing SHA1. */
8 |
9 | #ifndef mozilla_SHA1_h
10 | #define mozilla_SHA1_h
11 |
12 | #include "mozilla/Types.h"
13 |
14 | #include
15 | #include
16 |
17 | namespace mozilla {
18 |
19 | /**
20 | * This class computes the SHA1 hash of a byte sequence, or of the concatenation
21 | * of multiple sequences. For example, computing the SHA1 of two sequences of
22 | * bytes could be done as follows:
23 | *
24 | * void SHA1(const uint8_t* buf1, uint32_t size1,
25 | * const uint8_t* buf2, uint32_t size2,
26 | * SHA1Sum::Hash& hash)
27 | * {
28 | * SHA1Sum s;
29 | * s.update(buf1, size1);
30 | * s.update(buf2, size2);
31 | * s.finish(hash);
32 | * }
33 | *
34 | * The finish method may only be called once and cannot be followed by calls
35 | * to update.
36 | */
37 | class SHA1Sum
38 | {
39 | union
40 | {
41 | uint32_t mW[16]; /* input buffer */
42 | uint8_t mB[64];
43 | } mU;
44 | uint64_t mSize; /* count of hashed bytes. */
45 | unsigned mH[22]; /* 5 state variables, 16 tmp values, 1 extra */
46 | bool mDone;
47 |
48 | public:
49 | MFBT_API SHA1Sum();
50 |
51 | static const size_t kHashSize = 20;
52 | typedef uint8_t Hash[kHashSize];
53 |
54 | /* Add len bytes of dataIn to the data sequence being hashed. */
55 | MFBT_API void update(const void* aData, uint32_t aLength);
56 |
57 | /* Compute the final hash of all data into hashOut. */
58 | MFBT_API void finish(SHA1Sum::Hash& aHashOut);
59 | };
60 |
61 | } /* namespace mozilla */
62 |
63 | #endif /* mozilla_SHA1_h */
64 |
--------------------------------------------------------------------------------
/jsbcc_source/spidermonkey-mac/include/mozilla/SizePrintfMacros.h:
--------------------------------------------------------------------------------
1 | /* -*- Mode: C++; tab-width: 8; indent-tabs-mode: nil; c-basic-offset: 2 -*- */
2 | /* vim: set ts=8 sts=2 et sw=2 tw=80: */
3 | /* This Source Code Form is subject to the terms of the Mozilla Public
4 | * License, v. 2.0. If a copy of the MPL was not distributed with this
5 | * file, You can obtain one at http://mozilla.org/MPL/2.0/. */
6 |
7 | /* Implements (nonstandard) PRI{ouxX}SIZE format macros for size_t types. */
8 |
9 | #ifndef mozilla_SizePrintfMacros_h_
10 | #define mozilla_SizePrintfMacros_h_
11 |
12 | /*
13 | * MSVC's libc does not support C99's %z format length modifier for size_t
14 | * types. Instead, we use Microsoft's nonstandard %I modifier for size_t, which
15 | * is unsigned __int32 on 32-bit platforms and unsigned __int64 on 64-bit
16 | * platforms:
17 | *
18 | * http://msdn.microsoft.com/en-us/library/tcxf1dw6.aspx
19 | */
20 |
21 | #if defined(XP_WIN)
22 | # define PRIoSIZE "Io"
23 | # define PRIuSIZE "Iu"
24 | # define PRIxSIZE "Ix"
25 | # define PRIXSIZE "IX"
26 | #else
27 | # define PRIoSIZE "zo"
28 | # define PRIuSIZE "zu"
29 | # define PRIxSIZE "zx"
30 | # define PRIXSIZE "zX"
31 | #endif
32 |
33 | #endif /* mozilla_SizePrintfMacros_h_ */
34 |
--------------------------------------------------------------------------------
/jsbcc_source/spidermonkey-mac/include/mozilla/Sprintf.h:
--------------------------------------------------------------------------------
1 | /* -*- Mode: C++; tab-width: 8; indent-tabs-mode: nil; c-basic-offset: 2 -*- */
2 | /* vim: set ts=8 sts=2 et sw=2 tw=80: */
3 | /* This Source Code Form is subject to the terms of the Mozilla Public
4 | * License, v. 2.0. If a copy of the MPL was not distributed with this
5 | * file, You can obtain one at http://mozilla.org/MPL/2.0/. */
6 |
7 | /* Provides a safer sprintf for printing to fixed-size character arrays. */
8 |
9 | #ifndef mozilla_Sprintf_h_
10 | #define mozilla_Sprintf_h_
11 |
12 | #include
13 | #include
14 |
15 | #include "mozilla/Assertions.h"
16 | #include "mozilla/Attributes.h"
17 |
18 | #ifdef __cplusplus
19 |
20 | template
21 | int VsprintfLiteral(char (&buffer)[N], const char* format, va_list args)
22 | {
23 | MOZ_ASSERT(format != buffer);
24 | int result = vsnprintf(buffer, N, format, args);
25 | buffer[N - 1] = '\0';
26 | return result;
27 | }
28 |
29 | template
30 | MOZ_FORMAT_PRINTF(2, 3)
31 | int SprintfLiteral(char (&buffer)[N], const char* format, ...)
32 | {
33 | va_list args;
34 | va_start(args, format);
35 | int result = VsprintfLiteral(buffer, format, args);
36 | va_end(args);
37 | return result;
38 | }
39 |
40 | #endif
41 | #endif /* mozilla_Sprintf_h_ */
42 |
--------------------------------------------------------------------------------
/jsbcc_source/spidermonkey-mac/include/mozilla/StaticAnalysisFunctions.h:
--------------------------------------------------------------------------------
1 | /* -*- Mode: C++; tab-width: 8; indent-tabs-mode: nil; c-basic-offset: 2 -*- */
2 | /* vim: set ts=8 sts=2 et sw=2 tw=80: */
3 | /* This Source Code Form is subject to the terms of the Mozilla Public
4 | * License, v. 2.0. If a copy of the MPL was not distributed with this
5 | * file, You can obtain one at http://mozilla.org/MPL/2.0/. */
6 |
7 | #ifndef mozilla_StaticAnalysisFunctions_h
8 | #define mozilla_StaticAnalysisFunctions_h
9 |
10 | #ifndef __cplusplus
11 | #ifndef bool
12 | #include
13 | #endif
14 | #endif
15 | /*
16 | * Functions that are used as markers in Gecko code for static analysis. Their
17 | * purpose is to have different AST nodes generated during compile time and to
18 | * match them based on different checkers implemented in build/clang-plugin
19 | */
20 |
21 | #ifdef MOZ_CLANG_PLUGIN
22 |
23 | #ifdef __cplusplus
24 | extern "C" {
25 | #endif
26 |
27 | /*
28 | * MOZ_AssertAssignmentTest - used in MOZ_ASSERT in order to test the possible
29 | * presence of assignment instead of logical comparisons.
30 | *
31 | * Example:
32 | * MOZ_ASSERT(retVal = true);
33 | */
34 | static MOZ_ALWAYS_INLINE bool MOZ_AssertAssignmentTest(bool exprResult) {
35 | return exprResult;
36 | }
37 |
38 | #ifdef __cplusplus
39 | }
40 | #endif /* __cplusplus */
41 |
42 | #define MOZ_CHECK_ASSERT_ASSIGNMENT(expr) MOZ_AssertAssignmentTest(!!(expr))
43 |
44 | #else
45 |
46 | #define MOZ_CHECK_ASSERT_ASSIGNMENT(expr) (!!(expr))
47 |
48 | #endif /* MOZ_CLANG_PLUGIN */
49 | #endif /* StaticAnalysisFunctions_h */
--------------------------------------------------------------------------------
/jsbcc_source/spidermonkey-mac/include/mozilla/TaggedAnonymousMemory.h:
--------------------------------------------------------------------------------
1 | /* -*- Mode: C++; tab-width: 8; indent-tabs-mode: nil; c-basic-offset: 2 -*- */
2 | /* vim: set ts=8 sts=2 et sw=2 tw=80: */
3 | /* This Source Code Form is subject to the terms of the Mozilla Public
4 | * License, v. 2.0. If a copy of the MPL was not distributed with this
5 | * file, You can obtain one at http://mozilla.org/MPL/2.0/. */
6 |
7 | // Some Linux kernels -- specifically, newer versions of Android and
8 | // some B2G devices -- have a feature for assigning names to ranges of
9 | // anonymous memory (i.e., memory that doesn't have a "name" in the
10 | // form of an underlying mapped file). These names are reported in
11 | // /proc//smaps alongside system-level memory usage information
12 | // such as Proportional Set Size (memory usage adjusted for sharing
13 | // between processes), which allows reporting this information at a
14 | // finer granularity than would otherwise be possible (e.g.,
15 | // separating malloc() heap from JS heap).
16 | //
17 | // Existing memory can be tagged with MozTagAnonymousMemory(); it will
18 | // tag the range of complete pages containing the given interval, so
19 | // the results may be inexact if the range isn't page-aligned.
20 | // MozTaggedAnonymousMmap() can be used like mmap() with an extra
21 | // parameter, and will tag the returned memory if the mapping was
22 | // successful (and if it was in fact anonymous).
23 | //
24 | // NOTE: The pointer given as the "tag" argument MUST remain valid as
25 | // long as the mapping exists. The referenced string is read when
26 | // /proc/