From bc7d5bf7d835d980c2daeee337d15cae1ac7c28d Mon Sep 17 00:00:00 2001 From: Dmitriy Kuminov Date: Wed, 8 Jul 2015 23:21:24 +0300 Subject: [PATCH] vendor-esr: Import FIREFOX_31_8_0esr_RELEASE from vendor. Source URL: http://hg.mozilla.org/releases/mozilla-esr31/archive/c81c5e3eca8c.tar.bz2 --- .hg_archival.txt | 8 +- CLOBBER | 2 +- Makefile.in | 4 + accessible/tests/mochitest/focus/a11y.ini | 1 + b2g/config/emulator-ics/config.json | 5 +- b2g/config/emulator-jb/config.json | 5 +- b2g/config/emulator-kk/config.json | 5 +- b2g/config/emulator/config.json | 5 +- b2g/config/flame/config.json | 5 +- b2g/config/hamachi/config.json | 5 +- b2g/config/helix/config.json | 5 +- b2g/config/inari/config.json | 5 +- b2g/config/leo/config.json | 5 +- b2g/config/mako/config.json | 5 +- b2g/config/mozconfigs/common | 8 + b2g/config/unagi/config.json | 5 +- b2g/config/wasabi/config.json | 5 +- browser/app/blocklist.xml | 156 +- .../test/general/test_contextmenu.html | 2 +- .../test/general/test_contextmenu_input.html | 2 +- browser/config/version.txt | 2 +- build/gen_mach_buildprops.py | 16 +- build/macosx/mozconfig.common | 2 + build/moz-automation.mk | 6 +- build/mozconfig.win-common | 2 + build/unix/mozconfig.linux | 2 + build/upload.py | 21 +- build/virtualenv_packages.txt | 2 + config/milestone.txt | 2 +- configure.in | 3 +- content/base/src/nsXMLHttpRequest.cpp | 40 +- content/base/test/csp/mochitest.ini | 2 +- .../media/gstreamer/GStreamerFormatHelper.cpp | 4 +- content/media/webaudio/MediaBufferDecoder.cpp | 17 +- dom/file/ArchiveZipFile.cpp | 6 +- dom/indexedDB/IDBRequest.cpp | 5 + dom/indexedDB/IDBRequest.h | 3 + dom/indexedDB/IndexedDatabaseManager.cpp | 24 +- ...rConnection_offerRequiresReceiveAudio.html | 2 + ...rConnection_offerRequiresReceiveVideo.html | 2 + ...ection_offerRequiresReceiveVideoAudio.html | 2 + dom/plugins/base/nsPluginInstanceOwner.cpp | 174 +- dom/plugins/base/nsPluginInstanceOwner.h | 2 +- dom/plugins/ipc/PluginInterposeOSX.mm | 17 +- dom/workers/ScriptLoader.cpp | 37 +- dom/workers/XMLHttpRequest.cpp | 43 +- gfx/2d/SourceSurfaceD2D1.cpp | 11 +- gfx/gl/GLScreenBuffer.cpp | 5 +- gfx/gl/SharedSurfaceGL.cpp | 5 +- gfx/layers/YCbCrImageDataSerializer.cpp | 4 +- gfx/layers/opengl/CompositorOGL.cpp | 6 +- gfx/thebes/gfxPlatform.cpp | 6 +- ipc/chromium/moz.build | 1 + ipc/chromium/src/base/atomic_sequence_num.h | 42 +- .../src/chrome/common/child_process_host.cc | 2 +- .../src/chrome/common/child_process_info.cc | 17 +- .../src/chrome/common/child_process_info.h | 4 - ipc/chromium/src/chrome/common/ipc_channel.cc | 39 + ipc/chromium/src/chrome/common/ipc_channel.h | 11 + .../src/chrome/common/ipc_channel_posix.cc | 12 + .../src/chrome/common/ipc_channel_win.cc | 74 +- .../src/chrome/common/ipc_channel_win.h | 13 +- ipc/glue/Transport_posix.cpp | 5 +- ipc/glue/Transport_win.cpp | 4 +- js/ipc/JavaScriptChild.cpp | 86 +- js/ipc/JavaScriptChild.h | 90 +- js/ipc/JavaScriptParent.cpp | 148 +- js/ipc/JavaScriptParent.h | 58 +- js/ipc/JavaScriptShared.cpp | 72 +- js/ipc/JavaScriptShared.h | 62 +- js/public/Anchor.h | 38 +- js/public/CallArgs.h | 56 +- js/public/CallNonGenericMethod.h | 14 +- js/public/CharacterEncoding.h | 58 +- js/public/Class.h | 120 +- js/public/GCAPI.h | 102 +- js/public/HashTable.h | 218 +- js/public/HeapAPI.h | 70 +- js/public/Id.h | 18 +- js/public/MemoryMetrics.h | 86 +- js/public/OldDebugAPI.h | 280 +- js/public/Principals.h | 20 +- js/public/ProfilingStack.h | 24 +- js/public/PropertyKey.h | 10 +- js/public/RootingAPI.h | 290 +- js/public/StructuredClone.h | 102 +- js/public/TracingAPI.h | 76 +- js/public/Utility.h | 60 +- js/public/Value.h | 164 +- js/public/Vector.h | 4 +- js/public/WeakMapPtr.h | 16 +- js/src/assembler/assembler/ARMAssembler.cpp | 6 +- js/src/assembler/assembler/ARMAssembler.h | 6 +- .../assembler/AbstractMacroAssembler.h | 6 +- js/src/assembler/assembler/AssemblerBuffer.h | 14 +- js/src/assembler/assembler/LinkBuffer.h | 4 +- js/src/assembler/assembler/MIPSAssembler.h | 4 +- .../assembler/assembler/MacroAssemblerARM.cpp | 2 +- .../assembler/assembler/MacroAssemblerARM.h | 4 +- .../assembler/MacroAssemblerCodeRef.h | 6 +- .../assembler/assembler/MacroAssemblerSparc.h | 2 +- .../assembler/MacroAssemblerX86Common.h | 4 +- .../assembler/MacroAssemblerX86_64.h | 4 +- js/src/assembler/assembler/RepatchBuffer.h | 4 +- js/src/assembler/assembler/SparcAssembler.h | 44 +- js/src/assembler/assembler/X86Assembler.h | 26 +- js/src/assembler/jit/ExecutableAllocator.cpp | 2 +- js/src/assembler/jit/ExecutableAllocator.h | 24 +- .../jit/ExecutableAllocatorPosix.cpp | 2 +- .../assembler/jit/ExecutableAllocatorWin.cpp | 10 +- js/src/assembler/wtf/Platform.h | 2 +- js/src/builtin/Eval.cpp | 60 +- js/src/builtin/Eval.h | 10 +- js/src/builtin/Intl.cpp | 326 +- js/src/builtin/Intl.h | 42 +- js/src/builtin/MapObject.cpp | 428 +- js/src/builtin/MapObject.h | 122 +- js/src/builtin/Object.cpp | 108 +- js/src/builtin/Object.h | 10 +- js/src/builtin/Profilers.cpp | 56 +- js/src/builtin/Profilers.h | 14 +- js/src/builtin/RegExp.cpp | 104 +- js/src/builtin/RegExp.h | 28 +- js/src/builtin/SIMD.cpp | 114 +- js/src/builtin/SIMD.h | 26 +- js/src/builtin/TestingFunctions.cpp | 190 +- js/src/builtin/TestingFunctions.h | 8 +- js/src/builtin/TypedObject.cpp | 348 +- js/src/builtin/TypedObject.h | 186 +- js/src/ctypes/CTypes.cpp | 166 +- js/src/ctypes/CTypes.h | 30 +- js/src/ctypes/Library.cpp | 10 +- js/src/ctypes/Library.h | 2 +- js/src/devtools/Instruments.cpp | 4 +- js/src/devtools/sharkctl.cpp | 4 +- js/src/ds/BitArray.h | 2 +- js/src/ds/FixedSizeHash.h | 16 +- js/src/ds/InlineMap.h | 76 +- js/src/ds/LifoAlloc.cpp | 24 +- js/src/ds/LifoAlloc.h | 138 +- js/src/ds/PriorityQueue.h | 8 +- js/src/ds/Sort.h | 20 +- js/src/ds/SplayTree.h | 62 +- js/src/editline/editline.h | 8 +- js/src/frontend/BytecodeCompiler.cpp | 112 +- js/src/frontend/BytecodeCompiler.h | 38 +- js/src/frontend/BytecodeEmitter.cpp | 644 +- js/src/frontend/BytecodeEmitter.h | 80 +- js/src/frontend/FoldConstants.cpp | 42 +- js/src/frontend/FoldConstants.h | 6 +- js/src/frontend/FullParseHandler.h | 318 +- js/src/frontend/NameFunctions.cpp | 38 +- js/src/frontend/NameFunctions.h | 2 +- js/src/frontend/ParseMaps-inl.h | 4 +- js/src/frontend/ParseMaps.cpp | 38 +- js/src/frontend/ParseMaps.h | 120 +- js/src/frontend/ParseNode-inl.h | 6 +- js/src/frontend/ParseNode.cpp | 142 +- js/src/frontend/ParseNode.h | 274 +- js/src/frontend/Parser-inl.h | 2 +- js/src/frontend/Parser.cpp | 550 +- js/src/frontend/Parser.h | 172 +- js/src/frontend/SharedContext.h | 54 +- js/src/frontend/SourceNotes.h | 10 +- js/src/frontend/SyntaxParseHandler.h | 74 +- js/src/frontend/TokenStream.cpp | 106 +- js/src/frontend/TokenStream.h | 134 +- js/src/gc/Barrier-inl.h | 6 +- js/src/gc/Barrier.cpp | 18 +- js/src/gc/Barrier.h | 372 +- js/src/gc/FindSCCs.h | 42 +- js/src/gc/GCInternals.h | 44 +- js/src/gc/Heap.h | 200 +- js/src/gc/Iteration.cpp | 24 +- js/src/gc/Marking.cpp | 426 +- js/src/gc/Marking.h | 150 +- js/src/gc/Memory.cpp | 78 +- js/src/gc/Memory.h | 16 +- js/src/gc/Nursery-inl.h | 20 +- js/src/gc/Nursery.cpp | 196 +- js/src/gc/Nursery.h | 92 +- js/src/gc/RootMarking.cpp | 232 +- js/src/gc/Statistics.cpp | 66 +- js/src/gc/Statistics.h | 42 +- js/src/gc/StoreBuffer.cpp | 62 +- js/src/gc/StoreBuffer.h | 178 +- js/src/gc/Tracer.cpp | 110 +- js/src/gc/Tracer.h | 50 +- js/src/gc/Verifier.cpp | 138 +- js/src/gc/Zone.cpp | 36 +- js/src/gc/Zone.h | 77 +- js/src/gdb/gdb-tests.cpp | 18 +- js/src/gdb/gdb-tests.h | 16 +- js/src/gdb/tests/test-JSObject.cpp | 24 +- js/src/gdb/tests/test-JSString.cpp | 22 +- js/src/gdb/tests/test-Root.cpp | 8 +- js/src/gdb/tests/test-jsid.cpp | 8 +- js/src/jit/AliasAnalysis.cpp | 48 +- js/src/jit/AliasAnalysis.h | 10 +- js/src/jit/AsmJS.cpp | 1404 +-- js/src/jit/AsmJS.h | 8 +- js/src/jit/AsmJSLink.cpp | 172 +- js/src/jit/AsmJSLink.h | 42 +- js/src/jit/AsmJSModule.cpp | 320 +- js/src/jit/AsmJSModule.h | 258 +- js/src/jit/AsmJSSignalHandlers.cpp | 116 +- js/src/jit/AsmJSSignalHandlers.h | 8 +- js/src/jit/BacktrackingAllocator.cpp | 302 +- js/src/jit/BacktrackingAllocator.h | 104 +- js/src/jit/Bailouts.cpp | 56 +- js/src/jit/Bailouts.h | 38 +- js/src/jit/BaselineBailouts.cpp | 196 +- js/src/jit/BaselineCompiler.cpp | 136 +- js/src/jit/BaselineCompiler.h | 14 +- js/src/jit/BaselineDebugModeOSR.cpp | 142 +- js/src/jit/BaselineDebugModeOSR.h | 30 +- js/src/jit/BaselineFrame-inl.h | 14 +- js/src/jit/BaselineFrame.cpp | 34 +- js/src/jit/BaselineFrame.h | 120 +- js/src/jit/BaselineFrameInfo.cpp | 12 +- js/src/jit/BaselineFrameInfo.h | 48 +- js/src/jit/BaselineIC.cpp | 1180 +-- js/src/jit/BaselineIC.h | 1576 ++-- js/src/jit/BaselineInspector.cpp | 138 +- js/src/jit/BaselineInspector.h | 66 +- js/src/jit/BaselineJIT.cpp | 172 +- js/src/jit/BaselineJIT.h | 128 +- js/src/jit/BitSet.cpp | 40 +- js/src/jit/BitSet.h | 24 +- js/src/jit/BytecodeAnalysis.cpp | 24 +- js/src/jit/BytecodeAnalysis.h | 10 +- js/src/jit/C1Spewer.cpp | 30 +- js/src/jit/C1Spewer.h | 18 +- js/src/jit/CodeGenerator.cpp | 1601 ++-- js/src/jit/CodeGenerator.h | 657 +- js/src/jit/CompactBuffer.h | 16 +- js/src/jit/CompileInfo-inl.h | 8 +- js/src/jit/CompileInfo.h | 50 +- js/src/jit/CompileWrappers.cpp | 90 +- js/src/jit/CompileWrappers.h | 70 +- js/src/jit/CompilerRoot.h | 6 +- js/src/jit/EdgeCaseAnalysis.cpp | 2 +- js/src/jit/EdgeCaseAnalysis.h | 6 +- js/src/jit/EffectiveAddressAnalysis.cpp | 20 +- js/src/jit/EffectiveAddressAnalysis.h | 4 +- js/src/jit/ExecutionMode-inl.h | 12 +- js/src/jit/FixedList.h | 14 +- js/src/jit/InlineList.h | 146 +- js/src/jit/Ion.cpp | 463 +- js/src/jit/Ion.h | 100 +- js/src/jit/IonAllocPolicy.h | 74 +- js/src/jit/IonAnalysis.cpp | 486 +- js/src/jit/IonAnalysis.h | 65 +- js/src/jit/IonBuilder.cpp | 2120 ++--- js/src/jit/IonBuilder.h | 816 +- js/src/jit/IonCaches.cpp | 550 +- js/src/jit/IonCaches.h | 262 +- js/src/jit/IonCode.h | 194 +- js/src/jit/IonFrames-inl.h | 24 +- js/src/jit/IonFrames.cpp | 370 +- js/src/jit/IonFrames.h | 220 +- js/src/jit/IonInstrumentation.h | 6 +- js/src/jit/IonLinker.h | 28 +- js/src/jit/IonMacroAssembler.cpp | 268 +- js/src/jit/IonMacroAssembler.h | 358 +- js/src/jit/IonOptimizationLevels.cpp | 6 +- js/src/jit/IonOptimizationLevels.h | 10 +- js/src/jit/IonSpewer.cpp | 38 +- js/src/jit/IonSpewer.h | 44 +- js/src/jit/IonTypes.h | 4 +- js/src/jit/JSONSpewer.cpp | 42 +- js/src/jit/JSONSpewer.h | 30 +- js/src/jit/JitCommon.h | 8 +- js/src/jit/JitCompartment.h | 216 +- js/src/jit/JitFrameIterator-inl.h | 6 +- js/src/jit/JitFrameIterator.h | 136 +- js/src/jit/JitOptions.cpp | 2 +- js/src/jit/JitOptions.h | 2 +- js/src/jit/LICM.cpp | 58 +- js/src/jit/LICM.h | 6 +- js/src/jit/LIR-Common.h | 2004 ++--- js/src/jit/LIR.cpp | 82 +- js/src/jit/LIR.h | 284 +- js/src/jit/LOpcodes.h | 1 + js/src/jit/LinearScan.cpp | 206 +- js/src/jit/LinearScan.h | 40 +- js/src/jit/LiveRangeAllocator.cpp | 112 +- js/src/jit/LiveRangeAllocator.h | 176 +- js/src/jit/Lowering.cpp | 1067 +-- js/src/jit/Lowering.h | 413 +- js/src/jit/MCallOptimize.cpp | 376 +- js/src/jit/MIR.cpp | 704 +- js/src/jit/MIR.h | 2788 +++--- js/src/jit/MIRGenerator.h | 38 +- js/src/jit/MIRGraph.cpp | 244 +- js/src/jit/MIRGraph.h | 272 +- js/src/jit/MOpcodes.h | 5 +- js/src/jit/MoveResolver.cpp | 16 +- js/src/jit/MoveResolver.h | 28 +- js/src/jit/ParallelFunctions.cpp | 128 +- js/src/jit/ParallelFunctions.h | 84 +- js/src/jit/ParallelSafetyAnalysis.cpp | 137 +- js/src/jit/ParallelSafetyAnalysis.h | 14 +- js/src/jit/PcScriptCache.h | 14 +- js/src/jit/PerfSpewer.cpp | 44 +- js/src/jit/PerfSpewer.h | 28 +- js/src/jit/RangeAnalysis.cpp | 360 +- js/src/jit/RangeAnalysis.h | 116 +- js/src/jit/Recover.cpp | 14 +- js/src/jit/Recover.h | 10 +- js/src/jit/RegisterAllocator.cpp | 90 +- js/src/jit/RegisterAllocator.h | 98 +- js/src/jit/RegisterSets.h | 80 +- js/src/jit/Registers.h | 28 +- js/src/jit/RematerializedFrame.cpp | 20 +- js/src/jit/RematerializedFrame.h | 44 +- js/src/jit/Safepoints.cpp | 58 +- js/src/jit/Safepoints.h | 32 +- js/src/jit/Snapshots.cpp | 38 +- js/src/jit/Snapshots.h | 62 +- js/src/jit/StupidAllocator.cpp | 80 +- js/src/jit/StupidAllocator.h | 26 +- js/src/jit/TypeDescrSet.cpp | 44 +- js/src/jit/TypeDescrSet.h | 42 +- js/src/jit/TypePolicy.cpp | 242 +- js/src/jit/TypePolicy.h | 96 +- js/src/jit/UnreachableCodeElimination.cpp | 34 +- js/src/jit/UnreachableCodeElimination.h | 14 +- js/src/jit/VMFunctions.cpp | 220 +- js/src/jit/VMFunctions.h | 232 +- js/src/jit/ValueNumbering.cpp | 80 +- js/src/jit/ValueNumbering.h | 46 +- js/src/jit/arm/Architecture-arm.cpp | 12 +- js/src/jit/arm/Architecture-arm.h | 12 +- js/src/jit/arm/Assembler-arm.cpp | 364 +- js/src/jit/arm/Assembler-arm.h | 248 +- js/src/jit/arm/Bailouts-arm.cpp | 26 +- js/src/jit/arm/BaselineCompiler-arm.cpp | 2 +- js/src/jit/arm/BaselineCompiler-arm.h | 2 +- js/src/jit/arm/BaselineHelpers-arm.h | 44 +- js/src/jit/arm/BaselineIC-arm.cpp | 10 +- js/src/jit/arm/CodeGenerator-arm.cpp | 394 +- js/src/jit/arm/CodeGenerator-arm.h | 254 +- js/src/jit/arm/LIR-arm.h | 126 +- js/src/jit/arm/Lowering-arm.cpp | 168 +- js/src/jit/arm/Lowering-arm.h | 102 +- js/src/jit/arm/MacroAssembler-arm.cpp | 426 +- js/src/jit/arm/MacroAssembler-arm.h | 628 +- js/src/jit/arm/MoveEmitter-arm.cpp | 22 +- js/src/jit/arm/MoveEmitter-arm.h | 20 +- js/src/jit/arm/Simulator-arm.cpp | 338 +- js/src/jit/arm/Simulator-arm.h | 90 +- js/src/jit/arm/Trampoline-arm.cpp | 130 +- js/src/jit/mips/Architecture-mips.cpp | 6 +- js/src/jit/mips/Architecture-mips.h | 14 +- js/src/jit/mips/Assembler-mips.cpp | 150 +- js/src/jit/mips/Assembler-mips.h | 90 +- js/src/jit/mips/Bailouts-mips.cpp | 20 +- js/src/jit/mips/Bailouts-mips.h | 6 +- js/src/jit/mips/BaselineCompiler-mips.cpp | 2 +- js/src/jit/mips/BaselineCompiler-mips.h | 2 +- js/src/jit/mips/BaselineHelpers-mips.h | 34 +- js/src/jit/mips/BaselineIC-mips.cpp | 8 +- js/src/jit/mips/CodeGenerator-mips.cpp | 372 +- js/src/jit/mips/CodeGenerator-mips.h | 250 +- js/src/jit/mips/LIR-mips.h | 108 +- js/src/jit/mips/Lowering-mips.cpp | 172 +- js/src/jit/mips/Lowering-mips.h | 102 +- js/src/jit/mips/MacroAssembler-mips.cpp | 416 +- js/src/jit/mips/MacroAssembler-mips.h | 528 +- js/src/jit/mips/MoveEmitter-mips.cpp | 24 +- js/src/jit/mips/MoveEmitter-mips.h | 22 +- js/src/jit/mips/Trampoline-mips.cpp | 102 +- js/src/jit/shared/Assembler-shared.h | 98 +- js/src/jit/shared/Assembler-x86-shared.cpp | 28 +- js/src/jit/shared/Assembler-x86-shared.h | 388 +- js/src/jit/shared/BaselineCompiler-shared.cpp | 8 +- js/src/jit/shared/BaselineCompiler-shared.h | 22 +- .../shared/BaselineCompiler-x86-shared.cpp | 2 +- .../jit/shared/BaselineCompiler-x86-shared.h | 2 +- js/src/jit/shared/BaselineIC-x86-shared.cpp | 2 +- js/src/jit/shared/CodeGenerator-shared-inl.h | 54 +- js/src/jit/shared/CodeGenerator-shared.cpp | 170 +- js/src/jit/shared/CodeGenerator-shared.h | 238 +- .../jit/shared/CodeGenerator-x86-shared.cpp | 278 +- js/src/jit/shared/CodeGenerator-x86-shared.h | 172 +- js/src/jit/shared/IonAssemblerBuffer.h | 46 +- .../IonAssemblerBufferWithConstantPools.h | 118 +- js/src/jit/shared/LIR-x86-shared.h | 96 +- js/src/jit/shared/Lowering-shared-inl.h | 96 +- js/src/jit/shared/Lowering-shared.cpp | 64 +- js/src/jit/shared/Lowering-shared.h | 119 +- js/src/jit/shared/Lowering-x86-shared.cpp | 94 +- js/src/jit/shared/Lowering-x86-shared.h | 60 +- .../jit/shared/MacroAssembler-x86-shared.cpp | 18 +- js/src/jit/shared/MacroAssembler-x86-shared.h | 218 +- js/src/jit/shared/MoveEmitter-x86-shared.cpp | 40 +- js/src/jit/shared/MoveEmitter-x86-shared.h | 30 +- js/src/jit/x64/Architecture-x64.h | 8 +- js/src/jit/x64/Assembler-x64.cpp | 34 +- js/src/jit/x64/Assembler-x64.h | 150 +- js/src/jit/x64/Bailouts-x64.cpp | 18 +- js/src/jit/x64/BaselineCompiler-x64.cpp | 2 +- js/src/jit/x64/BaselineCompiler-x64.h | 2 +- js/src/jit/x64/BaselineHelpers-x64.h | 46 +- js/src/jit/x64/BaselineIC-x64.cpp | 6 +- js/src/jit/x64/CodeGenerator-x64.cpp | 112 +- js/src/jit/x64/CodeGenerator-x64.h | 70 +- js/src/jit/x64/LIR-x64.h | 28 +- js/src/jit/x64/Lowering-x64.cpp | 54 +- js/src/jit/x64/Lowering-x64.h | 32 +- js/src/jit/x64/MacroAssembler-x64.cpp | 36 +- js/src/jit/x64/MacroAssembler-x64.h | 438 +- js/src/jit/x64/Trampoline-x64.cpp | 98 +- js/src/jit/x86/Architecture-x86.h | 8 +- js/src/jit/x86/Assembler-x86.cpp | 16 +- js/src/jit/x86/Assembler-x86.h | 86 +- js/src/jit/x86/Bailouts-x86.cpp | 26 +- js/src/jit/x86/BaselineCompiler-x86.cpp | 2 +- js/src/jit/x86/BaselineCompiler-x86.h | 2 +- js/src/jit/x86/BaselineHelpers-x86.h | 46 +- js/src/jit/x86/BaselineIC-x86.cpp | 6 +- js/src/jit/x86/CodeGenerator-x86.cpp | 196 +- js/src/jit/x86/CodeGenerator-x86.h | 90 +- js/src/jit/x86/LIR-x86.h | 34 +- js/src/jit/x86/Lowering-x86.cpp | 68 +- js/src/jit/x86/Lowering-x86.h | 34 +- js/src/jit/x86/MacroAssembler-x86.cpp | 58 +- js/src/jit/x86/MacroAssembler-x86.h | 382 +- js/src/jit/x86/Trampoline-x86.cpp | 124 +- js/src/jsalloc.cpp | 8 +- js/src/jsalloc.h | 30 +- js/src/jsanalyze.cpp | 292 +- js/src/jsanalyze.h | 102 +- .../jsapi-tests/testAddPropertyPropcache.cpp | 2 +- js/src/jsapi-tests/testArgumentsObject.cpp | 2 +- js/src/jsapi-tests/testArrayBuffer.cpp | 10 +- js/src/jsapi-tests/testBug604087.cpp | 12 +- .../testCallNonGenericMethodOnProxy.cpp | 4 +- js/src/jsapi-tests/testChromeBuffer.cpp | 28 +- js/src/jsapi-tests/testClassGetter.cpp | 10 +- js/src/jsapi-tests/testCloneScript.cpp | 26 +- js/src/jsapi-tests/testConservativeGC.cpp | 12 +- js/src/jsapi-tests/testContexts.cpp | 8 +- js/src/jsapi-tests/testCustomIterator.cpp | 10 +- js/src/jsapi-tests/testDebugger.cpp | 36 +- .../testDefineGetterSetterNonEnumerable.cpp | 6 +- js/src/jsapi-tests/testEnclosingFunction.cpp | 4 +- js/src/jsapi-tests/testErrorCopying.cpp | 2 +- js/src/jsapi-tests/testExternalStrings.cpp | 6 +- js/src/jsapi-tests/testFindSCCs.cpp | 26 +- .../testFreshGlobalEvalRedefinition.cpp | 4 +- js/src/jsapi-tests/testFuncCallback.cpp | 18 +- js/src/jsapi-tests/testGCFinalizeCallback.cpp | 2 +- js/src/jsapi-tests/testGCHeapPostBarriers.cpp | 8 +- js/src/jsapi-tests/testGCOutOfMemory.cpp | 4 +- .../jsapi-tests/testGCStoreBufferRemoval.cpp | 12 +- js/src/jsapi-tests/testHashTable.cpp | 12 +- js/src/jsapi-tests/testIndexToString.cpp | 16 +- js/src/jsapi-tests/testIntString.cpp | 2 +- js/src/jsapi-tests/testIntern.cpp | 4 +- js/src/jsapi-tests/testJitRValueAlloc.cpp | 2 +- js/src/jsapi-tests/testLookup.cpp | 8 +- js/src/jsapi-tests/testLooselyEqual.cpp | 2 +- js/src/jsapi-tests/testMappedArrayBuffer.cpp | 20 +- js/src/jsapi-tests/testNewObject.cpp | 2 +- js/src/jsapi-tests/testNullRoot.cpp | 6 +- js/src/jsapi-tests/testOOM.cpp | 6 +- .../testObjectEmulatingUndefined.cpp | 4 +- js/src/jsapi-tests/testOps.cpp | 2 +- js/src/jsapi-tests/testOriginPrincipals.cpp | 16 +- js/src/jsapi-tests/testParseJSON.cpp | 26 +- js/src/jsapi-tests/testPersistentRooted.cpp | 24 +- js/src/jsapi-tests/testProfileStrings.cpp | 16 +- js/src/jsapi-tests/testPropCache.cpp | 2 +- js/src/jsapi-tests/testRegExp.cpp | 2 +- .../testRegExpInstanceProperties.cpp | 10 +- js/src/jsapi-tests/testResolveRecursion.cpp | 14 +- js/src/jsapi-tests/testScriptInfo.cpp | 6 +- js/src/jsapi-tests/testScriptObject.cpp | 18 +- js/src/jsapi-tests/testSetProperty.cpp | 2 +- .../testSetPropertyIgnoringNamedGetter.cpp | 8 +- js/src/jsapi-tests/testSlowScript.cpp | 6 +- js/src/jsapi-tests/testSourcePolicy.cpp | 12 +- js/src/jsapi-tests/testStringBuffer.cpp | 2 +- js/src/jsapi-tests/testTrap.cpp | 6 +- js/src/jsapi-tests/testTypedArrays.cpp | 20 +- js/src/jsapi-tests/testUTF8.cpp | 8 +- js/src/jsapi-tests/testUncaughtError.cpp | 2 +- js/src/jsapi-tests/testValueABI.cpp | 4 +- js/src/jsapi-tests/testXDR.cpp | 58 +- js/src/jsapi-tests/tests.cpp | 16 +- js/src/jsapi-tests/tests.h | 80 +- js/src/jsapi.cpp | 1630 ++-- js/src/jsapi.h | 1922 ++--- js/src/jsarray.cpp | 322 +- js/src/jsarray.h | 64 +- js/src/jsatom.cpp | 118 +- js/src/jsatom.h | 54 +- js/src/jsatominlines.h | 34 +- js/src/jsbool.cpp | 28 +- js/src/jsbool.h | 8 +- js/src/jsboolinlines.h | 4 +- js/src/jsclist.h | 4 +- js/src/jscntxt.cpp | 218 +- js/src/jscntxt.h | 374 +- js/src/jscntxtinlines.h | 112 +- js/src/jscompartment.cpp | 156 +- js/src/jscompartment.h | 230 +- js/src/jscompartmentinlines.h | 10 +- js/src/jscrashreport.cpp | 26 +- js/src/jscrashreport.h | 4 +- js/src/jsdate.cpp | 304 +- js/src/jsdate.h | 18 +- js/src/jsdtoa.cpp | 46 +- js/src/jsdtoa.h | 14 +- js/src/jsexn.cpp | 120 +- js/src/jsexn.h | 26 +- js/src/jsfriendapi.cpp | 382 +- js/src/jsfriendapi.h | 900 +- js/src/jsfun.cpp | 194 +- js/src/jsfun.h | 166 +- js/src/jsfuninlines.h | 20 +- js/src/jsgc.cpp | 809 +- js/src/jsgc.h | 285 +- js/src/jsgcinlines.h | 172 +- js/src/jshashutil.h | 8 +- js/src/jsinfer.cpp | 856 +- js/src/jsinfer.h | 464 +- js/src/jsinferinlines.h | 266 +- js/src/jsiter.cpp | 314 +- js/src/jsiter.h | 100 +- js/src/jskwgen.cpp | 52 +- js/src/jsmath.cpp | 154 +- js/src/jsmath.h | 130 +- js/src/jsnativestack.cpp | 14 +- js/src/jsnativestack.h | 4 +- js/src/jsnum.cpp | 318 +- js/src/jsnum.h | 92 +- js/src/jsobj.cpp | 716 +- js/src/jsobj.h | 570 +- js/src/jsobjinlines.h | 256 +- js/src/json.cpp | 74 +- js/src/json.h | 10 +- js/src/jsonparser.cpp | 42 +- js/src/jsonparser.h | 38 +- js/src/jsopcode.cpp | 364 +- js/src/jsopcode.h | 120 +- js/src/jsopcodeinlines.h | 14 +- js/src/jsprf.cpp | 114 +- js/src/jsprf.h | 14 +- js/src/jspropertytree.cpp | 84 +- js/src/jspropertytree.h | 40 +- js/src/jsproxy.cpp | 576 +- js/src/jsproxy.h | 284 +- js/src/jspubtd.h | 94 +- js/src/jsreflect.cpp | 608 +- js/src/jsscript.cpp | 612 +- js/src/jsscript.h | 550 +- js/src/jsscriptinlines.h | 54 +- js/src/jsstr.cpp | 786 +- js/src/jsstr.h | 148 +- js/src/jstypes.h | 12 +- js/src/jsutil.cpp | 14 +- js/src/jsutil.h | 64 +- js/src/jswatchpoint.cpp | 62 +- js/src/jswatchpoint.h | 34 +- js/src/jsweakcache.h | 12 +- js/src/jsweakmap.cpp | 126 +- js/src/jsweakmap.h | 70 +- js/src/jsworkers.cpp | 148 +- js/src/jsworkers.h | 122 +- js/src/jswrapper.cpp | 230 +- js/src/jswrapper.h | 188 +- js/src/perf/jsperf.cpp | 10 +- js/src/perf/jsperf.h | 2 +- js/src/perf/pm_linux.cpp | 2 +- js/src/prmjtime.cpp | 10 +- js/src/prmjtime.h | 2 +- js/src/shell/js.cpp | 844 +- js/src/shell/jsheaptools.cpp | 132 +- js/src/shell/jsheaptools.h | 2 +- js/src/shell/jsoptparse.cpp | 166 +- js/src/shell/jsoptparse.h | 124 +- js/src/vm/ArgumentsObject-inl.h | 14 +- js/src/vm/ArgumentsObject.cpp | 124 +- js/src/vm/ArgumentsObject.h | 50 +- js/src/vm/ArrayBufferObject.cpp | 274 +- js/src/vm/ArrayBufferObject.h | 108 +- js/src/vm/ArrayObject-inl.h | 2 +- js/src/vm/ArrayObject.h | 2 +- js/src/vm/BooleanObject-inl.h | 8 +- js/src/vm/BooleanObject.h | 6 +- js/src/vm/CallNonGenericMethod.cpp | 4 +- js/src/vm/CharacterEncoding.cpp | 46 +- js/src/vm/Compression.cpp | 18 +- js/src/vm/Compression.h | 10 +- js/src/vm/DateObject.h | 44 +- js/src/vm/DateTime.cpp | 8 +- js/src/vm/Debugger-inl.h | 2 +- js/src/vm/Debugger.cpp | 1036 +-- js/src/vm/Debugger.h | 334 +- js/src/vm/DebuggerMemory.cpp | 2 +- js/src/vm/DebuggerMemory.h | 2 +- js/src/vm/ErrorObject-inl.h | 16 +- js/src/vm/ErrorObject.cpp | 24 +- js/src/vm/ErrorObject.h | 38 +- js/src/vm/ForkJoin.cpp | 298 +- js/src/vm/ForkJoin.h | 106 +- js/src/vm/GeneratorObject.h | 4 +- js/src/vm/GlobalObject.cpp | 136 +- js/src/vm/GlobalObject.h | 214 +- js/src/vm/Interpreter-inl.h | 102 +- js/src/vm/Interpreter.cpp | 468 +- js/src/vm/Interpreter.h | 196 +- js/src/vm/MallocProvider.h | 46 +- js/src/vm/MatchPairs.h | 26 +- js/src/vm/MemoryMetrics.cpp | 138 +- js/src/vm/Monitor.h | 22 +- js/src/vm/NumberObject-inl.h | 8 +- js/src/vm/NumberObject.h | 6 +- js/src/vm/ObjectImpl-inl.h | 6 +- js/src/vm/ObjectImpl.cpp | 94 +- js/src/vm/ObjectImpl.h | 226 +- js/src/vm/OldDebugAPI.cpp | 284 +- js/src/vm/PIC.cpp | 64 +- js/src/vm/PIC.h | 60 +- js/src/vm/PosixNSPR.cpp | 80 +- js/src/vm/PosixNSPR.h | 46 +- js/src/vm/Probes-inl.h | 20 +- js/src/vm/Probes.cpp | 16 +- js/src/vm/Probes.h | 38 +- js/src/vm/PropertyKey.cpp | 2 +- js/src/vm/ProxyObject.cpp | 16 +- js/src/vm/ProxyObject.h | 36 +- js/src/vm/RegExpObject.cpp | 142 +- js/src/vm/RegExpObject.h | 148 +- js/src/vm/RegExpStatics.cpp | 26 +- js/src/vm/RegExpStatics.h | 110 +- js/src/vm/Runtime-inl.h | 20 +- js/src/vm/Runtime.cpp | 73 +- js/src/vm/Runtime.h | 449 +- js/src/vm/SPSProfiler.cpp | 64 +- js/src/vm/SPSProfiler.h | 96 +- js/src/vm/SavedStacks.cpp | 118 +- js/src/vm/SavedStacks.h | 64 +- js/src/vm/ScopeObject-inl.h | 14 +- js/src/vm/ScopeObject.cpp | 466 +- js/src/vm/ScopeObject.h | 258 +- js/src/vm/SelfHosting.cpp | 154 +- js/src/vm/SelfHosting.h | 4 +- js/src/vm/Shape-inl.h | 40 +- js/src/vm/Shape.cpp | 328 +- js/src/vm/Shape.h | 372 +- js/src/vm/SharedArrayObject.cpp | 56 +- js/src/vm/SharedArrayObject.h | 26 +- js/src/vm/Stack-inl.h | 154 +- js/src/vm/Stack.cpp | 216 +- js/src/vm/Stack.h | 482 +- js/src/vm/String-inl.h | 112 +- js/src/vm/String.cpp | 114 +- js/src/vm/String.h | 270 +- js/src/vm/StringBuffer.cpp | 24 +- js/src/vm/StringBuffer.h | 52 +- js/src/vm/StringObject-inl.h | 10 +- js/src/vm/StringObject.h | 18 +- js/src/vm/StructuredClone.cpp | 364 +- js/src/vm/ThreadPool.cpp | 38 +- js/src/vm/ThreadPool.h | 46 +- js/src/vm/TraceLogging.cpp | 84 +- js/src/vm/TraceLogging.h | 121 +- js/src/vm/TypedArrayObject.cpp | 480 +- js/src/vm/TypedArrayObject.h | 150 +- js/src/vm/Unicode.h | 4 +- js/src/vm/WeakMapObject.h | 2 +- js/src/vm/WeakMapPtr.cpp | 14 +- js/src/vm/Xdr.cpp | 16 +- js/src/vm/Xdr.h | 88 +- js/src/vtune/ittnotify_config.h | 2 +- js/src/vtune/jitprofiling.h | 6 +- js/src/yarr/BumpPointerAllocator.h | 2 +- js/src/yarr/YarrInterpreter.cpp | 12 +- js/src/yarr/YarrInterpreter.h | 8 +- js/src/yarr/YarrJIT.cpp | 2 +- js/src/yarr/YarrJIT.h | 2 +- js/src/yarr/YarrParser.h | 2 +- js/src/yarr/YarrPattern.cpp | 8 +- js/src/yarr/wtfbridge.h | 94 +- js/xpconnect/loader/mozJSComponentLoader.cpp | 108 +- js/xpconnect/loader/mozJSComponentLoader.h | 20 +- js/xpconnect/loader/mozJSLoaderUtils.cpp | 26 +- js/xpconnect/loader/mozJSLoaderUtils.h | 20 +- js/xpconnect/loader/mozJSSubScriptLoader.cpp | 38 +- js/xpconnect/loader/mozJSSubScriptLoader.h | 12 +- js/xpconnect/public/SandboxPrivate.h | 6 +- js/xpconnect/public/nsAXPCNativeCallContext.h | 20 +- js/xpconnect/public/nsAutoJSValHolder.h | 4 +- js/xpconnect/public/xpc_map_end.h | 36 +- js/xpconnect/src/BackstagePass.h | 2 +- js/xpconnect/src/Sandbox.cpp | 206 +- js/xpconnect/src/XPCCallContext.cpp | 32 +- js/xpconnect/src/XPCComponents.cpp | 458 +- js/xpconnect/src/XPCContext.cpp | 4 +- js/xpconnect/src/XPCConvert.cpp | 38 +- js/xpconnect/src/XPCDebug.cpp | 10 +- js/xpconnect/src/XPCInlines.h | 8 +- js/xpconnect/src/XPCJSContextStack.cpp | 20 +- js/xpconnect/src/XPCJSID.cpp | 92 +- js/xpconnect/src/XPCJSMemoryReporter.h | 8 +- js/xpconnect/src/XPCJSRuntime.cpp | 352 +- js/xpconnect/src/XPCLocale.cpp | 26 +- js/xpconnect/src/XPCLog.cpp | 2 +- js/xpconnect/src/XPCLog.h | 2 +- js/xpconnect/src/XPCMaps.cpp | 52 +- js/xpconnect/src/XPCMaps.h | 90 +- js/xpconnect/src/XPCQuickStubs.cpp | 240 +- js/xpconnect/src/XPCQuickStubs.h | 206 +- js/xpconnect/src/XPCRuntimeService.cpp | 28 +- js/xpconnect/src/XPCShellImpl.cpp | 150 +- js/xpconnect/src/XPCString.cpp | 20 +- js/xpconnect/src/XPCThrower.cpp | 6 +- js/xpconnect/src/XPCVariant.cpp | 74 +- js/xpconnect/src/XPCWrappedJS.cpp | 16 +- js/xpconnect/src/XPCWrappedJSClass.cpp | 26 +- js/xpconnect/src/XPCWrappedNative.cpp | 58 +- js/xpconnect/src/XPCWrappedNativeInfo.cpp | 4 +- js/xpconnect/src/XPCWrappedNativeJSOps.cpp | 112 +- js/xpconnect/src/XPCWrappedNativeProto.cpp | 6 +- js/xpconnect/src/XPCWrappedNativeScope.cpp | 100 +- js/xpconnect/src/XPCWrapper.cpp | 14 +- js/xpconnect/src/XPCWrapper.h | 10 +- js/xpconnect/src/nsCxPusher.cpp | 14 +- js/xpconnect/src/nsCxPusher.h | 8 +- js/xpconnect/src/nsDOMQS.h | 70 +- js/xpconnect/src/nsScriptError.cpp | 20 +- js/xpconnect/src/nsXPConnect.cpp | 184 +- js/xpconnect/src/qsObjectHelper.h | 6 +- js/xpconnect/src/xpcObjectHelper.h | 16 +- js/xpconnect/src/xpcprivate.h | 340 +- js/xpconnect/src/xpcpublic.h | 124 +- .../components/native/xpctest_attributes.cpp | 24 +- .../components/native/xpctest_params.cpp | 76 +- .../tests/components/native/xpctest_private.h | 2 +- js/xpconnect/wrappers/AccessCheck.cpp | 64 +- js/xpconnect/wrappers/AccessCheck.h | 36 +- js/xpconnect/wrappers/ChromeObjectWrapper.cpp | 24 +- js/xpconnect/wrappers/ChromeObjectWrapper.h | 14 +- js/xpconnect/wrappers/FilteringWrapper.cpp | 34 +- js/xpconnect/wrappers/FilteringWrapper.h | 26 +- js/xpconnect/wrappers/WaiveXrayWrapper.cpp | 16 +- js/xpconnect/wrappers/WaiveXrayWrapper.h | 18 +- js/xpconnect/wrappers/WrapperFactory.cpp | 86 +- js/xpconnect/wrappers/WrapperFactory.h | 28 +- js/xpconnect/wrappers/XrayWrapper.cpp | 450 +- js/xpconnect/wrappers/XrayWrapper.h | 124 +- layout/generic/nsBlockFrame.cpp | 18 +- layout/generic/nsBlockFrame.h | 14 +- layout/generic/nsContainerFrame.cpp | 49 +- layout/generic/nsInlineFrame.cpp | 42 +- layout/generic/nsInlineFrame.h | 4 +- layout/svg/SVGTextFrame.cpp | 88 +- layout/svg/SVGTextFrame.h | 23 +- layout/tables/nsTableFrame.cpp | 2 + layout/tables/nsTableRowFrame.cpp | 2 + layout/tables/nsTableRowGroupFrame.cpp | 2 + media/mtransport/nricectx.h | 13 + media/mtransport/nricemediastream.cpp | 1 + media/mtransport/nricemediastream.h | 5 +- .../src/peerconnection/PeerConnectionImpl.cpp | 66 +- .../src/peerconnection/PeerConnectionImpl.h | 2 +- mobile/android/config/mozconfigs/common | 2 + modules/libjar/nsZipArchive.cpp | 22 +- netwerk/base/src/ProxyAutoConfig.cpp | 34 +- netwerk/base/src/ProxyAutoConfig.h | 3 +- .../test/unit/test_protocolproxyservice.js | 2 + parser/expat/lib/xmlparse.c | 23 +- python/redo/PKG-INFO | 10 + python/redo/README | 4 + python/redo/redo.egg-info/PKG-INFO | 10 + python/redo/redo.egg-info/SOURCES.txt | 9 + .../redo/redo.egg-info/dependency_links.txt | 1 + python/redo/redo.egg-info/entry_points.txt | 3 + python/redo/redo.egg-info/top_level.txt | 1 + python/redo/redo/__init__.py | 218 + python/redo/redo/cmd.py | 53 + python/redo/setup.cfg | 5 + python/redo/setup.py | 14 + python/requests/HISTORY.rst | 904 ++ python/requests/LICENSE | 13 + python/requests/MANIFEST.in | 1 + python/requests/NOTICE | 54 + python/requests/PKG-INFO | 1011 +++ python/requests/README.rst | 85 + python/requests/requests.egg-info/PKG-INFO | 1011 +++ python/requests/requests.egg-info/SOURCES.txt | 95 + .../requests.egg-info/dependency_links.txt | 1 + .../requests/requests.egg-info/not-zip-safe | 1 + .../requests/requests.egg-info/requires.txt | 5 + .../requests/requests.egg-info/top_level.txt | 1 + python/requests/requests/__init__.py | 77 + python/requests/requests/adapters.py | 437 + python/requests/requests/api.py | 131 + python/requests/requests/auth.py | 209 + python/requests/requests/cacert.pem | 5026 +++++++++++ python/requests/requests/certs.py | 25 + python/requests/requests/compat.py | 115 + python/requests/requests/cookies.py | 454 + python/requests/requests/exceptions.py | 99 + python/requests/requests/hooks.py | 45 + python/requests/requests/models.py | 839 ++ python/requests/requests/packages/__init__.py | 3 + .../requests/packages/chardet/__init__.py | 32 + .../requests/packages/chardet/big5freq.py | 925 ++ .../requests/packages/chardet/big5prober.py | 42 + .../requests/packages/chardet/chardetect.py | 80 + .../packages/chardet/chardistribution.py | 231 + .../packages/chardet/charsetgroupprober.py | 106 + .../packages/chardet/charsetprober.py | 62 + .../packages/chardet/codingstatemachine.py | 61 + .../requests/packages/chardet/compat.py | 34 + .../requests/packages/chardet/constants.py | 39 + .../requests/packages/chardet/cp949prober.py | 44 + .../requests/packages/chardet/escprober.py | 86 + .../requests/packages/chardet/escsm.py | 242 + .../requests/packages/chardet/eucjpprober.py | 90 + .../requests/packages/chardet/euckrfreq.py | 596 ++ .../requests/packages/chardet/euckrprober.py | 42 + .../requests/packages/chardet/euctwfreq.py | 428 + .../requests/packages/chardet/euctwprober.py | 41 + .../requests/packages/chardet/gb2312freq.py | 472 ++ .../requests/packages/chardet/gb2312prober.py | 41 + .../requests/packages/chardet/hebrewprober.py | 283 + .../requests/packages/chardet/jisfreq.py | 569 ++ .../requests/packages/chardet/jpcntx.py | 227 + .../packages/chardet/langbulgarianmodel.py | 229 + .../packages/chardet/langcyrillicmodel.py | 329 + .../packages/chardet/langgreekmodel.py | 225 + .../packages/chardet/langhebrewmodel.py | 201 + .../packages/chardet/langhungarianmodel.py | 225 + .../packages/chardet/langthaimodel.py | 200 + .../requests/packages/chardet/latin1prober.py | 139 + .../packages/chardet/mbcharsetprober.py | 86 + .../packages/chardet/mbcsgroupprober.py | 54 + .../requests/packages/chardet/mbcssm.py | 572 ++ .../packages/chardet/sbcharsetprober.py | 120 + .../packages/chardet/sbcsgroupprober.py | 69 + .../requests/packages/chardet/sjisprober.py | 91 + .../packages/chardet/universaldetector.py | 170 + .../requests/packages/chardet/utf8prober.py | 76 + .../requests/packages/urllib3/__init__.py | 66 + .../requests/packages/urllib3/_collections.py | 198 + .../requests/packages/urllib3/connection.py | 262 + .../packages/urllib3/connectionpool.py | 761 ++ .../packages/urllib3/contrib/__init__.py | 0 .../packages/urllib3/contrib/ntlmpool.py | 114 + .../packages/urllib3/contrib/pyopenssl.py | 303 + .../requests/packages/urllib3/exceptions.py | 159 + .../requests/packages/urllib3/fields.py | 177 + .../requests/packages/urllib3/filepost.py | 93 + .../packages/urllib3/packages/__init__.py | 4 + .../packages/urllib3/packages/ordered_dict.py | 259 + .../requests/packages/urllib3/packages/six.py | 385 + .../packages/ssl_match_hostname/__init__.py | 13 + .../ssl_match_hostname/_implementation.py | 105 + .../requests/packages/urllib3/poolmanager.py | 265 + .../requests/packages/urllib3/request.py | 141 + .../requests/packages/urllib3/response.py | 333 + .../packages/urllib3/util/__init__.py | 24 + .../packages/urllib3/util/connection.py | 97 + .../requests/packages/urllib3/util/request.py | 71 + .../packages/urllib3/util/response.py | 22 + .../requests/packages/urllib3/util/retry.py | 285 + .../requests/packages/urllib3/util/ssl_.py | 254 + .../requests/packages/urllib3/util/timeout.py | 240 + .../requests/packages/urllib3/util/url.py | 212 + python/requests/requests/sessions.py | 682 ++ python/requests/requests/status_codes.py | 89 + python/requests/requests/structures.py | 104 + python/requests/requests/utils.py | 697 ++ python/requests/requirements.txt | 4 + python/requests/setup.cfg | 8 + python/requests/setup.py | 68 + python/requests/test_requests.py | 1558 ++++ .../manager/boot/src/nsSTSPreloadList.errors | 43 +- .../manager/boot/src/nsSTSPreloadList.inc | 36 +- security/nss/Makefile | 3 + security/nss/TAG-INFO | 2 +- security/nss/cmd/certutil/certext.c | 13 +- security/nss/cmd/certutil/certutil.c | 55 +- security/nss/cmd/certutil/keystuff.c | 3 - security/nss/cmd/checkcert/checkcert.c | 35 +- security/nss/cmd/crlutil/crlgen.c | 2 +- security/nss/cmd/lib/secutil.c | 44 + security/nss/cmd/lib/secutil.h | 3 + security/nss/cmd/modutil/install.c | 7 +- security/nss/cmd/pk12util/pk12util.c | 5 +- security/nss/cmd/platlibs.mk | 8 +- security/nss/cmd/pp/pp.c | 3 +- security/nss/cmd/rsaperf/rsaperf.c | 10 +- security/nss/cmd/ssltap/ssltap-manual.html | 340 +- security/nss/cmd/ssltap/ssltap.c | 1 + security/nss/cmd/tstclnt/manifest.mn | 1 + security/nss/cmd/tstclnt/tstclnt.c | 178 +- security/nss/coreconf/Darwin.mk | 19 + security/nss/coreconf/Linux.mk | 2 +- security/nss/coreconf/WIN32.mk | 51 +- security/nss/coreconf/command.mk | 3 +- security/nss/coreconf/location.mk | 4 + security/nss/coreconf/rules.mk | 4 +- security/nss/coreconf/ruleset.mk | 6 +- security/nss/doc/Makefile | 13 - security/nss/doc/certutil.xml | 64 +- security/nss/doc/html/certutil.html | 18 +- security/nss/doc/html/pp.html | 6 +- security/nss/doc/nroff/certutil.1 | 185 +- security/nss/doc/nroff/pp.1 | 20 +- security/nss/doc/pp.xml | 18 +- security/nss/external_tests/Makefile | 44 + security/nss/external_tests/README | 31 + .../nss/external_tests/google_test/Makefile | 45 + .../external_tests/google_test/gtest/CHANGES | 157 + .../google_test/gtest/CMakeLists.txt | 260 + .../google_test/gtest/CONTRIBUTORS | 37 + .../external_tests/google_test/gtest/LICENSE | 28 + .../google_test/gtest/Makefile.am | 306 + .../external_tests/google_test/gtest/README | 435 + .../google_test/gtest/build-aux/.keep | 0 .../gtest/cmake/internal_utils.cmake | 242 + .../google_test/gtest/codegear/gtest.cbproj | 138 + .../gtest/codegear/gtest.groupproj | 54 + .../google_test/gtest/codegear/gtest_all.cc | 38 + .../google_test/gtest/codegear/gtest_link.cc | 40 + .../gtest/codegear/gtest_main.cbproj | 82 + .../gtest/codegear/gtest_unittest.cbproj | 88 + .../google_test/gtest/configure.ac | 68 + .../gtest/include/gtest/gtest-death-test.h | 294 + .../gtest/include/gtest/gtest-message.h | 250 + .../gtest/include/gtest/gtest-param-test.h | 1421 ++++ .../include/gtest/gtest-param-test.h.pump | 487 ++ .../gtest/include/gtest/gtest-printers.h | 891 ++ .../gtest/include/gtest/gtest-spi.h | 232 + .../gtest/include/gtest/gtest-test-part.h | 179 + .../gtest/include/gtest/gtest-typed-test.h | 259 + .../google_test/gtest/include/gtest/gtest.h | 2307 +++++ .../gtest/include/gtest/gtest_pred_impl.h | 358 + .../gtest/include/gtest/gtest_prod.h | 58 + .../internal/gtest-death-test-internal.h | 319 + .../include/gtest/internal/gtest-filepath.h | 206 + .../include/gtest/internal/gtest-internal.h | 1193 +++ .../include/gtest/internal/gtest-linked_ptr.h | 233 + .../internal/gtest-param-util-generated.h | 5143 +++++++++++ .../gtest-param-util-generated.h.pump | 301 + .../include/gtest/internal/gtest-param-util.h | 619 ++ .../gtest/include/gtest/internal/gtest-port.h | 2432 ++++++ .../include/gtest/internal/gtest-string.h | 167 + .../include/gtest/internal/gtest-tuple.h | 1020 +++ .../include/gtest/internal/gtest-tuple.h.pump | 347 + .../include/gtest/internal/gtest-type-util.h | 3331 ++++++++ .../gtest/internal/gtest-type-util.h.pump | 297 + .../google_test/gtest/m4/acx_pthread.m4 | 363 + .../google_test/gtest/m4/gtest.m4 | 74 + .../google_test/gtest/make/Makefile | 82 + .../google_test/gtest/msvc/gtest-md.sln | 45 + .../google_test/gtest/msvc/gtest-md.vcproj | 126 + .../google_test/gtest/msvc/gtest.sln | 45 + .../google_test/gtest/msvc/gtest.vcproj | 126 + .../gtest/msvc/gtest_main-md.vcproj | 129 + .../google_test/gtest/msvc/gtest_main.vcproj | 129 + .../gtest/msvc/gtest_prod_test-md.vcproj | 164 + .../gtest/msvc/gtest_prod_test.vcproj | 164 + .../gtest/msvc/gtest_unittest-md.vcproj | 147 + .../gtest/msvc/gtest_unittest.vcproj | 147 + .../google_test/gtest/samples/prime_tables.h | 123 + .../google_test/gtest/samples/sample1.cc | 68 + .../google_test/gtest/samples/sample1.h | 43 + .../gtest/samples/sample10_unittest.cc | 144 + .../gtest/samples/sample1_unittest.cc | 153 + .../google_test/gtest/samples/sample2.cc | 56 + .../google_test/gtest/samples/sample2.h | 85 + .../gtest/samples/sample2_unittest.cc | 109 + .../google_test/gtest/samples/sample3-inl.h | 172 + .../gtest/samples/sample3_unittest.cc | 151 + .../google_test/gtest/samples/sample4.cc | 46 + .../google_test/gtest/samples/sample4.h | 53 + .../gtest/samples/sample4_unittest.cc | 45 + .../gtest/samples/sample5_unittest.cc | 199 + .../gtest/samples/sample6_unittest.cc | 224 + .../gtest/samples/sample7_unittest.cc | 130 + .../gtest/samples/sample8_unittest.cc | 173 + .../gtest/samples/sample9_unittest.cc | 160 + .../google_test/gtest/scripts/common.py | 83 + .../gtest/scripts/fuse_gtest_files.py | 250 + .../gtest/scripts/gen_gtest_pred_impl.py | 730 ++ .../google_test/gtest/scripts/gtest-config.in | 274 + .../google_test/gtest/scripts/pump.py | 855 ++ .../google_test/gtest/scripts/release_docs.py | 158 + .../google_test/gtest/scripts/test/Makefile | 59 + .../google_test/gtest/scripts/upload.py | 1387 +++ .../google_test/gtest/scripts/upload_gtest.py | 78 + .../google_test/gtest/src/gtest-all.cc | 48 + .../google_test/gtest/src/gtest-death-test.cc | 1346 +++ .../google_test/gtest/src/gtest-filepath.cc | 387 + .../gtest/src/gtest-internal-inl.h | 1192 +++ .../google_test/gtest/src/gtest-port.cc | 1184 +++ .../google_test/gtest/src/gtest-printers.cc | 373 + .../google_test/gtest/src/gtest-test-part.cc | 110 + .../google_test/gtest/src/gtest-typed-test.cc | 110 + .../google_test/gtest/src/gtest.cc | 5291 ++++++++++++ .../google_test/gtest/src/gtest_main.cc | 38 + .../gtest/test/gtest-death-test_ex_test.cc | 93 + .../gtest/test/gtest-death-test_test.cc | 1423 ++++ .../gtest/test/gtest-filepath_test.cc | 680 ++ .../gtest/test/gtest-linked_ptr_test.cc | 154 + .../gtest/test/gtest-listener_test.cc | 310 + .../gtest/test/gtest-message_test.cc | 159 + .../gtest/test/gtest-options_test.cc | 215 + .../gtest/test/gtest-param-test2_test.cc | 65 + .../gtest/test/gtest-param-test_test.cc | 904 ++ .../gtest/test/gtest-param-test_test.h | 57 + .../google_test/gtest/test/gtest-port_test.cc | 1323 +++ .../gtest/test/gtest-printers_test.cc | 1651 ++++ .../gtest/test/gtest-test-part_test.cc | 208 + .../gtest/test/gtest-tuple_test.cc | 320 + .../gtest/test/gtest-typed-test2_test.cc | 45 + .../gtest/test/gtest-typed-test_test.cc | 361 + .../gtest/test/gtest-typed-test_test.h | 66 + .../gtest/test/gtest-unittest-api_test.cc | 341 + .../google_test/gtest/test/gtest_all_test.cc | 47 + .../test/gtest_break_on_failure_unittest.py | 212 + .../test/gtest_break_on_failure_unittest_.cc | 88 + .../gtest/test/gtest_catch_exceptions_test.py | 237 + .../test/gtest_catch_exceptions_test_.cc | 311 + .../gtest/test/gtest_color_test.py | 130 + .../gtest/test/gtest_color_test_.cc | 71 + .../gtest/test/gtest_env_var_test.py | 103 + .../gtest/test/gtest_env_var_test_.cc | 126 + .../gtest/test/gtest_environment_test.cc | 192 + .../gtest/test/gtest_filter_unittest.py | 633 ++ .../gtest/test/gtest_filter_unittest_.cc | 140 + .../google_test/gtest/test/gtest_help_test.py | 172 + .../gtest/test/gtest_help_test_.cc | 46 + .../gtest/test/gtest_list_tests_unittest.py | 207 + .../gtest/test/gtest_list_tests_unittest_.cc | 157 + .../gtest/test/gtest_main_unittest.cc | 45 + .../gtest/test/gtest_no_test_unittest.cc | 56 + .../gtest/test/gtest_output_test.py | 335 + .../gtest/test/gtest_output_test_.cc | 1039 +++ .../test/gtest_output_test_golden_lin.txt | 732 ++ .../gtest/test/gtest_pred_impl_unittest.cc | 2427 ++++++ .../gtest/test/gtest_premature_exit_test.cc | 143 + .../google_test/gtest/test/gtest_prod_test.cc | 57 + .../gtest/test/gtest_repeat_test.cc | 253 + .../gtest/test/gtest_shuffle_test.py | 325 + .../gtest/test/gtest_shuffle_test_.cc | 103 + .../gtest/test/gtest_sole_header_test.cc | 57 + .../gtest/test/gtest_stress_test.cc | 256 + .../gtest/test/gtest_test_utils.py | 320 + .../test/gtest_throw_on_failure_ex_test.cc | 92 + .../gtest/test/gtest_throw_on_failure_test.py | 171 + .../test/gtest_throw_on_failure_test_.cc | 72 + .../gtest/test/gtest_uninitialized_test.py | 70 + .../gtest/test/gtest_uninitialized_test_.cc | 43 + .../google_test/gtest/test/gtest_unittest.cc | 7525 +++++++++++++++++ .../gtest/test/gtest_xml_outfile1_test_.cc | 49 + .../gtest/test/gtest_xml_outfile2_test_.cc | 49 + .../gtest/test/gtest_xml_outfiles_test.py | 132 + .../gtest/test/gtest_xml_output_unittest.py | 307 + .../gtest/test/gtest_xml_output_unittest_.cc | 181 + .../gtest/test/gtest_xml_test_utils.py | 194 + .../google_test/gtest/test/production.cc | 36 + .../google_test/gtest/test/production.h | 55 + .../gtest/xcode/Config/DebugProject.xcconfig | 30 + .../xcode/Config/FrameworkTarget.xcconfig | 17 + .../gtest/xcode/Config/General.xcconfig | 41 + .../xcode/Config/ReleaseProject.xcconfig | 32 + .../xcode/Config/StaticLibraryTarget.xcconfig | 18 + .../gtest/xcode/Config/TestTarget.xcconfig | 8 + .../gtest/xcode/Resources/Info.plist | 30 + .../xcode/Samples/FrameworkSample/Info.plist | 28 + .../WidgetFramework.xcodeproj/project.pbxproj | 457 + .../xcode/Samples/FrameworkSample/runtests.sh | 62 + .../xcode/Samples/FrameworkSample/widget.cc | 63 + .../xcode/Samples/FrameworkSample/widget.h | 59 + .../Samples/FrameworkSample/widget_test.cc | 68 + .../gtest/xcode/Scripts/runtests.sh | 65 + .../gtest/xcode/Scripts/versiongenerate.py | 100 + .../xcode/gtest.xcodeproj/project.pbxproj | 1135 +++ .../external_tests/google_test/manifest.mn | 23 + security/nss/external_tests/manifest.mn | 11 + .../nss/external_tests/ssl_gtest/Makefile | 48 + .../nss/external_tests/ssl_gtest/databuffer.h | 148 + .../external_tests/ssl_gtest/gtest_utils.h | 58 + .../nss/external_tests/ssl_gtest/manifest.mn | 26 + .../ssl_gtest/ssl_extension_unittest.cc | 578 ++ .../nss/external_tests/ssl_gtest/ssl_gtest.cc | 39 + .../ssl_gtest/ssl_loopback_unittest.cc | 272 + .../ssl_gtest/ssl_skip_unittest.cc | 167 + .../nss/external_tests/ssl_gtest/test_io.cc | 464 + .../nss/external_tests/ssl_gtest/test_io.h | 139 + .../nss/external_tests/ssl_gtest/tls_agent.cc | 229 + .../nss/external_tests/ssl_gtest/tls_agent.h | 193 + .../external_tests/ssl_gtest/tls_connect.cc | 231 + .../external_tests/ssl_gtest/tls_connect.h | 102 + .../external_tests/ssl_gtest/tls_filter.cc | 232 + .../nss/external_tests/ssl_gtest/tls_filter.h | 116 + .../external_tests/ssl_gtest/tls_parser.cc | 71 + .../nss/external_tests/ssl_gtest/tls_parser.h | 98 + security/nss/lib/certdb/cert.h | 31 +- security/nss/lib/certdb/certdb.c | 14 +- security/nss/lib/certdb/certdb.h | 15 + security/nss/lib/certdb/certi.h | 24 +- security/nss/lib/certdb/certt.h | 6 +- security/nss/lib/certdb/certv3.c | 136 - security/nss/lib/certdb/crl.c | 28 +- security/nss/lib/certdb/genname.c | 155 +- security/nss/lib/certdb/genname.h | 3 - security/nss/lib/certdb/xconst.c | 2 +- security/nss/lib/certhigh/certvfypkix.c | 70 +- security/nss/lib/certhigh/certvfypkixprint.c | 206 - security/nss/lib/certhigh/manifest.mn | 1 - security/nss/lib/ckfw/builtins/bfind.c | 42 +- security/nss/lib/ckfw/builtins/config.mk | 3 - security/nss/lib/ckfw/capi/config.mk | 3 - security/nss/lib/ckfw/dbm/db.c | 3 +- security/nss/lib/ckfw/nssmkey/mobject.c | 2 +- security/nss/lib/crmf/respcli.c | 12 +- security/nss/lib/crmf/servget.c | 2 +- security/nss/lib/cryptohi/keyhi.h | 5 + security/nss/lib/cryptohi/seckey.c | 95 +- security/nss/lib/cryptohi/secsign.c | 2 +- security/nss/lib/freebl/Makefile | 10 + security/nss/lib/freebl/cts.c | 1 - security/nss/lib/freebl/ecl/README | 39 +- security/nss/lib/freebl/ecl/ecp_jac.c | 17 +- security/nss/lib/freebl/ecl/ecp_jm.c | 4 +- security/nss/lib/freebl/mpi/README | 39 +- security/nss/lib/freebl/mpi/doc/LICENSE-MPL | 38 +- .../lib/freebl/mpi/mp_comba_amd64_masm.asm | 2 +- security/nss/lib/freebl/mpi/mpmontg.c | 31 +- security/nss/lib/freebl/mpi/tests/LICENSE-MPL | 38 +- security/nss/lib/freebl/mpi/utils/LICENSE-MPL | 38 +- security/nss/lib/freebl/mpi/utils/README | 39 +- .../lib/libpkix/include/pkix_errorstrings.h | 1 - .../nss/lib/libpkix/include/pkix_revchecker.h | 4 +- .../pkix/checker/pkix_revocationchecker.c | 10 +- .../pkix/checker/pkix_revocationmethod.h | 5 +- .../nss/lib/libpkix/pkix/top/pkix_build.c | 19 +- .../module/pkix_pl_httpdefaultclient.c | 4 - .../libpkix/pkix_pl_nss/pki/pkix_pl_crldp.c | 2 +- .../libpkix/pkix_pl_nss/pki/pkix_pl_crldp.h | 5 + .../pkix_pl_nss/pki/pkix_pl_publickey.c | 3 - .../pkix_pl_nss/pki/pkix_pl_x500name.c | 55 - security/nss/lib/nss/nss.def | 20 + security/nss/lib/nss/nss.h | 6 +- security/nss/lib/pk11wrap/dev3hack.c | 6 +- security/nss/lib/pk11wrap/pk11cert.c | 33 +- security/nss/lib/pk11wrap/pk11mech.c | 7 +- security/nss/lib/pk11wrap/pk11pub.h | 15 + security/nss/lib/pk11wrap/pk11util.c | 2 +- security/nss/lib/pkcs12/p12.h | 61 +- security/nss/lib/pkcs12/p12d.c | 58 + security/nss/lib/pkcs12/p12local.c | 3 +- security/nss/lib/pki/pki3hack.c | 28 +- security/nss/lib/pki/pki3hack.h | 2 +- security/nss/lib/pki/pkistore.c | 30 +- security/nss/lib/pki/tdcache.c | 36 +- security/nss/lib/pki/trustdomain.c | 12 +- security/nss/lib/smime/cmsmessage.c | 34 +- security/nss/lib/smime/smime.def | 6 + security/nss/lib/smime/smimeutil.c | 2 + security/nss/lib/softoken/config.mk | 6 +- security/nss/lib/softoken/fipstokn.c | 11 +- security/nss/lib/softoken/legacydb/lowcert.c | 2 +- security/nss/lib/softoken/legacydb/pcertdb.c | 6 +- security/nss/lib/softoken/lowpbe.c | 8 +- security/nss/lib/softoken/sdb.c | 2 - security/nss/lib/softoken/sftkpwd.c | 2 +- security/nss/lib/softoken/softkver.h | 6 +- security/nss/lib/ssl/SSLerrs.h | 3 + security/nss/lib/ssl/config.mk | 5 + security/nss/lib/ssl/dtlscon.c | 9 +- security/nss/lib/ssl/ssl.h | 6 + security/nss/lib/ssl/ssl3con.c | 349 +- security/nss/lib/ssl/ssl3ecc.c | 87 +- security/nss/lib/ssl/ssl3ext.c | 524 +- security/nss/lib/ssl/ssl3prot.h | 5 + security/nss/lib/ssl/sslcon.c | 7 +- security/nss/lib/ssl/sslerr.h | 2 + security/nss/lib/ssl/sslimpl.h | 22 +- security/nss/lib/ssl/sslproto.h | 4 + security/nss/lib/ssl/sslsecur.c | 6 +- security/nss/lib/ssl/sslsock.c | 21 +- security/nss/lib/ssl/sslt.h | 5 +- security/nss/lib/util/nssutil.h | 6 +- security/nss/lib/util/quickder.c | 91 +- security/nss/manifest.mn | 4 + .../nss/pkg/solaris/common_files/copyright | 38 +- security/nss/tests/all.sh | 3 +- security/nss/tests/cert/cert.sh | 46 + .../chains/scenarios/nameconstraints.cfg | 2 +- .../nss/tests/chains/scenarios/realcerts.cfg | 2 +- security/nss/tests/chains/scenarios/scenarios | 47 +- security/nss/tests/cipher/cipher.sh | 2 +- security/nss/tests/common/init.sh | 4 +- security/nss/tests/dbtests/dbtests.sh | 20 +- security/nss/tests/dbupgrade/dbupgrade.sh | 2 +- security/nss/tests/iopr/server_scr/config | 37 +- .../nss/tests/libpkix/certs/PayPalEE.cert | Bin 1531 -> 1382 bytes .../nss/tests/libpkix/certs/PayPalICA.cert | Bin 1512 -> 1205 bytes .../nss/tests/libpkix/certs/PayPalRootCA.cert | Bin 1249 -> 969 bytes security/nss/tests/libpkix/certs/make-nc | 2 +- security/nss/tests/libpkix/sample_apps/README | 39 +- security/nss/tests/libpkix/vfychain_test.lst | 2 +- security/nss/tests/memleak/memleak.sh | 3 +- .../netscape/suites/security/ssl/sslt.c | 6 +- security/nss/tests/ssl/sslcov.txt | 6 +- security/nss/tests/ssl_gtests/ssl_gtests.sh | 59 + testing/config/mozharness/try_arguments.py | 15 + testing/mozharness/mozharness.json | 2 +- toolkit/crashreporter/tools/upload_symbols.py | 95 + toolkit/mozapps/installer/packager.mk | 798 +- toolkit/mozapps/installer/upload-files.mk | 800 ++ tools/mercurial/hgsetup/wizard.py | 20 +- widget/gtk/nsImageToPixbuf.cpp | 4 +- 1224 files changed, 148426 insertions(+), 46318 deletions(-) create mode 100644 ipc/chromium/src/chrome/common/ipc_channel.cc create mode 100644 python/redo/PKG-INFO create mode 100644 python/redo/README create mode 100644 python/redo/redo.egg-info/PKG-INFO create mode 100644 python/redo/redo.egg-info/SOURCES.txt create mode 100644 python/redo/redo.egg-info/dependency_links.txt create mode 100644 python/redo/redo.egg-info/entry_points.txt create mode 100644 python/redo/redo.egg-info/top_level.txt create mode 100644 python/redo/redo/__init__.py create mode 100644 python/redo/redo/cmd.py create mode 100644 python/redo/setup.cfg create mode 100644 python/redo/setup.py create mode 100644 python/requests/HISTORY.rst create mode 100644 python/requests/LICENSE create mode 100644 python/requests/MANIFEST.in create mode 100644 python/requests/NOTICE create mode 100644 python/requests/PKG-INFO create mode 100644 python/requests/README.rst create mode 100644 python/requests/requests.egg-info/PKG-INFO create mode 100644 python/requests/requests.egg-info/SOURCES.txt create mode 100644 python/requests/requests.egg-info/dependency_links.txt create mode 100644 python/requests/requests.egg-info/not-zip-safe create mode 100644 python/requests/requests.egg-info/requires.txt create mode 100644 python/requests/requests.egg-info/top_level.txt create mode 100644 python/requests/requests/__init__.py create mode 100644 python/requests/requests/adapters.py create mode 100644 python/requests/requests/api.py create mode 100644 python/requests/requests/auth.py create mode 100644 python/requests/requests/cacert.pem create mode 100644 python/requests/requests/certs.py create mode 100644 python/requests/requests/compat.py create mode 100644 python/requests/requests/cookies.py create mode 100644 python/requests/requests/exceptions.py create mode 100644 python/requests/requests/hooks.py create mode 100644 python/requests/requests/models.py create mode 100644 python/requests/requests/packages/__init__.py create mode 100644 python/requests/requests/packages/chardet/__init__.py create mode 100644 python/requests/requests/packages/chardet/big5freq.py create mode 100644 python/requests/requests/packages/chardet/big5prober.py create mode 100755 python/requests/requests/packages/chardet/chardetect.py create mode 100644 python/requests/requests/packages/chardet/chardistribution.py create mode 100644 python/requests/requests/packages/chardet/charsetgroupprober.py create mode 100644 python/requests/requests/packages/chardet/charsetprober.py create mode 100644 python/requests/requests/packages/chardet/codingstatemachine.py create mode 100644 python/requests/requests/packages/chardet/compat.py create mode 100644 python/requests/requests/packages/chardet/constants.py create mode 100644 python/requests/requests/packages/chardet/cp949prober.py create mode 100644 python/requests/requests/packages/chardet/escprober.py create mode 100644 python/requests/requests/packages/chardet/escsm.py create mode 100644 python/requests/requests/packages/chardet/eucjpprober.py create mode 100644 python/requests/requests/packages/chardet/euckrfreq.py create mode 100644 python/requests/requests/packages/chardet/euckrprober.py create mode 100644 python/requests/requests/packages/chardet/euctwfreq.py create mode 100644 python/requests/requests/packages/chardet/euctwprober.py create mode 100644 python/requests/requests/packages/chardet/gb2312freq.py create mode 100644 python/requests/requests/packages/chardet/gb2312prober.py create mode 100644 python/requests/requests/packages/chardet/hebrewprober.py create mode 100644 python/requests/requests/packages/chardet/jisfreq.py create mode 100644 python/requests/requests/packages/chardet/jpcntx.py create mode 100644 python/requests/requests/packages/chardet/langbulgarianmodel.py create mode 100644 python/requests/requests/packages/chardet/langcyrillicmodel.py create mode 100644 python/requests/requests/packages/chardet/langgreekmodel.py create mode 100644 python/requests/requests/packages/chardet/langhebrewmodel.py create mode 100644 python/requests/requests/packages/chardet/langhungarianmodel.py create mode 100644 python/requests/requests/packages/chardet/langthaimodel.py create mode 100644 python/requests/requests/packages/chardet/latin1prober.py create mode 100644 python/requests/requests/packages/chardet/mbcharsetprober.py create mode 100644 python/requests/requests/packages/chardet/mbcsgroupprober.py create mode 100644 python/requests/requests/packages/chardet/mbcssm.py create mode 100644 python/requests/requests/packages/chardet/sbcharsetprober.py create mode 100644 python/requests/requests/packages/chardet/sbcsgroupprober.py create mode 100644 python/requests/requests/packages/chardet/sjisprober.py create mode 100644 python/requests/requests/packages/chardet/universaldetector.py create mode 100644 python/requests/requests/packages/chardet/utf8prober.py create mode 100644 python/requests/requests/packages/urllib3/__init__.py create mode 100644 python/requests/requests/packages/urllib3/_collections.py create mode 100644 python/requests/requests/packages/urllib3/connection.py create mode 100644 python/requests/requests/packages/urllib3/connectionpool.py create mode 100644 python/requests/requests/packages/urllib3/contrib/__init__.py create mode 100644 python/requests/requests/packages/urllib3/contrib/ntlmpool.py create mode 100644 python/requests/requests/packages/urllib3/contrib/pyopenssl.py create mode 100644 python/requests/requests/packages/urllib3/exceptions.py create mode 100644 python/requests/requests/packages/urllib3/fields.py create mode 100644 python/requests/requests/packages/urllib3/filepost.py create mode 100644 python/requests/requests/packages/urllib3/packages/__init__.py create mode 100644 python/requests/requests/packages/urllib3/packages/ordered_dict.py create mode 100644 python/requests/requests/packages/urllib3/packages/six.py create mode 100644 python/requests/requests/packages/urllib3/packages/ssl_match_hostname/__init__.py create mode 100644 python/requests/requests/packages/urllib3/packages/ssl_match_hostname/_implementation.py create mode 100644 python/requests/requests/packages/urllib3/poolmanager.py create mode 100644 python/requests/requests/packages/urllib3/request.py create mode 100644 python/requests/requests/packages/urllib3/response.py create mode 100644 python/requests/requests/packages/urllib3/util/__init__.py create mode 100644 python/requests/requests/packages/urllib3/util/connection.py create mode 100644 python/requests/requests/packages/urllib3/util/request.py create mode 100644 python/requests/requests/packages/urllib3/util/response.py create mode 100644 python/requests/requests/packages/urllib3/util/retry.py create mode 100644 python/requests/requests/packages/urllib3/util/ssl_.py create mode 100644 python/requests/requests/packages/urllib3/util/timeout.py create mode 100644 python/requests/requests/packages/urllib3/util/url.py create mode 100644 python/requests/requests/sessions.py create mode 100644 python/requests/requests/status_codes.py create mode 100644 python/requests/requests/structures.py create mode 100644 python/requests/requests/utils.py create mode 100644 python/requests/requirements.txt create mode 100644 python/requests/setup.cfg create mode 100755 python/requests/setup.py create mode 100755 python/requests/test_requests.py create mode 100644 security/nss/external_tests/Makefile create mode 100644 security/nss/external_tests/README create mode 100644 security/nss/external_tests/google_test/Makefile create mode 100644 security/nss/external_tests/google_test/gtest/CHANGES create mode 100644 security/nss/external_tests/google_test/gtest/CMakeLists.txt create mode 100644 security/nss/external_tests/google_test/gtest/CONTRIBUTORS create mode 100644 security/nss/external_tests/google_test/gtest/LICENSE create mode 100644 security/nss/external_tests/google_test/gtest/Makefile.am create mode 100644 security/nss/external_tests/google_test/gtest/README create mode 100644 security/nss/external_tests/google_test/gtest/build-aux/.keep create mode 100644 security/nss/external_tests/google_test/gtest/cmake/internal_utils.cmake create mode 100644 security/nss/external_tests/google_test/gtest/codegear/gtest.cbproj create mode 100644 security/nss/external_tests/google_test/gtest/codegear/gtest.groupproj create mode 100644 security/nss/external_tests/google_test/gtest/codegear/gtest_all.cc create mode 100644 security/nss/external_tests/google_test/gtest/codegear/gtest_link.cc create mode 100644 security/nss/external_tests/google_test/gtest/codegear/gtest_main.cbproj create mode 100644 security/nss/external_tests/google_test/gtest/codegear/gtest_unittest.cbproj create mode 100644 security/nss/external_tests/google_test/gtest/configure.ac create mode 100644 security/nss/external_tests/google_test/gtest/include/gtest/gtest-death-test.h create mode 100644 security/nss/external_tests/google_test/gtest/include/gtest/gtest-message.h create mode 100644 security/nss/external_tests/google_test/gtest/include/gtest/gtest-param-test.h create mode 100644 security/nss/external_tests/google_test/gtest/include/gtest/gtest-param-test.h.pump create mode 100644 security/nss/external_tests/google_test/gtest/include/gtest/gtest-printers.h create mode 100644 security/nss/external_tests/google_test/gtest/include/gtest/gtest-spi.h create mode 100644 security/nss/external_tests/google_test/gtest/include/gtest/gtest-test-part.h create mode 100644 security/nss/external_tests/google_test/gtest/include/gtest/gtest-typed-test.h create mode 100644 security/nss/external_tests/google_test/gtest/include/gtest/gtest.h create mode 100644 security/nss/external_tests/google_test/gtest/include/gtest/gtest_pred_impl.h create mode 100644 security/nss/external_tests/google_test/gtest/include/gtest/gtest_prod.h create mode 100644 security/nss/external_tests/google_test/gtest/include/gtest/internal/gtest-death-test-internal.h create mode 100644 security/nss/external_tests/google_test/gtest/include/gtest/internal/gtest-filepath.h create mode 100644 security/nss/external_tests/google_test/gtest/include/gtest/internal/gtest-internal.h create mode 100644 security/nss/external_tests/google_test/gtest/include/gtest/internal/gtest-linked_ptr.h create mode 100644 security/nss/external_tests/google_test/gtest/include/gtest/internal/gtest-param-util-generated.h create mode 100644 security/nss/external_tests/google_test/gtest/include/gtest/internal/gtest-param-util-generated.h.pump create mode 100644 security/nss/external_tests/google_test/gtest/include/gtest/internal/gtest-param-util.h create mode 100644 security/nss/external_tests/google_test/gtest/include/gtest/internal/gtest-port.h create mode 100644 security/nss/external_tests/google_test/gtest/include/gtest/internal/gtest-string.h create mode 100644 security/nss/external_tests/google_test/gtest/include/gtest/internal/gtest-tuple.h create mode 100644 security/nss/external_tests/google_test/gtest/include/gtest/internal/gtest-tuple.h.pump create mode 100644 security/nss/external_tests/google_test/gtest/include/gtest/internal/gtest-type-util.h create mode 100644 security/nss/external_tests/google_test/gtest/include/gtest/internal/gtest-type-util.h.pump create mode 100644 security/nss/external_tests/google_test/gtest/m4/acx_pthread.m4 create mode 100644 security/nss/external_tests/google_test/gtest/m4/gtest.m4 create mode 100644 security/nss/external_tests/google_test/gtest/make/Makefile create mode 100644 security/nss/external_tests/google_test/gtest/msvc/gtest-md.sln create mode 100644 security/nss/external_tests/google_test/gtest/msvc/gtest-md.vcproj create mode 100644 security/nss/external_tests/google_test/gtest/msvc/gtest.sln create mode 100644 security/nss/external_tests/google_test/gtest/msvc/gtest.vcproj create mode 100644 security/nss/external_tests/google_test/gtest/msvc/gtest_main-md.vcproj create mode 100644 security/nss/external_tests/google_test/gtest/msvc/gtest_main.vcproj create mode 100644 security/nss/external_tests/google_test/gtest/msvc/gtest_prod_test-md.vcproj create mode 100644 security/nss/external_tests/google_test/gtest/msvc/gtest_prod_test.vcproj create mode 100644 security/nss/external_tests/google_test/gtest/msvc/gtest_unittest-md.vcproj create mode 100644 security/nss/external_tests/google_test/gtest/msvc/gtest_unittest.vcproj create mode 100644 security/nss/external_tests/google_test/gtest/samples/prime_tables.h create mode 100644 security/nss/external_tests/google_test/gtest/samples/sample1.cc create mode 100644 security/nss/external_tests/google_test/gtest/samples/sample1.h create mode 100644 security/nss/external_tests/google_test/gtest/samples/sample10_unittest.cc create mode 100644 security/nss/external_tests/google_test/gtest/samples/sample1_unittest.cc create mode 100644 security/nss/external_tests/google_test/gtest/samples/sample2.cc create mode 100644 security/nss/external_tests/google_test/gtest/samples/sample2.h create mode 100644 security/nss/external_tests/google_test/gtest/samples/sample2_unittest.cc create mode 100644 security/nss/external_tests/google_test/gtest/samples/sample3-inl.h create mode 100644 security/nss/external_tests/google_test/gtest/samples/sample3_unittest.cc create mode 100644 security/nss/external_tests/google_test/gtest/samples/sample4.cc create mode 100644 security/nss/external_tests/google_test/gtest/samples/sample4.h create mode 100644 security/nss/external_tests/google_test/gtest/samples/sample4_unittest.cc create mode 100644 security/nss/external_tests/google_test/gtest/samples/sample5_unittest.cc create mode 100644 security/nss/external_tests/google_test/gtest/samples/sample6_unittest.cc create mode 100644 security/nss/external_tests/google_test/gtest/samples/sample7_unittest.cc create mode 100644 security/nss/external_tests/google_test/gtest/samples/sample8_unittest.cc create mode 100644 security/nss/external_tests/google_test/gtest/samples/sample9_unittest.cc create mode 100644 security/nss/external_tests/google_test/gtest/scripts/common.py create mode 100755 security/nss/external_tests/google_test/gtest/scripts/fuse_gtest_files.py create mode 100755 security/nss/external_tests/google_test/gtest/scripts/gen_gtest_pred_impl.py create mode 100755 security/nss/external_tests/google_test/gtest/scripts/gtest-config.in create mode 100755 security/nss/external_tests/google_test/gtest/scripts/pump.py create mode 100755 security/nss/external_tests/google_test/gtest/scripts/release_docs.py create mode 100644 security/nss/external_tests/google_test/gtest/scripts/test/Makefile create mode 100755 security/nss/external_tests/google_test/gtest/scripts/upload.py create mode 100755 security/nss/external_tests/google_test/gtest/scripts/upload_gtest.py create mode 100644 security/nss/external_tests/google_test/gtest/src/gtest-all.cc create mode 100644 security/nss/external_tests/google_test/gtest/src/gtest-death-test.cc create mode 100644 security/nss/external_tests/google_test/gtest/src/gtest-filepath.cc create mode 100644 security/nss/external_tests/google_test/gtest/src/gtest-internal-inl.h create mode 100644 security/nss/external_tests/google_test/gtest/src/gtest-port.cc create mode 100644 security/nss/external_tests/google_test/gtest/src/gtest-printers.cc create mode 100644 security/nss/external_tests/google_test/gtest/src/gtest-test-part.cc create mode 100644 security/nss/external_tests/google_test/gtest/src/gtest-typed-test.cc create mode 100644 security/nss/external_tests/google_test/gtest/src/gtest.cc create mode 100644 security/nss/external_tests/google_test/gtest/src/gtest_main.cc create mode 100644 security/nss/external_tests/google_test/gtest/test/gtest-death-test_ex_test.cc create mode 100644 security/nss/external_tests/google_test/gtest/test/gtest-death-test_test.cc create mode 100644 security/nss/external_tests/google_test/gtest/test/gtest-filepath_test.cc create mode 100644 security/nss/external_tests/google_test/gtest/test/gtest-linked_ptr_test.cc create mode 100644 security/nss/external_tests/google_test/gtest/test/gtest-listener_test.cc create mode 100644 security/nss/external_tests/google_test/gtest/test/gtest-message_test.cc create mode 100644 security/nss/external_tests/google_test/gtest/test/gtest-options_test.cc create mode 100644 security/nss/external_tests/google_test/gtest/test/gtest-param-test2_test.cc create mode 100644 security/nss/external_tests/google_test/gtest/test/gtest-param-test_test.cc create mode 100644 security/nss/external_tests/google_test/gtest/test/gtest-param-test_test.h create mode 100644 security/nss/external_tests/google_test/gtest/test/gtest-port_test.cc create mode 100644 security/nss/external_tests/google_test/gtest/test/gtest-printers_test.cc create mode 100644 security/nss/external_tests/google_test/gtest/test/gtest-test-part_test.cc create mode 100644 security/nss/external_tests/google_test/gtest/test/gtest-tuple_test.cc create mode 100644 security/nss/external_tests/google_test/gtest/test/gtest-typed-test2_test.cc create mode 100644 security/nss/external_tests/google_test/gtest/test/gtest-typed-test_test.cc create mode 100644 security/nss/external_tests/google_test/gtest/test/gtest-typed-test_test.h create mode 100644 security/nss/external_tests/google_test/gtest/test/gtest-unittest-api_test.cc create mode 100644 security/nss/external_tests/google_test/gtest/test/gtest_all_test.cc create mode 100755 security/nss/external_tests/google_test/gtest/test/gtest_break_on_failure_unittest.py create mode 100644 security/nss/external_tests/google_test/gtest/test/gtest_break_on_failure_unittest_.cc create mode 100755 security/nss/external_tests/google_test/gtest/test/gtest_catch_exceptions_test.py create mode 100644 security/nss/external_tests/google_test/gtest/test/gtest_catch_exceptions_test_.cc create mode 100755 security/nss/external_tests/google_test/gtest/test/gtest_color_test.py create mode 100644 security/nss/external_tests/google_test/gtest/test/gtest_color_test_.cc create mode 100755 security/nss/external_tests/google_test/gtest/test/gtest_env_var_test.py create mode 100644 security/nss/external_tests/google_test/gtest/test/gtest_env_var_test_.cc create mode 100644 security/nss/external_tests/google_test/gtest/test/gtest_environment_test.cc create mode 100755 security/nss/external_tests/google_test/gtest/test/gtest_filter_unittest.py create mode 100644 security/nss/external_tests/google_test/gtest/test/gtest_filter_unittest_.cc create mode 100755 security/nss/external_tests/google_test/gtest/test/gtest_help_test.py create mode 100644 security/nss/external_tests/google_test/gtest/test/gtest_help_test_.cc create mode 100755 security/nss/external_tests/google_test/gtest/test/gtest_list_tests_unittest.py create mode 100644 security/nss/external_tests/google_test/gtest/test/gtest_list_tests_unittest_.cc create mode 100644 security/nss/external_tests/google_test/gtest/test/gtest_main_unittest.cc create mode 100644 security/nss/external_tests/google_test/gtest/test/gtest_no_test_unittest.cc create mode 100755 security/nss/external_tests/google_test/gtest/test/gtest_output_test.py create mode 100644 security/nss/external_tests/google_test/gtest/test/gtest_output_test_.cc create mode 100644 security/nss/external_tests/google_test/gtest/test/gtest_output_test_golden_lin.txt create mode 100644 security/nss/external_tests/google_test/gtest/test/gtest_pred_impl_unittest.cc create mode 100644 security/nss/external_tests/google_test/gtest/test/gtest_premature_exit_test.cc create mode 100644 security/nss/external_tests/google_test/gtest/test/gtest_prod_test.cc create mode 100644 security/nss/external_tests/google_test/gtest/test/gtest_repeat_test.cc create mode 100755 security/nss/external_tests/google_test/gtest/test/gtest_shuffle_test.py create mode 100644 security/nss/external_tests/google_test/gtest/test/gtest_shuffle_test_.cc create mode 100644 security/nss/external_tests/google_test/gtest/test/gtest_sole_header_test.cc create mode 100644 security/nss/external_tests/google_test/gtest/test/gtest_stress_test.cc create mode 100755 security/nss/external_tests/google_test/gtest/test/gtest_test_utils.py create mode 100644 security/nss/external_tests/google_test/gtest/test/gtest_throw_on_failure_ex_test.cc create mode 100755 security/nss/external_tests/google_test/gtest/test/gtest_throw_on_failure_test.py create mode 100644 security/nss/external_tests/google_test/gtest/test/gtest_throw_on_failure_test_.cc create mode 100755 security/nss/external_tests/google_test/gtest/test/gtest_uninitialized_test.py create mode 100644 security/nss/external_tests/google_test/gtest/test/gtest_uninitialized_test_.cc create mode 100644 security/nss/external_tests/google_test/gtest/test/gtest_unittest.cc create mode 100644 security/nss/external_tests/google_test/gtest/test/gtest_xml_outfile1_test_.cc create mode 100644 security/nss/external_tests/google_test/gtest/test/gtest_xml_outfile2_test_.cc create mode 100755 security/nss/external_tests/google_test/gtest/test/gtest_xml_outfiles_test.py create mode 100755 security/nss/external_tests/google_test/gtest/test/gtest_xml_output_unittest.py create mode 100644 security/nss/external_tests/google_test/gtest/test/gtest_xml_output_unittest_.cc create mode 100755 security/nss/external_tests/google_test/gtest/test/gtest_xml_test_utils.py create mode 100644 security/nss/external_tests/google_test/gtest/test/production.cc create mode 100644 security/nss/external_tests/google_test/gtest/test/production.h create mode 100644 security/nss/external_tests/google_test/gtest/xcode/Config/DebugProject.xcconfig create mode 100644 security/nss/external_tests/google_test/gtest/xcode/Config/FrameworkTarget.xcconfig create mode 100644 security/nss/external_tests/google_test/gtest/xcode/Config/General.xcconfig create mode 100644 security/nss/external_tests/google_test/gtest/xcode/Config/ReleaseProject.xcconfig create mode 100644 security/nss/external_tests/google_test/gtest/xcode/Config/StaticLibraryTarget.xcconfig create mode 100644 security/nss/external_tests/google_test/gtest/xcode/Config/TestTarget.xcconfig create mode 100644 security/nss/external_tests/google_test/gtest/xcode/Resources/Info.plist create mode 100644 security/nss/external_tests/google_test/gtest/xcode/Samples/FrameworkSample/Info.plist create mode 100644 security/nss/external_tests/google_test/gtest/xcode/Samples/FrameworkSample/WidgetFramework.xcodeproj/project.pbxproj create mode 100644 security/nss/external_tests/google_test/gtest/xcode/Samples/FrameworkSample/runtests.sh create mode 100644 security/nss/external_tests/google_test/gtest/xcode/Samples/FrameworkSample/widget.cc create mode 100644 security/nss/external_tests/google_test/gtest/xcode/Samples/FrameworkSample/widget.h create mode 100644 security/nss/external_tests/google_test/gtest/xcode/Samples/FrameworkSample/widget_test.cc create mode 100644 security/nss/external_tests/google_test/gtest/xcode/Scripts/runtests.sh create mode 100644 security/nss/external_tests/google_test/gtest/xcode/Scripts/versiongenerate.py create mode 100644 security/nss/external_tests/google_test/gtest/xcode/gtest.xcodeproj/project.pbxproj create mode 100644 security/nss/external_tests/google_test/manifest.mn create mode 100644 security/nss/external_tests/manifest.mn create mode 100644 security/nss/external_tests/ssl_gtest/Makefile create mode 100644 security/nss/external_tests/ssl_gtest/databuffer.h create mode 100644 security/nss/external_tests/ssl_gtest/gtest_utils.h create mode 100644 security/nss/external_tests/ssl_gtest/manifest.mn create mode 100644 security/nss/external_tests/ssl_gtest/ssl_extension_unittest.cc create mode 100644 security/nss/external_tests/ssl_gtest/ssl_gtest.cc create mode 100644 security/nss/external_tests/ssl_gtest/ssl_loopback_unittest.cc create mode 100644 security/nss/external_tests/ssl_gtest/ssl_skip_unittest.cc create mode 100644 security/nss/external_tests/ssl_gtest/test_io.cc create mode 100644 security/nss/external_tests/ssl_gtest/test_io.h create mode 100644 security/nss/external_tests/ssl_gtest/tls_agent.cc create mode 100644 security/nss/external_tests/ssl_gtest/tls_agent.h create mode 100644 security/nss/external_tests/ssl_gtest/tls_connect.cc create mode 100644 security/nss/external_tests/ssl_gtest/tls_connect.h create mode 100644 security/nss/external_tests/ssl_gtest/tls_filter.cc create mode 100644 security/nss/external_tests/ssl_gtest/tls_filter.h create mode 100644 security/nss/external_tests/ssl_gtest/tls_parser.cc create mode 100644 security/nss/external_tests/ssl_gtest/tls_parser.h delete mode 100644 security/nss/lib/certhigh/certvfypkixprint.c create mode 100644 security/nss/tests/ssl_gtests/ssl_gtests.sh create mode 100644 testing/config/mozharness/try_arguments.py create mode 100644 toolkit/crashreporter/tools/upload_symbols.py create mode 100644 toolkit/mozapps/installer/upload-files.mk diff --git a/.hg_archival.txt b/.hg_archival.txt index c7a846bef6..4b7e740ce0 100644 --- a/.hg_archival.txt +++ b/.hg_archival.txt @@ -1,5 +1,5 @@ repo: 8ba995b74e18334ab3707f27e9eb8f4e37ba3d29 -node: 40a8b8411a0c0444249c48f1739bf13dd4f73fe0 -branch: GECKO3160esr_2015032523_RELBRANCH -tag: FIREFOX_31_6_0esr_BUILD2 -tag: FIREFOX_31_6_0esr_RELEASE +node: c81c5e3eca8c6b049e6e38fcb5ed8c93285391a8 +branch: GECKO3180esr_2015062417_RELBRANCH +tag: FIREFOX_31_8_0esr_BUILD1 +tag: FIREFOX_31_8_0esr_RELEASE diff --git a/CLOBBER b/CLOBBER index e1e476e4fa..4a4efa3201 100644 --- a/CLOBBER +++ b/CLOBBER @@ -22,4 +22,4 @@ # changes to stick? As of bug 928195, this shouldn't be necessary! Please # don't change CLOBBER for WebIDL changes any more. -Merge day clobber \ No newline at end of file +Bug 1166031 - NSS update hit needs-clobber bustage. diff --git a/Makefile.in b/Makefile.in index ad27e600f1..cb8fb5b402 100644 --- a/Makefile.in +++ b/Makefile.in @@ -243,8 +243,12 @@ endif # MOZ_CRASHREPORTER uploadsymbols: ifdef MOZ_CRASHREPORTER +ifdef SOCORRO_SYMBOL_UPLOAD_TOKEN_FILE + $(PYTHON) -u $(topsrcdir)/toolkit/crashreporter/tools/upload_symbols.py '$(DIST)/$(PKG_PATH)$(SYMBOL_FULL_ARCHIVE_BASENAME).zip' +else $(SHELL) $(topsrcdir)/toolkit/crashreporter/tools/upload_symbols.sh $(SYMBOL_INDEX_NAME) '$(DIST)/$(PKG_PATH)$(SYMBOL_FULL_ARCHIVE_BASENAME).zip' endif +endif # MOZ_SOURCE_STAMP is defined in package-name.mk with a deferred assignment. # exporting it makes make run its $(shell) command for each invoked submake, diff --git a/accessible/tests/mochitest/focus/a11y.ini b/accessible/tests/mochitest/focus/a11y.ini index 9496619823..a00b570ef2 100644 --- a/accessible/tests/mochitest/focus/a11y.ini +++ b/accessible/tests/mochitest/focus/a11y.ini @@ -1,5 +1,6 @@ [DEFAULT] [test_focusedChild.html] +skip-if = os == 'win' # bug 845134 [test_takeFocus.html] [test_takeFocus.xul] diff --git a/b2g/config/emulator-ics/config.json b/b2g/config/emulator-ics/config.json index 5df46a3823..0a4de79c42 100644 --- a/b2g/config/emulator-ics/config.json +++ b/b2g/config/emulator-ics/config.json @@ -3,7 +3,10 @@ "tooltool_manifest": "releng-emulator-ics.tt", "mock_target": "mozilla-centos6-x86_64", "mock_packages": ["ccache", "make", "bison", "flex", "gcc", "g++", "mpfr", "zlib-devel", "ncurses-devel", "zip", "autoconf213", "glibc-static", "perl-Digest-SHA", "wget", "alsa-lib", "atk", "cairo", "dbus-glib", "fontconfig", "freetype", "glib2", "gtk2", "libXRender", "libXt", "pango", "mozilla-python27-mercurial", "openssh-clients", "nss-devel", "glibc-devel.i686", "libstdc++.i686", "zlib-devel.i686", "ncurses-devel.i686", "libX11-devel.i686", "mesa-libGL-devel.i686", "mesa-libGL-devel", "libX11-devel", "git", "libxml2"], - "mock_files": [["/home/cltbld/.ssh", "/home/mock_mozilla/.ssh"]], + "mock_files": [ + ["/home/cltbld/.ssh", "/home/mock_mozilla/.ssh"], + ["/builds/crash-stats-api.token", "/builds/crash-stats-api.token"] + ], "build_targets": ["droid", "package-emulator", "package-tests"], "upload_files": [ "{workdir}/out/target/product/generic/*.tar.bz2", diff --git a/b2g/config/emulator-jb/config.json b/b2g/config/emulator-jb/config.json index f24f051adf..30ed453c87 100644 --- a/b2g/config/emulator-jb/config.json +++ b/b2g/config/emulator-jb/config.json @@ -3,7 +3,10 @@ "tooltool_manifest": "releng-emulator-jb.tt", "mock_target": "mozilla-centos6-x86_64", "mock_packages": ["ccache", "make", "bison", "flex", "gcc", "g++", "mpfr", "zlib-devel", "ncurses-devel", "zip", "autoconf213", "glibc-static", "perl-Digest-SHA", "wget", "alsa-lib", "atk", "cairo", "dbus-glib", "fontconfig", "freetype", "glib2", "gtk2", "libXRender", "libXt", "pango", "mozilla-python27-mercurial", "openssh-clients", "nss-devel", "glibc-devel.i686", "libstdc++.i686", "zlib-devel.i686", "ncurses-devel.i686", "libX11-devel.i686", "mesa-libGL-devel.i686", "mesa-libGL-devel", "libX11-devel", "git", "libxml2"], - "mock_files": [["/home/cltbld/.ssh", "/home/mock_mozilla/.ssh"]], + "mock_files": [ + ["/home/cltbld/.ssh", "/home/mock_mozilla/.ssh"], + ["/builds/crash-stats-api.token", "/builds/crash-stats-api.token"] + ], "build_targets": ["droid", "package-emulator", "package-tests"], "upload_files": [ "{workdir}/out/target/product/generic/*.tar.bz2", diff --git a/b2g/config/emulator-kk/config.json b/b2g/config/emulator-kk/config.json index 8390c24eff..155809e5ae 100644 --- a/b2g/config/emulator-kk/config.json +++ b/b2g/config/emulator-kk/config.json @@ -3,7 +3,10 @@ "tooltool_manifest": "releng-emulator-kk.tt", "mock_target": "mozilla-centos6-x86_64", "mock_packages": ["ccache", "make", "bison", "flex", "gcc", "g++", "mpfr", "zlib-devel", "ncurses-devel", "zip", "autoconf213", "glibc-static", "perl-Digest-SHA", "wget", "alsa-lib", "atk", "cairo", "dbus-glib", "fontconfig", "freetype", "glib2", "gtk2", "libXRender", "libXt", "pango", "mozilla-python27-mercurial", "openssh-clients", "nss-devel", "glibc-devel.i686", "libstdc++.i686", "zlib-devel.i686", "ncurses-devel.i686", "libX11-devel.i686", "mesa-libGL-devel.i686", "mesa-libGL-devel", "libX11-devel", "git", "libxml2"], - "mock_files": [["/home/cltbld/.ssh", "/home/mock_mozilla/.ssh"]], + "mock_files": [ + ["/home/cltbld/.ssh", "/home/mock_mozilla/.ssh"], + ["/builds/crash-stats-api.token", "/builds/crash-stats-api.token"] + ], "build_targets": ["droid", "package-emulator", "package-tests"], "upload_files": [ "{workdir}/out/target/product/generic/*.tar.bz2", diff --git a/b2g/config/emulator/config.json b/b2g/config/emulator/config.json index 6c1dbc6268..9e06792901 100644 --- a/b2g/config/emulator/config.json +++ b/b2g/config/emulator/config.json @@ -3,7 +3,10 @@ "tooltool_manifest": "releng-emulator.tt", "mock_target": "mozilla-centos6-x86_64", "mock_packages": ["ccache", "make", "bison", "flex", "gcc", "g++", "mpfr", "zlib-devel", "ncurses-devel", "zip", "autoconf213", "glibc-static", "perl-Digest-SHA", "wget", "alsa-lib", "atk", "cairo", "dbus-glib", "fontconfig", "freetype", "glib2", "gtk2", "libXRender", "libXt", "pango", "mozilla-python27-mercurial", "openssh-clients", "nss-devel", "glibc-devel.i686", "libstdc++.i686", "zlib-devel.i686", "ncurses-devel.i686", "libX11-devel.i686", "mesa-libGL-devel.i686", "mesa-libGL-devel", "libX11-devel", "git", "libxml2"], - "mock_files": [["/home/cltbld/.ssh", "/home/mock_mozilla/.ssh"]], + "mock_files": [ + ["/home/cltbld/.ssh", "/home/mock_mozilla/.ssh"], + ["/builds/crash-stats-api.token", "/builds/crash-stats-api.token"] + ], "build_targets": ["droid", "package-emulator", "package-tests"], "upload_files": [ "{workdir}/out/target/product/generic/*.tar.bz2", diff --git a/b2g/config/flame/config.json b/b2g/config/flame/config.json index 91ee6e47d9..a3bff94d8d 100644 --- a/b2g/config/flame/config.json +++ b/b2g/config/flame/config.json @@ -3,7 +3,10 @@ "tooltool_manifest": "releng-flame.tt", "mock_target": "mozilla-centos6-x86_64", "mock_packages": ["ccache", "make", "bison", "flex", "gcc", "g++", "mpfr", "zlib-devel", "ncurses-devel", "zip", "autoconf213", "glibc-static", "perl-Digest-SHA", "wget", "alsa-lib", "atk", "cairo", "dbus-glib", "fontconfig", "freetype", "glib2", "gtk2", "libXRender", "libXt", "pango", "mozilla-python27-mercurial", "openssh-clients", "nss-devel", "glibc-devel.i686", "libstdc++.i686", "zlib-devel.i686", "ncurses-devel.i686", "libX11-devel.i686", "mesa-libGL-devel.i686", "mesa-libGL-devel", "libX11-devel", "git", "libxml2"], - "mock_files": [["/home/cltbld/.ssh", "/home/mock_mozilla/.ssh"]], + "mock_files": [ + ["/home/cltbld/.ssh", "/home/mock_mozilla/.ssh"], + ["/builds/crash-stats-api.token", "/builds/crash-stats-api.token"] + ], "build_targets": [], "upload_files": [ "{objdir}/dist/b2g-*.crashreporter-symbols.zip", diff --git a/b2g/config/hamachi/config.json b/b2g/config/hamachi/config.json index f2e15665f0..66cc7da32a 100644 --- a/b2g/config/hamachi/config.json +++ b/b2g/config/hamachi/config.json @@ -3,7 +3,10 @@ "tooltool_manifest": "releng-hamachi.tt", "mock_target": "mozilla-centos6-i386", "mock_packages": ["ccache", "make", "bison", "flex", "gcc", "g++", "mpfr", "zlib-devel", "ncurses-devel", "zip", "autoconf213", "glibc-static", "perl-Digest-SHA", "wget", "alsa-lib", "atk", "cairo", "dbus-glib", "fontconfig", "freetype", "glib2", "gtk2", "libXRender", "libXt", "pango", "mozilla-python27-mercurial", "openssh-clients", "nss-devel", "java-1.6.0-openjdk-devel", "git"], - "mock_files": [["/home/cltbld/.ssh", "/home/mock_mozilla/.ssh"]], + "mock_files": [ + ["/home/cltbld/.ssh", "/home/mock_mozilla/.ssh"], + ["/builds/crash-stats-api.token", "/builds/crash-stats-api.token"] + ], "build_targets": [], "upload_files": [ "{objdir}/dist/b2g-*.crashreporter-symbols.zip", diff --git a/b2g/config/helix/config.json b/b2g/config/helix/config.json index 53fc595e7b..25eb823b3e 100644 --- a/b2g/config/helix/config.json +++ b/b2g/config/helix/config.json @@ -3,7 +3,10 @@ "tooltool_manifest": "releng-helix.tt", "mock_target": "mozilla-centos6-i386", "mock_packages": ["ccache", "make", "bison", "flex", "gcc", "g++", "mpfr", "zlib-devel", "ncurses-devel", "zip", "autoconf213", "glibc-static", "perl-Digest-SHA", "wget", "alsa-lib", "atk", "cairo", "dbus-glib", "fontconfig", "freetype", "glib2", "gtk2", "libXRender", "libXt", "pango", "mozilla-python27-mercurial", "openssh-clients", "nss-devel", "java-1.6.0-openjdk-devel", "git"], - "mock_files": [["/home/cltbld/.ssh", "/home/mock_mozilla/.ssh"]], + "mock_files": [ + ["/home/cltbld/.ssh", "/home/mock_mozilla/.ssh"], + ["/builds/crash-stats-api.token", "/builds/crash-stats-api.token"] + ], "build_targets": [], "upload_files": [ "{objdir}/dist/b2g-*.crashreporter-symbols.zip", diff --git a/b2g/config/inari/config.json b/b2g/config/inari/config.json index 9b6eecec2b..46edbba824 100644 --- a/b2g/config/inari/config.json +++ b/b2g/config/inari/config.json @@ -3,7 +3,10 @@ "tooltool_manifest": "releng-inari.tt", "mock_target": "mozilla-centos6-i386", "mock_packages": ["ccache", "make", "bison", "flex", "gcc", "g++", "mpfr", "zlib-devel", "ncurses-devel", "zip", "autoconf213", "glibc-static", "perl-Digest-SHA", "wget", "alsa-lib", "atk", "cairo", "dbus-glib", "fontconfig", "freetype", "glib2", "gtk2", "libXRender", "libXt", "pango", "mozilla-python27-mercurial", "openssh-clients", "nss-devel", "java-1.6.0-openjdk-devel", "git"], - "mock_files": [["/home/cltbld/.ssh", "/home/mock_mozilla/.ssh"]], + "mock_files": [ + ["/home/cltbld/.ssh", "/home/mock_mozilla/.ssh"], + ["/builds/crash-stats-api.token", "/builds/crash-stats-api.token"] + ], "build_targets": [], "upload_files": [ "{objdir}/dist/b2g-*.crashreporter-symbols.zip", diff --git a/b2g/config/leo/config.json b/b2g/config/leo/config.json index 8d3b60f184..1e62f5b29b 100644 --- a/b2g/config/leo/config.json +++ b/b2g/config/leo/config.json @@ -3,7 +3,10 @@ "tooltool_manifest": "releng-leo.tt", "mock_target": "mozilla-centos6-i386", "mock_packages": ["ccache", "make", "bison", "flex", "gcc", "g++", "mpfr", "zlib-devel", "ncurses-devel", "zip", "autoconf213", "glibc-static", "perl-Digest-SHA", "wget", "alsa-lib", "atk", "cairo", "dbus-glib", "fontconfig", "freetype", "glib2", "gtk2", "libXRender", "libXt", "pango", "mozilla-python27-mercurial", "openssh-clients", "nss-devel", "java-1.6.0-openjdk-devel", "git"], - "mock_files": [["/home/cltbld/.ssh", "/home/mock_mozilla/.ssh"]], + "mock_files": [ + ["/home/cltbld/.ssh", "/home/mock_mozilla/.ssh"], + ["/builds/crash-stats-api.token", "/builds/crash-stats-api.token"] + ], "build_targets": [], "upload_files": [ "{objdir}/dist/b2g-*.crashreporter-symbols.zip", diff --git a/b2g/config/mako/config.json b/b2g/config/mako/config.json index 56429ae7df..d183593765 100644 --- a/b2g/config/mako/config.json +++ b/b2g/config/mako/config.json @@ -3,7 +3,10 @@ "tooltool_manifest": "releng-mako.tt", "mock_target": "mozilla-centos6-x86_64", "mock_packages": ["ccache", "make", "bison", "flex", "gcc", "g++", "mpfr", "zlib-devel", "ncurses-devel", "zip", "autoconf213", "glibc-static", "perl-Digest-SHA", "wget", "alsa-lib", "atk", "cairo", "dbus-glib", "fontconfig", "freetype", "glib2", "gtk2", "libXRender", "libXt", "pango", "mozilla-python27-mercurial", "openssh-clients", "nss-devel", "glibc-devel.i686", "libstdc++.i686", "zlib-devel.i686", "ncurses-devel.i686", "libX11-devel.i686", "mesa-libGL-devel.i686", "mesa-libGL-devel", "libX11-devel", "git", "libxml2"], - "mock_files": [["/home/cltbld/.ssh", "/home/mock_mozilla/.ssh"]], + "mock_files": [ + ["/home/cltbld/.ssh", "/home/mock_mozilla/.ssh"], + ["/builds/crash-stats-api.token", "/builds/crash-stats-api.token"] + ], "build_targets": [], "upload_files": [ "{objdir}/dist/b2g-*.crashreporter-symbols.zip", diff --git a/b2g/config/mozconfigs/common b/b2g/config/mozconfigs/common index c6baae8bc9..f6bbe01170 100644 --- a/b2g/config/mozconfigs/common +++ b/b2g/config/mozconfigs/common @@ -9,4 +9,12 @@ no_sccache=1 . "$topsrcdir/build/mozconfig.common" +# Allow overriding this from the environment, and don't +# try to set it if it doesn't exist. As per above, this file is also +# used for local builds, and we may need to override this for builds in +# other environments. +if test -z "$SOCORRO_SYMBOL_UPLOAD_TOKEN_FILE" -a -f /builds/crash-stats-api.token; then + export SOCORRO_SYMBOL_UPLOAD_TOKEN_FILE=/builds/crash-stats-api.token +fi + ac_add_options --disable-unified-compilation diff --git a/b2g/config/unagi/config.json b/b2g/config/unagi/config.json index ff1701a8d9..b9c55ec9f2 100644 --- a/b2g/config/unagi/config.json +++ b/b2g/config/unagi/config.json @@ -3,7 +3,10 @@ "tooltool_manifest": "releng-unagi.tt", "mock_target": "mozilla-centos6-i386", "mock_packages": ["ccache", "make", "bison", "flex", "gcc", "g++", "mpfr", "zlib-devel", "ncurses-devel", "zip", "autoconf213", "glibc-static", "perl-Digest-SHA", "wget", "alsa-lib", "atk", "cairo", "dbus-glib", "fontconfig", "freetype", "glib2", "gtk2", "libXRender", "libXt", "pango", "mozilla-python27-mercurial", "openssh-clients", "nss-devel", "java-1.6.0-openjdk-devel", "git"], - "mock_files": [["/home/cltbld/.ssh", "/home/mock_mozilla/.ssh"]], + "mock_files": [ + ["/home/cltbld/.ssh", "/home/mock_mozilla/.ssh"], + ["/builds/crash-stats-api.token", "/builds/crash-stats-api.token"] + ], "build_targets": [], "upload_files": [ "{objdir}/dist/b2g-update/*.mar", diff --git a/b2g/config/wasabi/config.json b/b2g/config/wasabi/config.json index 231e5d0cb3..a0d302e6a0 100644 --- a/b2g/config/wasabi/config.json +++ b/b2g/config/wasabi/config.json @@ -3,7 +3,10 @@ "tooltool_manifest": "releng-wasabi.tt", "mock_target": "mozilla-centos6-i386", "mock_packages": ["ccache", "make", "bison", "flex", "gcc", "g++", "mpfr", "zlib-devel", "ncurses-devel", "zip", "autoconf213", "glibc-static", "perl-Digest-SHA", "wget", "alsa-lib", "atk", "cairo", "dbus-glib", "fontconfig", "freetype", "glib2", "gtk2", "libXRender", "libXt", "pango", "mozilla-python27-mercurial", "openssh-clients", "nss-devel", "java-1.6.0-openjdk-devel", "git"], - "mock_files": [["/home/cltbld/.ssh", "/home/mock_mozilla/.ssh"]], + "mock_files": [ + ["/home/cltbld/.ssh", "/home/mock_mozilla/.ssh"], + ["/builds/crash-stats-api.token", "/builds/crash-stats-api.token"] + ], "build_targets": [], "upload_files": [ "{objdir}/dist/b2g-*.crashreporter-symbols.zip", diff --git a/browser/app/blocklist.xml b/browser/app/blocklist.xml index 21ad821718..15536518e6 100644 --- a/browser/app/blocklist.xml +++ b/browser/app/blocklist.xml @@ -1,5 +1,5 @@ - + @@ -160,6 +160,15 @@ browser.startup.homepage browser.search.defaultenginename + + + + + + + + + @@ -282,6 +291,15 @@ + + + + + + + + + @@ -463,8 +481,13 @@ - + + + + + + @@ -545,12 +568,28 @@ + + + + + + browser.startup.homepage + browser.search.defaultenginename + + + + + + + browser.startup.homepage + browser.search.defaultenginename + @@ -641,6 +680,12 @@ + + + + + + @@ -729,6 +774,15 @@ + + + + + + + + + @@ -764,8 +818,13 @@ - + + + + + + @@ -799,6 +858,14 @@ + + + + + + browser.startup.homepage + browser.search.defaultenginename + @@ -874,10 +941,11 @@ - + + browser.startup.homepage @@ -925,6 +993,15 @@ + + + + + + + + + @@ -1113,6 +1190,14 @@ + + + + + + browser.startup.homepage + browser.search.defaultenginename + @@ -1636,6 +1721,15 @@ + + + + + + + + + @@ -1685,11 +1779,10 @@ - + - browser.startup.homepage @@ -2932,6 +3025,30 @@ https://get.adobe.com/flashplayer/ + + + https://java.com/ + + + + https://java.com/ + + + + https://java.com/ + + + + https://java.com/ + + + + https://java.com/ + + + + https://java.com/ + @@ -2982,5 +3099,32 @@ WINNT 5.1 0x8086 DIRECT3D_9_LAYERS, WEBGL_ANGLE BLOCKED_DRIVER_VERSION 6.14.10.5218 LESS_THAN + + + D9UltDPl4XVfSSqQOvdiwQ== + + + STMAjg== + + + UoRGnb96CUDTxIqVry6LBg== + + + ARQ= + + + YR3YYQAAAAAABA== + + + ATE0vw== + + + ATFpsA== + + + ATFEdg== + + + \ No newline at end of file diff --git a/browser/base/content/test/general/test_contextmenu.html b/browser/base/content/test/general/test_contextmenu.html index 09eb747de6..778d549ebc 100644 --- a/browser/base/content/test/general/test_contextmenu.html +++ b/browser/base/content/test/general/test_contextmenu.html @@ -869,7 +869,7 @@ if (painted && loaded) { subwindow.removeEventListener("MozAfterPaint", waitForEvents, false); subwindow.onload = null; - startTest(); + SimpleTest.waitForFocus(startTest, subwindow); } } diff --git a/browser/base/content/test/general/test_contextmenu_input.html b/browser/base/content/test/general/test_contextmenu_input.html index a0b041e15a..7f1afffb9e 100644 --- a/browser/base/content/test/general/test_contextmenu_input.html +++ b/browser/base/content/test/general/test_contextmenu_input.html @@ -323,7 +323,7 @@ if (painted && loaded) { subwindow.removeEventListener("MozAfterPaint", waitForEvents, false); subwindow.onload = null; - startTest(); + SimpleTest.waitForFocus(startTest, subwindow); } } diff --git a/browser/config/version.txt b/browser/config/version.txt index 0280be8bb3..6cc161e2af 100644 --- a/browser/config/version.txt +++ b/browser/config/version.txt @@ -1 +1 @@ -31.6.0 +31.8.0 diff --git a/build/gen_mach_buildprops.py b/build/gen_mach_buildprops.py index 9c0b175434..d318bdfd16 100644 --- a/build/gen_mach_buildprops.py +++ b/build/gen_mach_buildprops.py @@ -40,7 +40,7 @@ def getMarProperties(filename, partial=False): '%sMarHash' % martype: mar_hash, } -def getUrlProperties(filename): +def getUrlProperties(filename, package): # let's create a switch case using name-spaces/dict # rather than a long if/else with duplicate code property_conditions = [ @@ -54,8 +54,7 @@ def getUrlProperties(filename): ('jsshellUrl', lambda m: 'jsshell-' in m and m.endswith('.zip')), ('completeMarUrl', lambda m: m.endswith('.complete.mar')), ('partialMarUrl', lambda m: m.endswith('.mar') and '.partial.' in m), - # packageUrl must be last! - ('packageUrl', lambda m: True), + ('packageUrl', lambda m: m.endswith(package)), ] url_re = re.compile(r'''^(https?://.*?\.(?:tar\.bz2|dmg|zip|apk|rpm|mar|tar\.gz))$''') properties = {} @@ -95,10 +94,16 @@ def getPartialInfo(props): parser.add_argument("--upload-output", required=True, action="store", dest="upload_output", help="Path to the text output of 'make upload'") + parser.add_argument("--upload-files", required=True, nargs="+", + action="store", dest="upload_files", + help="List of files to be uploaded.") + parser.add_argument("--package", required=True, + action="store", dest="package", + help="Filename of the build package") args = parser.parse_args() json_data = getMarProperties(args.complete_mar_file) - json_data.update(getUrlProperties(args.upload_output)) + json_data.update(getUrlProperties(args.upload_output, args.package)) if args.partial_mar_file: json_data.update(getMarProperties(args.partial_mar_file, partial=True)) @@ -111,5 +116,8 @@ def getPartialInfo(props): # useful for balrog. json_data['partialInfo'] = getPartialInfo(json_data) + json_data['uploadFiles'] = args.upload_files + json_data['packageFilename'] = args.package + with open('mach_build_properties.json', 'w') as outfile: json.dump(json_data, outfile, indent=4) diff --git a/build/macosx/mozconfig.common b/build/macosx/mozconfig.common index 2dbf40bd0a..fc1eba6d32 100644 --- a/build/macosx/mozconfig.common +++ b/build/macosx/mozconfig.common @@ -31,3 +31,5 @@ if [ -z "$CXX" ]; then fi ac_add_options --with-ccache + +export SOCORRO_SYMBOL_UPLOAD_TOKEN_FILE=/builds/crash-stats-api.token diff --git a/build/moz-automation.mk b/build/moz-automation.mk index d031effcb0..0d19b69c8b 100644 --- a/build/moz-automation.mk +++ b/build/moz-automation.mk @@ -12,6 +12,10 @@ endif endif include $(topsrcdir)/toolkit/mozapps/installer/package-name.mk +include $(topsrcdir)/toolkit/mozapps/installer/upload-files.mk + +# Clear out DIST_FILES if it was set by upload-files.mk (for Android builds) +DIST_FILES = # Log file from the 'make upload' step. We need this to parse out the URLs of # the uploaded files. @@ -86,7 +90,7 @@ automation/l10n-check: automation/pretty-l10n-check automation/update-packaging: automation/pretty-update-packaging automation/build: $(addprefix automation/,$(MOZ_AUTOMATION_TIERS)) - $(PYTHON) $(topsrcdir)/build/gen_mach_buildprops.py --complete-mar-file $(DIST)/$(COMPLETE_MAR) $(addprefix --partial-mar-file ,$(wildcard $(DIST)/$(PARTIAL_MAR))) --upload-output $(AUTOMATION_UPLOAD_OUTPUT) + $(PYTHON) $(topsrcdir)/build/gen_mach_buildprops.py --complete-mar-file $(DIST)/$(COMPLETE_MAR) $(addprefix --partial-mar-file ,$(wildcard $(DIST)/$(PARTIAL_MAR))) --upload-output $(AUTOMATION_UPLOAD_OUTPUT) --upload-files $(abspath $(UPLOAD_FILES)) --package $(PACKAGE) # We need the log from make upload to grep it for urls in order to set # properties. diff --git a/build/mozconfig.win-common b/build/mozconfig.win-common index 396f0e60e7..6eec310362 100644 --- a/build/mozconfig.win-common +++ b/build/mozconfig.win-common @@ -7,3 +7,5 @@ if [ "x$IS_NIGHTLY" = "xyes" ]; then MOZ_AUTOMATION_UPDATE_PACKAGING=1 fi MOZ_AUTOMATION_INSTALLER=1 + +export SOCORRO_SYMBOL_UPLOAD_TOKEN_FILE=c:/builds/crash-stats-api.token diff --git a/build/unix/mozconfig.linux b/build/unix/mozconfig.linux index dc9259f0bc..4ab19b1f93 100644 --- a/build/unix/mozconfig.linux +++ b/build/unix/mozconfig.linux @@ -26,3 +26,5 @@ ac_add_options --enable-elf-hack # Avoid dependency on libstdc++ 4.7 ac_add_options --enable-stdcxx-compat + +export SOCORRO_SYMBOL_UPLOAD_TOKEN_FILE=/builds/crash-stats-api.token diff --git a/build/upload.py b/build/upload.py index 9dae5d9be8..6b1112eed5 100644 --- a/build/upload.py +++ b/build/upload.py @@ -24,7 +24,8 @@ import sys, os from optparse import OptionParser -from subprocess import PIPE, Popen, check_call +from subprocess import check_call, check_output +import redo def RequireEnvironmentVariable(v): """Return the value of the environment variable named v, or print @@ -82,12 +83,12 @@ def DoSSHCommand(command, user, host, port=None, ssh_key=None): cmdline = ["ssh"] AppendOptionalArgsToSSHCommandline(cmdline, port, ssh_key) cmdline.extend(["%s@%s" % (user, host), command]) - cmd = Popen(cmdline, stdout=PIPE) - retcode = cmd.wait() - if retcode != 0: - raise Exception("Command %s returned non-zero exit code: %i" % \ - (cmdline, retcode)) - return cmd.stdout.read().strip() + + with redo.retrying(check_output, sleeptime=10) as f: + output = f(cmdline).strip() + return output + + raise Exception("Command %s returned non-zero exit code" % cmdline) def DoSCPFile(file, remote_path, user, host, port=None, ssh_key=None): """Upload file to user@host:remote_path using scp. Optionally use @@ -96,7 +97,11 @@ def DoSCPFile(file, remote_path, user, host, port=None, ssh_key=None): AppendOptionalArgsToSSHCommandline(cmdline, port, ssh_key) cmdline.extend([WindowsPathToMsysPath(file), "%s@%s:%s" % (user, host, remote_path)]) - check_call(cmdline) + with redo.retrying(check_call, sleeptime=10) as f: + f(cmdline) + return + + raise Exception("Command %s returned non-zero exit code" % cmdline) def GetRemotePath(path, local_file, base_path): """Given a remote path to upload to, a full path to a local file, and an diff --git a/build/virtualenv_packages.txt b/build/virtualenv_packages.txt index 08091e1967..22482c8606 100644 --- a/build/virtualenv_packages.txt +++ b/build/virtualenv_packages.txt @@ -22,3 +22,5 @@ copy:build/buildconfig.py packages.txt:testing/mozbase/packages.txt objdir:build gyp.pth:media/webrtc/trunk/tools/gyp/pylib +redo.pth:python/redo +requests.pth:python/requests diff --git a/config/milestone.txt b/config/milestone.txt index 1fa347102f..ff1af3e79d 100644 --- a/config/milestone.txt +++ b/config/milestone.txt @@ -10,4 +10,4 @@ # hardcoded milestones in the tree from these two files. #-------------------------------------------------------- -31.6.0 +31.8.0 diff --git a/configure.in b/configure.in index 5852478b33..293a8b0a0c 100644 --- a/configure.in +++ b/configure.in @@ -3655,7 +3655,7 @@ MOZ_ARG_WITH_BOOL(system-nss, _USE_SYSTEM_NSS=1 ) if test -n "$_USE_SYSTEM_NSS"; then - AM_PATH_NSS(3.16.2.3, [MOZ_NATIVE_NSS=1], [AC_MSG_ERROR([you don't have NSS installed or your version is too old])]) + AM_PATH_NSS(3.19.2, [MOZ_NATIVE_NSS=1], [AC_MSG_ERROR([you don't have NSS installed or your version is too old])]) fi if test -n "$MOZ_NATIVE_NSS"; then @@ -8785,6 +8785,7 @@ AC_SUBST(LIBJPEG_TURBO_ARM_ASM) AC_SUBST(MOZ_PACKAGE_JSSHELL) AC_SUBST(MOZ_FOLD_LIBS) +AC_SUBST(SOCORRO_SYMBOL_UPLOAD_TOKEN_FILE) AC_SUBST(MOZ_ENABLE_SZIP) AC_SUBST(MOZ_SZIP_FLAGS) diff --git a/content/base/src/nsXMLHttpRequest.cpp b/content/base/src/nsXMLHttpRequest.cpp index 58a9ee01c8..86425d75bc 100644 --- a/content/base/src/nsXMLHttpRequest.cpp +++ b/content/base/src/nsXMLHttpRequest.cpp @@ -7,6 +7,7 @@ #include "nsXMLHttpRequest.h" #include "mozilla/ArrayUtils.h" +#include "mozilla/CheckedInt.h" #include "mozilla/dom/XMLHttpRequestUploadBinding.h" #include "mozilla/EventDispatcher.h" #include "mozilla/EventListenerManager.h" @@ -654,13 +655,18 @@ nsXMLHttpRequest::AppendToResponseText(const char * aSrcBuffer, &destBufferLen); NS_ENSURE_SUCCESS(rv, rv); - if (!mResponseText.SetCapacity(mResponseText.Length() + destBufferLen, fallible_t())) { + uint32_t size = mResponseText.Length() + destBufferLen; + if (size < (uint32_t)destBufferLen) { + return NS_ERROR_OUT_OF_MEMORY; + } + + if (!mResponseText.SetCapacity(size, fallible_t())) { return NS_ERROR_OUT_OF_MEMORY; } char16_t* destBuffer = mResponseText.BeginWriting() + mResponseText.Length(); - int32_t totalChars = mResponseText.Length(); + CheckedInt32 totalChars = mResponseText.Length(); // This code here is basically a copy of a similar thing in // nsScanner::Append(const char* aBuffer, uint32_t aLen). @@ -673,9 +679,11 @@ nsXMLHttpRequest::AppendToResponseText(const char * aSrcBuffer, MOZ_ASSERT(NS_SUCCEEDED(rv)); totalChars += destlen; + if (!totalChars.isValid()) { + return NS_ERROR_OUT_OF_MEMORY; + } - mResponseText.SetLength(totalChars); - + mResponseText.SetLength(totalChars.value()); return NS_OK; } @@ -3897,26 +3905,30 @@ bool ArrayBufferBuilder::append(const uint8_t *aNewData, uint32_t aDataLen, uint32_t aMaxGrowth) { + CheckedUint32 neededCapacity = mLength; + neededCapacity += aDataLen; + if (!neededCapacity.isValid()) { + return false; + } if (mLength + aDataLen > mCapacity) { - uint32_t newcap; + CheckedUint32 newcap = mCapacity; // Double while under aMaxGrowth or if not specified. if (!aMaxGrowth || mCapacity < aMaxGrowth) { - newcap = mCapacity * 2; + newcap *= 2; } else { - newcap = mCapacity + aMaxGrowth; + newcap += aMaxGrowth; } - // But make sure there's always enough to satisfy our request. - if (newcap < mLength + aDataLen) { - newcap = mLength + aDataLen; + if (!newcap.isValid()) { + return false; } - // Did we overflow? - if (newcap < mCapacity) { - return false; + // But make sure there's always enough to satisfy our request. + if (newcap.value() < neededCapacity.value()) { + newcap = neededCapacity; } - if (!setCapacity(newcap)) { + if (!setCapacity(newcap.value())) { return false; } } diff --git a/content/base/test/csp/mochitest.ini b/content/base/test/csp/mochitest.ini index 67cda61553..ead08fc8c9 100644 --- a/content/base/test/csp/mochitest.ini +++ b/content/base/test/csp/mochitest.ini @@ -137,7 +137,7 @@ skip-if = (buildapp == 'b2g' && (toolkit != 'gonk' || debug)) # b2g-debug(observ [test_CSP_evalscript.html] skip-if = (buildapp == 'b2g' && (toolkit != 'gonk' || debug)) # b2g-debug(observer not working) b2g-desktop(observer not working) [test_CSP_evalscript_getCRMFRequest.html] -skip-if = buildapp == 'b2g' || toolkit == 'android' #bug 824652 # b2g(no window.crypto support in multiprocess) b2g-debug(observer not working) b2g-desktop(observer not working) +skip-if = true # Bug 1166031 comment 42 [test_CSP_frameancestors.html] skip-if = (buildapp == 'b2g' && (toolkit != 'gonk' || debug)) || toolkit == 'android' # b2g-debug(observer not working) b2g-desktop(observer not working) [test_CSP_inlinescript.html] diff --git a/content/media/gstreamer/GStreamerFormatHelper.cpp b/content/media/gstreamer/GStreamerFormatHelper.cpp index 25095e733e..ebd12c233c 100644 --- a/content/media/gstreamer/GStreamerFormatHelper.cpp +++ b/content/media/gstreamer/GStreamerFormatHelper.cpp @@ -67,6 +67,7 @@ static char const * const sDefaultCodecCaps[][2] = { static char const * const sPluginBlacklist[] = { "flump3dec", + "h264parse", }; GStreamerFormatHelper::GStreamerFormatHelper() @@ -251,7 +252,8 @@ static gboolean FactoryFilter(GstPluginFeature *aFeature, gpointer) const gchar *className = gst_element_factory_get_klass(GST_ELEMENT_FACTORY_CAST(aFeature)); - if (!strstr(className, "Decoder") && !strstr(className, "Demux")) { + if (!strstr(className, "Decoder") && !strstr(className, "Demux") && + !strstr(className, "Parser")) { return FALSE; } diff --git a/content/media/webaudio/MediaBufferDecoder.cpp b/content/media/webaudio/MediaBufferDecoder.cpp index b9409adc6d..ee6538cc10 100644 --- a/content/media/webaudio/MediaBufferDecoder.cpp +++ b/content/media/webaudio/MediaBufferDecoder.cpp @@ -101,13 +101,6 @@ class MediaDecodeTask : public nsRunnable { MOZ_ASSERT(aBuffer); MOZ_ASSERT(NS_IsMainThread()); - - nsCOMPtr pWindow = do_QueryInterface(mDecodeJob.mContext->GetParentObject()); - nsCOMPtr scriptPrincipal = - do_QueryInterface(pWindow); - if (scriptPrincipal) { - mPrincipal = scriptPrincipal->GetPrincipal(); - } } NS_IMETHOD Run(); @@ -150,7 +143,6 @@ class MediaDecodeTask : public nsRunnable WebAudioDecodeJob& mDecodeJob; PhaseEnum mPhase; nsCOMPtr mThreadPool; - nsCOMPtr mPrincipal; nsRefPtr mBufferDecoder; nsAutoPtr mDecoderReader; }; @@ -179,9 +171,16 @@ MediaDecodeTask::CreateReader() { MOZ_ASSERT(NS_IsMainThread()); + + nsCOMPtr principal; + nsCOMPtr sop = do_QueryInterface(mDecodeJob.mContext->GetParentObject()); + if (sop) { + principal = sop->GetPrincipal(); + } + nsRefPtr resource = new BufferMediaResource(static_cast (mBuffer), - mLength, mPrincipal, mContentType); + mLength, principal, mContentType); MOZ_ASSERT(!mBufferDecoder); mBufferDecoder = new BufferDecoder(resource); diff --git a/dom/file/ArchiveZipFile.cpp b/dom/file/ArchiveZipFile.cpp index c206b6488e..d28b5baba2 100644 --- a/dom/file/ArchiveZipFile.cpp +++ b/dom/file/ArchiveZipFile.cpp @@ -102,7 +102,8 @@ ArchiveInputStream::Init() uint32_t offset = ArchiveZipItem::StrToInt32(mCentral.localhdr_offset); // The file is corrupt - if (offset + ZIPLOCAL_SIZE > mData.parentSize) { + if (mData.parentSize < ZIPLOCAL_SIZE || + offset > mData.parentSize - ZIPLOCAL_SIZE) { return NS_ERROR_UNEXPECTED; } @@ -137,7 +138,8 @@ ArchiveInputStream::Init() ArchiveZipItem::StrToInt16(local.extrafield_len); // The file is corrupt if there is not enough data - if (offset + mData.sizeToBeRead > mData.parentSize) { + if (mData.parentSize < mData.sizeToBeRead || + offset > mData.parentSize - mData.sizeToBeRead) { return NS_ERROR_UNEXPECTED; } diff --git a/dom/indexedDB/IDBRequest.cpp b/dom/indexedDB/IDBRequest.cpp index 36e8a96878..695f2ee1b5 100644 --- a/dom/indexedDB/IDBRequest.cpp +++ b/dom/indexedDB/IDBRequest.cpp @@ -35,6 +35,8 @@ namespace { +NS_DEFINE_IID(kIDBRequestIID, PRIVATE_IDBREQUEST_IID); + #ifdef MOZ_ENABLE_PROFILER_SPS uint64_t gNextRequestSerialNumber = 1; #endif @@ -382,6 +384,9 @@ NS_IMPL_CYCLE_COLLECTION_TRACE_BEGIN_INHERITED(IDBRequest, IDBWrapperCache) NS_IMPL_CYCLE_COLLECTION_TRACE_END NS_INTERFACE_MAP_BEGIN_CYCLE_COLLECTION_INHERITED(IDBRequest) + if (aIID.Equals(kIDBRequestIID)) { + foundInterface = this; + } else NS_INTERFACE_MAP_END_INHERITING(IDBWrapperCache) NS_IMPL_ADDREF_INHERITED(IDBRequest, IDBWrapperCache) diff --git a/dom/indexedDB/IDBRequest.h b/dom/indexedDB/IDBRequest.h index c835ae8cda..c8d108146c 100644 --- a/dom/indexedDB/IDBRequest.h +++ b/dom/indexedDB/IDBRequest.h @@ -19,6 +19,9 @@ #include "mozilla/dom/indexedDB/IDBWrapperCache.h" +#define PRIVATE_IDBREQUEST_IID \ + {0xe68901e5, 0x1d50, 0x4ee9, {0xaf, 0x49, 0x90, 0x99, 0x4a, 0xff, 0xc8, 0x39}} + class nsIScriptContext; class nsPIDOMWindow; diff --git a/dom/indexedDB/IndexedDatabaseManager.cpp b/dom/indexedDB/IndexedDatabaseManager.cpp index 466d0ffb3d..eabfe09912 100644 --- a/dom/indexedDB/IndexedDatabaseManager.cpp +++ b/dom/indexedDB/IndexedDatabaseManager.cpp @@ -108,6 +108,8 @@ END_INDEXEDDB_NAMESPACE namespace { +NS_DEFINE_IID(kIDBRequestIID, PRIVATE_IDBREQUEST_IID); + mozilla::StaticRefPtr gDBManager; mozilla::Atomic gInitialized(false); @@ -318,19 +320,31 @@ IndexedDatabaseManager::FireWindowOnError(nsPIDOMWindow* aOwner, return NS_OK; } + Event* internalEvent = aVisitor.mDOMEvent->InternalDOMEvent(); + MOZ_ASSERT(internalEvent); + + if (!internalEvent->IsTrusted()) { + return NS_OK; + } + nsString type; - nsresult rv = aVisitor.mDOMEvent->GetType(type); + nsresult rv = internalEvent->GetType(type); NS_ENSURE_SUCCESS(rv, rv); if (!type.EqualsLiteral(ERROR_EVT_STR)) { return NS_OK; } - nsCOMPtr eventTarget = - aVisitor.mDOMEvent->InternalDOMEvent()->GetTarget(); + nsCOMPtr eventTarget = internalEvent->GetTarget(); + MOZ_ASSERT(eventTarget); - IDBRequest* request = static_cast(eventTarget.get()); - NS_ENSURE_TRUE(request, NS_ERROR_UNEXPECTED); + // Only mess with events that were originally targeted to an IDBRequest. + nsRefPtr request; + if (NS_FAILED(eventTarget->QueryInterface(kIDBRequestIID, + getter_AddRefs(request))) || + !request) { + return NS_OK; + } ErrorResult ret; nsRefPtr error = request->GetError(ret); diff --git a/dom/media/tests/mochitest/test_peerConnection_offerRequiresReceiveAudio.html b/dom/media/tests/mochitest/test_peerConnection_offerRequiresReceiveAudio.html index 69d7e493f3..d68c078cb1 100644 --- a/dom/media/tests/mochitest/test_peerConnection_offerRequiresReceiveAudio.html +++ b/dom/media/tests/mochitest/test_peerConnection_offerRequiresReceiveAudio.html @@ -17,6 +17,8 @@ runTest(function() { var test = new PeerConnectionTest(); + test.chain.remove('PC_LOCAL_CHECK_STATS'); + test.chain.remove('PC_REMOTE_CHECK_STATS'); test.setOfferConstraints({ mandatory: { OfferToReceiveAudio: true } }); test.run(); }); diff --git a/dom/media/tests/mochitest/test_peerConnection_offerRequiresReceiveVideo.html b/dom/media/tests/mochitest/test_peerConnection_offerRequiresReceiveVideo.html index 5f1d0e5f80..0ecb0b7195 100644 --- a/dom/media/tests/mochitest/test_peerConnection_offerRequiresReceiveVideo.html +++ b/dom/media/tests/mochitest/test_peerConnection_offerRequiresReceiveVideo.html @@ -17,6 +17,8 @@ runTest(function() { var test = new PeerConnectionTest(); + test.chain.remove('PC_LOCAL_CHECK_STATS'); + test.chain.remove('PC_REMOTE_CHECK_STATS'); test.setOfferConstraints({ mandatory: { OfferToReceiveVideo: true } }); test.run(); }); diff --git a/dom/media/tests/mochitest/test_peerConnection_offerRequiresReceiveVideoAudio.html b/dom/media/tests/mochitest/test_peerConnection_offerRequiresReceiveVideoAudio.html index c3dea10c26..78eb0d4ebe 100644 --- a/dom/media/tests/mochitest/test_peerConnection_offerRequiresReceiveVideoAudio.html +++ b/dom/media/tests/mochitest/test_peerConnection_offerRequiresReceiveVideoAudio.html @@ -17,6 +17,8 @@ runTest(function() { var test = new PeerConnectionTest(); + test.chain.remove('PC_LOCAL_CHECK_STATS'); + test.chain.remove('PC_REMOTE_CHECK_STATS'); test.setOfferConstraints({ mandatory: { OfferToReceiveVideo: true, OfferToReceiveAudio: true diff --git a/dom/plugins/base/nsPluginInstanceOwner.cpp b/dom/plugins/base/nsPluginInstanceOwner.cpp index e5cf082c07..584bc5c114 100644 --- a/dom/plugins/base/nsPluginInstanceOwner.cpp +++ b/dom/plugins/base/nsPluginInstanceOwner.cpp @@ -135,7 +135,8 @@ nsPluginInstanceOwner::NotifyPaintWaiter(nsDisplayListBuilder* aBuilder) { // This is notification for reftests about async plugin paint start if (!mWaitingForPaint && !IsUpToDate() && aBuilder->ShouldSyncDecodeImages()) { - nsCOMPtr event = new AsyncPaintWaitEvent(mContent, false); + nsCOMPtr content = do_QueryReferent(mContent); + nsCOMPtr event = new AsyncPaintWaitEvent(content, false); // Run this event as soon as it's safe to do so, since listeners need to // receive it immediately mWaitingForPaint = nsContentUtils::AddScriptRunner(event); @@ -265,7 +266,6 @@ nsPluginInstanceOwner::nsPluginInstanceOwner() mPluginWindow = nullptr; mObjectFrame = nullptr; - mContent = nullptr; mWidgetCreationComplete = false; #ifdef XP_MACOSX memset(&mCGPluginPortCopy, 0, sizeof(NP_CGContext)); @@ -307,10 +307,13 @@ nsPluginInstanceOwner::~nsPluginInstanceOwner() int32_t cnt; if (mWaitingForPaint) { - // We don't care when the event is dispatched as long as it's "soon", - // since whoever needs it will be waiting for it. - nsCOMPtr event = new AsyncPaintWaitEvent(mContent, true); - NS_DispatchToMainThread(event); + nsCOMPtr content = do_QueryReferent(mContent); + if (content) { + // We don't care when the event is dispatched as long as it's "soon", + // since whoever needs it will be waiting for it. + nsCOMPtr event = new AsyncPaintWaitEvent(content, true); + NS_DispatchToMainThread(event); + } } mObjectFrame = nullptr; @@ -445,7 +448,7 @@ NS_IMETHODIMP nsPluginInstanceOwner::GetAttribute(const char* name, const char* NS_IMETHODIMP nsPluginInstanceOwner::GetDOMElement(nsIDOMElement* *result) { - return CallQueryInterface(mContent, result); + return CallQueryReferent(mContent.get(), result); } nsresult nsPluginInstanceOwner::GetInstance(nsNPAPIPluginInstance **aInstance) @@ -463,13 +466,16 @@ NS_IMETHODIMP nsPluginInstanceOwner::GetURL(const char *aURL, void *aHeadersData, uint32_t aHeadersDataLen) { - NS_ENSURE_TRUE(mContent, NS_ERROR_NULL_POINTER); + nsCOMPtr content = do_QueryReferent(mContent); + if (!content) { + return NS_ERROR_NULL_POINTER; + } - if (mContent->IsEditable()) { + if (content->IsEditable()) { return NS_OK; } - nsIDocument *doc = mContent->GetCurrentDoc(); + nsIDocument *doc = content->GetCurrentDoc(); if (!doc) { return NS_ERROR_FAILURE; } @@ -519,7 +525,7 @@ NS_IMETHODIMP nsPluginInstanceOwner::GetURL(const char *aURL, Preferences::GetInt("privacy.popups.disable_from_plugins"); nsAutoPopupStatePusher popupStatePusher((PopupControlState)blockPopups); - rv = lh->OnLinkClick(mContent, uri, unitarget.get(), NullString(), + rv = lh->OnLinkClick(content, uri, unitarget.get(), NullString(), aPostStream, headersDataStream, true); return rv; @@ -564,12 +570,14 @@ NS_IMETHODIMP nsPluginInstanceOwner::ShowStatus(const char16_t *aStatusMsg) NS_IMETHODIMP nsPluginInstanceOwner::GetDocument(nsIDocument* *aDocument) { - if (!aDocument) + nsCOMPtr content = do_QueryReferent(mContent); + if (!aDocument || !content) { return NS_ERROR_NULL_POINTER; + } // XXX sXBL/XBL2 issue: current doc or owner doc? // But keep in mind bug 322414 comment 33 - NS_IF_ADDREF(*aDocument = mContent->OwnerDoc()); + NS_IF_ADDREF(*aDocument = content->OwnerDoc()); return NS_OK; } @@ -578,9 +586,10 @@ NS_IMETHODIMP nsPluginInstanceOwner::InvalidateRect(NPRect *invalidRect) // If our object frame has gone away, we won't be able to determine // up-to-date-ness, so just fire off the event. if (mWaitingForPaint && (!mObjectFrame || IsUpToDate())) { + nsCOMPtr content = do_QueryReferent(mContent); // We don't care when the event is dispatched as long as it's "soon", // since whoever needs it will be waiting for it. - nsCOMPtr event = new AsyncPaintWaitEvent(mContent, true); + nsCOMPtr event = new AsyncPaintWaitEvent(content, true); NS_DispatchToMainThread(event); mWaitingForPaint = false; } @@ -775,7 +784,8 @@ NS_IMETHODIMP nsPluginInstanceOwner::GetTagType(nsPluginTagType *result) *result = nsPluginTagType_Unknown; - nsIAtom *atom = mContent->Tag(); + nsCOMPtr content = do_QueryReferent(mContent); + nsIAtom *atom = content->Tag(); if (atom == nsGkAtoms::applet) *result = nsPluginTagType_Applet; @@ -840,7 +850,8 @@ nsresult nsPluginInstanceOwner::EnsureCachedAttrParamArrays() // Convert to a 16-bit count. Subtract 3 in case we add an extra // "src", "wmode", or "codebase" entry below. - uint32_t cattrs = mContent->GetAttrCount(); + nsCOMPtr content = do_QueryReferent(mContent); + uint32_t cattrs = content->GetAttrCount(); if (cattrs < 0x0000FFFC) { mNumCachedAttrs = static_cast(cattrs); } else { @@ -863,7 +874,7 @@ nsresult nsPluginInstanceOwner::EnsureCachedAttrParamArrays() nsCOMArray ourParams; // Get all dependent PARAM tags, even if they are not direct children. - nsCOMPtr mydomElement = do_QueryInterface(mContent); + nsCOMPtr mydomElement = do_QueryInterface(content); NS_ENSURE_TRUE(mydomElement, NS_ERROR_NO_INTERFACE); // Making DOM method calls can cause our frame to go away. @@ -930,9 +941,9 @@ nsresult nsPluginInstanceOwner::EnsureCachedAttrParamArrays() // look for "data", lets instead copy the "data" attribute and add another entry // to the bottom of the array if there isn't already a "src" specified. nsAutoString data; - if (mContent->Tag() == nsGkAtoms::object && - !mContent->HasAttr(kNameSpaceID_None, nsGkAtoms::src) && - mContent->GetAttr(kNameSpaceID_None, nsGkAtoms::data, data) && + if (content->Tag() == nsGkAtoms::object && + !content->HasAttr(kNameSpaceID_None, nsGkAtoms::src) && + content->GetAttr(kNameSpaceID_None, nsGkAtoms::data, data) && !data.IsEmpty()) { mNumCachedAttrs++; } @@ -962,13 +973,13 @@ nsresult nsPluginInstanceOwner::EnsureCachedAttrParamArrays() bool addCodebase = false; nsAutoCString codebaseStr; if (isJava) { - nsCOMPtr objlc = do_QueryInterface(mContent); + nsCOMPtr objlc = do_QueryInterface(content); NS_ENSURE_TRUE(objlc, NS_ERROR_UNEXPECTED); nsCOMPtr codebaseURI; nsresult rv = objlc->GetBaseURI(getter_AddRefs(codebaseURI)); NS_ENSURE_SUCCESS(rv, rv); codebaseURI->GetSpec(codebaseStr); - if (!mContent->HasAttr(kNameSpaceID_None, nsGkAtoms::codebase)) { + if (!content->HasAttr(kNameSpaceID_None, nsGkAtoms::codebase)) { mNumCachedAttrs++; addCodebase = true; } @@ -986,8 +997,8 @@ nsresult nsPluginInstanceOwner::EnsureCachedAttrParamArrays() // source order, while in XML and XHTML it's the same as the source order // (see the AddAttributes functions in the HTML and XML content sinks). int32_t start, end, increment; - if (mContent->IsHTML() && - mContent->IsInHTMLDocument()) { + if (content->IsHTML() && + content->IsInHTMLDocument()) { // HTML. Walk attributes in reverse order. start = numRealAttrs - 1; end = -1; @@ -1008,10 +1019,10 @@ nsresult nsPluginInstanceOwner::EnsureCachedAttrParamArrays() // Add attribute name/value pairs. for (int32_t index = start; index != end; index += increment) { - const nsAttrName* attrName = mContent->GetAttrNameAt(index); + const nsAttrName* attrName = content->GetAttrNameAt(index); nsIAtom* atom = attrName->LocalName(); nsAutoString value; - mContent->GetAttr(attrName->NamespaceID(), atom, value); + content->GetAttr(attrName->NamespaceID(), atom, value); nsAutoString name; atom->ToString(name); @@ -1664,7 +1675,7 @@ nsPluginInstanceOwner::ProcessMouseDown(nsIDOMEvent* aMouseEvent) nsIFocusManager* fm = nsFocusManager::GetFocusManager(); if (fm) { - nsCOMPtr elem = do_QueryInterface(mContent); + nsCOMPtr elem = do_QueryReferent(mContent); fm->SetFocus(elem, 0); } } @@ -2203,7 +2214,7 @@ nsEventStatus nsPluginInstanceOwner::ProcessEvent(const WidgetGUIEvent& anEvent) // The plugin needs focus to receive keyboard and touch events nsIFocusManager* fm = nsFocusManager::GetFocusManager(); if (fm) { - nsCOMPtr elem = do_QueryInterface(mContent); + nsCOMPtr elem = do_QueryReferent(mContent); fm->SetFocus(elem, 0); } } @@ -2296,34 +2307,36 @@ nsPluginInstanceOwner::Destroy() ::CGColorSpaceRelease(mColorProfile); #endif + nsCOMPtr content = do_QueryReferent(mContent); + // unregister context menu listener if (mCXMenuListener) { - mCXMenuListener->Destroy(mContent); + mCXMenuListener->Destroy(content); mCXMenuListener = nullptr; } - mContent->RemoveEventListener(NS_LITERAL_STRING("focus"), this, false); - mContent->RemoveEventListener(NS_LITERAL_STRING("blur"), this, false); - mContent->RemoveEventListener(NS_LITERAL_STRING("mouseup"), this, false); - mContent->RemoveEventListener(NS_LITERAL_STRING("mousedown"), this, false); - mContent->RemoveEventListener(NS_LITERAL_STRING("mousemove"), this, false); - mContent->RemoveEventListener(NS_LITERAL_STRING("click"), this, false); - mContent->RemoveEventListener(NS_LITERAL_STRING("dblclick"), this, false); - mContent->RemoveEventListener(NS_LITERAL_STRING("mouseover"), this, false); - mContent->RemoveEventListener(NS_LITERAL_STRING("mouseout"), this, false); - mContent->RemoveEventListener(NS_LITERAL_STRING("keypress"), this, true); - mContent->RemoveEventListener(NS_LITERAL_STRING("keydown"), this, true); - mContent->RemoveEventListener(NS_LITERAL_STRING("keyup"), this, true); - mContent->RemoveEventListener(NS_LITERAL_STRING("drop"), this, true); - mContent->RemoveEventListener(NS_LITERAL_STRING("dragdrop"), this, true); - mContent->RemoveEventListener(NS_LITERAL_STRING("drag"), this, true); - mContent->RemoveEventListener(NS_LITERAL_STRING("dragenter"), this, true); - mContent->RemoveEventListener(NS_LITERAL_STRING("dragover"), this, true); - mContent->RemoveEventListener(NS_LITERAL_STRING("dragleave"), this, true); - mContent->RemoveEventListener(NS_LITERAL_STRING("dragexit"), this, true); - mContent->RemoveEventListener(NS_LITERAL_STRING("dragstart"), this, true); - mContent->RemoveEventListener(NS_LITERAL_STRING("draggesture"), this, true); - mContent->RemoveEventListener(NS_LITERAL_STRING("dragend"), this, true); + content->RemoveEventListener(NS_LITERAL_STRING("focus"), this, false); + content->RemoveEventListener(NS_LITERAL_STRING("blur"), this, false); + content->RemoveEventListener(NS_LITERAL_STRING("mouseup"), this, false); + content->RemoveEventListener(NS_LITERAL_STRING("mousedown"), this, false); + content->RemoveEventListener(NS_LITERAL_STRING("mousemove"), this, false); + content->RemoveEventListener(NS_LITERAL_STRING("click"), this, false); + content->RemoveEventListener(NS_LITERAL_STRING("dblclick"), this, false); + content->RemoveEventListener(NS_LITERAL_STRING("mouseover"), this, false); + content->RemoveEventListener(NS_LITERAL_STRING("mouseout"), this, false); + content->RemoveEventListener(NS_LITERAL_STRING("keypress"), this, true); + content->RemoveEventListener(NS_LITERAL_STRING("keydown"), this, true); + content->RemoveEventListener(NS_LITERAL_STRING("keyup"), this, true); + content->RemoveEventListener(NS_LITERAL_STRING("drop"), this, true); + content->RemoveEventListener(NS_LITERAL_STRING("dragdrop"), this, true); + content->RemoveEventListener(NS_LITERAL_STRING("drag"), this, true); + content->RemoveEventListener(NS_LITERAL_STRING("dragenter"), this, true); + content->RemoveEventListener(NS_LITERAL_STRING("dragover"), this, true); + content->RemoveEventListener(NS_LITERAL_STRING("dragleave"), this, true); + content->RemoveEventListener(NS_LITERAL_STRING("dragexit"), this, true); + content->RemoveEventListener(NS_LITERAL_STRING("dragstart"), this, true); + content->RemoveEventListener(NS_LITERAL_STRING("draggesture"), this, true); + content->RemoveEventListener(NS_LITERAL_STRING("dragend"), this, true); #if MOZ_WIDGET_ANDROID RemovePluginView(); @@ -2671,7 +2684,7 @@ nsresult nsPluginInstanceOwner::Init(nsIContent* aContent) { mLastEventloopNestingLevel = GetEventloopNestingLevel(); - mContent = aContent; + mContent = do_GetWeakReference(aContent); // Get a frame, don't reflow. If a reflow was necessary it should have been // done at a higher level than this (content). @@ -2693,37 +2706,37 @@ nsresult nsPluginInstanceOwner::Init(nsIContent* aContent) // register context menu listener mCXMenuListener = new nsPluginDOMContextMenuListener(aContent); - mContent->AddEventListener(NS_LITERAL_STRING("focus"), this, false, + aContent->AddEventListener(NS_LITERAL_STRING("focus"), this, false, false); - mContent->AddEventListener(NS_LITERAL_STRING("blur"), this, false, + aContent->AddEventListener(NS_LITERAL_STRING("blur"), this, false, false); - mContent->AddEventListener(NS_LITERAL_STRING("mouseup"), this, false, + aContent->AddEventListener(NS_LITERAL_STRING("mouseup"), this, false, false); - mContent->AddEventListener(NS_LITERAL_STRING("mousedown"), this, false, + aContent->AddEventListener(NS_LITERAL_STRING("mousedown"), this, false, false); - mContent->AddEventListener(NS_LITERAL_STRING("mousemove"), this, false, + aContent->AddEventListener(NS_LITERAL_STRING("mousemove"), this, false, false); - mContent->AddEventListener(NS_LITERAL_STRING("click"), this, false, + aContent->AddEventListener(NS_LITERAL_STRING("click"), this, false, false); - mContent->AddEventListener(NS_LITERAL_STRING("dblclick"), this, false, + aContent->AddEventListener(NS_LITERAL_STRING("dblclick"), this, false, false); - mContent->AddEventListener(NS_LITERAL_STRING("mouseover"), this, false, + aContent->AddEventListener(NS_LITERAL_STRING("mouseover"), this, false, false); - mContent->AddEventListener(NS_LITERAL_STRING("mouseout"), this, false, + aContent->AddEventListener(NS_LITERAL_STRING("mouseout"), this, false, false); - mContent->AddEventListener(NS_LITERAL_STRING("keypress"), this, true); - mContent->AddEventListener(NS_LITERAL_STRING("keydown"), this, true); - mContent->AddEventListener(NS_LITERAL_STRING("keyup"), this, true); - mContent->AddEventListener(NS_LITERAL_STRING("drop"), this, true); - mContent->AddEventListener(NS_LITERAL_STRING("dragdrop"), this, true); - mContent->AddEventListener(NS_LITERAL_STRING("drag"), this, true); - mContent->AddEventListener(NS_LITERAL_STRING("dragenter"), this, true); - mContent->AddEventListener(NS_LITERAL_STRING("dragover"), this, true); - mContent->AddEventListener(NS_LITERAL_STRING("dragleave"), this, true); - mContent->AddEventListener(NS_LITERAL_STRING("dragexit"), this, true); - mContent->AddEventListener(NS_LITERAL_STRING("dragstart"), this, true); - mContent->AddEventListener(NS_LITERAL_STRING("draggesture"), this, true); - mContent->AddEventListener(NS_LITERAL_STRING("dragend"), this, true); + aContent->AddEventListener(NS_LITERAL_STRING("keypress"), this, true); + aContent->AddEventListener(NS_LITERAL_STRING("keydown"), this, true); + aContent->AddEventListener(NS_LITERAL_STRING("keyup"), this, true); + aContent->AddEventListener(NS_LITERAL_STRING("drop"), this, true); + aContent->AddEventListener(NS_LITERAL_STRING("dragdrop"), this, true); + aContent->AddEventListener(NS_LITERAL_STRING("drag"), this, true); + aContent->AddEventListener(NS_LITERAL_STRING("dragenter"), this, true); + aContent->AddEventListener(NS_LITERAL_STRING("dragover"), this, true); + aContent->AddEventListener(NS_LITERAL_STRING("dragleave"), this, true); + aContent->AddEventListener(NS_LITERAL_STRING("dragexit"), this, true); + aContent->AddEventListener(NS_LITERAL_STRING("dragstart"), this, true); + aContent->AddEventListener(NS_LITERAL_STRING("draggesture"), this, true); + aContent->AddEventListener(NS_LITERAL_STRING("dragend"), this, true); return NS_OK; } @@ -2778,10 +2791,11 @@ NS_IMETHODIMP nsPluginInstanceOwner::CreateWidget(void) if (!windowless && !nsIWidget::UsePuppetWidgets()) { // Try to get a parent widget, on some platforms widget creation will fail without // a parent. + nsCOMPtr content = do_QueryReferent(mContent); nsCOMPtr parentWidget; nsIDocument *doc = nullptr; - if (mContent) { - doc = mContent->OwnerDoc(); + if (content) { + doc = content->OwnerDoc(); parentWidget = nsContentUtils::WidgetForDocument(doc); } @@ -3090,7 +3104,8 @@ nsPluginInstanceOwner::GetContentsScaleFactor(double *result) // for plugins. On other platforms, plugin coordinates are always in device // pixels. #if defined(XP_MACOSX) - nsIPresShell* presShell = nsContentUtils::FindPresShellForDocument(mContent->OwnerDoc()); + nsCOMPtr content = do_QueryReferent(mContent); + nsIPresShell* presShell = nsContentUtils::FindPresShellForDocument(content->OwnerDoc()); if (presShell) { scaleFactor = double(nsPresContext::AppUnitsPerCSSPixel())/ presShell->GetPresContext()->DeviceContext()->UnscaledAppUnitsPerDevPixel(); @@ -3160,10 +3175,11 @@ NS_IMETHODIMP nsPluginInstanceOwner::PrivateModeChanged(bool aEnabled) already_AddRefed nsPluginInstanceOwner::GetBaseURI() const { - if (!mContent) { + nsCOMPtr content = do_QueryReferent(mContent); + if (!content) { return nullptr; } - return mContent->GetBaseURI(); + return content->GetBaseURI(); } // nsPluginDOMContextMenuListener class implementation diff --git a/dom/plugins/base/nsPluginInstanceOwner.h b/dom/plugins/base/nsPluginInstanceOwner.h index d704e8783e..c2a0fc2788 100644 --- a/dom/plugins/base/nsPluginInstanceOwner.h +++ b/dom/plugins/base/nsPluginInstanceOwner.h @@ -314,7 +314,7 @@ class nsPluginInstanceOwner : public nsIPluginInstanceOwner, nsPluginNativeWindow *mPluginWindow; nsRefPtr mInstance; nsObjectFrame *mObjectFrame; - nsIContent *mContent; // WEAK, content owns us + nsWeakPtr mContent; // WEAK, content owns us nsCString mDocumentBase; bool mWidgetCreationComplete; nsCOMPtr mWidget; diff --git a/dom/plugins/ipc/PluginInterposeOSX.mm b/dom/plugins/ipc/PluginInterposeOSX.mm index f43192bbd6..cfd8e5730c 100644 --- a/dom/plugins/ipc/PluginInterposeOSX.mm +++ b/dom/plugins/ipc/PluginInterposeOSX.mm @@ -38,8 +38,7 @@ #import #import -using mozilla::plugins::PluginModuleChild; -using mozilla::plugins::AssertPluginThread; +using namespace mozilla::plugins; namespace mac_plugin_interposing { @@ -544,7 +543,7 @@ bool NSCursorInfo::GetNativeCursorsSupported() { if (mNativeCursorsSupported == -1) { - AssertPluginThread(); + ENSURE_PLUGIN_THREAD(false); PluginModuleChild *pmc = PluginModuleChild::current(); if (pmc) { bool result = pmc->GetNativeCursorsSupported(); @@ -689,7 +688,7 @@ void FocusPluginProcess() { void NotifyBrowserOfPluginShowWindow(uint32_t window_id, CGRect bounds, bool modal) { - AssertPluginThread(); + ENSURE_PLUGIN_THREAD_VOID(); PluginModuleChild *pmc = PluginModuleChild::current(); if (pmc) @@ -697,7 +696,7 @@ void NotifyBrowserOfPluginShowWindow(uint32_t window_id, CGRect bounds, } void NotifyBrowserOfPluginHideWindow(uint32_t window_id, CGRect bounds) { - AssertPluginThread(); + ENSURE_PLUGIN_THREAD_VOID(); PluginModuleChild *pmc = PluginModuleChild::current(); if (pmc) @@ -706,7 +705,7 @@ void NotifyBrowserOfPluginHideWindow(uint32_t window_id, CGRect bounds) { void NotifyBrowserOfSetCursor(NSCursorInfo& aCursorInfo) { - AssertPluginThread(); + ENSURE_PLUGIN_THREAD_VOID(); PluginModuleChild *pmc = PluginModuleChild::current(); if (pmc) { pmc->SetCursor(aCursorInfo); @@ -715,7 +714,7 @@ void NotifyBrowserOfSetCursor(NSCursorInfo& aCursorInfo) void NotifyBrowserOfShowCursor(bool show) { - AssertPluginThread(); + ENSURE_PLUGIN_THREAD_VOID(); PluginModuleChild *pmc = PluginModuleChild::current(); if (pmc) { pmc->ShowCursor(show); @@ -724,7 +723,7 @@ void NotifyBrowserOfShowCursor(bool show) void NotifyBrowserOfPushCursor(NSCursorInfo& aCursorInfo) { - AssertPluginThread(); + ENSURE_PLUGIN_THREAD_VOID(); PluginModuleChild *pmc = PluginModuleChild::current(); if (pmc) { pmc->PushCursor(aCursorInfo); @@ -733,7 +732,7 @@ void NotifyBrowserOfPushCursor(NSCursorInfo& aCursorInfo) void NotifyBrowserOfPopCursor() { - AssertPluginThread(); + ENSURE_PLUGIN_THREAD_VOID(); PluginModuleChild *pmc = PluginModuleChild::current(); if (pmc) { pmc->PopCursor(); diff --git a/dom/workers/ScriptLoader.cpp b/dom/workers/ScriptLoader.cpp index 0dfe625b55..3335c3ed49 100644 --- a/dom/workers/ScriptLoader.cpp +++ b/dom/workers/ScriptLoader.cpp @@ -509,22 +509,6 @@ class ScriptLoaderRunnable MOZ_FINAL : public WorkerFeature, rv = ssm->GetChannelPrincipal(channel, getter_AddRefs(channelPrincipal)); NS_ENSURE_SUCCESS(rv, rv); - // See if this is a resource URI. Since JSMs usually come from resource:// - // URIs we're currently considering all URIs with the URI_IS_UI_RESOURCE - // flag as valid for creating privileged workers. - if (!nsContentUtils::IsSystemPrincipal(channelPrincipal)) { - bool isResource; - rv = NS_URIChainHasFlags(finalURI, - nsIProtocolHandler::URI_IS_UI_RESOURCE, - &isResource); - NS_ENSURE_SUCCESS(rv, rv); - - if (isResource) { - rv = ssm->GetSystemPrincipal(getter_AddRefs(channelPrincipal)); - NS_ENSURE_SUCCESS(rv, rv); - } - } - // If the load principal is the system principal then the channel // principal must also be the system principal (we do not allow chrome // code to create workers with non-chrome scripts). Otherwise this channel @@ -532,14 +516,25 @@ class ScriptLoaderRunnable MOZ_FINAL : public WorkerFeature, // here in case redirects changed the location of the script). if (nsContentUtils::IsSystemPrincipal(loadPrincipal)) { if (!nsContentUtils::IsSystemPrincipal(channelPrincipal)) { - return NS_ERROR_DOM_BAD_URI; + // See if this is a resource URI. Since JSMs usually come from + // resource:// URIs we're currently considering all URIs with the + // URI_IS_UI_RESOURCE flag as valid for creating privileged workers. + bool isResource; + rv = NS_URIChainHasFlags(finalURI, + nsIProtocolHandler::URI_IS_UI_RESOURCE, + &isResource); + NS_ENSURE_SUCCESS(rv, rv); + + if (isResource) { + // Assign the system principal to the resource:// worker only if it + // was loaded from code using the system principal. + channelPrincipal = loadPrincipal; + } else { + return NS_ERROR_DOM_BAD_URI; + } } } else { - nsCString scheme; - rv = finalURI->GetScheme(scheme); - NS_ENSURE_SUCCESS(rv, rv); - // We exempt data urls and other URI's that inherit their // principal again. if (NS_FAILED(loadPrincipal->CheckMayLoad(finalURI, false, true))) { diff --git a/dom/workers/XMLHttpRequest.cpp b/dom/workers/XMLHttpRequest.cpp index 748fd3938d..d425eacbbc 100644 --- a/dom/workers/XMLHttpRequest.cpp +++ b/dom/workers/XMLHttpRequest.cpp @@ -113,6 +113,7 @@ class Proxy MOZ_FINAL : public nsIDOMEventListener bool mLastUploadLengthComputable; bool mSeenLoadStart; bool mSeenUploadLoadStart; + bool mOpening; // Only touched on the main thread. bool mUploadEventListenersAttached; @@ -127,7 +128,7 @@ class Proxy MOZ_FINAL : public nsIDOMEventListener mOuterEventStreamId(0), mOuterChannelId(0), mLastLoaded(0), mLastTotal(0), mLastUploadLoaded(0), mLastUploadTotal(0), mIsSyncXHR(false), mLastLengthComputable(false), mLastUploadLengthComputable(false), - mSeenLoadStart(false), mSeenUploadLoadStart(false), + mSeenLoadStart(false), mSeenUploadLoadStart(false), mOpening(false), mUploadEventListenersAttached(false), mMainThreadSeenLoadStart(false), mInOpen(false) { } @@ -139,7 +140,7 @@ class Proxy MOZ_FINAL : public nsIDOMEventListener Init(); void - Teardown(); + Teardown(bool aSendUnpin); bool AddRemoveEventListeners(bool aUpload, bool aAdd); @@ -307,7 +308,9 @@ class AsyncTeardownRunnable MOZ_FINAL : public nsRunnable { AssertIsOnMainThread(); - mProxy->Teardown(); + // This means the XHR was GC'd, so we can't be pinned, and we don't need to + // try to unpin. + mProxy->Teardown(/* aSendUnpin */ false); mProxy = nullptr; return NS_OK; @@ -562,7 +565,7 @@ class SyncTeardownRunnable MOZ_FINAL : public WorkerThreadProxySyncRunnable virtual nsresult MainThreadRun() MOZ_OVERRIDE { - mProxy->Teardown(); + mProxy->Teardown(/* aSendUnpin */ true); MOZ_ASSERT(!mProxy->mSyncLoopTarget); return NS_OK; } @@ -934,7 +937,7 @@ Proxy::Init() } void -Proxy::Teardown() +Proxy::Teardown(bool aSendUnpin) { AssertIsOnMainThread(); @@ -947,10 +950,12 @@ Proxy::Teardown() mXHR->Abort(); if (mOutstandingSendCount) { - nsRefPtr runnable = - new XHRUnpinRunnable(mWorkerPrivate, mXMLHttpRequestPrivate); - if (!runnable->Dispatch(nullptr)) { - NS_RUNTIMEABORT("We're going to hang at shutdown anyways."); + if (aSendUnpin) { + nsRefPtr runnable = + new XHRUnpinRunnable(mWorkerPrivate, mXMLHttpRequestPrivate); + if (!runnable->Dispatch(nullptr)) { + NS_RUNTIMEABORT("We're going to hang at shutdown anyways."); + } } if (mSyncLoopTarget) { @@ -1498,7 +1503,11 @@ SendRunnable::MainThreadRun() variant = wvariant; } - MOZ_ASSERT(!mProxy->mWorkerPrivate); + // Send() has been already called. + if (mProxy->mWorkerPrivate) { + return NS_ERROR_FAILURE; + } + mProxy->mWorkerPrivate = mWorkerPrivate; MOZ_ASSERT(!mProxy->mSyncLoopTarget); @@ -1789,6 +1798,12 @@ XMLHttpRequest::SendInternal(const nsAString& aStringBody, { mWorkerPrivate->AssertIsOnWorkerThread(); + // No send() calls when open is running. + if (mProxy->mOpening) { + aRv.Throw(NS_ERROR_FAILURE); + return; + } + bool hasUploadListeners = mUpload ? mUpload->HasListeners() : false; MaybePin(aRv); @@ -1814,6 +1829,11 @@ XMLHttpRequest::SendInternal(const nsAString& aStringBody, new SendRunnable(mWorkerPrivate, mProxy, aStringBody, Move(aBody), aClonedObjects, syncLoopTarget, hasUploadListeners); if (!runnable->Dispatch(cx)) { + // Dispatch() may have spun the event loop and we may have already unrooted. + // If so we don't want autoUnpin to try again. + if (!mRooted) { + autoUnpin.Clear(); + } aRv.Throw(NS_ERROR_FAILURE); return; } @@ -1874,12 +1894,15 @@ XMLHttpRequest::Open(const nsACString& aMethod, const nsAString& aUrl, mBackgroundRequest, mWithCredentials, mTimeout); + mProxy->mOpening = true; if (!runnable->Dispatch(mWorkerPrivate->GetJSContext())) { + mProxy->mOpening = false; ReleaseProxy(); aRv.Throw(NS_ERROR_FAILURE); return; } + mProxy->mOpening = false; mProxy->mIsSyncXHR = !aAsync; } diff --git a/gfx/2d/SourceSurfaceD2D1.cpp b/gfx/2d/SourceSurfaceD2D1.cpp index fc64327a8c..d7afa06e65 100644 --- a/gfx/2d/SourceSurfaceD2D1.cpp +++ b/gfx/2d/SourceSurfaceD2D1.cpp @@ -5,6 +5,7 @@ #include "SourceSurfaceD2D1.h" #include "DrawTargetD2D1.h" +#include "Logging.h" #include "Tools.h" namespace mozilla { @@ -156,7 +157,10 @@ DataSourceSurfaceD2D1::Map(MapType aMapType, MappedSurface *aMappedSurface) } D2D1_MAPPED_RECT map; - mBitmap->Map(D2D1_MAP_OPTIONS_READ, &map); + if (FAILED(mBitmap->Map(D2D1_MAP_OPTIONS_READ, &map))) { + gfxWarning() << "Failed to map bitmap."; + return false; + } aMappedSurface->mData = map.bits; aMappedSurface->mStride = map.pitch; @@ -189,7 +193,10 @@ DataSourceSurfaceD2D1::EnsureMapped() if (mMapped) { return; } - mBitmap->Map(D2D1_MAP_OPTIONS_READ, &mMap); + if (FAILED(mBitmap->Map(D2D1_MAP_OPTIONS_READ, &mMap))) { + gfxWarning() << "Failed to map bitmap."; + return; + } mMapped = true; } diff --git a/gfx/gl/GLScreenBuffer.cpp b/gfx/gl/GLScreenBuffer.cpp index 432bdbccc9..d31e848622 100755 --- a/gfx/gl/GLScreenBuffer.cpp +++ b/gfx/gl/GLScreenBuffer.cpp @@ -483,7 +483,10 @@ GLScreenBuffer::Readback(SharedSurface_GL* src, DataSourceSurface* dest) { MOZ_ASSERT(src && dest); DataSourceSurface::MappedSurface ms; - dest->Map(DataSourceSurface::MapType::READ, &ms); + if (!dest->Map(DataSourceSurface::MapType::READ, &ms)) { + NS_ERROR("Failed to map surface for reading."); + return; + } nsRefPtr wrappedDest = new gfxImageSurface(ms.mData, ThebesIntSize(dest->GetSize()), diff --git a/gfx/gl/SharedSurfaceGL.cpp b/gfx/gl/SharedSurfaceGL.cpp index 1aab56f26a..1f80c2892b 100644 --- a/gfx/gl/SharedSurfaceGL.cpp +++ b/gfx/gl/SharedSurfaceGL.cpp @@ -326,7 +326,10 @@ SharedSurface_Basic::Fence() ScopedBindFramebuffer autoFB(mGL, mFB); DataSourceSurface::MappedSurface map; - mData->Map(DataSourceSurface::MapType::WRITE, &map); + if (!mData->Map(DataSourceSurface::MapType::WRITE, &map)) { + NS_ERROR("Failed to map surface for writing."); + return; + } nsRefPtr wrappedData = new gfxImageSurface(map.mData, ThebesIntSize(mData->GetSize()), diff --git a/gfx/layers/YCbCrImageDataSerializer.cpp b/gfx/layers/YCbCrImageDataSerializer.cpp index e16db18bae..6e7a9084e8 100644 --- a/gfx/layers/YCbCrImageDataSerializer.cpp +++ b/gfx/layers/YCbCrImageDataSerializer.cpp @@ -278,7 +278,9 @@ YCbCrImageDataDeserializer::ToDataSourceSurface() Factory::CreateDataSourceSurface(GetYSize(), gfx::SurfaceFormat::B8G8R8X8); DataSourceSurface::MappedSurface map; - result->Map(DataSourceSurface::MapType::WRITE, &map); + if (NS_WARN_IF(!result->Map(DataSourceSurface::MapType::WRITE, &map))) { + return nullptr; + } gfx::ConvertYCbCrToRGB32(GetYData(), GetCbData(), GetCrData(), map.mData, diff --git a/gfx/layers/opengl/CompositorOGL.cpp b/gfx/layers/opengl/CompositorOGL.cpp index 92432c3f9e..2e0b51e6e4 100644 --- a/gfx/layers/opengl/CompositorOGL.cpp +++ b/gfx/layers/opengl/CompositorOGL.cpp @@ -1346,7 +1346,11 @@ CompositorOGL::CopyToTarget(DrawTarget *aTarget, const gfx::Matrix& aTransform) Factory::CreateDataSourceSurface(rect.Size(), gfx::SurfaceFormat::B8G8R8A8); DataSourceSurface::MappedSurface map; - source->Map(DataSourceSurface::MapType::WRITE, &map); + if (!source->Map(DataSourceSurface::MapType::WRITE, &map)) { + NS_ERROR("Failed to map surface for writing!"); + return; + } + // XXX we should do this properly one day without using the gfxImageSurface nsRefPtr surf = new gfxImageSurface(map.mData, diff --git a/gfx/thebes/gfxPlatform.cpp b/gfx/thebes/gfxPlatform.cpp index c869e5380f..8a2122ceb2 100644 --- a/gfx/thebes/gfxPlatform.cpp +++ b/gfx/thebes/gfxPlatform.cpp @@ -662,8 +662,10 @@ CopySurface(gfxASurface* aSurface) } DataSourceSurface::MappedSurface map; - DebugOnly result = data->Map(DataSourceSurface::WRITE, &map); - MOZ_ASSERT(result, "Should always succeed mapping raw data surfaces!"); + if (!data->Map(DataSourceSurface::WRITE, &map)) { + NS_ERROR("Failed to map surface for reading!"); + return nullptr; + } nsRefPtr image = new gfxImageSurface(map.mData, size, map.mStride, format); nsRefPtr ctx = new gfxContext(image); diff --git a/ipc/chromium/moz.build b/ipc/chromium/moz.build index 5622144430..8ffcc5bc17 100644 --- a/ipc/chromium/moz.build +++ b/ipc/chromium/moz.build @@ -76,6 +76,7 @@ UNIFIED_SOURCES += [ 'src/chrome/common/chrome_switches.cc', 'src/chrome/common/debug_flags.cc', 'src/chrome/common/env_vars.cc', + 'src/chrome/common/ipc_channel.cc', 'src/chrome/common/ipc_channel_proxy.cc', 'src/chrome/common/ipc_logging.cc', 'src/chrome/common/ipc_message.cc', diff --git a/ipc/chromium/src/base/atomic_sequence_num.h b/ipc/chromium/src/base/atomic_sequence_num.h index 6bd51c6b42..7bf2778991 100644 --- a/ipc/chromium/src/base/atomic_sequence_num.h +++ b/ipc/chromium/src/base/atomic_sequence_num.h @@ -1,4 +1,4 @@ -// Copyright (c) 2006-2008 The Chromium Authors. All rights reserved. +// Copyright (c) 2012 The Chromium Authors. All rights reserved. // Use of this source code is governed by a BSD-style license that can be // found in the LICENSE file. @@ -10,18 +10,48 @@ namespace base { -class AtomicSequenceNumber { - public: - AtomicSequenceNumber() : seq_(0) { } - explicit AtomicSequenceNumber(base::LinkerInitialized x) { /* seq_ is 0 */ } +class AtomicSequenceNumber; - int GetNext() { +// Static (POD) AtomicSequenceNumber that MUST be used in global scope (or +// non-function scope) ONLY. This implementation does not generate any static +// initializer. Note that it does not implement any constructor which means +// that its fields are not initialized except when it is stored in the global +// data section (.data in ELF). If you want to allocate an atomic sequence +// number on the stack (or heap), please use the AtomicSequenceNumber class +// declared below. +class StaticAtomicSequenceNumber { + public: + inline int GetNext() { return static_cast( base::subtle::NoBarrier_AtomicIncrement(&seq_, 1) - 1); } private: + friend class AtomicSequenceNumber; + + inline void Reset() { + base::subtle::Release_Store(&seq_, 0); + } + base::subtle::Atomic32 seq_; +}; + +// AtomicSequenceNumber that can be stored and used safely (i.e. its fields are +// always initialized as opposed to StaticAtomicSequenceNumber declared above). +// Please use StaticAtomicSequenceNumber if you want to declare an atomic +// sequence number in the global scope. +class AtomicSequenceNumber { + public: + AtomicSequenceNumber() { + seq_.Reset(); + } + + inline int GetNext() { + return seq_.GetNext(); + } + + private: + StaticAtomicSequenceNumber seq_; DISALLOW_COPY_AND_ASSIGN(AtomicSequenceNumber); }; diff --git a/ipc/chromium/src/chrome/common/child_process_host.cc b/ipc/chromium/src/chrome/common/child_process_host.cc index 3d590e5a2f..dbf7134e78 100644 --- a/ipc/chromium/src/chrome/common/child_process_host.cc +++ b/ipc/chromium/src/chrome/common/child_process_host.cc @@ -75,7 +75,7 @@ ChildProcessHost::~ChildProcessHost() { } bool ChildProcessHost::CreateChannel() { - channel_id_ = GenerateRandomChannelID(this); + channel_id_ = IPC::Channel::GenerateVerifiedChannelID(std::wstring()); channel_.reset(new IPC::Channel( channel_id_, IPC::Channel::MODE_SERVER, &listener_)); if (!channel_->Connect()) diff --git a/ipc/chromium/src/chrome/common/child_process_info.cc b/ipc/chromium/src/chrome/common/child_process_info.cc index 2f2c1238af..941c375166 100644 --- a/ipc/chromium/src/chrome/common/child_process_info.cc +++ b/ipc/chromium/src/chrome/common/child_process_info.cc @@ -7,9 +7,6 @@ #include #include "base/logging.h" -#include "base/process_util.h" -#include "base/rand_util.h" -#include "base/string_util.h" std::wstring ChildProcessInfo::GetTypeNameInEnglish( ChildProcessInfo::ProcessType type) { @@ -44,16 +41,4 @@ ChildProcessInfo::ChildProcessInfo(ProcessType type) { ChildProcessInfo::~ChildProcessInfo() { -} - -std::wstring ChildProcessInfo::GenerateRandomChannelID(void* instance) { - // Note: the string must start with the current process id, this is how - // child processes determine the pid of the parent. - // Build the channel ID. This is composed of a unique identifier for the - // parent browser process, an identifier for the child instance, and a random - // component. We use a random component so that a hacked child process can't - // cause denial of service by causing future named pipe creation to fail. - return StringPrintf(L"%d.%x.%d", - base::GetCurrentProcId(), instance, - base::RandInt(0, std::numeric_limits::max())); -} +} \ No newline at end of file diff --git a/ipc/chromium/src/chrome/common/child_process_info.h b/ipc/chromium/src/chrome/common/child_process_info.h index 1c4b07257b..5b3132b6fe 100644 --- a/ipc/chromium/src/chrome/common/child_process_info.h +++ b/ipc/chromium/src/chrome/common/child_process_info.h @@ -78,10 +78,6 @@ class ChildProcessInfo { return process_.handle() == rhs.process_.handle(); } - // Generates a unique channel name for a child renderer/plugin process. - // The "instance" pointer value is baked into the channel id. - static std::wstring GenerateRandomChannelID(void* instance); - protected: void set_type(ProcessType type) { type_ = type; } void set_name(const std::wstring& name) { name_ = name; } diff --git a/ipc/chromium/src/chrome/common/ipc_channel.cc b/ipc/chromium/src/chrome/common/ipc_channel.cc new file mode 100644 index 0000000000..b13293c7c1 --- /dev/null +++ b/ipc/chromium/src/chrome/common/ipc_channel.cc @@ -0,0 +1,39 @@ +// Copyright (c) 2012 The Chromium Authors. All rights reserved. +// Use of this source code is governed by a BSD-style license that can be +// found in the LICENSE file. + +#include "chrome/common/ipc_channel.h" + +#include + +#include "base/atomic_sequence_num.h" +#include "base/process_util.h" +#include "base/rand_util.h" +#include "base/string_util.h" + +namespace { + +// Global atomic used to guarantee channel IDs are unique. +base::StaticAtomicSequenceNumber g_last_id; + +} // namespace + +namespace IPC { + +// static +std::wstring Channel::GenerateUniqueRandomChannelID() { + // Note: the string must start with the current process id, this is how + // some child processes determine the pid of the parent. + // + // This is composed of a unique incremental identifier, the process ID of + // the creator, an identifier for the child instance, and a strong random + // component. The strong random component prevents other processes from + // hijacking or squatting on predictable channel names. + + return StringPrintf(L"%d.%u.%d", + base::GetCurrentProcId(), + g_last_id.GetNext(), + base::RandInt(0, std::numeric_limits::max())); +} + +} // namespace IPC \ No newline at end of file diff --git a/ipc/chromium/src/chrome/common/ipc_channel.h b/ipc/chromium/src/chrome/common/ipc_channel.h index 2411cb8a8b..c981cd57d4 100644 --- a/ipc/chromium/src/chrome/common/ipc_channel.h +++ b/ipc/chromium/src/chrome/common/ipc_channel.h @@ -5,6 +5,8 @@ #ifndef CHROME_COMMON_IPC_CHANNEL_H_ #define CHROME_COMMON_IPC_CHANNEL_H_ +#include + #include #include "chrome/common/ipc_message.h" @@ -131,6 +133,15 @@ class Channel : public Message::Sender { void* GetServerPipeHandle() const; #endif // defined(OS_POSIX) + // Generates a channel ID that's non-predictable and unique. + static std::wstring GenerateUniqueRandomChannelID(); + + // Generates a channel ID that, if passed to the client as a shared secret, + // will validate that the client's authenticity. On platforms that do not + // require additional validation this is simply calls GenerateUniqueRandomChannelID(). + // For portability the prefix should not include the \ character. + static std::wstring GenerateVerifiedChannelID(const std::wstring& prefix); + private: // PIMPL to which all channel calls are delegated. class ChannelImpl; diff --git a/ipc/chromium/src/chrome/common/ipc_channel_posix.cc b/ipc/chromium/src/chrome/common/ipc_channel_posix.cc index d060465973..156e5c5f9e 100644 --- a/ipc/chromium/src/chrome/common/ipc_channel_posix.cc +++ b/ipc/chromium/src/chrome/common/ipc_channel_posix.cc @@ -1017,4 +1017,16 @@ uint32_t Channel::Unsound_NumQueuedMessages() const { return channel_impl_->Unsound_NumQueuedMessages(); } +// static +std::wstring Channel::GenerateVerifiedChannelID(const std::wstring& prefix) { + // A random name is sufficient validation on posix systems, so we don't need + // an additional shared secret. + + std::wstring id = prefix; + if (!id.empty()) + id.append(L"."); + + return id.append(GenerateUniqueRandomChannelID()); +} + } // namespace IPC diff --git a/ipc/chromium/src/chrome/common/ipc_channel_win.cc b/ipc/chromium/src/chrome/common/ipc_channel_win.cc index b25c89f75e..bd7ae15d22 100644 --- a/ipc/chromium/src/chrome/common/ipc_channel_win.cc +++ b/ipc/chromium/src/chrome/common/ipc_channel_win.cc @@ -9,6 +9,9 @@ #include "base/compiler_specific.h" #include "base/logging.h" +#include "base/process_util.h" +#include "base/rand_util.h" +#include "base/string_util.h" #include "base/non_thread_safe.h" #include "base/stats_counters.h" #include "base/win_util.h" @@ -35,7 +38,9 @@ Channel::ChannelImpl::ChannelImpl(const std::wstring& channel_id, Mode mode, Listener* listener) : ALLOW_THIS_IN_INITIALIZER_LIST(input_state_(this)), ALLOW_THIS_IN_INITIALIZER_LIST(output_state_(this)), - ALLOW_THIS_IN_INITIALIZER_LIST(factory_(this)) { + ALLOW_THIS_IN_INITIALIZER_LIST(factory_(this)), + shared_secret_(0), + waiting_for_shared_secret_(false) { Init(mode, listener); if (!CreatePipe(channel_id, mode)) { @@ -50,7 +55,9 @@ Channel::ChannelImpl::ChannelImpl(const std::wstring& channel_id, Mode mode, Listener* listener) : ALLOW_THIS_IN_INITIALIZER_LIST(input_state_(this)), ALLOW_THIS_IN_INITIALIZER_LIST(output_state_(this)), - ALLOW_THIS_IN_INITIALIZER_LIST(factory_(this)) { + ALLOW_THIS_IN_INITIALIZER_LIST(factory_(this)), + shared_secret_(0), + waiting_for_shared_secret_(false) { Init(mode, listener); if (mode == MODE_SERVER) { @@ -158,18 +165,31 @@ bool Channel::ChannelImpl::Send(Message* message) { } const std::wstring Channel::ChannelImpl::PipeName( - const std::wstring& channel_id) const { + const std::wstring& channel_id, int32_t* secret) const { + MOZ_ASSERT(secret); + std::wostringstream ss; - // XXX(darin): get application name from somewhere else - ss << L"\\\\.\\pipe\\chrome." << channel_id; + ss << L"\\\\.\\pipe\\chrome."; + + // Prevent the shared secret from ending up in the pipe name. + size_t index = channel_id.find_first_of(L'\\'); + if (index != std::string::npos) { + StringToInt(channel_id.substr(index + 1), secret); + ss << channel_id.substr(0, index - 1); + } else { + // This case is here to support predictable named pipes in tests. + *secret = 0; + ss << channel_id; + } return ss.str(); } bool Channel::ChannelImpl::CreatePipe(const std::wstring& channel_id, Mode mode) { DCHECK(pipe_ == INVALID_HANDLE_VALUE); - const std::wstring pipe_name = PipeName(channel_id); + const std::wstring pipe_name = PipeName(channel_id, &shared_secret_); if (mode == MODE_SERVER) { + waiting_for_shared_secret_ = !!shared_secret_; pipe_ = CreateNamedPipeW(pipe_name.c_str(), PIPE_ACCESS_DUPLEX | FILE_FLAG_OVERLAPPED | FILE_FLAG_FIRST_PIPE_INSTANCE, @@ -205,7 +225,15 @@ bool Channel::ChannelImpl::EnqueueHelloMessage() { scoped_ptr m(new Message(MSG_ROUTING_NONE, HELLO_MESSAGE_TYPE, IPC::Message::PRIORITY_NORMAL)); - if (!m->WriteInt(GetCurrentProcessId())) { + + // If we're waiting for our shared secret from the other end's hello message + // then don't give the game away by sending it in ours. + int32_t secret = waiting_for_shared_secret_ ? 0 : shared_secret_; + + // Also, don't send if the value is zero (for IPC backwards compatability). + if (!m->WriteInt(GetCurrentProcessId()) || + (secret && !m->WriteUInt32(secret))) + { CloseHandle(pipe_); pipe_ = INVALID_HANDLE_VALUE; return false; @@ -343,8 +371,19 @@ bool Channel::ChannelImpl::ProcessIncomingMessages( #endif if (m.routing_id() == MSG_ROUTING_NONE && m.type() == HELLO_MESSAGE_TYPE) { - // The Hello message contains only the process id. - listener_->OnChannelConnected(MessageIterator(m).NextInt()); + // The Hello message contains the process id and must include the + // shared secret, if we are waiting for it. + MessageIterator it = MessageIterator(m); + int32_t claimed_pid = it.NextInt(); + if (waiting_for_shared_secret_ && (it.NextInt() != shared_secret_)) { + NOTREACHED(); + // Something went wrong. Abort connection. + Close(); + listener_->OnChannelError(); + return false; + } + waiting_for_shared_secret_ = false; + listener_->OnChannelConnected(claimed_pid); } else { listener_->OnMessageReceived(m); } @@ -507,4 +546,21 @@ uint32_t Channel::Unsound_NumQueuedMessages() const { return channel_impl_->Unsound_NumQueuedMessages(); } +// static +std::wstring Channel::GenerateVerifiedChannelID(const std::wstring& prefix) { + // Windows pipes can be enumerated by low-privileged processes. So, we + // append a strong random value after the \ character. This value is not + // included in the pipe name, but sent as part of the client hello, to + // prevent hijacking the pipe name to spoof the client. + std::wstring id = prefix; + if (!id.empty()) + id.append(L"."); + int secret; + do { // Guarantee we get a non-zero value. + secret = base::RandInt(0, std::numeric_limits::max()); + } while (secret == 0); + id.append(GenerateUniqueRandomChannelID()); + return id.append(StringPrintf(L"\\%d", secret)); +} + } // namespace IPC diff --git a/ipc/chromium/src/chrome/common/ipc_channel_win.h b/ipc/chromium/src/chrome/common/ipc_channel_win.h index 2511ff0d42..fd03f815d5 100644 --- a/ipc/chromium/src/chrome/common/ipc_channel_win.h +++ b/ipc/chromium/src/chrome/common/ipc_channel_win.h @@ -48,7 +48,8 @@ class Channel::ChannelImpl : public MessageLoopForIO::IOHandler { void OutputQueuePush(Message* msg); void OutputQueuePop(); - const std::wstring PipeName(const std::wstring& channel_id) const; + const std::wstring PipeName(const std::wstring& channel_id, + int32_t* secret) const; bool CreatePipe(const std::wstring& channel_id, Mode mode); bool EnqueueHelloMessage(); @@ -107,6 +108,16 @@ class Channel::ChannelImpl : public MessageLoopForIO::IOHandler { ScopedRunnableMethodFactory factory_; + // This is a unique per-channel value used to authenticate the client end of + // a connection. If the value is non-zero, the client passes it in the hello + // and the host validates. (We don't send the zero value to preserve IPC + // compatibility with existing clients that don't validate the channel.) + int32_t shared_secret_; + + // In server-mode, we wait for the channel at the other side of the pipe to + // send us back our shared secret, if we are using one. + bool waiting_for_shared_secret_; + scoped_ptr thread_check_; DISALLOW_COPY_AND_ASSIGN(ChannelImpl); diff --git a/ipc/glue/Transport_posix.cpp b/ipc/glue/Transport_posix.cpp index 6f41c2057a..e8d9f5f68c 100644 --- a/ipc/glue/Transport_posix.cpp +++ b/ipc/glue/Transport_posix.cpp @@ -24,10 +24,7 @@ bool CreateTransport(ProcessHandle /*unused*/, ProcessHandle /*unused*/, TransportDescriptor* aOne, TransportDescriptor* aTwo) { - // Gecko doesn't care about this random ID, and the argument to this - // function isn't really necessary, it can be just any random - // pointer value - wstring id = ChildProcessInfo::GenerateRandomChannelID(aOne); + wstring id = IPC::Channel::GenerateVerifiedChannelID(std::wstring()); // Use MODE_SERVER to force creation of the socketpair Transport t(id, Transport::MODE_SERVER, nullptr); int fd1 = t.GetFileDescriptor(); diff --git a/ipc/glue/Transport_win.cpp b/ipc/glue/Transport_win.cpp index 629d15dfb0..755f87e1b4 100644 --- a/ipc/glue/Transport_win.cpp +++ b/ipc/glue/Transport_win.cpp @@ -20,9 +20,7 @@ bool CreateTransport(ProcessHandle aProcOne, ProcessHandle /*unused*/, TransportDescriptor* aOne, TransportDescriptor* aTwo) { - // This id is used to name the IPC pipe. The pointer passed to this - // function isn't significant. - wstring id = ChildProcessInfo::GenerateRandomChannelID(aOne); + wstring id = IPC::Channel::GenerateVerifiedChannelID(std::wstring()); // Use MODE_SERVER to force creation of the pipe Transport t(id, Transport::MODE_SERVER, nullptr); HANDLE serverPipe = t.GetServerPipeHandle(); diff --git a/js/ipc/JavaScriptChild.cpp b/js/ipc/JavaScriptChild.cpp index 6e65fed545..d44ecb9756 100644 --- a/js/ipc/JavaScriptChild.cpp +++ b/js/ipc/JavaScriptChild.cpp @@ -19,16 +19,16 @@ using namespace mozilla::jsipc; using mozilla::AutoSafeJSContext; -JavaScriptChild::JavaScriptChild(JSRuntime *rt) +JavaScriptChild::JavaScriptChild(JSRuntime* rt) : lastId_(0), rt_(rt) { } static void -Trace(JSTracer *trc, void *data) +Trace(JSTracer* trc, void* data) { - reinterpret_cast(data)->trace(trc); + reinterpret_cast(data)->trace(trc); } JavaScriptChild::~JavaScriptChild() @@ -37,7 +37,7 @@ JavaScriptChild::~JavaScriptChild() } void -JavaScriptChild::trace(JSTracer *trc) +JavaScriptChild::trace(JSTracer* trc) { objects_.trace(trc); ids_.trace(trc); @@ -56,9 +56,9 @@ JavaScriptChild::init() } bool -JavaScriptChild::RecvDropObject(const ObjectId &objId) +JavaScriptChild::RecvDropObject(const ObjectId& objId) { - JSObject *obj = findObject(objId); + JSObject* obj = findObject(objId); if (obj) { ids_.remove(obj); objects_.remove(objId); @@ -67,7 +67,7 @@ JavaScriptChild::RecvDropObject(const ObjectId &objId) } bool -JavaScriptChild::makeId(JSContext *cx, JSObject *obj, ObjectId *idp) +JavaScriptChild::makeId(JSContext* cx, JSObject* obj, ObjectId* idp) { if (!obj) { *idp = 0; @@ -99,16 +99,16 @@ JavaScriptChild::makeId(JSContext *cx, JSObject *obj, ObjectId *idp) return true; } -JSObject * -JavaScriptChild::unwrap(JSContext *cx, ObjectId id) +JSObject* +JavaScriptChild::unwrap(JSContext* cx, ObjectId id) { - JSObject *obj = findObject(id); + JSObject* obj = findObject(id); MOZ_ASSERT(obj); return obj; } bool -JavaScriptChild::fail(JSContext *cx, ReturnStatus *rs) +JavaScriptChild::fail(JSContext* cx, ReturnStatus* rs) { // By default, we set |undefined| unless we can get a more meaningful // exception. @@ -139,14 +139,14 @@ JavaScriptChild::fail(JSContext *cx, ReturnStatus *rs) } bool -JavaScriptChild::ok(ReturnStatus *rs) +JavaScriptChild::ok(ReturnStatus* rs) { *rs = ReturnStatus(ReturnSuccess()); return true; } bool -JavaScriptChild::AnswerPreventExtensions(const ObjectId &objId, ReturnStatus *rs) +JavaScriptChild::AnswerPreventExtensions(const ObjectId& objId, ReturnStatus* rs) { AutoSafeJSContext cx; JSAutoRequest request(cx); @@ -163,7 +163,7 @@ JavaScriptChild::AnswerPreventExtensions(const ObjectId &objId, ReturnStatus *rs } static void -EmptyDesc(PPropertyDescriptor *desc) +EmptyDesc(PPropertyDescriptor* desc) { desc->objId() = 0; desc->attrs() = 0; @@ -173,8 +173,8 @@ EmptyDesc(PPropertyDescriptor *desc) } bool -JavaScriptChild::AnswerGetPropertyDescriptor(const ObjectId &objId, const nsString &id, - ReturnStatus *rs, PPropertyDescriptor *out) +JavaScriptChild::AnswerGetPropertyDescriptor(const ObjectId& objId, const nsString& id, + ReturnStatus* rs, PPropertyDescriptor* out) { AutoSafeJSContext cx; JSAutoRequest request(cx); @@ -205,8 +205,8 @@ JavaScriptChild::AnswerGetPropertyDescriptor(const ObjectId &objId, const nsStri } bool -JavaScriptChild::AnswerGetOwnPropertyDescriptor(const ObjectId &objId, const nsString &id, - ReturnStatus *rs, PPropertyDescriptor *out) +JavaScriptChild::AnswerGetOwnPropertyDescriptor(const ObjectId& objId, const nsString& id, + ReturnStatus* rs, PPropertyDescriptor* out) { AutoSafeJSContext cx; JSAutoRequest request(cx); @@ -237,8 +237,8 @@ JavaScriptChild::AnswerGetOwnPropertyDescriptor(const ObjectId &objId, const nsS } bool -JavaScriptChild::AnswerDefineProperty(const ObjectId &objId, const nsString &id, - const PPropertyDescriptor &descriptor, ReturnStatus *rs) +JavaScriptChild::AnswerDefineProperty(const ObjectId& objId, const nsString& id, + const PPropertyDescriptor& descriptor, ReturnStatus* rs) { AutoSafeJSContext cx; JSAutoRequest request(cx); @@ -273,8 +273,8 @@ JavaScriptChild::AnswerDefineProperty(const ObjectId &objId, const nsString &id, } bool -JavaScriptChild::AnswerDelete(const ObjectId &objId, const nsString &id, ReturnStatus *rs, - bool *success) +JavaScriptChild::AnswerDelete(const ObjectId& objId, const nsString& id, ReturnStatus* rs, + bool* success) { AutoSafeJSContext cx; JSAutoRequest request(cx); @@ -298,7 +298,7 @@ JavaScriptChild::AnswerDelete(const ObjectId &objId, const nsString &id, ReturnS } bool -JavaScriptChild::AnswerHas(const ObjectId &objId, const nsString &id, ReturnStatus *rs, bool *bp) +JavaScriptChild::AnswerHas(const ObjectId& objId, const nsString& id, ReturnStatus* rs, bool* bp) { AutoSafeJSContext cx; JSAutoRequest request(cx); @@ -324,7 +324,7 @@ JavaScriptChild::AnswerHas(const ObjectId &objId, const nsString &id, ReturnStat } bool -JavaScriptChild::AnswerHasOwn(const ObjectId &objId, const nsString &id, ReturnStatus *rs, bool *bp) +JavaScriptChild::AnswerHasOwn(const ObjectId& objId, const nsString& id, ReturnStatus* rs, bool* bp) { AutoSafeJSContext cx; JSAutoRequest request(cx); @@ -350,8 +350,8 @@ JavaScriptChild::AnswerHasOwn(const ObjectId &objId, const nsString &id, ReturnS } bool -JavaScriptChild::AnswerGet(const ObjectId &objId, const ObjectId &receiverId, const nsString &id, - ReturnStatus *rs, JSVariant *result) +JavaScriptChild::AnswerGet(const ObjectId& objId, const ObjectId& receiverId, const nsString& id, + ReturnStatus* rs, JSVariant* result) { AutoSafeJSContext cx; JSAutoRequest request(cx); @@ -385,9 +385,9 @@ JavaScriptChild::AnswerGet(const ObjectId &objId, const ObjectId &receiverId, co } bool -JavaScriptChild::AnswerSet(const ObjectId &objId, const ObjectId &receiverId, const nsString &id, - const bool &strict, const JSVariant &value, ReturnStatus *rs, - JSVariant *result) +JavaScriptChild::AnswerSet(const ObjectId& objId, const ObjectId& receiverId, const nsString& id, + const bool& strict, const JSVariant& value, ReturnStatus* rs, + JSVariant* result) { AutoSafeJSContext cx; JSAutoRequest request(cx); @@ -426,7 +426,7 @@ JavaScriptChild::AnswerSet(const ObjectId &objId, const ObjectId &receiverId, co } bool -JavaScriptChild::AnswerIsExtensible(const ObjectId &objId, ReturnStatus *rs, bool *result) +JavaScriptChild::AnswerIsExtensible(const ObjectId& objId, ReturnStatus* rs, bool* result) { AutoSafeJSContext cx; JSAutoRequest request(cx); @@ -448,8 +448,8 @@ JavaScriptChild::AnswerIsExtensible(const ObjectId &objId, ReturnStatus *rs, boo } bool -JavaScriptChild::AnswerCall(const ObjectId &objId, const nsTArray &argv, ReturnStatus *rs, - JSVariant *result, nsTArray *outparams) +JavaScriptChild::AnswerCall(const ObjectId& objId, const nsTArray& argv, ReturnStatus* rs, + JSVariant* result, nsTArray* outparams) { AutoSafeJSContext cx; JSAutoRequest request(cx); @@ -477,7 +477,7 @@ JavaScriptChild::AnswerCall(const ObjectId &objId, const nsTArray &argv for (size_t i = 0; i < argv.Length(); i++) { if (argv[i].type() == JSParam::Tvoid_t) { // This is an outparam. - JSCompartment *compartment = js::GetContextCompartment(cx); + JSCompartment* compartment = js::GetContextCompartment(cx); RootedObject global(cx, JS_GetGlobalForCompartmentOrNull(cx, compartment)); RootedObject obj(cx, xpc::NewOutObject(cx, global)); if (!obj) @@ -545,8 +545,8 @@ JavaScriptChild::AnswerCall(const ObjectId &objId, const nsTArray &argv } bool -JavaScriptChild::AnswerObjectClassIs(const ObjectId &objId, const uint32_t &classValue, - bool *result) +JavaScriptChild::AnswerObjectClassIs(const ObjectId& objId, const uint32_t& classValue, + bool* result) { AutoSafeJSContext cx; JSAutoRequest request(cx); @@ -562,7 +562,7 @@ JavaScriptChild::AnswerObjectClassIs(const ObjectId &objId, const uint32_t &clas } bool -JavaScriptChild::AnswerClassName(const ObjectId &objId, nsString *name) +JavaScriptChild::AnswerClassName(const ObjectId& objId, nsString* name) { AutoSafeJSContext cx; JSAutoRequest request(cx); @@ -578,8 +578,8 @@ JavaScriptChild::AnswerClassName(const ObjectId &objId, nsString *name) } bool -JavaScriptChild::AnswerGetPropertyNames(const ObjectId &objId, const uint32_t &flags, - ReturnStatus *rs, nsTArray *names) +JavaScriptChild::AnswerGetPropertyNames(const ObjectId& objId, const uint32_t& flags, + ReturnStatus* rs, nsTArray* names) { AutoSafeJSContext cx; JSAutoRequest request(cx); @@ -606,8 +606,8 @@ JavaScriptChild::AnswerGetPropertyNames(const ObjectId &objId, const uint32_t &f } bool -JavaScriptChild::AnswerInstanceOf(const ObjectId &objId, const JSIID &iid, ReturnStatus *rs, - bool *instanceof) +JavaScriptChild::AnswerInstanceOf(const ObjectId& objId, const JSIID& iid, ReturnStatus* rs, + bool* instanceof) { AutoSafeJSContext cx; JSAutoRequest request(cx); @@ -631,9 +631,9 @@ JavaScriptChild::AnswerInstanceOf(const ObjectId &objId, const JSIID &iid, Retur } bool -JavaScriptChild::AnswerDOMInstanceOf(const ObjectId &objId, const int &prototypeID, - const int &depth, - ReturnStatus *rs, bool *instanceof) +JavaScriptChild::AnswerDOMInstanceOf(const ObjectId& objId, const int& prototypeID, + const int& depth, + ReturnStatus* rs, bool* instanceof) { AutoSafeJSContext cx; JSAutoRequest request(cx); diff --git a/js/ipc/JavaScriptChild.h b/js/ipc/JavaScriptChild.h index 8b682ed4c4..35ef4389b0 100644 --- a/js/ipc/JavaScriptChild.h +++ b/js/ipc/JavaScriptChild.h @@ -19,66 +19,66 @@ class JavaScriptChild public JavaScriptShared { public: - JavaScriptChild(JSRuntime *rt); + JavaScriptChild(JSRuntime* rt); ~JavaScriptChild(); bool init(); - void trace(JSTracer *trc); + void trace(JSTracer* trc); - bool RecvDropObject(const ObjectId &objId) MOZ_OVERRIDE; + bool RecvDropObject(const ObjectId& objId) MOZ_OVERRIDE; - bool AnswerPreventExtensions(const ObjectId &objId, ReturnStatus *rs) MOZ_OVERRIDE; - bool AnswerGetPropertyDescriptor(const ObjectId &objId, const nsString &id, - ReturnStatus *rs, - PPropertyDescriptor *out) MOZ_OVERRIDE; - bool AnswerGetOwnPropertyDescriptor(const ObjectId &objId, - const nsString &id, - ReturnStatus *rs, - PPropertyDescriptor *out) MOZ_OVERRIDE; - bool AnswerDefineProperty(const ObjectId &objId, const nsString &id, - const PPropertyDescriptor &flags, - ReturnStatus *rs) MOZ_OVERRIDE; - bool AnswerDelete(const ObjectId &objId, const nsString &id, - ReturnStatus *rs, bool *success) MOZ_OVERRIDE; + bool AnswerPreventExtensions(const ObjectId& objId, ReturnStatus* rs) MOZ_OVERRIDE; + bool AnswerGetPropertyDescriptor(const ObjectId& objId, const nsString& id, + ReturnStatus* rs, + PPropertyDescriptor* out) MOZ_OVERRIDE; + bool AnswerGetOwnPropertyDescriptor(const ObjectId& objId, + const nsString& id, + ReturnStatus* rs, + PPropertyDescriptor* out) MOZ_OVERRIDE; + bool AnswerDefineProperty(const ObjectId& objId, const nsString& id, + const PPropertyDescriptor& flags, + ReturnStatus* rs) MOZ_OVERRIDE; + bool AnswerDelete(const ObjectId& objId, const nsString& id, + ReturnStatus* rs, bool* success) MOZ_OVERRIDE; - bool AnswerHas(const ObjectId &objId, const nsString &id, - ReturnStatus *rs, bool *bp) MOZ_OVERRIDE; - bool AnswerHasOwn(const ObjectId &objId, const nsString &id, - ReturnStatus *rs, bool *bp) MOZ_OVERRIDE; - bool AnswerGet(const ObjectId &objId, const ObjectId &receiverId, - const nsString &id, - ReturnStatus *rs, JSVariant *result) MOZ_OVERRIDE; - bool AnswerSet(const ObjectId &objId, const ObjectId &receiverId, - const nsString &id, const bool &strict, - const JSVariant &value, ReturnStatus *rs, JSVariant *result) MOZ_OVERRIDE; + bool AnswerHas(const ObjectId& objId, const nsString& id, + ReturnStatus* rs, bool* bp) MOZ_OVERRIDE; + bool AnswerHasOwn(const ObjectId& objId, const nsString& id, + ReturnStatus* rs, bool* bp) MOZ_OVERRIDE; + bool AnswerGet(const ObjectId& objId, const ObjectId& receiverId, + const nsString& id, + ReturnStatus* rs, JSVariant* result) MOZ_OVERRIDE; + bool AnswerSet(const ObjectId& objId, const ObjectId& receiverId, + const nsString& id, const bool& strict, + const JSVariant& value, ReturnStatus* rs, JSVariant* result) MOZ_OVERRIDE; - bool AnswerIsExtensible(const ObjectId &objId, ReturnStatus *rs, - bool *result) MOZ_OVERRIDE; - bool AnswerCall(const ObjectId &objId, const nsTArray &argv, - ReturnStatus *rs, JSVariant *result, - nsTArray *outparams) MOZ_OVERRIDE; - bool AnswerObjectClassIs(const ObjectId &objId, const uint32_t &classValue, - bool *result) MOZ_OVERRIDE; - bool AnswerClassName(const ObjectId &objId, nsString *result) MOZ_OVERRIDE; + bool AnswerIsExtensible(const ObjectId& objId, ReturnStatus* rs, + bool* result) MOZ_OVERRIDE; + bool AnswerCall(const ObjectId& objId, const nsTArray& argv, + ReturnStatus* rs, JSVariant* result, + nsTArray* outparams) MOZ_OVERRIDE; + bool AnswerObjectClassIs(const ObjectId& objId, const uint32_t& classValue, + bool* result) MOZ_OVERRIDE; + bool AnswerClassName(const ObjectId& objId, nsString* result) MOZ_OVERRIDE; - bool AnswerGetPropertyNames(const ObjectId &objId, const uint32_t &flags, - ReturnStatus *rs, nsTArray *names) MOZ_OVERRIDE; - bool AnswerInstanceOf(const ObjectId &objId, const JSIID &iid, - ReturnStatus *rs, bool *instanceof) MOZ_OVERRIDE; - bool AnswerDOMInstanceOf(const ObjectId &objId, const int &prototypeID, const int &depth, - ReturnStatus *rs, bool *instanceof) MOZ_OVERRIDE; + bool AnswerGetPropertyNames(const ObjectId& objId, const uint32_t& flags, + ReturnStatus* rs, nsTArray* names) MOZ_OVERRIDE; + bool AnswerInstanceOf(const ObjectId& objId, const JSIID& iid, + ReturnStatus* rs, bool* instanceof) MOZ_OVERRIDE; + bool AnswerDOMInstanceOf(const ObjectId& objId, const int& prototypeID, const int& depth, + ReturnStatus* rs, bool* instanceof) MOZ_OVERRIDE; protected: - JSObject *unwrap(JSContext *cx, ObjectId id); + JSObject* unwrap(JSContext* cx, ObjectId id); private: - bool makeId(JSContext *cx, JSObject *obj, ObjectId *idp); - bool fail(JSContext *cx, ReturnStatus *rs); - bool ok(ReturnStatus *rs); + bool makeId(JSContext* cx, JSObject* obj, ObjectId* idp); + bool fail(JSContext* cx, ReturnStatus* rs); + bool ok(ReturnStatus* rs); private: ObjectId lastId_; - JSRuntime *rt_; + JSRuntime* rt_; ObjectIdCache ids_; }; diff --git a/js/ipc/JavaScriptParent.cpp b/js/ipc/JavaScriptParent.cpp index 34507d0c5b..10825804f3 100644 --- a/js/ipc/JavaScriptParent.cpp +++ b/js/ipc/JavaScriptParent.cpp @@ -27,15 +27,15 @@ JavaScriptParent::JavaScriptParent() { } -static inline JavaScriptParent * -ParentOf(JSObject *obj) +static inline JavaScriptParent* +ParentOf(JSObject* obj) { MOZ_ASSERT(JavaScriptParent::IsCPOW(obj)); - return reinterpret_cast(GetProxyExtra(obj, 0).toPrivate()); + return reinterpret_cast(GetProxyExtra(obj, 0).toPrivate()); } ObjectId -JavaScriptParent::idOf(JSObject *obj) +JavaScriptParent::idOf(JSObject* obj) { MOZ_ASSERT(JavaScriptParent::IsCPOW(obj)); @@ -62,31 +62,31 @@ class CPOWProxyHandler : public BaseProxyHandler return false; } - virtual bool preventExtensions(JSContext *cx, HandleObject proxy) MOZ_OVERRIDE; - virtual bool getPropertyDescriptor(JSContext *cx, HandleObject proxy, HandleId id, + virtual bool preventExtensions(JSContext* cx, HandleObject proxy) MOZ_OVERRIDE; + virtual bool getPropertyDescriptor(JSContext* cx, HandleObject proxy, HandleId id, MutableHandle desc) MOZ_OVERRIDE; - virtual bool getOwnPropertyDescriptor(JSContext *cx, HandleObject proxy, HandleId id, + virtual bool getOwnPropertyDescriptor(JSContext* cx, HandleObject proxy, HandleId id, MutableHandle desc) MOZ_OVERRIDE; - virtual bool defineProperty(JSContext *cx, HandleObject proxy, HandleId id, + virtual bool defineProperty(JSContext* cx, HandleObject proxy, HandleId id, MutableHandle desc) MOZ_OVERRIDE; - virtual bool getOwnPropertyNames(JSContext *cx, HandleObject proxy, - AutoIdVector &props) MOZ_OVERRIDE; - virtual bool delete_(JSContext *cx, HandleObject proxy, HandleId id, bool *bp) MOZ_OVERRIDE; - virtual bool enumerate(JSContext *cx, HandleObject proxy, AutoIdVector &props) MOZ_OVERRIDE; - - virtual bool has(JSContext *cx, HandleObject proxy, HandleId id, bool *bp) MOZ_OVERRIDE; - virtual bool hasOwn(JSContext *cx, HandleObject proxy, HandleId id, bool *bp) MOZ_OVERRIDE; - virtual bool get(JSContext *cx, HandleObject proxy, HandleObject receiver, + virtual bool getOwnPropertyNames(JSContext* cx, HandleObject proxy, + AutoIdVector& props) MOZ_OVERRIDE; + virtual bool delete_(JSContext* cx, HandleObject proxy, HandleId id, bool* bp) MOZ_OVERRIDE; + virtual bool enumerate(JSContext* cx, HandleObject proxy, AutoIdVector& props) MOZ_OVERRIDE; + + virtual bool has(JSContext* cx, HandleObject proxy, HandleId id, bool* bp) MOZ_OVERRIDE; + virtual bool hasOwn(JSContext* cx, HandleObject proxy, HandleId id, bool* bp) MOZ_OVERRIDE; + virtual bool get(JSContext* cx, HandleObject proxy, HandleObject receiver, HandleId id, MutableHandleValue vp) MOZ_OVERRIDE; - virtual bool set(JSContext *cx, JS::HandleObject proxy, JS::HandleObject receiver, + virtual bool set(JSContext* cx, JS::HandleObject proxy, JS::HandleObject receiver, JS::HandleId id, bool strict, JS::MutableHandleValue vp) MOZ_OVERRIDE; - virtual bool keys(JSContext *cx, HandleObject proxy, AutoIdVector &props) MOZ_OVERRIDE; + virtual bool keys(JSContext* cx, HandleObject proxy, AutoIdVector& props) MOZ_OVERRIDE; - virtual bool isExtensible(JSContext *cx, HandleObject proxy, bool *extensible) MOZ_OVERRIDE; - virtual bool call(JSContext *cx, HandleObject proxy, const CallArgs &args) MOZ_OVERRIDE; - virtual bool objectClassIs(HandleObject obj, js::ESClassValue classValue, JSContext *cx) MOZ_OVERRIDE; - virtual const char* className(JSContext *cx, HandleObject proxy) MOZ_OVERRIDE; - virtual void finalize(JSFreeOp *fop, JSObject *proxy) MOZ_OVERRIDE; + virtual bool isExtensible(JSContext* cx, HandleObject proxy, bool* extensible) MOZ_OVERRIDE; + virtual bool call(JSContext* cx, HandleObject proxy, const CallArgs& args) MOZ_OVERRIDE; + virtual bool objectClassIs(HandleObject obj, js::ESClassValue classValue, JSContext* cx) MOZ_OVERRIDE; + virtual const char* className(JSContext* cx, HandleObject proxy) MOZ_OVERRIDE; + virtual void finalize(JSFreeOp* fop, JSObject* proxy) MOZ_OVERRIDE; static CPOWProxyHandler singleton; }; @@ -94,7 +94,7 @@ class CPOWProxyHandler : public BaseProxyHandler CPOWProxyHandler CPOWProxyHandler::singleton; #define FORWARD(call, args) \ - JavaScriptParent *parent = ParentOf(proxy); \ + JavaScriptParent* parent = ParentOf(proxy); \ if (!parent->active()) { \ JS_ReportError(cx, "cannot use a CPOW whose process is gone"); \ return false; \ @@ -102,13 +102,13 @@ CPOWProxyHandler CPOWProxyHandler::singleton; return parent->call args; bool -CPOWProxyHandler::preventExtensions(JSContext *cx, HandleObject proxy) +CPOWProxyHandler::preventExtensions(JSContext* cx, HandleObject proxy) { FORWARD(preventExtensions, (cx, proxy)); } bool -JavaScriptParent::preventExtensions(JSContext *cx, HandleObject proxy) +JavaScriptParent::preventExtensions(JSContext* cx, HandleObject proxy) { ObjectId objId = idOf(proxy); @@ -120,14 +120,14 @@ JavaScriptParent::preventExtensions(JSContext *cx, HandleObject proxy) } bool -CPOWProxyHandler::getPropertyDescriptor(JSContext *cx, HandleObject proxy, HandleId id, +CPOWProxyHandler::getPropertyDescriptor(JSContext* cx, HandleObject proxy, HandleId id, MutableHandle desc) { FORWARD(getPropertyDescriptor, (cx, proxy, id, desc)); } bool -JavaScriptParent::getPropertyDescriptor(JSContext *cx, HandleObject proxy, HandleId id, +JavaScriptParent::getPropertyDescriptor(JSContext* cx, HandleObject proxy, HandleId id, MutableHandle desc) { ObjectId objId = idOf(proxy); @@ -147,14 +147,14 @@ JavaScriptParent::getPropertyDescriptor(JSContext *cx, HandleObject proxy, Handl } bool -CPOWProxyHandler::getOwnPropertyDescriptor(JSContext *cx, HandleObject proxy, +CPOWProxyHandler::getOwnPropertyDescriptor(JSContext* cx, HandleObject proxy, HandleId id, MutableHandle desc) { FORWARD(getOwnPropertyDescriptor, (cx, proxy, id, desc)); } bool -JavaScriptParent::getOwnPropertyDescriptor(JSContext *cx, HandleObject proxy, HandleId id, +JavaScriptParent::getOwnPropertyDescriptor(JSContext* cx, HandleObject proxy, HandleId id, MutableHandle desc) { ObjectId objId = idOf(proxy); @@ -174,14 +174,14 @@ JavaScriptParent::getOwnPropertyDescriptor(JSContext *cx, HandleObject proxy, Ha } bool -CPOWProxyHandler::defineProperty(JSContext *cx, HandleObject proxy, HandleId id, +CPOWProxyHandler::defineProperty(JSContext* cx, HandleObject proxy, HandleId id, MutableHandle desc) { FORWARD(defineProperty, (cx, proxy, id, desc)); } bool -JavaScriptParent::defineProperty(JSContext *cx, HandleObject proxy, HandleId id, +JavaScriptParent::defineProperty(JSContext* cx, HandleObject proxy, HandleId id, MutableHandle desc) { ObjectId objId = idOf(proxy); @@ -202,25 +202,25 @@ JavaScriptParent::defineProperty(JSContext *cx, HandleObject proxy, HandleId id, } bool -CPOWProxyHandler::getOwnPropertyNames(JSContext *cx, HandleObject proxy, AutoIdVector &props) +CPOWProxyHandler::getOwnPropertyNames(JSContext* cx, HandleObject proxy, AutoIdVector& props) { FORWARD(getOwnPropertyNames, (cx, proxy, props)); } bool -JavaScriptParent::getOwnPropertyNames(JSContext *cx, HandleObject proxy, AutoIdVector &props) +JavaScriptParent::getOwnPropertyNames(JSContext* cx, HandleObject proxy, AutoIdVector& props) { return getPropertyNames(cx, proxy, JSITER_OWNONLY | JSITER_HIDDEN, props); } bool -CPOWProxyHandler::delete_(JSContext *cx, HandleObject proxy, HandleId id, bool *bp) +CPOWProxyHandler::delete_(JSContext* cx, HandleObject proxy, HandleId id, bool* bp) { FORWARD(delete_, (cx, proxy, id, bp)); } bool -JavaScriptParent::delete_(JSContext *cx, HandleObject proxy, HandleId id, bool *bp) +JavaScriptParent::delete_(JSContext* cx, HandleObject proxy, HandleId id, bool* bp) { ObjectId objId = idOf(proxy); @@ -236,25 +236,25 @@ JavaScriptParent::delete_(JSContext *cx, HandleObject proxy, HandleId id, bool * } bool -CPOWProxyHandler::enumerate(JSContext *cx, HandleObject proxy, AutoIdVector &props) +CPOWProxyHandler::enumerate(JSContext* cx, HandleObject proxy, AutoIdVector& props) { FORWARD(enumerate, (cx, proxy, props)); } bool -JavaScriptParent::enumerate(JSContext *cx, HandleObject proxy, AutoIdVector &props) +JavaScriptParent::enumerate(JSContext* cx, HandleObject proxy, AutoIdVector& props) { return getPropertyNames(cx, proxy, 0, props); } bool -CPOWProxyHandler::has(JSContext *cx, HandleObject proxy, HandleId id, bool *bp) +CPOWProxyHandler::has(JSContext* cx, HandleObject proxy, HandleId id, bool* bp) { FORWARD(has, (cx, proxy, id, bp)); } bool -JavaScriptParent::has(JSContext *cx, HandleObject proxy, HandleId id, bool *bp) +JavaScriptParent::has(JSContext* cx, HandleObject proxy, HandleId id, bool* bp) { ObjectId objId = idOf(proxy); @@ -270,13 +270,13 @@ JavaScriptParent::has(JSContext *cx, HandleObject proxy, HandleId id, bool *bp) } bool -CPOWProxyHandler::hasOwn(JSContext *cx, HandleObject proxy, HandleId id, bool *bp) +CPOWProxyHandler::hasOwn(JSContext* cx, HandleObject proxy, HandleId id, bool* bp) { FORWARD(hasOwn, (cx, proxy, id, bp)); } bool -JavaScriptParent::hasOwn(JSContext *cx, HandleObject proxy, HandleId id, bool *bp) +JavaScriptParent::hasOwn(JSContext* cx, HandleObject proxy, HandleId id, bool* bp) { ObjectId objId = idOf(proxy); @@ -292,14 +292,14 @@ JavaScriptParent::hasOwn(JSContext *cx, HandleObject proxy, HandleId id, bool *b } bool -CPOWProxyHandler::get(JSContext *cx, HandleObject proxy, HandleObject receiver, +CPOWProxyHandler::get(JSContext* cx, HandleObject proxy, HandleObject receiver, HandleId id, MutableHandleValue vp) { FORWARD(get, (cx, proxy, receiver, id, vp)); } bool -JavaScriptParent::get(JSContext *cx, HandleObject proxy, HandleObject receiver, +JavaScriptParent::get(JSContext* cx, HandleObject proxy, HandleObject receiver, HandleId id, MutableHandleValue vp) { ObjectId objId = idOf(proxy); @@ -321,14 +321,14 @@ JavaScriptParent::get(JSContext *cx, HandleObject proxy, HandleObject receiver, } bool -CPOWProxyHandler::set(JSContext *cx, JS::HandleObject proxy, JS::HandleObject receiver, +CPOWProxyHandler::set(JSContext* cx, JS::HandleObject proxy, JS::HandleObject receiver, JS::HandleId id, bool strict, JS::MutableHandleValue vp) { FORWARD(set, (cx, proxy, receiver, id, strict, vp)); } bool -JavaScriptParent::set(JSContext *cx, JS::HandleObject proxy, JS::HandleObject receiver, +JavaScriptParent::set(JSContext* cx, JS::HandleObject proxy, JS::HandleObject receiver, JS::HandleId id, bool strict, JS::MutableHandleValue vp) { ObjectId objId = idOf(proxy); @@ -354,25 +354,25 @@ JavaScriptParent::set(JSContext *cx, JS::HandleObject proxy, JS::HandleObject re } bool -CPOWProxyHandler::keys(JSContext *cx, HandleObject proxy, AutoIdVector &props) +CPOWProxyHandler::keys(JSContext* cx, HandleObject proxy, AutoIdVector& props) { FORWARD(keys, (cx, proxy, props)); } bool -JavaScriptParent::keys(JSContext *cx, HandleObject proxy, AutoIdVector &props) +JavaScriptParent::keys(JSContext* cx, HandleObject proxy, AutoIdVector& props) { return getPropertyNames(cx, proxy, JSITER_OWNONLY, props); } bool -CPOWProxyHandler::isExtensible(JSContext *cx, HandleObject proxy, bool *extensible) +CPOWProxyHandler::isExtensible(JSContext* cx, HandleObject proxy, bool* extensible) { FORWARD(isExtensible, (cx, proxy, extensible)); } bool -JavaScriptParent::isExtensible(JSContext *cx, HandleObject proxy, bool *extensible) +JavaScriptParent::isExtensible(JSContext* cx, HandleObject proxy, bool* extensible) { ObjectId objId = idOf(proxy); @@ -384,13 +384,13 @@ JavaScriptParent::isExtensible(JSContext *cx, HandleObject proxy, bool *extensib } bool -CPOWProxyHandler::call(JSContext *cx, HandleObject proxy, const CallArgs &args) +CPOWProxyHandler::call(JSContext* cx, HandleObject proxy, const CallArgs& args) { FORWARD(call, (cx, proxy, args)); } bool -JavaScriptParent::call(JSContext *cx, HandleObject proxy, const CallArgs &args) +JavaScriptParent::call(JSContext* cx, HandleObject proxy, const CallArgs& args) { ObjectId objId = idOf(proxy); @@ -459,13 +459,13 @@ JavaScriptParent::call(JSContext *cx, HandleObject proxy, const CallArgs &args) bool -CPOWProxyHandler::objectClassIs(HandleObject proxy, js::ESClassValue classValue, JSContext *cx) +CPOWProxyHandler::objectClassIs(HandleObject proxy, js::ESClassValue classValue, JSContext* cx) { FORWARD(objectClassIs, (cx, proxy, classValue)); } bool -JavaScriptParent::objectClassIs(JSContext *cx, HandleObject proxy, js::ESClassValue classValue) +JavaScriptParent::objectClassIs(JSContext* cx, HandleObject proxy, js::ESClassValue classValue) { ObjectId objId = idOf(proxy); @@ -478,17 +478,17 @@ JavaScriptParent::objectClassIs(JSContext *cx, HandleObject proxy, js::ESClassVa return result; } -const char * -CPOWProxyHandler::className(JSContext *cx, HandleObject proxy) +const char* +CPOWProxyHandler::className(JSContext* cx, HandleObject proxy) { - JavaScriptParent *parent = ParentOf(proxy); + JavaScriptParent* parent = ParentOf(proxy); if (!parent->active()) return ""; return parent->className(cx, proxy); } -const char * -JavaScriptParent::className(JSContext *cx, HandleObject proxy) +const char* +JavaScriptParent::className(JSContext* cx, HandleObject proxy) { ObjectId objId = idOf(proxy); @@ -500,13 +500,13 @@ JavaScriptParent::className(JSContext *cx, HandleObject proxy) } void -CPOWProxyHandler::finalize(JSFreeOp *fop, JSObject *proxy) +CPOWProxyHandler::finalize(JSFreeOp* fop, JSObject* proxy) { ParentOf(proxy)->drop(proxy); } void -JavaScriptParent::drop(JSObject *obj) +JavaScriptParent::drop(JSObject* obj) { ObjectId objId = idOf(obj); @@ -526,7 +526,7 @@ JavaScriptParent::init() } bool -JavaScriptParent::makeId(JSContext *cx, JSObject *obj, ObjectId *idp) +JavaScriptParent::makeId(JSContext* cx, JSObject* obj, ObjectId* idp) { obj = js::CheckedUnwrap(obj, false); if (!obj || !IsProxy(obj) || GetProxyHandler(obj) != &CPOWProxyHandler::singleton) { @@ -539,7 +539,7 @@ JavaScriptParent::makeId(JSContext *cx, JSObject *obj, ObjectId *idp) } bool -JavaScriptParent::getPropertyNames(JSContext *cx, HandleObject proxy, uint32_t flags, AutoIdVector &props) +JavaScriptParent::getPropertyNames(JSContext* cx, HandleObject proxy, uint32_t flags, AutoIdVector& props) { ObjectId objId = idOf(proxy); @@ -561,8 +561,8 @@ JavaScriptParent::getPropertyNames(JSContext *cx, HandleObject proxy, uint32_t f return true; } -JSObject * -JavaScriptParent::unwrap(JSContext *cx, ObjectId objId) +JSObject* +JavaScriptParent::unwrap(JSContext* cx, ObjectId objId) { RootedObject obj(cx, findObject(objId)); if (obj) { @@ -604,14 +604,14 @@ JavaScriptParent::unwrap(JSContext *cx, ObjectId objId) } bool -JavaScriptParent::ipcfail(JSContext *cx) +JavaScriptParent::ipcfail(JSContext* cx) { JS_ReportError(cx, "child process crashed or timedout"); return false; } bool -JavaScriptParent::ok(JSContext *cx, const ReturnStatus &status) +JavaScriptParent::ok(JSContext* cx, const ReturnStatus& status) { if (status.type() == ReturnStatus::TReturnSuccess) return true; @@ -648,22 +648,22 @@ JavaScriptParent::ActorDestroy(ActorDestroyReason why) } /* static */ bool -JavaScriptParent::IsCPOW(JSObject *obj) +JavaScriptParent::IsCPOW(JSObject* obj) { return IsProxy(obj) && GetProxyHandler(obj) == &CPOWProxyHandler::singleton; } /* static */ nsresult -JavaScriptParent::InstanceOf(JSObject *proxy, const nsID *id, bool *bp) +JavaScriptParent::InstanceOf(JSObject* proxy, const nsID* id, bool* bp) { - JavaScriptParent *parent = ParentOf(proxy); + JavaScriptParent* parent = ParentOf(proxy); if (!parent->active()) return NS_ERROR_UNEXPECTED; return parent->instanceOf(proxy, id, bp); } nsresult -JavaScriptParent::instanceOf(JSObject *obj, const nsID *id, bool *bp) +JavaScriptParent::instanceOf(JSObject* obj, const nsID* id, bool* bp) { ObjectId objId = idOf(obj); @@ -681,13 +681,13 @@ JavaScriptParent::instanceOf(JSObject *obj, const nsID *id, bool *bp) } /* static */ bool -JavaScriptParent::DOMInstanceOf(JSContext *cx, JSObject *proxy, int prototypeID, int depth, bool *bp) +JavaScriptParent::DOMInstanceOf(JSContext* cx, JSObject* proxy, int prototypeID, int depth, bool* bp) { FORWARD(domInstanceOf, (cx, proxy, prototypeID, depth, bp)); } bool -JavaScriptParent::domInstanceOf(JSContext *cx, JSObject *obj, int prototypeID, int depth, bool *bp) +JavaScriptParent::domInstanceOf(JSContext* cx, JSObject* obj, int prototypeID, int depth, bool* bp) { ObjectId objId = idOf(obj); @@ -701,7 +701,7 @@ JavaScriptParent::domInstanceOf(JSContext *cx, JSObject *obj, int prototypeID, i mozilla::ipc::IProtocol* JavaScriptParent::CloneProtocol(Channel* aChannel, ProtocolCloneContext* aCtx) { - ContentParent *contentParent = aCtx->GetContentParent(); + ContentParent* contentParent = aCtx->GetContentParent(); nsAutoPtr actor(contentParent->AllocPJavaScriptParent()); if (!actor || !contentParent->RecvPJavaScriptConstructor(actor)) { return nullptr; diff --git a/js/ipc/JavaScriptParent.h b/js/ipc/JavaScriptParent.h index 4c25194d56..9b8a193601 100644 --- a/js/ipc/JavaScriptParent.h +++ b/js/ipc/JavaScriptParent.h @@ -32,32 +32,32 @@ class JavaScriptParent public: // Fundamental proxy traps. These are required. // (The traps should be in the same order like js/src/jsproxy.h) - bool preventExtensions(JSContext *cx, JS::HandleObject proxy); - bool getPropertyDescriptor(JSContext *cx, JS::HandleObject proxy, JS::HandleId id, + bool preventExtensions(JSContext* cx, JS::HandleObject proxy); + bool getPropertyDescriptor(JSContext* cx, JS::HandleObject proxy, JS::HandleId id, JS::MutableHandle desc); - bool getOwnPropertyDescriptor(JSContext *cx, JS::HandleObject proxy, JS::HandleId id, + bool getOwnPropertyDescriptor(JSContext* cx, JS::HandleObject proxy, JS::HandleId id, JS::MutableHandle desc); - bool defineProperty(JSContext *cx, JS::HandleObject proxy, JS::HandleId id, + bool defineProperty(JSContext* cx, JS::HandleObject proxy, JS::HandleId id, JS::MutableHandle desc); - bool getOwnPropertyNames(JSContext *cx, JS::HandleObject proxy, JS::AutoIdVector &props); - bool delete_(JSContext *cx, JS::HandleObject proxy, JS::HandleId id, bool *bp); - bool enumerate(JSContext *cx, JS::HandleObject proxy, JS::AutoIdVector &props); + bool getOwnPropertyNames(JSContext* cx, JS::HandleObject proxy, JS::AutoIdVector& props); + bool delete_(JSContext* cx, JS::HandleObject proxy, JS::HandleId id, bool* bp); + bool enumerate(JSContext* cx, JS::HandleObject proxy, JS::AutoIdVector& props); // Derived proxy traps. Implementing these is useful for perfomance. - bool has(JSContext *cx, JS::HandleObject proxy, JS::HandleId id, bool *bp); - bool hasOwn(JSContext *cx, JS::HandleObject proxy, JS::HandleId id, bool *bp); - bool get(JSContext *cx, JS::HandleObject proxy, JS::HandleObject receiver, + bool has(JSContext* cx, JS::HandleObject proxy, JS::HandleId id, bool* bp); + bool hasOwn(JSContext* cx, JS::HandleObject proxy, JS::HandleId id, bool* bp); + bool get(JSContext* cx, JS::HandleObject proxy, JS::HandleObject receiver, JS::HandleId id, JS::MutableHandleValue vp); - bool set(JSContext *cx, JS::HandleObject proxy, JS::HandleObject receiver, + bool set(JSContext* cx, JS::HandleObject proxy, JS::HandleObject receiver, JS::HandleId id, bool strict, JS::MutableHandleValue vp); - bool keys(JSContext *cx, JS::HandleObject proxy, JS::AutoIdVector &props); + bool keys(JSContext* cx, JS::HandleObject proxy, JS::AutoIdVector& props); // We use "iterate" provided by the base class here. // SpiderMonkey Extensions. - bool isExtensible(JSContext *cx, JS::HandleObject proxy, bool *extensible); - bool call(JSContext *cx, JS::HandleObject proxy, const JS::CallArgs &args); - bool objectClassIs(JSContext *cx, JS::HandleObject obj, js::ESClassValue classValue); - const char* className(JSContext *cx, JS::HandleObject proxy); + bool isExtensible(JSContext* cx, JS::HandleObject proxy, bool* extensible); + bool call(JSContext* cx, JS::HandleObject proxy, const JS::CallArgs& args); + bool objectClassIs(JSContext* cx, JS::HandleObject obj, js::ESClassValue classValue); + const char* className(JSContext* cx, JS::HandleObject proxy); virtual void ActorDestroy(ActorDestroyReason why); @@ -66,37 +66,37 @@ class JavaScriptParent bool active() { return !inactive_; } - void drop(JSObject *obj); + void drop(JSObject* obj); - static bool IsCPOW(JSObject *obj); + static bool IsCPOW(JSObject* obj); - static nsresult InstanceOf(JSObject *obj, const nsID *id, bool *bp); - nsresult instanceOf(JSObject *obj, const nsID *id, bool *bp); + static nsresult InstanceOf(JSObject* obj, const nsID* id, bool* bp); + nsresult instanceOf(JSObject* obj, const nsID* id, bool* bp); /* * Check that |obj| is a DOM wrapper whose prototype chain contains * |prototypeID| at depth |depth|. */ - static bool DOMInstanceOf(JSContext *cx, JSObject *obj, int prototypeID, int depth, bool *bp); - bool domInstanceOf(JSContext *cx, JSObject *obj, int prototypeID, int depth, bool *bp); + static bool DOMInstanceOf(JSContext* cx, JSObject* obj, int prototypeID, int depth, bool* bp); + bool domInstanceOf(JSContext* cx, JSObject* obj, int prototypeID, int depth, bool* bp); mozilla::ipc::IProtocol* CloneProtocol(Channel* aChannel, ProtocolCloneContext* aCtx) MOZ_OVERRIDE; protected: - JSObject *unwrap(JSContext *cx, ObjectId objId); + JSObject* unwrap(JSContext* cx, ObjectId objId); private: - bool makeId(JSContext *cx, JSObject *obj, ObjectId *idp); - bool getPropertyNames(JSContext *cx, JS::HandleObject proxy, uint32_t flags, - JS::AutoIdVector &props); - ObjectId idOf(JSObject *obj); + bool makeId(JSContext* cx, JSObject* obj, ObjectId* idp); + bool getPropertyNames(JSContext* cx, JS::HandleObject proxy, uint32_t flags, + JS::AutoIdVector& props); + ObjectId idOf(JSObject* obj); // Catastrophic IPC failure. - bool ipcfail(JSContext *cx); + bool ipcfail(JSContext* cx); // Check whether a return status is okay, and if not, propagate its error. - bool ok(JSContext *cx, const ReturnStatus &status); + bool ok(JSContext* cx, const ReturnStatus& status); private: uintptr_t refcount_; diff --git a/js/ipc/JavaScriptShared.cpp b/js/ipc/JavaScriptShared.cpp index 295e190244..5e2a3eef95 100644 --- a/js/ipc/JavaScriptShared.cpp +++ b/js/ipc/JavaScriptShared.cpp @@ -27,16 +27,16 @@ ObjectStore::init() } void -ObjectStore::trace(JSTracer *trc) +ObjectStore::trace(JSTracer* trc) { for (ObjectTable::Range r(table_.all()); !r.empty(); r.popFront()) { - DebugOnly prior = r.front().value().get(); + DebugOnly prior = r.front().value().get(); JS_CallHeapObjectTracer(trc, &r.front().value(), "ipc-object"); MOZ_ASSERT(r.front().value() == prior); } } -JSObject * +JSObject* ObjectStore::find(ObjectId id) { ObjectTable::Ptr p = table_.lookup(id); @@ -46,7 +46,7 @@ ObjectStore::find(ObjectId id) } bool -ObjectStore::add(ObjectId id, JSObject *obj) +ObjectStore::add(ObjectId id, JSObject* obj) { return table_.put(id, obj); } @@ -79,17 +79,17 @@ ObjectIdCache::init() } void -ObjectIdCache::trace(JSTracer *trc) +ObjectIdCache::trace(JSTracer* trc) { for (ObjectIdTable::Range r(table_->all()); !r.empty(); r.popFront()) { - JSObject *obj = r.front().key(); + JSObject* obj = r.front().key(); JS_CallObjectTracer(trc, &obj, "ipc-id"); MOZ_ASSERT(obj == r.front().key()); } } ObjectId -ObjectIdCache::find(JSObject *obj) +ObjectIdCache::find(JSObject* obj) { ObjectIdTable::Ptr p = table_->lookup(obj); if (!p) @@ -98,7 +98,7 @@ ObjectIdCache::find(JSObject *obj) } bool -ObjectIdCache::add(JSContext *cx, JSObject *obj, ObjectId id) +ObjectIdCache::add(JSContext* cx, JSObject* obj, ObjectId id) { if (!table_->put(obj, id)) return false; @@ -111,15 +111,15 @@ ObjectIdCache::add(JSContext *cx, JSObject *obj, ObjectId id) * been moved. */ /* static */ void -ObjectIdCache::keyMarkCallback(JSTracer *trc, JSObject *key, void *data) { +ObjectIdCache::keyMarkCallback(JSTracer* trc, JSObject* key, void* data) { ObjectIdTable* table = static_cast(data); - JSObject *prior = key; + JSObject* prior = key; JS_CallObjectTracer(trc, &key, "ObjectIdCache::table_ key"); table->rekeyIfMoved(prior, key); } void -ObjectIdCache::remove(JSObject *obj) +ObjectIdCache::remove(JSObject* obj) { table_->remove(obj); } @@ -133,7 +133,7 @@ JavaScriptShared::init() } bool -JavaScriptShared::convertIdToGeckoString(JSContext *cx, JS::HandleId id, nsString *to) +JavaScriptShared::convertIdToGeckoString(JSContext* cx, JS::HandleId id, nsString* to) { RootedValue idval(cx); if (!JS_IdToValue(cx, id, &idval)) @@ -143,7 +143,7 @@ JavaScriptShared::convertIdToGeckoString(JSContext *cx, JS::HandleId id, nsStrin if (!str) return false; - const jschar *chars = JS_GetStringCharsZ(cx, str); + const jschar* chars = JS_GetStringCharsZ(cx, str); if (!chars) return false; @@ -152,7 +152,7 @@ JavaScriptShared::convertIdToGeckoString(JSContext *cx, JS::HandleId id, nsStrin } bool -JavaScriptShared::convertGeckoStringToId(JSContext *cx, const nsString &from, JS::MutableHandleId to) +JavaScriptShared::convertGeckoStringToId(JSContext* cx, const nsString& from, JS::MutableHandleId to) { RootedString str(cx, JS_NewUCStringCopyN(cx, from.BeginReading(), from.Length())); if (!str) @@ -162,7 +162,7 @@ JavaScriptShared::convertGeckoStringToId(JSContext *cx, const nsString &from, JS } bool -JavaScriptShared::toVariant(JSContext *cx, JS::HandleValue from, JSVariant *to) +JavaScriptShared::toVariant(JSContext* cx, JS::HandleValue from, JSVariant* to) { switch (JS_TypeOfValue(cx, from)) { case JSTYPE_VOID: @@ -187,7 +187,7 @@ JavaScriptShared::toVariant(JSContext *cx, JS::HandleValue from, JSVariant *to) if (xpc_JSObjectIsID(cx, obj)) { JSIID iid; - const nsID *id = xpc_JSObjectToID(cx, obj); + const nsID* id = xpc_JSObjectToID(cx, obj); ConvertID(*id, &iid); *to = iid; return true; @@ -227,7 +227,7 @@ JavaScriptShared::toVariant(JSContext *cx, JS::HandleValue from, JSVariant *to) } bool -JavaScriptShared::toValue(JSContext *cx, const JSVariant &from, MutableHandleValue to) +JavaScriptShared::toValue(JSContext* cx, const JSVariant& from, MutableHandleValue to) { switch (from.type()) { case JSVariant::Tvoid_t: @@ -238,7 +238,7 @@ JavaScriptShared::toValue(JSContext *cx, const JSVariant &from, MutableHandleVal { ObjectId id = from.get_uint64_t(); if (id) { - JSObject *obj = unwrap(cx, id); + JSObject* obj = unwrap(cx, id); if (!obj) return false; to.set(ObjectValue(*obj)); @@ -258,8 +258,8 @@ JavaScriptShared::toValue(JSContext *cx, const JSVariant &from, MutableHandleVal case JSVariant::TnsString: { - const nsString &old = from.get_nsString(); - JSString *str = JS_NewUCStringCopyN(cx, old.BeginReading(), old.Length()); + const nsString& old = from.get_nsString(); + JSString* str = JS_NewUCStringCopyN(cx, old.BeginReading(), old.Length()); if (!str) return false; to.set(StringValue(str)); @@ -269,12 +269,12 @@ JavaScriptShared::toValue(JSContext *cx, const JSVariant &from, MutableHandleVal case JSVariant::TJSIID: { nsID iid; - const JSIID &id = from.get_JSIID(); + const JSIID& id = from.get_JSIID(); ConvertID(id, &iid); - JSCompartment *compartment = GetContextCompartment(cx); + JSCompartment* compartment = GetContextCompartment(cx); RootedObject global(cx, JS_GetGlobalForCompartmentOrNull(cx, compartment)); - JSObject *obj = xpc_NewIDObject(cx, global, iid); + JSObject* obj = xpc_NewIDObject(cx, global, iid); if (!obj) return false; to.set(ObjectValue(*obj)); @@ -287,7 +287,7 @@ JavaScriptShared::toValue(JSContext *cx, const JSVariant &from, MutableHandleVal } /* static */ void -JavaScriptShared::ConvertID(const nsID &from, JSIID *to) +JavaScriptShared::ConvertID(const nsID& from, JSIID* to) { to->m0() = from.m0; to->m1() = from.m1; @@ -303,7 +303,7 @@ JavaScriptShared::ConvertID(const nsID &from, JSIID *to) } /* static */ void -JavaScriptShared::ConvertID(const JSIID &from, nsID *to) +JavaScriptShared::ConvertID(const JSIID& from, nsID* to) { to->m0 = from.m0(); to->m1 = from.m1(); @@ -323,8 +323,8 @@ static const uint32_t GetterOnlyPropertyStub = 2; static const uint32_t UnknownPropertyOp = 3; bool -JavaScriptShared::fromDescriptor(JSContext *cx, Handle desc, - PPropertyDescriptor *out) +JavaScriptShared::fromDescriptor(JSContext* cx, Handle desc, + PPropertyDescriptor* out) { out->attrs() = desc.attributes(); if (!toVariant(cx, desc.value(), &out->value())) @@ -336,7 +336,7 @@ JavaScriptShared::fromDescriptor(JSContext *cx, Handle des if (!desc.getter()) { out->getter() = 0; } else if (desc.hasGetterObject()) { - JSObject *getter = desc.getterObject(); + JSObject* getter = desc.getterObject(); if (!makeId(cx, getter, &out->getter())) return false; } else { @@ -349,7 +349,7 @@ JavaScriptShared::fromDescriptor(JSContext *cx, Handle des if (!desc.setter()) { out->setter() = 0; } else if (desc.hasSetterObject()) { - JSObject *setter = desc.setterObject(); + JSObject* setter = desc.setterObject(); if (!makeId(cx, setter, &out->setter())) return false; } else { @@ -365,21 +365,21 @@ JavaScriptShared::fromDescriptor(JSContext *cx, Handle des } bool -UnknownPropertyStub(JSContext *cx, HandleObject obj, HandleId id, MutableHandleValue vp) +UnknownPropertyStub(JSContext* cx, HandleObject obj, HandleId id, MutableHandleValue vp) { JS_ReportError(cx, "getter could not be wrapped via CPOWs"); return false; } bool -UnknownStrictPropertyStub(JSContext *cx, HandleObject obj, HandleId id, bool strict, MutableHandleValue vp) +UnknownStrictPropertyStub(JSContext* cx, HandleObject obj, HandleId id, bool strict, MutableHandleValue vp) { JS_ReportError(cx, "setter could not be wrapped via CPOWs"); return false; } bool -JavaScriptShared::toDescriptor(JSContext *cx, const PPropertyDescriptor &in, +JavaScriptShared::toDescriptor(JSContext* cx, const PPropertyDescriptor& in, MutableHandle out) { out.setAttributes(in.attrs()); @@ -424,13 +424,13 @@ JavaScriptShared::toDescriptor(JSContext *cx, const PPropertyDescriptor &in, } bool -CpowIdHolder::ToObject(JSContext *cx, JS::MutableHandleObject objp) +CpowIdHolder::ToObject(JSContext* cx, JS::MutableHandleObject objp) { return js_->Unwrap(cx, cpows_, objp); } bool -JavaScriptShared::Unwrap(JSContext *cx, const InfallibleTArray &aCpows, +JavaScriptShared::Unwrap(JSContext* cx, const InfallibleTArray& aCpows, JS::MutableHandleObject objp) { objp.set(nullptr); @@ -445,7 +445,7 @@ JavaScriptShared::Unwrap(JSContext *cx, const InfallibleTArray &aCpow RootedValue v(cx); RootedString str(cx); for (size_t i = 0; i < aCpows.Length(); i++) { - const nsString &name = aCpows[i].name(); + const nsString& name = aCpows[i].name(); if (!toValue(cx, aCpows[i].value(), &v)) return false; @@ -468,7 +468,7 @@ JavaScriptShared::Unwrap(JSContext *cx, const InfallibleTArray &aCpow } bool -JavaScriptShared::Wrap(JSContext *cx, HandleObject aObj, InfallibleTArray *outCpows) +JavaScriptShared::Wrap(JSContext* cx, HandleObject aObj, InfallibleTArray* outCpows) { if (!aObj) return true; diff --git a/js/ipc/JavaScriptShared.h b/js/ipc/JavaScriptShared.h index 6a78b0a0e2..1a131e6502 100644 --- a/js/ipc/JavaScriptShared.h +++ b/js/ipc/JavaScriptShared.h @@ -23,17 +23,17 @@ class JavaScriptShared; class CpowIdHolder : public CpowHolder { public: - CpowIdHolder(JavaScriptShared *js, const InfallibleTArray &cpows) + CpowIdHolder(JavaScriptShared* js, const InfallibleTArray& cpows) : js_(js), cpows_(cpows) { } - bool ToObject(JSContext *cx, JS::MutableHandleObject objp); + bool ToObject(JSContext* cx, JS::MutableHandleObject objp); private: - JavaScriptShared *js_; - const InfallibleTArray &cpows_; + JavaScriptShared* js_; + const InfallibleTArray& cpows_; }; // Map ids -> JSObjects @@ -41,16 +41,16 @@ class ObjectStore { typedef js::DefaultHasher TableKeyHasher; - typedef js::HashMap, TableKeyHasher, js::SystemAllocPolicy> ObjectTable; + typedef js::HashMap, TableKeyHasher, js::SystemAllocPolicy> ObjectTable; public: ObjectStore(); bool init(); - void trace(JSTracer *trc); + void trace(JSTracer* trc); - bool add(ObjectId id, JSObject *obj); - JSObject *find(ObjectId id); + bool add(ObjectId id, JSObject* obj); + JSObject* find(ObjectId id); void remove(ObjectId id); private: @@ -60,24 +60,24 @@ class ObjectStore // Map JSObjects -> ids class ObjectIdCache { - typedef js::PointerHasher Hasher; - typedef js::HashMap ObjectIdTable; + typedef js::PointerHasher Hasher; + typedef js::HashMap ObjectIdTable; public: ObjectIdCache(); ~ObjectIdCache(); bool init(); - void trace(JSTracer *trc); + void trace(JSTracer* trc); - bool add(JSContext *cx, JSObject *obj, ObjectId id); - ObjectId find(JSObject *obj); - void remove(JSObject *obj); + bool add(JSContext* cx, JSObject* obj, ObjectId id); + ObjectId find(JSObject* obj); + void remove(JSObject* obj); private: - static void keyMarkCallback(JSTracer *trc, JSObject *key, void *data); + static void keyMarkCallback(JSTracer* trc, JSObject* key, void* data); - ObjectIdTable *table_; + ObjectIdTable* table_; }; class JavaScriptShared @@ -88,19 +88,19 @@ class JavaScriptShared static const uint32_t OBJECT_EXTRA_BITS = 1; static const uint32_t OBJECT_IS_CALLABLE = (1 << 0); - bool Unwrap(JSContext *cx, const InfallibleTArray &aCpows, JS::MutableHandleObject objp); - bool Wrap(JSContext *cx, JS::HandleObject aObj, InfallibleTArray *outCpows); + bool Unwrap(JSContext* cx, const InfallibleTArray& aCpows, JS::MutableHandleObject objp); + bool Wrap(JSContext* cx, JS::HandleObject aObj, InfallibleTArray* outCpows); protected: - bool toVariant(JSContext *cx, JS::HandleValue from, JSVariant *to); - bool toValue(JSContext *cx, const JSVariant &from, JS::MutableHandleValue to); - bool fromDescriptor(JSContext *cx, JS::Handle desc, PPropertyDescriptor *out); - bool toDescriptor(JSContext *cx, const PPropertyDescriptor &in, + bool toVariant(JSContext* cx, JS::HandleValue from, JSVariant* to); + bool toValue(JSContext* cx, const JSVariant& from, JS::MutableHandleValue to); + bool fromDescriptor(JSContext* cx, JS::Handle desc, PPropertyDescriptor* out); + bool toDescriptor(JSContext* cx, const PPropertyDescriptor& in, JS::MutableHandle out); - bool convertIdToGeckoString(JSContext *cx, JS::HandleId id, nsString *to); - bool convertGeckoStringToId(JSContext *cx, const nsString &from, JS::MutableHandleId id); + bool convertIdToGeckoString(JSContext* cx, JS::HandleId id, nsString* to); + bool convertGeckoStringToId(JSContext* cx, const nsString& from, JS::MutableHandleId id); - bool toValue(JSContext *cx, const JSVariant &from, jsval *to) { + bool toValue(JSContext* cx, const JSVariant& from, jsval* to) { JS::RootedValue v(cx); if (!toValue(cx, from, &v)) return false; @@ -108,10 +108,10 @@ class JavaScriptShared return true; } - virtual bool makeId(JSContext *cx, JSObject *obj, ObjectId *idp) = 0; - virtual JSObject *unwrap(JSContext *cx, ObjectId id) = 0; + virtual bool makeId(JSContext* cx, JSObject* obj, ObjectId* idp) = 0; + virtual JSObject* unwrap(JSContext* cx, ObjectId id) = 0; - bool unwrap(JSContext *cx, ObjectId id, JS::MutableHandle objp) { + bool unwrap(JSContext* cx, ObjectId id, JS::MutableHandle objp) { if (!id) { objp.set(nullptr); return true; @@ -121,10 +121,10 @@ class JavaScriptShared return bool(objp.get()); } - static void ConvertID(const nsID &from, JSIID *to); - static void ConvertID(const JSIID &from, nsID *to); + static void ConvertID(const nsID& from, JSIID* to); + static void ConvertID(const JSIID& from, nsID* to); - JSObject *findObject(uint32_t objId) { + JSObject* findObject(uint32_t objId) { return objects_.find(objId); } diff --git a/js/public/Anchor.h b/js/public/Anchor.h index d9ed3fd750..5a8378fa3a 100644 --- a/js/public/Anchor.h +++ b/js/public/Anchor.h @@ -16,7 +16,7 @@ namespace JS { /* - * Protecting non-Value, non-JSObject *, non-JSString * values from collection + * Protecting non-Value, non-JSObject*, non-JSString * values from collection * * Most of the time, the garbage collector's conservative stack scanner works * behind the scenes, finding all live values and protecting them from being @@ -31,8 +31,8 @@ namespace JS { * * So suppose we have: * - * void f(JSString *str) { - * const jschar *ch = JS_GetStringCharsZ(str); + * void f(JSString* str) { + * const jschar* ch = JS_GetStringCharsZ(str); * ... do stuff with ch, but no uses of str ...; * } * @@ -48,7 +48,7 @@ namespace JS { * doesn't recognize from 2) a thing Y the scanner does recognize, and 3) if Y * gets garbage-collected, then X gets freed. If we have code like this: * - * void g(JSObject *obj) { + * void g(JSObject* obj) { * JS::Value x; * JS_GetProperty(obj, "x", &x); * ... do stuff with x ... @@ -65,9 +65,9 @@ namespace JS { * derived values like |ch| alive throughout the Anchor's lifetime. We could * fix the above code as follows: * - * void f(JSString *str) { - * JS::Anchor a_str(str); - * const jschar *ch = JS_GetStringCharsZ(str); + * void f(JSString* str) { + * JS::Anchor a_str(str); + * const jschar* ch = JS_GetStringCharsZ(str); * ... do stuff with ch, but no uses of str ...; * } * @@ -76,15 +76,15 @@ namespace JS { * than that, we have avoided all garbage collection hazards. */ template class AnchorPermitted; -template<> class AnchorPermitted { }; -template<> class AnchorPermitted { }; -template<> class AnchorPermitted { }; -template<> class AnchorPermitted { }; -template<> class AnchorPermitted { }; -template<> class AnchorPermitted { }; +template<> class AnchorPermitted { }; +template<> class AnchorPermitted { }; +template<> class AnchorPermitted { }; +template<> class AnchorPermitted { }; +template<> class AnchorPermitted { }; +template<> class AnchorPermitted { }; template<> class AnchorPermitted { }; -template<> class AnchorPermitted { }; -template<> class AnchorPermitted { }; +template<> class AnchorPermitted { }; +template<> class AnchorPermitted { }; template class Anchor : AnchorPermitted @@ -102,7 +102,7 @@ class Anchor : AnchorPermitted * For simplicity, Anchor is treated as if it contained a GC thing, from * construction. Thus if we had * - * void operator=(const T &t) { hold = t; } + * void operator=(const T& t) { hold = t; } * * and this code * @@ -116,10 +116,10 @@ class Anchor : AnchorPermitted * always constructed, living for however long the corresponding value must * live. */ - void operator=(const T &t) MOZ_DELETE; + void operator=(const T& t) MOZ_DELETE; - Anchor(const Anchor &other) MOZ_DELETE; - void operator=(const Anchor &other) MOZ_DELETE; + Anchor(const Anchor& other) MOZ_DELETE; + void operator=(const Anchor& other) MOZ_DELETE; }; template diff --git a/js/public/CallArgs.h b/js/public/CallArgs.h index 5229b93747..f3f2e2bf67 100644 --- a/js/public/CallArgs.h +++ b/js/public/CallArgs.h @@ -9,7 +9,7 @@ * and argument count for a function call. * * The intent of JS::CallArgs and JS::CallReceiver is that they be used to - * encapsulate access to the un-abstracted |unsigned argc, Value *vp| arguments + * encapsulate access to the un-abstracted |unsigned argc, Value* vp| arguments * to a function. It's possible (albeit deprecated) to manually index into * |vp| to access the callee, |this|, and arguments of a function, and to set * its return value. It's also possible to use the supported API of JS_CALLEE, @@ -40,18 +40,18 @@ /* Typedef for native functions called by the JS VM. */ typedef bool -(* JSNative)(JSContext *cx, unsigned argc, JS::Value *vp); +(* JSNative)(JSContext* cx, unsigned argc, JS::Value* vp); /* Typedef for native functions that may be called in parallel. */ typedef bool -(* JSParallelNative)(js::ForkJoinContext *cx, unsigned argc, JS::Value *vp); +(* JSParallelNative)(js::ForkJoinContext* cx, unsigned argc, JS::Value* vp); /* * Typedef for native functions that may be called either in parallel or * sequential execution. */ typedef bool -(* JSThreadSafeNative)(js::ThreadSafeContext *cx, unsigned argc, JS::Value *vp); +(* JSThreadSafeNative)(js::ThreadSafeContext* cx, unsigned argc, JS::Value* vp); /* * Convenience wrappers for passing in ThreadSafeNative to places that expect @@ -59,11 +59,11 @@ typedef bool */ template inline bool -JSNativeThreadSafeWrapper(JSContext *cx, unsigned argc, JS::Value *vp); +JSNativeThreadSafeWrapper(JSContext* cx, unsigned argc, JS::Value* vp); template inline bool -JSParallelNativeThreadSafeWrapper(js::ForkJoinContext *cx, unsigned argc, JS::Value *vp); +JSParallelNativeThreadSafeWrapper(js::ForkJoinContext* cx, unsigned argc, JS::Value* vp); /* * Compute |this| for the |vp| inside a JSNative, either boxing primitives or @@ -75,7 +75,7 @@ JSParallelNativeThreadSafeWrapper(js::ForkJoinContext *cx, unsigned argc, JS::Va * the value is some other primitive, use |JS_ValueToObject| to box it. */ extern JS_PUBLIC_API(JS::Value) -JS_ComputeThis(JSContext *cx, JS::Value *vp); +JS_ComputeThis(JSContext* cx, JS::Value* vp); namespace JS { @@ -87,13 +87,13 @@ extern JS_PUBLIC_DATA(const HandleValue) UndefinedHandleValue; * CallReceiver is using JS::CallReceiverFromVp: * * static bool - * FunctionReturningThis(JSContext *cx, unsigned argc, JS::Value *vp) + * FunctionReturningThis(JSContext* cx, unsigned argc, JS::Value* vp) * { * JS::CallReceiver rec = JS::CallReceiverFromVp(vp); * * // Access to the callee must occur before accessing/setting * // the return value. - * JSObject &callee = rec.callee(); + * JSObject& callee = rec.callee(); * rec.rval().set(JS::ObjectValue(callee)); * * // callee() and calleev() will now assert. @@ -155,14 +155,14 @@ class MOZ_STACK_CLASS CallReceiverBase : public UsedRvalBase< > { protected: - Value *argv_; + Value* argv_; public: /* * Returns the function being called, as an object. Must not be called * after rval() has been used! */ - JSObject &callee() const { + JSObject& callee() const { MOZ_ASSERT(!this->usedRval_); return argv_[-2].toObject(); } @@ -189,7 +189,7 @@ class MOZ_STACK_CLASS CallReceiverBase : public UsedRvalBase< return HandleValue::fromMarkedLocation(&argv_[-1]); } - Value computeThis(JSContext *cx) const { + Value computeThis(JSContext* cx) const { if (thisv().isObject()) return thisv(); @@ -224,9 +224,9 @@ class MOZ_STACK_CLASS CallReceiverBase : public UsedRvalBase< // These methods are only intended for internal use. Embedders shouldn't // use them! - Value *base() const { return argv_ - 2; } + Value* base() const { return argv_ - 2; } - Value *spAfterCall() const { + Value* spAfterCall() const { this->setUsedRval(); return argv_ - 1; } @@ -255,12 +255,12 @@ class MOZ_STACK_CLASS CallReceiverBase : public UsedRvalBase< class MOZ_STACK_CLASS CallReceiver : public detail::CallReceiverBase { private: - friend CallReceiver CallReceiverFromVp(Value *vp); - friend CallReceiver CallReceiverFromArgv(Value *argv); + friend CallReceiver CallReceiverFromVp(Value* vp); + friend CallReceiver CallReceiverFromArgv(Value* argv); }; MOZ_ALWAYS_INLINE CallReceiver -CallReceiverFromArgv(Value *argv) +CallReceiverFromArgv(Value* argv) { CallReceiver receiver; receiver.clearUsedRval(); @@ -269,7 +269,7 @@ CallReceiverFromArgv(Value *argv) } MOZ_ALWAYS_INLINE CallReceiver -CallReceiverFromVp(Value *vp) +CallReceiverFromVp(Value* vp) { return CallReceiverFromArgv(vp + 2); } @@ -280,7 +280,7 @@ CallReceiverFromVp(Value *vp) * like so, using JS::CallArgsFromVp: * * static bool - * FunctionReturningArgcTimesArg0(JSContext *cx, unsigned argc, JS::Value *vp) + * FunctionReturningArgcTimesArg0(JSContext* cx, unsigned argc, JS::Value* vp) * { * JS::CallArgs args = JS::CallArgsFromVp(argc, vp); * @@ -342,8 +342,8 @@ class MOZ_STACK_CLASS CallArgsBase : // here than we'd like (because they're hackish and drop assertions). Try // to avoid using these if you can. - Value *array() const { return this->argv_; } - Value *end() const { return this->argv_ + argc_; } + Value* array() const { return this->argv_; } + Value* end() const { return this->argv_ + argc_; } }; } // namespace detail @@ -351,10 +351,10 @@ class MOZ_STACK_CLASS CallArgsBase : class MOZ_STACK_CLASS CallArgs : public detail::CallArgsBase { private: - friend CallArgs CallArgsFromVp(unsigned argc, Value *vp); - friend CallArgs CallArgsFromSp(unsigned argc, Value *sp); + friend CallArgs CallArgsFromVp(unsigned argc, Value* vp); + friend CallArgs CallArgsFromSp(unsigned argc, Value* sp); - static CallArgs create(unsigned argc, Value *argv) { + static CallArgs create(unsigned argc, Value* argv) { CallArgs args; args.clearUsedRval(); args.argv_ = argv; @@ -365,7 +365,7 @@ class MOZ_STACK_CLASS CallArgs : public detail::CallArgsBase(cx, args); @@ -93,7 +93,7 @@ CallMethodIfWrapped(JSContext *cx, IsAcceptableThis test, NativeImpl impl, CallA // template MOZ_ALWAYS_INLINE bool -CallNonGenericMethod(JSContext *cx, CallArgs args) +CallNonGenericMethod(JSContext* cx, CallArgs args) { HandleValue thisv = args.thisv(); if (Test(thisv)) @@ -103,7 +103,7 @@ CallNonGenericMethod(JSContext *cx, CallArgs args) } MOZ_ALWAYS_INLINE bool -CallNonGenericMethod(JSContext *cx, IsAcceptableThis Test, NativeImpl Impl, CallArgs args) +CallNonGenericMethod(JSContext* cx, IsAcceptableThis Test, NativeImpl Impl, CallArgs args) { HandleValue thisv = args.thisv(); if (Test(thisv)) diff --git a/js/public/CharacterEncoding.h b/js/public/CharacterEncoding.h index 0626b129d2..e05db405b9 100644 --- a/js/public/CharacterEncoding.h +++ b/js/public/CharacterEncoding.h @@ -31,9 +31,9 @@ class Latin1Chars : public mozilla::Range public: Latin1Chars() : Base() {} - Latin1Chars(char *aBytes, size_t aLength) : Base(reinterpret_cast(aBytes), aLength) {} - Latin1Chars(const char *aBytes, size_t aLength) - : Base(reinterpret_cast(const_cast(aBytes)), aLength) + Latin1Chars(char* aBytes, size_t aLength) : Base(reinterpret_cast(aBytes), aLength) {} + Latin1Chars(const char* aBytes, size_t aLength) + : Base(reinterpret_cast(const_cast(aBytes)), aLength) {} }; @@ -47,13 +47,13 @@ class Latin1CharsZ : public mozilla::RangedPtr public: Latin1CharsZ() : Base(nullptr, 0) {} - Latin1CharsZ(char *aBytes, size_t aLength) - : Base(reinterpret_cast(aBytes), aLength) + Latin1CharsZ(char* aBytes, size_t aLength) + : Base(reinterpret_cast(aBytes), aLength) { MOZ_ASSERT(aBytes[aLength] == '\0'); } - Latin1CharsZ(unsigned char *aBytes, size_t aLength) + Latin1CharsZ(unsigned char* aBytes, size_t aLength) : Base(aBytes, aLength) { MOZ_ASSERT(aBytes[aLength] == '\0'); @@ -61,7 +61,7 @@ class Latin1CharsZ : public mozilla::RangedPtr using Base::operator=; - char *c_str() { return reinterpret_cast(get()); } + char* c_str() { return reinterpret_cast(get()); } }; class UTF8Chars : public mozilla::Range @@ -70,11 +70,11 @@ class UTF8Chars : public mozilla::Range public: UTF8Chars() : Base() {} - UTF8Chars(char *aBytes, size_t aLength) - : Base(reinterpret_cast(aBytes), aLength) + UTF8Chars(char* aBytes, size_t aLength) + : Base(reinterpret_cast(aBytes), aLength) {} - UTF8Chars(const char *aBytes, size_t aLength) - : Base(reinterpret_cast(const_cast(aBytes)), aLength) + UTF8Chars(const char* aBytes, size_t aLength) + : Base(reinterpret_cast(const_cast(aBytes)), aLength) {} }; @@ -88,13 +88,13 @@ class UTF8CharsZ : public mozilla::RangedPtr public: UTF8CharsZ() : Base(nullptr, 0) {} - UTF8CharsZ(char *aBytes, size_t aLength) - : Base(reinterpret_cast(aBytes), aLength) + UTF8CharsZ(char* aBytes, size_t aLength) + : Base(reinterpret_cast(aBytes), aLength) { MOZ_ASSERT(aBytes[aLength] == '\0'); } - UTF8CharsZ(unsigned char *aBytes, size_t aLength) + UTF8CharsZ(unsigned char* aBytes, size_t aLength) : Base(aBytes, aLength) { MOZ_ASSERT(aBytes[aLength] == '\0'); @@ -102,7 +102,7 @@ class UTF8CharsZ : public mozilla::RangedPtr using Base::operator=; - char *c_str() { return reinterpret_cast(get()); } + char* c_str() { return reinterpret_cast(get()); } }; /* @@ -119,8 +119,8 @@ class TwoByteChars : public mozilla::Range public: TwoByteChars() : Base() {} - TwoByteChars(jschar *aChars, size_t aLength) : Base(aChars, aLength) {} - TwoByteChars(const jschar *aChars, size_t aLength) : Base(const_cast(aChars), aLength) {} + TwoByteChars(jschar* aChars, size_t aLength) : Base(aChars, aLength) {} + TwoByteChars(const jschar* aChars, size_t aLength) : Base(const_cast(aChars), aLength) {} }; /* @@ -133,7 +133,7 @@ class TwoByteCharsZ : public mozilla::RangedPtr public: TwoByteCharsZ() : Base(nullptr, 0) {} - TwoByteCharsZ(jschar *chars, size_t length) + TwoByteCharsZ(jschar* chars, size_t length) : Base(chars, length) { MOZ_ASSERT(chars[length] == '\0'); @@ -150,10 +150,10 @@ typedef mozilla::RangedPtr ConstCharPtr; class ConstTwoByteChars : public mozilla::RangedPtr { public: - ConstTwoByteChars(const ConstTwoByteChars &s) : ConstCharPtr(s) {} - ConstTwoByteChars(const mozilla::RangedPtr &s) : ConstCharPtr(s) {} - ConstTwoByteChars(const jschar *s, size_t len) : ConstCharPtr(s, len) {} - ConstTwoByteChars(const jschar *pos, const jschar *start, size_t len) + ConstTwoByteChars(const ConstTwoByteChars& s) : ConstCharPtr(s) {} + ConstTwoByteChars(const mozilla::RangedPtr& s) : ConstCharPtr(s) {} + ConstTwoByteChars(const jschar* s, size_t len) : ConstCharPtr(s, len) {} + ConstTwoByteChars(const jschar* pos, const jschar* start, size_t len) : ConstCharPtr(pos, start, len) {} @@ -172,13 +172,13 @@ class ConstTwoByteChars : public mozilla::RangedPtr * This method cannot trigger GC. */ extern Latin1CharsZ -LossyTwoByteCharsToNewLatin1CharsZ(js::ThreadSafeContext *cx, TwoByteChars tbchars); +LossyTwoByteCharsToNewLatin1CharsZ(js::ThreadSafeContext* cx, TwoByteChars tbchars); extern UTF8CharsZ -TwoByteCharsToNewUTF8CharsZ(js::ThreadSafeContext *cx, TwoByteChars tbchars); +TwoByteCharsToNewUTF8CharsZ(js::ThreadSafeContext* cx, TwoByteChars tbchars); uint32_t -Utf8ToOneUcs4Char(const uint8_t *utf8Buffer, int utf8Length); +Utf8ToOneUcs4Char(const uint8_t* utf8Buffer, int utf8Length); /* * Inflate bytes in UTF-8 encoding to jschars. @@ -187,7 +187,7 @@ Utf8ToOneUcs4Char(const uint8_t *utf8Buffer, int utf8Length); * its length; the length value excludes the trailing null. */ extern TwoByteCharsZ -UTF8CharsToNewTwoByteCharsZ(JSContext *cx, const UTF8Chars utf8, size_t *outlen); +UTF8CharsToNewTwoByteCharsZ(JSContext* cx, const UTF8Chars utf8, size_t* outlen); /* * The same as UTF8CharsToNewTwoByteCharsZ(), except that any malformed UTF-8 characters @@ -195,11 +195,11 @@ UTF8CharsToNewTwoByteCharsZ(JSContext *cx, const UTF8Chars utf8, size_t *outlen) * input. */ extern TwoByteCharsZ -LossyUTF8CharsToNewTwoByteCharsZ(JSContext *cx, const UTF8Chars utf8, size_t *outlen); +LossyUTF8CharsToNewTwoByteCharsZ(JSContext* cx, const UTF8Chars utf8, size_t* outlen); } // namespace JS -inline void JS_free(JS::Latin1CharsZ &ptr) { js_free((void*)ptr.get()); } -inline void JS_free(JS::UTF8CharsZ &ptr) { js_free((void*)ptr.get()); } +inline void JS_free(JS::Latin1CharsZ& ptr) { js_free((void*)ptr.get()); } +inline void JS_free(JS::UTF8CharsZ& ptr) { js_free((void*)ptr.get()); } #endif /* js_CharacterEncoding_h */ diff --git a/js/public/Class.h b/js/public/Class.h index 46f7d39cfb..66563f5ab4 100644 --- a/js/public/Class.h +++ b/js/public/Class.h @@ -46,7 +46,7 @@ extern JS_FRIEND_DATA(const js::Class* const) FunctionClassPtr; // be a string (Unicode property identifier) or an int (element index). The // *vp out parameter, on success, is the new property value after the action. typedef bool -(* JSPropertyOp)(JSContext *cx, JS::HandleObject obj, JS::HandleId id, +(* JSPropertyOp)(JSContext* cx, JS::HandleObject obj, JS::HandleId id, JS::MutableHandleValue vp); // Set a property named by id in obj, treating the assignment as strict @@ -55,7 +55,7 @@ typedef bool // parameter, on success, is the new property value after the // set. typedef bool -(* JSStrictPropertyOp)(JSContext *cx, JS::HandleObject obj, JS::HandleId id, +(* JSStrictPropertyOp)(JSContext* cx, JS::HandleObject obj, JS::HandleId id, bool strict, JS::MutableHandleValue vp); // Delete a property named by id in obj. @@ -72,8 +72,8 @@ typedef bool // property, or an inherited property, is allowed -- it's just pointless), // set *succeeded to true and return true. typedef bool -(* JSDeletePropertyOp)(JSContext *cx, JS::HandleObject obj, JS::HandleId id, - bool *succeeded); +(* JSDeletePropertyOp)(JSContext* cx, JS::HandleObject obj, JS::HandleId id, + bool* succeeded); // This function type is used for callbacks that enumerate the properties of // a JSObject. The behavior depends on the value of enum_op: @@ -106,13 +106,13 @@ typedef bool // The return value is used to indicate success, with a value of false // indicating failure. typedef bool -(* JSNewEnumerateOp)(JSContext *cx, JS::HandleObject obj, JSIterateOp enum_op, +(* JSNewEnumerateOp)(JSContext* cx, JS::HandleObject obj, JSIterateOp enum_op, JS::MutableHandleValue statep, JS::MutableHandleId idp); // The old-style JSClass.enumerate op should define all lazy properties not // yet reflected in obj. typedef bool -(* JSEnumerateOp)(JSContext *cx, JS::HandleObject obj); +(* JSEnumerateOp)(JSContext* cx, JS::HandleObject obj); // Resolve a lazy property named by id in obj by defining it directly in obj. // Lazy properties are those reflected from some peer native property space @@ -125,42 +125,42 @@ typedef bool // // NB: JSNewResolveOp provides a cheaper way to resolve lazy properties. typedef bool -(* JSResolveOp)(JSContext *cx, JS::HandleObject obj, JS::HandleId id); +(* JSResolveOp)(JSContext* cx, JS::HandleObject obj, JS::HandleId id); // Like JSResolveOp, except the *objp out parameter, on success, should be null // to indicate that id was not resolved; and non-null, referring to obj or one -// of its prototypes, if id was resolved. The hook may assume *objp is null on +// of its prototypes, if id was resolved. The hook may assume* objp is null on // entry. // // This hook instead of JSResolveOp is called via the JSClass.resolve member // if JSCLASS_NEW_RESOLVE is set in JSClass.flags. typedef bool -(* JSNewResolveOp)(JSContext *cx, JS::HandleObject obj, JS::HandleId id, +(* JSNewResolveOp)(JSContext* cx, JS::HandleObject obj, JS::HandleId id, JS::MutableHandleObject objp); // Convert obj to the given type, returning true with the resulting value in // *vp on success, and returning false on error or exception. typedef bool -(* JSConvertOp)(JSContext *cx, JS::HandleObject obj, JSType type, +(* JSConvertOp)(JSContext* cx, JS::HandleObject obj, JSType type, JS::MutableHandleValue vp); // Finalize obj, which the garbage collector has determined to be unreachable // from other live objects or from GC roots. Obviously, finalizers must never // store a reference to obj. typedef void -(* JSFinalizeOp)(JSFreeOp *fop, JSObject *obj); +(* JSFinalizeOp)(JSFreeOp* fop, JSObject* obj); // Finalizes external strings created by JS_NewExternalString. struct JSStringFinalizer { - void (*finalize)(const JSStringFinalizer *fin, jschar *chars); + void (*finalize)(const JSStringFinalizer* fin, jschar* chars); }; // Check whether v is an instance of obj. Return false on error or exception, // true on success with true in *bp if v is an instance of obj, false in // *bp otherwise. typedef bool -(* JSHasInstanceOp)(JSContext *cx, JS::HandleObject obj, JS::MutableHandleValue vp, - bool *bp); +(* JSHasInstanceOp)(JSContext* cx, JS::HandleObject obj, JS::MutableHandleValue vp, + bool* bp); // Function type for trace operation of the class called to enumerate all // traceable things reachable from obj's private data structure. For each such @@ -175,90 +175,90 @@ typedef bool // JS_IsGCMarkingTracer and apply a special code like emptying caches or // marking its native structures. typedef void -(* JSTraceOp)(JSTracer *trc, JSObject *obj); +(* JSTraceOp)(JSTracer* trc, JSObject* obj); // A generic type for functions mapping an object to another object, or null // if an error or exception was thrown on cx. -typedef JSObject * -(* JSObjectOp)(JSContext *cx, JS::HandleObject obj); +typedef JSObject* +(* JSObjectOp)(JSContext* cx, JS::HandleObject obj); // Hook that creates an iterator object for a given object. Returns the // iterator object or null if an error or exception was thrown on cx. -typedef JSObject * -(* JSIteratorOp)(JSContext *cx, JS::HandleObject obj, bool keysonly); +typedef JSObject* +(* JSIteratorOp)(JSContext* cx, JS::HandleObject obj, bool keysonly); -typedef JSObject * -(* JSWeakmapKeyDelegateOp)(JSObject *obj); +typedef JSObject* +(* JSWeakmapKeyDelegateOp)(JSObject* obj); /* js::Class operation signatures. */ namespace js { typedef bool -(* LookupGenericOp)(JSContext *cx, JS::HandleObject obj, JS::HandleId id, +(* LookupGenericOp)(JSContext* cx, JS::HandleObject obj, JS::HandleId id, JS::MutableHandleObject objp, JS::MutableHandle propp); typedef bool -(* LookupPropOp)(JSContext *cx, JS::HandleObject obj, JS::Handle name, +(* LookupPropOp)(JSContext* cx, JS::HandleObject obj, JS::Handle name, JS::MutableHandleObject objp, JS::MutableHandle propp); typedef bool -(* LookupElementOp)(JSContext *cx, JS::HandleObject obj, uint32_t index, +(* LookupElementOp)(JSContext* cx, JS::HandleObject obj, uint32_t index, JS::MutableHandleObject objp, JS::MutableHandle propp); typedef bool -(* DefineGenericOp)(JSContext *cx, JS::HandleObject obj, JS::HandleId id, JS::HandleValue value, +(* DefineGenericOp)(JSContext* cx, JS::HandleObject obj, JS::HandleId id, JS::HandleValue value, JSPropertyOp getter, JSStrictPropertyOp setter, unsigned attrs); typedef bool -(* DefinePropOp)(JSContext *cx, JS::HandleObject obj, JS::Handle name, +(* DefinePropOp)(JSContext* cx, JS::HandleObject obj, JS::Handle name, JS::HandleValue value, JSPropertyOp getter, JSStrictPropertyOp setter, unsigned attrs); typedef bool -(* DefineElementOp)(JSContext *cx, JS::HandleObject obj, uint32_t index, JS::HandleValue value, +(* DefineElementOp)(JSContext* cx, JS::HandleObject obj, uint32_t index, JS::HandleValue value, JSPropertyOp getter, JSStrictPropertyOp setter, unsigned attrs); typedef bool -(* GenericIdOp)(JSContext *cx, JS::HandleObject obj, JS::HandleObject receiver, JS::HandleId id, +(* GenericIdOp)(JSContext* cx, JS::HandleObject obj, JS::HandleObject receiver, JS::HandleId id, JS::MutableHandleValue vp); typedef bool -(* PropertyIdOp)(JSContext *cx, JS::HandleObject obj, JS::HandleObject receiver, +(* PropertyIdOp)(JSContext* cx, JS::HandleObject obj, JS::HandleObject receiver, JS::Handle name, JS::MutableHandleValue vp); typedef bool -(* ElementIdOp)(JSContext *cx, JS::HandleObject obj, JS::HandleObject receiver, uint32_t index, +(* ElementIdOp)(JSContext* cx, JS::HandleObject obj, JS::HandleObject receiver, uint32_t index, JS::MutableHandleValue vp); typedef bool -(* StrictGenericIdOp)(JSContext *cx, JS::HandleObject obj, JS::HandleId id, +(* StrictGenericIdOp)(JSContext* cx, JS::HandleObject obj, JS::HandleId id, JS::MutableHandleValue vp, bool strict); typedef bool -(* StrictPropertyIdOp)(JSContext *cx, JS::HandleObject obj, JS::Handle name, +(* StrictPropertyIdOp)(JSContext* cx, JS::HandleObject obj, JS::Handle name, JS::MutableHandleValue vp, bool strict); typedef bool -(* StrictElementIdOp)(JSContext *cx, JS::HandleObject obj, uint32_t index, +(* StrictElementIdOp)(JSContext* cx, JS::HandleObject obj, uint32_t index, JS::MutableHandleValue vp, bool strict); typedef bool -(* GenericAttributesOp)(JSContext *cx, JS::HandleObject obj, JS::HandleId id, unsigned *attrsp); +(* GenericAttributesOp)(JSContext* cx, JS::HandleObject obj, JS::HandleId id, unsigned* attrsp); typedef bool -(* PropertyAttributesOp)(JSContext *cx, JS::HandleObject obj, JS::Handle name, - unsigned *attrsp); +(* PropertyAttributesOp)(JSContext* cx, JS::HandleObject obj, JS::Handle name, + unsigned* attrsp); typedef bool -(* DeletePropertyOp)(JSContext *cx, JS::HandleObject obj, JS::Handle name, - bool *succeeded); +(* DeletePropertyOp)(JSContext* cx, JS::HandleObject obj, JS::Handle name, + bool* succeeded); typedef bool -(* DeleteElementOp)(JSContext *cx, JS::HandleObject obj, uint32_t index, bool *succeeded); +(* DeleteElementOp)(JSContext* cx, JS::HandleObject obj, uint32_t index, bool* succeeded); typedef bool -(* WatchOp)(JSContext *cx, JS::HandleObject obj, JS::HandleId id, JS::HandleObject callable); +(* WatchOp)(JSContext* cx, JS::HandleObject obj, JS::HandleId id, JS::HandleObject callable); typedef bool -(* UnwatchOp)(JSContext *cx, JS::HandleObject obj, JS::HandleId id); +(* UnwatchOp)(JSContext* cx, JS::HandleObject obj, JS::HandleId id); typedef bool -(* SliceOp)(JSContext *cx, JS::HandleObject obj, uint32_t begin, uint32_t end, +(* SliceOp)(JSContext* cx, JS::HandleObject obj, uint32_t begin, uint32_t end, JS::HandleObject result); // result is actually preallocted. -typedef JSObject * -(* ObjectOp)(JSContext *cx, JS::HandleObject obj); +typedef JSObject* +(* ObjectOp)(JSContext* cx, JS::HandleObject obj); typedef void -(* FinalizeOp)(FreeOp *fop, JSObject *obj); +(* FinalizeOp)(FreeOp* fop, JSObject* obj); #define JS_CLASS_MEMBERS(FinalizeOpType) \ - const char *name; \ + const char* name; \ uint32_t flags; \ \ /* Mandatory function pointer members. */ \ @@ -278,18 +278,18 @@ typedef void JSTraceOp trace // Callback for the creation of constructor and prototype objects. -typedef JSObject *(*ClassObjectCreationOp)(JSContext *cx, JSProtoKey key); +typedef JSObject* (*ClassObjectCreationOp)(JSContext* cx, JSProtoKey key); // Callback for custom post-processing after class initialization via ClassSpec. -typedef bool (*FinishClassInitOp)(JSContext *cx, JS::HandleObject ctor, +typedef bool (*FinishClassInitOp)(JSContext* cx, JS::HandleObject ctor, JS::HandleObject proto); struct ClassSpec { ClassObjectCreationOp createConstructor; ClassObjectCreationOp createPrototype; - const JSFunctionSpec *constructorFunctions; - const JSFunctionSpec *prototypeFunctions; + const JSFunctionSpec* constructorFunctions; + const JSFunctionSpec* prototypeFunctions; FinishClassInitOp finishInit; bool defined() const { return !!createConstructor; } }; @@ -363,13 +363,13 @@ typedef void (*JSClassInternal)(); struct JSClass { JS_CLASS_MEMBERS(JSFinalizeOp); - void *reserved[31]; + void* reserved[31]; }; #define JSCLASS_HAS_PRIVATE (1<<0) // objects have private slot #define JSCLASS_NEW_ENUMERATE (1<<1) // has JSNewEnumerateOp hook #define JSCLASS_NEW_RESOLVE (1<<2) // has JSNewResolveOp hook -#define JSCLASS_PRIVATE_IS_NSISUPPORTS (1<<3) // private is (nsISupports *) +#define JSCLASS_PRIVATE_IS_NSISUPPORTS (1<<3) // private is (nsISupports*) #define JSCLASS_IS_DOMJSCLASS (1<<4) // objects are DOM #define JSCLASS_IMPLEMENTS_BARRIERS (1<<5) // Correctly implements GC read // and write barriers @@ -503,16 +503,16 @@ JS_STATIC_ASSERT(offsetof(JSClass, hasInstance) == offsetof(Class, hasInstance)) JS_STATIC_ASSERT(offsetof(JSClass, trace) == offsetof(Class, trace)); JS_STATIC_ASSERT(sizeof(JSClass) == sizeof(Class)); -static MOZ_ALWAYS_INLINE const JSClass * -Jsvalify(const Class *c) +static MOZ_ALWAYS_INLINE const JSClass* +Jsvalify(const Class* c) { - return (const JSClass *)c; + return (const JSClass*)c; } -static MOZ_ALWAYS_INLINE const Class * -Valueify(const JSClass *c) +static MOZ_ALWAYS_INLINE const Class* +Valueify(const JSClass* c) { - return (const Class *)c; + return (const Class*)c; } /* @@ -534,11 +534,11 @@ enum ESClassValue { * may be a proxy). */ inline bool -ObjectClassIs(JSObject &obj, ESClassValue classValue, JSContext *cx); +ObjectClassIs(JSObject& obj, ESClassValue classValue, JSContext* cx); /* Just a helper that checks v.isObject before calling ObjectClassIs. */ inline bool -IsObjectWithClass(const JS::Value &v, ESClassValue classValue, JSContext *cx); +IsObjectWithClass(const JS::Value& v, ESClassValue classValue, JSContext* cx); } /* namespace js */ diff --git a/js/public/GCAPI.h b/js/public/GCAPI.h index c6c5b78662..93cd76b075 100644 --- a/js/public/GCAPI.h +++ b/js/public/GCAPI.h @@ -127,13 +127,13 @@ enum Reason { * Schedule the given zone to be collected as part of the next GC. */ extern JS_FRIEND_API(void) -PrepareZoneForGC(Zone *zone); +PrepareZoneForGC(Zone* zone); /* * Schedule all zones to be collected in the next GC. */ extern JS_FRIEND_API(void) -PrepareForFullGC(JSRuntime *rt); +PrepareForFullGC(JSRuntime* rt); /* * When performing an incremental GC, the zones that were selected for the @@ -141,21 +141,21 @@ PrepareForFullGC(JSRuntime *rt); * This function selects those slices automatically. */ extern JS_FRIEND_API(void) -PrepareForIncrementalGC(JSRuntime *rt); +PrepareForIncrementalGC(JSRuntime* rt); /* * Returns true if any zone in the system has been scheduled for GC with one of * the functions above or by the JS engine. */ extern JS_FRIEND_API(bool) -IsGCScheduled(JSRuntime *rt); +IsGCScheduled(JSRuntime* rt); /* * Undoes the effect of the Prepare methods above. The given zone will not be * collected in the next GC. */ extern JS_FRIEND_API(void) -SkipZoneForGC(Zone *zone); +SkipZoneForGC(Zone* zone); /* * Non-Incremental GC: @@ -169,7 +169,7 @@ SkipZoneForGC(Zone *zone); * of internal references. */ extern JS_FRIEND_API(void) -GCForReason(JSRuntime *rt, gcreason::Reason reason); +GCForReason(JSRuntime* rt, gcreason::Reason reason); /* * Perform a non-incremental collection after clearing caches and other @@ -177,7 +177,7 @@ GCForReason(JSRuntime *rt, gcreason::Reason reason); * in the system. */ extern JS_FRIEND_API(void) -ShrinkingGC(JSRuntime *rt, gcreason::Reason reason); +ShrinkingGC(JSRuntime* rt, gcreason::Reason reason); /* * Incremental GC: @@ -212,7 +212,7 @@ ShrinkingGC(JSRuntime *rt, gcreason::Reason reason); * shorter than the requested interval. */ extern JS_FRIEND_API(void) -IncrementalGC(JSRuntime *rt, gcreason::Reason reason, int64_t millis = 0); +IncrementalGC(JSRuntime* rt, gcreason::Reason reason, int64_t millis = 0); /* * If IsIncrementalGCInProgress(rt), this call finishes the ongoing collection @@ -221,7 +221,7 @@ IncrementalGC(JSRuntime *rt, gcreason::Reason reason, int64_t millis = 0); * IsIncrementalGCInProgress(rt) will always be false. */ extern JS_FRIEND_API(void) -FinishIncrementalGC(JSRuntime *rt, gcreason::Reason reason); +FinishIncrementalGC(JSRuntime* rt, gcreason::Reason reason); enum GCProgress { /* @@ -246,12 +246,12 @@ struct JS_FRIEND_API(GCDescription) { GCDescription(bool isCompartment) : isCompartment_(isCompartment) {} - jschar *formatMessage(JSRuntime *rt) const; - jschar *formatJSON(JSRuntime *rt, uint64_t timestamp) const; + jschar* formatMessage(JSRuntime* rt) const; + jschar* formatJSON(JSRuntime* rt, uint64_t timestamp) const; }; typedef void -(* GCSliceCallback)(JSRuntime *rt, GCProgress progress, const GCDescription &desc); +(* GCSliceCallback)(JSRuntime* rt, GCProgress progress, const GCDescription& desc); /* * The GC slice callback is called at the beginning and end of each slice. This @@ -259,7 +259,7 @@ typedef void * marking. */ extern JS_FRIEND_API(GCSliceCallback) -SetGCSliceCallback(JSRuntime *rt, GCSliceCallback callback); +SetGCSliceCallback(JSRuntime* rt, GCSliceCallback callback); /* * Incremental GC defaults to enabled, but may be disabled for testing or in @@ -268,7 +268,7 @@ SetGCSliceCallback(JSRuntime *rt, GCSliceCallback callback); * disabled on the runtime. */ extern JS_FRIEND_API(void) -DisableIncrementalGC(JSRuntime *rt); +DisableIncrementalGC(JSRuntime* rt); /* * Returns true if incremental GC is enabled. Simply having incremental GC @@ -279,14 +279,14 @@ DisableIncrementalGC(JSRuntime *rt); * collections are not happening incrementally when expected. */ extern JS_FRIEND_API(bool) -IsIncrementalGCEnabled(JSRuntime *rt); +IsIncrementalGCEnabled(JSRuntime* rt); /* * Returns true while an incremental GC is ongoing, both when actively * collecting and between slices. */ JS_FRIEND_API(bool) -IsIncrementalGCInProgress(JSRuntime *rt); +IsIncrementalGCInProgress(JSRuntime* rt); /* * Returns true when writes to GC things must call an incremental (pre) barrier. @@ -294,29 +294,29 @@ IsIncrementalGCInProgress(JSRuntime *rt); * At other times, the barrier may be elided for performance. */ extern JS_FRIEND_API(bool) -IsIncrementalBarrierNeeded(JSRuntime *rt); +IsIncrementalBarrierNeeded(JSRuntime* rt); extern JS_FRIEND_API(bool) -IsIncrementalBarrierNeeded(JSContext *cx); +IsIncrementalBarrierNeeded(JSContext* cx); /* * Notify the GC that a reference to a GC thing is about to be overwritten. * These methods must be called if IsIncrementalBarrierNeeded. */ extern JS_FRIEND_API(void) -IncrementalReferenceBarrier(void *ptr, JSGCTraceKind kind); +IncrementalReferenceBarrier(void* ptr, JSGCTraceKind kind); extern JS_FRIEND_API(void) -IncrementalValueBarrier(const Value &v); +IncrementalValueBarrier(const Value& v); extern JS_FRIEND_API(void) -IncrementalObjectBarrier(JSObject *obj); +IncrementalObjectBarrier(JSObject* obj); /* * Returns true if the most recent GC ran incrementally. */ extern JS_FRIEND_API(bool) -WasIncrementalGC(JSRuntime *rt); +WasIncrementalGC(JSRuntime* rt); /* * Generational GC: @@ -329,13 +329,13 @@ WasIncrementalGC(JSRuntime *rt); /* Ensure that generational GC is disabled within some scope. */ class JS_FRIEND_API(AutoDisableGenerationalGC) { - JSRuntime *runtime; + JSRuntime* runtime; #if defined(JSGC_GENERATIONAL) && defined(JS_GC_ZEAL) bool restartVerifier; #endif public: - AutoDisableGenerationalGC(JSRuntime *rt); + AutoDisableGenerationalGC(JSRuntime* rt); ~AutoDisableGenerationalGC(); }; @@ -344,7 +344,7 @@ class JS_FRIEND_API(AutoDisableGenerationalGC) * on the given runtime. */ extern JS_FRIEND_API(bool) -IsGenerationalGCEnabled(JSRuntime *rt); +IsGenerationalGCEnabled(JSRuntime* rt); /* * Returns the GC's "number". This does not correspond directly to the number @@ -360,7 +360,7 @@ GetGCNumber(); * GC to return this memory immediately. */ extern JS_FRIEND_API(void) -ShrinkGCBuffers(JSRuntime *rt); +ShrinkGCBuffers(JSRuntime* rt); /* * Assert if any GC occured while this guard object was live. This is most @@ -378,60 +378,60 @@ ShrinkGCBuffers(JSRuntime *rt); class JS_PUBLIC_API(AutoAssertNoGC) { #ifdef JS_DEBUG - JSRuntime *runtime; + JSRuntime* runtime; size_t gcNumber; public: AutoAssertNoGC(); - AutoAssertNoGC(JSRuntime *rt); + AutoAssertNoGC(JSRuntime* rt); ~AutoAssertNoGC(); #else public: /* Prevent unreferenced local warnings in opt builds. */ AutoAssertNoGC() {} - AutoAssertNoGC(JSRuntime *) {} + AutoAssertNoGC(JSRuntime*) {} #endif }; class JS_PUBLIC_API(ObjectPtr) { - Heap value; + Heap value; public: ObjectPtr() : value(nullptr) {} - ObjectPtr(JSObject *obj) : value(obj) {} + ObjectPtr(JSObject* obj) : value(obj) {} /* Always call finalize before the destructor. */ ~ObjectPtr() { MOZ_ASSERT(!value); } - void finalize(JSRuntime *rt) { + void finalize(JSRuntime* rt) { if (IsIncrementalBarrierNeeded(rt)) IncrementalObjectBarrier(value); value = nullptr; } - void init(JSObject *obj) { value = obj; } + void init(JSObject* obj) { value = obj; } - JSObject *get() const { return value; } + JSObject* get() const { return value; } - void writeBarrierPre(JSRuntime *rt) { + void writeBarrierPre(JSRuntime* rt) { IncrementalObjectBarrier(value); } bool isAboutToBeFinalized(); - ObjectPtr &operator=(JSObject *obj) { + ObjectPtr& operator=(JSObject* obj) { IncrementalObjectBarrier(value); value = obj; return *this; } - void trace(JSTracer *trc, const char *name); + void trace(JSTracer* trc, const char* name); - JSObject &operator*() const { return *value; } - JSObject *operator->() const { return value; } - operator JSObject *() const { return value; } + JSObject& operator*() const { return *value; } + JSObject* operator->() const { return value; } + operator JSObject*() const { return value; } }; /* @@ -439,7 +439,7 @@ class JS_PUBLIC_API(ObjectPtr) * JSTRACE_SHAPE. |thing| should be non-null. */ extern JS_FRIEND_API(bool) -UnmarkGrayGCThingRecursively(void *thing, JSGCTraceKind kind); +UnmarkGrayGCThingRecursively(void* thing, JSGCTraceKind kind); /* * This should be called when an object that is marked gray is exposed to the JS @@ -448,11 +448,11 @@ UnmarkGrayGCThingRecursively(void *thing, JSGCTraceKind kind); * we conservatively mark the object black. */ static MOZ_ALWAYS_INLINE void -ExposeGCThingToActiveJS(void *thing, JSGCTraceKind kind) +ExposeGCThingToActiveJS(void* thing, JSGCTraceKind kind) { MOZ_ASSERT(kind != JSTRACE_SHAPE); - shadow::Runtime *rt = js::gc::GetGCThingRuntime(thing); + shadow::Runtime* rt = js::gc::GetGCThingRuntime(thing); #ifdef JSGC_GENERATIONAL /* * GC things residing in the nursery cannot be gray: they have no mark bits. @@ -469,14 +469,14 @@ ExposeGCThingToActiveJS(void *thing, JSGCTraceKind kind) } static MOZ_ALWAYS_INLINE void -ExposeValueToActiveJS(const Value &v) +ExposeValueToActiveJS(const Value& v) { if (v.isMarkable()) ExposeGCThingToActiveJS(v.toGCThing(), v.gcKind()); } static MOZ_ALWAYS_INLINE void -ExposeObjectToActiveJS(JSObject *obj) +ExposeObjectToActiveJS(JSObject* obj) { ExposeGCThingToActiveJS(obj, JSTRACE_OBJECT); } @@ -485,9 +485,9 @@ ExposeObjectToActiveJS(JSObject *obj) * If a GC is currently marking, mark the object black. */ static MOZ_ALWAYS_INLINE void -MarkGCThingAsLive(JSRuntime *rt_, void *thing, JSGCTraceKind kind) +MarkGCThingAsLive(JSRuntime* rt_, void* thing, JSGCTraceKind kind) { - shadow::Runtime *rt = shadow::Runtime::asShadowRuntime(rt_); + shadow::Runtime* rt = shadow::Runtime::asShadowRuntime(rt_); #ifdef JSGC_GENERATIONAL /* * Any object in the nursery will not be freed during any GC running at that time. @@ -500,9 +500,9 @@ MarkGCThingAsLive(JSRuntime *rt_, void *thing, JSGCTraceKind kind) } static MOZ_ALWAYS_INLINE void -MarkStringAsLive(Zone *zone, JSString *string) +MarkStringAsLive(Zone* zone, JSString* string) { - JSRuntime *rt = JS::shadow::Zone::asShadowZone(zone)->runtimeFromMainThread(); + JSRuntime* rt = JS::shadow::Zone::asShadowZone(zone)->runtimeFromMainThread(); MarkGCThingAsLive(rt, string, JSTRACE_STRING); } @@ -512,13 +512,13 @@ MarkStringAsLive(Zone *zone, JSString *string) * Note: this is not related to the PokeGC in nsJSEnvironment. */ extern JS_FRIEND_API(void) -PokeGC(JSRuntime *rt); +PokeGC(JSRuntime* rt); /* * Internal to Firefox. */ extern JS_FRIEND_API(void) -NotifyDidPaint(JSRuntime *rt); +NotifyDidPaint(JSRuntime* rt); } /* namespace JS */ diff --git a/js/public/HashTable.h b/js/public/HashTable.h index 8d77ca02ac..03f2347ade 100644 --- a/js/public/HashTable.h +++ b/js/public/HashTable.h @@ -60,8 +60,8 @@ class HashMap struct MapHashPolicy : HashPolicy { typedef Key KeyType; - static const Key &getKey(TableEntry &e) { return e.key(); } - static void setKey(TableEntry &e, Key &k) { HashPolicy::rekey(e.mutableKey(), k); } + static const Key& getKey(TableEntry& e) { return e.key(); } + static void setKey(TableEntry& e, Key& k) { HashPolicy::rekey(e.mutableKey(), k); } }; typedef detail::HashTable Impl; @@ -82,18 +82,18 @@ class HashMap // typedef HashMap HM; // HM h; // if (HM::Ptr p = h.lookup(3)) { - // const HM::Entry &e = *p; // p acts like a pointer to Entry + // const HM::Entry& e = *p; // p acts like a pointer to Entry // assert(p->key == 3); // Entry contains the key // char val = p->value; // and value // } // // Also see the definition of Ptr in HashTable above (with T = Entry). typedef typename Impl::Ptr Ptr; - Ptr lookup(const Lookup &l) const { return impl.lookup(l); } + Ptr lookup(const Lookup& l) const { return impl.lookup(l); } // Like lookup, but does not assert if two threads call lookup at the same // time. Only use this method when none of the threads will modify the map. - Ptr readonlyThreadsafeLookup(const Lookup &l) const { return impl.readonlyThreadsafeLookup(l); } + Ptr readonlyThreadsafeLookup(const Lookup& l) const { return impl.readonlyThreadsafeLookup(l); } // Assuming |p.found()|, remove |*p|. void remove(Ptr p) { impl.remove(p); } @@ -109,7 +109,7 @@ class HashMap // if (!h.add(p, 3, 'a')) // return false; // } - // const HM::Entry &e = *p; // p acts like a pointer to Entry + // const HM::Entry& e = *p; // p acts like a pointer to Entry // assert(p->key == 3); // Entry contains the key // char val = p->value; // and value // @@ -128,28 +128,28 @@ class HashMap // if (!h.relookupOrAdd(p, 3, 'a')) // return false; // } - // const HM::Entry &e = *p; + // const HM::Entry& e = *p; // assert(p->key == 3); // char val = p->value; typedef typename Impl::AddPtr AddPtr; - AddPtr lookupForAdd(const Lookup &l) const { + AddPtr lookupForAdd(const Lookup& l) const { return impl.lookupForAdd(l); } template - bool add(AddPtr &p, KeyInput &&k, ValueInput &&v) { + bool add(AddPtr& p, KeyInput&& k, ValueInput&& v) { Entry e(mozilla::Forward(k), mozilla::Forward(v)); return impl.add(p, mozilla::Move(e)); } template - bool add(AddPtr &p, KeyInput &&k) { + bool add(AddPtr& p, KeyInput&& k) { Entry e(mozilla::Forward(k), Value()); return impl.add(p, mozilla::Move(e)); } template - bool relookupOrAdd(AddPtr &p, KeyInput &&k, ValueInput &&v) { + bool relookupOrAdd(AddPtr& p, KeyInput&& k, ValueInput&& v) { Entry e(mozilla::Forward(k), mozilla::Forward(v)); return impl.relookupOrAdd(p, e.key(), mozilla::Move(e)); } @@ -214,13 +214,13 @@ class HashMap /************************************************** Shorthand operations */ - bool has(const Lookup &l) const { + bool has(const Lookup& l) const { return impl.lookup(l) != nullptr; } // Overwrite existing value with v. Return false on oom. template - bool put(KeyInput &&k, ValueInput &&v) { + bool put(KeyInput&& k, ValueInput&& v) { AddPtr p = lookupForAdd(k); if (p) { p->value() = mozilla::Forward(v); @@ -231,13 +231,13 @@ class HashMap // Like put, but assert that the given key is not already present. template - bool putNew(KeyInput &&k, ValueInput &&v) { + bool putNew(KeyInput&& k, ValueInput&& v) { Entry e(mozilla::Forward(k), mozilla::Forward(v)); return impl.putNew(e.key(), mozilla::Move(e)); } // Add (k,defaultValue) if |k| is not found. Return a false-y Ptr on oom. - Ptr lookupWithDefault(const Key &k, const Value &defaultValue) { + Ptr lookupWithDefault(const Key& k, const Value& defaultValue) { AddPtr p = lookupForAdd(k); if (p) return p; @@ -246,35 +246,35 @@ class HashMap } // Remove if present. - void remove(const Lookup &l) { + void remove(const Lookup& l) { if (Ptr p = lookup(l)) remove(p); } // Infallibly rekey one entry, if necessary. // Requires template parameters Key and HashPolicy::Lookup to be the same type. - void rekeyIfMoved(const Key &old_key, const Key &new_key) { + void rekeyIfMoved(const Key& old_key, const Key& new_key) { if (old_key != new_key) rekeyAs(old_key, new_key, new_key); } // Infallibly rekey one entry, if present. - void rekeyAs(const Lookup &old_lookup, const Lookup &new_lookup, const Key &new_key) { + void rekeyAs(const Lookup& old_lookup, const Lookup& new_lookup, const Key& new_key) { if (Ptr p = lookup(old_lookup)) impl.rekeyAndMaybeRehash(p, new_lookup, new_key); } // HashMap is movable - HashMap(HashMap &&rhs) : impl(mozilla::Move(rhs.impl)) {} - void operator=(HashMap &&rhs) { + HashMap(HashMap&& rhs) : impl(mozilla::Move(rhs.impl)) {} + void operator=(HashMap&& rhs) { MOZ_ASSERT(this != &rhs, "self-move assignment is prohibited"); impl = mozilla::Move(rhs.impl); } private: // HashMap is not copyable or assignable - HashMap(const HashMap &hm) MOZ_DELETE; - HashMap &operator=(const HashMap &hm) MOZ_DELETE; + HashMap(const HashMap& hm) MOZ_DELETE; + HashMap& operator=(const HashMap& hm) MOZ_DELETE; friend class Impl::Enum; }; @@ -304,8 +304,8 @@ class HashSet struct SetOps : HashPolicy { typedef T KeyType; - static const KeyType &getKey(const T &t) { return t; } - static void setKey(T &t, KeyType &k) { HashPolicy::rekey(t, k); } + static const KeyType& getKey(const T& t) { return t; } + static void setKey(T& t, KeyType& k) { HashPolicy::rekey(t, k); } }; typedef detail::HashTable Impl; @@ -331,11 +331,11 @@ class HashSet // // Also see the definition of Ptr in HashTable above. typedef typename Impl::Ptr Ptr; - Ptr lookup(const Lookup &l) const { return impl.lookup(l); } + Ptr lookup(const Lookup& l) const { return impl.lookup(l); } // Like lookup, but does not assert if two threads call lookup at the same // time. Only use this method when none of the threads will modify the map. - Ptr readonlyThreadsafeLookup(const Lookup &l) const { return impl.readonlyThreadsafeLookup(l); } + Ptr readonlyThreadsafeLookup(const Lookup& l) const { return impl.readonlyThreadsafeLookup(l); } // Assuming |p.found()|, remove |*p|. void remove(Ptr p) { impl.remove(p); } @@ -373,15 +373,15 @@ class HashSet // Note that relookupOrAdd(p,l,t) performs Lookup using |l| and adds the // entry |t|, where the caller ensures match(l,t). typedef typename Impl::AddPtr AddPtr; - AddPtr lookupForAdd(const Lookup &l) const { return impl.lookupForAdd(l); } + AddPtr lookupForAdd(const Lookup& l) const { return impl.lookupForAdd(l); } template - bool add(AddPtr &p, U &&u) { + bool add(AddPtr& p, U&& u) { return impl.add(p, mozilla::Forward(u)); } template - bool relookupOrAdd(AddPtr &p, const Lookup &l, U &&u) { + bool relookupOrAdd(AddPtr& p, const Lookup& l, U&& u) { return impl.relookupOrAdd(p, l, mozilla::Forward(u)); } @@ -442,57 +442,57 @@ class HashSet /************************************************** Shorthand operations */ - bool has(const Lookup &l) const { + bool has(const Lookup& l) const { return impl.lookup(l) != nullptr; } // Add |u| if it is not present already. Return false on oom. template - bool put(U &&u) { + bool put(U&& u) { AddPtr p = lookupForAdd(u); return p ? true : add(p, mozilla::Forward(u)); } // Like put, but assert that the given key is not already present. template - bool putNew(U &&u) { + bool putNew(U&& u) { return impl.putNew(u, mozilla::Forward(u)); } template - bool putNew(const Lookup &l, U &&u) { + bool putNew(const Lookup& l, U&& u) { return impl.putNew(l, mozilla::Forward(u)); } - void remove(const Lookup &l) { + void remove(const Lookup& l) { if (Ptr p = lookup(l)) remove(p); } // Infallibly rekey one entry, if present. // Requires template parameters T and HashPolicy::Lookup to be the same type. - void rekeyIfMoved(const Lookup &old_value, const T &new_value) { + void rekeyIfMoved(const Lookup& old_value, const T& new_value) { if (old_value != new_value) rekeyAs(old_value, new_value, new_value); } // Infallibly rekey one entry, if present. - void rekeyAs(const Lookup &old_lookup, const Lookup &new_lookup, const T &new_value) { + void rekeyAs(const Lookup& old_lookup, const Lookup& new_lookup, const T& new_value) { if (Ptr p = lookup(old_lookup)) impl.rekeyAndMaybeRehash(p, new_lookup, new_value); } // HashSet is movable - HashSet(HashSet &&rhs) : impl(mozilla::Move(rhs.impl)) {} - void operator=(HashSet &&rhs) { + HashSet(HashSet&& rhs) : impl(mozilla::Move(rhs.impl)) {} + void operator=(HashSet&& rhs) { MOZ_ASSERT(this != &rhs, "self-move assignment is prohibited"); impl = mozilla::Move(rhs.impl); } private: // HashSet is not copyable or assignable - HashSet(const HashSet &hs) MOZ_DELETE; - HashSet &operator=(const HashSet &hs) MOZ_DELETE; + HashSet(const HashSet& hs) MOZ_DELETE; + HashSet& operator=(const HashSet& hs) MOZ_DELETE; friend class Impl::Enum; }; @@ -530,7 +530,7 @@ template struct PointerHasher { typedef Key Lookup; - static HashNumber hash(const Lookup &l) { + static HashNumber hash(const Lookup& l) { MOZ_ASSERT(!JS::IsPoisonedPtr(l)); size_t word = reinterpret_cast(l) >> zeroBits; JS_STATIC_ASSERT(sizeof(HashNumber) == 4); @@ -541,12 +541,12 @@ struct PointerHasher return HashNumber((word >> 32) ^ word); #endif } - static bool match(const Key &k, const Lookup &l) { + static bool match(const Key& k, const Lookup& l) { MOZ_ASSERT(!JS::IsPoisonedPtr(k)); MOZ_ASSERT(!JS::IsPoisonedPtr(l)); return k == l; } - static void rekey(Key &k, const Key& newKey) { + static void rekey(Key& k, const Key& newKey) { k = newKey; } }; @@ -559,15 +559,15 @@ template struct DefaultHasher { typedef Key Lookup; - static HashNumber hash(const Lookup &l) { + static HashNumber hash(const Lookup& l) { // Hash if can implicitly cast to hash number type. return l; } - static bool match(const Key &k, const Lookup &l) { + static bool match(const Key& k, const Lookup& l) { // Use builtin or overloaded operator==. return k == l; } - static void rekey(Key &k, const Key& newKey) { + static void rekey(Key& k, const Key& newKey) { k = newKey; } }; @@ -575,7 +575,7 @@ struct DefaultHasher // Specialize hashing policy for pointer types. It assumes that the type is // at least word-aligned. For types with smaller size use PointerHasher. template -struct DefaultHasher : PointerHasher::value> +struct DefaultHasher : PointerHasher::value> {}; // For doubles, we can xor the two uint32s. @@ -627,12 +627,12 @@ class HashMapEntry public: template - HashMapEntry(KeyInput &&k, ValueInput &&v) + HashMapEntry(KeyInput&& k, ValueInput&& v) : key_(mozilla::Forward(k)), value_(mozilla::Forward(v)) {} - HashMapEntry(HashMapEntry &&rhs) + HashMapEntry(HashMapEntry&& rhs) : key_(mozilla::Move(rhs.key_)), value_(mozilla::Move(rhs.value_)) {} @@ -645,8 +645,8 @@ class HashMapEntry Value & value() { return value_; } private: - HashMapEntry(const HashMapEntry &) MOZ_DELETE; - void operator=(const HashMapEntry &) MOZ_DELETE; + HashMapEntry(const HashMapEntry&) MOZ_DELETE; + void operator=(const HashMapEntry&) MOZ_DELETE; }; } // namespace js @@ -688,8 +688,8 @@ class HashTableEntry return hash > sRemovedKey; } - HashTableEntry(const HashTableEntry &) MOZ_DELETE; - void operator=(const HashTableEntry &) MOZ_DELETE; + HashTableEntry(const HashTableEntry&) MOZ_DELETE; + void operator=(const HashTableEntry&) MOZ_DELETE; ~HashTableEntry() MOZ_DELETE; public: @@ -705,12 +705,12 @@ class HashTableEntry mem.addr()->~T(); } - void swap(HashTableEntry *other) { + void swap(HashTableEntry* other) { mozilla::Swap(keyHash, other->keyHash); mozilla::Swap(mem, other->mem); } - T &get() { MOZ_ASSERT(isLive()); return *mem.addr(); } + T& get() { MOZ_ASSERT(isLive()); return *mem.addr(); } bool isFree() const { return keyHash == sFreeKey; } void clearLive() { MOZ_ASSERT(isLive()); keyHash = sFreeKey; mem.addr()->~T(); } @@ -726,7 +726,7 @@ class HashTableEntry HashNumber getKeyHash() const { return keyHash & ~sCollisionBit; } template - void setLive(HashNumber hn, U &&u) + void setLive(HashNumber hn, U&& u) { MOZ_ASSERT(!isLive()); keyHash = hn; @@ -755,14 +755,14 @@ class HashTable : private AllocPolicy typedef void (Ptr::* ConvertibleToBool)(); void nonNull() {} - Entry *entry_; + Entry* entry_; #ifdef DEBUG - const HashTable *table_; + const HashTable* table_; uint32_t generation; #endif protected: - Ptr(Entry &entry, const HashTable &tableArg) + Ptr(Entry& entry, const HashTable& tableArg) : entry_(&entry) #ifdef DEBUG , table_(&tableArg) @@ -774,7 +774,7 @@ class HashTable : private AllocPolicy // Leaves Ptr uninitialized. Ptr() { #ifdef JS_DEBUG - entry_ = (Entry *)0xbad; + entry_ = (Entry*)0xbad; #endif } @@ -787,22 +787,22 @@ class HashTable : private AllocPolicy return found() ? &Ptr::nonNull : 0; } - bool operator==(const Ptr &rhs) const { + bool operator==(const Ptr& rhs) const { MOZ_ASSERT(found() && rhs.found()); return entry_ == rhs.entry_; } - bool operator!=(const Ptr &rhs) const { + bool operator!=(const Ptr& rhs) const { MOZ_ASSERT(generation == table_->generation()); return !(*this == rhs); } - T &operator*() const { + T& operator*() const { MOZ_ASSERT(generation == table_->generation()); return entry_->get(); } - T *operator->() const { + T* operator->() const { MOZ_ASSERT(generation == table_->generation()); return &entry_->get(); } @@ -815,7 +815,7 @@ class HashTable : private AllocPolicy HashNumber keyHash; mozilla::DebugOnly mutationCount; - AddPtr(Entry &entry, const HashTable &tableArg, HashNumber hn) + AddPtr(Entry& entry, const HashTable& tableArg, HashNumber hn) : Ptr(entry, tableArg), keyHash(hn), mutationCount(tableArg.mutationCount) {} @@ -833,7 +833,7 @@ class HashTable : private AllocPolicy protected: friend class HashTable; - Range(const HashTable &tableArg, Entry *c, Entry *e) + Range(const HashTable& tableArg, Entry* c, Entry* e) : cur(c) , end(e) #ifdef DEBUG @@ -847,9 +847,9 @@ class HashTable : private AllocPolicy ++cur; } - Entry *cur, *end; + Entry* cur, *end; #ifdef DEBUG - const HashTable *table_; + const HashTable* table_; uint64_t mutationCount; uint32_t generation; bool validEntry; @@ -873,7 +873,7 @@ class HashTable : private AllocPolicy return cur == end; } - T &front() const { + T& front() const { MOZ_ASSERT(validEntry); MOZ_ASSERT(!empty()); MOZ_ASSERT(generation == table_->generation()); @@ -902,17 +902,17 @@ class HashTable : private AllocPolicy { friend class HashTable; - HashTable &table_; + HashTable& table_; bool rekeyed; bool removed; /* Not copyable. */ - Enum(const Enum &) MOZ_DELETE; - void operator=(const Enum &) MOZ_DELETE; + Enum(const Enum&) MOZ_DELETE; + void operator=(const Enum&) MOZ_DELETE; public: template explicit - Enum(Map &map) : Range(map.all()), table_(map.impl), rekeyed(false), removed(false) {} + Enum(Map& map) : Range(map.all()), table_(map.impl), rekeyed(false), removed(false) {} // Removes the |front()| element from the table, leaving |front()| // invalid until the next call to |popFront()|. For example: @@ -933,7 +933,7 @@ class HashTable : private AllocPolicy // Removes the |front()| element and re-inserts it into the table with // a new key at the new Lookup position. |front()| is invalid after // this operation until the next call to |popFront()|. - void rekeyFront(const Lookup &l, const Key &k) { + void rekeyFront(const Lookup& l, const Key& k) { Ptr p(*this->cur, table_); table_.rekeyWithoutRehash(p, l, k); rekeyed = true; @@ -943,7 +943,7 @@ class HashTable : private AllocPolicy #endif } - void rekeyFront(const Key &k) { + void rekeyFront(const Key& k) { rekeyFront(k, k); } @@ -960,13 +960,13 @@ class HashTable : private AllocPolicy }; // HashTable is movable - HashTable(HashTable &&rhs) + HashTable(HashTable&& rhs) : AllocPolicy(rhs) { mozilla::PodAssign(this, &rhs); rhs.table = nullptr; } - void operator=(HashTable &&rhs) { + void operator=(HashTable&& rhs) { MOZ_ASSERT(this != &rhs, "self-move assignment is prohibited"); if (table) destroyTable(*this, table, capacity()); @@ -976,15 +976,15 @@ class HashTable : private AllocPolicy private: // HashTable is not copyable or assignable - HashTable(const HashTable &) MOZ_DELETE; - void operator=(const HashTable &) MOZ_DELETE; + HashTable(const HashTable&) MOZ_DELETE; + void operator=(const HashTable&) MOZ_DELETE; private: uint32_t hashShift; // multiplicative hash shift uint32_t entryCount; // number of entries in table uint32_t gen; // entry storage generation number uint32_t removedCount; // removed entry sentinels in table - Entry *table; // entry storage + Entry* table; // entry storage void setTableSizeLog2(unsigned sizeLog2) { @@ -1048,7 +1048,7 @@ class HashTable : private AllocPolicy return keyHash & ~sCollisionBit; } - static Entry *createTable(AllocPolicy &alloc, uint32_t capacity) + static Entry* createTable(AllocPolicy& alloc, uint32_t capacity) { static_assert(sFreeKey == 0, "newly-calloc'd tables have to be considered empty"); @@ -1057,9 +1057,9 @@ class HashTable : private AllocPolicy return static_cast(alloc.calloc_(capacity * sizeof(Entry))); } - static void destroyTable(AllocPolicy &alloc, Entry *oldTable, uint32_t capacity) + static void destroyTable(AllocPolicy& alloc, Entry* oldTable, uint32_t capacity) { - for (Entry *e = oldTable, *end = e + capacity; e < end; ++e) + for (Entry* e = oldTable, *end = e + capacity; e < end; ++e) e->destroyIfLive(); alloc.free_(oldTable); } @@ -1154,7 +1154,7 @@ class HashTable : private AllocPolicy return dh; } - static HashNumber applyDoubleHash(HashNumber h1, const DoubleHash &dh) + static HashNumber applyDoubleHash(HashNumber h1, const DoubleHash& dh) { return (h1 - dh.h2) & dh.sizeMask; } @@ -1181,12 +1181,12 @@ class HashTable : private AllocPolicy return wouldBeUnderloaded(capacity(), entryCount); } - static bool match(Entry &e, const Lookup &l) + static bool match(Entry& e, const Lookup& l) { return HashPolicy::match(HashPolicy::getKey(e.get()), l); } - Entry &lookup(const Lookup &l, HashNumber keyHash, unsigned collisionBit) const + Entry& lookup(const Lookup& l, HashNumber keyHash, unsigned collisionBit) const { MOZ_ASSERT(isLiveHash(keyHash)); MOZ_ASSERT(!(keyHash & sCollisionBit)); @@ -1196,7 +1196,7 @@ class HashTable : private AllocPolicy // Compute the primary hash address. HashNumber h1 = hash1(keyHash); - Entry *entry = &table[h1]; + Entry* entry = &table[h1]; // Miss: return space for a new entry. if (entry->isFree()) { @@ -1214,7 +1214,7 @@ class HashTable : private AllocPolicy DoubleHash dh = hash2(keyHash); // Save the first removed entry pointer so we can recycle later. - Entry *firstRemoved = nullptr; + Entry* firstRemoved = nullptr; while(true) { if (MOZ_UNLIKELY(entry->isRemoved())) { @@ -1246,7 +1246,7 @@ class HashTable : private AllocPolicy // 3. no entries have been removed from the table. // This specialized search avoids the need for recovering lookup values // from entries, which allows more flexible Lookup/Key types. - Entry &findFreeEntry(HashNumber keyHash) + Entry& findFreeEntry(HashNumber keyHash) { MOZ_ASSERT(!(keyHash & sCollisionBit)); MOZ_ASSERT(table); @@ -1256,7 +1256,7 @@ class HashTable : private AllocPolicy // Compute the primary hash address. HashNumber h1 = hash1(keyHash); - Entry *entry = &table[h1]; + Entry* entry = &table[h1]; // Miss: return space for a new entry. if (!entry->isLive()) { @@ -1287,7 +1287,7 @@ class HashTable : private AllocPolicy RebuildStatus changeTableSize(int deltaLog2) { // Look, but don't touch, until we succeed in getting new entry store. - Entry *oldTable = table; + Entry* oldTable = table; uint32_t oldCap = capacity(); uint32_t newLog2 = sHashBits - hashShift + deltaLog2; uint32_t newCapacity = JS_BIT(newLog2); @@ -1296,7 +1296,7 @@ class HashTable : private AllocPolicy return RehashFailed; } - Entry *newTable = createTable(*this, newCapacity); + Entry* newTable = createTable(*this, newCapacity); if (!newTable) return RehashFailed; @@ -1307,7 +1307,7 @@ class HashTable : private AllocPolicy table = newTable; // Copy only live entries, leaving removed ones behind. - for (Entry *src = oldTable, *end = src + oldCap; src < end; ++src) { + for (Entry* src = oldTable, *end = src + oldCap; src < end; ++src) { if (src->isLive()) { HashNumber hn = src->getKeyHash(); findFreeEntry(hn).setLive(hn, mozilla::Move(src->get())); @@ -1347,7 +1347,7 @@ class HashTable : private AllocPolicy } } - void remove(Entry &e) + void remove(Entry& e) { MOZ_ASSERT(table); METER(stats.removes++); @@ -1401,7 +1401,7 @@ class HashTable : private AllocPolicy table[i].unsetCollision(); for (size_t i = 0; i < capacity();) { - Entry *src = &table[i]; + Entry* src = &table[i]; if (!src->isLive() || src->hasCollision()) { ++i; @@ -1411,7 +1411,7 @@ class HashTable : private AllocPolicy HashNumber keyHash = src->getKeyHash(); HashNumber h1 = hash1(keyHash); DoubleHash dh = hash2(keyHash); - Entry *tgt = &table[h1]; + Entry* tgt = &table[h1]; while (true) { if (!tgt->hasCollision()) { src->swap(tgt); @@ -1438,7 +1438,7 @@ class HashTable : private AllocPolicy memset(table, 0, sizeof(*table) * capacity()); } else { uint32_t tableCapacity = capacity(); - for (Entry *e = table, *end = table + tableCapacity; e < end; ++e) + for (Entry* e = table, *end = table + tableCapacity; e < end; ++e) e->clear(); } removedCount = 0; @@ -1501,30 +1501,30 @@ class HashTable : private AllocPolicy return mallocSizeOf(this) + sizeOfExcludingThis(mallocSizeOf); } - Ptr lookup(const Lookup &l) const + Ptr lookup(const Lookup& l) const { mozilla::ReentrancyGuard g(*this); HashNumber keyHash = prepareHash(l); return Ptr(lookup(l, keyHash, 0), *this); } - Ptr readonlyThreadsafeLookup(const Lookup &l) const + Ptr readonlyThreadsafeLookup(const Lookup& l) const { HashNumber keyHash = prepareHash(l); return Ptr(lookup(l, keyHash, 0), *this); } - AddPtr lookupForAdd(const Lookup &l) const + AddPtr lookupForAdd(const Lookup& l) const { mozilla::ReentrancyGuard g(*this); HashNumber keyHash = prepareHash(l); - Entry &entry = lookup(l, keyHash, sCollisionBit); + Entry& entry = lookup(l, keyHash, sCollisionBit); AddPtr p(entry, *this, keyHash); return p; } template - bool add(AddPtr &p, U &&u) + bool add(AddPtr& p, U&& u) { mozilla::ReentrancyGuard g(*this); MOZ_ASSERT(table); @@ -1559,12 +1559,12 @@ class HashTable : private AllocPolicy // Note: |l| may be a reference to a piece of |u|, so this function // must take care not to use |l| after moving |u|. template - void putNewInfallible(const Lookup &l, U &&u) + void putNewInfallible(const Lookup& l, U&& u) { MOZ_ASSERT(table); HashNumber keyHash = prepareHash(l); - Entry *entry = &findFreeEntry(keyHash); + Entry* entry = &findFreeEntry(keyHash); if (entry->isRemoved()) { METER(stats.addOverRemoved++); @@ -1580,7 +1580,7 @@ class HashTable : private AllocPolicy // Note: |l| may be a reference to a piece of |u|, so this function // must take care not to use |l| after moving |u|. template - bool putNew(const Lookup &l, U &&u) + bool putNew(const Lookup& l, U&& u) { if (checkOverloaded() == RehashFailed) return false; @@ -1592,7 +1592,7 @@ class HashTable : private AllocPolicy // Note: |l| may be a reference to a piece of |u|, so this function // must take care not to use |l| after moving |u|. template - bool relookupOrAdd(AddPtr& p, const Lookup &l, U &&u) + bool relookupOrAdd(AddPtr& p, const Lookup& l, U&& u) { #ifdef DEBUG p.generation = generation(); @@ -1615,18 +1615,18 @@ class HashTable : private AllocPolicy checkUnderloaded(); } - void rekeyWithoutRehash(Ptr p, const Lookup &l, const Key &k) + void rekeyWithoutRehash(Ptr p, const Lookup& l, const Key& k) { MOZ_ASSERT(table); mozilla::ReentrancyGuard g(*this); MOZ_ASSERT(p.found()); typename HashTableEntry::NonConstT t(mozilla::Move(*p)); - HashPolicy::setKey(t, const_cast(k)); + HashPolicy::setKey(t, const_cast(k)); remove(*p.entry_); putNewInfallible(l, mozilla::Move(t)); } - void rekeyAndMaybeRehash(Ptr p, const Lookup &l, const Key &k) + void rekeyAndMaybeRehash(Ptr p, const Lookup& l, const Key& k) { rekeyWithoutRehash(p, l, k); checkOverRemoved(); diff --git a/js/public/HeapAPI.h b/js/public/HeapAPI.h index 47ff022b8f..0698ef1605 100644 --- a/js/public/HeapAPI.h +++ b/js/public/HeapAPI.h @@ -19,10 +19,10 @@ namespace js { // Whether the current thread is permitted access to any part of the specified // runtime or zone. JS_FRIEND_API(bool) -CurrentThreadCanAccessRuntime(JSRuntime *rt); +CurrentThreadCanAccessRuntime(JSRuntime* rt); JS_FRIEND_API(bool) -CurrentThreadCanAccessZone(JS::Zone *zone); +CurrentThreadCanAccessZone(JS::Zone* zone); namespace gc { @@ -73,19 +73,19 @@ namespace shadow { struct ArenaHeader { - JS::Zone *zone; + JS::Zone* zone; }; struct Zone { protected: - JSRuntime *const runtime_; - JSTracer *const barrierTracer_; // A pointer to the JSRuntime's |gcMarker|. + JSRuntime* const runtime_; + JSTracer* const barrierTracer_; // A pointer to the JSRuntime's |gcMarker|. public: bool needsBarrier_; - Zone(JSRuntime *runtime, JSTracer *barrierTracerArg) + Zone(JSRuntime* runtime, JSTracer* barrierTracerArg) : runtime_(runtime), barrierTracer_(barrierTracerArg), needsBarrier_(false) @@ -95,24 +95,24 @@ struct Zone return needsBarrier_; } - JSTracer *barrierTracer() { + JSTracer* barrierTracer() { MOZ_ASSERT(needsBarrier_); MOZ_ASSERT(js::CurrentThreadCanAccessRuntime(runtime_)); return barrierTracer_; } - JSRuntime *runtimeFromMainThread() const { + JSRuntime* runtimeFromMainThread() const { MOZ_ASSERT(js::CurrentThreadCanAccessRuntime(runtime_)); return runtime_; } // Note: Unrestricted access to the zone's runtime from an arbitrary // thread can easily lead to races. Use this method very carefully. - JSRuntime *runtimeFromAnyThread() const { + JSRuntime* runtimeFromAnyThread() const { return runtime_; } - static JS::shadow::Zone *asShadowZone(JS::Zone *zone) { + static JS::shadow::Zone* asShadowZone(JS::Zone* zone) { return reinterpret_cast(zone); } }; @@ -123,49 +123,49 @@ struct Zone namespace js { namespace gc { -static MOZ_ALWAYS_INLINE uintptr_t * -GetGCThingMarkBitmap(const void *thing) +static MOZ_ALWAYS_INLINE uintptr_t* +GetGCThingMarkBitmap(const void* thing) { MOZ_ASSERT(thing); uintptr_t addr = uintptr_t(thing); addr &= ~js::gc::ChunkMask; addr |= js::gc::ChunkMarkBitmapOffset; - return reinterpret_cast(addr); + return reinterpret_cast(addr); } -static MOZ_ALWAYS_INLINE JS::shadow::Runtime * -GetGCThingRuntime(const void *thing) +static MOZ_ALWAYS_INLINE JS::shadow::Runtime* +GetGCThingRuntime(const void* thing) { MOZ_ASSERT(thing); uintptr_t addr = uintptr_t(thing); addr &= ~js::gc::ChunkMask; addr |= js::gc::ChunkRuntimeOffset; - return *reinterpret_cast(addr); + return *reinterpret_cast(addr); } static MOZ_ALWAYS_INLINE void -GetGCThingMarkWordAndMask(const void *thing, uint32_t color, - uintptr_t **wordp, uintptr_t *maskp) +GetGCThingMarkWordAndMask(const void* thing, uint32_t color, + uintptr_t** wordp, uintptr_t* maskp) { uintptr_t addr = uintptr_t(thing); size_t bit = (addr & js::gc::ChunkMask) / js::gc::CellSize + color; MOZ_ASSERT(bit < js::gc::ChunkMarkBitmapBits); - uintptr_t *bitmap = GetGCThingMarkBitmap(thing); + uintptr_t* bitmap = GetGCThingMarkBitmap(thing); const uintptr_t nbits = sizeof(*bitmap) * CHAR_BIT; *maskp = uintptr_t(1) << (bit % nbits); *wordp = &bitmap[bit / nbits]; } -static MOZ_ALWAYS_INLINE JS::shadow::ArenaHeader * -GetGCThingArena(void *thing) +static MOZ_ALWAYS_INLINE JS::shadow::ArenaHeader* +GetGCThingArena(void* thing) { uintptr_t addr = uintptr_t(thing); addr &= ~js::gc::ArenaMask; - return reinterpret_cast(addr); + return reinterpret_cast(addr); } MOZ_ALWAYS_INLINE bool -IsInsideNursery(const JS::shadow::Runtime *runtime, const void *p) +IsInsideNursery(const JS::shadow::Runtime* runtime, const void* p) { #ifdef JSGC_GENERATIONAL return uintptr_t(p) >= runtime->gcNurseryStart_ && uintptr_t(p) < runtime->gcNurseryEnd_; @@ -175,7 +175,7 @@ IsInsideNursery(const JS::shadow::Runtime *runtime, const void *p) } MOZ_ALWAYS_INLINE bool -IsInsideNursery(const js::gc::Cell *cell) +IsInsideNursery(const js::gc::Cell* cell) { #ifdef JSGC_GENERATIONAL if (!cell) @@ -183,7 +183,7 @@ IsInsideNursery(const js::gc::Cell *cell) uintptr_t addr = uintptr_t(cell); addr &= ~js::gc::ChunkMask; addr |= js::gc::ChunkLocationOffset; - uint32_t location = *reinterpret_cast(addr); + uint32_t location = *reinterpret_cast(addr); JS_ASSERT(location == gc::ChunkLocationNursery || location == gc::ChunkLocationTenuredHeap); return location == gc::ChunkLocationNursery; @@ -198,21 +198,21 @@ IsInsideNursery(const js::gc::Cell *cell) namespace JS { -static MOZ_ALWAYS_INLINE Zone * -GetGCThingZone(void *thing) +static MOZ_ALWAYS_INLINE Zone* +GetGCThingZone(void* thing) { MOZ_ASSERT(thing); return js::gc::GetGCThingArena(thing)->zone; } -static MOZ_ALWAYS_INLINE Zone * -GetObjectZone(JSObject *obj) +static MOZ_ALWAYS_INLINE Zone* +GetObjectZone(JSObject* obj) { return GetGCThingZone(obj); } static MOZ_ALWAYS_INLINE bool -GCThingIsMarkedGray(void *thing) +GCThingIsMarkedGray(void* thing) { #ifdef JSGC_GENERATIONAL /* @@ -220,22 +220,22 @@ GCThingIsMarkedGray(void *thing) * All live objects in the nursery are moved to tenured at the beginning of * each GC slice, so the gray marker never sees nursery things. */ - JS::shadow::Runtime *rt = js::gc::GetGCThingRuntime(thing); + JS::shadow::Runtime* rt = js::gc::GetGCThingRuntime(thing); if (js::gc::IsInsideNursery(rt, thing)) return false; #endif - uintptr_t *word, mask; + uintptr_t* word, mask; js::gc::GetGCThingMarkWordAndMask(thing, js::gc::GRAY, &word, &mask); return *word & mask; } static MOZ_ALWAYS_INLINE bool -IsIncrementalBarrierNeededOnGCThing(shadow::Runtime *rt, void *thing, JSGCTraceKind kind) +IsIncrementalBarrierNeededOnGCThing(shadow::Runtime* rt, void* thing, JSGCTraceKind kind) { if (!rt->needsBarrier_) return false; - JS::Zone *zone = GetGCThingZone(thing); - return reinterpret_cast(zone)->needsBarrier_; + JS::Zone* zone = GetGCThingZone(thing); + return reinterpret_cast(zone)->needsBarrier_; } } /* namespace JS */ diff --git a/js/public/Id.h b/js/public/Id.h index 8841c2045a..cc3588835b 100644 --- a/js/public/Id.h +++ b/js/public/Id.h @@ -53,11 +53,11 @@ JSID_IS_STRING(jsid id) return (JSID_BITS(id) & JSID_TYPE_MASK) == 0; } -static MOZ_ALWAYS_INLINE JSString * +static MOZ_ALWAYS_INLINE JSString* JSID_TO_STRING(jsid id) { MOZ_ASSERT(JSID_IS_STRING(id)); - return (JSString *)JSID_BITS(id); + return (JSString*)JSID_BITS(id); } static MOZ_ALWAYS_INLINE bool @@ -104,15 +104,15 @@ JSID_IS_OBJECT(jsid id) (size_t)JSID_BITS(id) != JSID_TYPE_OBJECT; } -static MOZ_ALWAYS_INLINE JSObject * +static MOZ_ALWAYS_INLINE JSObject* JSID_TO_OBJECT(jsid id) { MOZ_ASSERT(JSID_IS_OBJECT(id)); - return (JSObject *)(JSID_BITS(id) & ~(size_t)JSID_TYPE_MASK); + return (JSObject*)(JSID_BITS(id) & ~(size_t)JSID_TYPE_MASK); } static MOZ_ALWAYS_INLINE jsid -OBJECT_TO_JSID(JSObject *obj) +OBJECT_TO_JSID(JSObject* obj) { jsid id; MOZ_ASSERT(obj != nullptr); @@ -128,10 +128,10 @@ JSID_IS_GCTHING(jsid id) return JSID_IS_STRING(id) || JSID_IS_OBJECT(id); } -static MOZ_ALWAYS_INLINE void * +static MOZ_ALWAYS_INLINE void* JSID_TO_GCTHING(jsid id) { - return (void *)(JSID_BITS(id) & ~(size_t)JSID_TYPE_MASK); + return (void*)(JSID_BITS(id) & ~(size_t)JSID_TYPE_MASK); } static MOZ_ALWAYS_INLINE bool @@ -175,8 +175,8 @@ template <> struct GCMethods static bool poisoned(jsid id) { return IsPoisonedId(id); } static bool needsPostBarrier(jsid id) { return false; } #ifdef JSGC_GENERATIONAL - static void postBarrier(jsid *idp) {} - static void relocate(jsid *idp) {} + static void postBarrier(jsid* idp) {} + static void relocate(jsid* idp) {} #endif }; diff --git a/js/public/MemoryMetrics.h b/js/public/MemoryMetrics.h index 423760b230..03ecf00699 100644 --- a/js/public/MemoryMetrics.h +++ b/js/public/MemoryMetrics.h @@ -72,16 +72,16 @@ JS_FRIEND_API(size_t) MemoryReportingSundriesThreshold(); // on every hash and match! Beware. struct InefficientNonFlatteningStringHashPolicy { - typedef JSString *Lookup; - static HashNumber hash(const Lookup &l); - static bool match(const JSString *const &k, const Lookup &l); + typedef JSString* Lookup; + static HashNumber hash(const Lookup& l); + static bool match(const JSString* const& k, const Lookup& l); }; struct CStringHashPolicy { - typedef const char *Lookup; - static HashNumber hash(const Lookup &l); - static bool match(const char *const &k, const Lookup &l); + typedef const char* Lookup; + static HashNumber hash(const Lookup& l); + static bool match(const char* const& k, const Lookup& l); }; // This file features many classes with numerous size_t fields, and each such @@ -136,7 +136,7 @@ struct ObjectsExtraSizes dummy() {} - void add(const ObjectsExtraSizes &other) { + void add(const ObjectsExtraSizes& other) { FOR_EACH_SIZE(ADD_OTHER_SIZE) } @@ -146,7 +146,7 @@ struct ObjectsExtraSizes return n; } - void addToTabSizes(TabSizes *sizes) const { + void addToTabSizes(TabSizes* sizes) const { FOR_EACH_SIZE(ADD_TO_TAB_SIZES) } @@ -220,12 +220,12 @@ struct StringInfo numCopies(0) {} - void add(const StringInfo &other) { + void add(const StringInfo& other) { FOR_EACH_SIZE(ADD_OTHER_SIZE); numCopies++; } - void subtract(const StringInfo &other) { + void subtract(const StringInfo& other) { FOR_EACH_SIZE(SUB_OTHER_SIZE); numCopies--; } @@ -243,7 +243,7 @@ struct StringInfo return n; } - void addToTabSizes(TabSizes *sizes) const { + void addToTabSizes(TabSizes* sizes) const { FOR_EACH_SIZE(ADD_TO_TAB_SIZES) } @@ -263,15 +263,15 @@ struct NotableStringInfo : public StringInfo static const size_t MAX_SAVED_CHARS = 1024; NotableStringInfo(); - NotableStringInfo(JSString *str, const StringInfo &info); - NotableStringInfo(NotableStringInfo &&info); - NotableStringInfo &operator=(NotableStringInfo &&info); + NotableStringInfo(JSString* str, const StringInfo& info); + NotableStringInfo(NotableStringInfo&& info); + NotableStringInfo& operator=(NotableStringInfo&& info); ~NotableStringInfo() { js_free(buffer); } - char *buffer; + char* buffer; size_t length; private: @@ -292,12 +292,12 @@ struct ScriptSourceInfo numScripts(0) {} - void add(const ScriptSourceInfo &other) { + void add(const ScriptSourceInfo& other) { FOR_EACH_SIZE(ADD_OTHER_SIZE) numScripts++; } - void subtract(const ScriptSourceInfo &other) { + void subtract(const ScriptSourceInfo& other) { FOR_EACH_SIZE(SUB_OTHER_SIZE) numScripts--; } @@ -325,15 +325,15 @@ struct ScriptSourceInfo struct NotableScriptSourceInfo : public ScriptSourceInfo { NotableScriptSourceInfo(); - NotableScriptSourceInfo(const char *filename, const ScriptSourceInfo &info); - NotableScriptSourceInfo(NotableScriptSourceInfo &&info); - NotableScriptSourceInfo &operator=(NotableScriptSourceInfo &&info); + NotableScriptSourceInfo(const char* filename, const ScriptSourceInfo& info); + NotableScriptSourceInfo(NotableScriptSourceInfo&& info); + NotableScriptSourceInfo& operator=(NotableScriptSourceInfo&& info); ~NotableScriptSourceInfo() { js_free(filename_); } - char *filename_; + char* filename_; private: NotableScriptSourceInfo(const NotableScriptSourceInfo& info) MOZ_DELETE; @@ -391,7 +391,7 @@ struct RuntimeSizes // it is filled with info about every script source in the runtime. It's // then used to fill in |notableScriptSources| (which actually gets // reported), and immediately discarded afterwards. - ScriptSourcesHashMap *allScriptSources; + ScriptSourcesHashMap* allScriptSources; js::Vector notableScriptSources; #undef FOR_EACH_SIZE @@ -419,7 +419,7 @@ struct ZoneStats isTotals(true) {} - ZoneStats(ZoneStats &&other) + ZoneStats(ZoneStats&& other) : FOR_EACH_SIZE(COPY_OTHER_SIZE) stringInfo(mozilla::Move(other.stringInfo)), extra(other.extra), @@ -438,9 +438,9 @@ struct ZoneStats js_delete(allStrings); } - bool initStrings(JSRuntime *rt); + bool initStrings(JSRuntime* rt); - void addSizes(const ZoneStats &other) { + void addSizes(const ZoneStats& other) { MOZ_ASSERT(isTotals); FOR_EACH_SIZE(ADD_OTHER_SIZE) stringInfo.add(other.stringInfo); @@ -454,7 +454,7 @@ struct ZoneStats return n; } - void addToTabSizes(JS::TabSizes *sizes) const { + void addToTabSizes(JS::TabSizes* sizes) const { MOZ_ASSERT(isTotals); FOR_EACH_SIZE(ADD_TO_TAB_SIZES) stringInfo.addToTabSizes(sizes); @@ -466,7 +466,7 @@ struct ZoneStats // |notableStrings|. FOR_EACH_SIZE(DECL_SIZE) StringInfo stringInfo; - void *extra; // This field can be used by embedders. + void* extra; // This field can be used by embedders. typedef js::HashMap notableStrings; bool isTotals; @@ -521,13 +521,13 @@ struct CompartmentStats extra() {} - CompartmentStats(const CompartmentStats &other) + CompartmentStats(const CompartmentStats& other) : FOR_EACH_SIZE(COPY_OTHER_SIZE) objectsExtra(other.objectsExtra), extra(other.extra) {} - void add(const CompartmentStats &other) { + void add(const CompartmentStats& other) { FOR_EACH_SIZE(ADD_OTHER_SIZE) objectsExtra.add(other.objectsExtra); // Do nothing with |extra|. @@ -541,7 +541,7 @@ struct CompartmentStats return n; } - void addToTabSizes(TabSizes *sizes) const { + void addToTabSizes(TabSizes* sizes) const { FOR_EACH_SIZE(ADD_TO_TAB_SIZES); objectsExtra.addToTabSizes(sizes); // Do nothing with |extra|. @@ -549,7 +549,7 @@ struct CompartmentStats FOR_EACH_SIZE(DECL_SIZE) ObjectsExtraSizes objectsExtra; - void *extra; // This field can be used by embedders. + void* extra; // This field can be used by embedders. #undef FOR_EACH_SIZE }; @@ -608,12 +608,12 @@ struct RuntimeStats CompartmentStatsVector compartmentStatsVector; ZoneStatsVector zoneStatsVector; - ZoneStats *currZoneStats; + ZoneStats* currZoneStats; mozilla::MallocSizeOf mallocSizeOf_; - virtual void initExtraCompartmentStats(JSCompartment *c, CompartmentStats *cstats) = 0; - virtual void initExtraZoneStats(JS::Zone *zone, ZoneStats *zstats) = 0; + virtual void initExtraCompartmentStats(JSCompartment* c, CompartmentStats* cstats) = 0; + virtual void initExtraZoneStats(JS::Zone* zone, ZoneStats* zstats) = 0; #undef FOR_EACH_SIZE }; @@ -623,11 +623,11 @@ class ObjectPrivateVisitor public: // Within CollectRuntimeStats, this method is called for each JS object // that has an nsISupports pointer. - virtual size_t sizeOfIncludingThis(nsISupports *aSupports) = 0; + virtual size_t sizeOfIncludingThis(nsISupports* aSupports) = 0; // A callback that gets a JSObject's nsISupports pointer, if it has one. // Note: this function does *not* addref |iface|. - typedef bool(*GetISupportsFun)(JSObject *obj, nsISupports **iface); + typedef bool(*GetISupportsFun)(JSObject* obj, nsISupports** iface); GetISupportsFun getISupports_; ObjectPrivateVisitor(GetISupportsFun getISupports) @@ -636,20 +636,20 @@ class ObjectPrivateVisitor }; extern JS_PUBLIC_API(bool) -CollectRuntimeStats(JSRuntime *rt, RuntimeStats *rtStats, ObjectPrivateVisitor *opv); +CollectRuntimeStats(JSRuntime* rt, RuntimeStats* rtStats, ObjectPrivateVisitor* opv); extern JS_PUBLIC_API(size_t) -SystemCompartmentCount(JSRuntime *rt); +SystemCompartmentCount(JSRuntime* rt); extern JS_PUBLIC_API(size_t) -UserCompartmentCount(JSRuntime *rt); +UserCompartmentCount(JSRuntime* rt); extern JS_PUBLIC_API(size_t) -PeakSizeOfTemporary(const JSRuntime *rt); +PeakSizeOfTemporary(const JSRuntime* rt); extern JS_PUBLIC_API(bool) -AddSizeOfTab(JSRuntime *rt, JS::HandleObject obj, mozilla::MallocSizeOf mallocSizeOf, - ObjectPrivateVisitor *opv, TabSizes *sizes); +AddSizeOfTab(JSRuntime* rt, JS::HandleObject obj, mozilla::MallocSizeOf mallocSizeOf, + ObjectPrivateVisitor* opv, TabSizes* sizes); } // namespace JS diff --git a/js/public/OldDebugAPI.h b/js/public/OldDebugAPI.h index fe5e336863..e091b9e2a9 100644 --- a/js/public/OldDebugAPI.h +++ b/js/public/OldDebugAPI.h @@ -29,10 +29,10 @@ class ScriptFrameIter; // Raw JSScript* because this needs to be callable from a signal handler. extern JS_PUBLIC_API(unsigned) -JS_PCToLineNumber(JSContext *cx, JSScript *script, jsbytecode *pc); +JS_PCToLineNumber(JSContext* cx, JSScript* script, jsbytecode* pc); -extern JS_PUBLIC_API(const char *) -JS_GetScriptFilename(JSScript *script); +extern JS_PUBLIC_API(const char*) +JS_GetScriptFilename(JSScript* script); namespace JS { @@ -49,27 +49,27 @@ class FrameDescription return lineno_; } - const char *filename() const { + const char* filename() const { return JS_GetScriptFilename(script_); } - JSFlatString *funDisplayName() const { + JSFlatString* funDisplayName() const { return funDisplayName_ ? JS_ASSERT_STRING_IS_FLAT(funDisplayName_) : nullptr; } // Both these locations should be traced during GC but otherwise not used; // they are implementation details. - Heap &markedLocation1() { + Heap& markedLocation1() { return script_; } - Heap &markedLocation2() { + Heap& markedLocation2() { return funDisplayName_; } private: Heap script_; Heap funDisplayName_; - jsbytecode *pc_; + jsbytecode* pc_; unsigned lineno_; bool linenoComputed; }; @@ -77,28 +77,28 @@ class FrameDescription struct StackDescription { unsigned nframes; - FrameDescription *frames; + FrameDescription* frames; }; -extern JS_PUBLIC_API(StackDescription *) -DescribeStack(JSContext *cx, unsigned maxFrames); +extern JS_PUBLIC_API(StackDescription*) +DescribeStack(JSContext* cx, unsigned maxFrames); extern JS_PUBLIC_API(void) -FreeStackDescription(JSContext *cx, StackDescription *desc); +FreeStackDescription(JSContext* cx, StackDescription* desc); -extern JS_PUBLIC_API(char *) -FormatStackDump(JSContext *cx, char *buf, bool showArgs, bool showLocals, bool showThisProps); +extern JS_PUBLIC_API(char*) +FormatStackDump(JSContext* cx, char* buf, bool showArgs, bool showLocals, bool showThisProps); } // namespace JS # ifdef JS_DEBUG -JS_FRIEND_API(void) js_DumpValue(const JS::Value &val); +JS_FRIEND_API(void) js_DumpValue(const JS::Value& val); JS_FRIEND_API(void) js_DumpId(jsid id); -JS_FRIEND_API(void) js_DumpInterpreterFrame(JSContext *cx, js::InterpreterFrame *start = nullptr); +JS_FRIEND_API(void) js_DumpInterpreterFrame(JSContext* cx, js::InterpreterFrame* start = nullptr); # endif JS_FRIEND_API(void) -js_DumpBacktrace(JSContext *cx); +js_DumpBacktrace(JSContext* cx); typedef enum JSTrapStatus { JSTRAP_ERROR, @@ -109,58 +109,58 @@ typedef enum JSTrapStatus { } JSTrapStatus; typedef JSTrapStatus -(* JSTrapHandler)(JSContext *cx, JSScript *script, jsbytecode *pc, JS::Value *rval, +(* JSTrapHandler)(JSContext* cx, JSScript* script, jsbytecode* pc, JS::Value* rval, JS::Value closure); typedef JSTrapStatus -(* JSInterruptHook)(JSContext *cx, JSScript *script, jsbytecode *pc, JS::Value *rval, - void *closure); +(* JSInterruptHook)(JSContext* cx, JSScript* script, jsbytecode* pc, JS::Value* rval, + void* closure); typedef JSTrapStatus -(* JSDebuggerHandler)(JSContext *cx, JSScript *script, jsbytecode *pc, JS::Value *rval, - void *closure); +(* JSDebuggerHandler)(JSContext* cx, JSScript* script, jsbytecode* pc, JS::Value* rval, + void* closure); typedef JSTrapStatus -(* JSThrowHook)(JSContext *cx, JSScript *script, jsbytecode *pc, JS::Value *rval, - void *closure); +(* JSThrowHook)(JSContext* cx, JSScript* script, jsbytecode* pc, JS::Value* rval, + void* closure); typedef bool -(* JSWatchPointHandler)(JSContext *cx, JSObject *obj, jsid id, JS::Value old, - JS::Value *newp, void *closure); +(* JSWatchPointHandler)(JSContext* cx, JSObject* obj, jsid id, JS::Value old, + JS::Value* newp, void* closure); /* called just after script creation */ typedef void -(* JSNewScriptHook)(JSContext *cx, - const char *filename, /* URL of script */ +(* JSNewScriptHook)(JSContext* cx, + const char* filename, /* URL of script */ unsigned lineno, /* first line */ - JSScript *script, - JSFunction *fun, - void *callerdata); + JSScript* script, + JSFunction* fun, + void* callerdata); /* called just before script destruction */ typedef void -(* JSDestroyScriptHook)(JSFreeOp *fop, - JSScript *script, - void *callerdata); +(* JSDestroyScriptHook)(JSFreeOp* fop, + JSScript* script, + void* callerdata); typedef void -(* JSSourceHandler)(const char *filename, unsigned lineno, const jschar *str, - size_t length, void **listenerTSData, void *closure); +(* JSSourceHandler)(const char* filename, unsigned lineno, const jschar* str, + size_t length, void** listenerTSData, void* closure); -extern JS_PUBLIC_API(JSCompartment *) -JS_EnterCompartmentOfScript(JSContext *cx, JSScript *target); +extern JS_PUBLIC_API(JSCompartment*) +JS_EnterCompartmentOfScript(JSContext* cx, JSScript* target); -extern JS_PUBLIC_API(JSString *) -JS_DecompileScript(JSContext *cx, JS::HandleScript script, const char *name, unsigned indent); +extern JS_PUBLIC_API(JSString*) +JS_DecompileScript(JSContext* cx, JS::HandleScript script, const char* name, unsigned indent); /* * Currently, we only support runtime-wide debugging. In the future, we should * be able to support compartment-wide debugging. */ extern JS_PUBLIC_API(void) -JS_SetRuntimeDebugMode(JSRuntime *rt, bool debug); +JS_SetRuntimeDebugMode(JSRuntime* rt, bool debug); /* * Debug mode is a compartment-wide mode that enables a debugger to attach @@ -174,14 +174,14 @@ JS_SetRuntimeDebugMode(JSRuntime *rt, bool debug); /* Get current state of debugging mode. */ extern JS_PUBLIC_API(bool) -JS_GetDebugMode(JSContext *cx); +JS_GetDebugMode(JSContext* cx); /* * Turn on/off debugging mode for all compartments. This returns false if any code * from any of the runtime's compartments is running or on the stack. */ JS_FRIEND_API(bool) -JS_SetDebugModeForAllCompartments(JSContext *cx, bool debug); +JS_SetDebugModeForAllCompartments(JSContext* cx, bool debug); /* * Turn on/off debugging mode for a single compartment. This should only be @@ -189,105 +189,105 @@ JS_SetDebugModeForAllCompartments(JSContext *cx, bool debug); * thread. */ JS_FRIEND_API(bool) -JS_SetDebugModeForCompartment(JSContext *cx, JSCompartment *comp, bool debug); +JS_SetDebugModeForCompartment(JSContext* cx, JSCompartment* comp, bool debug); /* * Turn on/off debugging mode for a context's compartment. */ JS_FRIEND_API(bool) -JS_SetDebugMode(JSContext *cx, bool debug); +JS_SetDebugMode(JSContext* cx, bool debug); /* Turn on single step mode. */ extern JS_PUBLIC_API(bool) -JS_SetSingleStepMode(JSContext *cx, JS::HandleScript script, bool singleStep); +JS_SetSingleStepMode(JSContext* cx, JS::HandleScript script, bool singleStep); /* The closure argument will be marked. */ extern JS_PUBLIC_API(bool) -JS_SetTrap(JSContext *cx, JS::HandleScript script, jsbytecode *pc, +JS_SetTrap(JSContext* cx, JS::HandleScript script, jsbytecode* pc, JSTrapHandler handler, JS::HandleValue closure); extern JS_PUBLIC_API(void) -JS_ClearTrap(JSContext *cx, JSScript *script, jsbytecode *pc, - JSTrapHandler *handlerp, JS::Value *closurep); +JS_ClearTrap(JSContext* cx, JSScript* script, jsbytecode* pc, + JSTrapHandler* handlerp, JS::Value* closurep); extern JS_PUBLIC_API(void) -JS_ClearScriptTraps(JSRuntime *rt, JSScript *script); +JS_ClearScriptTraps(JSRuntime* rt, JSScript* script); extern JS_PUBLIC_API(void) -JS_ClearAllTrapsForCompartment(JSContext *cx); +JS_ClearAllTrapsForCompartment(JSContext* cx); extern JS_PUBLIC_API(bool) -JS_SetInterrupt(JSRuntime *rt, JSInterruptHook handler, void *closure); +JS_SetInterrupt(JSRuntime* rt, JSInterruptHook handler, void* closure); extern JS_PUBLIC_API(bool) -JS_ClearInterrupt(JSRuntime *rt, JSInterruptHook *handlerp, void **closurep); +JS_ClearInterrupt(JSRuntime* rt, JSInterruptHook* handlerp, void** closurep); /************************************************************************/ extern JS_PUBLIC_API(bool) -JS_SetWatchPoint(JSContext *cx, JS::HandleObject obj, JS::HandleId id, +JS_SetWatchPoint(JSContext* cx, JS::HandleObject obj, JS::HandleId id, JSWatchPointHandler handler, JS::HandleObject closure); extern JS_PUBLIC_API(bool) -JS_ClearWatchPoint(JSContext *cx, JSObject *obj, jsid id, - JSWatchPointHandler *handlerp, JSObject **closurep); +JS_ClearWatchPoint(JSContext* cx, JSObject* obj, jsid id, + JSWatchPointHandler* handlerp, JSObject** closurep); extern JS_PUBLIC_API(bool) -JS_ClearWatchPointsForObject(JSContext *cx, JSObject *obj); +JS_ClearWatchPointsForObject(JSContext* cx, JSObject* obj); /************************************************************************/ -extern JS_PUBLIC_API(jsbytecode *) -JS_LineNumberToPC(JSContext *cx, JSScript *script, unsigned lineno); +extern JS_PUBLIC_API(jsbytecode*) +JS_LineNumberToPC(JSContext* cx, JSScript* script, unsigned lineno); -extern JS_PUBLIC_API(jsbytecode *) -JS_EndPC(JSContext *cx, JSScript *script); +extern JS_PUBLIC_API(jsbytecode*) +JS_EndPC(JSContext* cx, JSScript* script); extern JS_PUBLIC_API(bool) -JS_GetLinePCs(JSContext *cx, JSScript *script, +JS_GetLinePCs(JSContext* cx, JSScript* script, unsigned startLine, unsigned maxLines, unsigned* count, unsigned** lines, jsbytecode*** pcs); extern JS_PUBLIC_API(unsigned) -JS_GetFunctionArgumentCount(JSContext *cx, JSFunction *fun); +JS_GetFunctionArgumentCount(JSContext* cx, JSFunction* fun); extern JS_PUBLIC_API(bool) -JS_FunctionHasLocalNames(JSContext *cx, JSFunction *fun); +JS_FunctionHasLocalNames(JSContext* cx, JSFunction* fun); /* * N.B. The mark is in the context temp pool and thus the caller must take care * to call JS_ReleaseFunctionLocalNameArray in a LIFO manner (wrt to any other * call that may use the temp pool. */ -extern JS_PUBLIC_API(uintptr_t *) -JS_GetFunctionLocalNameArray(JSContext *cx, JSFunction *fun, void **markp); +extern JS_PUBLIC_API(uintptr_t*) +JS_GetFunctionLocalNameArray(JSContext* cx, JSFunction* fun, void** markp); -extern JS_PUBLIC_API(JSAtom *) +extern JS_PUBLIC_API(JSAtom*) JS_LocalNameToAtom(uintptr_t w); -extern JS_PUBLIC_API(JSString *) -JS_AtomKey(JSAtom *atom); +extern JS_PUBLIC_API(JSString*) +JS_AtomKey(JSAtom* atom); extern JS_PUBLIC_API(void) -JS_ReleaseFunctionLocalNameArray(JSContext *cx, void *mark); +JS_ReleaseFunctionLocalNameArray(JSContext* cx, void* mark); -extern JS_PUBLIC_API(JSScript *) -JS_GetFunctionScript(JSContext *cx, JS::HandleFunction fun); +extern JS_PUBLIC_API(JSScript*) +JS_GetFunctionScript(JSContext* cx, JS::HandleFunction fun); extern JS_PUBLIC_API(JSNative) -JS_GetFunctionNative(JSContext *cx, JSFunction *fun); +JS_GetFunctionNative(JSContext* cx, JSFunction* fun); -extern JS_PUBLIC_API(JSPrincipals *) -JS_GetScriptPrincipals(JSScript *script); +extern JS_PUBLIC_API(JSPrincipals*) +JS_GetScriptPrincipals(JSScript* script); -extern JS_PUBLIC_API(JSPrincipals *) -JS_GetScriptOriginPrincipals(JSScript *script); +extern JS_PUBLIC_API(JSPrincipals*) +JS_GetScriptOriginPrincipals(JSScript* script); -JS_PUBLIC_API(JSFunction *) -JS_GetScriptFunction(JSContext *cx, JSScript *script); +JS_PUBLIC_API(JSFunction*) +JS_GetScriptFunction(JSContext* cx, JSScript* script); -extern JS_PUBLIC_API(JSObject *) -JS_GetParentOrScopeChain(JSContext *cx, JSObject *obj); +extern JS_PUBLIC_API(JSObject*) +JS_GetParentOrScopeChain(JSContext* cx, JSObject* obj); /************************************************************************/ @@ -297,25 +297,25 @@ JS_GetParentOrScopeChain(JSContext *cx, JSObject *obj); * of any scope (returned via JS_GetFrameScopeChain or JS_GetFrameCalleeObject) * from "Proxy" to "Call", "Block", "With" etc. */ -extern JS_PUBLIC_API(const char *) -JS_GetDebugClassName(JSObject *obj); +extern JS_PUBLIC_API(const char*) +JS_GetDebugClassName(JSObject* obj); /************************************************************************/ -extern JS_PUBLIC_API(const jschar *) -JS_GetScriptSourceMap(JSContext *cx, JSScript *script); +extern JS_PUBLIC_API(const jschar*) +JS_GetScriptSourceMap(JSContext* cx, JSScript* script); extern JS_PUBLIC_API(unsigned) -JS_GetScriptBaseLineNumber(JSContext *cx, JSScript *script); +JS_GetScriptBaseLineNumber(JSContext* cx, JSScript* script); extern JS_PUBLIC_API(unsigned) -JS_GetScriptLineExtent(JSContext *cx, JSScript *script); +JS_GetScriptLineExtent(JSContext* cx, JSScript* script); extern JS_PUBLIC_API(JSVersion) -JS_GetScriptVersion(JSContext *cx, JSScript *script); +JS_GetScriptVersion(JSContext* cx, JSScript* script); extern JS_PUBLIC_API(bool) -JS_GetScriptIsSelfHosted(JSScript *script); +JS_GetScriptIsSelfHosted(JSScript* script); /************************************************************************/ @@ -327,11 +327,11 @@ JS_GetScriptIsSelfHosted(JSScript *script); #define JS_SetDestroyScriptHook JS_SetDestroyScriptHookProc extern JS_PUBLIC_API(void) -JS_SetNewScriptHook(JSRuntime *rt, JSNewScriptHook hook, void *callerdata); +JS_SetNewScriptHook(JSRuntime* rt, JSNewScriptHook hook, void* callerdata); extern JS_PUBLIC_API(void) -JS_SetDestroyScriptHook(JSRuntime *rt, JSDestroyScriptHook hook, - void *callerdata); +JS_SetDestroyScriptHook(JSRuntime* rt, JSDestroyScriptHook hook, + void* callerdata); /************************************************************************/ @@ -354,16 +354,16 @@ typedef struct JSPropertyDesc { typedef struct JSPropertyDescArray { uint32_t length; /* number of elements in array */ - JSPropertyDesc *array; /* alloc'd by Get, freed by Put */ + JSPropertyDesc* array; /* alloc'd by Get, freed by Put */ } JSPropertyDescArray; typedef struct JSScopeProperty JSScopeProperty; extern JS_PUBLIC_API(bool) -JS_GetPropertyDescArray(JSContext *cx, JS::HandleObject obj, JSPropertyDescArray *pda); +JS_GetPropertyDescArray(JSContext* cx, JS::HandleObject obj, JSPropertyDescArray* pda); extern JS_PUBLIC_API(void) -JS_PutPropertyDescArray(JSContext *cx, JSPropertyDescArray *pda); +JS_PutPropertyDescArray(JSContext* cx, JSPropertyDescArray* pda); /************************************************************************/ @@ -374,7 +374,7 @@ JS_PutPropertyDescArray(JSContext *cx, JSPropertyDescArray *pda); class JS_PUBLIC_API(JSAbstractFramePtr) { uintptr_t ptr_; - jsbytecode *pc_; + jsbytecode* pc_; protected: JSAbstractFramePtr() @@ -382,31 +382,31 @@ class JS_PUBLIC_API(JSAbstractFramePtr) { } public: - JSAbstractFramePtr(void *raw, jsbytecode *pc); + JSAbstractFramePtr(void* raw, jsbytecode* pc); uintptr_t raw() const { return ptr_; } - jsbytecode *pc() const { return pc_; } + jsbytecode* pc() const { return pc_; } operator bool() const { return !!ptr_; } - JSObject *scopeChain(JSContext *cx); - JSObject *callObject(JSContext *cx); + JSObject* scopeChain(JSContext* cx); + JSObject* callObject(JSContext* cx); - JSFunction *maybeFun(); - JSScript *script(); + JSFunction* maybeFun(); + JSScript* script(); - bool getThisValue(JSContext *cx, JS::MutableHandleValue thisv); + bool getThisValue(JSContext* cx, JS::MutableHandleValue thisv); bool isDebuggerFrame(); - bool evaluateInStackFrame(JSContext *cx, - const char *bytes, unsigned length, - const char *filename, unsigned lineno, + bool evaluateInStackFrame(JSContext* cx, + const char* bytes, unsigned length, + const char* filename, unsigned lineno, JS::MutableHandleValue rval); - bool evaluateUCInStackFrame(JSContext *cx, - const jschar *chars, unsigned length, - const char *filename, unsigned lineno, + bool evaluateUCInStackFrame(JSContext* cx, + const jschar* chars, unsigned length, + const char* filename, unsigned lineno, JS::MutableHandleValue rval); }; @@ -427,17 +427,17 @@ class JS_PUBLIC_API(JSNullFramePtr) : public JSAbstractFramePtr */ class JS_PUBLIC_API(JSBrokenFrameIterator) { - void *data_; + void* data_; public: - JSBrokenFrameIterator(JSContext *cx); + JSBrokenFrameIterator(JSContext* cx); ~JSBrokenFrameIterator(); bool done() const; JSBrokenFrameIterator& operator++(); JSAbstractFramePtr abstractFramePtr() const; - jsbytecode *pc() const; + jsbytecode* pc() const; bool isConstructing() const; }; @@ -467,83 +467,83 @@ class JS_PUBLIC_API(JSBrokenFrameIterator) * Returning nullptr in the 'before' hook will cause the 'after' hook *not* to * be called. */ -typedef void * -(* JSInterpreterHook)(JSContext *cx, JSAbstractFramePtr frame, bool isConstructing, - bool before, bool *ok, void *closure); +typedef void* +(* JSInterpreterHook)(JSContext* cx, JSAbstractFramePtr frame, bool isConstructing, + bool before, bool* ok, void* closure); typedef bool -(* JSDebugErrorHook)(JSContext *cx, const char *message, JSErrorReport *report, - void *closure); +(* JSDebugErrorHook)(JSContext* cx, const char* message, JSErrorReport* report, + void* closure); typedef struct JSDebugHooks { JSInterruptHook interruptHook; - void *interruptHookData; + void* interruptHookData; JSNewScriptHook newScriptHook; - void *newScriptHookData; + void* newScriptHookData; JSDestroyScriptHook destroyScriptHook; - void *destroyScriptHookData; + void* destroyScriptHookData; JSDebuggerHandler debuggerHandler; - void *debuggerHandlerData; + void* debuggerHandlerData; JSSourceHandler sourceHandler; - void *sourceHandlerData; + void* sourceHandlerData; JSInterpreterHook executeHook; - void *executeHookData; + void* executeHookData; JSInterpreterHook callHook; - void *callHookData; + void* callHookData; JSThrowHook throwHook; - void *throwHookData; + void* throwHookData; JSDebugErrorHook debugErrorHook; - void *debugErrorHookData; + void* debugErrorHookData; } JSDebugHooks; /************************************************************************/ extern JS_PUBLIC_API(bool) -JS_SetDebuggerHandler(JSRuntime *rt, JSDebuggerHandler hook, void *closure); +JS_SetDebuggerHandler(JSRuntime* rt, JSDebuggerHandler hook, void* closure); extern JS_PUBLIC_API(bool) -JS_SetSourceHandler(JSRuntime *rt, JSSourceHandler handler, void *closure); +JS_SetSourceHandler(JSRuntime* rt, JSSourceHandler handler, void* closure); extern JS_PUBLIC_API(bool) -JS_SetExecuteHook(JSRuntime *rt, JSInterpreterHook hook, void *closure); +JS_SetExecuteHook(JSRuntime* rt, JSInterpreterHook hook, void* closure); extern JS_PUBLIC_API(bool) -JS_SetCallHook(JSRuntime *rt, JSInterpreterHook hook, void *closure); +JS_SetCallHook(JSRuntime* rt, JSInterpreterHook hook, void* closure); extern JS_PUBLIC_API(bool) -JS_SetThrowHook(JSRuntime *rt, JSThrowHook hook, void *closure); +JS_SetThrowHook(JSRuntime* rt, JSThrowHook hook, void* closure); extern JS_PUBLIC_API(bool) -JS_SetDebugErrorHook(JSRuntime *rt, JSDebugErrorHook hook, void *closure); +JS_SetDebugErrorHook(JSRuntime* rt, JSDebugErrorHook hook, void* closure); /************************************************************************/ -extern JS_PUBLIC_API(const JSDebugHooks *) -JS_GetGlobalDebugHooks(JSRuntime *rt); +extern JS_PUBLIC_API(const JSDebugHooks*) +JS_GetGlobalDebugHooks(JSRuntime* rt); /** * Add various profiling-related functions as properties of the given object. */ extern JS_PUBLIC_API(bool) -JS_DefineProfilingFunctions(JSContext *cx, JSObject *obj); +JS_DefineProfilingFunctions(JSContext* cx, JSObject* obj); /* Defined in vm/Debugger.cpp. */ extern JS_PUBLIC_API(bool) -JS_DefineDebuggerObject(JSContext *cx, JS::HandleObject obj); +JS_DefineDebuggerObject(JSContext* cx, JS::HandleObject obj); extern JS_PUBLIC_API(void) -JS_DumpPCCounts(JSContext *cx, JS::HandleScript script); +JS_DumpPCCounts(JSContext* cx, JS::HandleScript script); extern JS_PUBLIC_API(void) -JS_DumpCompartmentPCCounts(JSContext *cx); +JS_DumpCompartmentPCCounts(JSContext* cx); namespace js { extern JS_FRIEND_API(bool) -CanCallContextDebugHandler(JSContext *cx); +CanCallContextDebugHandler(JSContext* cx); } /* Call the context debug handler on the topmost scripted frame. */ extern JS_FRIEND_API(bool) -js_CallContextDebugHandler(JSContext *cx); +js_CallContextDebugHandler(JSContext* cx); #endif /* js_OldDebugAPI_h */ diff --git a/js/public/Principals.h b/js/public/Principals.h index 78d8c7e893..4794ffffb1 100644 --- a/js/public/Principals.h +++ b/js/public/Principals.h @@ -42,23 +42,23 @@ struct JSPrincipals { }; extern JS_PUBLIC_API(void) -JS_HoldPrincipals(JSPrincipals *principals); +JS_HoldPrincipals(JSPrincipals* principals); extern JS_PUBLIC_API(void) -JS_DropPrincipals(JSRuntime *rt, JSPrincipals *principals); +JS_DropPrincipals(JSRuntime* rt, JSPrincipals* principals); // Return whether the first principal subsumes the second. The exact meaning of // 'subsumes' is left up to the browser. Subsumption is checked inside the JS // engine when determining, e.g., which stack frames to display in a backtrace. typedef bool -(* JSSubsumesOp)(JSPrincipals *first, JSPrincipals *second); +(* JSSubsumesOp)(JSPrincipals* first, JSPrincipals* second); /* * Used to check if a CSP instance wants to disable eval() and friends. * See js_CheckCSPPermitsJSAction() in jsobj. */ typedef bool -(* JSCSPEvalChecker)(JSContext *cx); +(* JSCSPEvalChecker)(JSContext* cx); struct JSSecurityCallbacks { JSCSPEvalChecker contentSecurityPolicyAllows; @@ -66,10 +66,10 @@ struct JSSecurityCallbacks { }; extern JS_PUBLIC_API(void) -JS_SetSecurityCallbacks(JSRuntime *rt, const JSSecurityCallbacks *callbacks); +JS_SetSecurityCallbacks(JSRuntime* rt, const JSSecurityCallbacks* callbacks); -extern JS_PUBLIC_API(const JSSecurityCallbacks *) -JS_GetSecurityCallbacks(JSRuntime *rt); +extern JS_PUBLIC_API(const JSSecurityCallbacks*) +JS_GetSecurityCallbacks(JSRuntime* rt); /* * Code running with "trusted" principals will be given a deeper stack @@ -84,10 +84,10 @@ JS_GetSecurityCallbacks(JSRuntime *rt); * called again, passing nullptr for 'prin'. */ extern JS_PUBLIC_API(void) -JS_SetTrustedPrincipals(JSRuntime *rt, const JSPrincipals *prin); +JS_SetTrustedPrincipals(JSRuntime* rt, const JSPrincipals* prin); typedef void -(* JSDestroyPrincipalsOp)(JSPrincipals *principals); +(* JSDestroyPrincipalsOp)(JSPrincipals* principals); /* * Initialize the callback that is called to destroy JSPrincipals instance @@ -95,6 +95,6 @@ typedef void * only once per JS runtime. */ extern JS_PUBLIC_API(void) -JS_InitDestroyPrincipalsCallback(JSRuntime *rt, JSDestroyPrincipalsOp destroyPrincipals); +JS_InitDestroyPrincipalsCallback(JSRuntime* rt, JSDestroyPrincipalsOp destroyPrincipals); #endif /* js_Principals_h */ diff --git a/js/public/ProfilingStack.h b/js/public/ProfilingStack.h index 0f6e7fd57e..d80d4cda52 100644 --- a/js/public/ProfilingStack.h +++ b/js/public/ProfilingStack.h @@ -61,26 +61,26 @@ class ProfileEntry } uint32_t line() const volatile { MOZ_ASSERT(!js()); return idx; } - JSScript *script() const volatile { MOZ_ASSERT(js()); return script_; } + JSScript* script() const volatile { MOZ_ASSERT(js()); return script_; } bool scriptIsOptimized() const volatile { MOZ_ASSERT(js()); return uintptr_t(sp) <= SCRIPT_OPT_STACKPOINTER; } - void *stackAddress() const volatile { + void* stackAddress() const volatile { if (js()) return nullptr; return sp; } - const char *label() const volatile { return string; } + const char* label() const volatile { return string; } void setLine(uint32_t aLine) volatile { MOZ_ASSERT(!js()); idx = aLine; } - void setLabel(const char *aString) volatile { string = aString; } - void setStackAddress(void *aSp) volatile { sp = aSp; } - void setScript(JSScript *aScript) volatile { script_ = aScript; } + void setLabel(const char* aString) volatile { string = aString; } + void setStackAddress(void* aSp) volatile { sp = aSp; } + void setScript(JSScript* aScript) volatile { script_ = aScript; } // We can't know the layout of JSScript, so look in vm/SPSProfiler.cpp. - JS_FRIEND_API(jsbytecode *) pc() const volatile; - JS_FRIEND_API(void) setPC(jsbytecode *pc) volatile; + JS_FRIEND_API(jsbytecode*) pc() const volatile; + JS_FRIEND_API(void) setPC(jsbytecode* pc) volatile; static size_t offsetOfString() { return offsetof(ProfileEntry, string); } static size_t offsetOfStackAddress() { return offsetof(ProfileEntry, sp); } @@ -98,17 +98,17 @@ class ProfileEntry }; JS_FRIEND_API(void) -SetRuntimeProfilingStack(JSRuntime *rt, ProfileEntry *stack, uint32_t *size, +SetRuntimeProfilingStack(JSRuntime* rt, ProfileEntry* stack, uint32_t* size, uint32_t max); JS_FRIEND_API(void) -EnableRuntimeProfilingStack(JSRuntime *rt, bool enabled); +EnableRuntimeProfilingStack(JSRuntime* rt, bool enabled); JS_FRIEND_API(void) -RegisterRuntimeProfilingEventMarker(JSRuntime *rt, void (*fn)(const char *)); +RegisterRuntimeProfilingEventMarker(JSRuntime* rt, void (*fn)(const char*)); JS_FRIEND_API(jsbytecode*) -ProfilingGetPC(JSRuntime *rt, JSScript *script, void *ip); +ProfilingGetPC(JSRuntime* rt, JSScript* script, void* ip); } // namespace js diff --git a/js/public/PropertyKey.h b/js/public/PropertyKey.h index 1f90653b40..91a9a6c99b 100644 --- a/js/public/PropertyKey.h +++ b/js/public/PropertyKey.h @@ -19,7 +19,7 @@ class PropertyKey; namespace detail { extern JS_PUBLIC_API(bool) -ToPropertyKeySlow(JSContext *cx, HandleValue v, PropertyKey *key); +ToPropertyKeySlow(JSContext* cx, HandleValue v, PropertyKey* key); } // namespace detail @@ -34,7 +34,7 @@ ToPropertyKeySlow(JSContext *cx, HandleValue v, PropertyKey *key); class PropertyKey { Value v; - friend JS_PUBLIC_API(bool) detail::ToPropertyKeySlow(JSContext *cx, HandleValue v, PropertyKey *key); + friend JS_PUBLIC_API(bool) detail::ToPropertyKeySlow(JSContext* cx, HandleValue v, PropertyKey* key); public: explicit PropertyKey(uint32_t index) : v(PrivateUint32Value(index)) {} @@ -44,7 +44,7 @@ class PropertyKey * unsigned 32-bit integer in decimal: "0", "1", "2", ...., "4294967294", * "4294967295". */ - bool isIndex(uint32_t *index) { + bool isIndex(uint32_t* index) { // The implementation here assumes that private uint32_t are stored // using the int32_t representation. This is purely an implementation // detail: embedders must not rely upon this! @@ -59,7 +59,7 @@ class PropertyKey * the ECMAScript language grammar, any dotted property access |obj.prop| * will access a named property. */ - bool isName(JSString **str) { + bool isName(JSString** str) { uint32_t dummy; if (isIndex(&dummy)) return false; @@ -80,7 +80,7 @@ class PropertyKey }; inline bool -ToPropertyKey(JSContext *cx, HandleValue v, PropertyKey *key) +ToPropertyKey(JSContext* cx, HandleValue v, PropertyKey* key) { if (v.isInt32() && v.toInt32() >= 0) { *key = PropertyKey(uint32_t(v.toInt32())); diff --git a/js/public/RootingAPI.h b/js/public/RootingAPI.h index a155665307..32ac127df9 100644 --- a/js/public/RootingAPI.h +++ b/js/public/RootingAPI.h @@ -30,7 +30,7 @@ * whose value may be held live across a call that can trigger GC. For a * code fragment such as: * - * JSObject *obj = NewObject(cx); + * JSObject* obj = NewObject(cx); * DoSomething(cx); * ... = obj->lastProperty(); * @@ -72,7 +72,7 @@ * separate rooting analysis. * * - MutableHandle is a non-const reference to Rooted. It is used in the - * same way as Handle and includes a |set(const T &v)| method to allow + * same way as Handle and includes a |set(const T& v)| method to allow * updating the value of the referenced Rooted. A MutableHandle can be * created from a Rooted by using |Rooted::operator&()|. * @@ -202,32 +202,32 @@ class Heap : public js::HeapBase * that will be used for both lvalue and rvalue copies, so we can simply * omit the rvalue variant. */ - explicit Heap(const Heap &p) { init(p.ptr); } + explicit Heap(const Heap& p) { init(p.ptr); } ~Heap() { if (js::GCMethods::needsPostBarrier(ptr)) relocate(); } - bool operator==(const Heap &other) { return ptr == other.ptr; } - bool operator!=(const Heap &other) { return ptr != other.ptr; } + bool operator==(const Heap& other) { return ptr == other.ptr; } + bool operator!=(const Heap& other) { return ptr != other.ptr; } - bool operator==(const T &other) const { return ptr == other; } - bool operator!=(const T &other) const { return ptr != other; } + bool operator==(const T& other) const { return ptr == other; } + bool operator!=(const T& other) const { return ptr != other; } operator T() const { return ptr; } T operator->() const { return ptr; } - const T *address() const { return &ptr; } - const T &get() const { return ptr; } + const T* address() const { return &ptr; } + const T& get() const { return ptr; } - T *unsafeGet() { return &ptr; } + T* unsafeGet() { return &ptr; } - Heap &operator=(T p) { + Heap& operator=(T p) { set(p); return *this; } - Heap &operator=(const Heap& other) { + Heap& operator=(const Heap& other) { set(other.get()); return *this; } @@ -294,7 +294,7 @@ extern JS_FRIEND_API(void) AssertGCThingMustBeTenured(JSObject* obj); #else inline void -AssertGCThingMustBeTenured(JSObject *obj) {} +AssertGCThingMustBeTenured(JSObject* obj) {} #endif /* @@ -335,10 +335,10 @@ class TenuredHeap : public js::HeapBase "TenuredHeap must be binary compatible with T."); } explicit TenuredHeap(T p) : bits(0) { setPtr(p); } - explicit TenuredHeap(const TenuredHeap &p) : bits(0) { setPtr(p.getPtr()); } + explicit TenuredHeap(const TenuredHeap& p) : bits(0) { setPtr(p.getPtr()); } - bool operator==(const TenuredHeap &other) { return bits == other.bits; } - bool operator!=(const TenuredHeap &other) { return bits != other.bits; } + bool operator==(const TenuredHeap& other) { return bits == other.bits; } + bool operator!=(const TenuredHeap& other) { return bits != other.bits; } void setPtr(T newPtr) { MOZ_ASSERT((reinterpret_cast(newPtr) & flagsMask) == 0); @@ -369,12 +369,12 @@ class TenuredHeap : public js::HeapBase operator T() const { return getPtr(); } T operator->() const { return getPtr(); } - TenuredHeap &operator=(T p) { + TenuredHeap& operator=(T p) { setPtr(p); return *this; } - TenuredHeap &operator=(const TenuredHeap& other) { + TenuredHeap& operator=(const TenuredHeap& other) { bits = other.bits; return *this; } @@ -407,23 +407,23 @@ class MOZ_NONHEAP_CLASS Handle : public js::HandleBase Handle(Handle handle, typename mozilla::EnableIf::value, int>::Type dummy = 0) { - static_assert(sizeof(Handle) == sizeof(T *), + static_assert(sizeof(Handle) == sizeof(T*), "Handle must be binary compatible with T*."); - ptr = reinterpret_cast(handle.address()); + ptr = reinterpret_cast(handle.address()); } /* Create a handle for a nullptr pointer. */ Handle(js::NullPtr) { static_assert(mozilla::IsPointer::value, "js::NullPtr overload not valid for non-pointer types"); - ptr = reinterpret_cast(&js::NullPtr::constNullValue); + ptr = reinterpret_cast(&js::NullPtr::constNullValue); } /* Create a handle for a nullptr pointer. */ Handle(JS::NullPtr) { static_assert(mozilla::IsPointer::value, "JS::NullPtr overload not valid for non-pointer types"); - ptr = reinterpret_cast(&JS::NullPtr::constNullValue); + ptr = reinterpret_cast(&JS::NullPtr::constNullValue); } Handle(MutableHandle handle) { @@ -445,7 +445,7 @@ class MOZ_NONHEAP_CLASS Handle : public js::HandleBase * for the lifetime of the handle, as its users may not expect its value * to change underneath them. */ - static MOZ_CONSTEXPR Handle fromMarkedLocation(const T *p) { + static MOZ_CONSTEXPR Handle fromMarkedLocation(const T* p) { return Handle(p, DeliberatelyChoosingThisOverload, ImUsingThisOnlyInFromFromMarkedLocation); } @@ -456,21 +456,21 @@ class MOZ_NONHEAP_CLASS Handle : public js::HandleBase */ template inline - Handle(const Rooted &root, + Handle(const Rooted& root, typename mozilla::EnableIf::value, int>::Type dummy = 0); template inline - Handle(const PersistentRooted &root, + Handle(const PersistentRooted& root, typename mozilla::EnableIf::value, int>::Type dummy = 0); /* Construct a read only handle from a mutable handle. */ template inline - Handle(MutableHandle &root, + Handle(MutableHandle& root, typename mozilla::EnableIf::value, int>::Type dummy = 0); - const T *address() const { return ptr; } + const T* address() const { return ptr; } const T& get() const { return *ptr; } /* @@ -480,20 +480,20 @@ class MOZ_NONHEAP_CLASS Handle : public js::HandleBase operator const T&() const { return get(); } T operator->() const { return get(); } - bool operator!=(const T &other) const { return *ptr != other; } - bool operator==(const T &other) const { return *ptr == other; } + bool operator!=(const T& other) const { return *ptr != other; } + bool operator==(const T& other) const { return *ptr == other; } /* Change this handle to point to the same rooted location RHS does. */ - void repoint(const Handle &rhs) { ptr = rhs.address(); } + void repoint(const Handle& rhs) { ptr = rhs.address(); } private: Handle() {} enum Disambiguator { DeliberatelyChoosingThisOverload = 42 }; enum CallerIdentity { ImUsingThisOnlyInFromFromMarkedLocation = 17 }; - MOZ_CONSTEXPR Handle(const T *p, Disambiguator, CallerIdentity) : ptr(p) {} + MOZ_CONSTEXPR Handle(const T* p, Disambiguator, CallerIdentity) : ptr(p) {} - const T *ptr; + const T* ptr; template void operator=(S) MOZ_DELETE; void operator=(Handle) MOZ_DELETE; @@ -511,8 +511,8 @@ template class MOZ_STACK_CLASS MutableHandle : public js::MutableHandleBase { public: - inline MutableHandle(Rooted *root); - inline MutableHandle(PersistentRooted *root); + inline MutableHandle(Rooted* root); + inline MutableHandle(PersistentRooted* root); private: // Disallow true nullptr and emulated nullptr (gcc 4.4/4.5, __null, appears @@ -538,13 +538,13 @@ class MOZ_STACK_CLASS MutableHandle : public js::MutableHandleBase * * Create a MutableHandle from a raw location of a T. */ - static MutableHandle fromMarkedLocation(T *p) { + static MutableHandle fromMarkedLocation(T* p) { MutableHandle h; h.ptr = p; return h; } - T *address() const { return ptr; } + T* address() const { return ptr; } const T& get() const { return *ptr; } /* @@ -557,15 +557,15 @@ class MOZ_STACK_CLASS MutableHandle : public js::MutableHandleBase private: MutableHandle() {} - T *ptr; + T* ptr; template void operator=(S v) MOZ_DELETE; void operator=(MutableHandle other) MOZ_DELETE; }; #ifdef JSGC_GENERATIONAL -JS_FRIEND_API(void) HeapCellPostBarrier(js::gc::Cell **cellp); -JS_FRIEND_API(void) HeapCellRelocate(js::gc::Cell **cellp); +JS_FRIEND_API(void) HeapCellPostBarrier(js::gc::Cell** cellp); +JS_FRIEND_API(void) HeapCellRelocate(js::gc::Cell** cellp); #endif } /* namespace JS */ @@ -584,7 +584,7 @@ class InternalHandle {}; template class InternalHandle { - void * const *holder; + void * const* holder; size_t offset; public: @@ -593,7 +593,7 @@ class InternalHandle * field in question, and a pointer to the field. */ template - InternalHandle(const JS::Handle &handle, T *field) + InternalHandle(const JS::Handle& handle, T* field) : holder((void**)handle.address()), offset(uintptr_t(field) - uintptr_t(handle.get())) {} @@ -601,19 +601,19 @@ class InternalHandle * Create an InternalHandle to a field within a Rooted<>. */ template - InternalHandle(const JS::Rooted &root, T *field) + InternalHandle(const JS::Rooted& root, T* field) : holder((void**)root.address()), offset(uintptr_t(field) - uintptr_t(root.get())) {} InternalHandle(const InternalHandle& other) : holder(other.holder), offset(other.offset) {} - T *get() const { return reinterpret_cast(uintptr_t(*holder) + offset); } + T* get() const { return reinterpret_cast(uintptr_t(*holder) + offset); } - const T &operator*() const { return *get(); } - T *operator->() const { return get(); } + const T& operator*() const { return *get(); } + T* operator->() const { return get(); } - static InternalHandle fromMarkedLocation(T *fieldPtr) { + static InternalHandle fromMarkedLocation(T* fieldPtr) { return InternalHandle(fieldPtr); } @@ -627,8 +627,8 @@ class InternalHandle * Make this private to prevent accidental misuse; this is only for * fromMarkedLocation(). */ - InternalHandle(T *field) - : holder(reinterpret_cast(&js::NullPtr::constNullValue)), + InternalHandle(T* field) + : holder(reinterpret_cast(&js::NullPtr::constNullValue)), offset(uintptr_t(field)) {} @@ -641,54 +641,54 @@ class InternalHandle * Rooted may be used without the class definition being available. */ template -struct RootKind +struct RootKind { static ThingRootKind rootKind() { return T::rootKind(); } }; template -struct GCMethods +struct GCMethods { - static T *initial() { return nullptr; } - static ThingRootKind kind() { return RootKind::rootKind(); } - static bool poisoned(T *v) { return JS::IsPoisonedPtr(v); } - static bool needsPostBarrier(T *v) { return false; } + static T* initial() { return nullptr; } + static ThingRootKind kind() { return RootKind::rootKind(); } + static bool poisoned(T* v) { return JS::IsPoisonedPtr(v); } + static bool needsPostBarrier(T* v) { return false; } #ifdef JSGC_GENERATIONAL - static void postBarrier(T **vp) {} - static void relocate(T **vp) {} + static void postBarrier(T** vp) {} + static void relocate(T** vp) {} #endif }; template <> -struct GCMethods +struct GCMethods { - static JSObject *initial() { return nullptr; } - static ThingRootKind kind() { return RootKind::rootKind(); } - static bool poisoned(JSObject *v) { return JS::IsPoisonedPtr(v); } - static bool needsPostBarrier(JSObject *v) { return v; } + static JSObject* initial() { return nullptr; } + static ThingRootKind kind() { return RootKind::rootKind(); } + static bool poisoned(JSObject* v) { return JS::IsPoisonedPtr(v); } + static bool needsPostBarrier(JSObject* v) { return v; } #ifdef JSGC_GENERATIONAL - static void postBarrier(JSObject **vp) { - JS::HeapCellPostBarrier(reinterpret_cast(vp)); + static void postBarrier(JSObject** vp) { + JS::HeapCellPostBarrier(reinterpret_cast(vp)); } - static void relocate(JSObject **vp) { - JS::HeapCellRelocate(reinterpret_cast(vp)); + static void relocate(JSObject** vp) { + JS::HeapCellRelocate(reinterpret_cast(vp)); } #endif }; template <> -struct GCMethods +struct GCMethods { - static JSFunction *initial() { return nullptr; } - static ThingRootKind kind() { return RootKind::rootKind(); } - static bool poisoned(JSFunction *v) { return JS::IsPoisonedPtr(v); } - static bool needsPostBarrier(JSFunction *v) { return v; } + static JSFunction* initial() { return nullptr; } + static ThingRootKind kind() { return RootKind::rootKind(); } + static bool poisoned(JSFunction* v) { return JS::IsPoisonedPtr(v); } + static bool needsPostBarrier(JSFunction* v) { return v; } #ifdef JSGC_GENERATIONAL - static void postBarrier(JSFunction **vp) { - JS::HeapCellPostBarrier(reinterpret_cast(vp)); + static void postBarrier(JSFunction** vp) { + JS::HeapCellPostBarrier(reinterpret_cast(vp)); } - static void relocate(JSFunction **vp) { - JS::HeapCellRelocate(reinterpret_cast(vp)); + static void relocate(JSFunction** vp) { + JS::HeapCellRelocate(reinterpret_cast(vp)); } #endif }; @@ -696,7 +696,7 @@ struct GCMethods #ifdef JS_DEBUG /* This helper allows us to assert that Rooted is scoped within a request. */ extern JS_PUBLIC_API(bool) -IsInRequest(JSContext *cx); +IsInRequest(JSContext* cx); #endif } /* namespace js */ @@ -716,7 +716,7 @@ class MOZ_STACK_CLASS Rooted : public js::RootedBase { /* Note: CX is a subclass of either ContextFriendFields or PerThreadDataFriendFields. */ template - void init(CX *cx) { + void init(CX* cx) { #ifdef JSGC_TRACK_EXACT_ROOTS js::ThingRootKind kind = js::GCMethods::kind(); this->stack = &cx->thingGCRooters[kind]; @@ -728,7 +728,7 @@ class MOZ_STACK_CLASS Rooted : public js::RootedBase } public: - Rooted(JSContext *cx + Rooted(JSContext* cx MOZ_GUARD_OBJECT_NOTIFIER_PARAM) : ptr(js::GCMethods::initial()) { @@ -739,7 +739,7 @@ class MOZ_STACK_CLASS Rooted : public js::RootedBase init(js::ContextFriendFields::get(cx)); } - Rooted(JSContext *cx, T initial + Rooted(JSContext* cx, T initial MOZ_GUARD_OBJECT_NOTIFIER_PARAM) : ptr(initial) { @@ -750,7 +750,7 @@ class MOZ_STACK_CLASS Rooted : public js::RootedBase init(js::ContextFriendFields::get(cx)); } - Rooted(js::ContextFriendFields *cx + Rooted(js::ContextFriendFields* cx MOZ_GUARD_OBJECT_NOTIFIER_PARAM) : ptr(js::GCMethods::initial()) { @@ -758,7 +758,7 @@ class MOZ_STACK_CLASS Rooted : public js::RootedBase init(cx); } - Rooted(js::ContextFriendFields *cx, T initial + Rooted(js::ContextFriendFields* cx, T initial MOZ_GUARD_OBJECT_NOTIFIER_PARAM) : ptr(initial) { @@ -766,7 +766,7 @@ class MOZ_STACK_CLASS Rooted : public js::RootedBase init(cx); } - Rooted(js::PerThreadDataFriendFields *pt + Rooted(js::PerThreadDataFriendFields* pt MOZ_GUARD_OBJECT_NOTIFIER_PARAM) : ptr(js::GCMethods::initial()) { @@ -774,7 +774,7 @@ class MOZ_STACK_CLASS Rooted : public js::RootedBase init(pt); } - Rooted(js::PerThreadDataFriendFields *pt, T initial + Rooted(js::PerThreadDataFriendFields* pt, T initial MOZ_GUARD_OBJECT_NOTIFIER_PARAM) : ptr(initial) { @@ -782,7 +782,7 @@ class MOZ_STACK_CLASS Rooted : public js::RootedBase init(pt); } - Rooted(JSRuntime *rt + Rooted(JSRuntime* rt MOZ_GUARD_OBJECT_NOTIFIER_PARAM) : ptr(js::GCMethods::initial()) { @@ -790,7 +790,7 @@ class MOZ_STACK_CLASS Rooted : public js::RootedBase init(js::PerThreadDataFriendFields::getMainThread(rt)); } - Rooted(JSRuntime *rt, T initial + Rooted(JSRuntime* rt, T initial MOZ_GUARD_OBJECT_NOTIFIER_PARAM) : ptr(initial) { @@ -809,7 +809,7 @@ class MOZ_STACK_CLASS Rooted : public js::RootedBase #endif #ifdef JSGC_TRACK_EXACT_ROOTS - Rooted *previous() { return prev; } + Rooted* previous() { return prev; } #endif /* @@ -818,18 +818,18 @@ class MOZ_STACK_CLASS Rooted : public js::RootedBase */ operator const T&() const { return ptr; } T operator->() const { return ptr; } - T *address() { return &ptr; } - const T *address() const { return &ptr; } - T &get() { return ptr; } - const T &get() const { return ptr; } + T* address() { return &ptr; } + const T* address() const { return &ptr; } + T& get() { return ptr; } + const T& get() const { return ptr; } - T &operator=(T value) { + T& operator=(T value) { MOZ_ASSERT(!js::GCMethods::poisoned(value)); ptr = value; return ptr; } - T &operator=(const Rooted &value) { + T& operator=(const Rooted& value) { ptr = value; return ptr; } @@ -839,12 +839,12 @@ class MOZ_STACK_CLASS Rooted : public js::RootedBase ptr = value; } - bool operator!=(const T &other) const { return ptr != other; } - bool operator==(const T &other) const { return ptr == other; } + bool operator!=(const T& other) const { return ptr != other; } + bool operator==(const T& other) const { return ptr == other; } private: #ifdef JSGC_TRACK_EXACT_ROOTS - Rooted **stack, *prev; + Rooted** stack, *prev; #endif /* @@ -855,7 +855,7 @@ class MOZ_STACK_CLASS Rooted : public js::RootedBase MOZ_DECL_USE_GUARD_OBJECT_NOTIFIER - Rooted(const Rooted &) MOZ_DELETE; + Rooted(const Rooted&) MOZ_DELETE; }; } /* namespace JS */ @@ -886,7 +886,7 @@ class RootedBase * including the following two methods: * * static inline js::ThingRootKind rootKind() { return js::THING_ROOT_CUSTOM; } - * void trace(JSTracer *trc); + * void trace(JSTracer* trc); * * The trace() method must trace all of the class's fields. * @@ -903,24 +903,24 @@ class JS_PUBLIC_API(RootedGeneric) public: JS::Rooted rooter; - RootedGeneric(js::ContextFriendFields *cx) + RootedGeneric(js::ContextFriendFields* cx) : rooter(cx) { } - RootedGeneric(js::ContextFriendFields *cx, const GCType &initial) + RootedGeneric(js::ContextFriendFields* cx, const GCType& initial) : rooter(cx, initial) { } - virtual inline void trace(JSTracer *trc); + virtual inline void trace(JSTracer* trc); operator const GCType&() const { return rooter.get(); } GCType operator->() const { return rooter.get(); } }; template -inline void RootedGeneric::trace(JSTracer *trc) +inline void RootedGeneric::trace(JSTracer* trc) { rooter->trace(trc); } @@ -930,7 +930,7 @@ inline void RootedGeneric::trace(JSTracer *trc) // though it's never called.) MSVC's complaint is not unreasonable, so // specialize for void*. template <> -inline void RootedGeneric::trace(JSTracer *trc) +inline void RootedGeneric::trace(JSTracer* trc) { MOZ_ASSUME_UNREACHABLE("RootedGeneric::trace()"); } @@ -941,7 +941,7 @@ class FakeRooted : public RootedBase { public: template - FakeRooted(CX *cx + FakeRooted(CX* cx MOZ_GUARD_OBJECT_NOTIFIER_PARAM) : ptr(GCMethods::initial()) { @@ -949,7 +949,7 @@ class FakeRooted : public RootedBase } template - FakeRooted(CX *cx, T initial + FakeRooted(CX* cx, T initial MOZ_GUARD_OBJECT_NOTIFIER_PARAM) : ptr(initial) { @@ -958,32 +958,32 @@ class FakeRooted : public RootedBase operator T() const { return ptr; } T operator->() const { return ptr; } - T *address() { return &ptr; } - const T *address() const { return &ptr; } - T &get() { return ptr; } - const T &get() const { return ptr; } + T* address() { return &ptr; } + const T* address() const { return &ptr; } + T& get() { return ptr; } + const T& get() const { return ptr; } - FakeRooted &operator=(T value) { + FakeRooted& operator=(T value) { MOZ_ASSERT(!GCMethods::poisoned(value)); ptr = value; return *this; } - FakeRooted &operator=(const FakeRooted &other) { + FakeRooted& operator=(const FakeRooted& other) { MOZ_ASSERT(!GCMethods::poisoned(other.ptr)); ptr = other.ptr; return *this; } - bool operator!=(const T &other) const { return ptr != other; } - bool operator==(const T &other) const { return ptr == other; } + bool operator!=(const T& other) const { return ptr != other; } + bool operator==(const T& other) const { return ptr == other; } private: T ptr; MOZ_DECL_USE_GUARD_OBJECT_NOTIFIER - FakeRooted(const FakeRooted &) MOZ_DELETE; + FakeRooted(const FakeRooted&) MOZ_DELETE; }; /* Interface substitute for MutableHandle which is not required to point to rooted memory. */ @@ -991,11 +991,11 @@ template class FakeMutableHandle : public js::MutableHandleBase { public: - FakeMutableHandle(T *t) { + FakeMutableHandle(T* t) { ptr = t; } - FakeMutableHandle(FakeRooted *root) { + FakeMutableHandle(FakeRooted* root) { ptr = root->address(); } @@ -1004,7 +1004,7 @@ class FakeMutableHandle : public js::MutableHandleBase *ptr = v; } - T *address() const { return ptr; } + T* address() const { return ptr; } T get() const { return *ptr; } operator T() const { return get(); } @@ -1013,7 +1013,7 @@ class FakeMutableHandle : public js::MutableHandleBase private: FakeMutableHandle() {} - T *ptr; + T* ptr; template void operator=(S v) MOZ_DELETE; @@ -1077,42 +1077,42 @@ namespace JS { template template inline -Handle::Handle(const Rooted &root, +Handle::Handle(const Rooted& root, typename mozilla::EnableIf::value, int>::Type dummy) { - ptr = reinterpret_cast(root.address()); + ptr = reinterpret_cast(root.address()); } template template inline -Handle::Handle(const PersistentRooted &root, +Handle::Handle(const PersistentRooted& root, typename mozilla::EnableIf::value, int>::Type dummy) { - ptr = reinterpret_cast(root.address()); + ptr = reinterpret_cast(root.address()); } template template inline -Handle::Handle(MutableHandle &root, +Handle::Handle(MutableHandle& root, typename mozilla::EnableIf::value, int>::Type dummy) { - ptr = reinterpret_cast(root.address()); + ptr = reinterpret_cast(root.address()); } template inline -MutableHandle::MutableHandle(Rooted *root) +MutableHandle::MutableHandle(Rooted* root) { - static_assert(sizeof(MutableHandle) == sizeof(T *), + static_assert(sizeof(MutableHandle) == sizeof(T*), "MutableHandle must be binary compatible with T*."); ptr = root->address(); } template inline -MutableHandle::MutableHandle(PersistentRooted *root) +MutableHandle::MutableHandle(PersistentRooted* root) { - static_assert(sizeof(MutableHandle) == sizeof(T *), + static_assert(sizeof(MutableHandle) == sizeof(T*), "MutableHandle must be binary compatible with T*."); ptr = root->address(); } @@ -1156,33 +1156,33 @@ class PersistentRooted : private mozilla::LinkedListElement friend class js::gc::PersistentRootedMarker; - void registerWithRuntime(JSRuntime *rt) { - JS::shadow::Runtime *srt = JS::shadow::Runtime::asShadowRuntime(rt); + void registerWithRuntime(JSRuntime* rt) { + JS::shadow::Runtime* srt = JS::shadow::Runtime::asShadowRuntime(rt); srt->getPersistentRootedList().insertBack(this); } public: - PersistentRooted(JSContext *cx) : ptr(js::GCMethods::initial()) + PersistentRooted(JSContext* cx) : ptr(js::GCMethods::initial()) { registerWithRuntime(js::GetRuntime(cx)); } - PersistentRooted(JSContext *cx, T initial) : ptr(initial) + PersistentRooted(JSContext* cx, T initial) : ptr(initial) { registerWithRuntime(js::GetRuntime(cx)); } - PersistentRooted(JSRuntime *rt) : ptr(js::GCMethods::initial()) + PersistentRooted(JSRuntime* rt) : ptr(js::GCMethods::initial()) { registerWithRuntime(rt); } - PersistentRooted(JSRuntime *rt, T initial) : ptr(initial) + PersistentRooted(JSRuntime* rt, T initial) : ptr(initial) { registerWithRuntime(rt); } - PersistentRooted(PersistentRooted &rhs) : ptr(rhs.ptr) + PersistentRooted(PersistentRooted& rhs) : ptr(rhs.ptr) { /* * Copy construction takes advantage of the fact that the original @@ -1198,18 +1198,18 @@ class PersistentRooted : private mozilla::LinkedListElement */ operator const T&() const { return ptr; } T operator->() const { return ptr; } - T *address() { return &ptr; } - const T *address() const { return &ptr; } - T &get() { return ptr; } - const T &get() const { return ptr; } + T* address() { return &ptr; } + const T* address() const { return &ptr; } + T& get() { return ptr; } + const T& get() const { return ptr; } - T &operator=(T value) { + T& operator=(T value) { MOZ_ASSERT(!js::GCMethods::poisoned(value)); ptr = value; return ptr; } - T &operator=(const PersistentRooted &value) { + T& operator=(const PersistentRooted& value) { ptr = value; return ptr; } @@ -1219,8 +1219,8 @@ class PersistentRooted : private mozilla::LinkedListElement ptr = value; } - bool operator!=(const T &other) const { return ptr != other; } - bool operator==(const T &other) const { return ptr == other; } + bool operator!=(const T& other) const { return ptr != other; } + bool operator==(const T& other) const { return ptr == other; } private: T ptr; @@ -1234,16 +1234,16 @@ namespace js { class CompilerRootNode { protected: - CompilerRootNode(js::gc::Cell *ptr) : next(nullptr), ptr_(ptr) {} + CompilerRootNode(js::gc::Cell* ptr) : next(nullptr), ptr_(ptr) {} public: - void **address() { return (void **)&ptr_; } + void** address() { return (void**)&ptr_; } public: - CompilerRootNode *next; + CompilerRootNode* next; protected: - js::gc::Cell *ptr_; + js::gc::Cell* ptr_; }; } /* namespace js */ diff --git a/js/public/StructuredClone.h b/js/public/StructuredClone.h index 98eabcb577..0452923fcb 100644 --- a/js/public/StructuredClone.h +++ b/js/public/StructuredClone.h @@ -59,8 +59,8 @@ enum TransferableOwnership { // may use the JS_Read* APIs to read any other relevant parts of the object // from the reader r. closure is any value passed to the JS_ReadStructuredClone // function. Return the new object on success, nullptr on error/exception. -typedef JSObject *(*ReadStructuredCloneOp)(JSContext *cx, JSStructuredCloneReader *r, - uint32_t tag, uint32_t data, void *closure); +typedef JSObject* (*ReadStructuredCloneOp)(JSContext* cx, JSStructuredCloneReader* r, + uint32_t tag, uint32_t data, void* closure); // Structured data serialization hook. The engine can write primitive values, // Objects, Arrays, Dates, RegExps, TypedArrays, and ArrayBuffers. Any other @@ -71,22 +71,22 @@ typedef JSObject *(*ReadStructuredCloneOp)(JSContext *cx, JSStructuredCloneReade // writer w. closure is any value passed to the JS_WriteStructuredCLone function. // // Return true on success, false on error/exception. -typedef bool (*WriteStructuredCloneOp)(JSContext *cx, JSStructuredCloneWriter *w, - JS::HandleObject obj, void *closure); +typedef bool (*WriteStructuredCloneOp)(JSContext* cx, JSStructuredCloneWriter* w, + JS::HandleObject obj, void* closure); // This is called when JS_WriteStructuredClone is given an invalid transferable. // To follow HTML5, the application must throw a DATA_CLONE_ERR DOMException // with error set to one of the JS_SCERR_* values. -typedef void (*StructuredCloneErrorOp)(JSContext *cx, uint32_t errorid); +typedef void (*StructuredCloneErrorOp)(JSContext* cx, uint32_t errorid); // This is called when JS_ReadStructuredClone receives a transferable object // not known to the engine. If this hook does not exist or returns false, the // JS engine calls the reportError op if set, otherwise it throws a // DATA_CLONE_ERR DOM Exception. This method is called before any other // callback and must return a non-null object in returnObject on success. -typedef bool (*ReadTransferStructuredCloneOp)(JSContext *cx, JSStructuredCloneReader *r, - uint32_t tag, void *content, uint64_t extraData, - void *closure, +typedef bool (*ReadTransferStructuredCloneOp)(JSContext* cx, JSStructuredCloneReader* r, + uint32_t tag, void* content, uint64_t extraData, + void* closure, JS::MutableHandleObject returnObject); // Called when JS_WriteStructuredClone receives a transferable object not @@ -103,20 +103,20 @@ typedef bool (*ReadTransferStructuredCloneOp)(JSContext *cx, JSStructuredCloneRe // // content, extraData: what the ReadTransferStructuredCloneOp will receive // -typedef bool (*TransferStructuredCloneOp)(JSContext *cx, +typedef bool (*TransferStructuredCloneOp)(JSContext* cx, JS::Handle obj, - void *closure, + void* closure, // Output: - uint32_t *tag, - JS::TransferableOwnership *ownership, - void **content, - uint64_t *extraData); + uint32_t* tag, + JS::TransferableOwnership* ownership, + void** content, + uint64_t* extraData); // Called when JS_ClearStructuredClone has to free an unknown transferable // object. Note that it should never trigger a garbage collection (and will // assert in a debug build if it does.) typedef void (*FreeTransferStructuredCloneOp)(uint32_t tag, JS::TransferableOwnership ownership, - void *content, uint64_t extraData, void *closure); + void* content, uint64_t extraData, void* closure); // The maximum supported structured-clone serialization format version. Note // that this does not need to be bumped for Transferable-only changes, since @@ -134,36 +134,36 @@ struct JSStructuredCloneCallbacks { // Note: if the *data contains transferable objects, it can be read only once. JS_PUBLIC_API(bool) -JS_ReadStructuredClone(JSContext *cx, uint64_t *data, size_t nbytes, uint32_t version, +JS_ReadStructuredClone(JSContext* cx, uint64_t* data, size_t nbytes, uint32_t version, JS::MutableHandleValue vp, - const JSStructuredCloneCallbacks *optionalCallbacks, void *closure); + const JSStructuredCloneCallbacks* optionalCallbacks, void* closure); // Note: On success, the caller is responsible for calling // JS_ClearStructuredClone(*datap, nbytes, optionalCallbacks, closure). JS_PUBLIC_API(bool) -JS_WriteStructuredClone(JSContext *cx, JS::HandleValue v, uint64_t **datap, size_t *nbytesp, - const JSStructuredCloneCallbacks *optionalCallbacks, - void *closure, JS::HandleValue transferable); +JS_WriteStructuredClone(JSContext* cx, JS::HandleValue v, uint64_t** datap, size_t* nbytesp, + const JSStructuredCloneCallbacks* optionalCallbacks, + void* closure, JS::HandleValue transferable); JS_PUBLIC_API(bool) -JS_ClearStructuredClone(uint64_t *data, size_t nbytes, - const JSStructuredCloneCallbacks *optionalCallbacks, - void *closure); +JS_ClearStructuredClone(uint64_t* data, size_t nbytes, + const JSStructuredCloneCallbacks* optionalCallbacks, + void* closure); JS_PUBLIC_API(bool) -JS_StructuredCloneHasTransferables(const uint64_t *data, size_t nbytes, bool *hasTransferable); +JS_StructuredCloneHasTransferables(const uint64_t* data, size_t nbytes, bool* hasTransferable); JS_PUBLIC_API(bool) -JS_StructuredClone(JSContext *cx, JS::HandleValue v, JS::MutableHandleValue vp, - const JSStructuredCloneCallbacks *optionalCallbacks, void *closure); +JS_StructuredClone(JSContext* cx, JS::HandleValue v, JS::MutableHandleValue vp, + const JSStructuredCloneCallbacks* optionalCallbacks, void* closure); // RAII sugar for JS_WriteStructuredClone. class JS_PUBLIC_API(JSAutoStructuredCloneBuffer) { - uint64_t *data_; + uint64_t* data_; size_t nbytes_; uint32_t version_; - const JSStructuredCloneCallbacks *callbacks_; - void *closure_; + const JSStructuredCloneCallbacks* callbacks_; + void* closure_; public: JSAutoStructuredCloneBuffer() @@ -171,47 +171,47 @@ class JS_PUBLIC_API(JSAutoStructuredCloneBuffer) { callbacks_(nullptr), closure_(nullptr) {} - JSAutoStructuredCloneBuffer(const JSStructuredCloneCallbacks *callbacks, void *closure) + JSAutoStructuredCloneBuffer(const JSStructuredCloneCallbacks* callbacks, void* closure) : data_(nullptr), nbytes_(0), version_(JS_STRUCTURED_CLONE_VERSION), callbacks_(callbacks), closure_(closure) {} - JSAutoStructuredCloneBuffer(JSAutoStructuredCloneBuffer &&other); - JSAutoStructuredCloneBuffer &operator=(JSAutoStructuredCloneBuffer &&other); + JSAutoStructuredCloneBuffer(JSAutoStructuredCloneBuffer&& other); + JSAutoStructuredCloneBuffer& operator=(JSAutoStructuredCloneBuffer&& other); ~JSAutoStructuredCloneBuffer() { clear(); } - uint64_t *data() const { return data_; } + uint64_t* data() const { return data_; } size_t nbytes() const { return nbytes_; } void clear(); // Copy some memory. It will be automatically freed by the destructor. - bool copy(const uint64_t *data, size_t nbytes, uint32_t version=JS_STRUCTURED_CLONE_VERSION); + bool copy(const uint64_t* data, size_t nbytes, uint32_t version=JS_STRUCTURED_CLONE_VERSION); // Adopt some memory. It will be automatically freed by the destructor. // data must have been allocated by the JS engine (e.g., extracted via // JSAutoStructuredCloneBuffer::steal). - void adopt(uint64_t *data, size_t nbytes, uint32_t version=JS_STRUCTURED_CLONE_VERSION); + void adopt(uint64_t* data, size_t nbytes, uint32_t version=JS_STRUCTURED_CLONE_VERSION); // Remove the buffer so that it will not be automatically freed. // After this, the caller is responsible for feeding the memory back to // JSAutoStructuredCloneBuffer::adopt. - void steal(uint64_t **datap, size_t *nbytesp, uint32_t *versionp=nullptr); + void steal(uint64_t** datap, size_t* nbytesp, uint32_t* versionp=nullptr); - bool read(JSContext *cx, JS::MutableHandleValue vp, - const JSStructuredCloneCallbacks *optionalCallbacks=nullptr, void *closure=nullptr); + bool read(JSContext* cx, JS::MutableHandleValue vp, + const JSStructuredCloneCallbacks* optionalCallbacks=nullptr, void* closure=nullptr); - bool write(JSContext *cx, JS::HandleValue v, - const JSStructuredCloneCallbacks *optionalCallbacks=nullptr, void *closure=nullptr); + bool write(JSContext* cx, JS::HandleValue v, + const JSStructuredCloneCallbacks* optionalCallbacks=nullptr, void* closure=nullptr); - bool write(JSContext *cx, JS::HandleValue v, JS::HandleValue transferable, - const JSStructuredCloneCallbacks *optionalCallbacks=nullptr, void *closure=nullptr); + bool write(JSContext* cx, JS::HandleValue v, JS::HandleValue transferable, + const JSStructuredCloneCallbacks* optionalCallbacks=nullptr, void* closure=nullptr); private: // Copy and assignment are not supported. - JSAutoStructuredCloneBuffer(const JSAutoStructuredCloneBuffer &other) MOZ_DELETE; - JSAutoStructuredCloneBuffer &operator=(const JSAutoStructuredCloneBuffer &other) MOZ_DELETE; + JSAutoStructuredCloneBuffer(const JSAutoStructuredCloneBuffer& other) MOZ_DELETE; + JSAutoStructuredCloneBuffer& operator=(const JSAutoStructuredCloneBuffer& other) MOZ_DELETE; }; // The range of tag values the application may use for its own custom object types. @@ -222,24 +222,24 @@ class JS_PUBLIC_API(JSAutoStructuredCloneBuffer) { #define JS_SCERR_TRANSFERABLE 1 JS_PUBLIC_API(void) -JS_SetStructuredCloneCallbacks(JSRuntime *rt, const JSStructuredCloneCallbacks *callbacks); +JS_SetStructuredCloneCallbacks(JSRuntime* rt, const JSStructuredCloneCallbacks* callbacks); JS_PUBLIC_API(bool) -JS_ReadUint32Pair(JSStructuredCloneReader *r, uint32_t *p1, uint32_t *p2); +JS_ReadUint32Pair(JSStructuredCloneReader* r, uint32_t* p1, uint32_t* p2); JS_PUBLIC_API(bool) -JS_ReadBytes(JSStructuredCloneReader *r, void *p, size_t len); +JS_ReadBytes(JSStructuredCloneReader* r, void* p, size_t len); JS_PUBLIC_API(bool) -JS_ReadTypedArray(JSStructuredCloneReader *r, JS::MutableHandleValue vp); +JS_ReadTypedArray(JSStructuredCloneReader* r, JS::MutableHandleValue vp); JS_PUBLIC_API(bool) -JS_WriteUint32Pair(JSStructuredCloneWriter *w, uint32_t tag, uint32_t data); +JS_WriteUint32Pair(JSStructuredCloneWriter* w, uint32_t tag, uint32_t data); JS_PUBLIC_API(bool) -JS_WriteBytes(JSStructuredCloneWriter *w, const void *p, size_t len); +JS_WriteBytes(JSStructuredCloneWriter* w, const void* p, size_t len); JS_PUBLIC_API(bool) -JS_WriteTypedArray(JSStructuredCloneWriter *w, JS::HandleValue v); +JS_WriteTypedArray(JSStructuredCloneWriter* w, JS::HandleValue v); #endif /* js_StructuredClone_h */ diff --git a/js/public/TracingAPI.h b/js/public/TracingAPI.h index 3c7fdbe1b1..bae0d35cd1 100644 --- a/js/public/TracingAPI.h +++ b/js/public/TracingAPI.h @@ -33,12 +33,12 @@ template class TenuredHeap; // of its mappings. This should be used in cases where the tracer // wants to use the existing liveness of entries. typedef void -(* JSTraceCallback)(JSTracer *trc, void **thingp, JSGCTraceKind kind); +(* JSTraceCallback)(JSTracer* trc, void** thingp, JSGCTraceKind kind); // Callback that JSTraceOp implementation can provide to return a string // describing the reference traced with JS_CallTracer. typedef void -(* JSTraceNamePrinter)(JSTracer *trc, char *buf, size_t bufsize); +(* JSTraceNamePrinter)(JSTracer* trc, char* buf, size_t bufsize); enum WeakMapTraceKind { DoNotTraceWeakMaps = 0, @@ -49,7 +49,7 @@ enum WeakMapTraceKind { class JS_PUBLIC_API(JSTracer) { public: - JSTracer(JSRuntime *rt, JSTraceCallback traceCallback, + JSTracer(JSRuntime* rt, JSTraceCallback traceCallback, WeakMapTraceKind weakTraceKind = TraceWeakMapValues); // Set debugging information about a reference to a traceable thing to prepare @@ -66,18 +66,18 @@ class JS_PUBLIC_API(JSTracer) // // The storage for name or callback's arguments needs to live only until // the following call to JS_CallTracer returns. - void setTracingDetails(JSTraceNamePrinter printer, const void *arg, size_t index) { + void setTracingDetails(JSTraceNamePrinter printer, const void* arg, size_t index) { debugPrinter_ = printer; debugPrintArg_ = arg; debugPrintIndex_ = index; } - void setTracingIndex(const char *name, size_t index) { - setTracingDetails(nullptr, (void *)name, index); + void setTracingIndex(const char* name, size_t index) { + setTracingDetails(nullptr, (void*)name, index); } - void setTracingName(const char *name) { - setTracingDetails(nullptr, (void *)name, size_t(-1)); + void setTracingName(const char* name) { + setTracingDetails(nullptr, (void*)name, size_t(-1)); } // Remove the currently set tracing details. @@ -91,19 +91,19 @@ class JS_PUBLIC_API(JSTracer) // Get the string set with the most recent call to setTracingName or return // fallback if a name printer function has been installed. - const char *tracingName(const char *fallback) const; + const char* tracingName(const char* fallback) const; // Build a description of this edge in the heap graph. This call may invoke // the debug printer, which may inspect arbitrary areas of the heap. - const char *getTracingEdgeName(char *buffer, size_t bufferSize); + const char* getTracingEdgeName(char* buffer, size_t bufferSize); // Access the currently active tracing details. JSTraceNamePrinter debugPrinter() const; - const void *debugPrintArg() const; + const void* debugPrintArg() const; size_t debugPrintIndex() const; // Return the runtime set on the tracer. - JSRuntime *runtime() const { return runtime_; } + JSRuntime* runtime() const { return runtime_; } // Return the weak map tracing behavior set on this tracer. WeakMapTraceKind eagerlyTraceWeakMaps() const { return eagerlyTraceWeakMaps_; } @@ -118,13 +118,13 @@ class JS_PUBLIC_API(JSTracer) // // This is currently complicated by our need to nest calls for Values // stored as keys in hash tables. - void setTracingLocation(void *location); + void setTracingLocation(void* location); void unsetTracingLocation(); - void **tracingLocation(void **thingp); + void** tracingLocation(void** thingp); #else - void setTracingLocation(void *location) {} + void setTracingLocation(void* location) {} void unsetTracingLocation() {} - void **tracingLocation(void **thingp) { return nullptr; } + void** tracingLocation(void** thingp) { return nullptr; } #endif // We expose |callback| directly so that IS_GC_MARKING_TRACER can compare @@ -132,13 +132,13 @@ class JS_PUBLIC_API(JSTracer) JSTraceCallback callback; private: - JSRuntime *runtime_; + JSRuntime* runtime_; JSTraceNamePrinter debugPrinter_; - const void *debugPrintArg_; + const void* debugPrintArg_; size_t debugPrintIndex_; WeakMapTraceKind eagerlyTraceWeakMaps_; #ifdef JS_GC_ZEAL - void *realLocation_; + void* realLocation_; #endif }; @@ -155,44 +155,44 @@ class JS_PUBLIC_API(JSTracer) // and re-inserted with the correct hash. // extern JS_PUBLIC_API(void) -JS_CallValueTracer(JSTracer *trc, JS::Value *valuep, const char *name); +JS_CallValueTracer(JSTracer* trc, JS::Value* valuep, const char* name); extern JS_PUBLIC_API(void) -JS_CallIdTracer(JSTracer *trc, jsid *idp, const char *name); +JS_CallIdTracer(JSTracer* trc, jsid* idp, const char* name); extern JS_PUBLIC_API(void) -JS_CallObjectTracer(JSTracer *trc, JSObject **objp, const char *name); +JS_CallObjectTracer(JSTracer* trc, JSObject** objp, const char* name); extern JS_PUBLIC_API(void) -JS_CallStringTracer(JSTracer *trc, JSString **strp, const char *name); +JS_CallStringTracer(JSTracer* trc, JSString** strp, const char* name); extern JS_PUBLIC_API(void) -JS_CallScriptTracer(JSTracer *trc, JSScript **scriptp, const char *name); +JS_CallScriptTracer(JSTracer* trc, JSScript** scriptp, const char* name); extern JS_PUBLIC_API(void) -JS_CallHeapValueTracer(JSTracer *trc, JS::Heap *valuep, const char *name); +JS_CallHeapValueTracer(JSTracer* trc, JS::Heap* valuep, const char* name); extern JS_PUBLIC_API(void) -JS_CallHeapIdTracer(JSTracer *trc, JS::Heap *idp, const char *name); +JS_CallHeapIdTracer(JSTracer* trc, JS::Heap* idp, const char* name); extern JS_PUBLIC_API(void) -JS_CallHeapObjectTracer(JSTracer *trc, JS::Heap *objp, const char *name); +JS_CallHeapObjectTracer(JSTracer* trc, JS::Heap* objp, const char* name); extern JS_PUBLIC_API(void) -JS_CallHeapStringTracer(JSTracer *trc, JS::Heap *strp, const char *name); +JS_CallHeapStringTracer(JSTracer* trc, JS::Heap* strp, const char* name); extern JS_PUBLIC_API(void) -JS_CallHeapScriptTracer(JSTracer *trc, JS::Heap *scriptp, const char *name); +JS_CallHeapScriptTracer(JSTracer* trc, JS::Heap* scriptp, const char* name); extern JS_PUBLIC_API(void) -JS_CallHeapFunctionTracer(JSTracer *trc, JS::Heap *funp, const char *name); +JS_CallHeapFunctionTracer(JSTracer* trc, JS::Heap* funp, const char* name); template inline void -JS_CallHashSetObjectTracer(JSTracer *trc, HashSetEnum &e, JSObject *const &key, const char *name) +JS_CallHashSetObjectTracer(JSTracer* trc, HashSetEnum& e, JSObject* const& key, const char* name) { - JSObject *updated = key; - trc->setTracingLocation(reinterpret_cast(&const_cast(key))); + JSObject* updated = key; + trc->setTracingLocation(reinterpret_cast(&const_cast(key))); JS_CallObjectTracer(trc, &updated, name); if (updated != key) e.rekeyFront(key, updated); @@ -201,16 +201,16 @@ JS_CallHashSetObjectTracer(JSTracer *trc, HashSetEnum &e, JSObject *const &key, // Trace an object that is known to always be tenured. No post barriers are // required in this case. extern JS_PUBLIC_API(void) -JS_CallTenuredObjectTracer(JSTracer *trc, JS::TenuredHeap *objp, const char *name); +JS_CallTenuredObjectTracer(JSTracer* trc, JS::TenuredHeap* objp, const char* name); extern JS_PUBLIC_API(void) -JS_TraceChildren(JSTracer *trc, void *thing, JSGCTraceKind kind); +JS_TraceChildren(JSTracer* trc, void* thing, JSGCTraceKind kind); extern JS_PUBLIC_API(void) -JS_TraceRuntime(JSTracer *trc); +JS_TraceRuntime(JSTracer* trc); extern JS_PUBLIC_API(void) -JS_GetTraceThingInfo(char *buf, size_t bufsize, JSTracer *trc, - void *thing, JSGCTraceKind kind, bool includeDetails); +JS_GetTraceThingInfo(char* buf, size_t bufsize, JSTracer* trc, + void* thing, JSGCTraceKind kind, bool includeDetails); #endif /* js_TracingAPI_h */ diff --git a/js/public/Utility.h b/js/public/Utility.h index fd5e7eb6af..f11cda3f25 100644 --- a/js/public/Utility.h +++ b/js/public/Utility.h @@ -55,7 +55,7 @@ namespace js {} #define JS_STATIC_ASSERT_IF(cond, expr) MOZ_STATIC_ASSERT_IF(cond, expr, "JS_STATIC_ASSERT_IF") extern MOZ_NORETURN JS_PUBLIC_API(void) -JS_Assert(const char *s, const char *file, int ln); +JS_Assert(const char* s, const char* file, int ln); /* * Abort the process in a non-graceful manner. This will cause a core file, @@ -174,7 +174,7 @@ static inline void js_free(void* p) */ #define JS_NEW_BODY(allocator, t, parms) \ - void *memory = allocator(sizeof(t)); \ + void* memory = allocator(sizeof(t)); \ return memory ? new(memory) t parms : nullptr; /* @@ -188,25 +188,25 @@ static inline void js_free(void* p) */ #define JS_DECLARE_NEW_METHODS(NEWNAME, ALLOCATOR, QUALIFIERS)\ template \ - QUALIFIERS T *NEWNAME() MOZ_HEAP_ALLOCATOR {\ + QUALIFIERS T* NEWNAME() MOZ_HEAP_ALLOCATOR {\ JS_NEW_BODY(ALLOCATOR, T, ())\ }\ \ template \ - QUALIFIERS T *NEWNAME(P1 &&p1) MOZ_HEAP_ALLOCATOR {\ + QUALIFIERS T* NEWNAME(P1&& p1) MOZ_HEAP_ALLOCATOR {\ JS_NEW_BODY(ALLOCATOR, T,\ (mozilla::Forward(p1)))\ }\ \ template \ - QUALIFIERS T *NEWNAME(P1 &&p1, P2 &&p2) MOZ_HEAP_ALLOCATOR {\ + QUALIFIERS T* NEWNAME(P1&& p1, P2&& p2) MOZ_HEAP_ALLOCATOR {\ JS_NEW_BODY(ALLOCATOR, T,\ (mozilla::Forward(p1),\ mozilla::Forward(p2)))\ }\ \ template \ - QUALIFIERS T *NEWNAME(P1 &&p1, P2 &&p2, P3 &&p3) MOZ_HEAP_ALLOCATOR {\ + QUALIFIERS T* NEWNAME(P1&& p1, P2&& p2, P3&& p3) MOZ_HEAP_ALLOCATOR {\ JS_NEW_BODY(ALLOCATOR, T,\ (mozilla::Forward(p1),\ mozilla::Forward(p2),\ @@ -214,7 +214,7 @@ static inline void js_free(void* p) }\ \ template \ - QUALIFIERS T *NEWNAME(P1 &&p1, P2 &&p2, P3 &&p3, P4 &&p4) MOZ_HEAP_ALLOCATOR {\ + QUALIFIERS T* NEWNAME(P1&& p1, P2&& p2, P3&& p3, P4&& p4) MOZ_HEAP_ALLOCATOR {\ JS_NEW_BODY(ALLOCATOR, T,\ (mozilla::Forward(p1),\ mozilla::Forward(p2),\ @@ -223,7 +223,7 @@ static inline void js_free(void* p) }\ \ template \ - QUALIFIERS T *NEWNAME(P1 &&p1, P2 &&p2, P3 &&p3, P4 &&p4, P5 &&p5) MOZ_HEAP_ALLOCATOR {\ + QUALIFIERS T* NEWNAME(P1&& p1, P2&& p2, P3&& p3, P4&& p4, P5&& p5) MOZ_HEAP_ALLOCATOR {\ JS_NEW_BODY(ALLOCATOR, T,\ (mozilla::Forward(p1),\ mozilla::Forward(p2),\ @@ -233,7 +233,7 @@ static inline void js_free(void* p) }\ \ template \ - QUALIFIERS T *NEWNAME(P1 &&p1, P2 &&p2, P3 &&p3, P4 &&p4, P5 &&p5, P6 &&p6) MOZ_HEAP_ALLOCATOR {\ + QUALIFIERS T* NEWNAME(P1&& p1, P2&& p2, P3&& p3, P4&& p4, P5&& p5, P6&& p6) MOZ_HEAP_ALLOCATOR {\ JS_NEW_BODY(ALLOCATOR, T,\ (mozilla::Forward(p1),\ mozilla::Forward(p2),\ @@ -244,7 +244,7 @@ static inline void js_free(void* p) }\ \ template \ - QUALIFIERS T *NEWNAME(P1 &&p1, P2 &&p2, P3 &&p3, P4 &&p4, P5 &&p5, P6 &&p6, P7 &&p7) MOZ_HEAP_ALLOCATOR {\ + QUALIFIERS T* NEWNAME(P1&& p1, P2&& p2, P3&& p3, P4&& p4, P5&& p5, P6&& p6, P7&& p7) MOZ_HEAP_ALLOCATOR {\ JS_NEW_BODY(ALLOCATOR, T,\ (mozilla::Forward(p1),\ mozilla::Forward(p2),\ @@ -256,7 +256,7 @@ static inline void js_free(void* p) }\ \ template \ - QUALIFIERS T *NEWNAME(P1 &&p1, P2 &&p2, P3 &&p3, P4 &&p4, P5 &&p5, P6 &&p6, P7 &&p7, P8 &&p8) MOZ_HEAP_ALLOCATOR {\ + QUALIFIERS T* NEWNAME(P1&& p1, P2&& p2, P3&& p3, P4&& p4, P5&& p5, P6&& p6, P7&& p7, P8&& p8) MOZ_HEAP_ALLOCATOR {\ JS_NEW_BODY(ALLOCATOR, T,\ (mozilla::Forward(p1),\ mozilla::Forward(p2),\ @@ -269,7 +269,7 @@ static inline void js_free(void* p) }\ \ template \ - QUALIFIERS T *NEWNAME(P1 &&p1, P2 &&p2, P3 &&p3, P4 &&p4, P5 &&p5, P6 &&p6, P7 &&p7, P8 &&p8, P9 &&p9) MOZ_HEAP_ALLOCATOR {\ + QUALIFIERS T* NEWNAME(P1&& p1, P2&& p2, P3&& p3, P4&& p4, P5&& p5, P6&& p6, P7&& p7, P8&& p8, P9&& p9) MOZ_HEAP_ALLOCATOR {\ JS_NEW_BODY(ALLOCATOR, T,\ (mozilla::Forward(p1),\ mozilla::Forward(p2),\ @@ -283,7 +283,7 @@ static inline void js_free(void* p) }\ \ template \ - QUALIFIERS T *NEWNAME(P1 &&p1, P2 &&p2, P3 &&p3, P4 &&p4, P5 &&p5, P6 &&p6, P7 &&p7, P8 &&p8, P9 &&p9, P10 &&p10) MOZ_HEAP_ALLOCATOR {\ + QUALIFIERS T* NEWNAME(P1&& p1, P2&& p2, P3&& p3, P4&& p4, P5&& p5, P6&& p6, P7&& p7, P8&& p8, P9&& p9, P10&& p10) MOZ_HEAP_ALLOCATOR {\ JS_NEW_BODY(ALLOCATOR, T,\ (mozilla::Forward(p1),\ mozilla::Forward(p2),\ @@ -298,7 +298,7 @@ static inline void js_free(void* p) }\ \ template \ - QUALIFIERS T *NEWNAME(P1 &&p1, P2 &&p2, P3 &&p3, P4 &&p4, P5 &&p5, P6 &&p6, P7 &&p7, P8 &&p8, P9 &&p9, P10 &&p10, P11 &&p11) MOZ_HEAP_ALLOCATOR {\ + QUALIFIERS T* NEWNAME(P1&& p1, P2&& p2, P3&& p3, P4&& p4, P5&& p5, P6&& p6, P7&& p7, P8&& p8, P9&& p9, P10&& p10, P11&& p11) MOZ_HEAP_ALLOCATOR {\ JS_NEW_BODY(ALLOCATOR, T,\ (mozilla::Forward(p1),\ mozilla::Forward(p2),\ @@ -314,7 +314,7 @@ static inline void js_free(void* p) }\ \ template \ - QUALIFIERS T *NEWNAME(P1 &&p1, P2 &&p2, P3 &&p3, P4 &&p4, P5 &&p5, P6 &&p6, P7 &&p7, P8 &&p8, P9 &&p9, P10 &&p10, P11 &&p11, P12 &&p12) MOZ_HEAP_ALLOCATOR {\ + QUALIFIERS T* NEWNAME(P1&& p1, P2&& p2, P3&& p3, P4&& p4, P5&& p5, P6&& p6, P7&& p7, P8&& p8, P9&& p9, P10&& p10, P11&& p11, P12&& p12) MOZ_HEAP_ALLOCATOR {\ JS_NEW_BODY(ALLOCATOR, T,\ (mozilla::Forward(p1),\ mozilla::Forward(p2),\ @@ -334,7 +334,7 @@ JS_DECLARE_NEW_METHODS(js_new, js_malloc, static MOZ_ALWAYS_INLINE) template static MOZ_ALWAYS_INLINE void -js_delete(T *p) +js_delete(T* p) { if (p) { p->~T(); @@ -344,7 +344,7 @@ js_delete(T *p) template static MOZ_ALWAYS_INLINE void -js_delete_poison(T *p) +js_delete_poison(T* p) { if (p) { p->~T(); @@ -354,35 +354,35 @@ js_delete_poison(T *p) } template -static MOZ_ALWAYS_INLINE T * +static MOZ_ALWAYS_INLINE T* js_pod_malloc() { - return (T *)js_malloc(sizeof(T)); + return (T*)js_malloc(sizeof(T)); } template -static MOZ_ALWAYS_INLINE T * +static MOZ_ALWAYS_INLINE T* js_pod_calloc() { - return (T *)js_calloc(sizeof(T)); + return (T*)js_calloc(sizeof(T)); } template -static MOZ_ALWAYS_INLINE T * +static MOZ_ALWAYS_INLINE T* js_pod_malloc(size_t numElems) { if (numElems & mozilla::tl::MulOverflowMask::value) return nullptr; - return (T *)js_malloc(numElems * sizeof(T)); + return (T*)js_malloc(numElems * sizeof(T)); } template -static MOZ_ALWAYS_INLINE T * +static MOZ_ALWAYS_INLINE T* js_pod_calloc(size_t numElems) { if (numElems & mozilla::tl::MulOverflowMask::value) return nullptr; - return (T *)js_calloc(numElems * sizeof(T)); + return (T*)js_calloc(numElems * sizeof(T)); } namespace js { @@ -399,14 +399,14 @@ SCOPED_TEMPLATE(ScopedJSFreePtr, ScopedFreePtrTraits) template struct ScopedDeletePtrTraits : public ScopedFreePtrTraits { - static void release(T *ptr) { js_delete(ptr); } + static void release(T* ptr) { js_delete(ptr); } }; SCOPED_TEMPLATE(ScopedJSDeletePtr, ScopedDeletePtrTraits) template struct ScopedReleasePtrTraits : public ScopedFreePtrTraits { - static void release(T *ptr) { if (ptr) ptr->release(); } + static void release(T* ptr) { if (ptr) ptr->release(); } }; SCOPED_TEMPLATE(ScopedReleasePtr, ScopedReleasePtrTraits) @@ -474,16 +474,16 @@ namespace JS { * a live integer value. */ -inline void PoisonPtr(void *v) +inline void PoisonPtr(void* v) { #if defined(JSGC_ROOT_ANALYSIS) && defined(JS_DEBUG) - uint8_t *ptr = (uint8_t *) v + 3; + uint8_t* ptr = (uint8_t*) v + 3; *ptr = JS_FREE_PATTERN; #endif } template -inline bool IsPoisonedPtr(T *v) +inline bool IsPoisonedPtr(T* v) { #if defined(JSGC_ROOT_ANALYSIS) && defined(JS_DEBUG) uint32_t mask = uintptr_t(v) & 0xff000000; diff --git a/js/public/Value.h b/js/public/Value.h index a84f54186e..b842478c2b 100644 --- a/js/public/Value.h +++ b/js/public/Value.h @@ -251,9 +251,9 @@ typedef union jsval_layout int32_t i32; uint32_t u32; uint32_t boo; // Don't use |bool| -- it must be four bytes. - JSString *str; - JSObject *obj; - void *ptr; + JSString* str; + JSObject* obj; + void* ptr; JSWhyMagic why; size_t word; uintptr_t uintptr; @@ -261,7 +261,7 @@ typedef union jsval_layout JSValueTag tag; } s; double asDouble; - void *asPtr; + void* asPtr; } JSVAL_ALIGNMENT jsval_layout; # elif JS_BITS_PER_WORD == 64 typedef union jsval_layout @@ -282,7 +282,7 @@ typedef union jsval_layout } payload; } s; double asDouble; - void *asPtr; + void* asPtr; size_t asWord; uintptr_t asUIntPtr; } JSVAL_ALIGNMENT jsval_layout; @@ -298,16 +298,16 @@ typedef union jsval_layout int32_t i32; uint32_t u32; uint32_t boo; // Don't use |bool| -- it must be four bytes. - JSString *str; - JSObject *obj; - void *ptr; + JSString* str; + JSObject* obj; + void* ptr; JSWhyMagic why; size_t word; uintptr_t uintptr; } payload; } s; double asDouble; - void *asPtr; + void* asPtr; } JSVAL_ALIGNMENT jsval_layout; # elif JS_BITS_PER_WORD == 64 typedef union jsval_layout @@ -326,7 +326,7 @@ typedef union jsval_layout } payload; } s; double asDouble; - void *asPtr; + void* asPtr; size_t asWord; uintptr_t asUIntPtr; } JSVAL_ALIGNMENT jsval_layout; @@ -453,7 +453,7 @@ JSVAL_IS_STRING_IMPL(jsval_layout l) } static inline jsval_layout -STRING_TO_JSVAL_IMPL(JSString *str) +STRING_TO_JSVAL_IMPL(JSString* str) { jsval_layout l; MOZ_ASSERT(uintptr_t(str) > 0x1000); @@ -462,7 +462,7 @@ STRING_TO_JSVAL_IMPL(JSString *str) return l; } -static inline JSString * +static inline JSString* JSVAL_TO_STRING_IMPL(jsval_layout l) { return l.s.payload.str; @@ -514,14 +514,14 @@ JSVAL_IS_OBJECT_OR_NULL_IMPL(jsval_layout l) return (uint32_t)l.s.tag >= (uint32_t)JSVAL_LOWER_INCL_TAG_OF_OBJ_OR_NULL_SET; } -static inline JSObject * +static inline JSObject* JSVAL_TO_OBJECT_IMPL(jsval_layout l) { return l.s.payload.obj; } static inline jsval_layout -OBJECT_TO_JSVAL_IMPL(JSObject *obj) +OBJECT_TO_JSVAL_IMPL(JSObject* obj) { jsval_layout l; MOZ_ASSERT(uintptr_t(obj) > 0x1000 || uintptr_t(obj) == 0x42); @@ -537,7 +537,7 @@ JSVAL_IS_NULL_IMPL(jsval_layout l) } static inline jsval_layout -PRIVATE_PTR_TO_JSVAL_IMPL(void *ptr) +PRIVATE_PTR_TO_JSVAL_IMPL(void* ptr) { jsval_layout l; MOZ_ASSERT(((uint32_t)ptr & 1) == 0); @@ -547,7 +547,7 @@ PRIVATE_PTR_TO_JSVAL_IMPL(void *ptr) return l; } -static inline void * +static inline void* JSVAL_TO_PRIVATE_PTR_IMPL(jsval_layout l) { return l.s.payload.ptr; @@ -560,7 +560,7 @@ JSVAL_IS_GCTHING_IMPL(jsval_layout l) return (uint32_t)l.s.tag >= (uint32_t)JSVAL_LOWER_INCL_TAG_OF_GCTHING_SET; } -static inline void * +static inline void* JSVAL_TO_GCTHING_IMPL(jsval_layout l) { return l.s.payload.ptr; @@ -683,7 +683,7 @@ JSVAL_IS_STRING_IMPL(jsval_layout l) } static inline jsval_layout -STRING_TO_JSVAL_IMPL(JSString *str) +STRING_TO_JSVAL_IMPL(JSString* str) { jsval_layout l; uint64_t strBits = (uint64_t)str; @@ -693,10 +693,10 @@ STRING_TO_JSVAL_IMPL(JSString *str) return l; } -static inline JSString * +static inline JSString* JSVAL_TO_STRING_IMPL(jsval_layout l) { - return (JSString *)(l.asBits & JSVAL_PAYLOAD_MASK); + return (JSString*)(l.asBits & JSVAL_PAYLOAD_MASK); } static inline bool @@ -745,16 +745,16 @@ JSVAL_IS_OBJECT_OR_NULL_IMPL(jsval_layout l) return l.asBits >= JSVAL_LOWER_INCL_SHIFTED_TAG_OF_OBJ_OR_NULL_SET; } -static inline JSObject * +static inline JSObject* JSVAL_TO_OBJECT_IMPL(jsval_layout l) { uint64_t ptrBits = l.asBits & JSVAL_PAYLOAD_MASK; MOZ_ASSERT((ptrBits & 0x7) == 0); - return (JSObject *)ptrBits; + return (JSObject*)ptrBits; } static inline jsval_layout -OBJECT_TO_JSVAL_IMPL(JSObject *obj) +OBJECT_TO_JSVAL_IMPL(JSObject* obj) { jsval_layout l; uint64_t objBits = (uint64_t)obj; @@ -776,12 +776,12 @@ JSVAL_IS_GCTHING_IMPL(jsval_layout l) return l.asBits >= JSVAL_LOWER_INCL_SHIFTED_TAG_OF_GCTHING_SET; } -static inline void * +static inline void* JSVAL_TO_GCTHING_IMPL(jsval_layout l) { uint64_t ptrBits = l.asBits & JSVAL_PAYLOAD_MASK; MOZ_ASSERT((ptrBits & 0x7) == 0); - return (void *)ptrBits; + return (void*)ptrBits; } static inline bool @@ -797,7 +797,7 @@ JSVAL_TRACE_KIND_IMPL(jsval_layout l) } static inline jsval_layout -PRIVATE_PTR_TO_JSVAL_IMPL(void *ptr) +PRIVATE_PTR_TO_JSVAL_IMPL(void* ptr) { jsval_layout l; uint64_t ptrBits = (uint64_t)ptr; @@ -807,11 +807,11 @@ PRIVATE_PTR_TO_JSVAL_IMPL(void *ptr) return l; } -static inline void * +static inline void* JSVAL_TO_PRIVATE_PTR_IMPL(jsval_layout l) { MOZ_ASSERT((l.asBits & 0x8000000000000000LL) == 0); - return (void *)(l.asBits << 1); + return (void*)(l.asBits << 1); } static inline bool @@ -927,7 +927,7 @@ CanonicalizeNaN(double d) * * - Note that JS::Value is 8 bytes on 32 and 64-bit architectures. Thus, on * 32-bit user code should avoid copying jsval/JS::Value as much as possible, - * preferring to pass by const Value &. + * preferring to pass by const Value&. */ class Value { @@ -955,7 +955,7 @@ class Value data = INT32_TO_JSVAL_IMPL(i); } - int32_t &getInt32Ref() { + int32_t& getInt32Ref() { MOZ_ASSERT(isInt32()); return data.s.payload.i32; } @@ -968,17 +968,17 @@ class Value setDouble(GenericNaN()); } - double &getDoubleRef() { + double& getDoubleRef() { MOZ_ASSERT(isDouble()); return data.asDouble; } - void setString(JSString *str) { + void setString(JSString* str) { MOZ_ASSERT(!IsPoisonedPtr(str)); data = STRING_TO_JSVAL_IMPL(str); } - void setObject(JSObject &obj) { + void setObject(JSObject& obj) { MOZ_ASSERT(!IsPoisonedPtr(&obj)); data = OBJECT_TO_JSVAL_IMPL(&obj); } @@ -1016,14 +1016,14 @@ class Value return false; } - void setObjectOrNull(JSObject *arg) { + void setObjectOrNull(JSObject* arg) { if (arg) setObject(*arg); else setNull(); } - void swap(Value &rhs) { + void swap(Value& rhs) { uint64_t tmp = rhs.data.asBits; rhs.data.asBits = data.asBits; data.asBits = tmp; @@ -1121,15 +1121,15 @@ class Value /*** Comparison ***/ - bool operator==(const Value &rhs) const { + bool operator==(const Value& rhs) const { return data.asBits == rhs.data.asBits; } - bool operator!=(const Value &rhs) const { + bool operator!=(const Value& rhs) const { return data.asBits != rhs.data.asBits; } - friend inline bool SameType(const Value &lhs, const Value &rhs); + friend inline bool SameType(const Value& lhs, const Value& rhs); /*** Extract the value's typed payload ***/ @@ -1148,22 +1148,22 @@ class Value return isDouble() ? toDouble() : double(toInt32()); } - JSString *toString() const { + JSString* toString() const { MOZ_ASSERT(isString()); return JSVAL_TO_STRING_IMPL(data); } - JSObject &toObject() const { + JSObject& toObject() const { MOZ_ASSERT(isObject()); return *JSVAL_TO_OBJECT_IMPL(data); } - JSObject *toObjectOrNull() const { + JSObject* toObjectOrNull() const { MOZ_ASSERT(isObjectOrNull()); return JSVAL_TO_OBJECT_IMPL(data); } - void *toGCThing() const { + void* toGCThing() const { MOZ_ASSERT(isGCThing()); return JSVAL_TO_GCTHING_IMPL(data); } @@ -1195,11 +1195,11 @@ class Value * Privates values are given a type which ensures they are not marked. */ - void setPrivate(void *ptr) { + void setPrivate(void* ptr) { data = PRIVATE_PTR_TO_JSVAL_IMPL(ptr); } - void *toPrivate() const { + void* toPrivate() const { MOZ_ASSERT(JSVAL_IS_DOUBLE_IMPL(data)); return JSVAL_TO_PRIVATE_PTR_IMPL(data); } @@ -1219,15 +1219,15 @@ class Value * and the ensuing strict-aliasing warnings. */ - void setUnmarkedPtr(void *ptr) { + void setUnmarkedPtr(void* ptr) { data.asPtr = ptr; } - void *toUnmarkedPtr() const { + void* toUnmarkedPtr() const { return data.asPtr; } - const size_t *payloadWord() const { + const size_t* payloadWord() const { #if JS_BITS_PER_WORD == 32 return &data.s.payload.word; #elif JS_BITS_PER_WORD == 64 @@ -1235,7 +1235,7 @@ class Value #endif } - const uintptr_t *payloadUIntPtr() const { + const uintptr_t* payloadUIntPtr() const { #if JS_BITS_PER_WORD == 32 return &data.s.payload.uintptr; #elif JS_BITS_PER_WORD == 64 @@ -1270,7 +1270,7 @@ class Value }; inline bool -IsPoisonedValue(const Value &v) +IsPoisonedValue(const Value& v) { if (v.isString()) return IsPoisonedPtr(v.toString()); @@ -1280,7 +1280,7 @@ IsPoisonedValue(const Value &v) } inline bool -IsOptimizedPlaceholderMagicValue(const Value &v) +IsOptimizedPlaceholderMagicValue(const Value& v) { if (v.isMagic()) { MOZ_ASSERT(v.whyMagic() == JS_OPTIMIZED_ARGUMENTS || v.whyMagic() == JS_OPTIMIZED_OUT); @@ -1344,7 +1344,7 @@ Float32Value(float f) } static inline Value -StringValue(JSString *str) +StringValue(JSString* str) { Value v; v.setString(str); @@ -1376,7 +1376,7 @@ FalseValue() } static inline Value -ObjectValue(JSObject &obj) +ObjectValue(JSObject& obj) { Value v; v.setObject(obj); @@ -1387,7 +1387,7 @@ static inline Value ObjectValueCrashOnTouch() { Value v; - v.setObject(*reinterpret_cast(0x42)); + v.setObject(*reinterpret_cast(0x42)); return v; } @@ -1506,7 +1506,7 @@ NumberValue(const T t) } static inline Value -ObjectOrNullValue(JSObject *obj) +ObjectOrNullValue(JSObject* obj) { Value v; v.setObjectOrNull(obj); @@ -1514,7 +1514,7 @@ ObjectOrNullValue(JSObject *obj) } static inline Value -PrivateValue(void *ptr) +PrivateValue(void* ptr) { Value v; v.setPrivate(ptr); @@ -1530,7 +1530,7 @@ PrivateUint32Value(uint32_t ui) } inline bool -SameType(const Value &lhs, const Value &rhs) +SameType(const Value& lhs, const Value& rhs) { return JSVAL_SAME_TYPE_IMPL(lhs.data, rhs.data); } @@ -1541,8 +1541,8 @@ SameType(const Value &lhs, const Value &rhs) #ifdef JSGC_GENERATIONAL namespace JS { -JS_PUBLIC_API(void) HeapValuePostBarrier(Value *valuep); -JS_PUBLIC_API(void) HeapValueRelocate(Value *valuep); +JS_PUBLIC_API(void) HeapValuePostBarrier(Value* valuep); +JS_PUBLIC_API(void) HeapValueRelocate(Value* valuep); } #endif @@ -1552,18 +1552,18 @@ template <> struct GCMethods { static JS::Value initial() { return JS::UndefinedValue(); } static ThingRootKind kind() { return THING_ROOT_VALUE; } - static bool poisoned(const JS::Value &v) { return JS::IsPoisonedValue(v); } + static bool poisoned(const JS::Value& v) { return JS::IsPoisonedValue(v); } }; template <> struct GCMethods { static JS::Value initial() { return JS::UndefinedValue(); } static ThingRootKind kind() { return THING_ROOT_VALUE; } - static bool poisoned(const JS::Value &v) { return JS::IsPoisonedValue(v); } - static bool needsPostBarrier(const JS::Value &v) { return v.isMarkable(); } + static bool poisoned(const JS::Value& v) { return JS::IsPoisonedValue(v); } + static bool needsPostBarrier(const JS::Value& v) { return v.isMarkable(); } #ifdef JSGC_GENERATIONAL - static void postBarrier(JS::Value *v) { JS::HeapValuePostBarrier(v); } - static void relocate(JS::Value *v) { JS::HeapValueRelocate(v); } + static void postBarrier(JS::Value* v) { JS::HeapValuePostBarrier(v); } + static void relocate(JS::Value* v) { JS::HeapValueRelocate(v); } #endif }; @@ -1606,10 +1606,10 @@ class ValueOperations double toNumber() const { return value()->toNumber(); } int32_t toInt32() const { return value()->toInt32(); } double toDouble() const { return value()->toDouble(); } - JSString *toString() const { return value()->toString(); } - JSObject &toObject() const { return value()->toObject(); } - JSObject *toObjectOrNull() const { return value()->toObjectOrNull(); } - void *toGCThing() const { return value()->toGCThing(); } + JSString* toString() const { return value()->toString(); } + JSObject& toObject() const { return value()->toObject(); } + JSObject* toObjectOrNull() const { return value()->toObjectOrNull(); } + void* toGCThing() const { return value()->toGCThing(); } JSValueType extractNonDoubleType() const { return value()->extractNonDoubleType(); } uint32_t toPrivateUint32() const { return value()->toPrivateUint32(); } @@ -1639,9 +1639,9 @@ class MutableValueOperations : public ValueOperations void setMagic(JSWhyMagic why) { value()->setMagic(why); } bool setNumber(uint32_t ui) { return value()->setNumber(ui); } bool setNumber(double d) { return value()->setNumber(d); } - void setString(JSString *str) { this->value()->setString(str); } - void setObject(JSObject &obj) { this->value()->setObject(obj); } - void setObjectOrNull(JSObject *arg) { this->value()->setObjectOrNull(arg); } + void setString(JSString* str) { this->value()->setString(str); } + void setObject(JSObject& obj) { this->value()->setObject(obj); } + void setObjectOrNull(JSObject* arg) { this->value()->setObjectOrNull(arg); } }; /* @@ -1657,8 +1657,8 @@ class HeapBase : public ValueOperations > const JS::Value * extract() const { return static_cast(this)->address(); } - void setBarriered(const JS::Value &v) { - static_cast *>(this)->set(v); + void setBarriered(const JS::Value& v) { + static_cast*>(this)->set(v); } public: @@ -1669,8 +1669,8 @@ class HeapBase : public ValueOperations > void setNaN() { setDouble(JS::GenericNaN()); } void setBoolean(bool b) { setBarriered(JS::BooleanValue(b)); } void setMagic(JSWhyMagic why) { setBarriered(JS::MagicValue(why)); } - void setString(JSString *str) { setBarriered(JS::StringValue(str)); } - void setObject(JSObject &obj) { setBarriered(JS::ObjectValue(obj)); } + void setString(JSString* str) { setBarriered(JS::StringValue(str)); } + void setObject(JSObject& obj) { setBarriered(JS::ObjectValue(obj)); } bool setNumber(uint32_t ui) { if (ui > JSVAL_INT_MAX) { @@ -1693,7 +1693,7 @@ class HeapBase : public ValueOperations > return false; } - void setObjectOrNull(JSObject *arg) { + void setObjectOrNull(JSObject* arg) { if (arg) setObject(*arg); else @@ -1909,7 +1909,7 @@ JSVAL_IS_STRING(jsval v) return JSVAL_IS_STRING_IMPL(JSVAL_TO_IMPL(v)); } -static inline JSString * +static inline JSString* JSVAL_TO_STRING(jsval v) { MOZ_ASSERT(JSVAL_IS_STRING(v)); @@ -1917,12 +1917,12 @@ JSVAL_TO_STRING(jsval v) } static inline jsval -STRING_TO_JSVAL(JSString *str) +STRING_TO_JSVAL(JSString* str) { return IMPL_TO_JSVAL(STRING_TO_JSVAL_IMPL(str)); } -static inline JSObject * +static inline JSObject* JSVAL_TO_OBJECT(jsval v) { MOZ_ASSERT(JSVAL_IS_OBJECT_OR_NULL_IMPL(JSVAL_TO_IMPL(v))); @@ -1930,7 +1930,7 @@ JSVAL_TO_OBJECT(jsval v) } static inline jsval -OBJECT_TO_JSVAL(JSObject *obj) +OBJECT_TO_JSVAL(JSObject* obj) { if (obj) return IMPL_TO_JSVAL(OBJECT_TO_JSVAL_IMPL(obj)); @@ -1968,7 +1968,7 @@ JSVAL_IS_GCTHING(jsval v) return JSVAL_IS_GCTHING_IMPL(JSVAL_TO_IMPL(v)); } -static inline void * +static inline void* JSVAL_TO_GCTHING(jsval v) { MOZ_ASSERT(JSVAL_IS_GCTHING(v)); @@ -1978,12 +1978,12 @@ JSVAL_TO_GCTHING(jsval v) /* To be GC-safe, privates are tagged as doubles. */ static inline jsval -PRIVATE_TO_JSVAL(void *ptr) +PRIVATE_TO_JSVAL(void* ptr) { return IMPL_TO_JSVAL(PRIVATE_PTR_TO_JSVAL_IMPL(ptr)); } -static inline void * +static inline void* JSVAL_TO_PRIVATE(jsval v) { MOZ_ASSERT(JSVAL_IS_DOUBLE(v)); diff --git a/js/public/Vector.h b/js/public/Vector.h index e8aef1713d..824c9602d8 100644 --- a/js/public/Vector.h +++ b/js/public/Vector.h @@ -55,8 +55,8 @@ class Vector public: Vector(AllocPolicy alloc = AllocPolicy()) : Base(alloc) {} - Vector(Vector &&vec) : Base(mozilla::Move(vec)) {} - Vector &operator=(Vector &&vec) { + Vector(Vector&& vec) : Base(mozilla::Move(vec)) {} + Vector& operator=(Vector&& vec) { return Base::operator=(mozilla::Move(vec)); } }; diff --git a/js/public/WeakMapPtr.h b/js/public/WeakMapPtr.h index f5822bef4b..defacb6b03 100644 --- a/js/public/WeakMapPtr.h +++ b/js/public/WeakMapPtr.h @@ -24,23 +24,23 @@ class JS_PUBLIC_API(WeakMapPtr) { public: WeakMapPtr() : ptr(nullptr) {}; - bool init(JSContext *cx); + bool init(JSContext* cx); bool initialized() { return ptr != nullptr; }; void destroy(); virtual ~WeakMapPtr() { MOZ_ASSERT(!initialized()); } - void trace(JSTracer *tracer); + void trace(JSTracer* tracer); - V lookup(const K &key); - bool put(JSContext *cx, const K &key, const V &value); + V lookup(const K& key); + bool put(JSContext* cx, const K& key, const V& value); - static void keyMarkCallback(JSTracer *trc, K key, void *data); + static void keyMarkCallback(JSTracer* trc, K key, void* data); private: - void *ptr; + void* ptr; // WeakMapPtr is neither copyable nor assignable. - WeakMapPtr(const WeakMapPtr &wmp) MOZ_DELETE; - WeakMapPtr &operator=(const WeakMapPtr &wmp) MOZ_DELETE; + WeakMapPtr(const WeakMapPtr& wmp) MOZ_DELETE; + WeakMapPtr& operator=(const WeakMapPtr& wmp) MOZ_DELETE; }; } /* namespace JS */ diff --git a/js/src/assembler/assembler/ARMAssembler.cpp b/js/src/assembler/assembler/ARMAssembler.cpp index 95f458fbfd..ba401dbe36 100644 --- a/js/src/assembler/assembler/ARMAssembler.cpp +++ b/js/src/assembler/assembler/ARMAssembler.cpp @@ -40,7 +40,7 @@ namespace JSC { void ARMAssembler::patchConstantPoolLoad(void* loadAddr, void* constPoolAddr) { - ARMWord *ldr = reinterpret_cast(loadAddr); + ARMWord* ldr = reinterpret_cast(loadAddr); ARMWord diff = reinterpret_cast(constPoolAddr) - ldr; ARMWord index = (*ldr & 0xfff) >> 1; @@ -615,7 +615,7 @@ void ARMAssembler::baseIndexFloatTransfer(bool isLoad, bool isDouble, FPRegister // already contain the code from m_buffer. inline void ARMAssembler::fixUpOffsets(void * buffer) { - char * data = reinterpret_cast(buffer); + char * data = reinterpret_cast(buffer); for (Jumps::Iterator iter = m_jumps.begin(); iter != m_jumps.end(); ++iter) { // The last bit is set if the constant must be placed on constant pool. int pos = (*iter) & (~0x1); @@ -640,7 +640,7 @@ inline void ARMAssembler::fixUpOffsets(void * buffer) } } -void* ARMAssembler::executableAllocAndCopy(ExecutableAllocator* allocator, ExecutablePool **poolp, CodeKind kind) +void* ARMAssembler::executableAllocAndCopy(ExecutableAllocator* allocator, ExecutablePool** poolp, CodeKind kind) { // 64-bit alignment is required for next constant pool and JIT code as well m_buffer.flushWithoutBarrier(true); diff --git a/js/src/assembler/assembler/ARMAssembler.h b/js/src/assembler/assembler/ARMAssembler.h index ffc99ca6d6..b50eec0675 100644 --- a/js/src/assembler/assembler/ARMAssembler.h +++ b/js/src/assembler/assembler/ARMAssembler.h @@ -134,7 +134,7 @@ namespace JSC { typedef AssemblerBufferWithConstantPool<2048, 4, 4, ARMAssembler> ARMBuffer; typedef SegmentedVector Jumps; - unsigned char *buffer() const { return m_buffer.buffer(); } + unsigned char* buffer() const { return m_buffer.buffer(); } bool oom() const { return m_buffer.oom(); } // ARM conditional constants @@ -964,7 +964,7 @@ namespace JSC { return loadBranchTarget(ARMRegisters::pc, cc, useConstantPool); } - void* executableAllocAndCopy(ExecutableAllocator* allocator, ExecutablePool **poolp, CodeKind kind); + void* executableAllocAndCopy(ExecutableAllocator* allocator, ExecutablePool** poolp, CodeKind kind); void executableCopy(void* buffer); void fixUpOffsets(void* buffer); @@ -1701,7 +1701,7 @@ namespace JSC { void putInst32(uint32_t data) { m_buffer.putInt(data); } - uint32_t *editSrc(JmpSrc src) { + uint32_t* editSrc(JmpSrc src) { return (uint32_t*)(((char*)m_buffer.data()) + src.offset()); } }; // ARMAssembler diff --git a/js/src/assembler/assembler/AbstractMacroAssembler.h b/js/src/assembler/assembler/AbstractMacroAssembler.h index 88aaaa2fca..94c4ac92f1 100644 --- a/js/src/assembler/assembler/AbstractMacroAssembler.h +++ b/js/src/assembler/assembler/AbstractMacroAssembler.h @@ -436,12 +436,12 @@ class AbstractMacroAssembler { JumpList() {} - JumpList(const JumpList &other) + JumpList(const JumpList& other) { m_jumps.appendAll(other.m_jumps); } - JumpList &operator=(const JumpList &other) + JumpList& operator=(const JumpList& other) { m_jumps.clear(); m_jumps.append(other.m_jumps); @@ -503,7 +503,7 @@ class AbstractMacroAssembler { return m_assembler.size(); } - unsigned char *buffer() + unsigned char* buffer() { return m_assembler.buffer(); } diff --git a/js/src/assembler/assembler/AssemblerBuffer.h b/js/src/assembler/assembler/AssemblerBuffer.h index 25640e7e5b..bfbba6bddc 100644 --- a/js/src/assembler/assembler/AssemblerBuffer.h +++ b/js/src/assembler/assembler/AssemblerBuffer.h @@ -166,7 +166,7 @@ namespace JSC { return 0; } - m_allocSize = js::AlignBytes(m_size, sizeof(void *)); + m_allocSize = js::AlignBytes(m_size, sizeof(void*)); void* result = allocator->alloc(m_allocSize, poolp, kind); if (!result) { @@ -180,9 +180,9 @@ namespace JSC { return memcpy(result, m_buffer, m_size); } - unsigned char *buffer() const { + unsigned char* buffer() const { ASSERT(!m_oom); - return reinterpret_cast(m_buffer); + return reinterpret_cast(m_buffer); } protected: @@ -270,7 +270,7 @@ namespace JSC { class GenericAssembler { - js::Sprinter *printer; + js::Sprinter* printer; public: @@ -281,11 +281,11 @@ namespace JSC { , isOOLPath(false) {} - void setPrinter(js::Sprinter *sp) { + void setPrinter(js::Sprinter* sp) { printer = sp; } - void spew(const char *fmt, ...) + void spew(const char* fmt, ...) #ifdef __GNUC__ __attribute__ ((format (printf, 2, 3))) #endif @@ -316,7 +316,7 @@ namespace JSC { } } - static void staticSpew(const char *fmt, ...) + static void staticSpew(const char* fmt, ...) #ifdef __GNUC__ __attribute__ ((format (printf, 1, 2))) #endif diff --git a/js/src/assembler/assembler/LinkBuffer.h b/js/src/assembler/assembler/LinkBuffer.h index d78ec2b438..8a5b03fc34 100644 --- a/js/src/assembler/assembler/LinkBuffer.h +++ b/js/src/assembler/assembler/LinkBuffer.h @@ -187,8 +187,8 @@ class LinkBuffer { return m_code; } - void *executableAllocAndCopy(MacroAssembler &masm, ExecutableAllocator *allocator, - ExecutablePool **poolp) + void* executableAllocAndCopy(MacroAssembler& masm, ExecutableAllocator* allocator, + ExecutablePool** poolp) { return masm.m_assembler.executableAllocAndCopy(allocator, poolp, m_codeKind); } diff --git a/js/src/assembler/assembler/MIPSAssembler.h b/js/src/assembler/assembler/MIPSAssembler.h index bf4b2602b6..da6334344e 100644 --- a/js/src/assembler/assembler/MIPSAssembler.h +++ b/js/src/assembler/assembler/MIPSAssembler.h @@ -157,7 +157,7 @@ class MIPSAssembler : public GenericAssembler { typedef MIPSRegisters::RegisterID RegisterID; typedef MIPSRegisters::FPRegisterID FPRegisterID; typedef SegmentedVector Jumps; - unsigned char *buffer() const { return m_buffer.buffer(); } + unsigned char* buffer() const { return m_buffer.buffer(); } bool oom() const { return m_buffer.oom(); } // MIPS instruction opcode field position @@ -780,7 +780,7 @@ class MIPSAssembler : public GenericAssembler { void* executableAllocAndCopy(ExecutableAllocator* allocator, ExecutablePool** poolp, CodeKind kind) { - void *result = m_buffer.executableAllocAndCopy(allocator, poolp, kind); + void* result = m_buffer.executableAllocAndCopy(allocator, poolp, kind); if (!result) return 0; diff --git a/js/src/assembler/assembler/MacroAssemblerARM.cpp b/js/src/assembler/assembler/MacroAssemblerARM.cpp index 73336e9b9c..3e7032a035 100644 --- a/js/src/assembler/assembler/MacroAssemblerARM.cpp +++ b/js/src/assembler/assembler/MacroAssemblerARM.cpp @@ -78,7 +78,7 @@ static bool isVFPPresent() #endif #ifdef WTF_OS_ANDROID - FILE *fp = fopen("/proc/cpuinfo", "r"); + FILE* fp = fopen("/proc/cpuinfo", "r"); if (!fp) return false; diff --git a/js/src/assembler/assembler/MacroAssemblerARM.h b/js/src/assembler/assembler/MacroAssemblerARM.h index 4ab79e5c00..ac4622e7d9 100644 --- a/js/src/assembler/assembler/MacroAssemblerARM.h +++ b/js/src/assembler/assembler/MacroAssemblerARM.h @@ -667,14 +667,14 @@ class MacroAssemblerARM : public AbstractMacroAssembler { } // As branch32_force32, but allow the value ('right') to be patched. - Jump branch32WithPatch(Condition cond, RegisterID left, TrustedImm32 right, DataLabel32 &dataLabel) + Jump branch32WithPatch(Condition cond, RegisterID left, TrustedImm32 right, DataLabel32& dataLabel) { ASSERT(left != ARMRegisters::S1); dataLabel = moveWithPatch(right, ARMRegisters::S1); return branch32(cond, left, ARMRegisters::S1, true); } - Jump branch32WithPatch(Condition cond, Address left, TrustedImm32 right, DataLabel32 &dataLabel) + Jump branch32WithPatch(Condition cond, Address left, TrustedImm32 right, DataLabel32& dataLabel) { ASSERT(left.base != ARMRegisters::S1); load32(left, ARMRegisters::S1); diff --git a/js/src/assembler/assembler/MacroAssemblerCodeRef.h b/js/src/assembler/assembler/MacroAssemblerCodeRef.h index b6f17ebc68..9c1fc0c6b1 100644 --- a/js/src/assembler/assembler/MacroAssemblerCodeRef.h +++ b/js/src/assembler/assembler/MacroAssemblerCodeRef.h @@ -164,11 +164,11 @@ class MacroAssemblerCodePtr { return !m_value; } - ptrdiff_t operator -(const MacroAssemblerCodePtr &other) const + ptrdiff_t operator -(const MacroAssemblerCodePtr& other) const { JS_ASSERT(m_value); - return reinterpret_cast(m_value) - - reinterpret_cast(other.m_value); + return reinterpret_cast(m_value) - + reinterpret_cast(other.m_value); } private: diff --git a/js/src/assembler/assembler/MacroAssemblerSparc.h b/js/src/assembler/assembler/MacroAssemblerSparc.h index 6639a1da55..dc8203e983 100644 --- a/js/src/assembler/assembler/MacroAssemblerSparc.h +++ b/js/src/assembler/assembler/MacroAssemblerSparc.h @@ -619,7 +619,7 @@ namespace JSC { return branch32(cond, left, SparcRegisters::g2); } - Jump branch32WithPatch(Condition cond, RegisterID left, TrustedImm32 right, DataLabel32 &dataLabel) + Jump branch32WithPatch(Condition cond, RegisterID left, TrustedImm32 right, DataLabel32& dataLabel) { // Always use move_nocheck, since the value is to be patched. dataLabel = DataLabel32(this); diff --git a/js/src/assembler/assembler/MacroAssemblerX86Common.h b/js/src/assembler/assembler/MacroAssemblerX86Common.h index fef1006f76..f73b6d0600 100644 --- a/js/src/assembler/assembler/MacroAssemblerX86Common.h +++ b/js/src/assembler/assembler/MacroAssemblerX86Common.h @@ -892,7 +892,7 @@ class MacroAssemblerX86Common : public AbstractMacroAssembler { } // Branch and record a label after the comparison. - Jump branch32WithPatch(Condition cond, RegisterID left, TrustedImm32 right, DataLabel32 &dataLabel) + Jump branch32WithPatch(Condition cond, RegisterID left, TrustedImm32 right, DataLabel32& dataLabel) { // Always use cmpl, since the value is to be patched. m_assembler.cmpl_ir_force32(right.m_value, left); @@ -900,7 +900,7 @@ class MacroAssemblerX86Common : public AbstractMacroAssembler { return Jump(m_assembler.jCC(x86Condition(cond))); } - Jump branch32WithPatch(Condition cond, Address left, TrustedImm32 right, DataLabel32 &dataLabel) + Jump branch32WithPatch(Condition cond, Address left, TrustedImm32 right, DataLabel32& dataLabel) { m_assembler.cmpl_im_force32(right.m_value, left.offset, left.base); dataLabel = DataLabel32(this); diff --git a/js/src/assembler/assembler/MacroAssemblerX86_64.h b/js/src/assembler/assembler/MacroAssemblerX86_64.h index 8434a4e2e3..abe6307e47 100644 --- a/js/src/assembler/assembler/MacroAssemblerX86_64.h +++ b/js/src/assembler/assembler/MacroAssemblerX86_64.h @@ -560,12 +560,12 @@ class MacroAssemblerX86_64 : public MacroAssemblerX86Common { void storeDouble(ImmDouble imm, Address address) { - storePtr(ImmPtr(reinterpret_cast(imm.u.u64)), address); + storePtr(ImmPtr(reinterpret_cast(imm.u.u64)), address); } void storeDouble(ImmDouble imm, BaseIndex address) { - storePtr(ImmPtr(reinterpret_cast(imm.u.u64)), address); + storePtr(ImmPtr(reinterpret_cast(imm.u.u64)), address); } static bool supportsFloatingPoint() { return true; } diff --git a/js/src/assembler/assembler/RepatchBuffer.h b/js/src/assembler/assembler/RepatchBuffer.h index b1d686021d..6d5d0d68bc 100644 --- a/js/src/assembler/assembler/RepatchBuffer.h +++ b/js/src/assembler/assembler/RepatchBuffer.h @@ -49,7 +49,7 @@ class RepatchBuffer { typedef MacroAssemblerCodePtr CodePtr; public: - RepatchBuffer(const MacroAssemblerCodeRef &ref) + RepatchBuffer(const MacroAssemblerCodeRef& ref) { m_start = ref.m_code.executableAddress(); m_size = ref.m_size; @@ -59,7 +59,7 @@ class RepatchBuffer { ExecutableAllocator::makeWritable(m_start, m_size); } - RepatchBuffer(const JITCode &code) + RepatchBuffer(const JITCode& code) { m_start = code.start(); m_size = code.size(); diff --git a/js/src/assembler/assembler/SparcAssembler.h b/js/src/assembler/assembler/SparcAssembler.h index 0864613a2c..d5f4b75852 100644 --- a/js/src/assembler/assembler/SparcAssembler.h +++ b/js/src/assembler/assembler/SparcAssembler.h @@ -957,7 +957,7 @@ namespace JSC { // General helpers size_t size() const { return m_buffer.size(); } - unsigned char *buffer() const { return m_buffer.buffer(); } + unsigned char* buffer() const { return m_buffer.buffer(); } static int getDifferenceBetweenLabels(JmpDst src, JmpDst dst) { @@ -993,7 +993,7 @@ namespace JSC { return reinterpret_cast(reinterpret_cast(code) + destination.m_offset); } - void* executableAllocAndCopy(ExecutableAllocator* allocator, ExecutablePool **poolp, CodeKind kind) + void* executableAllocAndCopy(ExecutableAllocator* allocator, ExecutablePool** poolp, CodeKind kind) { return m_buffer.executableAllocAndCopy(allocator, poolp, kind); } @@ -1006,7 +1006,7 @@ namespace JSC { static void patchPointerInternal(void* where, int value) { // Patch move_nocheck. - uint32_t *branch = (uint32_t*) where; + uint32_t* branch = (uint32_t*) where; branch[0] &= 0xFFC00000; branch[0] |= (value >> 10) & 0x3FFFFF; branch[1] &= 0xFFFFFC00; @@ -1016,7 +1016,7 @@ namespace JSC { static void patchbranch(void* where, int value) { - uint32_t *branch = (uint32_t*) where; + uint32_t* branch = (uint32_t*) where; branch[0] &= 0xFFC00000; branch[0] |= value & 0x3FFFFF; ExecutableAllocator::cacheFlush(where, 4); @@ -1029,7 +1029,7 @@ namespace JSC { static void relinkJump(void* from, void* to) { - from = (void *)((int)from - 36); + from = (void*)((int)from - 36); js::JaegerSpew(js::JSpew_Insns, ISPFX "##link ((%p)) jumps to ((%p))\n", from, to); @@ -1039,7 +1039,7 @@ namespace JSC { patchbranch(from, value); else { patchbranch(from, 4); - from = (void *)((intptr_t)from + 16); + from = (void*)((intptr_t)from + 16); patchPointerInternal(from, (int)(value * 4 - 24)); } } @@ -1049,15 +1049,15 @@ namespace JSC { ASSERT(from.m_offset != -1); ASSERT(to.m_offset != -1); intptr_t code = (intptr_t)(m_buffer.data()); - void *where = (void *)((intptr_t)code + from.m_offset); - void *target = (void *)((intptr_t)code + to.m_offset); + void* where = (void*)((intptr_t)code + from.m_offset); + void* target = (void*)((intptr_t)code + to.m_offset); relinkJump(where, target); } static void linkJump(void* code, JmpSrc from, void* to) { ASSERT(from.m_offset != -1); - void *where = (void *)((intptr_t)code + from.m_offset); + void* where = (void*)((intptr_t)code + from.m_offset); relinkJump(where, to); } @@ -1067,20 +1067,20 @@ namespace JSC { ISPFX "##relinkCall ((from=%p)) ((to=%p))\n", from, to); - void * where= (void *)((intptr_t)from - 20); + void * where= (void*)((intptr_t)from - 20); patchPointerInternal(where, (int)to); ExecutableAllocator::cacheFlush(where, 8); } static void linkCall(void* code, JmpSrc where, void* to) { - void *from = (void *)((intptr_t)code + where.m_offset); + void* from = (void*)((intptr_t)code + where.m_offset); js::JaegerSpew(js::JSpew_Insns, ISPFX "##linkCall ((from=%p)) ((to=%p))\n", from, to); int disp = ((int)to - (int)from)/4; - *(uint32_t *)((int)from) &= 0x40000000; - *(uint32_t *)((int)from) |= disp & 0x3fffffff; + *(uint32_t*)((int)from) &= 0x40000000; + *(uint32_t*)((int)from) |= disp & 0x3fffffff; ExecutableAllocator::cacheFlush(from, 4); } @@ -1090,7 +1090,7 @@ namespace JSC { ISPFX "##linkPointer ((%p + %#x)) points to ((%p))\n", code, where.m_offset, value); - void *from = (void *)((intptr_t)code + where.m_offset); + void* from = (void*)((intptr_t)code + where.m_offset); patchPointerInternal(from, (int)value); } @@ -1115,22 +1115,22 @@ namespace JSC { static void repatchLoadPtrToLEA(void* where) { // sethi is used. The offset is in a register - if (*(uint32_t *)((int)where) & 0x01000000) - where = (void *)((intptr_t)where + 8); + if (*(uint32_t*)((int)where) & 0x01000000) + where = (void*)((intptr_t)where + 8); - *(uint32_t *)((int)where) &= 0x3fffffff; - *(uint32_t *)((int)where) |= 0x80000000; + *(uint32_t*)((int)where) &= 0x3fffffff; + *(uint32_t*)((int)where) |= 0x80000000; ExecutableAllocator::cacheFlush(where, 4); } static void repatchLEAToLoadPtr(void* where) { // sethi is used. The offset is in a register - if (*(uint32_t *)((int)where) & 0x01000000) - where = (void *)((intptr_t)where + 8); + if (*(uint32_t*)((int)where) & 0x01000000) + where = (void*)((intptr_t)where + 8); - *(uint32_t *)((int)where) &= 0x3fffffff; - *(uint32_t *)((int)where) |= 0xc0000000; + *(uint32_t*)((int)where) &= 0x3fffffff; + *(uint32_t*)((int)where) |= 0xc0000000; ExecutableAllocator::cacheFlush(where, 4); } diff --git a/js/src/assembler/assembler/X86Assembler.h b/js/src/assembler/assembler/X86Assembler.h index 91ff1c62a4..6d50a39601 100644 --- a/js/src/assembler/assembler/X86Assembler.h +++ b/js/src/assembler/assembler/X86Assembler.h @@ -442,7 +442,7 @@ class X86Assembler : public GenericAssembler { size_t size() const { return m_formatter.size(); } size_t allocSize() const { return m_formatter.allocSize(); } - unsigned char *buffer() const { return m_formatter.buffer(); } + unsigned char* buffer() const { return m_formatter.buffer(); } bool oom() const { return m_formatter.oom(); } void nop() @@ -3223,7 +3223,7 @@ class X86Assembler : public GenericAssembler { *next = JmpSrc(offset); return true; } - void setNextJump(const JmpSrc& from, const JmpSrc &to) + void setNextJump(const JmpSrc& from, const JmpSrc& to) { // Sanity check - if the assembler has OOM'd, it will start overwriting // its internal buffer and thus our links could be garbage. @@ -3369,7 +3369,7 @@ class X86Assembler : public GenericAssembler { return dst.m_offset - src.m_offset; } - void* executableAllocAndCopy(ExecutableAllocator* allocator, ExecutablePool **poolp, CodeKind kind) + void* executableAllocAndCopy(ExecutableAllocator* allocator, ExecutablePool** poolp, CodeKind kind) { return m_formatter.executableAllocAndCopy(allocator, poolp, kind); } @@ -3383,7 +3383,7 @@ class X86Assembler : public GenericAssembler { { intptr_t offset = reinterpret_cast(to) - reinterpret_cast(from); ASSERT(offset == static_cast(offset)); -#define JS_CRASH(x) *(int *)x = 0 +#define JS_CRASH(x) *(int*)x = 0 if (offset != static_cast(offset)) JS_CRASH(0xC0DE); #undef JS_CRASH @@ -3392,20 +3392,20 @@ class X86Assembler : public GenericAssembler { setInt32(from, offset); } - static void *getRel32Target(void* where) + static void* getRel32Target(void* where) { int32_t rel = getInt32(where); - return (char *)where + rel; + return (char*)where + rel; } - static void *getPointer(void* where) + static void* getPointer(void* where) { - return reinterpret_cast(where)[-1]; + return reinterpret_cast(where)[-1]; } - static void **getPointerRef(void* where) + static void** getPointerRef(void* where) { - return &reinterpret_cast(where)[-1]; + return &reinterpret_cast(where)[-1]; } static void setPointer(void* where, const void* value) @@ -3417,7 +3417,7 @@ class X86Assembler : public GenericAssembler { // Test whether the given address will fit in an address immediate field. // This is always true on x86, but on x64 it's only true for addreses // which fit in the 32-bit immediate field. - static bool isAddressImmediate(const void *address) { + static bool isAddressImmediate(const void* address) { intptr_t value = reinterpret_cast(address); int32_t immediate = static_cast(value); return value == immediate; @@ -3426,7 +3426,7 @@ class X86Assembler : public GenericAssembler { // Convert the given address to a 32-bit immediate field value. This is // a no-op on x86, but on x64 it asserts that the address is actually // a valid address immediate. - static int32_t addressImmediate(const void *address) { + static int32_t addressImmediate(const void* address) { #if WTF_CPU_X86_64 // x64's 64-bit addresses don't all fit in the 32-bit immediate. ASSERT(isAddressImmediate(address)); @@ -3884,7 +3884,7 @@ class X86Assembler : public GenericAssembler { size_t size() const { return m_buffer.size(); } size_t allocSize() const { return m_buffer.allocSize(); } - unsigned char *buffer() const { return m_buffer.buffer(); } + unsigned char* buffer() const { return m_buffer.buffer(); } bool oom() const { return m_buffer.oom(); } bool isAligned(int alignment) const { return m_buffer.isAligned(alignment); } void* data() const { return m_buffer.data(); } diff --git a/js/src/assembler/jit/ExecutableAllocator.cpp b/js/src/assembler/jit/ExecutableAllocator.cpp index 19378a17b8..daa9268f8c 100644 --- a/js/src/assembler/jit/ExecutableAllocator.cpp +++ b/js/src/assembler/jit/ExecutableAllocator.cpp @@ -47,7 +47,7 @@ ExecutablePool::~ExecutablePool() } void -ExecutableAllocator::addSizeOfCode(JS::CodeSizes *sizes) const +ExecutableAllocator::addSizeOfCode(JS::CodeSizes* sizes) const { if (m_pools.initialized()) { for (ExecPoolHashSet::Range r = m_pools.all(); !r.empty(); r.popFront()) { diff --git a/js/src/assembler/jit/ExecutableAllocator.h b/js/src/assembler/jit/ExecutableAllocator.h index 4616e563b0..5fbb065d8e 100644 --- a/js/src/assembler/jit/ExecutableAllocator.h +++ b/js/src/assembler/jit/ExecutableAllocator.h @@ -172,7 +172,7 @@ namespace JSC { void* alloc(size_t n, CodeKind kind) { JS_ASSERT(n <= available()); - void *result = m_freePtr; + void* result = m_freePtr; m_freePtr += n; switch (kind) { @@ -259,12 +259,12 @@ class ExecutableAllocator { // This alloc is infallible because poolForSize() just obtained // (found, or created if necessary) a pool that had enough space. - void *result = (*poolp)->alloc(n, type); + void* result = (*poolp)->alloc(n, type); JS_ASSERT(result); return result; } - void releasePoolPages(ExecutablePool *pool) { + void releasePoolPages(ExecutablePool* pool) { JS_ASSERT(pool->m_allocation.pages); if (destroyCallback) destroyCallback(pool->m_allocation.pages, pool->m_allocation.size); @@ -273,7 +273,7 @@ class ExecutableAllocator { m_pools.remove(m_pools.lookup(pool)); // this asserts if |pool| is not in m_pools } - void addSizeOfCode(JS::CodeSizes *sizes) const; + void addSizeOfCode(JS::CodeSizes* sizes) const; void toggleAllCodeAsAccessible(bool accessible); bool codeContains(char* address); @@ -311,7 +311,7 @@ class ExecutableAllocator { // On OOM, this will return an Allocation where pages is NULL. ExecutablePool::Allocation systemAlloc(size_t n); static void systemRelease(const ExecutablePool::Allocation& alloc); - void *computeRandomAllocationAddress(); + void* computeRandomAllocationAddress(); ExecutablePool* createPool(size_t n) { @@ -330,7 +330,7 @@ class ExecutableAllocator { if (!a.pages) return NULL; - ExecutablePool *pool = js_new(this, a); + ExecutablePool* pool = js_new(this, a); if (!pool) { systemRelease(a); return NULL; @@ -348,9 +348,9 @@ class ExecutableAllocator { // best strategy because (a) it maximizes the chance of the next // allocation fitting in a small pool, and (b) it minimizes the // potential waste when a small pool is next abandoned. - ExecutablePool *minPool = NULL; + ExecutablePool* minPool = NULL; for (size_t i = 0; i < m_smallPools.length(); i++) { - ExecutablePool *pool = m_smallPools[i]; + ExecutablePool* pool = m_smallPools[i]; if (n <= pool->available() && (!minPool || pool->available() < minPool->available())) minPool = pool; } @@ -386,7 +386,7 @@ class ExecutableAllocator { // If the new allocator will result in more free space than the small // pool with the least space, then we will use it instead - ExecutablePool *minPool = m_smallPools[iMin]; + ExecutablePool* minPool = m_smallPools[iMin]; if ((pool->available() - n) > minPool->available()) { minPool->release(); m_smallPools[iMin] = pool; @@ -419,7 +419,7 @@ class ExecutableAllocator { { } #elif defined(JS_ARM_SIMULATOR) - static void cacheFlush(void *code, size_t size) + static void cacheFlush(void* code, size_t size) { js::jit::Simulator::FlushICache(code, size); } @@ -509,13 +509,13 @@ class ExecutableAllocator { // These are strong references; they keep pools alive. static const size_t maxSmallPools = 4; - typedef js::Vector SmallExecPoolVector; + typedef js::Vector SmallExecPoolVector; SmallExecPoolVector m_smallPools; // All live pools are recorded here, just for stats purposes. These are // weak references; they don't keep pools alive. When a pool is destroyed // its reference is removed from m_pools. - typedef js::HashSet, js::SystemAllocPolicy> + typedef js::HashSet, js::SystemAllocPolicy> ExecPoolHashSet; ExecPoolHashSet m_pools; // All pools, just for stats purposes. diff --git a/js/src/assembler/jit/ExecutableAllocatorPosix.cpp b/js/src/assembler/jit/ExecutableAllocatorPosix.cpp index c5c95f15d0..f08c93b4ca 100644 --- a/js/src/assembler/jit/ExecutableAllocatorPosix.cpp +++ b/js/src/assembler/jit/ExecutableAllocatorPosix.cpp @@ -43,7 +43,7 @@ size_t ExecutableAllocator::determinePageSize() ExecutablePool::Allocation ExecutableAllocator::systemAlloc(size_t n) { - void *allocation = mmap(NULL, n, INITIAL_PROTECTION_FLAGS, MAP_PRIVATE | MAP_ANON, VM_TAG_FOR_EXECUTABLEALLOCATOR_MEMORY, 0); + void* allocation = mmap(NULL, n, INITIAL_PROTECTION_FLAGS, MAP_PRIVATE | MAP_ANON, VM_TAG_FOR_EXECUTABLEALLOCATOR_MEMORY, 0); if (allocation == MAP_FAILED) allocation = NULL; ExecutablePool::Allocation alloc = { reinterpret_cast(allocation), n }; diff --git a/js/src/assembler/jit/ExecutableAllocatorWin.cpp b/js/src/assembler/jit/ExecutableAllocatorWin.cpp index 427bb11f88..bcc78ed799 100644 --- a/js/src/assembler/jit/ExecutableAllocatorWin.cpp +++ b/js/src/assembler/jit/ExecutableAllocatorWin.cpp @@ -30,7 +30,7 @@ #include "jswin.h" #include "mozilla/WindowsVersion.h" -extern uint64_t random_next(uint64_t *, int); +extern uint64_t random_next(uint64_t*, int); namespace JSC { @@ -43,7 +43,7 @@ size_t ExecutableAllocator::determinePageSize() return system_info.dwPageSize; } -void *ExecutableAllocator::computeRandomAllocationAddress() +void* ExecutableAllocator::computeRandomAllocationAddress() { /* * Inspiration is V8's OS::Allocate in platform-win32.cc. @@ -67,7 +67,7 @@ void *ExecutableAllocator::computeRandomAllocationAddress() # error "Unsupported architecture" #endif uint64_t rand = random_next(&rngSeed, 32) << chunkBits; - return (void *) (base | rand & mask); + return (void*) (base | rand & mask); } static bool @@ -88,12 +88,12 @@ RandomizeIsBroken() ExecutablePool::Allocation ExecutableAllocator::systemAlloc(size_t n) { - void *allocation = NULL; + void* allocation = NULL; // Randomization disabled to avoid a performance fault on x64 builds. // See bug 728623. #ifndef JS_CPU_X64 if (!RandomizeIsBroken()) { - void *randomAddress = computeRandomAllocationAddress(); + void* randomAddress = computeRandomAllocationAddress(); allocation = VirtualAlloc(randomAddress, n, MEM_COMMIT | MEM_RESERVE, PAGE_EXECUTE_READWRITE); } diff --git a/js/src/assembler/wtf/Platform.h b/js/src/assembler/wtf/Platform.h index 4e78ae5c4e..753fa2ae93 100644 --- a/js/src/assembler/wtf/Platform.h +++ b/js/src/assembler/wtf/Platform.h @@ -1179,7 +1179,7 @@ #endif /* Accelerated compositing */ -#if (WTF_PLATFORM_MAC && !defined(BUILDING_ON_TIGER)) || WTF_PLATFORM_IOS || WTF_PLATFORM_QT || (WTF_PLATFORM_WIN && !WTF_OS_WINCE &&!defined(WIN_CAIRO)) +#if (WTF_PLATFORM_MAC && !defined(BUILDING_ON_TIGER)) || WTF_PLATFORM_IOS || WTF_PLATFORM_QT || (WTF_PLATFORM_WIN && !WTF_OS_WINCE&&!defined(WIN_CAIRO)) #define WTF_USE_ACCELERATED_COMPOSITING 1 #endif diff --git a/js/src/builtin/Eval.cpp b/js/src/builtin/Eval.cpp index 11633eb4ae..8a85aa32b7 100644 --- a/js/src/builtin/Eval.cpp +++ b/js/src/builtin/Eval.cpp @@ -23,7 +23,7 @@ using mozilla::HashString; // We should be able to assert this for *any* fp->scopeChain(). static void -AssertInnerizedScopeChain(JSContext *cx, JSObject &scopeobj) +AssertInnerizedScopeChain(JSContext* cx, JSObject& scopeobj) { #ifdef DEBUG RootedObject obj(cx); @@ -36,7 +36,7 @@ AssertInnerizedScopeChain(JSContext *cx, JSObject &scopeobj) } static bool -IsEvalCacheCandidate(JSScript *script) +IsEvalCacheCandidate(JSScript* script) { // Make sure there are no inner objects which might use the wrong parent // and/or call scope by reusing the previous eval's script. Skip the @@ -48,7 +48,7 @@ IsEvalCacheCandidate(JSScript *script) } /* static */ HashNumber -EvalCacheHashPolicy::hash(const EvalCacheLookup &l) +EvalCacheHashPolicy::hash(const EvalCacheLookup& l) { return AddToHash(HashString(l.str->chars(), l.str->length()), l.callerScript.get(), @@ -57,15 +57,15 @@ EvalCacheHashPolicy::hash(const EvalCacheLookup &l) } /* static */ bool -EvalCacheHashPolicy::match(const EvalCacheEntry &cacheEntry, const EvalCacheLookup &l) +EvalCacheHashPolicy::match(const EvalCacheEntry& cacheEntry, const EvalCacheLookup& l) { - JSScript *script = cacheEntry.script; + JSScript* script = cacheEntry.script; JS_ASSERT(IsEvalCacheCandidate(script)); // Get the source string passed for safekeeping in the atom map // by the prior eval to frontend::CompileScript. - JSAtom *keyStr = script->atoms[0]; + JSAtom* keyStr = script->atoms[0]; return EqualStrings(keyStr, l.str) && cacheEntry.callerScript == l.callerScript && @@ -83,7 +83,7 @@ EvalCacheHashPolicy::match(const EvalCacheEntry &cacheEntry, const EvalCacheLook // to deal with calls to JS_GetScriptObject for scripts in the eval cache. class EvalScriptGuard { - JSContext *cx_; + JSContext* cx_; Rooted script_; /* These fields are only valid if lookup_.str is non-nullptr. */ @@ -93,7 +93,7 @@ class EvalScriptGuard Rooted lookupStr_; public: - EvalScriptGuard(JSContext *cx) + EvalScriptGuard(JSContext* cx) : cx_(cx), script_(cx), lookup_(cx), lookupStr_(cx) {} ~EvalScriptGuard() { @@ -107,7 +107,7 @@ class EvalScriptGuard } } - void lookupInEvalCache(JSLinearString *str, JSScript *callerScript, jsbytecode *pc) + void lookupInEvalCache(JSLinearString* str, JSScript* callerScript, jsbytecode* pc) { lookupStr_ = str; lookup_.str = str; @@ -123,7 +123,7 @@ class EvalScriptGuard } } - void setNewScript(JSScript *script) { + void setNewScript(JSScript* script) { // JSScript::initFromEmitter has already called js_CallNewScriptHook. JS_ASSERT(!script_ && script); script_ = script; @@ -147,7 +147,7 @@ enum EvalJSONResult { }; static EvalJSONResult -TryEvalJSON(JSContext *cx, JSScript *callerScript, +TryEvalJSON(JSContext* cx, JSScript* callerScript, ConstTwoByteChars chars, size_t length, MutableHandleValue rval) { // If the eval string starts with '(' or '[' and ends with ')' or ']', it may be JSON. @@ -170,7 +170,7 @@ TryEvalJSON(JSContext *cx, JSScript *callerScript, // Rather than force the JSON parser to handle this quirk when used by // eval, we simply don't use the JSON parser when either character // appears in the provided string. See bug 657367. - for (const jschar *cp = &chars[1], *end = &chars[length - 2]; ; cp++) { + for (const jschar* cp = &chars[1], *end = &chars[length - 2]; ; cp++) { if (*cp == 0x2028 || *cp == 0x2029) break; @@ -203,8 +203,8 @@ enum EvalType { DIRECT_EVAL = EXECUTE_DIRECT_EVAL, INDIRECT_EVAL = EXECUTE_INDIR // // On success, store the completion value in call.rval and return true. static bool -EvalKernel(JSContext *cx, const CallArgs &args, EvalType evalType, AbstractFramePtr caller, - HandleObject scopeobj, jsbytecode *pc) +EvalKernel(JSContext* cx, const CallArgs& args, EvalType evalType, AbstractFramePtr caller, + HandleObject scopeobj, jsbytecode* pc) { JS_ASSERT((evalType == INDIRECT_EVAL) == !caller); JS_ASSERT((evalType == INDIRECT_EVAL) == !pc); @@ -250,7 +250,7 @@ EvalKernel(JSContext *cx, const CallArgs &args, EvalType evalType, AbstractFrame staticLevel = 0; // Use the global as 'this', modulo outerization. - JSObject *thisobj = JSObject::thisObject(cx, scopeobj); + JSObject* thisobj = JSObject::thisObject(cx, scopeobj); if (!thisobj) return false; thisv = ObjectValue(*thisobj); @@ -276,8 +276,8 @@ EvalKernel(JSContext *cx, const CallArgs &args, EvalType evalType, AbstractFrame if (!esg.foundScript()) { RootedScript maybeScript(cx); unsigned lineno; - const char *filename; - JSPrincipals *originPrincipals; + const char* filename; + JSPrincipals* originPrincipals; uint32_t pcOffset; DescribeScriptedCallerForCompilation(cx, &maybeScript, &filename, &lineno, &pcOffset, &originPrincipals, @@ -285,7 +285,7 @@ EvalKernel(JSContext *cx, const CallArgs &args, EvalType evalType, AbstractFrame ? CALLED_FROM_JSOP_EVAL : NOT_CALLED_FROM_JSOP_EVAL); - const char *introducerFilename = filename; + const char* introducerFilename = filename; if (maybeScript && maybeScript->scriptSource()->introducerFilename()) introducerFilename = maybeScript->scriptSource()->introducerFilename(); @@ -297,7 +297,7 @@ EvalKernel(JSContext *cx, const CallArgs &args, EvalType evalType, AbstractFrame .setOriginPrincipals(originPrincipals) .setIntroductionInfo(introducerFilename, "eval", lineno, maybeScript, pcOffset); SourceBufferHolder srcBuf(chars.get(), length, SourceBufferHolder::NoOwnership); - JSScript *compiled = frontend::CompileScript(cx, &cx->tempLifoAlloc(), + JSScript* compiled = frontend::CompileScript(cx, &cx->tempLifoAlloc(), scopeobj, callerScript, options, srcBuf, flatStr, staticLevel); if (!compiled) @@ -311,10 +311,10 @@ EvalKernel(JSContext *cx, const CallArgs &args, EvalType evalType, AbstractFrame } bool -js::DirectEvalStringFromIon(JSContext *cx, +js::DirectEvalStringFromIon(JSContext* cx, HandleObject scopeobj, HandleScript callerScript, HandleValue thisValue, HandleString str, - jsbytecode *pc, MutableHandleValue vp) + jsbytecode* pc, MutableHandleValue vp) { AssertInnerizedScopeChain(cx, *scopeobj); @@ -345,14 +345,14 @@ js::DirectEvalStringFromIon(JSContext *cx, if (!esg.foundScript()) { RootedScript maybeScript(cx); - const char *filename; + const char* filename; unsigned lineno; - JSPrincipals *originPrincipals; + JSPrincipals* originPrincipals; uint32_t pcOffset; DescribeScriptedCallerForCompilation(cx, &maybeScript, &filename, &lineno, &pcOffset, &originPrincipals, CALLED_FROM_JSOP_EVAL); - const char *introducerFilename = filename; + const char* introducerFilename = filename; if (maybeScript && maybeScript->scriptSource()->introducerFilename()) introducerFilename = maybeScript->scriptSource()->introducerFilename(); @@ -364,7 +364,7 @@ js::DirectEvalStringFromIon(JSContext *cx, .setOriginPrincipals(originPrincipals) .setIntroductionInfo(introducerFilename, "eval", lineno, maybeScript, pcOffset); SourceBufferHolder srcBuf(chars.get(), length, SourceBufferHolder::NoOwnership); - JSScript *compiled = frontend::CompileScript(cx, &cx->tempLifoAlloc(), + JSScript* compiled = frontend::CompileScript(cx, &cx->tempLifoAlloc(), scopeobj, callerScript, options, srcBuf, flatStr, staticLevel); if (!compiled) @@ -382,10 +382,10 @@ js::DirectEvalStringFromIon(JSContext *cx, } bool -js::DirectEvalValueFromIon(JSContext *cx, +js::DirectEvalValueFromIon(JSContext* cx, HandleObject scopeobj, HandleScript callerScript, HandleValue thisValue, HandleValue evalArg, - jsbytecode *pc, MutableHandleValue vp) + jsbytecode* pc, MutableHandleValue vp) { // Act as identity on non-strings per ES5 15.1.2.1 step 1. if (!evalArg.isString()) { @@ -398,7 +398,7 @@ js::DirectEvalValueFromIon(JSContext *cx, } bool -js::IndirectEval(JSContext *cx, unsigned argc, Value *vp) +js::IndirectEval(JSContext* cx, unsigned argc, Value* vp) { CallArgs args = CallArgsFromVp(argc, vp); Rooted global(cx, &args.callee().global()); @@ -406,7 +406,7 @@ js::IndirectEval(JSContext *cx, unsigned argc, Value *vp) } bool -js::DirectEval(JSContext *cx, const CallArgs &args) +js::DirectEval(JSContext* cx, const CallArgs& args) { // Direct eval can assume it was called from an interpreted or baseline frame. ScriptFrameIter iter(cx); @@ -423,7 +423,7 @@ js::DirectEval(JSContext *cx, const CallArgs &args) } bool -js::IsAnyBuiltinEval(JSFunction *fun) +js::IsAnyBuiltinEval(JSFunction* fun) { return fun->maybeNative() == IndirectEval; } diff --git a/js/src/builtin/Eval.h b/js/src/builtin/Eval.h index d35f397e31..30ad6f719c 100644 --- a/js/src/builtin/Eval.h +++ b/js/src/builtin/Eval.h @@ -18,29 +18,29 @@ namespace js { // the callee function object for *all* calls to eval, it is by construction // only ever called in the case indirect eval. extern bool -IndirectEval(JSContext *cx, unsigned argc, Value *vp); +IndirectEval(JSContext* cx, unsigned argc, Value* vp); // Performs a direct eval for the given arguments, which must correspond to the // currently-executing stack frame, which must be a script frame. On completion // the result is returned in args.rval. extern bool -DirectEval(JSContext *cx, const CallArgs &args); +DirectEval(JSContext* cx, const CallArgs& args); // Performs a direct eval called from Ion code. extern bool -DirectEvalStringFromIon(JSContext *cx, +DirectEvalStringFromIon(JSContext* cx, HandleObject scopeObj, HandleScript callerScript, HandleValue thisValue, HandleString str, jsbytecode * pc, MutableHandleValue vp); extern bool -DirectEvalValueFromIon(JSContext *cx, +DirectEvalValueFromIon(JSContext* cx, HandleObject scopeObj, HandleScript callerScript, HandleValue thisValue, HandleValue evalArg, jsbytecode * pc, MutableHandleValue vp); // True iff fun is a built-in eval function. extern bool -IsAnyBuiltinEval(JSFunction *fun); +IsAnyBuiltinEval(JSFunction* fun); } // namespace js #endif /* builtin_Eval_h */ diff --git a/js/src/builtin/Intl.cpp b/js/src/builtin/Intl.cpp index e78f1448f5..89d8daefa5 100644 --- a/js/src/builtin/Intl.cpp +++ b/js/src/builtin/Intl.cpp @@ -74,7 +74,7 @@ using icu::NumberingSystem; */ static int32_t -u_strlen(const UChar *s) +u_strlen(const UChar* s) { MOZ_ASSUME_UNREACHABLE("u_strlen: Intl API disabled"); } @@ -82,19 +82,19 @@ u_strlen(const UChar *s) struct UEnumeration; static int32_t -uenum_count(UEnumeration *en, UErrorCode *status) +uenum_count(UEnumeration* en, UErrorCode* status) { MOZ_ASSUME_UNREACHABLE("uenum_count: Intl API disabled"); } -static const char * -uenum_next(UEnumeration *en, int32_t *resultLength, UErrorCode *status) +static const char* +uenum_next(UEnumeration* en, int32_t* resultLength, UErrorCode* status) { MOZ_ASSUME_UNREACHABLE("uenum_next: Intl API disabled"); } static void -uenum_close(UEnumeration *en) +uenum_close(UEnumeration* en) { MOZ_ASSUME_UNREACHABLE("uenum_close: Intl API disabled"); } @@ -134,47 +134,47 @@ ucol_countAvailable(void) MOZ_ASSUME_UNREACHABLE("ucol_countAvailable: Intl API disabled"); } -static const char * +static const char* ucol_getAvailable(int32_t localeIndex) { MOZ_ASSUME_UNREACHABLE("ucol_getAvailable: Intl API disabled"); } -static UCollator * -ucol_open(const char *loc, UErrorCode *status) +static UCollator* +ucol_open(const char* loc, UErrorCode* status) { MOZ_ASSUME_UNREACHABLE("ucol_open: Intl API disabled"); } static void -ucol_setAttribute(UCollator *coll, UColAttribute attr, UColAttributeValue value, UErrorCode *status) +ucol_setAttribute(UCollator* coll, UColAttribute attr, UColAttributeValue value, UErrorCode* status) { MOZ_ASSUME_UNREACHABLE("ucol_setAttribute: Intl API disabled"); } static UCollationResult -ucol_strcoll(const UCollator *coll, const UChar *source, int32_t sourceLength, - const UChar *target, int32_t targetLength) +ucol_strcoll(const UCollator* coll, const UChar* source, int32_t sourceLength, + const UChar* target, int32_t targetLength) { MOZ_ASSUME_UNREACHABLE("ucol_strcoll: Intl API disabled"); } static void -ucol_close(UCollator *coll) +ucol_close(UCollator* coll) { MOZ_ASSUME_UNREACHABLE("ucol_close: Intl API disabled"); } -static UEnumeration * -ucol_getKeywordValuesForLocale(const char *key, const char *locale, UBool commonlyUsed, - UErrorCode *status) +static UEnumeration* +ucol_getKeywordValuesForLocale(const char* key, const char* locale, UBool commonlyUsed, + UErrorCode* status) { MOZ_ASSUME_UNREACHABLE("ucol_getKeywordValuesForLocale: Intl API disabled"); } struct UParseError; struct UFieldPosition; -typedef void *UNumberFormat; +typedef void* UNumberFormat; enum UNumberFormatStyle { UNUM_DECIMAL = 1, @@ -209,76 +209,76 @@ unum_countAvailable(void) MOZ_ASSUME_UNREACHABLE("unum_countAvailable: Intl API disabled"); } -static const char * +static const char* unum_getAvailable(int32_t localeIndex) { MOZ_ASSUME_UNREACHABLE("unum_getAvailable: Intl API disabled"); } -static UNumberFormat * -unum_open(UNumberFormatStyle style, const UChar *pattern, int32_t patternLength, - const char *locale, UParseError *parseErr, UErrorCode *status) +static UNumberFormat* +unum_open(UNumberFormatStyle style, const UChar* pattern, int32_t patternLength, + const char* locale, UParseError* parseErr, UErrorCode* status) { MOZ_ASSUME_UNREACHABLE("unum_open: Intl API disabled"); } static void -unum_setAttribute(UNumberFormat *fmt, UNumberFormatAttribute attr, int32_t newValue) +unum_setAttribute(UNumberFormat* fmt, UNumberFormatAttribute attr, int32_t newValue) { MOZ_ASSUME_UNREACHABLE("unum_setAttribute: Intl API disabled"); } static int32_t -unum_formatDouble(const UNumberFormat *fmt, double number, UChar *result, - int32_t resultLength, UFieldPosition *pos, UErrorCode *status) +unum_formatDouble(const UNumberFormat* fmt, double number, UChar* result, + int32_t resultLength, UFieldPosition* pos, UErrorCode* status) { MOZ_ASSUME_UNREACHABLE("unum_formatDouble: Intl API disabled"); } static void -unum_close(UNumberFormat *fmt) +unum_close(UNumberFormat* fmt) { MOZ_ASSUME_UNREACHABLE("unum_close: Intl API disabled"); } static void -unum_setTextAttribute(UNumberFormat *fmt, UNumberFormatTextAttribute tag, const UChar *newValue, - int32_t newValueLength, UErrorCode *status) +unum_setTextAttribute(UNumberFormat* fmt, UNumberFormatTextAttribute tag, const UChar* newValue, + int32_t newValueLength, UErrorCode* status) { MOZ_ASSUME_UNREACHABLE("unum_setTextAttribute: Intl API disabled"); } class Locale { public: - Locale(const char *language, const char *country = 0, const char *variant = 0, - const char *keywordsAndValues = 0); + Locale(const char* language, const char* country = 0, const char* variant = 0, + const char* keywordsAndValues = 0); }; -Locale::Locale(const char *language, const char *country, const char *variant, - const char *keywordsAndValues) +Locale::Locale(const char* language, const char* country, const char* variant, + const char* keywordsAndValues) { MOZ_ASSUME_UNREACHABLE("Locale::Locale: Intl API disabled"); } class NumberingSystem { public: - static NumberingSystem *createInstance(const Locale &inLocale, UErrorCode &status); - const char *getName(); + static NumberingSystem* createInstance(const Locale& inLocale, UErrorCode& status); + const char* getName(); }; -NumberingSystem * -NumberingSystem::createInstance(const Locale &inLocale, UErrorCode &status) +NumberingSystem* +NumberingSystem::createInstance(const Locale& inLocale, UErrorCode& status) { MOZ_ASSUME_UNREACHABLE("NumberingSystem::createInstance: Intl API disabled"); } -const char * +const char* NumberingSystem::getName() { MOZ_ASSUME_UNREACHABLE("NumberingSystem::getName: Intl API disabled"); } -typedef void *UCalendar; +typedef void* UCalendar; enum UCalendarType { UCAL_TRADITIONAL, @@ -286,56 +286,56 @@ enum UCalendarType { UCAL_GREGORIAN }; -static UCalendar * -ucal_open(const UChar *zoneID, int32_t len, const char *locale, - UCalendarType type, UErrorCode *status) +static UCalendar* +ucal_open(const UChar* zoneID, int32_t len, const char* locale, + UCalendarType type, UErrorCode* status) { MOZ_ASSUME_UNREACHABLE("ucal_open: Intl API disabled"); } -static const char * -ucal_getType(const UCalendar *cal, UErrorCode *status) +static const char* +ucal_getType(const UCalendar* cal, UErrorCode* status) { MOZ_ASSUME_UNREACHABLE("ucal_getType: Intl API disabled"); } -static UEnumeration * -ucal_getKeywordValuesForLocale(const char *key, const char *locale, - UBool commonlyUsed, UErrorCode *status) +static UEnumeration* +ucal_getKeywordValuesForLocale(const char* key, const char* locale, + UBool commonlyUsed, UErrorCode* status) { MOZ_ASSUME_UNREACHABLE("ucal_getKeywordValuesForLocale: Intl API disabled"); } static void -ucal_close(UCalendar *cal) +ucal_close(UCalendar* cal) { MOZ_ASSUME_UNREACHABLE("ucal_close: Intl API disabled"); } -typedef void *UDateTimePatternGenerator; +typedef void* UDateTimePatternGenerator; -static UDateTimePatternGenerator * -udatpg_open(const char *locale, UErrorCode *pErrorCode) +static UDateTimePatternGenerator* +udatpg_open(const char* locale, UErrorCode* pErrorCode) { MOZ_ASSUME_UNREACHABLE("udatpg_open: Intl API disabled"); } static int32_t -udatpg_getBestPattern(UDateTimePatternGenerator *dtpg, const UChar *skeleton, - int32_t length, UChar *bestPattern, int32_t capacity, - UErrorCode *pErrorCode) +udatpg_getBestPattern(UDateTimePatternGenerator* dtpg, const UChar* skeleton, + int32_t length, UChar* bestPattern, int32_t capacity, + UErrorCode* pErrorCode) { MOZ_ASSUME_UNREACHABLE("udatpg_getBestPattern: Intl API disabled"); } static void -udatpg_close(UDateTimePatternGenerator *dtpg) +udatpg_close(UDateTimePatternGenerator* dtpg) { MOZ_ASSUME_UNREACHABLE("udatpg_close: Intl API disabled"); } -typedef void *UCalendar; -typedef void *UDateFormat; +typedef void* UCalendar; +typedef void* UDateFormat; enum UDateFormatStyle { UDAT_PATTERN = -2, @@ -348,41 +348,41 @@ udat_countAvailable(void) MOZ_ASSUME_UNREACHABLE("udat_countAvailable: Intl API disabled"); } -static const char * +static const char* udat_getAvailable(int32_t localeIndex) { MOZ_ASSUME_UNREACHABLE("udat_getAvailable: Intl API disabled"); } -static UDateFormat * -udat_open(UDateFormatStyle timeStyle, UDateFormatStyle dateStyle, const char *locale, - const UChar *tzID, int32_t tzIDLength, const UChar *pattern, - int32_t patternLength, UErrorCode *status) +static UDateFormat* +udat_open(UDateFormatStyle timeStyle, UDateFormatStyle dateStyle, const char* locale, + const UChar* tzID, int32_t tzIDLength, const UChar* pattern, + int32_t patternLength, UErrorCode* status) { MOZ_ASSUME_UNREACHABLE("udat_open: Intl API disabled"); } -static const UCalendar * -udat_getCalendar(const UDateFormat *fmt) +static const UCalendar* +udat_getCalendar(const UDateFormat* fmt) { MOZ_ASSUME_UNREACHABLE("udat_getCalendar: Intl API disabled"); } static void -ucal_setGregorianChange(UCalendar *cal, UDate date, UErrorCode *pErrorCode) +ucal_setGregorianChange(UCalendar* cal, UDate date, UErrorCode* pErrorCode) { MOZ_ASSUME_UNREACHABLE("ucal_setGregorianChange: Intl API disabled"); } static int32_t -udat_format(const UDateFormat *format, UDate dateToFormat, UChar *result, - int32_t resultLength, UFieldPosition *position, UErrorCode *status) +udat_format(const UDateFormat* format, UDate dateToFormat, UChar* result, + int32_t resultLength, UFieldPosition* position, UErrorCode* status) { MOZ_ASSUME_UNREACHABLE("udat_format: Intl API disabled"); } static void -udat_close(UDateFormat *format) +udat_close(UDateFormat* format) { MOZ_ASSUME_UNREACHABLE("udat_close: Intl API disabled"); } @@ -393,7 +393,7 @@ udat_close(UDateFormat *format) /******************** Common to Intl constructors ********************/ static bool -IntlInitialize(JSContext *cx, HandleObject obj, Handle initializer, +IntlInitialize(JSContext* cx, HandleObject obj, Handle initializer, HandleValue locales, HandleValue options) { RootedValue initializerValue(cx); @@ -420,11 +420,11 @@ IntlInitialize(JSContext *cx, HandleObject obj, Handle initialize typedef int32_t (* CountAvailable)(void); -typedef const char * +typedef const char* (* GetAvailable)(int32_t localeIndex); static bool -intl_availableLocales(JSContext *cx, CountAvailable countAvailable, +intl_availableLocales(JSContext* cx, CountAvailable countAvailable, GetAvailable getAvailable, MutableHandleValue result) { RootedObject locales(cx, NewObjectWithGivenProto(cx, &JSObject::class_, nullptr, nullptr)); @@ -435,11 +435,11 @@ intl_availableLocales(JSContext *cx, CountAvailable countAvailable, uint32_t count = countAvailable(); RootedValue t(cx, BooleanValue(true)); for (uint32_t i = 0; i < count; i++) { - const char *locale = getAvailable(i); + const char* locale = getAvailable(i); ScopedJSFreePtr lang(JS_strdup(cx, locale)); if (!lang) return false; - char *p; + char* p; while ((p = strchr(lang, '_'))) *p = '-'; RootedAtom a(cx, Atomize(cx, lang, strlen(lang))); @@ -460,7 +460,7 @@ intl_availableLocales(JSContext *cx, CountAvailable countAvailable, * Returns the object holding the internal properties for obj. */ static bool -GetInternals(JSContext *cx, HandleObject obj, MutableHandleObject internals) +GetInternals(JSContext* cx, HandleObject obj, MutableHandleObject internals) { RootedValue getInternalsValue(cx); if (!GlobalObject::getIntrinsicValue(cx, cx->global(), cx->names().getInternals, &getInternalsValue)) @@ -483,19 +483,19 @@ GetInternals(JSContext *cx, HandleObject obj, MutableHandleObject internals) } static bool -equal(const char *s1, const char *s2) +equal(const char* s1, const char* s2) { return !strcmp(s1, s2); } static bool -equal(JSAutoByteString &s1, const char *s2) +equal(JSAutoByteString& s1, const char* s2) { return !strcmp(s1.ptr(), s2); } -static const char * -icuLocale(const char *locale) +static const char* +icuLocale(const char* locale) { if (equal(locale, "und")) return ""; // ICU root locale @@ -510,11 +510,11 @@ icuLocale(const char *locale) template class ScopedICUObject { - T *ptr_; + T* ptr_; void (* deleter_)(T*); public: - ScopedICUObject(T *ptr, void (*deleter)(T*)) + ScopedICUObject(T* ptr, void (*deleter)(T*)) : ptr_(ptr), deleter_(deleter) {} @@ -527,8 +527,8 @@ class ScopedICUObject // In cases where an object should be deleted on abnormal exits, // but returned to the caller if everything goes well, call forget() // to transfer the object just before returning. - T *forget() { - T *tmp = ptr_; + T* forget() { + T* tmp = ptr_; ptr_ = nullptr; return tmp; } @@ -541,7 +541,7 @@ static const size_t INITIAL_STRING_BUFFER_SIZE = 32; /******************** Collator ********************/ -static void collator_finalize(FreeOp *fop, JSObject *obj); +static void collator_finalize(FreeOp* fop, JSObject* obj); static const uint32_t UCOLLATOR_SLOT = 0; static const uint32_t COLLATOR_SLOTS_COUNT = 1; @@ -561,7 +561,7 @@ static const Class CollatorClass = { #if JS_HAS_TOSOURCE static bool -collator_toSource(JSContext *cx, unsigned argc, Value *vp) +collator_toSource(JSContext* cx, unsigned argc, Value* vp) { CallArgs args = CallArgsFromVp(argc, vp); args.rval().setString(cx->names().Collator); @@ -587,13 +587,13 @@ static const JSFunctionSpec collator_methods[] = { * Spec: ECMAScript Internationalization API Specification, 10.1 */ static bool -Collator(JSContext *cx, CallArgs args, bool construct) +Collator(JSContext* cx, CallArgs args, bool construct) { RootedObject obj(cx); if (!construct) { // 10.1.2.1 step 3 - JSObject *intl = cx->global()->getOrCreateIntlObject(cx); + JSObject* intl = cx->global()->getOrCreateIntlObject(cx); if (!intl) return false; RootedValue self(cx, args.thisv()); @@ -640,14 +640,14 @@ Collator(JSContext *cx, CallArgs args, bool construct) } static bool -Collator(JSContext *cx, unsigned argc, Value *vp) +Collator(JSContext* cx, unsigned argc, Value* vp) { CallArgs args = CallArgsFromVp(argc, vp); return Collator(cx, args, args.isConstructing()); } bool -js::intl_Collator(JSContext *cx, unsigned argc, Value *vp) +js::intl_Collator(JSContext* cx, unsigned argc, Value* vp) { CallArgs args = CallArgsFromVp(argc, vp); JS_ASSERT(args.length() == 2); @@ -657,15 +657,15 @@ js::intl_Collator(JSContext *cx, unsigned argc, Value *vp) } static void -collator_finalize(FreeOp *fop, JSObject *obj) +collator_finalize(FreeOp* fop, JSObject* obj) { - UCollator *coll = static_cast(obj->getReservedSlot(UCOLLATOR_SLOT).toPrivate()); + UCollator* coll = static_cast(obj->getReservedSlot(UCOLLATOR_SLOT).toPrivate()); if (coll) ucol_close(coll); } -static JSObject * -InitCollatorClass(JSContext *cx, HandleObject Intl, Handle global) +static JSObject* +InitCollatorClass(JSContext* cx, HandleObject Intl, Handle global) { RootedFunction ctor(cx, global->createConstructor(cx, &Collator, cx->names().Collator, 0)); if (!ctor) @@ -719,7 +719,7 @@ InitCollatorClass(JSContext *cx, HandleObject Intl, Handle global } bool -GlobalObject::initCollatorProto(JSContext *cx, Handle global) +GlobalObject::initCollatorProto(JSContext* cx, Handle global) { RootedObject proto(cx, global->createBlankPrototype(cx, &CollatorClass)); if (!proto) @@ -730,7 +730,7 @@ GlobalObject::initCollatorProto(JSContext *cx, Handle global) } bool -js::intl_Collator_availableLocales(JSContext *cx, unsigned argc, Value *vp) +js::intl_Collator_availableLocales(JSContext* cx, unsigned argc, Value* vp) { CallArgs args = CallArgsFromVp(argc, vp); JS_ASSERT(args.length() == 0); @@ -743,7 +743,7 @@ js::intl_Collator_availableLocales(JSContext *cx, unsigned argc, Value *vp) } bool -js::intl_availableCollations(JSContext *cx, unsigned argc, Value *vp) +js::intl_availableCollations(JSContext* cx, unsigned argc, Value* vp) { CallArgs args = CallArgsFromVp(argc, vp); JS_ASSERT(args.length() == 1); @@ -753,7 +753,7 @@ js::intl_availableCollations(JSContext *cx, unsigned argc, Value *vp) if (!locale) return false; UErrorCode status = U_ZERO_ERROR; - UEnumeration *values = ucol_getKeywordValuesForLocale("co", locale.ptr(), false, &status); + UEnumeration* values = ucol_getKeywordValuesForLocale("co", locale.ptr(), false, &status); if (U_FAILURE(status)) { JS_ReportErrorNumber(cx, js_GetErrorMessage, nullptr, JSMSG_INTERNAL_INTL_ERROR); return false; @@ -772,7 +772,7 @@ js::intl_availableCollations(JSContext *cx, unsigned argc, Value *vp) uint32_t index = 0; for (uint32_t i = 0; i < count; i++) { - const char *collation = uenum_next(values, nullptr, &status); + const char* collation = uenum_next(values, nullptr, &status); if (U_FAILURE(status)) { JS_ReportErrorNumber(cx, js_GetErrorMessage, nullptr, JSMSG_INTERNAL_INTL_ERROR); return false; @@ -812,8 +812,8 @@ js::intl_availableCollations(JSContext *cx, unsigned argc, Value *vp) * Returns a new UCollator with the locale and collation options * of the given Collator. */ -static UCollator * -NewUCollator(JSContext *cx, HandleObject collator) +static UCollator* +NewUCollator(JSContext* cx, HandleObject collator) { RootedValue value(cx); @@ -844,8 +844,8 @@ NewUCollator(JSContext *cx, HandleObject collator) if (equal(usage, "search")) { // ICU expects search as a Unicode locale extension on locale. // Unicode locale extensions must occur before private use extensions. - const char *oldLocale = locale.ptr(); - const char *p; + const char* oldLocale = locale.ptr(); + const char* p; size_t index; size_t localeLen = strlen(oldLocale); if ((p = strstr(oldLocale, "-x-"))) @@ -853,7 +853,7 @@ NewUCollator(JSContext *cx, HandleObject collator) else index = localeLen; - const char *insert; + const char* insert; if ((p = strstr(oldLocale, "-u-")) && static_cast(p - oldLocale) < index) { index = p - oldLocale + 2; insert = "-co-search"; @@ -861,7 +861,7 @@ NewUCollator(JSContext *cx, HandleObject collator) insert = "-u-co-search"; } size_t insertLen = strlen(insert); - char *newLocale = cx->pod_malloc(localeLen + insertLen + 1); + char* newLocale = cx->pod_malloc(localeLen + insertLen + 1); if (!newLocale) return nullptr; memcpy(newLocale, oldLocale, index); @@ -922,7 +922,7 @@ NewUCollator(JSContext *cx, HandleObject collator) } UErrorCode status = U_ZERO_ERROR; - UCollator *coll = ucol_open(icuLocale(locale.ptr()), &status); + UCollator* coll = ucol_open(icuLocale(locale.ptr()), &status); if (U_FAILURE(status)) { JS_ReportErrorNumber(cx, js_GetErrorMessage, nullptr, JSMSG_INTERNAL_INTL_ERROR); return nullptr; @@ -944,7 +944,7 @@ NewUCollator(JSContext *cx, HandleObject collator) } static bool -intl_CompareStrings(JSContext *cx, UCollator *coll, HandleString str1, HandleString str2, MutableHandleValue result) +intl_CompareStrings(JSContext* cx, UCollator* coll, HandleString str1, HandleString str2, MutableHandleValue result) { JS_ASSERT(str1); JS_ASSERT(str2); @@ -955,11 +955,11 @@ intl_CompareStrings(JSContext *cx, UCollator *coll, HandleString str1, HandleStr } size_t length1 = str1->length(); - const jschar *chars1 = str1->getChars(cx); + const jschar* chars1 = str1->getChars(cx); if (!chars1) return false; size_t length2 = str2->length(); - const jschar *chars2 = str2->getChars(cx); + const jschar* chars2 = str2->getChars(cx); if (!chars2) return false; @@ -979,7 +979,7 @@ intl_CompareStrings(JSContext *cx, UCollator *coll, HandleString str1, HandleStr } bool -js::intl_CompareStrings(JSContext *cx, unsigned argc, Value *vp) +js::intl_CompareStrings(JSContext* cx, unsigned argc, Value* vp) { CallArgs args = CallArgsFromVp(argc, vp); JS_ASSERT(args.length() == 3); @@ -992,9 +992,9 @@ js::intl_CompareStrings(JSContext *cx, unsigned argc, Value *vp) // Obtain a UCollator object, cached if possible. // XXX Does this handle Collator instances from other globals correctly? bool isCollatorInstance = collator->getClass() == &CollatorClass; - UCollator *coll; + UCollator* coll; if (isCollatorInstance) { - coll = static_cast(collator->getReservedSlot(UCOLLATOR_SLOT).toPrivate()); + coll = static_cast(collator->getReservedSlot(UCOLLATOR_SLOT).toPrivate()); if (!coll) { coll = NewUCollator(cx, collator); if (!coll) @@ -1028,7 +1028,7 @@ js::intl_CompareStrings(JSContext *cx, unsigned argc, Value *vp) /******************** NumberFormat ********************/ -static void numberFormat_finalize(FreeOp *fop, JSObject *obj); +static void numberFormat_finalize(FreeOp* fop, JSObject* obj); static const uint32_t UNUMBER_FORMAT_SLOT = 0; static const uint32_t NUMBER_FORMAT_SLOTS_COUNT = 1; @@ -1048,7 +1048,7 @@ static const Class NumberFormatClass = { #if JS_HAS_TOSOURCE static bool -numberFormat_toSource(JSContext *cx, unsigned argc, Value *vp) +numberFormat_toSource(JSContext* cx, unsigned argc, Value* vp) { CallArgs args = CallArgsFromVp(argc, vp); args.rval().setString(cx->names().NumberFormat); @@ -1074,13 +1074,13 @@ static const JSFunctionSpec numberFormat_methods[] = { * Spec: ECMAScript Internationalization API Specification, 11.1 */ static bool -NumberFormat(JSContext *cx, CallArgs args, bool construct) +NumberFormat(JSContext* cx, CallArgs args, bool construct) { RootedObject obj(cx); if (!construct) { // 11.1.2.1 step 3 - JSObject *intl = cx->global()->getOrCreateIntlObject(cx); + JSObject* intl = cx->global()->getOrCreateIntlObject(cx); if (!intl) return false; RootedValue self(cx, args.thisv()); @@ -1127,14 +1127,14 @@ NumberFormat(JSContext *cx, CallArgs args, bool construct) } static bool -NumberFormat(JSContext *cx, unsigned argc, Value *vp) +NumberFormat(JSContext* cx, unsigned argc, Value* vp) { CallArgs args = CallArgsFromVp(argc, vp); return NumberFormat(cx, args, args.isConstructing()); } bool -js::intl_NumberFormat(JSContext *cx, unsigned argc, Value *vp) +js::intl_NumberFormat(JSContext* cx, unsigned argc, Value* vp) { CallArgs args = CallArgsFromVp(argc, vp); JS_ASSERT(args.length() == 2); @@ -1145,16 +1145,16 @@ js::intl_NumberFormat(JSContext *cx, unsigned argc, Value *vp) } static void -numberFormat_finalize(FreeOp *fop, JSObject *obj) +numberFormat_finalize(FreeOp* fop, JSObject* obj) { - UNumberFormat *nf = + UNumberFormat* nf = static_cast(obj->getReservedSlot(UNUMBER_FORMAT_SLOT).toPrivate()); if (nf) unum_close(nf); } -static JSObject * -InitNumberFormatClass(JSContext *cx, HandleObject Intl, Handle global) +static JSObject* +InitNumberFormatClass(JSContext* cx, HandleObject Intl, Handle global) { RootedFunction ctor(cx, global->createConstructor(cx, &NumberFormat, cx->names().NumberFormat, 0)); if (!ctor) @@ -1208,7 +1208,7 @@ InitNumberFormatClass(JSContext *cx, HandleObject Intl, Handle gl } bool -GlobalObject::initNumberFormatProto(JSContext *cx, Handle global) +GlobalObject::initNumberFormatProto(JSContext* cx, Handle global) { RootedObject proto(cx, global->createBlankPrototype(cx, &NumberFormatClass)); if (!proto) @@ -1219,7 +1219,7 @@ GlobalObject::initNumberFormatProto(JSContext *cx, Handle global) } bool -js::intl_NumberFormat_availableLocales(JSContext *cx, unsigned argc, Value *vp) +js::intl_NumberFormat_availableLocales(JSContext* cx, unsigned argc, Value* vp) { CallArgs args = CallArgsFromVp(argc, vp); JS_ASSERT(args.length() == 0); @@ -1232,7 +1232,7 @@ js::intl_NumberFormat_availableLocales(JSContext *cx, unsigned argc, Value *vp) } bool -js::intl_numberingSystem(JSContext *cx, unsigned argc, Value *vp) +js::intl_numberingSystem(JSContext* cx, unsigned argc, Value* vp) { CallArgs args = CallArgsFromVp(argc, vp); JS_ASSERT(args.length() == 1); @@ -1246,12 +1246,12 @@ js::intl_numberingSystem(JSContext *cx, unsigned argc, Value *vp) // won't break. http://bugs.icu-project.org/trac/ticket/10039 Locale ulocale(locale.ptr()); UErrorCode status = U_ZERO_ERROR; - NumberingSystem *numbers = NumberingSystem::createInstance(ulocale, status); + NumberingSystem* numbers = NumberingSystem::createInstance(ulocale, status); if (U_FAILURE(status)) { JS_ReportErrorNumber(cx, js_GetErrorMessage, nullptr, JSMSG_INTERNAL_INTL_ERROR); return false; } - const char *name = numbers->getName(); + const char* name = numbers->getName(); RootedString jsname(cx, JS_NewStringCopyZ(cx, name)); delete numbers; if (!jsname) @@ -1264,8 +1264,8 @@ js::intl_numberingSystem(JSContext *cx, unsigned argc, Value *vp) * Returns a new UNumberFormat with the locale and number formatting options * of the given NumberFormat. */ -static UNumberFormat * -NewUNumberFormat(JSContext *cx, HandleObject numberFormat) +static UNumberFormat* +NewUNumberFormat(JSContext* cx, HandleObject numberFormat) { RootedValue value(cx); @@ -1281,7 +1281,7 @@ NewUNumberFormat(JSContext *cx, HandleObject numberFormat) // UNumberFormat options with default values UNumberFormatStyle uStyle = UNUM_DECIMAL; - const UChar *uCurrency = nullptr; + const UChar* uCurrency = nullptr; uint32_t uMinimumIntegerDigits = 1; uint32_t uMinimumFractionDigits = 0; uint32_t uMaximumFractionDigits = 3; @@ -1374,7 +1374,7 @@ NewUNumberFormat(JSContext *cx, HandleObject numberFormat) uUseGrouping = value.toBoolean(); UErrorCode status = U_ZERO_ERROR; - UNumberFormat *nf = unum_open(uStyle, nullptr, 0, icuLocale(locale.ptr()), nullptr, &status); + UNumberFormat* nf = unum_open(uStyle, nullptr, 0, icuLocale(locale.ptr()), nullptr, &status); if (U_FAILURE(status)) { JS_ReportErrorNumber(cx, js_GetErrorMessage, nullptr, JSMSG_INTERNAL_INTL_ERROR); return nullptr; @@ -1404,7 +1404,7 @@ NewUNumberFormat(JSContext *cx, HandleObject numberFormat) } static bool -intl_FormatNumber(JSContext *cx, UNumberFormat *nf, double x, MutableHandleValue result) +intl_FormatNumber(JSContext* cx, UNumberFormat* nf, double x, MutableHandleValue result) { // FormatNumber doesn't consider -0.0 to be negative. if (IsNegativeZero(x)) @@ -1441,7 +1441,7 @@ intl_FormatNumber(JSContext *cx, UNumberFormat *nf, double x, MutableHandleValue } bool -js::intl_FormatNumber(JSContext *cx, unsigned argc, Value *vp) +js::intl_FormatNumber(JSContext* cx, unsigned argc, Value* vp) { CallArgs args = CallArgsFromVp(argc, vp); JS_ASSERT(args.length() == 2); @@ -1452,7 +1452,7 @@ js::intl_FormatNumber(JSContext *cx, unsigned argc, Value *vp) // Obtain a UNumberFormat object, cached if possible. bool isNumberFormatInstance = numberFormat->getClass() == &NumberFormatClass; - UNumberFormat *nf; + UNumberFormat* nf; if (isNumberFormatInstance) { nf = static_cast(numberFormat->getReservedSlot(UNUMBER_FORMAT_SLOT).toPrivate()); if (!nf) { @@ -1486,7 +1486,7 @@ js::intl_FormatNumber(JSContext *cx, unsigned argc, Value *vp) /******************** DateTimeFormat ********************/ -static void dateTimeFormat_finalize(FreeOp *fop, JSObject *obj); +static void dateTimeFormat_finalize(FreeOp* fop, JSObject* obj); static const uint32_t UDATE_FORMAT_SLOT = 0; static const uint32_t DATE_TIME_FORMAT_SLOTS_COUNT = 1; @@ -1506,7 +1506,7 @@ static const Class DateTimeFormatClass = { #if JS_HAS_TOSOURCE static bool -dateTimeFormat_toSource(JSContext *cx, unsigned argc, Value *vp) +dateTimeFormat_toSource(JSContext* cx, unsigned argc, Value* vp) { CallArgs args = CallArgsFromVp(argc, vp); args.rval().setString(cx->names().DateTimeFormat); @@ -1532,13 +1532,13 @@ static const JSFunctionSpec dateTimeFormat_methods[] = { * Spec: ECMAScript Internationalization API Specification, 12.1 */ static bool -DateTimeFormat(JSContext *cx, CallArgs args, bool construct) +DateTimeFormat(JSContext* cx, CallArgs args, bool construct) { RootedObject obj(cx); if (!construct) { // 12.1.2.1 step 3 - JSObject *intl = cx->global()->getOrCreateIntlObject(cx); + JSObject* intl = cx->global()->getOrCreateIntlObject(cx); if (!intl) return false; RootedValue self(cx, args.thisv()); @@ -1585,14 +1585,14 @@ DateTimeFormat(JSContext *cx, CallArgs args, bool construct) } static bool -DateTimeFormat(JSContext *cx, unsigned argc, Value *vp) +DateTimeFormat(JSContext* cx, unsigned argc, Value* vp) { CallArgs args = CallArgsFromVp(argc, vp); return DateTimeFormat(cx, args, args.isConstructing()); } bool -js::intl_DateTimeFormat(JSContext *cx, unsigned argc, Value *vp) +js::intl_DateTimeFormat(JSContext* cx, unsigned argc, Value* vp) { CallArgs args = CallArgsFromVp(argc, vp); JS_ASSERT(args.length() == 2); @@ -1603,15 +1603,15 @@ js::intl_DateTimeFormat(JSContext *cx, unsigned argc, Value *vp) } static void -dateTimeFormat_finalize(FreeOp *fop, JSObject *obj) +dateTimeFormat_finalize(FreeOp* fop, JSObject* obj) { - UDateFormat *df = static_cast(obj->getReservedSlot(UDATE_FORMAT_SLOT).toPrivate()); + UDateFormat* df = static_cast(obj->getReservedSlot(UDATE_FORMAT_SLOT).toPrivate()); if (df) udat_close(df); } -static JSObject * -InitDateTimeFormatClass(JSContext *cx, HandleObject Intl, Handle global) +static JSObject* +InitDateTimeFormatClass(JSContext* cx, HandleObject Intl, Handle global) { RootedFunction ctor(cx, global->createConstructor(cx, &DateTimeFormat, cx->names().DateTimeFormat, 0)); if (!ctor) @@ -1665,7 +1665,7 @@ InitDateTimeFormatClass(JSContext *cx, HandleObject Intl, Handle } bool -GlobalObject::initDateTimeFormatProto(JSContext *cx, Handle global) +GlobalObject::initDateTimeFormatProto(JSContext* cx, Handle global) { RootedObject proto(cx, global->createBlankPrototype(cx, &DateTimeFormatClass)); if (!proto) @@ -1676,7 +1676,7 @@ GlobalObject::initDateTimeFormatProto(JSContext *cx, Handle globa } bool -js::intl_DateTimeFormat_availableLocales(JSContext *cx, unsigned argc, Value *vp) +js::intl_DateTimeFormat_availableLocales(JSContext* cx, unsigned argc, Value* vp) { CallArgs args = CallArgsFromVp(argc, vp); JS_ASSERT(args.length() == 0); @@ -1690,8 +1690,8 @@ js::intl_DateTimeFormat_availableLocales(JSContext *cx, unsigned argc, Value *vp // ICU returns old-style keyword values; map them to BCP 47 equivalents // (see http://bugs.icu-project.org/trac/ticket/9620). -static const char * -bcp47CalendarName(const char *icuName) +static const char* +bcp47CalendarName(const char* icuName) { if (equal(icuName, "ethiopic-amete-alem")) return "ethioaa"; @@ -1703,7 +1703,7 @@ bcp47CalendarName(const char *icuName) } bool -js::intl_availableCalendars(JSContext *cx, unsigned argc, Value *vp) +js::intl_availableCalendars(JSContext* cx, unsigned argc, Value* vp) { CallArgs args = CallArgsFromVp(argc, vp); JS_ASSERT(args.length() == 1); @@ -1720,8 +1720,8 @@ js::intl_availableCalendars(JSContext *cx, unsigned argc, Value *vp) // We need the default calendar for the locale as the first result. UErrorCode status = U_ZERO_ERROR; - UCalendar *cal = ucal_open(nullptr, 0, locale.ptr(), UCAL_DEFAULT, &status); - const char *calendar = ucal_getType(cal, &status); + UCalendar* cal = ucal_open(nullptr, 0, locale.ptr(), UCAL_DEFAULT, &status); + const char* calendar = ucal_getType(cal, &status); if (U_FAILURE(status)) { JS_ReportErrorNumber(cx, js_GetErrorMessage, nullptr, JSMSG_INTERNAL_INTL_ERROR); return false; @@ -1735,7 +1735,7 @@ js::intl_availableCalendars(JSContext *cx, unsigned argc, Value *vp) return false; // Now get the calendars that "would make a difference", i.e., not the default. - UEnumeration *values = ucal_getKeywordValuesForLocale("ca", locale.ptr(), false, &status); + UEnumeration* values = ucal_getKeywordValuesForLocale("ca", locale.ptr(), false, &status); if (U_FAILURE(status)) { JS_ReportErrorNumber(cx, js_GetErrorMessage, nullptr, JSMSG_INTERNAL_INTL_ERROR); return false; @@ -1768,7 +1768,7 @@ js::intl_availableCalendars(JSContext *cx, unsigned argc, Value *vp) } bool -js::intl_patternForSkeleton(JSContext *cx, unsigned argc, Value *vp) +js::intl_patternForSkeleton(JSContext* cx, unsigned argc, Value* vp) { CallArgs args = CallArgsFromVp(argc, vp); JS_ASSERT(args.length() == 2); @@ -1779,13 +1779,13 @@ js::intl_patternForSkeleton(JSContext *cx, unsigned argc, Value *vp) if (!locale) return false; RootedString jsskeleton(cx, args[1].toString()); - const jschar *skeleton = JS_GetStringCharsZ(cx, jsskeleton); + const jschar* skeleton = JS_GetStringCharsZ(cx, jsskeleton); if (!skeleton) return false; uint32_t skeletonLen = u_strlen(JSCharToUChar(skeleton)); UErrorCode status = U_ZERO_ERROR; - UDateTimePatternGenerator *gen = udatpg_open(icuLocale(locale.ptr()), &status); + UDateTimePatternGenerator* gen = udatpg_open(icuLocale(locale.ptr()), &status); if (U_FAILURE(status)) { JS_ReportErrorNumber(cx, js_GetErrorMessage, nullptr, JSMSG_INTERNAL_INTL_ERROR); return false; @@ -1821,8 +1821,8 @@ js::intl_patternForSkeleton(JSContext *cx, unsigned argc, Value *vp) * Returns a new UDateFormat with the locale and date-time formatting options * of the given DateTimeFormat. */ -static UDateFormat * -NewUDateFormat(JSContext *cx, HandleObject dateTimeFormat) +static UDateFormat* +NewUDateFormat(JSContext* cx, HandleObject dateTimeFormat) { RootedValue value(cx); @@ -1838,9 +1838,9 @@ NewUDateFormat(JSContext *cx, HandleObject dateTimeFormat) return nullptr; // UDateFormat options with default values. - const UChar *uTimeZone = nullptr; + const UChar* uTimeZone = nullptr; uint32_t uTimeZoneLength = 0; - const UChar *uPattern = nullptr; + const UChar* uPattern = nullptr; uint32_t uPatternLength = 0; // We don't need to look at calendar and numberingSystem - they can only be @@ -1872,7 +1872,7 @@ NewUDateFormat(JSContext *cx, HandleObject dateTimeFormat) // If building with ICU headers before 50.1, use UDAT_IGNORE instead of // UDAT_PATTERN. - UDateFormat *df = + UDateFormat* df = udat_open(UDAT_PATTERN, UDAT_PATTERN, icuLocale(locale.ptr()), uTimeZone, uTimeZoneLength, uPattern, uPatternLength, &status); if (U_FAILURE(status)) { @@ -1882,7 +1882,7 @@ NewUDateFormat(JSContext *cx, HandleObject dateTimeFormat) // ECMAScript requires the Gregorian calendar to be used from the beginning // of ECMAScript time. - UCalendar *cal = const_cast(udat_getCalendar(df)); + UCalendar* cal = const_cast(udat_getCalendar(df)); ucal_setGregorianChange(cal, StartOfTime, &status); // An error here means the calendar is not Gregorian, so we don't care. @@ -1891,7 +1891,7 @@ NewUDateFormat(JSContext *cx, HandleObject dateTimeFormat) } static bool -intl_FormatDateTime(JSContext *cx, UDateFormat *df, double x, MutableHandleValue result) +intl_FormatDateTime(JSContext* cx, UDateFormat* df, double x, MutableHandleValue result) { if (!IsFinite(x)) { JS_ReportErrorNumber(cx, js_GetErrorMessage, nullptr, JSMSG_DATE_NOT_FINITE); @@ -1927,7 +1927,7 @@ intl_FormatDateTime(JSContext *cx, UDateFormat *df, double x, MutableHandleValue } bool -js::intl_FormatDateTime(JSContext *cx, unsigned argc, Value *vp) +js::intl_FormatDateTime(JSContext* cx, unsigned argc, Value* vp) { CallArgs args = CallArgsFromVp(argc, vp); JS_ASSERT(args.length() == 2); @@ -1938,7 +1938,7 @@ js::intl_FormatDateTime(JSContext *cx, unsigned argc, Value *vp) // Obtain a UDateFormat object, cached if possible. bool isDateTimeFormatInstance = dateTimeFormat->getClass() == &DateTimeFormatClass; - UDateFormat *df; + UDateFormat* df; if (isDateTimeFormatInstance) { df = static_cast(dateTimeFormat->getReservedSlot(UDATE_FORMAT_SLOT).toPrivate()); if (!df) { @@ -1986,7 +1986,7 @@ const Class js::IntlClass = { #if JS_HAS_TOSOURCE static bool -intl_toSource(JSContext *cx, unsigned argc, Value *vp) +intl_toSource(JSContext* cx, unsigned argc, Value* vp) { CallArgs args = CallArgsFromVp(argc, vp); args.rval().setString(cx->names().Intl); @@ -2005,8 +2005,8 @@ static const JSFunctionSpec intl_static_methods[] = { * Initializes the Intl Object and its standard built-in properties. * Spec: ECMAScript Internationalization API Specification, 8.0, 8.1 */ -JSObject * -js_InitIntlClass(JSContext *cx, HandleObject obj) +JSObject* +js_InitIntlClass(JSContext* cx, HandleObject obj) { JS_ASSERT(obj->is()); Rooted global(cx, &obj->as()); @@ -2047,7 +2047,7 @@ js_InitIntlClass(JSContext *cx, HandleObject obj) } bool -GlobalObject::initIntlObject(JSContext *cx, Handle global) +GlobalObject::initIntlObject(JSContext* cx, Handle global) { RootedObject Intl(cx); Intl = NewObjectWithGivenProto(cx, &IntlClass, global->getOrCreateObjectPrototype(cx), diff --git a/js/src/builtin/Intl.h b/js/src/builtin/Intl.h index d62819ca4b..fda5a6f736 100644 --- a/js/src/builtin/Intl.h +++ b/js/src/builtin/Intl.h @@ -19,8 +19,8 @@ * Initializes the Intl Object and its standard built-in properties. * Spec: ECMAScript Internationalization API Specification, 8.0, 8.1 */ -extern JSObject * -js_InitIntlClass(JSContext *cx, js::HandleObject obj); +extern JSObject* +js_InitIntlClass(JSContext* cx, js::HandleObject obj); namespace js { @@ -39,7 +39,7 @@ namespace js { * Usage: collator = intl_Collator(locales, options) */ extern bool -intl_Collator(JSContext *cx, unsigned argc, Value *vp); +intl_Collator(JSContext* cx, unsigned argc, Value* vp); /** * Returns an object indicating the supported locales for collation @@ -50,7 +50,7 @@ intl_Collator(JSContext *cx, unsigned argc, Value *vp); * Usage: availableLocales = intl_Collator_availableLocales() */ extern bool -intl_Collator_availableLocales(JSContext *cx, unsigned argc, Value *vp); +intl_Collator_availableLocales(JSContext* cx, unsigned argc, Value* vp); /** * Returns an array with the collation type identifiers per Unicode @@ -61,7 +61,7 @@ intl_Collator_availableLocales(JSContext *cx, unsigned argc, Value *vp); * Usage: collations = intl_availableCollations(locale) */ extern bool -intl_availableCollations(JSContext *cx, unsigned argc, Value *vp); +intl_availableCollations(JSContext* cx, unsigned argc, Value* vp); /** * Compares x and y (which must be String values), and returns a number less @@ -74,7 +74,7 @@ intl_availableCollations(JSContext *cx, unsigned argc, Value *vp); * Usage: result = intl_CompareStrings(collator, x, y) */ extern bool -intl_CompareStrings(JSContext *cx, unsigned argc, Value *vp); +intl_CompareStrings(JSContext* cx, unsigned argc, Value* vp); /******************** NumberFormat ********************/ @@ -87,7 +87,7 @@ intl_CompareStrings(JSContext *cx, unsigned argc, Value *vp); * Usage: numberFormat = intl_NumberFormat(locales, options) */ extern bool -intl_NumberFormat(JSContext *cx, unsigned argc, Value *vp); +intl_NumberFormat(JSContext* cx, unsigned argc, Value* vp); /** * Returns an object indicating the supported locales for number formatting @@ -98,7 +98,7 @@ intl_NumberFormat(JSContext *cx, unsigned argc, Value *vp); * Usage: availableLocales = intl_NumberFormat_availableLocales() */ extern bool -intl_NumberFormat_availableLocales(JSContext *cx, unsigned argc, Value *vp); +intl_NumberFormat_availableLocales(JSContext* cx, unsigned argc, Value* vp); /** * Returns the numbering system type identifier per Unicode @@ -108,7 +108,7 @@ intl_NumberFormat_availableLocales(JSContext *cx, unsigned argc, Value *vp); * Usage: defaultNumberingSystem = intl_numberingSystem(locale) */ extern bool -intl_numberingSystem(JSContext *cx, unsigned argc, Value *vp); +intl_numberingSystem(JSContext* cx, unsigned argc, Value* vp); /** * Returns a string representing the number x according to the effective @@ -119,7 +119,7 @@ intl_numberingSystem(JSContext *cx, unsigned argc, Value *vp); * Usage: formatted = intl_FormatNumber(numberFormat, x) */ extern bool -intl_FormatNumber(JSContext *cx, unsigned argc, Value *vp); +intl_FormatNumber(JSContext* cx, unsigned argc, Value* vp); /******************** DateTimeFormat ********************/ @@ -132,7 +132,7 @@ intl_FormatNumber(JSContext *cx, unsigned argc, Value *vp); * Usage: dateTimeFormat = intl_DateTimeFormat(locales, options) */ extern bool -intl_DateTimeFormat(JSContext *cx, unsigned argc, Value *vp); +intl_DateTimeFormat(JSContext* cx, unsigned argc, Value* vp); /** * Returns an object indicating the supported locales for date and time @@ -143,7 +143,7 @@ intl_DateTimeFormat(JSContext *cx, unsigned argc, Value *vp); * Usage: availableLocales = intl_DateTimeFormat_availableLocales() */ extern bool -intl_DateTimeFormat_availableLocales(JSContext *cx, unsigned argc, Value *vp); +intl_DateTimeFormat_availableLocales(JSContext* cx, unsigned argc, Value* vp); /** * Returns an array with the calendar type identifiers per Unicode @@ -154,7 +154,7 @@ intl_DateTimeFormat_availableLocales(JSContext *cx, unsigned argc, Value *vp); * Usage: calendars = intl_availableCalendars(locale) */ extern bool -intl_availableCalendars(JSContext *cx, unsigned argc, Value *vp); +intl_availableCalendars(JSContext* cx, unsigned argc, Value* vp); /** * Return a pattern in the date-time format pattern language of Unicode @@ -165,7 +165,7 @@ intl_availableCalendars(JSContext *cx, unsigned argc, Value *vp); * Usage: pattern = intl_patternForSkeleton(locale, skeleton) */ extern bool -intl_patternForSkeleton(JSContext *cx, unsigned argc, Value *vp); +intl_patternForSkeleton(JSContext* cx, unsigned argc, Value* vp); /** * Returns a String value representing x (which must be a Number value) @@ -177,21 +177,21 @@ intl_patternForSkeleton(JSContext *cx, unsigned argc, Value *vp); * Usage: formatted = intl_FormatDateTime(dateTimeFormat, x) */ extern bool -intl_FormatDateTime(JSContext *cx, unsigned argc, Value *vp); +intl_FormatDateTime(JSContext* cx, unsigned argc, Value* vp); /** * Cast jschar* strings to UChar* strings used by ICU. */ -inline const UChar * -JSCharToUChar(const jschar *chars) +inline const UChar* +JSCharToUChar(const jschar* chars) { - return reinterpret_cast(chars); + return reinterpret_cast(chars); } -inline UChar * -JSCharToUChar(jschar *chars) +inline UChar* +JSCharToUChar(jschar* chars) { - return reinterpret_cast(chars); + return reinterpret_cast(chars); } } // namespace js diff --git a/js/src/builtin/MapObject.cpp b/js/src/builtin/MapObject.cpp index bf4b85e82c..6d50db9657 100644 --- a/js/src/builtin/MapObject.cpp +++ b/js/src/builtin/MapObject.cpp @@ -56,8 +56,8 @@ using JS::ForOfIterator; * hash policy classes must provide. Hash policies for OrderedHashMaps and Sets * must additionally provide a distinguished "empty" key value and the * following static member functions: - * bool isEmpty(const Key &); - * void makeEmpty(Key *); + * bool isEmpty(const Key&); + * void makeEmpty(Key*); */ namespace js { @@ -79,42 +79,42 @@ class OrderedHashTable struct Data { T element; - Data *chain; + Data* chain; - Data(const T &e, Data *c) : element(e), chain(c) {} - Data(T &&e, Data *c) : element(Move(e)), chain(c) {} + Data(const T& e, Data* c) : element(e), chain(c) {} + Data(T&& e, Data* c) : element(Move(e)), chain(c) {} }; class Range; friend class Range; private: - Data **hashTable; // hash table (has hashBuckets() elements) - Data *data; // data vector, an array of Data objects + Data** hashTable; // hash table (has hashBuckets() elements) + Data* data; // data vector, an array of Data objects // data[0:dataLength] are constructed uint32_t dataLength; // number of constructed elements in data uint32_t dataCapacity; // size of data, in elements uint32_t liveCount; // dataLength less empty (removed) entries uint32_t hashShift; // multiplicative hash shift - Range *ranges; // list of all live Ranges on this table + Range* ranges; // list of all live Ranges on this table AllocPolicy alloc; public: - OrderedHashTable(AllocPolicy &ap) + OrderedHashTable(AllocPolicy& ap) : hashTable(nullptr), data(nullptr), dataLength(0), ranges(nullptr), alloc(ap) {} bool init() { MOZ_ASSERT(!hashTable, "init must be called at most once"); uint32_t buckets = initialBuckets(); - Data **tableAlloc = static_cast(alloc.malloc_(buckets * sizeof(Data *))); + Data** tableAlloc = static_cast(alloc.malloc_(buckets * sizeof(Data*))); if (!tableAlloc) return false; for (uint32_t i = 0; i < buckets; i++) tableAlloc[i] = nullptr; uint32_t capacity = uint32_t(buckets * fillFactor()); - Data *dataAlloc = static_cast(alloc.malloc_(capacity * sizeof(Data))); + Data* dataAlloc = static_cast(alloc.malloc_(capacity * sizeof(Data))); if (!dataAlloc) { alloc.free_(tableAlloc); return false; @@ -133,7 +133,7 @@ class OrderedHashTable } ~OrderedHashTable() { - for (Range *r = ranges, *next; r; r = next) { + for (Range* r = ranges, *next; r; r = next) { next = r->next; r->onTableDestroyed(); } @@ -145,19 +145,19 @@ class OrderedHashTable uint32_t count() const { return liveCount; } /* True if any element matches l. */ - bool has(const Lookup &l) const { + bool has(const Lookup& l) const { return lookup(l) != nullptr; } /* Return a pointer to the element, if any, that matches l, or nullptr. */ - T *get(const Lookup &l) { - Data *e = lookup(l, prepareHash(l)); + T* get(const Lookup& l) { + Data* e = lookup(l, prepareHash(l)); return e ? &e->element : nullptr; } /* Return a pointer to the element, if any, that matches l, or nullptr. */ - const T *get(const Lookup &l) const { - return const_cast(this)->get(l); + const T* get(const Lookup& l) const { + return const_cast(this)->get(l); } /* @@ -169,9 +169,9 @@ class OrderedHashTable * means the element was not added to the table. */ template - bool put(ElementInput &&element) { + bool put(ElementInput&& element) { HashNumber h = prepareHash(Ops::getKey(element)); - if (Data *e = lookup(Ops::getKey(element), h)) { + if (Data* e = lookup(Ops::getKey(element), h)) { e->element = Forward(element); return true; } @@ -186,7 +186,7 @@ class OrderedHashTable h >>= hashShift; liveCount++; - Data *e = &data[dataLength++]; + Data* e = &data[dataLength++]; new (e) Data(Forward(element), hashTable[h]); hashTable[h] = e; return true; @@ -201,13 +201,13 @@ class OrderedHashTable * and the matching element was removed. Shrinking is an optimization and * it's OK for it to fail. */ - bool remove(const Lookup &l, bool *foundp) { + bool remove(const Lookup& l, bool* foundp) { // Note: This could be optimized so that removing the last entry, // data[dataLength - 1], decrements dataLength. LIFO use cases would // benefit. // If a matching entry exists, empty it. - Data *e = lookup(l, prepareHash(l)); + Data* e = lookup(l, prepareHash(l)); if (e == nullptr) { *foundp = false; return true; @@ -219,7 +219,7 @@ class OrderedHashTable // Update active Ranges. uint32_t pos = e - data; - for (Range *r = ranges; r; r = r->next) + for (Range* r = ranges; r; r = r->next) r->onRemove(pos); // If many entries have been removed, try to shrink the table. @@ -242,8 +242,8 @@ class OrderedHashTable */ bool clear() { if (dataLength != 0) { - Data **oldHashTable = hashTable; - Data *oldData = data; + Data** oldHashTable = hashTable; + Data* oldData = data; uint32_t oldDataLength = dataLength; hashTable = nullptr; @@ -255,7 +255,7 @@ class OrderedHashTable alloc.free_(oldHashTable); freeData(oldData, oldDataLength); - for (Range *r = ranges; r; r = r->next) + for (Range* r = ranges; r; r = r->next) r->onClear(); } @@ -273,7 +273,7 @@ class OrderedHashTable * Then you can walk all the key-value pairs like this: * * for (Map::Range r = map.all(); !r.empty(); r.popFront()) { - * Map::Entry &pair = r.front(); + * Map::Entry& pair = r.front(); * ... do something with pair ... * } * @@ -303,7 +303,7 @@ class OrderedHashTable { friend class OrderedHashTable; - OrderedHashTable &ht; + OrderedHashTable& ht; /* The index of front() within ht.data. */ uint32_t i; @@ -324,14 +324,14 @@ class OrderedHashTable * * Invariant: *prevp == this. */ - Range **prevp; - Range *next; + Range** prevp; + Range* next; /* * Create a Range over all the entries in ht. * (This is private on purpose. End users must use ht.all().) */ - Range(OrderedHashTable &ht) : ht(ht), i(0), count(0), prevp(&ht.ranges), next(ht.ranges) { + Range(OrderedHashTable& ht) : ht(ht), i(0), count(0), prevp(&ht.ranges), next(ht.ranges) { *prevp = this; if (next) next->prevp = &next; @@ -339,7 +339,7 @@ class OrderedHashTable } public: - Range(const Range &other) + Range(const Range& other) : ht(other.ht), i(other.i), count(other.count), prevp(&ht.ranges), next(ht.ranges) { *prevp = this; @@ -355,7 +355,7 @@ class OrderedHashTable private: // Prohibit copy assignment. - Range &operator=(const Range &other) MOZ_DELETE; + Range& operator=(const Range& other) MOZ_DELETE; void seek() { while (i < ht.dataLength && Ops::isEmpty(Ops::getKey(ht.data[i].element))) @@ -415,7 +415,7 @@ class OrderedHashTable * live Ranges, and a Range can become empty that way, rendering * front() invalid. If in doubt, check empty() before calling front(). */ - T &front() { + T& front() { MOZ_ASSERT(valid()); MOZ_ASSERT(!empty()); return ht.data[i].element; @@ -446,9 +446,9 @@ class OrderedHashTable * Ops::hash on the current key must return the same hash code as * when the entry was added to the table. */ - void rekeyFront(const Key &k) { + void rekeyFront(const Key& k) { MOZ_ASSERT(valid()); - Data &entry = ht.data[i]; + Data& entry = ht.data[i]; HashNumber oldHash = prepareHash(Ops::getKey(entry.element)) >> ht.hashShift; HashNumber newHash = prepareHash(k) >> ht.hashShift; Ops::setKey(entry.element, k); @@ -458,7 +458,7 @@ class OrderedHashTable // the hash chain where we expected it. That probably means the // key's hash code changed since it was inserted, breaking the // hash code invariant.) - Data **ep = &ht.hashTable[oldHash]; + Data** ep = &ht.hashTable[oldHash]; while (*ep != &entry) ep = &(*ep)->chain; *ep = entry.chain; @@ -487,11 +487,11 @@ class OrderedHashTable * Ops::hash on the current key must return the same hash code as * when the entry was added to the table. */ - void rekeyOneEntry(const Key ¤t, const Key &newKey, const T &element) { + void rekeyOneEntry(const Key& current, const Key& newKey, const T& element) { if (current == newKey) return; - Data *entry = lookup(current, prepareHash(current)); + Data* entry = lookup(current, prepareHash(current)); if (!entry) return; @@ -505,7 +505,7 @@ class OrderedHashTable // the hash chain where we expected it. That probably means the // key's hash code changed since it was inserted, breaking the // hash code invariant.) - Data **ep = &hashTable[oldHash]; + Data** ep = &hashTable[oldHash]; while (*ep != entry) ep = &(*ep)->chain; *ep = entry->chain; @@ -546,7 +546,7 @@ class OrderedHashTable */ static double minDataFill() { return 0.25; } - static HashNumber prepareHash(const Lookup &l) { + static HashNumber prepareHash(const Lookup& l) { return ScrambleHashCode(Ops::hash(l)); } @@ -555,33 +555,33 @@ class OrderedHashTable return 1 << (HashNumberSizeBits - hashShift); } - static void destroyData(Data *data, uint32_t length) { - for (Data *p = data + length; p != data; ) + static void destroyData(Data* data, uint32_t length) { + for (Data* p = data + length; p != data; ) (--p)->~Data(); } - void freeData(Data *data, uint32_t length) { + void freeData(Data* data, uint32_t length) { destroyData(data, length); alloc.free_(data); } - Data *lookup(const Lookup &l, HashNumber h) { - for (Data *e = hashTable[h >> hashShift]; e; e = e->chain) { + Data* lookup(const Lookup& l, HashNumber h) { + for (Data* e = hashTable[h >> hashShift]; e; e = e->chain) { if (Ops::match(Ops::getKey(e->element), l)) return e; } return nullptr; } - const Data *lookup(const Lookup &l) const { - return const_cast(this)->lookup(l, prepareHash(l)); + const Data* lookup(const Lookup& l) const { + return const_cast(this)->lookup(l, prepareHash(l)); } /* This is called after rehashing the table. */ void compacted() { // If we had any empty entries, compacting may have moved live entries // to the left within |data|. Notify all live Ranges of the change. - for (Range *r = ranges; r; r = r->next) + for (Range* r = ranges; r; r = r->next) r->onCompact(); } @@ -589,8 +589,8 @@ class OrderedHashTable void rehashInPlace() { for (uint32_t i = 0, N = hashBuckets(); i < N; i++) hashTable[i] = nullptr; - Data *wp = data, *end = data + dataLength; - for (Data *rp = data; rp != end; rp++) { + Data* wp = data, *end = data + dataLength; + for (Data* rp = data; rp != end; rp++) { if (!Ops::isEmpty(Ops::getKey(rp->element))) { HashNumber h = prepareHash(Ops::getKey(rp->element)) >> hashShift; if (rp != wp) @@ -624,21 +624,21 @@ class OrderedHashTable } size_t newHashBuckets = 1 << (HashNumberSizeBits - newHashShift); - Data **newHashTable = static_cast(alloc.malloc_(newHashBuckets * sizeof(Data *))); + Data** newHashTable = static_cast(alloc.malloc_(newHashBuckets * sizeof(Data*))); if (!newHashTable) return false; for (uint32_t i = 0; i < newHashBuckets; i++) newHashTable[i] = nullptr; uint32_t newCapacity = uint32_t(newHashBuckets * fillFactor()); - Data *newData = static_cast(alloc.malloc_(newCapacity * sizeof(Data))); + Data* newData = static_cast(alloc.malloc_(newCapacity * sizeof(Data))); if (!newData) { alloc.free_(newHashTable); return false; } - Data *wp = newData; - for (Data *p = data, *end = data + dataLength; p != end; p++) { + Data* wp = newData; + for (Data* p = data, *end = data + dataLength; p != end; p++) { if (!Ops::isEmpty(Ops::getKey(p->element))) { HashNumber h = prepareHash(Ops::getKey(p->element)) >> newHashShift; new (wp) Data(Move(p->element), newHashTable[h]); @@ -663,8 +663,8 @@ class OrderedHashTable } // Not copyable. - OrderedHashTable &operator=(const OrderedHashTable &) MOZ_DELETE; - OrderedHashTable(const OrderedHashTable &) MOZ_DELETE; + OrderedHashTable& operator=(const OrderedHashTable&) MOZ_DELETE; + OrderedHashTable(const OrderedHashTable&) MOZ_DELETE; }; } // namespace detail @@ -676,21 +676,21 @@ class OrderedHashMap class Entry { template friend class detail::OrderedHashTable; - void operator=(const Entry &rhs) { - const_cast(key) = rhs.key; + void operator=(const Entry& rhs) { + const_cast(key) = rhs.key; value = rhs.value; } - void operator=(Entry &&rhs) { + void operator=(Entry&& rhs) { MOZ_ASSERT(this != &rhs, "self-move assignment is prohibited"); - const_cast(key) = Move(rhs.key); + const_cast(key) = Move(rhs.key); value = Move(rhs.value); } public: Entry() : key(), value() {} - Entry(const Key &k, const Value &v) : key(k), value(v) {} - Entry(Entry &&rhs) : key(Move(rhs.key)), value(Move(rhs.value)) {} + Entry(const Key& k, const Value& v) : key(k), value(v) {} + Entry(Entry&& rhs) : key(Move(rhs.key)), value(Move(rhs.value)) {} const Key key; Value value; @@ -700,15 +700,15 @@ class OrderedHashMap struct MapOps : OrderedHashPolicy { typedef Key KeyType; - static void makeEmpty(Entry *e) { - OrderedHashPolicy::makeEmpty(const_cast(&e->key)); + static void makeEmpty(Entry* e) { + OrderedHashPolicy::makeEmpty(const_cast(&e->key)); // Clear the value. Destroying it is another possibility, but that // would complicate class Entry considerably. e->value = Value(); } - static const Key &getKey(const Entry &e) { return e.key; } - static void setKey(Entry &e, const Key &k) { const_cast(e.key) = k; } + static const Key& getKey(const Entry& e) { return e.key; } + static void setKey(Entry& e, const Key& k) { const_cast(e.key) = k; } }; typedef detail::OrderedHashTable Impl; @@ -720,16 +720,16 @@ class OrderedHashMap OrderedHashMap(AllocPolicy ap = AllocPolicy()) : impl(ap) {} bool init() { return impl.init(); } uint32_t count() const { return impl.count(); } - bool has(const Key &key) const { return impl.has(key); } + bool has(const Key& key) const { return impl.has(key); } Range all() { return impl.all(); } - const Entry *get(const Key &key) const { return impl.get(key); } - Entry *get(const Key &key) { return impl.get(key); } - bool put(const Key &key, const Value &value) { return impl.put(Entry(key, value)); } - bool remove(const Key &key, bool *foundp) { return impl.remove(key, foundp); } + const Entry* get(const Key& key) const { return impl.get(key); } + Entry* get(const Key& key) { return impl.get(key); } + bool put(const Key& key, const Value& value) { return impl.put(Entry(key, value)); } + bool remove(const Key& key, bool* foundp) { return impl.remove(key, foundp); } bool clear() { return impl.clear(); } - void rekeyOneEntry(const Key ¤t, const Key &newKey) { - const Entry *e = get(current); + void rekeyOneEntry(const Key& current, const Key& newKey) { + const Entry* e = get(current); if (!e) return; return impl.rekeyOneEntry(current, newKey, Entry(newKey, e->value)); @@ -743,8 +743,8 @@ class OrderedHashSet struct SetOps : OrderedHashPolicy { typedef const T KeyType; - static const T &getKey(const T &v) { return v; } - static void setKey(const T &e, const T &v) { const_cast(e) = v; } + static const T& getKey(const T& v) { return v; } + static void setKey(const T& e, const T& v) { const_cast(e) = v; } }; typedef detail::OrderedHashTable Impl; @@ -756,13 +756,13 @@ class OrderedHashSet OrderedHashSet(AllocPolicy ap = AllocPolicy()) : impl(ap) {} bool init() { return impl.init(); } uint32_t count() const { return impl.count(); } - bool has(const T &value) const { return impl.has(value); } + bool has(const T& value) const { return impl.has(value); } Range all() { return impl.all(); } - bool put(const T &value) { return impl.put(value); } - bool remove(const T &value, bool *foundp) { return impl.remove(value, foundp); } + bool put(const T& value) { return impl.put(value); } + bool remove(const T& value, bool* foundp) { return impl.remove(value, foundp); } bool clear() { return impl.clear(); } - void rekeyOneEntry(const T ¤t, const T &newKey) { + void rekeyOneEntry(const T& current, const T& newKey) { return impl.rekeyOneEntry(current, newKey, newKey); } }; @@ -773,11 +773,11 @@ class OrderedHashSet /*** HashableValue *******************************************************************************/ bool -HashableValue::setValue(JSContext *cx, HandleValue v) +HashableValue::setValue(JSContext* cx, HandleValue v) { if (v.isString()) { // Atomize so that hash() and operator==() are fast and infallible. - JSString *str = AtomizeString(cx, v.toString(), DoNotInternAtom); + JSString* str = AtomizeString(cx, v.toString(), DoNotInternAtom); if (!str) return false; value = StringValue(str); @@ -812,7 +812,7 @@ HashableValue::hash() const } bool -HashableValue::operator==(const HashableValue &other) const +HashableValue::operator==(const HashableValue& other) const { // Two HashableValues are equal if they have equal bits. bool b = (value.asRawBits() == other.value.asRawBits()); @@ -826,10 +826,10 @@ HashableValue::operator==(const HashableValue &other) const } HashableValue -HashableValue::mark(JSTracer *trc) const +HashableValue::mark(JSTracer* trc) const { HashableValue hv(*this); - trc->setTracingLocation((void *)this); + trc->setTracingLocation((void*)this); gc::MarkValue(trc, &hv.value, "key"); return hv; } @@ -846,16 +846,16 @@ class MapIteratorObject : public JSObject enum { TargetSlot, KindSlot, RangeSlot, SlotCount }; static const JSFunctionSpec methods[]; - static MapIteratorObject *create(JSContext *cx, HandleObject mapobj, ValueMap *data, + static MapIteratorObject* create(JSContext* cx, HandleObject mapobj, ValueMap* data, MapObject::IteratorKind kind); - static void finalize(FreeOp *fop, JSObject *obj); + static void finalize(FreeOp* fop, JSObject* obj); private: static inline bool is(HandleValue v); - inline ValueMap::Range *range(); + inline ValueMap::Range* range(); inline MapObject::IteratorKind kind() const; - static bool next_impl(JSContext *cx, CallArgs args); - static bool next(JSContext *cx, unsigned argc, Value *vp); + static bool next_impl(JSContext* cx, CallArgs args); + static bool next(JSContext* cx, unsigned argc, Value* vp); }; } /* anonymous namespace */ @@ -880,10 +880,10 @@ const JSFunctionSpec MapIteratorObject::methods[] = { JS_FS_END }; -inline ValueMap::Range * +inline ValueMap::Range* MapIteratorObject::range() { - return static_cast(getSlot(RangeSlot).toPrivate()); + return static_cast(getSlot(RangeSlot).toPrivate()); } inline MapObject::IteratorKind @@ -895,9 +895,9 @@ MapIteratorObject::kind() const } bool -GlobalObject::initMapIteratorProto(JSContext *cx, Handle global) +GlobalObject::initMapIteratorProto(JSContext* cx, Handle global) { - JSObject *base = GlobalObject::getOrCreateIteratorPrototype(cx, global); + JSObject* base = GlobalObject::getOrCreateIteratorPrototype(cx, global); if (!base) return false; Rooted proto(cx, @@ -911,20 +911,20 @@ GlobalObject::initMapIteratorProto(JSContext *cx, Handle global) return true; } -MapIteratorObject * -MapIteratorObject::create(JSContext *cx, HandleObject mapobj, ValueMap *data, +MapIteratorObject* +MapIteratorObject::create(JSContext* cx, HandleObject mapobj, ValueMap* data, MapObject::IteratorKind kind) { - Rooted global(cx, &mapobj->global()); + Rooted global(cx, &mapobj->global()); Rooted proto(cx, GlobalObject::getOrCreateMapIteratorPrototype(cx, global)); if (!proto) return nullptr; - ValueMap::Range *range = cx->new_(data->all()); + ValueMap::Range* range = cx->new_(data->all()); if (!range) return nullptr; - JSObject *iterobj = NewObjectWithGivenProto(cx, &class_, proto, global); + JSObject* iterobj = NewObjectWithGivenProto(cx, &class_, proto, global); if (!iterobj) { js_delete(range); return nullptr; @@ -932,11 +932,11 @@ MapIteratorObject::create(JSContext *cx, HandleObject mapobj, ValueMap *data, iterobj->setSlot(TargetSlot, ObjectValue(*mapobj)); iterobj->setSlot(KindSlot, Int32Value(int32_t(kind))); iterobj->setSlot(RangeSlot, PrivateValue(range)); - return static_cast(iterobj); + return static_cast(iterobj); } void -MapIteratorObject::finalize(FreeOp *fop, JSObject *obj) +MapIteratorObject::finalize(FreeOp* fop, JSObject* obj) { fop->delete_(obj->as().range()); } @@ -948,10 +948,10 @@ MapIteratorObject::is(HandleValue v) } bool -MapIteratorObject::next_impl(JSContext *cx, CallArgs args) +MapIteratorObject::next_impl(JSContext* cx, CallArgs args) { - MapIteratorObject &thisobj = args.thisv().toObject().as(); - ValueMap::Range *range = thisobj.range(); + MapIteratorObject& thisobj = args.thisv().toObject().as(); + ValueMap::Range* range = thisobj.range(); RootedValue value(cx); bool done; @@ -975,7 +975,7 @@ MapIteratorObject::next_impl(JSContext *cx, CallArgs args) pair[0].set(range->front().key.get()); pair[1].set(range->front().value); - JSObject *pairobj = NewDenseCopiedArray(cx, pair.length(), pair.begin()); + JSObject* pairobj = NewDenseCopiedArray(cx, pair.length(), pair.begin()); if (!pairobj) return false; value.setObject(*pairobj); @@ -995,7 +995,7 @@ MapIteratorObject::next_impl(JSContext *cx, CallArgs args) } bool -MapIteratorObject::next(JSContext *cx, unsigned argc, Value *vp) +MapIteratorObject::next(JSContext* cx, unsigned argc, Value* vp) { CallArgs args = CallArgsFromVp(argc, vp); return CallNonGenericMethod(cx, is, next_impl, args); @@ -1039,9 +1039,9 @@ const JSFunctionSpec MapObject::methods[] = { JS_FS_END }; -static JSObject * -InitClass(JSContext *cx, Handle global, const Class *clasp, JSProtoKey key, Native construct, - const JSPropertySpec *properties, const JSFunctionSpec *methods) +static JSObject* +InitClass(JSContext* cx, Handle global, const Class* clasp, JSProtoKey key, Native construct, + const JSPropertySpec* properties, const JSFunctionSpec* methods) { Rooted proto(cx, global->createBlankPrototype(cx, clasp)); if (!proto) @@ -1059,15 +1059,15 @@ InitClass(JSContext *cx, Handle global, const Class *clasp, JSPro return proto; } -JSObject * -MapObject::initClass(JSContext *cx, JSObject *obj) +JSObject* +MapObject::initClass(JSContext* cx, JSObject* obj) { Rooted global(cx, &obj->as()); RootedObject proto(cx, InitClass(cx, global, &class_, JSProto_Map, construct, properties, methods)); if (proto) { // Define the "entries" method. - JSFunction *fun = JS_DefineFunction(cx, proto, "entries", entries, 0, 0); + JSFunction* fun = JS_DefineFunction(cx, proto, "entries", entries, 0, 0); if (!fun) return nullptr; @@ -1081,7 +1081,7 @@ MapObject::initClass(JSContext *cx, JSObject *obj) template static void -MarkKey(Range &r, const HashableValue &key, JSTracer *trc) +MarkKey(Range& r, const HashableValue& key, JSTracer* trc) { HashableValue newKey = key.mark(trc); @@ -1093,9 +1093,9 @@ MarkKey(Range &r, const HashableValue &key, JSTracer *trc) } void -MapObject::mark(JSTracer *trc, JSObject *obj) +MapObject::mark(JSTracer* trc, JSObject* obj) { - if (ValueMap *map = obj->as().getData()) { + if (ValueMap* map = obj->as().getData()) { for (ValueMap::Range r = map->all(); !r.empty(); r.popFront()) { MarkKey(r, r.front().key, trc); gc::MarkValue(trc, &r.front().value, "value"); @@ -1106,22 +1106,22 @@ MapObject::mark(JSTracer *trc, JSObject *obj) #ifdef JSGC_GENERATIONAL struct UnbarrieredHashPolicy { typedef Value Lookup; - static HashNumber hash(const Lookup &v) { return v.asRawBits(); } - static bool match(const Value &k, const Lookup &l) { return k == l; } - static bool isEmpty(const Value &v) { return v.isMagic(JS_HASH_KEY_EMPTY); } - static void makeEmpty(Value *vp) { vp->setMagic(JS_HASH_KEY_EMPTY); } + static HashNumber hash(const Lookup& v) { return v.asRawBits(); } + static bool match(const Value& k, const Lookup& l) { return k == l; } + static bool isEmpty(const Value& v) { return v.isMagic(JS_HASH_KEY_EMPTY); } + static void makeEmpty(Value* vp) { vp->setMagic(JS_HASH_KEY_EMPTY); } }; template class OrderedHashTableRef : public gc::BufferableRef { - TableType *table; + TableType* table; Value key; public: - explicit OrderedHashTableRef(TableType *t, const Value &k) : table(t), key(k) {} + explicit OrderedHashTableRef(TableType* t, const Value& k) : table(t), key(k) {} - void mark(JSTracer *trc) { + void mark(JSTracer* trc) { JS_ASSERT(UnbarrieredHashPolicy::hash(key) == HashableValue::Hasher::hash(*reinterpret_cast(&key))); Value prior = key; @@ -1132,40 +1132,40 @@ class OrderedHashTableRef : public gc::BufferableRef #endif static void -WriteBarrierPost(JSRuntime *rt, ValueMap *map, const HashableValue &key) +WriteBarrierPost(JSRuntime* rt, ValueMap* map, const HashableValue& key) { #ifdef JSGC_GENERATIONAL typedef OrderedHashMap UnbarrieredMap; rt->gcStoreBuffer.putGeneric(OrderedHashTableRef( - reinterpret_cast(map), key.get())); + reinterpret_cast(map), key.get())); #endif } static void -WriteBarrierPost(JSRuntime *rt, ValueSet *set, const HashableValue &key) +WriteBarrierPost(JSRuntime* rt, ValueSet* set, const HashableValue& key) { #ifdef JSGC_GENERATIONAL typedef OrderedHashSet UnbarrieredSet; rt->gcStoreBuffer.putGeneric(OrderedHashTableRef( - reinterpret_cast(set), key.get())); + reinterpret_cast(set), key.get())); #endif } void -MapObject::finalize(FreeOp *fop, JSObject *obj) +MapObject::finalize(FreeOp* fop, JSObject* obj) { - if (ValueMap *map = obj->as().getData()) + if (ValueMap* map = obj->as().getData()) fop->delete_(map); } bool -MapObject::construct(JSContext *cx, unsigned argc, Value *vp) +MapObject::construct(JSContext* cx, unsigned argc, Value* vp) { Rooted obj(cx, NewBuiltinClassInstance(cx, &class_)); if (!obj) return false; - ValueMap *map = cx->new_(cx->runtime()); + ValueMap* map = cx->new_(cx->runtime()); if (!map) return false; if (!map->init()) { @@ -1232,7 +1232,7 @@ MapObject::is(HandleValue v) if (args.length() > 0 && !key.setValue(cx, args[0])) \ return false -ValueMap & +ValueMap& MapObject::extract(CallReceiver call) { JS_ASSERT(call.thisv().isObject()); @@ -1241,32 +1241,32 @@ MapObject::extract(CallReceiver call) } bool -MapObject::size_impl(JSContext *cx, CallArgs args) +MapObject::size_impl(JSContext* cx, CallArgs args) { JS_ASSERT(MapObject::is(args.thisv())); - ValueMap &map = extract(args); + ValueMap& map = extract(args); JS_STATIC_ASSERT(sizeof map.count() <= sizeof(uint32_t)); args.rval().setNumber(map.count()); return true; } bool -MapObject::size(JSContext *cx, unsigned argc, Value *vp) +MapObject::size(JSContext* cx, unsigned argc, Value* vp) { CallArgs args = CallArgsFromVp(argc, vp); return CallNonGenericMethod(cx, args); } bool -MapObject::get_impl(JSContext *cx, CallArgs args) +MapObject::get_impl(JSContext* cx, CallArgs args) { JS_ASSERT(MapObject::is(args.thisv())); - ValueMap &map = extract(args); + ValueMap& map = extract(args); ARG0_KEY(cx, args, key); - if (ValueMap::Entry *p = map.get(key)) + if (ValueMap::Entry* p = map.get(key)) args.rval().set(p->value); else args.rval().setUndefined(); @@ -1274,36 +1274,36 @@ MapObject::get_impl(JSContext *cx, CallArgs args) } bool -MapObject::get(JSContext *cx, unsigned argc, Value *vp) +MapObject::get(JSContext* cx, unsigned argc, Value* vp) { CallArgs args = CallArgsFromVp(argc, vp); return CallNonGenericMethod(cx, args); } bool -MapObject::has_impl(JSContext *cx, CallArgs args) +MapObject::has_impl(JSContext* cx, CallArgs args) { JS_ASSERT(MapObject::is(args.thisv())); - ValueMap &map = extract(args); + ValueMap& map = extract(args); ARG0_KEY(cx, args, key); args.rval().setBoolean(map.has(key)); return true; } bool -MapObject::has(JSContext *cx, unsigned argc, Value *vp) +MapObject::has(JSContext* cx, unsigned argc, Value* vp) { CallArgs args = CallArgsFromVp(argc, vp); return CallNonGenericMethod(cx, args); } bool -MapObject::set_impl(JSContext *cx, CallArgs args) +MapObject::set_impl(JSContext* cx, CallArgs args) { JS_ASSERT(MapObject::is(args.thisv())); - ValueMap &map = extract(args); + ValueMap& map = extract(args); ARG0_KEY(cx, args, key); RelocatableValue rval(args.get(1)); if (!map.put(key, rval)) { @@ -1316,14 +1316,14 @@ MapObject::set_impl(JSContext *cx, CallArgs args) } bool -MapObject::set(JSContext *cx, unsigned argc, Value *vp) +MapObject::set(JSContext* cx, unsigned argc, Value* vp) { CallArgs args = CallArgsFromVp(argc, vp); return CallNonGenericMethod(cx, args); } bool -MapObject::delete_impl(JSContext *cx, CallArgs args) +MapObject::delete_impl(JSContext* cx, CallArgs args) { // MapObject::mark does not mark deleted entries. Incremental GC therefore // requires that no RelocatableValue objects pointing to heap values be @@ -1336,7 +1336,7 @@ MapObject::delete_impl(JSContext *cx, CallArgs args) // RelocatableValue(UndefinedValue()). JS_ASSERT(MapObject::is(args.thisv())); - ValueMap &map = extract(args); + ValueMap& map = extract(args); ARG0_KEY(cx, args, key); bool found; if (!map.remove(key, &found)) { @@ -1348,17 +1348,17 @@ MapObject::delete_impl(JSContext *cx, CallArgs args) } bool -MapObject::delete_(JSContext *cx, unsigned argc, Value *vp) +MapObject::delete_(JSContext* cx, unsigned argc, Value* vp) { CallArgs args = CallArgsFromVp(argc, vp); return CallNonGenericMethod(cx, args); } bool -MapObject::iterator_impl(JSContext *cx, CallArgs args, IteratorKind kind) +MapObject::iterator_impl(JSContext* cx, CallArgs args, IteratorKind kind) { Rooted mapobj(cx, &args.thisv().toObject().as()); - ValueMap &map = *mapobj->getData(); + ValueMap& map = *mapobj->getData(); Rooted iterobj(cx, MapIteratorObject::create(cx, mapobj, &map, kind)); if (!iterobj) return false; @@ -1367,46 +1367,46 @@ MapObject::iterator_impl(JSContext *cx, CallArgs args, IteratorKind kind) } bool -MapObject::keys_impl(JSContext *cx, CallArgs args) +MapObject::keys_impl(JSContext* cx, CallArgs args) { return iterator_impl(cx, args, Keys); } bool -MapObject::keys(JSContext *cx, unsigned argc, Value *vp) +MapObject::keys(JSContext* cx, unsigned argc, Value* vp) { CallArgs args = CallArgsFromVp(argc, vp); return CallNonGenericMethod(cx, is, keys_impl, args); } bool -MapObject::values_impl(JSContext *cx, CallArgs args) +MapObject::values_impl(JSContext* cx, CallArgs args) { return iterator_impl(cx, args, Values); } bool -MapObject::values(JSContext *cx, unsigned argc, Value *vp) +MapObject::values(JSContext* cx, unsigned argc, Value* vp) { CallArgs args = CallArgsFromVp(argc, vp); return CallNonGenericMethod(cx, is, values_impl, args); } bool -MapObject::entries_impl(JSContext *cx, CallArgs args) +MapObject::entries_impl(JSContext* cx, CallArgs args) { return iterator_impl(cx, args, Entries); } bool -MapObject::entries(JSContext *cx, unsigned argc, Value *vp) +MapObject::entries(JSContext* cx, unsigned argc, Value* vp) { CallArgs args = CallArgsFromVp(argc, vp); return CallNonGenericMethod(cx, is, entries_impl, args); } bool -MapObject::clear_impl(JSContext *cx, CallArgs args) +MapObject::clear_impl(JSContext* cx, CallArgs args) { Rooted mapobj(cx, &args.thisv().toObject().as()); if (!mapobj->getData()->clear()) { @@ -1418,14 +1418,14 @@ MapObject::clear_impl(JSContext *cx, CallArgs args) } bool -MapObject::clear(JSContext *cx, unsigned argc, Value *vp) +MapObject::clear(JSContext* cx, unsigned argc, Value* vp) { CallArgs args = CallArgsFromVp(argc, vp); return CallNonGenericMethod(cx, is, clear_impl, args); } -JSObject * -js_InitMapClass(JSContext *cx, HandleObject obj) +JSObject* +js_InitMapClass(JSContext* cx, HandleObject obj) { return MapObject::initClass(cx, obj); } @@ -1442,16 +1442,16 @@ class SetIteratorObject : public JSObject enum { TargetSlot, KindSlot, RangeSlot, SlotCount }; static const JSFunctionSpec methods[]; - static SetIteratorObject *create(JSContext *cx, HandleObject setobj, ValueSet *data, + static SetIteratorObject* create(JSContext* cx, HandleObject setobj, ValueSet* data, SetObject::IteratorKind kind); - static void finalize(FreeOp *fop, JSObject *obj); + static void finalize(FreeOp* fop, JSObject* obj); private: static inline bool is(HandleValue v); - inline ValueSet::Range *range(); + inline ValueSet::Range* range(); inline SetObject::IteratorKind kind() const; - static bool next_impl(JSContext *cx, CallArgs args); - static bool next(JSContext *cx, unsigned argc, Value *vp); + static bool next_impl(JSContext* cx, CallArgs args); + static bool next(JSContext* cx, unsigned argc, Value* vp); }; } /* anonymous namespace */ @@ -1476,10 +1476,10 @@ const JSFunctionSpec SetIteratorObject::methods[] = { JS_FS_END }; -inline ValueSet::Range * +inline ValueSet::Range* SetIteratorObject::range() { - return static_cast(getSlot(RangeSlot).toPrivate()); + return static_cast(getSlot(RangeSlot).toPrivate()); } inline SetObject::IteratorKind @@ -1491,9 +1491,9 @@ SetIteratorObject::kind() const } bool -GlobalObject::initSetIteratorProto(JSContext *cx, Handle global) +GlobalObject::initSetIteratorProto(JSContext* cx, Handle global) { - JSObject *base = GlobalObject::getOrCreateIteratorPrototype(cx, global); + JSObject* base = GlobalObject::getOrCreateIteratorPrototype(cx, global); if (!base) return false; RootedObject proto(cx, NewObjectWithGivenProto(cx, &SetIteratorObject::class_, base, global)); @@ -1506,20 +1506,20 @@ GlobalObject::initSetIteratorProto(JSContext *cx, Handle global) return true; } -SetIteratorObject * -SetIteratorObject::create(JSContext *cx, HandleObject setobj, ValueSet *data, +SetIteratorObject* +SetIteratorObject::create(JSContext* cx, HandleObject setobj, ValueSet* data, SetObject::IteratorKind kind) { - Rooted global(cx, &setobj->global()); + Rooted global(cx, &setobj->global()); Rooted proto(cx, GlobalObject::getOrCreateSetIteratorPrototype(cx, global)); if (!proto) return nullptr; - ValueSet::Range *range = cx->new_(data->all()); + ValueSet::Range* range = cx->new_(data->all()); if (!range) return nullptr; - JSObject *iterobj = NewObjectWithGivenProto(cx, &class_, proto, global); + JSObject* iterobj = NewObjectWithGivenProto(cx, &class_, proto, global); if (!iterobj) { js_delete(range); return nullptr; @@ -1527,11 +1527,11 @@ SetIteratorObject::create(JSContext *cx, HandleObject setobj, ValueSet *data, iterobj->setSlot(TargetSlot, ObjectValue(*setobj)); iterobj->setSlot(KindSlot, Int32Value(int32_t(kind))); iterobj->setSlot(RangeSlot, PrivateValue(range)); - return static_cast(iterobj); + return static_cast(iterobj); } void -SetIteratorObject::finalize(FreeOp *fop, JSObject *obj) +SetIteratorObject::finalize(FreeOp* fop, JSObject* obj) { fop->delete_(obj->as().range()); } @@ -1543,10 +1543,10 @@ SetIteratorObject::is(HandleValue v) } bool -SetIteratorObject::next_impl(JSContext *cx, CallArgs args) +SetIteratorObject::next_impl(JSContext* cx, CallArgs args) { - SetIteratorObject &thisobj = args.thisv().toObject().as(); - ValueSet::Range *range = thisobj.range(); + SetIteratorObject& thisobj = args.thisv().toObject().as(); + ValueSet::Range* range = thisobj.range(); RootedValue value(cx); bool done; @@ -1566,7 +1566,7 @@ SetIteratorObject::next_impl(JSContext *cx, CallArgs args) pair[0].set(range->front().get()); pair[1].set(range->front().get()); - JSObject *pairObj = NewDenseCopiedArray(cx, 2, pair.begin()); + JSObject* pairObj = NewDenseCopiedArray(cx, 2, pair.begin()); if (!pairObj) return false; value.setObject(*pairObj); @@ -1586,7 +1586,7 @@ SetIteratorObject::next_impl(JSContext *cx, CallArgs args) } bool -SetIteratorObject::next(JSContext *cx, unsigned argc, Value *vp) +SetIteratorObject::next(JSContext* cx, unsigned argc, Value* vp) { CallArgs args = CallArgsFromVp(argc, vp); return CallNonGenericMethod(cx, is, next_impl, args); @@ -1628,15 +1628,15 @@ const JSFunctionSpec SetObject::methods[] = { JS_FS_END }; -JSObject * -SetObject::initClass(JSContext *cx, JSObject *obj) +JSObject* +SetObject::initClass(JSContext* cx, JSObject* obj) { Rooted global(cx, &obj->as()); RootedObject proto(cx, InitClass(cx, global, &class_, JSProto_Set, construct, properties, methods)); if (proto) { // Define the "values" method. - JSFunction *fun = JS_DefineFunction(cx, proto, "values", values, 0, 0); + JSFunction* fun = JS_DefineFunction(cx, proto, "values", values, 0, 0); if (!fun) return nullptr; @@ -1651,31 +1651,31 @@ SetObject::initClass(JSContext *cx, JSObject *obj) } void -SetObject::mark(JSTracer *trc, JSObject *obj) +SetObject::mark(JSTracer* trc, JSObject* obj) { - SetObject *setobj = static_cast(obj); - if (ValueSet *set = setobj->getData()) { + SetObject* setobj = static_cast(obj); + if (ValueSet* set = setobj->getData()) { for (ValueSet::Range r = set->all(); !r.empty(); r.popFront()) MarkKey(r, r.front(), trc); } } void -SetObject::finalize(FreeOp *fop, JSObject *obj) +SetObject::finalize(FreeOp* fop, JSObject* obj) { - SetObject *setobj = static_cast(obj); - if (ValueSet *set = setobj->getData()) + SetObject* setobj = static_cast(obj); + if (ValueSet* set = setobj->getData()) fop->delete_(set); } bool -SetObject::construct(JSContext *cx, unsigned argc, Value *vp) +SetObject::construct(JSContext* cx, unsigned argc, Value* vp) { Rooted obj(cx, NewBuiltinClassInstance(cx, &class_)); if (!obj) return false; - ValueSet *set = cx->new_(cx->runtime()); + ValueSet* set = cx->new_(cx->runtime()); if (!set) return false; if (!set->init()) { @@ -1717,7 +1717,7 @@ SetObject::is(HandleValue v) return v.isObject() && v.toObject().hasClass(&class_) && v.toObject().getPrivate(); } -ValueSet & +ValueSet& SetObject::extract(CallReceiver call) { JS_ASSERT(call.thisv().isObject()); @@ -1726,47 +1726,47 @@ SetObject::extract(CallReceiver call) } bool -SetObject::size_impl(JSContext *cx, CallArgs args) +SetObject::size_impl(JSContext* cx, CallArgs args) { JS_ASSERT(is(args.thisv())); - ValueSet &set = extract(args); + ValueSet& set = extract(args); JS_STATIC_ASSERT(sizeof set.count() <= sizeof(uint32_t)); args.rval().setNumber(set.count()); return true; } bool -SetObject::size(JSContext *cx, unsigned argc, Value *vp) +SetObject::size(JSContext* cx, unsigned argc, Value* vp) { CallArgs args = CallArgsFromVp(argc, vp); return CallNonGenericMethod(cx, args); } bool -SetObject::has_impl(JSContext *cx, CallArgs args) +SetObject::has_impl(JSContext* cx, CallArgs args) { JS_ASSERT(is(args.thisv())); - ValueSet &set = extract(args); + ValueSet& set = extract(args); ARG0_KEY(cx, args, key); args.rval().setBoolean(set.has(key)); return true; } bool -SetObject::has(JSContext *cx, unsigned argc, Value *vp) +SetObject::has(JSContext* cx, unsigned argc, Value* vp) { CallArgs args = CallArgsFromVp(argc, vp); return CallNonGenericMethod(cx, args); } bool -SetObject::add_impl(JSContext *cx, CallArgs args) +SetObject::add_impl(JSContext* cx, CallArgs args) { JS_ASSERT(is(args.thisv())); - ValueSet &set = extract(args); + ValueSet& set = extract(args); ARG0_KEY(cx, args, key); if (!set.put(key)) { js_ReportOutOfMemory(cx); @@ -1778,18 +1778,18 @@ SetObject::add_impl(JSContext *cx, CallArgs args) } bool -SetObject::add(JSContext *cx, unsigned argc, Value *vp) +SetObject::add(JSContext* cx, unsigned argc, Value* vp) { CallArgs args = CallArgsFromVp(argc, vp); return CallNonGenericMethod(cx, args); } bool -SetObject::delete_impl(JSContext *cx, CallArgs args) +SetObject::delete_impl(JSContext* cx, CallArgs args) { JS_ASSERT(is(args.thisv())); - ValueSet &set = extract(args); + ValueSet& set = extract(args); ARG0_KEY(cx, args, key); bool found; if (!set.remove(key, &found)) { @@ -1801,17 +1801,17 @@ SetObject::delete_impl(JSContext *cx, CallArgs args) } bool -SetObject::delete_(JSContext *cx, unsigned argc, Value *vp) +SetObject::delete_(JSContext* cx, unsigned argc, Value* vp) { CallArgs args = CallArgsFromVp(argc, vp); return CallNonGenericMethod(cx, args); } bool -SetObject::iterator_impl(JSContext *cx, CallArgs args, IteratorKind kind) +SetObject::iterator_impl(JSContext* cx, CallArgs args, IteratorKind kind) { Rooted setobj(cx, &args.thisv().toObject().as()); - ValueSet &set = *setobj->getData(); + ValueSet& set = *setobj->getData(); Rooted iterobj(cx, SetIteratorObject::create(cx, setobj, &set, kind)); if (!iterobj) return false; @@ -1820,33 +1820,33 @@ SetObject::iterator_impl(JSContext *cx, CallArgs args, IteratorKind kind) } bool -SetObject::values_impl(JSContext *cx, CallArgs args) +SetObject::values_impl(JSContext* cx, CallArgs args) { return iterator_impl(cx, args, Values); } bool -SetObject::values(JSContext *cx, unsigned argc, Value *vp) +SetObject::values(JSContext* cx, unsigned argc, Value* vp) { CallArgs args = CallArgsFromVp(argc, vp); return CallNonGenericMethod(cx, is, values_impl, args); } bool -SetObject::entries_impl(JSContext *cx, CallArgs args) +SetObject::entries_impl(JSContext* cx, CallArgs args) { return iterator_impl(cx, args, Entries); } bool -SetObject::entries(JSContext *cx, unsigned argc, Value *vp) +SetObject::entries(JSContext* cx, unsigned argc, Value* vp) { CallArgs args = CallArgsFromVp(argc, vp); return CallNonGenericMethod(cx, is, entries_impl, args); } bool -SetObject::clear_impl(JSContext *cx, CallArgs args) +SetObject::clear_impl(JSContext* cx, CallArgs args) { Rooted setobj(cx, &args.thisv().toObject().as()); if (!setobj->getData()->clear()) { @@ -1858,14 +1858,14 @@ SetObject::clear_impl(JSContext *cx, CallArgs args) } bool -SetObject::clear(JSContext *cx, unsigned argc, Value *vp) +SetObject::clear(JSContext* cx, unsigned argc, Value* vp) { CallArgs args = CallArgsFromVp(argc, vp); return CallNonGenericMethod(cx, is, clear_impl, args); } -JSObject * -js_InitSetClass(JSContext *cx, HandleObject obj) +JSObject* +js_InitSetClass(JSContext* cx, HandleObject obj) { return SetObject::initClass(cx, obj); } diff --git a/js/src/builtin/MapObject.h b/js/src/builtin/MapObject.h index 6f294b5a7a..12fb1f3eac 100644 --- a/js/src/builtin/MapObject.h +++ b/js/src/builtin/MapObject.h @@ -27,32 +27,32 @@ class HashableValue { public: struct Hasher { typedef HashableValue Lookup; - static HashNumber hash(const Lookup &v) { return v.hash(); } - static bool match(const HashableValue &k, const Lookup &l) { return k == l; } - static bool isEmpty(const HashableValue &v) { return v.value.isMagic(JS_HASH_KEY_EMPTY); } - static void makeEmpty(HashableValue *vp) { vp->value = MagicValue(JS_HASH_KEY_EMPTY); } + static HashNumber hash(const Lookup& v) { return v.hash(); } + static bool match(const HashableValue& k, const Lookup& l) { return k == l; } + static bool isEmpty(const HashableValue& v) { return v.value.isMagic(JS_HASH_KEY_EMPTY); } + static void makeEmpty(HashableValue* vp) { vp->value = MagicValue(JS_HASH_KEY_EMPTY); } }; HashableValue() : value(UndefinedValue()) {} - bool setValue(JSContext *cx, HandleValue v); + bool setValue(JSContext* cx, HandleValue v); HashNumber hash() const; - bool operator==(const HashableValue &other) const; - HashableValue mark(JSTracer *trc) const; + bool operator==(const HashableValue& other) const; + HashableValue mark(JSTracer* trc) const; Value get() const { return value.get(); } }; class AutoHashableValueRooter : private AutoGCRooter { public: - explicit AutoHashableValueRooter(JSContext *cx + explicit AutoHashableValueRooter(JSContext* cx MOZ_GUARD_OBJECT_NOTIFIER_PARAM) : AutoGCRooter(cx, HASHABLEVALUE) { MOZ_GUARD_OBJECT_NOTIFIER_INIT; } - bool setValue(JSContext *cx, HandleValue v) { + bool setValue(JSContext* cx, HandleValue v) { return value.setValue(cx, v); } @@ -60,8 +60,8 @@ class AutoHashableValueRooter : private AutoGCRooter return value; } - friend void AutoGCRooter::trace(JSTracer *trc); - void trace(JSTracer *trc); + friend void AutoGCRooter::trace(JSTracer* trc); + void trace(JSTracer* trc); private: HashableValue value; @@ -87,81 +87,81 @@ class MapObject : public JSObject { public: enum IteratorKind { Keys, Values, Entries }; - static JSObject *initClass(JSContext *cx, JSObject *obj); + static JSObject* initClass(JSContext* cx, JSObject* obj); static const Class class_; private: static const JSPropertySpec properties[]; static const JSFunctionSpec methods[]; - ValueMap *getData() { return static_cast(getPrivate()); } + ValueMap* getData() { return static_cast(getPrivate()); } static ValueMap & extract(CallReceiver call); - static void mark(JSTracer *trc, JSObject *obj); - static void finalize(FreeOp *fop, JSObject *obj); - static bool construct(JSContext *cx, unsigned argc, Value *vp); + static void mark(JSTracer* trc, JSObject* obj); + static void finalize(FreeOp* fop, JSObject* obj); + static bool construct(JSContext* cx, unsigned argc, Value* vp); static bool is(HandleValue v); - static bool iterator_impl(JSContext *cx, CallArgs args, IteratorKind kind); - - static bool size_impl(JSContext *cx, CallArgs args); - static bool size(JSContext *cx, unsigned argc, Value *vp); - static bool get_impl(JSContext *cx, CallArgs args); - static bool get(JSContext *cx, unsigned argc, Value *vp); - static bool has_impl(JSContext *cx, CallArgs args); - static bool has(JSContext *cx, unsigned argc, Value *vp); - static bool set_impl(JSContext *cx, CallArgs args); - static bool set(JSContext *cx, unsigned argc, Value *vp); - static bool delete_impl(JSContext *cx, CallArgs args); - static bool delete_(JSContext *cx, unsigned argc, Value *vp); - static bool keys_impl(JSContext *cx, CallArgs args); - static bool keys(JSContext *cx, unsigned argc, Value *vp); - static bool values_impl(JSContext *cx, CallArgs args); - static bool values(JSContext *cx, unsigned argc, Value *vp); - static bool entries_impl(JSContext *cx, CallArgs args); - static bool entries(JSContext *cx, unsigned argc, Value *vp); - static bool clear_impl(JSContext *cx, CallArgs args); - static bool clear(JSContext *cx, unsigned argc, Value *vp); + static bool iterator_impl(JSContext* cx, CallArgs args, IteratorKind kind); + + static bool size_impl(JSContext* cx, CallArgs args); + static bool size(JSContext* cx, unsigned argc, Value* vp); + static bool get_impl(JSContext* cx, CallArgs args); + static bool get(JSContext* cx, unsigned argc, Value* vp); + static bool has_impl(JSContext* cx, CallArgs args); + static bool has(JSContext* cx, unsigned argc, Value* vp); + static bool set_impl(JSContext* cx, CallArgs args); + static bool set(JSContext* cx, unsigned argc, Value* vp); + static bool delete_impl(JSContext* cx, CallArgs args); + static bool delete_(JSContext* cx, unsigned argc, Value* vp); + static bool keys_impl(JSContext* cx, CallArgs args); + static bool keys(JSContext* cx, unsigned argc, Value* vp); + static bool values_impl(JSContext* cx, CallArgs args); + static bool values(JSContext* cx, unsigned argc, Value* vp); + static bool entries_impl(JSContext* cx, CallArgs args); + static bool entries(JSContext* cx, unsigned argc, Value* vp); + static bool clear_impl(JSContext* cx, CallArgs args); + static bool clear(JSContext* cx, unsigned argc, Value* vp); }; class SetObject : public JSObject { public: enum IteratorKind { Values, Entries }; - static JSObject *initClass(JSContext *cx, JSObject *obj); + static JSObject* initClass(JSContext* cx, JSObject* obj); static const Class class_; private: static const JSPropertySpec properties[]; static const JSFunctionSpec methods[]; - ValueSet *getData() { return static_cast(getPrivate()); } + ValueSet* getData() { return static_cast(getPrivate()); } static ValueSet & extract(CallReceiver call); - static void mark(JSTracer *trc, JSObject *obj); - static void finalize(FreeOp *fop, JSObject *obj); - static bool construct(JSContext *cx, unsigned argc, Value *vp); + static void mark(JSTracer* trc, JSObject* obj); + static void finalize(FreeOp* fop, JSObject* obj); + static bool construct(JSContext* cx, unsigned argc, Value* vp); static bool is(HandleValue v); - static bool iterator_impl(JSContext *cx, CallArgs args, IteratorKind kind); - - static bool size_impl(JSContext *cx, CallArgs args); - static bool size(JSContext *cx, unsigned argc, Value *vp); - static bool has_impl(JSContext *cx, CallArgs args); - static bool has(JSContext *cx, unsigned argc, Value *vp); - static bool add_impl(JSContext *cx, CallArgs args); - static bool add(JSContext *cx, unsigned argc, Value *vp); - static bool delete_impl(JSContext *cx, CallArgs args); - static bool delete_(JSContext *cx, unsigned argc, Value *vp); - static bool values_impl(JSContext *cx, CallArgs args); - static bool values(JSContext *cx, unsigned argc, Value *vp); - static bool entries_impl(JSContext *cx, CallArgs args); - static bool entries(JSContext *cx, unsigned argc, Value *vp); - static bool clear_impl(JSContext *cx, CallArgs args); - static bool clear(JSContext *cx, unsigned argc, Value *vp); + static bool iterator_impl(JSContext* cx, CallArgs args, IteratorKind kind); + + static bool size_impl(JSContext* cx, CallArgs args); + static bool size(JSContext* cx, unsigned argc, Value* vp); + static bool has_impl(JSContext* cx, CallArgs args); + static bool has(JSContext* cx, unsigned argc, Value* vp); + static bool add_impl(JSContext* cx, CallArgs args); + static bool add(JSContext* cx, unsigned argc, Value* vp); + static bool delete_impl(JSContext* cx, CallArgs args); + static bool delete_(JSContext* cx, unsigned argc, Value* vp); + static bool values_impl(JSContext* cx, CallArgs args); + static bool values(JSContext* cx, unsigned argc, Value* vp); + static bool entries_impl(JSContext* cx, CallArgs args); + static bool entries(JSContext* cx, unsigned argc, Value* vp); + static bool clear_impl(JSContext* cx, CallArgs args); + static bool clear(JSContext* cx, unsigned argc, Value* vp); }; } /* namespace js */ -extern JSObject * -js_InitMapClass(JSContext *cx, js::HandleObject obj); +extern JSObject* +js_InitMapClass(JSContext* cx, js::HandleObject obj); -extern JSObject * -js_InitSetClass(JSContext *cx, js::HandleObject obj); +extern JSObject* +js_InitSetClass(JSContext* cx, js::HandleObject obj); #endif /* builtin_MapObject_h */ diff --git a/js/src/builtin/Object.cpp b/js/src/builtin/Object.cpp index 69c35b3a88..dceac532df 100644 --- a/js/src/builtin/Object.cpp +++ b/js/src/builtin/Object.cpp @@ -25,7 +25,7 @@ using mozilla::ArrayLength; bool -js::obj_construct(JSContext *cx, unsigned argc, Value *vp) +js::obj_construct(JSContext* cx, unsigned argc, Value* vp) { CallArgs args = CallArgsFromVp(argc, vp); @@ -46,7 +46,7 @@ js::obj_construct(JSContext *cx, unsigned argc, Value *vp) /* ES5 15.2.4.7. */ static bool -obj_propertyIsEnumerable(JSContext *cx, unsigned argc, Value *vp) +obj_propertyIsEnumerable(JSContext* cx, unsigned argc, Value* vp) { CallArgs args = CallArgsFromVp(argc, vp); @@ -88,7 +88,7 @@ obj_propertyIsEnumerable(JSContext *cx, unsigned argc, Value *vp) #if JS_HAS_TOSOURCE static bool -obj_toSource(JSContext *cx, unsigned argc, Value *vp) +obj_toSource(JSContext* cx, unsigned argc, Value* vp) { CallArgs args = CallArgsFromVp(argc, vp); JS_CHECK_RECURSION(cx, return false); @@ -97,7 +97,7 @@ obj_toSource(JSContext *cx, unsigned argc, Value *vp) if (!obj) return false; - JSString *str = ObjectToSource(cx, obj); + JSString* str = ObjectToSource(cx, obj); if (!str) return false; @@ -105,8 +105,8 @@ obj_toSource(JSContext *cx, unsigned argc, Value *vp) return true; } -JSString * -js::ObjectToSource(JSContext *cx, HandleObject obj) +JSString* +js::ObjectToSource(JSContext* cx, HandleObject obj) { /* If outermost, we need parentheses to be an expression, not a block. */ bool outermost = (cx->cycleDetectorSet.count() == 0); @@ -170,7 +170,7 @@ js::ObjectToSource(JSContext *cx, HandleObject obj) /* Convert id to a linear string. */ RootedValue idv(cx, IdToValue(id)); - JSString *s = ToString(cx, idv); + JSString* s = ToString(cx, idv); if (!s) return nullptr; Rooted idstr(cx, s->ensureLinear(cx)); @@ -202,7 +202,7 @@ js::ObjectToSource(JSContext *cx, HandleObject obj) RootedString valstr(cx, ValueToSource(cx, val[j])); if (!valstr) return nullptr; - const jschar *vchars = valstr->getChars(cx); + const jschar* vchars = valstr->getChars(cx); if (!vchars) return nullptr; size_t vlength = valstr->length(); @@ -212,8 +212,8 @@ js::ObjectToSource(JSContext *cx, HandleObject obj) * end so that we can put "get" in front of the function definition. */ if (gsop[j] && IsFunctionObject(val[j])) { - const jschar *start = vchars; - const jschar *end = vchars + vlength; + const jschar* start = vchars; + const jschar* end = vchars + vlength; uint8_t parenChomp = 0; if (vchars[0] == '(') { @@ -269,8 +269,8 @@ js::ObjectToSource(JSContext *cx, HandleObject obj) } #endif /* JS_HAS_TOSOURCE */ -JSString * -JS_BasicObjectToString(JSContext *cx, HandleObject obj) +JSString* +JS_BasicObjectToString(JSContext* cx, HandleObject obj) { // Some classes are really common, don't allocate new strings for them. // The ordering below is based on the measurements in bug 966264. @@ -285,7 +285,7 @@ JS_BasicObjectToString(JSContext *cx, HandleObject obj) if (obj->is()) return cx->names().objectNumber; - const char *className = JSObject::className(cx, obj); + const char* className = JSObject::className(cx, obj); if (strcmp(className, "Window") == 0) return cx->names().objectWindow; @@ -301,7 +301,7 @@ JS_BasicObjectToString(JSContext *cx, HandleObject obj) /* ES5 15.2.4.2. Note steps 1 and 2 are errata. */ static bool -obj_toString(JSContext *cx, unsigned argc, Value *vp) +obj_toString(JSContext* cx, unsigned argc, Value* vp) { CallArgs args = CallArgsFromVp(argc, vp); @@ -323,7 +323,7 @@ obj_toString(JSContext *cx, unsigned argc, Value *vp) return false; /* Steps 4-5. */ - JSString *str = JS_BasicObjectToString(cx, obj); + JSString* str = JS_BasicObjectToString(cx, obj); if (!str) return false; args.rval().setString(str); @@ -332,7 +332,7 @@ obj_toString(JSContext *cx, unsigned argc, Value *vp) /* ES5 15.2.4.3. */ static bool -obj_toLocaleString(JSContext *cx, unsigned argc, Value *vp) +obj_toLocaleString(JSContext* cx, unsigned argc, Value* vp) { JS_CHECK_RECURSION(cx, return false); @@ -349,7 +349,7 @@ obj_toLocaleString(JSContext *cx, unsigned argc, Value *vp) } static bool -obj_valueOf(JSContext *cx, unsigned argc, Value *vp) +obj_valueOf(JSContext* cx, unsigned argc, Value* vp) { CallArgs args = CallArgsFromVp(argc, vp); RootedObject obj(cx, ToObject(cx, args.thisv())); @@ -365,7 +365,7 @@ enum DefineType { GetterAccessor, SetterAccessor }; template static bool -DefineAccessor(JSContext *cx, unsigned argc, Value *vp) +DefineAccessor(JSContext* cx, unsigned argc, Value* vp) { CallArgs args = CallArgsFromVp(argc, vp); if (!BoxNonStrictThis(cx, args)) @@ -386,7 +386,7 @@ DefineAccessor(JSContext *cx, unsigned argc, Value *vp) if (!descObj) return false; - JSAtomState &names = cx->names(); + JSAtomState& names = cx->names(); RootedValue trueVal(cx, BooleanValue(true)); /* enumerable: true */ @@ -398,7 +398,7 @@ DefineAccessor(JSContext *cx, unsigned argc, Value *vp) return false; /* enumerable: true */ - PropertyName *acc = (Type == GetterAccessor) ? names.get : names.set; + PropertyName* acc = (Type == GetterAccessor) ? names.get : names.set; RootedValue accessorVal(cx, args[1]); if (!JSObject::defineProperty(cx, descObj, acc, accessorVal)) return false; @@ -415,19 +415,19 @@ DefineAccessor(JSContext *cx, unsigned argc, Value *vp) } JS_FRIEND_API(bool) -js::obj_defineGetter(JSContext *cx, unsigned argc, Value *vp) +js::obj_defineGetter(JSContext* cx, unsigned argc, Value* vp) { return DefineAccessor(cx, argc, vp); } JS_FRIEND_API(bool) -js::obj_defineSetter(JSContext *cx, unsigned argc, Value *vp) +js::obj_defineSetter(JSContext* cx, unsigned argc, Value* vp) { return DefineAccessor(cx, argc, vp); } static bool -obj_lookupGetter(JSContext *cx, unsigned argc, Value *vp) +obj_lookupGetter(JSContext* cx, unsigned argc, Value* vp) { CallArgs args = CallArgsFromVp(argc, vp); @@ -463,7 +463,7 @@ obj_lookupGetter(JSContext *cx, unsigned argc, Value *vp) } static bool -obj_lookupSetter(JSContext *cx, unsigned argc, Value *vp) +obj_lookupSetter(JSContext* cx, unsigned argc, Value* vp) { CallArgs args = CallArgsFromVp(argc, vp); @@ -501,7 +501,7 @@ obj_lookupSetter(JSContext *cx, unsigned argc, Value *vp) /* ES5 15.2.3.2. */ static bool -obj_getPrototypeOf(JSContext *cx, unsigned argc, Value *vp) +obj_getPrototypeOf(JSContext* cx, unsigned argc, Value* vp) { CallArgs args = CallArgsFromVp(argc, vp); @@ -513,7 +513,7 @@ obj_getPrototypeOf(JSContext *cx, unsigned argc, Value *vp) if (args[0].isPrimitive()) { RootedValue val(cx, args[0]); - char *bytes = DecompileValueGenerator(cx, JSDVG_SEARCH_STACK, val, NullPtr()); + char* bytes = DecompileValueGenerator(cx, JSDVG_SEARCH_STACK, val, NullPtr()); if (!bytes) return false; JS_ReportErrorNumber(cx, js_GetErrorMessage, nullptr, @@ -540,7 +540,7 @@ obj_getPrototypeOf(JSContext *cx, unsigned argc, Value *vp) } static bool -obj_setPrototypeOf(JSContext *cx, unsigned argc, Value *vp) +obj_setPrototypeOf(JSContext* cx, unsigned argc, Value* vp) { CallArgs args = CallArgsFromVp(argc, vp); @@ -596,8 +596,8 @@ obj_setPrototypeOf(JSContext *cx, unsigned argc, Value *vp) #if JS_HAS_OBJ_WATCHPOINT bool -js::WatchHandler(JSContext *cx, JSObject *obj_, jsid id_, JS::Value old, - JS::Value *nvp, void *closure) +js::WatchHandler(JSContext* cx, JSObject* obj_, jsid id_, JS::Value old, + JS::Value* nvp, void* closure) { RootedObject obj(cx, obj_); RootedId id(cx, id_); @@ -607,7 +607,7 @@ js::WatchHandler(JSContext *cx, JSObject *obj_, jsid id_, JS::Value old, if (resolving.alreadyStarted()) return true; - JSObject *callable = (JSObject *)closure; + JSObject* callable = (JSObject*)closure; Value argv[] = { IdToValue(id), old, *nvp }; RootedValue rv(cx); if (!Invoke(cx, ObjectValue(*obj), ObjectOrNullValue(callable), ArrayLength(argv), argv, &rv)) @@ -618,7 +618,7 @@ js::WatchHandler(JSContext *cx, JSObject *obj_, jsid id_, JS::Value old, } static bool -obj_watch(JSContext *cx, unsigned argc, Value *vp) +obj_watch(JSContext* cx, unsigned argc, Value* vp) { CallArgs args = CallArgsFromVp(argc, vp); @@ -650,7 +650,7 @@ obj_watch(JSContext *cx, unsigned argc, Value *vp) } static bool -obj_unwatch(JSContext *cx, unsigned argc, Value *vp) +obj_unwatch(JSContext* cx, unsigned argc, Value* vp) { CallArgs args = CallArgsFromVp(argc, vp); @@ -680,7 +680,7 @@ obj_unwatch(JSContext *cx, unsigned argc, Value *vp) /* ECMA 15.2.4.5. */ static bool -obj_hasOwnProperty(JSContext *cx, unsigned argc, Value *vp) +obj_hasOwnProperty(JSContext* cx, unsigned argc, Value* vp) { CallArgs args = CallArgsFromVp(argc, vp); @@ -689,8 +689,8 @@ obj_hasOwnProperty(JSContext *cx, unsigned argc, Value *vp) /* Step 1, 2. */ jsid id; if (args.thisv().isObject() && ValueToId(cx, idValue, &id)) { - JSObject *obj = &args.thisv().toObject(), *obj2; - Shape *prop; + JSObject* obj = &args.thisv().toObject(), *obj2; + Shape* prop; if (!obj->is() && HasOwnProperty(cx, obj->getOps()->lookupGeneric, obj, id, &obj2, &prop)) { @@ -730,7 +730,7 @@ obj_hasOwnProperty(JSContext *cx, unsigned argc, Value *vp) /* ES5 15.2.4.6. */ static bool -obj_isPrototypeOf(JSContext *cx, unsigned argc, Value *vp) +obj_isPrototypeOf(JSContext* cx, unsigned argc, Value* vp) { CallArgs args = CallArgsFromVp(argc, vp); @@ -755,7 +755,7 @@ obj_isPrototypeOf(JSContext *cx, unsigned argc, Value *vp) /* ES5 15.2.3.5: Object.create(O [, Properties]) */ static bool -obj_create(JSContext *cx, unsigned argc, Value *vp) +obj_create(JSContext* cx, unsigned argc, Value* vp) { CallArgs args = CallArgsFromVp(argc, vp); if (args.length() == 0) { @@ -766,7 +766,7 @@ obj_create(JSContext *cx, unsigned argc, Value *vp) RootedValue v(cx, args[0]); if (!v.isObjectOrNull()) { - char *bytes = DecompileValueGenerator(cx, JSDVG_SEARCH_STACK, v, NullPtr()); + char* bytes = DecompileValueGenerator(cx, JSDVG_SEARCH_STACK, v, NullPtr()); if (!bytes) return false; JS_ReportErrorNumber(cx, js_GetErrorMessage, nullptr, JSMSG_UNEXPECTED_TYPE, @@ -803,7 +803,7 @@ obj_create(JSContext *cx, unsigned argc, Value *vp) } static bool -obj_getOwnPropertyDescriptor(JSContext *cx, unsigned argc, Value *vp) +obj_getOwnPropertyDescriptor(JSContext* cx, unsigned argc, Value* vp) { CallArgs args = CallArgsFromVp(argc, vp); RootedObject obj(cx); @@ -816,7 +816,7 @@ obj_getOwnPropertyDescriptor(JSContext *cx, unsigned argc, Value *vp) } static bool -obj_keys(JSContext *cx, unsigned argc, Value *vp) +obj_keys(JSContext* cx, unsigned argc, Value* vp) { CallArgs args = CallArgsFromVp(argc, vp); RootedObject obj(cx); @@ -835,7 +835,7 @@ obj_keys(JSContext *cx, unsigned argc, Value *vp) if (JSID_IS_STRING(id)) { vals.infallibleAppend(StringValue(JSID_TO_STRING(id))); } else if (JSID_IS_INT(id)) { - JSString *str = Int32ToString(cx, JSID_TO_INT(id)); + JSString* str = Int32ToString(cx, JSID_TO_INT(id)); if (!str) return false; vals.infallibleAppend(StringValue(str)); @@ -845,7 +845,7 @@ obj_keys(JSContext *cx, unsigned argc, Value *vp) } JS_ASSERT(props.length() <= UINT32_MAX); - JSObject *aobj = NewDenseCopiedArray(cx, uint32_t(vals.length()), vals.begin()); + JSObject* aobj = NewDenseCopiedArray(cx, uint32_t(vals.length()), vals.begin()); if (!aobj) return false; @@ -855,7 +855,7 @@ obj_keys(JSContext *cx, unsigned argc, Value *vp) /* ES6 draft 15.2.3.16 */ static bool -obj_is(JSContext *cx, unsigned argc, Value *vp) +obj_is(JSContext* cx, unsigned argc, Value* vp) { CallArgs args = CallArgsFromVp(argc, vp); @@ -868,7 +868,7 @@ obj_is(JSContext *cx, unsigned argc, Value *vp) } static bool -obj_getOwnPropertyNames(JSContext *cx, unsigned argc, Value *vp) +obj_getOwnPropertyNames(JSContext* cx, unsigned argc, Value* vp) { CallArgs args = CallArgsFromVp(argc, vp); RootedObject obj(cx); @@ -886,7 +886,7 @@ obj_getOwnPropertyNames(JSContext *cx, unsigned argc, Value *vp) for (size_t i = 0, len = keys.length(); i < len; i++) { jsid id = keys[i]; if (JSID_IS_INT(id)) { - JSString *str = Int32ToString(cx, JSID_TO_INT(id)); + JSString* str = Int32ToString(cx, JSID_TO_INT(id)); if (!str) return false; vals[i].setString(str); @@ -897,7 +897,7 @@ obj_getOwnPropertyNames(JSContext *cx, unsigned argc, Value *vp) } } - JSObject *aobj = NewDenseCopiedArray(cx, vals.length(), vals.begin()); + JSObject* aobj = NewDenseCopiedArray(cx, vals.length(), vals.begin()); if (!aobj) return false; @@ -907,7 +907,7 @@ obj_getOwnPropertyNames(JSContext *cx, unsigned argc, Value *vp) /* ES5 15.2.3.6: Object.defineProperty(O, P, Attributes) */ static bool -obj_defineProperty(JSContext *cx, unsigned argc, Value *vp) +obj_defineProperty(JSContext* cx, unsigned argc, Value* vp) { CallArgs args = CallArgsFromVp(argc, vp); RootedObject obj(cx); @@ -928,7 +928,7 @@ obj_defineProperty(JSContext *cx, unsigned argc, Value *vp) /* ES5 15.2.3.7: Object.defineProperties(O, Properties) */ static bool -obj_defineProperties(JSContext *cx, unsigned argc, Value *vp) +obj_defineProperties(JSContext* cx, unsigned argc, Value* vp) { CallArgs args = CallArgsFromVp(argc, vp); @@ -954,7 +954,7 @@ obj_defineProperties(JSContext *cx, unsigned argc, Value *vp) } static bool -obj_isExtensible(JSContext *cx, unsigned argc, Value *vp) +obj_isExtensible(JSContext* cx, unsigned argc, Value* vp) { CallArgs args = CallArgsFromVp(argc, vp); RootedObject obj(cx); @@ -969,7 +969,7 @@ obj_isExtensible(JSContext *cx, unsigned argc, Value *vp) } static bool -obj_preventExtensions(JSContext *cx, unsigned argc, Value *vp) +obj_preventExtensions(JSContext* cx, unsigned argc, Value* vp) { CallArgs args = CallArgsFromVp(argc, vp); RootedObject obj(cx); @@ -988,7 +988,7 @@ obj_preventExtensions(JSContext *cx, unsigned argc, Value *vp) } static bool -obj_freeze(JSContext *cx, unsigned argc, Value *vp) +obj_freeze(JSContext* cx, unsigned argc, Value* vp) { CallArgs args = CallArgsFromVp(argc, vp); RootedObject obj(cx); @@ -1001,7 +1001,7 @@ obj_freeze(JSContext *cx, unsigned argc, Value *vp) } static bool -obj_isFrozen(JSContext *cx, unsigned argc, Value *vp) +obj_isFrozen(JSContext* cx, unsigned argc, Value* vp) { CallArgs args = CallArgsFromVp(argc, vp); RootedObject obj(cx); @@ -1016,7 +1016,7 @@ obj_isFrozen(JSContext *cx, unsigned argc, Value *vp) } static bool -obj_seal(JSContext *cx, unsigned argc, Value *vp) +obj_seal(JSContext* cx, unsigned argc, Value* vp) { CallArgs args = CallArgsFromVp(argc, vp); RootedObject obj(cx); @@ -1029,7 +1029,7 @@ obj_seal(JSContext *cx, unsigned argc, Value *vp) } static bool -obj_isSealed(JSContext *cx, unsigned argc, Value *vp) +obj_isSealed(JSContext* cx, unsigned argc, Value* vp) { CallArgs args = CallArgsFromVp(argc, vp); RootedObject obj(cx); diff --git a/js/src/builtin/Object.h b/js/src/builtin/Object.h index 39950d1b1b..d69a5084a3 100644 --- a/js/src/builtin/Object.h +++ b/js/src/builtin/Object.h @@ -18,17 +18,17 @@ extern const JSFunctionSpec object_static_methods[]; // Object constructor native. Exposed only so the JIT can know its address. bool -obj_construct(JSContext *cx, unsigned argc, JS::Value *vp); +obj_construct(JSContext* cx, unsigned argc, JS::Value* vp); #if JS_HAS_TOSOURCE // Object.prototype.toSource. Function.prototype.toSource and uneval use this. -JSString * -ObjectToSource(JSContext *cx, JS::HandleObject obj); +JSString* +ObjectToSource(JSContext* cx, JS::HandleObject obj); #endif // JS_HAS_TOSOURCE extern bool -WatchHandler(JSContext *cx, JSObject *obj, jsid id, JS::Value old, - JS::Value *nvp, void *closure); +WatchHandler(JSContext* cx, JSObject* obj, jsid id, JS::Value old, + JS::Value* nvp, void* closure); } /* namespace js */ diff --git a/js/src/builtin/Profilers.cpp b/js/src/builtin/Profilers.cpp index 44844f1ff6..8a90a1acd2 100644 --- a/js/src/builtin/Profilers.cpp +++ b/js/src/builtin/Profilers.cpp @@ -44,7 +44,7 @@ static void #ifdef __GNUC__ __attribute__((unused,format(printf,1,2))) #endif -UnsafeError(const char *format, ...) +UnsafeError(const char* format, ...) { va_list args; va_start(args, format); @@ -54,7 +54,7 @@ UnsafeError(const char *format, ...) gLastError[sizeof(gLastError) - 1] = '\0'; } -JS_PUBLIC_API(const char *) +JS_PUBLIC_API(const char*) JS_UnsafeGetLastProfilingError() { return gLastError; @@ -62,7 +62,7 @@ JS_UnsafeGetLastProfilingError() #ifdef __APPLE__ static bool -StartOSXProfiling(const char *profileName, pid_t pid) +StartOSXProfiling(const char* profileName, pid_t pid) { bool ok = true; const char* profiler = nullptr; @@ -86,7 +86,7 @@ StartOSXProfiling(const char *profileName, pid_t pid) #endif JS_PUBLIC_API(bool) -JS_StartProfiling(const char *profileName, pid_t pid) +JS_StartProfiling(const char* profileName, pid_t pid) { bool ok = true; #ifdef __APPLE__ @@ -100,7 +100,7 @@ JS_StartProfiling(const char *profileName, pid_t pid) } JS_PUBLIC_API(bool) -JS_StopProfiling(const char *profileName) +JS_StopProfiling(const char* profileName) { bool ok = true; #ifdef __APPLE__ @@ -181,19 +181,19 @@ ControlProfilers(bool toState) * tracked, not the state of each profiler. */ JS_PUBLIC_API(bool) -JS_PauseProfilers(const char *profileName) +JS_PauseProfilers(const char* profileName) { return ControlProfilers(false); } JS_PUBLIC_API(bool) -JS_ResumeProfilers(const char *profileName) +JS_ResumeProfilers(const char* profileName) { return ControlProfilers(true); } JS_PUBLIC_API(bool) -JS_DumpProfile(const char *outfile, const char *profileName) +JS_DumpProfile(const char* outfile, const char* profileName) { bool ok = true; #ifdef MOZ_CALLGRIND @@ -205,9 +205,9 @@ JS_DumpProfile(const char *outfile, const char *profileName) #ifdef MOZ_PROFILING struct RequiredStringArg { - JSContext *mCx; - char *mBytes; - RequiredStringArg(JSContext *cx, const CallArgs &args, size_t argi, const char *caller) + JSContext* mCx; + char* mBytes; + RequiredStringArg(JSContext* cx, const CallArgs& args, size_t argi, const char* caller) : mCx(cx), mBytes(nullptr) { if (args.length() <= argi) { @@ -227,7 +227,7 @@ struct RequiredStringArg { }; static bool -StartProfiling(JSContext *cx, unsigned argc, jsval *vp) +StartProfiling(JSContext* cx, unsigned argc, jsval* vp) { CallArgs args = CallArgsFromVp(argc, vp); if (args.length() == 0) { @@ -254,7 +254,7 @@ StartProfiling(JSContext *cx, unsigned argc, jsval *vp) } static bool -StopProfiling(JSContext *cx, unsigned argc, jsval *vp) +StopProfiling(JSContext* cx, unsigned argc, jsval* vp) { CallArgs args = CallArgsFromVp(argc, vp); if (args.length() == 0) { @@ -270,7 +270,7 @@ StopProfiling(JSContext *cx, unsigned argc, jsval *vp) } static bool -PauseProfilers(JSContext *cx, unsigned argc, jsval *vp) +PauseProfilers(JSContext* cx, unsigned argc, jsval* vp) { CallArgs args = CallArgsFromVp(argc, vp); if (args.length() == 0) { @@ -286,7 +286,7 @@ PauseProfilers(JSContext *cx, unsigned argc, jsval *vp) } static bool -ResumeProfilers(JSContext *cx, unsigned argc, jsval *vp) +ResumeProfilers(JSContext* cx, unsigned argc, jsval* vp) { CallArgs args = CallArgsFromVp(argc, vp); if (args.length() == 0) { @@ -303,7 +303,7 @@ ResumeProfilers(JSContext *cx, unsigned argc, jsval *vp) /* Usage: DumpProfile([filename[, profileName]]) */ static bool -DumpProfile(JSContext *cx, unsigned argc, jsval *vp) +DumpProfile(JSContext* cx, unsigned argc, jsval* vp) { bool ret; CallArgs args = CallArgsFromVp(argc, vp); @@ -332,7 +332,7 @@ DumpProfile(JSContext *cx, unsigned argc, jsval *vp) #if defined(MOZ_SHARK) || defined(MOZ_INSTRUMENTS) static bool -IgnoreAndReturnTrue(JSContext *cx, unsigned argc, jsval *vp) +IgnoreAndReturnTrue(JSContext* cx, unsigned argc, jsval* vp) { CallArgs args = CallArgsFromVp(argc, vp); args.rval().setBoolean(true); @@ -343,7 +343,7 @@ IgnoreAndReturnTrue(JSContext *cx, unsigned argc, jsval *vp) #ifdef MOZ_CALLGRIND static bool -StartCallgrind(JSContext *cx, unsigned argc, jsval *vp) +StartCallgrind(JSContext* cx, unsigned argc, jsval* vp) { CallArgs args = CallArgsFromVp(argc, vp); args.rval().setBoolean(js_StartCallgrind()); @@ -351,7 +351,7 @@ StartCallgrind(JSContext *cx, unsigned argc, jsval *vp) } static bool -StopCallgrind(JSContext *cx, unsigned argc, jsval *vp) +StopCallgrind(JSContext* cx, unsigned argc, jsval* vp) { CallArgs args = CallArgsFromVp(argc, vp); args.rval().setBoolean(js_StopCallgrind()); @@ -359,7 +359,7 @@ StopCallgrind(JSContext *cx, unsigned argc, jsval *vp) } static bool -DumpCallgrind(JSContext *cx, unsigned argc, jsval *vp) +DumpCallgrind(JSContext* cx, unsigned argc, jsval* vp) { CallArgs args = CallArgsFromVp(argc, vp); if (args.length() == 0) { @@ -400,7 +400,7 @@ static const JSFunctionSpec profiling_functions[] = { #endif JS_PUBLIC_API(bool) -JS_DefineProfilingFunctions(JSContext *cx, JSObject *objArg) +JS_DefineProfilingFunctions(JSContext* cx, JSObject* objArg) { RootedObject obj(cx, objArg); @@ -430,7 +430,7 @@ js_StopCallgrind() } JS_FRIEND_API(bool) -js_DumpCallgrind(const char *outfile) +js_DumpCallgrind(const char* outfile) { if (outfile) { JS_SILENCE_UNUSED_VALUE_IN_EXPR(CALLGRIND_DUMP_STATS_AT(outfile)); @@ -475,7 +475,7 @@ static pid_t perfPid = 0; bool js_StartPerf() { - const char *outfile = "mozperf.data"; + const char* outfile = "mozperf.data"; if (perfPid != 0) { UnsafeError("js_StartPerf: called while perf was already running!\n"); @@ -508,26 +508,26 @@ bool js_StartPerf() char mainPidStr[16]; snprintf(mainPidStr, sizeof(mainPidStr), "%d", mainPid); - const char *defaultArgs[] = {"perf", "record", "--append", + const char* defaultArgs[] = {"perf", "record", "--append", "--pid", mainPidStr, "--output", outfile}; Vector args; args.append(defaultArgs, ArrayLength(defaultArgs)); - const char *flags = getenv("MOZ_PROFILE_PERF_FLAGS"); + const char* flags = getenv("MOZ_PROFILE_PERF_FLAGS"); if (!flags) { flags = "--call-graph"; } - char *flags2 = (char *)js_malloc(strlen(flags) + 1); + char* flags2 = (char*)js_malloc(strlen(flags) + 1); if (!flags2) return false; strcpy(flags2, flags); // Split |flags2| on spaces. (Don't bother to free it -- we're going to // exec anyway.) - char *toksave; - char *tok = strtok_r(flags2, " ", &toksave); + char* toksave; + char* tok = strtok_r(flags2, " ", &toksave); while (tok) { args.append(tok); tok = strtok_r(nullptr, " ", &toksave); diff --git a/js/src/builtin/Profilers.h b/js/src/builtin/Profilers.h index 5a1b9a9f6a..77d5d59500 100644 --- a/js/src/builtin/Profilers.h +++ b/js/src/builtin/Profilers.h @@ -31,21 +31,21 @@ typedef int pid_t; * Returns true if no profilers fail to start. */ extern JS_PUBLIC_API(bool) -JS_StartProfiling(const char *profileName, pid_t pid); +JS_StartProfiling(const char* profileName, pid_t pid); /** * Stop any profilers that were previously started with JS_StartProfiling. * Returns true if no profilers fail to stop. */ extern JS_PUBLIC_API(bool) -JS_StopProfiling(const char *profileName); +JS_StopProfiling(const char* profileName); /** * Write the current profile data to the given file, if applicable to whatever * profiler is being used. */ extern JS_PUBLIC_API(bool) -JS_DumpProfile(const char *outfile, const char *profileName); +JS_DumpProfile(const char* outfile, const char* profileName); /** * Pause currently active profilers (only supported by some profilers). Returns @@ -53,20 +53,20 @@ JS_DumpProfile(const char *outfile, const char *profileName); * pause/resume do not count.) */ extern JS_PUBLIC_API(bool) -JS_PauseProfilers(const char *profileName); +JS_PauseProfilers(const char* profileName); /** * Resume suspended profilers */ extern JS_PUBLIC_API(bool) -JS_ResumeProfilers(const char *profileName); +JS_ResumeProfilers(const char* profileName); /** * The profiling API calls are not able to report errors, so they use a * thread-unsafe global memory buffer to hold the last error encountered. This * should only be called after something returns false. */ -JS_PUBLIC_API(const char *) +JS_PUBLIC_API(const char*) JS_UnsafeGetLastProfilingError(); #ifdef MOZ_CALLGRIND @@ -78,7 +78,7 @@ extern JS_FRIEND_API(bool) js_StartCallgrind(); extern JS_FRIEND_API(bool) -js_DumpCallgrind(const char *outfile); +js_DumpCallgrind(const char* outfile); #endif /* MOZ_CALLGRIND */ diff --git a/js/src/builtin/RegExp.cpp b/js/src/builtin/RegExp.cpp index 14c030c7eb..fab2f2560f 100644 --- a/js/src/builtin/RegExp.cpp +++ b/js/src/builtin/RegExp.cpp @@ -19,7 +19,7 @@ using namespace js::types; using mozilla::ArrayLength; bool -js::CreateRegExpMatchResult(JSContext *cx, HandleString input, const MatchPairs &matches, +js::CreateRegExpMatchResult(JSContext* cx, HandleString input, const MatchPairs& matches, MutableHandleValue rval) { JS_ASSERT(input); @@ -35,7 +35,7 @@ js::CreateRegExpMatchResult(JSContext *cx, HandleString input, const MatchPairs */ /* Get the templateObject that defines the shape and type of the output object */ - JSObject *templateObject = cx->compartment()->regExps.getOrCreateMatchResultTemplateObject(cx); + JSObject* templateObject = cx->compartment()->regExps.getOrCreateMatchResultTemplateObject(cx); if (!templateObject) return false; @@ -48,14 +48,14 @@ js::CreateRegExpMatchResult(JSContext *cx, HandleString input, const MatchPairs /* Store a Value for each pair. */ for (size_t i = 0; i < numPairs; i++) { - const MatchPair &pair = matches[i]; + const MatchPair& pair = matches[i]; if (pair.isUndefined()) { JS_ASSERT(i != 0); /* Since we had a match, first pair must be present. */ arr->setDenseInitializedLength(i + 1); arr->initDenseElement(i, UndefinedValue()); } else { - JSLinearString *str = js_NewDependentString(cx, input, pair.start, pair.length()); + JSLinearString* str = js_NewDependentString(cx, input, pair.start, pair.length()); if (!str) return false; arr->setDenseInitializedLength(i + 1); @@ -86,9 +86,9 @@ js::CreateRegExpMatchResult(JSContext *cx, HandleString input, const MatchPairs } static RegExpRunStatus -ExecuteRegExpImpl(JSContext *cx, RegExpStatics *res, RegExpShared &re, - Handle input, const jschar *chars, size_t length, - size_t *lastIndex, MatchConduit &matches) +ExecuteRegExpImpl(JSContext* cx, RegExpStatics* res, RegExpShared& re, + Handle input, const jschar* chars, size_t length, + size_t* lastIndex, MatchConduit& matches) { RegExpRunStatus status; @@ -113,9 +113,9 @@ ExecuteRegExpImpl(JSContext *cx, RegExpStatics *res, RegExpShared &re, /* Legacy ExecuteRegExp behavior is baked into the JSAPI. */ bool -js::ExecuteRegExpLegacy(JSContext *cx, RegExpStatics *res, RegExpObject &reobj, - Handle input_, const jschar *chars, size_t length, - size_t *lastIndex, bool test, MutableHandleValue rval) +js::ExecuteRegExpLegacy(JSContext* cx, RegExpStatics* res, RegExpObject& reobj, + Handle input_, const jschar* chars, size_t length, + size_t* lastIndex, bool test, MutableHandleValue rval) { RegExpGuard shared(cx); if (!reobj.getShared(cx, &shared)) @@ -153,18 +153,18 @@ js::ExecuteRegExpLegacy(JSContext *cx, RegExpStatics *res, RegExpObject &reobj, } /* Note: returns the original if no escaping need be performed. */ -static JSAtom * -EscapeNakedForwardSlashes(JSContext *cx, HandleAtom unescaped) +static JSAtom* +EscapeNakedForwardSlashes(JSContext* cx, HandleAtom unescaped) { size_t oldLen = unescaped->length(); - const jschar *oldChars = unescaped->chars(); + const jschar* oldChars = unescaped->chars(); - JS::Anchor anchor(unescaped); + JS::Anchor anchor(unescaped); /* We may never need to use |sb|. Start using it lazily. */ StringBuffer sb(cx); - for (const jschar *it = oldChars; it < oldChars + oldLen; ++it) { + for (const jschar* it = oldChars; it < oldChars + oldLen; ++it) { if (*it == '/' && (it == oldChars || it[-1] != '\\')) { /* There's a forward slash that needs escaping. */ if (sb.empty()) { @@ -181,7 +181,7 @@ EscapeNakedForwardSlashes(JSContext *cx, HandleAtom unescaped) return nullptr; } - return sb.empty() ? (JSAtom *)unescaped : sb.finishAtom(); + return sb.empty() ? (JSAtom*)unescaped : sb.finishAtom(); } /* @@ -196,12 +196,12 @@ EscapeNakedForwardSlashes(JSContext *cx, HandleAtom unescaped) * flags := ToString(flags) if defined(flags) else '' */ static bool -CompileRegExpObject(JSContext *cx, RegExpObjectBuilder &builder, CallArgs args) +CompileRegExpObject(JSContext* cx, RegExpObjectBuilder& builder, CallArgs args) { if (args.length() == 0) { - RegExpStatics *res = cx->global()->getRegExpStatics(); + RegExpStatics* res = cx->global()->getRegExpStatics(); Rooted empty(cx, cx->runtime()->emptyString); - RegExpObject *reobj = builder.build(empty, res->getFlags()); + RegExpObject* reobj = builder.build(empty, res->getFlags()); if (!reobj) return false; args.rval().setObject(*reobj); @@ -249,7 +249,7 @@ CompileRegExpObject(JSContext *cx, RegExpObjectBuilder &builder, CallArgs args) return false; Rooted sourceAtom(cx, &v.toString()->asAtom()); - RegExpObject *reobj = builder.build(sourceAtom, flags); + RegExpObject* reobj = builder.build(sourceAtom, flags); if (!reobj) return false; @@ -284,8 +284,8 @@ CompileRegExpObject(JSContext *cx, RegExpObjectBuilder &builder, CallArgs args) if (!js::RegExpShared::checkSyntax(cx, nullptr, escapedSourceStr)) return false; - RegExpStatics *res = cx->global()->getRegExpStatics(); - RegExpObject *reobj = builder.build(escapedSourceStr, RegExpFlag(flags | res->getFlags())); + RegExpStatics* res = cx->global()->getRegExpStatics(); + RegExpObject* reobj = builder.build(escapedSourceStr, RegExpFlag(flags | res->getFlags())); if (!reobj) return false; @@ -300,7 +300,7 @@ IsRegExp(HandleValue v) } MOZ_ALWAYS_INLINE bool -regexp_compile_impl(JSContext *cx, CallArgs args) +regexp_compile_impl(JSContext* cx, CallArgs args) { JS_ASSERT(IsRegExp(args.thisv())); RegExpObjectBuilder builder(cx, &args.thisv().toObject().as()); @@ -308,14 +308,14 @@ regexp_compile_impl(JSContext *cx, CallArgs args) } static bool -regexp_compile(JSContext *cx, unsigned argc, Value *vp) +regexp_compile(JSContext* cx, unsigned argc, Value* vp) { CallArgs args = CallArgsFromVp(argc, vp); return CallNonGenericMethod(cx, args); } static bool -regexp_construct(JSContext *cx, unsigned argc, Value *vp) +regexp_construct(JSContext* cx, unsigned argc, Value* vp) { CallArgs args = CallArgsFromVp(argc, vp); @@ -339,11 +339,11 @@ regexp_construct(JSContext *cx, unsigned argc, Value *vp) } MOZ_ALWAYS_INLINE bool -regexp_toString_impl(JSContext *cx, CallArgs args) +regexp_toString_impl(JSContext* cx, CallArgs args) { JS_ASSERT(IsRegExp(args.thisv())); - JSString *str = args.thisv().toObject().as().toString(cx); + JSString* str = args.thisv().toObject().as().toString(cx); if (!str) return false; @@ -352,7 +352,7 @@ regexp_toString_impl(JSContext *cx, CallArgs args) } static bool -regexp_toString(JSContext *cx, unsigned argc, Value *vp) +regexp_toString(JSContext* cx, unsigned argc, Value* vp) { CallArgs args = CallArgsFromVp(argc, vp); return CallNonGenericMethod(cx, args); @@ -384,10 +384,10 @@ static const JSFunctionSpec regexp_methods[] = { #define DEFINE_STATIC_GETTER(name, code) \ static bool \ - name(JSContext *cx, unsigned argc, Value *vp) \ + name(JSContext* cx, unsigned argc, Value* vp) \ { \ CallArgs args = CallArgsFromVp(argc, vp); \ - RegExpStatics *res = cx->global()->getRegExpStatics(); \ + RegExpStatics* res = cx->global()->getRegExpStatics(); \ code; \ } @@ -411,18 +411,18 @@ DEFINE_STATIC_GETTER(static_paren9_getter, return res->createParen(cx, 9, #define DEFINE_STATIC_SETTER(name, code) \ static bool \ - name(JSContext *cx, unsigned argc, Value *vp) \ + name(JSContext* cx, unsigned argc, Value* vp) \ { \ - RegExpStatics *res = cx->global()->getRegExpStatics(); \ + RegExpStatics* res = cx->global()->getRegExpStatics(); \ code; \ return true; \ } static bool -static_input_setter(JSContext *cx, unsigned argc, Value *vp) +static_input_setter(JSContext* cx, unsigned argc, Value* vp) { CallArgs args = CallArgsFromVp(argc, vp); - RegExpStatics *res = cx->global()->getRegExpStatics(); + RegExpStatics* res = cx->global()->getRegExpStatics(); RootedString str(cx, ToString(cx, args.get(0))); if (!str) @@ -434,10 +434,10 @@ static_input_setter(JSContext *cx, unsigned argc, Value *vp) } static bool -static_multiline_setter(JSContext *cx, unsigned argc, Value *vp) +static_multiline_setter(JSContext* cx, unsigned argc, Value* vp) { CallArgs args = CallArgsFromVp(argc, vp); - RegExpStatics *res = cx->global()->getRegExpStatics(); + RegExpStatics* res = cx->global()->getRegExpStatics(); bool b = ToBoolean(args.get(0)); res->setMultiline(cx, b); @@ -472,8 +472,8 @@ static const JSPropertySpec regexp_static_props[] = { JS_PS_END }; -JSObject * -js_InitRegExpClass(JSContext *cx, HandleObject obj) +JSObject* +js_InitRegExpClass(JSContext* cx, HandleObject obj) { JS_ASSERT(obj->isNative()); @@ -511,8 +511,8 @@ js_InitRegExpClass(JSContext *cx, HandleObject obj) } RegExpRunStatus -js::ExecuteRegExp(JSContext *cx, HandleObject regexp, HandleString string, - MatchConduit &matches, RegExpStaticsUpdate staticsUpdate) +js::ExecuteRegExp(JSContext* cx, HandleObject regexp, HandleString string, + MatchConduit& matches, RegExpStaticsUpdate staticsUpdate) { /* Step 1 (b) was performed by CallNonGenericMethod. */ Rooted reobj(cx, ®exp->as()); @@ -521,7 +521,7 @@ js::ExecuteRegExp(JSContext *cx, HandleObject regexp, HandleString string, if (!reobj->getShared(cx, &re)) return RegExpRunStatus_Error; - RegExpStatics *res = (staticsUpdate == UpdateRegExpStatics) + RegExpStatics* res = (staticsUpdate == UpdateRegExpStatics) ? cx->global()->getRegExpStatics() : nullptr; @@ -564,7 +564,7 @@ js::ExecuteRegExp(JSContext *cx, HandleObject regexp, HandleString string, } /* Steps 8-21. */ - const jschar *chars = input->chars(); + const jschar* chars = input->chars(); size_t lastIndexInt(i); RegExpRunStatus status = ExecuteRegExpImpl(cx, res, *re, input, chars, length, &lastIndexInt, matches); @@ -583,7 +583,7 @@ js::ExecuteRegExp(JSContext *cx, HandleObject regexp, HandleString string, /* ES5 15.10.6.2 (and 15.10.6.3, which calls 15.10.6.2). */ static RegExpRunStatus -ExecuteRegExp(JSContext *cx, CallArgs args, MatchConduit &matches) +ExecuteRegExp(JSContext* cx, CallArgs args, MatchConduit& matches) { /* Step 1 (a) was performed by CallNonGenericMethod. */ RootedObject regexp(cx, &args.thisv().toObject()); @@ -598,7 +598,7 @@ ExecuteRegExp(JSContext *cx, CallArgs args, MatchConduit &matches) /* ES5 15.10.6.2. */ static bool -regexp_exec_impl(JSContext *cx, HandleObject regexp, HandleString string, +regexp_exec_impl(JSContext* cx, HandleObject regexp, HandleString string, RegExpStaticsUpdate staticsUpdate, MutableHandleValue rval) { /* Execute regular expression and gather matches. */ @@ -619,7 +619,7 @@ regexp_exec_impl(JSContext *cx, HandleObject regexp, HandleString string, } static bool -regexp_exec_impl(JSContext *cx, CallArgs args) +regexp_exec_impl(JSContext* cx, CallArgs args) { RootedObject regexp(cx, &args.thisv().toObject()); RootedString string(cx, ToString(cx, args.get(0))); @@ -630,7 +630,7 @@ regexp_exec_impl(JSContext *cx, CallArgs args) } bool -js::regexp_exec(JSContext *cx, unsigned argc, Value *vp) +js::regexp_exec(JSContext* cx, unsigned argc, Value* vp) { CallArgs args = CallArgsFromVp(argc, vp); return CallNonGenericMethod(cx, IsRegExp, regexp_exec_impl, args); @@ -638,13 +638,13 @@ js::regexp_exec(JSContext *cx, unsigned argc, Value *vp) /* Separate interface for use by IonMonkey. */ bool -js::regexp_exec_raw(JSContext *cx, HandleObject regexp, HandleString input, MutableHandleValue output) +js::regexp_exec_raw(JSContext* cx, HandleObject regexp, HandleString input, MutableHandleValue output) { return regexp_exec_impl(cx, regexp, input, UpdateRegExpStatics, output); } bool -js::regexp_exec_no_statics(JSContext *cx, unsigned argc, Value *vp) +js::regexp_exec_no_statics(JSContext* cx, unsigned argc, Value* vp) { CallArgs args = CallArgsFromVp(argc, vp); JS_ASSERT(args.length() == 2); @@ -659,7 +659,7 @@ js::regexp_exec_no_statics(JSContext *cx, unsigned argc, Value *vp) /* ES5 15.10.6.3. */ static bool -regexp_test_impl(JSContext *cx, CallArgs args) +regexp_test_impl(JSContext* cx, CallArgs args) { MatchPair match; MatchConduit conduit(&match); @@ -670,7 +670,7 @@ regexp_test_impl(JSContext *cx, CallArgs args) /* Separate interface for use by IonMonkey. */ bool -js::regexp_test_raw(JSContext *cx, HandleObject regexp, HandleString input, bool *result) +js::regexp_test_raw(JSContext* cx, HandleObject regexp, HandleString input, bool* result) { MatchPair match; MatchConduit conduit(&match); @@ -680,14 +680,14 @@ js::regexp_test_raw(JSContext *cx, HandleObject regexp, HandleString input, bool } bool -js::regexp_test(JSContext *cx, unsigned argc, Value *vp) +js::regexp_test(JSContext* cx, unsigned argc, Value* vp) { CallArgs args = CallArgsFromVp(argc, vp); return CallNonGenericMethod(cx, IsRegExp, regexp_test_impl, args); } bool -js::regexp_test_no_statics(JSContext *cx, unsigned argc, Value *vp) +js::regexp_test_no_statics(JSContext* cx, unsigned argc, Value* vp) { CallArgs args = CallArgsFromVp(argc, vp); JS_ASSERT(args.length() == 2); diff --git a/js/src/builtin/RegExp.h b/js/src/builtin/RegExp.h index e92324c290..84110d401c 100644 --- a/js/src/builtin/RegExp.h +++ b/js/src/builtin/RegExp.h @@ -9,8 +9,8 @@ #include "vm/RegExpObject.h" -JSObject * -js_InitRegExpClass(JSContext *cx, js::HandleObject obj); +JSObject* +js_InitRegExpClass(JSContext* cx, js::HandleObject obj); /* * The following builtin natives are extern'd for pointer comparison in @@ -24,8 +24,8 @@ namespace js { enum RegExpStaticsUpdate { UpdateRegExpStatics, DontUpdateRegExpStatics }; RegExpRunStatus -ExecuteRegExp(JSContext *cx, HandleObject regexp, HandleString string, - MatchConduit &matches, RegExpStaticsUpdate staticsUpdate); +ExecuteRegExp(JSContext* cx, HandleObject regexp, HandleString string, + MatchConduit& matches, RegExpStaticsUpdate staticsUpdate); /* * Legacy behavior of ExecuteRegExp(), which is baked into the JSAPI. @@ -35,26 +35,26 @@ ExecuteRegExp(JSContext *cx, HandleObject regexp, HandleString string, * |chars| and |length|. */ bool -ExecuteRegExpLegacy(JSContext *cx, RegExpStatics *res, RegExpObject &reobj, - Handle input, const jschar *chars, size_t length, - size_t *lastIndex, bool test, MutableHandleValue rval); +ExecuteRegExpLegacy(JSContext* cx, RegExpStatics* res, RegExpObject& reobj, + Handle input, const jschar* chars, size_t length, + size_t* lastIndex, bool test, MutableHandleValue rval); /* Translation from MatchPairs to a JS array in regexp_exec()'s output format. */ bool -CreateRegExpMatchResult(JSContext *cx, HandleString input, const MatchPairs &matches, +CreateRegExpMatchResult(JSContext* cx, HandleString input, const MatchPairs& matches, MutableHandleValue rval); extern bool -regexp_exec_raw(JSContext *cx, HandleObject regexp, HandleString input, MutableHandleValue output); +regexp_exec_raw(JSContext* cx, HandleObject regexp, HandleString input, MutableHandleValue output); extern bool -regexp_exec(JSContext *cx, unsigned argc, Value *vp); +regexp_exec(JSContext* cx, unsigned argc, Value* vp); bool -regexp_test_raw(JSContext *cx, HandleObject regexp, HandleString input, bool *result); +regexp_test_raw(JSContext* cx, HandleObject regexp, HandleString input, bool* result); extern bool -regexp_test(JSContext *cx, unsigned argc, Value *vp); +regexp_test(JSContext* cx, unsigned argc, Value* vp); /* * The following functions are for use by self-hosted code. @@ -66,7 +66,7 @@ regexp_test(JSContext *cx, unsigned argc, Value *vp); * Usage: match = regexp_exec_no_statics(regexp, string) */ extern bool -regexp_exec_no_statics(JSContext *cx, unsigned argc, Value *vp); +regexp_exec_no_statics(JSContext* cx, unsigned argc, Value* vp); /* * Behaves like regexp.test(string), but doesn't set RegExp statics. @@ -74,7 +74,7 @@ regexp_exec_no_statics(JSContext *cx, unsigned argc, Value *vp); * Usage: does_match = regexp_test_no_statics(regexp, string) */ extern bool -regexp_test_no_statics(JSContext *cx, unsigned argc, Value *vp); +regexp_test_no_statics(JSContext* cx, unsigned argc, Value* vp); } /* namespace js */ diff --git a/js/src/builtin/SIMD.cpp b/js/src/builtin/SIMD.cpp index 77a014d7ff..b5a69852c9 100644 --- a/js/src/builtin/SIMD.cpp +++ b/js/src/builtin/SIMD.cpp @@ -35,10 +35,10 @@ extern const JSFunctionSpec Int32x4Methods[]; /////////////////////////////////////////////////////////////////////////// // X4 -static const char *laneNames[] = {"lane 0", "lane 1", "lane 2", "lane3"}; +static const char* laneNames[] = {"lane 0", "lane 1", "lane 2", "lane3"}; template -static bool GetX4Lane(JSContext *cx, unsigned argc, Value *vp) { +static bool GetX4Lane(JSContext* cx, unsigned argc, Value* vp) { typedef typename Type32x4::Elem Elem; CallArgs args = CallArgsFromVp(argc, vp); @@ -49,8 +49,8 @@ static bool GetX4Lane(JSContext *cx, unsigned argc, Value *vp) { return false; } - TypedObject &typedObj = args.thisv().toObject().as(); - TypeDescr &descr = typedObj.typeDescr(); + TypedObject& typedObj = args.thisv().toObject().as(); + TypeDescr& descr = typedObj.typeDescr(); if (descr.kind() != TypeDescr::X4 || descr.as().type() != Type32x4::type) { JS_ReportErrorNumber(cx, js_GetErrorMessage, nullptr, JSMSG_INCOMPATIBLE_PROTO, X4TypeDescr::class_.name, laneNames[lane], @@ -59,13 +59,13 @@ static bool GetX4Lane(JSContext *cx, unsigned argc, Value *vp) { } MOZ_ASSERT(!typedObj.owner().isNeutered()); - Elem *data = reinterpret_cast(typedObj.typedMem()); + Elem* data = reinterpret_cast(typedObj.typedMem()); Type32x4::setReturn(args, data[lane]); return true; } #define LANE_ACCESSOR(type, lane) \ -static bool type##Lane##lane(JSContext *cx, unsigned argc, Value *vp) { \ +static bool type##Lane##lane(JSContext* cx, unsigned argc, Value* vp) { \ return GetX4Lane(cx, argc, vp);\ } @@ -81,7 +81,7 @@ static bool type##Lane##lane(JSContext *cx, unsigned argc, Value *vp) { \ #undef LANE_ACCESSOR template -static bool SignMask(JSContext *cx, unsigned argc, Value *vp) { +static bool SignMask(JSContext* cx, unsigned argc, Value* vp) { typedef typename Type32x4::Elem Elem; CallArgs args = CallArgsFromVp(argc, vp); @@ -92,8 +92,8 @@ static bool SignMask(JSContext *cx, unsigned argc, Value *vp) { return false; } - TypedObject &typedObj = args.thisv().toObject().as(); - TypeDescr &descr = typedObj.typeDescr(); + TypedObject& typedObj = args.thisv().toObject().as(); + TypeDescr& descr = typedObj.typeDescr(); if (descr.kind() != TypeDescr::X4 || descr.as().type() != Type32x4::type) { JS_ReportErrorNumber(cx, js_GetErrorMessage, nullptr, JSMSG_INCOMPATIBLE_PROTO, X4TypeDescr::class_.name, "signMask", @@ -102,7 +102,7 @@ static bool SignMask(JSContext *cx, unsigned argc, Value *vp) { } MOZ_ASSERT(!typedObj.owner().isNeutered()); - Elem *data = reinterpret_cast(typedObj.typedMem()); + Elem* data = reinterpret_cast(typedObj.typedMem()); int32_t mx = data[0] < 0.0 ? 1 : 0; int32_t my = data[1] < 0.0 ? 1 : 0; int32_t mz = data[2] < 0.0 ? 1 : 0; @@ -113,7 +113,7 @@ static bool SignMask(JSContext *cx, unsigned argc, Value *vp) { } #define SIGN_MASK(type) \ -static bool type##SignMask(JSContext *cx, unsigned argc, Value *vp) { \ +static bool type##SignMask(JSContext* cx, unsigned argc, Value* vp) { \ return SignMask(cx, argc, vp); \ } SIGN_MASK(Float32x4); @@ -198,8 +198,8 @@ const JSFunctionSpec js::Int32x4Defn::TypedObjectMethods[] = { }; template -static JSObject * -CreateX4Class(JSContext *cx, +static JSObject* +CreateX4Class(JSContext* cx, Handle global, HandlePropertyName stringRepr) { @@ -254,7 +254,7 @@ CreateX4Class(JSContext *cx, } bool -X4TypeDescr::call(JSContext *cx, unsigned argc, Value *vp) +X4TypeDescr::call(JSContext* cx, unsigned argc, Value* vp) { CallArgs args = CallArgsFromVp(argc, vp); const uint32_t LANES = 4; @@ -281,7 +281,7 @@ X4TypeDescr::call(JSContext *cx, unsigned argc, Value *vp) #define STORE_LANES(_constant, _type, _name) \ case _constant: \ { \ - _type *mem = reinterpret_cast<_type*>(result->typedMem()); \ + _type* mem = reinterpret_cast<_type*>(result->typedMem()); \ for (uint32_t i = 0; i < LANES; i++) { \ mem[i] = ConvertScalar<_type>(values[i]); \ } \ @@ -314,8 +314,8 @@ const Class SIMDObject::class_ = { nullptr }; -JSObject * -SIMDObject::initClass(JSContext *cx, Handle global) +JSObject* +SIMDObject::initClass(JSContext* cx, Handle global) { // SIMD relies on having the TypedObject module initialized. // In particular, the self-hosted code for array() wants @@ -385,11 +385,11 @@ SIMDObject::initClass(JSContext *cx, Handle global) return SIMD; } -JSObject * -js_InitSIMDClass(JSContext *cx, HandleObject obj) +JSObject* +js_InitSIMDClass(JSContext* cx, HandleObject obj) { JS_ASSERT(obj->is()); - Rooted global(cx, &obj->as()); + Rooted global(cx, &obj->as()); return SIMDObject::initClass(cx, global); } @@ -400,11 +400,11 @@ IsVectorObject(HandleValue v) if (!v.isObject()) return false; - JSObject &obj = v.toObject(); + JSObject& obj = v.toObject(); if (!obj.is()) return false; - TypeDescr &typeRepr = obj.as().typeDescr(); + TypeDescr& typeRepr = obj.as().typeDescr(); if (typeRepr.kind() != TypeDescr::X4) return false; @@ -415,31 +415,31 @@ template static Elem TypedObjectMemory(HandleValue v) { - TypedObject &obj = v.toObject().as(); + TypedObject& obj = v.toObject().as(); MOZ_ASSERT(!obj.owner().isNeutered()); return reinterpret_cast(obj.typedMem()); } template -JSObject * -js::Create(JSContext *cx, typename V::Elem *data) +JSObject* +js::Create(JSContext* cx, typename V::Elem* data) { typedef typename V::Elem Elem; Rooted typeDescr(cx, &V::GetTypeDescr(*cx->global())); JS_ASSERT(typeDescr); - Rooted result(cx, TypedObject::createZeroed(cx, typeDescr, 0)); + Rooted result(cx, TypedObject::createZeroed(cx, typeDescr, 0)); if (!result) return nullptr; MOZ_ASSERT(!result->owner().isNeutered()); - Elem *resultMem = reinterpret_cast(result->typedMem()); + Elem* resultMem = reinterpret_cast(result->typedMem()); memcpy(resultMem, data, sizeof(Elem) * V::lanes); return result; } -template JSObject *js::Create(JSContext *cx, Float32x4::Elem *data); -template JSObject *js::Create(JSContext *cx, Int32x4::Elem *data); +template JSObject* js::Create(JSContext* cx, Float32x4::Elem* data); +template JSObject* js::Create(JSContext* cx, Int32x4::Elem* data); namespace js { template @@ -570,7 +570,7 @@ struct Shuffle { template static bool -Func(JSContext *cx, unsigned argc, Value *vp) +Func(JSContext* cx, unsigned argc, Value* vp) { typedef typename V::Elem Elem; typedef typename Vret::Elem RetElem; @@ -588,7 +588,7 @@ Func(JSContext *cx, unsigned argc, Value *vp) return false; } - Elem *val = TypedObjectMemory(args[0]); + Elem* val = TypedObjectMemory(args[0]); for (int32_t i = 0; i < Vret::lanes; i++) result[i] = Op::apply(val[i], 0); } else { @@ -599,8 +599,8 @@ Func(JSContext *cx, unsigned argc, Value *vp) return false; } - Elem *left = TypedObjectMemory(args[0]); - Elem *right = TypedObjectMemory(args[1]); + Elem* left = TypedObjectMemory(args[0]); + Elem* right = TypedObjectMemory(args[1]); for (int32_t i = 0; i < Vret::lanes; i++) result[i] = Op::apply(left[i], right[i]); } @@ -615,7 +615,7 @@ Func(JSContext *cx, unsigned argc, Value *vp) template static bool -FuncWith(JSContext *cx, unsigned argc, Value *vp) +FuncWith(JSContext* cx, unsigned argc, Value* vp) { typedef typename V::Elem Elem; typedef typename Vret::Elem RetElem; @@ -628,7 +628,7 @@ FuncWith(JSContext *cx, unsigned argc, Value *vp) return false; } - Elem *val = TypedObjectMemory(args[0]); + Elem* val = TypedObjectMemory(args[0]); RetElem result[Vret::lanes]; if (args[1].isNumber()) { @@ -653,7 +653,7 @@ FuncWith(JSContext *cx, unsigned argc, Value *vp) template static bool -FuncShuffle(JSContext *cx, unsigned argc, Value *vp) +FuncShuffle(JSContext* cx, unsigned argc, Value* vp) { typedef typename V::Elem Elem; typedef typename Vret::Elem RetElem; @@ -672,7 +672,7 @@ FuncShuffle(JSContext *cx, unsigned argc, Value *vp) return false; } - Elem *val = TypedObjectMemory(args[0]);; + Elem* val = TypedObjectMemory(args[0]);; Elem arg1; if (!Vret::toType(cx, args[1], &arg1)) return false; @@ -687,8 +687,8 @@ FuncShuffle(JSContext *cx, unsigned argc, Value *vp) return false; } - Elem *val1 = TypedObjectMemory(args[0]); - Elem *val2 = TypedObjectMemory(args[1]); + Elem* val1 = TypedObjectMemory(args[0]); + Elem* val2 = TypedObjectMemory(args[1]); Elem arg2; if (!Vret::toType(cx, args[2], &arg2)) return false; @@ -711,7 +711,7 @@ FuncShuffle(JSContext *cx, unsigned argc, Value *vp) template static bool -FuncConvert(JSContext *cx, unsigned argc, Value *vp) +FuncConvert(JSContext* cx, unsigned argc, Value* vp) { typedef typename V::Elem Elem; typedef typename Vret::Elem RetElem; @@ -723,7 +723,7 @@ FuncConvert(JSContext *cx, unsigned argc, Value *vp) return false; } - Elem *val = TypedObjectMemory(args[0]); + Elem* val = TypedObjectMemory(args[0]); RetElem result[Vret::lanes]; for (int32_t i = 0; i < Vret::lanes; i++) result[i] = RetElem(val[i]); @@ -738,7 +738,7 @@ FuncConvert(JSContext *cx, unsigned argc, Value *vp) template static bool -FuncConvertBits(JSContext *cx, unsigned argc, Value *vp) +FuncConvertBits(JSContext* cx, unsigned argc, Value* vp) { typedef typename Vret::Elem RetElem; @@ -749,7 +749,7 @@ FuncConvertBits(JSContext *cx, unsigned argc, Value *vp) return false; } - RetElem *val = TypedObjectMemory(args[0]); + RetElem* val = TypedObjectMemory(args[0]); RootedObject obj(cx, Create(cx, val)); if (!obj) return false; @@ -760,7 +760,7 @@ FuncConvertBits(JSContext *cx, unsigned argc, Value *vp) template static bool -FuncZero(JSContext *cx, unsigned argc, Value *vp) +FuncZero(JSContext* cx, unsigned argc, Value* vp) { typedef typename Vret::Elem RetElem; @@ -784,7 +784,7 @@ FuncZero(JSContext *cx, unsigned argc, Value *vp) template static bool -FuncSplat(JSContext *cx, unsigned argc, Value *vp) +FuncSplat(JSContext* cx, unsigned argc, Value* vp) { typedef typename Vret::Elem RetElem; @@ -811,7 +811,7 @@ FuncSplat(JSContext *cx, unsigned argc, Value *vp) } static bool -Int32x4Bool(JSContext *cx, unsigned argc, Value *vp) +Int32x4Bool(JSContext* cx, unsigned argc, Value* vp) { CallArgs args = CallArgsFromVp(argc, vp); if (args.length() != 4 || @@ -835,7 +835,7 @@ Int32x4Bool(JSContext *cx, unsigned argc, Value *vp) } static bool -Float32x4Clamp(JSContext *cx, unsigned argc, Value *vp) +Float32x4Clamp(JSContext* cx, unsigned argc, Value* vp) { CallArgs args = CallArgsFromVp(argc, vp); if (args.length() != 3 || !IsVectorObject(args[0]) || @@ -845,9 +845,9 @@ Float32x4Clamp(JSContext *cx, unsigned argc, Value *vp) return false; } - float *val = TypedObjectMemory(args[0]); - float *lowerLimit = TypedObjectMemory(args[1]); - float *upperLimit = TypedObjectMemory(args[2]); + float* val = TypedObjectMemory(args[0]); + float* lowerLimit = TypedObjectMemory(args[1]); + float* upperLimit = TypedObjectMemory(args[2]); float result[Float32x4::lanes]; for (int32_t i = 0; i < Float32x4::lanes; i++) { @@ -864,7 +864,7 @@ Float32x4Clamp(JSContext *cx, unsigned argc, Value *vp) } static bool -Int32x4Select(JSContext *cx, unsigned argc, Value *vp) +Int32x4Select(JSContext* cx, unsigned argc, Value* vp) { CallArgs args = CallArgsFromVp(argc, vp); if (args.length() != 3 || !IsVectorObject(args[0]) || @@ -874,9 +874,9 @@ Int32x4Select(JSContext *cx, unsigned argc, Value *vp) return false; } - int32_t *val = TypedObjectMemory(args[0]); - int32_t *tv = TypedObjectMemory(args[1]); - int32_t *fv = TypedObjectMemory(args[2]); + int32_t* val = TypedObjectMemory(args[0]); + int32_t* tv = TypedObjectMemory(args[1]); + int32_t* fv = TypedObjectMemory(args[2]); int32_t tr[Int32x4::lanes]; for (int32_t i = 0; i < Int32x4::lanes; i++) @@ -890,7 +890,7 @@ Int32x4Select(JSContext *cx, unsigned argc, Value *vp) for (int32_t i = 0; i < Int32x4::lanes; i++) orInt[i] = Or::apply(tr[i], fr[i]); - float *result = reinterpret_cast(orInt); + float* result = reinterpret_cast(orInt); RootedObject obj(cx, Create(cx, result)); if (!obj) return false; @@ -901,7 +901,7 @@ Int32x4Select(JSContext *cx, unsigned argc, Value *vp) #define DEFINE_SIMD_FLOAT32X4_FUNCTION(Name, Func, Operands, Flags, MIRId) \ bool \ -js::simd_float32x4_##Name(JSContext *cx, unsigned argc, Value *vp) \ +js::simd_float32x4_##Name(JSContext* cx, unsigned argc, Value* vp) \ { \ return Func(cx, argc, vp); \ } @@ -910,7 +910,7 @@ FLOAT32X4_FUNCTION_LIST(DEFINE_SIMD_FLOAT32X4_FUNCTION) #define DEFINE_SIMD_INT32X4_FUNCTION(Name, Func, Operands, Flags, MIRId) \ bool \ -js::simd_int32x4_##Name(JSContext *cx, unsigned argc, Value *vp) \ +js::simd_int32x4_##Name(JSContext* cx, unsigned argc, Value* vp) \ { \ return Func(cx, argc, vp); \ } diff --git a/js/src/builtin/SIMD.h b/js/src/builtin/SIMD.h index 8df636139b..fd9f41be98 100644 --- a/js/src/builtin/SIMD.h +++ b/js/src/builtin/SIMD.h @@ -108,8 +108,8 @@ class SIMDObject : public JSObject { public: static const Class class_; - static JSObject* initClass(JSContext *cx, Handle global); - static bool toString(JSContext *cx, unsigned int argc, jsval *vp); + static JSObject* initClass(JSContext* cx, Handle global); + static bool toString(JSContext* cx, unsigned int argc, jsval* vp); }; // These classes exist for use with templates below. @@ -119,17 +119,17 @@ struct Float32x4 { static const int32_t lanes = 4; static const X4TypeDescr::Type type = X4TypeDescr::TYPE_FLOAT32; - static TypeDescr &GetTypeDescr(GlobalObject &global) { + static TypeDescr& GetTypeDescr(GlobalObject& global) { return global.float32x4TypeDescr().as(); } static Elem toType(Elem a) { return a; } - static bool toType(JSContext *cx, JS::HandleValue v, Elem *out) { + static bool toType(JSContext* cx, JS::HandleValue v, Elem* out) { *out = v.toNumber(); return true; } - static void setReturn(CallArgs &args, Elem value) { + static void setReturn(CallArgs& args, Elem value) { args.rval().setDouble(JS::CanonicalizeNaN(value)); } }; @@ -139,38 +139,38 @@ struct Int32x4 { static const int32_t lanes = 4; static const X4TypeDescr::Type type = X4TypeDescr::TYPE_INT32; - static TypeDescr &GetTypeDescr(GlobalObject &global) { + static TypeDescr& GetTypeDescr(GlobalObject& global) { return global.int32x4TypeDescr().as(); } static Elem toType(Elem a) { return ToInt32(a); } - static bool toType(JSContext *cx, JS::HandleValue v, Elem *out) { + static bool toType(JSContext* cx, JS::HandleValue v, Elem* out) { return ToInt32(cx, v, out); } - static void setReturn(CallArgs &args, Elem value) { + static void setReturn(CallArgs& args, Elem value) { args.rval().setInt32(value); } }; template -JSObject *Create(JSContext *cx, typename V::Elem *data); +JSObject* Create(JSContext* cx, typename V::Elem* data); #define DECLARE_SIMD_FLOAT32X4_FUNCTION(Name, Func, Operands, Flags, MIRId) \ extern bool \ -simd_float32x4_##Name(JSContext *cx, unsigned argc, Value *vp); +simd_float32x4_##Name(JSContext* cx, unsigned argc, Value* vp); FLOAT32X4_FUNCTION_LIST(DECLARE_SIMD_FLOAT32X4_FUNCTION) #undef DECLARE_SIMD_FLOAT32X4_FUNCTION #define DECLARE_SIMD_INT32x4_FUNCTION(Name, Func, Operands, Flags, MIRId) \ extern bool \ -simd_int32x4_##Name(JSContext *cx, unsigned argc, Value *vp); +simd_int32x4_##Name(JSContext* cx, unsigned argc, Value* vp); INT32X4_FUNCTION_LIST(DECLARE_SIMD_INT32x4_FUNCTION) #undef DECLARE_SIMD_INT32x4_FUNCTION } /* namespace js */ -JSObject * -js_InitSIMDClass(JSContext *cx, js::HandleObject obj); +JSObject* +js_InitSIMDClass(JSContext* cx, js::HandleObject obj); #endif /* builtin_SIMD_h */ diff --git a/js/src/builtin/TestingFunctions.cpp b/js/src/builtin/TestingFunctions.cpp index 72a26a77a8..b0c1fb8717 100644 --- a/js/src/builtin/TestingFunctions.cpp +++ b/js/src/builtin/TestingFunctions.cpp @@ -39,7 +39,7 @@ using mozilla::ArrayLength; static bool fuzzingSafe = false; static bool -GetBuildConfiguration(JSContext *cx, unsigned argc, jsval *vp) +GetBuildConfiguration(JSContext* cx, unsigned argc, jsval* vp) { CallArgs args = CallArgsFromVp(argc, vp); RootedObject info(cx, JS_NewObject(cx, nullptr, JS::NullPtr(), JS::NullPtr())); @@ -215,7 +215,7 @@ GetBuildConfiguration(JSContext *cx, unsigned argc, jsval *vp) } static bool -GC(JSContext *cx, unsigned argc, jsval *vp) +GC(JSContext* cx, unsigned argc, jsval* vp) { CallArgs args = CallArgsFromVp(argc, vp); @@ -252,7 +252,7 @@ GC(JSContext *cx, unsigned argc, jsval *vp) JS_snprintf(buf, sizeof(buf), "before %lu, after %lu\n", (unsigned long)preBytes, (unsigned long)cx->runtime()->gcBytes); #endif - JSString *str = JS_NewStringCopyZ(cx, buf); + JSString* str = JS_NewStringCopyZ(cx, buf); if (!str) return false; args.rval().setString(str); @@ -260,7 +260,7 @@ GC(JSContext *cx, unsigned argc, jsval *vp) } static bool -MinorGC(JSContext *cx, unsigned argc, jsval *vp) +MinorGC(JSContext* cx, unsigned argc, jsval* vp) { CallArgs args = CallArgsFromVp(argc, vp); #ifdef JSGC_GENERATIONAL @@ -274,7 +274,7 @@ MinorGC(JSContext *cx, unsigned argc, jsval *vp) } static const struct ParamPair { - const char *name; + const char* name; JSGCParamKey param; } paramMap[] = { {"maxBytes", JSGC_MAX_BYTES }, @@ -289,15 +289,15 @@ static const struct ParamPair { #define GC_PARAMETER_ARGS_LIST "maxBytes, maxMallocBytes, gcBytes, gcNumber, sliceTimeBudget, or markStackLimit" static bool -GCParameter(JSContext *cx, unsigned argc, Value *vp) +GCParameter(JSContext* cx, unsigned argc, Value* vp) { CallArgs args = CallArgsFromVp(argc, vp); - JSString *str = ToString(cx, args.get(0)); + JSString* str = ToString(cx, args.get(0)); if (!str) return false; - JSFlatString *flatStr = JS_FlattenString(cx, str); + JSFlatString* flatStr = JS_FlattenString(cx, str); if (!flatStr) return false; @@ -358,7 +358,7 @@ GCParameter(JSContext *cx, unsigned argc, Value *vp) } static bool -IsProxy(JSContext *cx, unsigned argc, Value *vp) +IsProxy(JSContext* cx, unsigned argc, Value* vp) { CallArgs args = CallArgsFromVp(argc, vp); if (args.length() != 1) { @@ -374,7 +374,7 @@ IsProxy(JSContext *cx, unsigned argc, Value *vp) } static bool -IsLazyFunction(JSContext *cx, unsigned argc, Value *vp) +IsLazyFunction(JSContext* cx, unsigned argc, Value* vp) { CallArgs args = CallArgsFromVp(argc, vp); if (args.length() != 1) { @@ -390,7 +390,7 @@ IsLazyFunction(JSContext *cx, unsigned argc, Value *vp) } static bool -IsRelazifiableFunction(JSContext *cx, unsigned argc, Value *vp) +IsRelazifiableFunction(JSContext* cx, unsigned argc, Value* vp) { CallArgs args = CallArgsFromVp(argc, vp); if (args.length() != 1) { @@ -404,13 +404,13 @@ IsRelazifiableFunction(JSContext *cx, unsigned argc, Value *vp) return true; } - JSFunction *fun = &args[0].toObject().as(); + JSFunction* fun = &args[0].toObject().as(); args.rval().setBoolean(fun->hasScript() && fun->nonLazyScript()->isRelazifiable()); return true; } static bool -InternalConst(JSContext *cx, unsigned argc, jsval *vp) +InternalConst(JSContext* cx, unsigned argc, jsval* vp) { CallArgs args = CallArgsFromVp(argc, vp); if (args.length() == 0) { @@ -418,10 +418,10 @@ InternalConst(JSContext *cx, unsigned argc, jsval *vp) return false; } - JSString *str = ToString(cx, args[0]); + JSString* str = ToString(cx, args[0]); if (!str) return false; - JSFlatString *flat = JS_FlattenString(cx, str); + JSFlatString* flat = JS_FlattenString(cx, str); if (!flat) return false; @@ -435,7 +435,7 @@ InternalConst(JSContext *cx, unsigned argc, jsval *vp) } static bool -GCPreserveCode(JSContext *cx, unsigned argc, jsval *vp) +GCPreserveCode(JSContext* cx, unsigned argc, jsval* vp) { CallArgs args = CallArgsFromVp(argc, vp); @@ -453,7 +453,7 @@ GCPreserveCode(JSContext *cx, unsigned argc, jsval *vp) #ifdef JS_GC_ZEAL static bool -GCZeal(JSContext *cx, unsigned argc, Value *vp) +GCZeal(JSContext* cx, unsigned argc, Value* vp) { CallArgs args = CallArgsFromVp(argc, vp); @@ -479,7 +479,7 @@ GCZeal(JSContext *cx, unsigned argc, Value *vp) } static bool -ScheduleGC(JSContext *cx, unsigned argc, Value *vp) +ScheduleGC(JSContext* cx, unsigned argc, Value* vp) { CallArgs args = CallArgsFromVp(argc, vp); @@ -494,7 +494,7 @@ ScheduleGC(JSContext *cx, unsigned argc, Value *vp) JS_ScheduleGC(cx, args[0].toInt32()); } else if (args[0].isObject()) { /* Ensure that |zone| is collected during the next GC. */ - Zone *zone = UncheckedUnwrap(&args[0].toObject())->zone(); + Zone* zone = UncheckedUnwrap(&args[0].toObject())->zone(); PrepareZoneForGC(zone); } else if (args[0].isString()) { /* This allows us to schedule atomsCompartment for GC. */ @@ -506,11 +506,11 @@ ScheduleGC(JSContext *cx, unsigned argc, Value *vp) } static bool -SelectForGC(JSContext *cx, unsigned argc, Value *vp) +SelectForGC(JSContext* cx, unsigned argc, Value* vp) { CallArgs args = CallArgsFromVp(argc, vp); - JSRuntime *rt = cx->runtime(); + JSRuntime* rt = cx->runtime(); for (unsigned i = 0; i < args.length(); i++) { if (args[i].isObject()) { if (!rt->gcSelectedForMarking.append(&args[i].toObject())) @@ -523,7 +523,7 @@ SelectForGC(JSContext *cx, unsigned argc, Value *vp) } static bool -VerifyPreBarriers(JSContext *cx, unsigned argc, jsval *vp) +VerifyPreBarriers(JSContext* cx, unsigned argc, jsval* vp) { CallArgs args = CallArgsFromVp(argc, vp); @@ -539,7 +539,7 @@ VerifyPreBarriers(JSContext *cx, unsigned argc, jsval *vp) } static bool -VerifyPostBarriers(JSContext *cx, unsigned argc, jsval *vp) +VerifyPostBarriers(JSContext* cx, unsigned argc, jsval* vp) { CallArgs args = CallArgsFromVp(argc, vp); if (args.length()) { @@ -553,7 +553,7 @@ VerifyPostBarriers(JSContext *cx, unsigned argc, jsval *vp) } static bool -GCState(JSContext *cx, unsigned argc, jsval *vp) +GCState(JSContext* cx, unsigned argc, jsval* vp) { CallArgs args = CallArgsFromVp(argc, vp); @@ -563,7 +563,7 @@ GCState(JSContext *cx, unsigned argc, jsval *vp) return false; } - const char *state; + const char* state; gc::State globalState = cx->runtime()->gcIncrementalState; if (globalState == gc::NO_INCREMENTAL) state = "none"; @@ -574,7 +574,7 @@ GCState(JSContext *cx, unsigned argc, jsval *vp) else MOZ_ASSUME_UNREACHABLE("Unobserveable global GC state"); - JSString *str = JS_NewStringCopyZ(cx, state); + JSString* str = JS_NewStringCopyZ(cx, state); if (!str) return false; args.rval().setString(str); @@ -582,7 +582,7 @@ GCState(JSContext *cx, unsigned argc, jsval *vp) } static bool -DeterministicGC(JSContext *cx, unsigned argc, jsval *vp) +DeterministicGC(JSContext* cx, unsigned argc, jsval* vp) { CallArgs args = CallArgsFromVp(argc, vp); @@ -599,7 +599,7 @@ DeterministicGC(JSContext *cx, unsigned argc, jsval *vp) #endif /* JS_GC_ZEAL */ static bool -GCSlice(JSContext *cx, unsigned argc, Value *vp) +GCSlice(JSContext* cx, unsigned argc, Value* vp) { CallArgs args = CallArgsFromVp(argc, vp); @@ -624,7 +624,7 @@ GCSlice(JSContext *cx, unsigned argc, Value *vp) } static bool -ValidateGC(JSContext *cx, unsigned argc, jsval *vp) +ValidateGC(JSContext* cx, unsigned argc, jsval* vp) { CallArgs args = CallArgsFromVp(argc, vp); @@ -640,7 +640,7 @@ ValidateGC(JSContext *cx, unsigned argc, jsval *vp) } static bool -FullCompartmentChecks(JSContext *cx, unsigned argc, jsval *vp) +FullCompartmentChecks(JSContext* cx, unsigned argc, jsval* vp) { CallArgs args = CallArgsFromVp(argc, vp); @@ -656,7 +656,7 @@ FullCompartmentChecks(JSContext *cx, unsigned argc, jsval *vp) } static bool -NondeterministicGetWeakMapKeys(JSContext *cx, unsigned argc, jsval *vp) +NondeterministicGetWeakMapKeys(JSContext* cx, unsigned argc, jsval* vp) { CallArgs args = CallArgsFromVp(argc, vp); @@ -686,32 +686,32 @@ NondeterministicGetWeakMapKeys(JSContext *cx, unsigned argc, jsval *vp) } struct JSCountHeapNode { - void *thing; + void* thing; JSGCTraceKind kind; - JSCountHeapNode *next; + JSCountHeapNode* next; }; -typedef HashSet, SystemAllocPolicy> VisitedSet; +typedef HashSet, SystemAllocPolicy> VisitedSet; class CountHeapTracer { public: - CountHeapTracer(JSRuntime *rt, JSTraceCallback callback) : base(rt, callback) {} + CountHeapTracer(JSRuntime* rt, JSTraceCallback callback) : base(rt, callback) {} JSTracer base; VisitedSet visited; - JSCountHeapNode *traceList; - JSCountHeapNode *recycleList; + JSCountHeapNode* traceList; + JSCountHeapNode* recycleList; bool ok; }; static void -CountHeapNotify(JSTracer *trc, void **thingp, JSGCTraceKind kind) +CountHeapNotify(JSTracer* trc, void** thingp, JSGCTraceKind kind) { JS_ASSERT(trc->callback == CountHeapNotify); - CountHeapTracer *countTracer = (CountHeapTracer *)trc; - void *thing = *thingp; + CountHeapTracer* countTracer = (CountHeapTracer*)trc; + void* thing = *thingp; if (!countTracer->ok) return; @@ -725,7 +725,7 @@ CountHeapNotify(JSTracer *trc, void **thingp, JSGCTraceKind kind) return; } - JSCountHeapNode *node = countTracer->recycleList; + JSCountHeapNode* node = countTracer->recycleList; if (node) { countTracer->recycleList = node->next; } else { @@ -742,7 +742,7 @@ CountHeapNotify(JSTracer *trc, void **thingp, JSGCTraceKind kind) } static const struct TraceKindPair { - const char *name; + const char* name; int32_t kind; } traceKindNames[] = { { "all", -1 }, @@ -751,7 +751,7 @@ static const struct TraceKindPair { }; static bool -CountHeap(JSContext *cx, unsigned argc, jsval *vp) +CountHeap(JSContext* cx, unsigned argc, jsval* vp) { CallArgs args = CallArgsFromVp(argc, vp); @@ -770,12 +770,12 @@ CountHeap(JSContext *cx, unsigned argc, jsval *vp) RootedValue traceValue(cx); int32_t traceKind = -1; - void *traceThing = nullptr; + void* traceThing = nullptr; if (args.length() > 1) { - JSString *str = ToString(cx, args[1]); + JSString* str = ToString(cx, args[1]); if (!str) return false; - JSFlatString *flatStr = JS_FlattenString(cx, str); + JSFlatString* flatStr = JS_FlattenString(cx, str); if (!flatStr) return false; if (JS_FlatStringEqualsAscii(flatStr, "specific")) { @@ -821,7 +821,7 @@ CountHeap(JSContext *cx, unsigned argc, jsval *vp) JS_CallValueTracer(&countTracer.base, startValue.address(), "root"); } - JSCountHeapNode *node; + JSCountHeapNode* node; size_t counter = 0; while ((node = countTracer.traceList) != nullptr) { if (traceThing == nullptr) { @@ -852,7 +852,7 @@ CountHeap(JSContext *cx, unsigned argc, jsval *vp) } static bool -GetSavedFrameCount(JSContext *cx, unsigned argc, jsval *vp) +GetSavedFrameCount(JSContext* cx, unsigned argc, jsval* vp) { CallArgs args = CallArgsFromVp(argc, vp); args.rval().setNumber(cx->compartment()->savedStacks().count()); @@ -860,7 +860,7 @@ GetSavedFrameCount(JSContext *cx, unsigned argc, jsval *vp) } static bool -SaveStack(JSContext *cx, unsigned argc, jsval *vp) +SaveStack(JSContext* cx, unsigned argc, jsval* vp) { CallArgs args = CallArgsFromVp(argc, vp); Rooted frame(cx); @@ -872,7 +872,7 @@ SaveStack(JSContext *cx, unsigned argc, jsval *vp) #if defined(DEBUG) || defined(JS_OOM_BREAKPOINT) static bool -OOMAfterAllocations(JSContext *cx, unsigned argc, jsval *vp) +OOMAfterAllocations(JSContext* cx, unsigned argc, jsval* vp) { CallArgs args = CallArgsFromVp(argc, vp); if (args.length() != 1) { @@ -892,7 +892,7 @@ OOMAfterAllocations(JSContext *cx, unsigned argc, jsval *vp) static unsigned finalizeCount = 0; static void -finalize_counter_finalize(JSFreeOp *fop, JSObject *obj) +finalize_counter_finalize(JSFreeOp* fop, JSObject* obj) { ++finalizeCount; } @@ -910,14 +910,14 @@ static const JSClass FinalizeCounterClass = { }; static bool -MakeFinalizeObserver(JSContext *cx, unsigned argc, jsval *vp) +MakeFinalizeObserver(JSContext* cx, unsigned argc, jsval* vp) { CallArgs args = CallArgsFromVp(argc, vp); RootedObject scope(cx, JS::CurrentGlobalOrNull(cx)); if (!scope) return false; - JSObject *obj = JS_NewObjectWithGivenProto(cx, &FinalizeCounterClass, JS::NullPtr(), scope); + JSObject* obj = JS_NewObjectWithGivenProto(cx, &FinalizeCounterClass, JS::NullPtr(), scope); if (!obj) return false; @@ -926,7 +926,7 @@ MakeFinalizeObserver(JSContext *cx, unsigned argc, jsval *vp) } static bool -FinalizeCount(JSContext *cx, unsigned argc, jsval *vp) +FinalizeCount(JSContext* cx, unsigned argc, jsval* vp) { CallArgs args = CallArgsFromVp(argc, vp); args.rval().setInt32(finalizeCount); @@ -934,18 +934,18 @@ FinalizeCount(JSContext *cx, unsigned argc, jsval *vp) } static bool -DumpHeapComplete(JSContext *cx, unsigned argc, jsval *vp) +DumpHeapComplete(JSContext* cx, unsigned argc, jsval* vp) { CallArgs args = CallArgsFromVp(argc, vp); DumpHeapNurseryBehaviour nurseryBehaviour = js::IgnoreNurseryObjects; - FILE *dumpFile = nullptr; + FILE* dumpFile = nullptr; unsigned i = 0; if (args.length() > i) { Value v = args[i]; if (v.isString()) { - JSString *str = v.toString(); + JSString* str = v.toString(); bool same = false; if (!JS_StringEqualsAscii(cx, str, "collectNurseryBeforeDump", &same)) return false; @@ -960,11 +960,11 @@ DumpHeapComplete(JSContext *cx, unsigned argc, jsval *vp) Value v = args[i]; if (v.isString()) { if (!fuzzingSafe) { - JSString *str = v.toString(); + JSString* str = v.toString(); JSAutoByteString fileNameBytes; if (!fileNameBytes.encodeLatin1(cx, str)) return false; - const char *fileName = fileNameBytes.ptr(); + const char* fileName = fileNameBytes.ptr(); dumpFile = fopen(fileName, "w"); if (!dumpFile) { JS_ReportError(cx, "can't open %s", fileName); @@ -990,7 +990,7 @@ DumpHeapComplete(JSContext *cx, unsigned argc, jsval *vp) } static bool -Terminate(JSContext *cx, unsigned arg, jsval *vp) +Terminate(JSContext* cx, unsigned arg, jsval* vp) { #ifdef JS_MORE_DETERMINISTIC // Print a message to stderr in more-deterministic builds to help jsfunfuzz @@ -1003,7 +1003,7 @@ Terminate(JSContext *cx, unsigned arg, jsval *vp) } static bool -EnableSPSProfilingAssertions(JSContext *cx, unsigned argc, jsval *vp) +EnableSPSProfilingAssertions(JSContext* cx, unsigned argc, jsval* vp) { CallArgs args = CallArgsFromVp(argc, vp); if (!args.get(0).isBoolean()) { @@ -1027,7 +1027,7 @@ EnableSPSProfilingAssertions(JSContext *cx, unsigned argc, jsval *vp) } static bool -DisableSPSProfiling(JSContext *cx, unsigned argc, jsval *vp) +DisableSPSProfiling(JSContext* cx, unsigned argc, jsval* vp) { if (cx->runtime()->spsProfiler.installed()) cx->runtime()->spsProfiler.enable(false); @@ -1035,7 +1035,7 @@ DisableSPSProfiling(JSContext *cx, unsigned argc, jsval *vp) } static bool -EnableOsiPointRegisterChecks(JSContext *, unsigned argc, jsval *vp) +EnableOsiPointRegisterChecks(JSContext*, unsigned argc, jsval* vp) { CallArgs args = CallArgsFromVp(argc, vp); #if defined(JS_ION) && defined(CHECK_OSIPOINT_REGISTERS) @@ -1046,7 +1046,7 @@ EnableOsiPointRegisterChecks(JSContext *, unsigned argc, jsval *vp) } static bool -DisplayName(JSContext *cx, unsigned argc, jsval *vp) +DisplayName(JSContext* cx, unsigned argc, jsval* vp) { CallArgs args = CallArgsFromVp(argc, vp); if (!args.get(0).isObject() || !args[0].toObject().is()) { @@ -1055,14 +1055,14 @@ DisplayName(JSContext *cx, unsigned argc, jsval *vp) return false; } - JSFunction *fun = &args[0].toObject().as(); - JSString *str = fun->displayAtom(); + JSFunction* fun = &args[0].toObject().as(); + JSString* str = fun->displayAtom(); args.rval().setString(str ? str : cx->runtime()->emptyString); return true; } bool -js::testingFunc_inParallelSection(JSContext *cx, unsigned argc, jsval *vp) +js::testingFunc_inParallelSection(JSContext* cx, unsigned argc, jsval* vp) { CallArgs args = CallArgsFromVp(argc, vp); @@ -1074,7 +1074,7 @@ js::testingFunc_inParallelSection(JSContext *cx, unsigned argc, jsval *vp) } static bool -ShellObjectMetadataCallback(JSContext *cx, JSObject **pmetadata) +ShellObjectMetadataCallback(JSContext* cx, JSObject** pmetadata) { RootedObject obj(cx, NewBuiltinClassInstance(cx, &JSObject::class_)); if (!obj) @@ -1116,7 +1116,7 @@ ShellObjectMetadataCallback(JSContext *cx, JSObject **pmetadata) } static bool -SetObjectMetadataCallback(JSContext *cx, unsigned argc, jsval *vp) +SetObjectMetadataCallback(JSContext* cx, unsigned argc, jsval* vp) { CallArgs args = CallArgsFromVp(argc, vp); @@ -1128,7 +1128,7 @@ SetObjectMetadataCallback(JSContext *cx, unsigned argc, jsval *vp) } static bool -SetObjectMetadata(JSContext *cx, unsigned argc, jsval *vp) +SetObjectMetadata(JSContext* cx, unsigned argc, jsval* vp) { CallArgs args = CallArgsFromVp(argc, vp); if (args.length() != 2 || !args[0].isObject() || !args[1].isObject()) { @@ -1144,7 +1144,7 @@ SetObjectMetadata(JSContext *cx, unsigned argc, jsval *vp) } static bool -GetObjectMetadata(JSContext *cx, unsigned argc, jsval *vp) +GetObjectMetadata(JSContext* cx, unsigned argc, jsval* vp) { CallArgs args = CallArgsFromVp(argc, vp); if (args.length() != 1 || !args[0].isObject()) { @@ -1157,7 +1157,7 @@ GetObjectMetadata(JSContext *cx, unsigned argc, jsval *vp) } bool -js::testingFunc_bailout(JSContext *cx, unsigned argc, jsval *vp) +js::testingFunc_bailout(JSContext* cx, unsigned argc, jsval* vp) { CallArgs args = CallArgsFromVp(argc, vp); @@ -1167,7 +1167,7 @@ js::testingFunc_bailout(JSContext *cx, unsigned argc, jsval *vp) } bool -js::testingFunc_assertFloat32(JSContext *cx, unsigned argc, jsval *vp) +js::testingFunc_assertFloat32(JSContext* cx, unsigned argc, jsval* vp) { CallArgs args = CallArgsFromVp(argc, vp); @@ -1177,7 +1177,7 @@ js::testingFunc_assertFloat32(JSContext *cx, unsigned argc, jsval *vp) } static bool -SetJitCompilerOption(JSContext *cx, unsigned argc, jsval *vp) +SetJitCompilerOption(JSContext* cx, unsigned argc, jsval* vp) { CallArgs args = CallArgsFromVp(argc, vp); RootedObject callee(cx, &args.callee()); @@ -1197,7 +1197,7 @@ SetJitCompilerOption(JSContext *cx, unsigned argc, jsval *vp) return false; } - JSFlatString *strArg = JS_FlattenString(cx, args[0].toString()); + JSFlatString* strArg = JS_FlattenString(cx, args[0].toString()); #define JIT_COMPILER_MATCH(key, string) \ else if (JS_FlatStringEqualsAscii(strArg, string)) \ @@ -1224,7 +1224,7 @@ SetJitCompilerOption(JSContext *cx, unsigned argc, jsval *vp) } static bool -GetJitCompilerOptions(JSContext *cx, unsigned argc, jsval *vp) +GetJitCompilerOptions(JSContext* cx, unsigned argc, jsval* vp) { CallArgs args = CallArgsFromVp(argc, vp); RootedObject info(cx, JS_NewObject(cx, nullptr, JS::NullPtr(), JS::NullPtr())); @@ -1249,7 +1249,7 @@ GetJitCompilerOptions(JSContext *cx, unsigned argc, jsval *vp) } static bool -SetIonCheckGraphCoherency(JSContext *cx, unsigned argc, jsval *vp) +SetIonCheckGraphCoherency(JSContext* cx, unsigned argc, jsval* vp) { CallArgs args = CallArgsFromVp(argc, vp); #ifdef JS_ION @@ -1268,7 +1268,7 @@ class CloneBufferObject : public JSObject { public: static const Class class_; - static CloneBufferObject *Create(JSContext *cx) { + static CloneBufferObject* Create(JSContext* cx) { RootedObject obj(cx, JS_NewObject(cx, Jsvalify(&class_), JS::NullPtr(), JS::NullPtr())); if (!obj) return nullptr; @@ -1281,11 +1281,11 @@ class CloneBufferObject : public JSObject { return &obj->as(); } - static CloneBufferObject *Create(JSContext *cx, JSAutoStructuredCloneBuffer *buffer) { + static CloneBufferObject* Create(JSContext* cx, JSAutoStructuredCloneBuffer* buffer) { Rooted obj(cx, Create(cx)); if (!obj) return nullptr; - uint64_t *datap; + uint64_t* datap; size_t nbytes; buffer->steal(&datap, &nbytes); obj->setData(datap); @@ -1293,11 +1293,11 @@ class CloneBufferObject : public JSObject { return obj; } - uint64_t *data() const { + uint64_t* data() const { return static_cast(getReservedSlot(DATA_SLOT).toPrivate()); } - void setData(uint64_t *aData) { + void setData(uint64_t* aData) { JS_ASSERT(!data()); setReservedSlot(DATA_SLOT, PrivateValue(aData)); } @@ -1338,7 +1338,7 @@ class CloneBufferObject : public JSObject { Rooted obj(cx, &args.thisv().toObject().as()); obj->discard(); - char *str = JS_EncodeString(cx, args[0].toString()); + char* str = JS_EncodeString(cx, args[0].toString()); if (!str) return false; obj->setData(reinterpret_cast(str)); @@ -1378,7 +1378,7 @@ class CloneBufferObject : public JSObject { return false; } - JSString *str = JS_NewStringCopyN(cx, reinterpret_cast(obj->data()), obj->nbytes()); + JSString* str = JS_NewStringCopyN(cx, reinterpret_cast(obj->data()), obj->nbytes()); if (!str) return false; args.rval().setString(str); @@ -1391,7 +1391,7 @@ class CloneBufferObject : public JSObject { return CallNonGenericMethod(cx, args); } - static void Finalize(FreeOp *fop, JSObject *obj) { + static void Finalize(FreeOp* fop, JSObject* obj) { obj->as().discard(); } }; @@ -1421,7 +1421,7 @@ const JSPropertySpec CloneBufferObject::props_[] = { }; static bool -Serialize(JSContext *cx, unsigned argc, jsval *vp) +Serialize(JSContext* cx, unsigned argc, jsval* vp) { CallArgs args = CallArgsFromVp(argc, vp); @@ -1438,7 +1438,7 @@ Serialize(JSContext *cx, unsigned argc, jsval *vp) } static bool -Deserialize(JSContext *cx, unsigned argc, jsval *vp) +Deserialize(JSContext* cx, unsigned argc, jsval* vp) { CallArgs args = CallArgsFromVp(argc, vp); @@ -1479,7 +1479,7 @@ Deserialize(JSContext *cx, unsigned argc, jsval *vp) } static bool -Neuter(JSContext *cx, unsigned argc, jsval *vp) +Neuter(JSContext* cx, unsigned argc, jsval* vp) { CallArgs args = CallArgsFromVp(argc, vp); @@ -1521,7 +1521,7 @@ Neuter(JSContext *cx, unsigned argc, jsval *vp) } static bool -WorkerThreadCount(JSContext *cx, unsigned argc, jsval *vp) +WorkerThreadCount(JSContext* cx, unsigned argc, jsval* vp) { CallArgs args = CallArgsFromVp(argc, vp); #ifdef JS_THREADSAFE @@ -1533,7 +1533,7 @@ WorkerThreadCount(JSContext *cx, unsigned argc, jsval *vp) } static bool -TimesAccessed(JSContext *cx, unsigned argc, jsval *vp) +TimesAccessed(JSContext* cx, unsigned argc, jsval* vp) { static int32_t accessed = 0; CallArgs args = CallArgsFromVp(argc, vp); @@ -1542,20 +1542,20 @@ TimesAccessed(JSContext *cx, unsigned argc, jsval *vp) } static bool -EnableTraceLogger(JSContext *cx, unsigned argc, jsval *vp) +EnableTraceLogger(JSContext* cx, unsigned argc, jsval* vp) { CallArgs args = CallArgsFromVp(argc, vp); - TraceLogger *logger = TraceLoggerForMainThread(cx->runtime()); + TraceLogger* logger = TraceLoggerForMainThread(cx->runtime()); args.rval().setBoolean(TraceLoggerEnable(logger)); return true; } static bool -DisableTraceLogger(JSContext *cx, unsigned argc, jsval *vp) +DisableTraceLogger(JSContext* cx, unsigned argc, jsval* vp) { CallArgs args = CallArgsFromVp(argc, vp); - TraceLogger *logger = TraceLoggerForMainThread(cx->runtime()); + TraceLogger* logger = TraceLoggerForMainThread(cx->runtime()); args.rval().setBoolean(TraceLoggerDisable(logger)); return true; @@ -1826,7 +1826,7 @@ static const JSPropertySpec TestingProperties[] = { }; bool -js::DefineTestingFunctions(JSContext *cx, HandleObject obj, bool fuzzingSafe_) +js::DefineTestingFunctions(JSContext* cx, HandleObject obj, bool fuzzingSafe_) { fuzzingSafe = fuzzingSafe_; if (getenv("MOZ_FUZZING_SAFE") && getenv("MOZ_FUZZING_SAFE")[0] != '0') diff --git a/js/src/builtin/TestingFunctions.h b/js/src/builtin/TestingFunctions.h index acaf2c4856..35a02eabc7 100644 --- a/js/src/builtin/TestingFunctions.h +++ b/js/src/builtin/TestingFunctions.h @@ -12,16 +12,16 @@ namespace js { bool -DefineTestingFunctions(JSContext *cx, HandleObject obj, bool fuzzingSafe); +DefineTestingFunctions(JSContext* cx, HandleObject obj, bool fuzzingSafe); bool -testingFunc_inParallelSection(JSContext *cx, unsigned argc, Value *vp); +testingFunc_inParallelSection(JSContext* cx, unsigned argc, Value* vp); bool -testingFunc_bailout(JSContext *cx, unsigned argc, Value *vp); +testingFunc_bailout(JSContext* cx, unsigned argc, Value* vp); bool -testingFunc_assertFloat32(JSContext *cx, unsigned argc, Value *vp); +testingFunc_assertFloat32(JSContext* cx, unsigned argc, Value* vp); } /* namespace js */ diff --git a/js/src/builtin/TypedObject.cpp b/js/src/builtin/TypedObject.cpp index 0008582585..7ea2a67d02 100644 --- a/js/src/builtin/TypedObject.cpp +++ b/js/src/builtin/TypedObject.cpp @@ -51,7 +51,7 @@ static const JSFunctionSpec TypedObjectMethods[] = { }; static void -ReportCannotConvertTo(JSContext *cx, HandleValue fromValue, const char *toType) +ReportCannotConvertTo(JSContext* cx, HandleValue fromValue, const char* toType) { JS_ReportErrorNumber(cx, js_GetErrorMessage, nullptr, JSMSG_CANT_CONVERT_TO, InformalValueTypeName(fromValue), toType); @@ -111,7 +111,7 @@ static inline CheckedInt32 roundUpToAlignment(CheckedInt32 address, int32_t alig * type of `typedObj` but rather some subcomponent of `typedObj`. */ static bool -ConvertAndCopyTo(JSContext *cx, +ConvertAndCopyTo(JSContext* cx, HandleTypeDescr typeObj, HandleTypedObject typedObj, int32_t offset, @@ -136,7 +136,7 @@ ConvertAndCopyTo(JSContext *cx, } static bool -ConvertAndCopyTo(JSContext *cx, HandleTypedObject typedObj, HandleValue val) +ConvertAndCopyTo(JSContext* cx, HandleTypedObject typedObj, HandleValue val) { Rooted type(cx, &typedObj->typeDescr()); return ConvertAndCopyTo(cx, type, typedObj, 0, val); @@ -147,7 +147,7 @@ ConvertAndCopyTo(JSContext *cx, HandleTypedObject typedObj, HandleValue val) * converted to the type `typeObj` */ static bool -Reify(JSContext *cx, +Reify(JSContext* cx, HandleTypeDescr type, HandleTypedObject typedObj, size_t offset, @@ -175,8 +175,8 @@ Reify(JSContext *cx, // Extracts the `prototype` property from `obj`, throwing if it is // missing or not an object. -static JSObject * -GetPrototype(JSContext *cx, HandleObject obj) +static JSObject* +GetPrototype(JSContext* cx, HandleObject obj) { RootedValue prototypeVal(cx); if (!JSObject::getProperty(cx, obj, obj, cx->names().prototype, @@ -269,7 +269,7 @@ ScalarTypeDescr::alignment(Type t) return ScalarSizes[t]; } -/*static*/ const char * +/*static*/ const char* ScalarTypeDescr::typeName(Type type) { switch (type) { @@ -281,7 +281,7 @@ ScalarTypeDescr::typeName(Type type) } bool -ScalarTypeDescr::call(JSContext *cx, unsigned argc, Value *vp) +ScalarTypeDescr::call(JSContext* cx, unsigned argc, Value* vp) { CallArgs args = CallArgsFromVp(argc, vp); if (args.length() < 1) { @@ -290,7 +290,7 @@ ScalarTypeDescr::call(JSContext *cx, unsigned argc, Value *vp) return false; } - Rooted descr(cx, &args.callee().as()); + Rooted descr(cx, &args.callee().as()); ScalarTypeDescr::Type type = descr->type(); double number; @@ -368,7 +368,7 @@ ReferenceTypeDescr::alignment(Type t) return ReferenceSizes[t]; } -/*static*/ const char * +/*static*/ const char* ReferenceTypeDescr::typeName(Type type) { switch (type) { @@ -380,12 +380,12 @@ ReferenceTypeDescr::typeName(Type type) } bool -js::ReferenceTypeDescr::call(JSContext *cx, unsigned argc, Value *vp) +js::ReferenceTypeDescr::call(JSContext* cx, unsigned argc, Value* vp) { CallArgs args = CallArgsFromVp(argc, vp); JS_ASSERT(args.callee().is()); - Rooted descr(cx, &args.callee().as()); + Rooted descr(cx, &args.callee().as()); if (args.length() < 1) { JS_ReportErrorNumber(cx, js_GetErrorMessage, nullptr, @@ -485,8 +485,8 @@ X4TypeDescr::alignment(Type t) * TypedObject.StructType constructor function, then returns an empty * object with the .prototype.prototype object as its [[Prototype]]. */ -static TypedProto * -CreatePrototypeObjectForComplexTypeInstance(JSContext *cx, +static TypedProto* +CreatePrototypeObjectForComplexTypeInstance(JSContext* cx, Handle descr, HandleObject ctorPrototype) { @@ -575,7 +575,7 @@ const JSFunctionSpec ArrayMetaTypeDescr::typedObjectMethods[] = { }; bool -js::CreateUserSizeAndAlignmentProperties(JSContext *cx, HandleTypeDescr descr) +js::CreateUserSizeAndAlignmentProperties(JSContext* cx, HandleTypeDescr descr) { // If data is transparent, also store the public slots. if (descr->transparent() && descr->is()) { @@ -634,8 +634,8 @@ js::CreateUserSizeAndAlignmentProperties(JSContext *cx, HandleTypeDescr descr) } template -T * -ArrayMetaTypeDescr::create(JSContext *cx, +T* +ArrayMetaTypeDescr::create(JSContext* cx, HandleObject arrayTypePrototype, HandleSizedTypeDescr elementType, HandleAtom stringRepr, @@ -676,7 +676,7 @@ ArrayMetaTypeDescr::create(JSContext *cx, } bool -ArrayMetaTypeDescr::construct(JSContext *cx, unsigned argc, Value *vp) +ArrayMetaTypeDescr::construct(JSContext* cx, unsigned argc, Value* vp) { CallArgs args = CallArgsFromVp(argc, vp); @@ -718,7 +718,7 @@ ArrayMetaTypeDescr::construct(JSContext *cx, unsigned argc, Value *vp) return nullptr; // Create the instance of ArrayType - Rooted obj(cx); + Rooted obj(cx); obj = create(cx, arrayTypePrototype, elementType, stringRepr, 0); if (!obj) @@ -735,7 +735,7 @@ ArrayMetaTypeDescr::construct(JSContext *cx, unsigned argc, Value *vp) } /*static*/ bool -UnsizedArrayTypeDescr::dimension(JSContext *cx, unsigned int argc, jsval *vp) +UnsizedArrayTypeDescr::dimension(JSContext* cx, unsigned int argc, jsval* vp) { // Expect that the `this` pointer is an unsized array type // and the first argument is an integer size. @@ -808,7 +808,7 @@ UnsizedArrayTypeDescr::dimension(JSContext *cx, unsigned int argc, jsval *vp) } bool -js::IsTypedObjectArray(JSObject &obj) +js::IsTypedObjectArray(JSObject& obj) { if (!obj.is()) return false; @@ -857,8 +857,8 @@ const JSFunctionSpec StructMetaTypeDescr::typedObjectMethods[] = { JS_FS_END }; -JSObject * -StructMetaTypeDescr::create(JSContext *cx, +JSObject* +StructMetaTypeDescr::create(JSContext* cx, HandleObject metaTypeDescr, HandleObject fields) { @@ -1095,7 +1095,7 @@ StructMetaTypeDescr::create(JSContext *cx, } bool -StructMetaTypeDescr::construct(JSContext *cx, unsigned int argc, Value *vp) +StructMetaTypeDescr::construct(JSContext* cx, unsigned int argc, Value* vp) { CallArgs args = CallArgsFromVp(argc, vp); @@ -1127,12 +1127,12 @@ StructTypeDescr::fieldCount() } bool -StructTypeDescr::fieldIndex(jsid id, size_t *out) +StructTypeDescr::fieldIndex(jsid id, size_t* out) { - JSObject &fieldNames = getReservedSlot(JS_DESCR_SLOT_STRUCT_FIELD_NAMES).toObject(); + JSObject& fieldNames = getReservedSlot(JS_DESCR_SLOT_STRUCT_FIELD_NAMES).toObject(); size_t l = fieldNames.getDenseInitializedLength(); for (size_t i = 0; i < l; i++) { - JSAtom &a = fieldNames.getDenseElement(i).toString()->asAtom(); + JSAtom& a = fieldNames.getDenseElement(i).toString()->asAtom(); if (JSID_IS_ATOM(id, &a)) { *out = i; return true; @@ -1141,17 +1141,17 @@ StructTypeDescr::fieldIndex(jsid id, size_t *out) return false; } -JSAtom & +JSAtom& StructTypeDescr::fieldName(size_t index) { - JSObject &fieldNames = getReservedSlot(JS_DESCR_SLOT_STRUCT_FIELD_NAMES).toObject(); + JSObject& fieldNames = getReservedSlot(JS_DESCR_SLOT_STRUCT_FIELD_NAMES).toObject(); return fieldNames.getDenseElement(index).toString()->asAtom(); } int32_t StructTypeDescr::fieldOffset(size_t index) { - JSObject &fieldOffsets = + JSObject& fieldOffsets = getReservedSlot(JS_DESCR_SLOT_STRUCT_FIELD_OFFSETS).toObject(); JS_ASSERT(index < fieldOffsets.getDenseInitializedLength()); return fieldOffsets.getDenseElement(index).toInt32(); @@ -1160,7 +1160,7 @@ StructTypeDescr::fieldOffset(size_t index) SizedTypeDescr& StructTypeDescr::fieldDescr(size_t index) { - JSObject &fieldDescrs = + JSObject& fieldDescrs = getReservedSlot(JS_DESCR_SLOT_STRUCT_FIELD_TYPES).toObject(); JS_ASSERT(index < fieldDescrs.getDenseInitializedLength()); return fieldDescrs.getDenseElement(index).toObject().as(); @@ -1216,8 +1216,8 @@ StructTypeDescr::fieldDescr(size_t index) // Here `T` is either `ScalarTypeDescr` or `ReferenceTypeDescr` template static bool -DefineSimpleTypeDescr(JSContext *cx, - Handle global, +DefineSimpleTypeDescr(JSContext* cx, + Handle global, HandleObject module, typename T::Type type, HandlePropertyName className) @@ -1270,8 +1270,8 @@ DefineSimpleTypeDescr(JSContext *cx, /////////////////////////////////////////////////////////////////////////// template -static JSObject * -DefineMetaTypeDescr(JSContext *cx, +static JSObject* +DefineMetaTypeDescr(JSContext* cx, Handle global, HandleObject module, TypedObjectModuleObject::Slot protoSlot) @@ -1339,7 +1339,7 @@ DefineMetaTypeDescr(JSContext *cx, * `TypedObject` global (which is referred to as "module" herein). */ bool -GlobalObject::initTypedObjectModule(JSContext *cx, Handle global) +GlobalObject::initTypedObjectModule(JSContext* cx, Handle global) { RootedObject objProto(cx, global->getOrCreateObjectPrototype(cx)); if (!objProto) @@ -1413,16 +1413,16 @@ GlobalObject::initTypedObjectModule(JSContext *cx, Handle global) return module; } -JSObject * -js_InitTypedObjectModuleObject(JSContext *cx, HandleObject obj) +JSObject* +js_InitTypedObjectModuleObject(JSContext* cx, HandleObject obj) { JS_ASSERT(obj->is()); - Rooted global(cx, &obj->as()); + Rooted global(cx, &obj->as()); return global->getOrCreateTypedObjectModule(cx); } -JSObject * -js_InitTypedObjectDummy(JSContext *cx, HandleObject obj) +JSObject* +js_InitTypedObjectDummy(JSContext* cx, HandleObject obj) { /* * This function is entered into the jsprototypes.h table @@ -1437,8 +1437,8 @@ js_InitTypedObjectDummy(JSContext *cx, HandleObject obj) * Typed objects */ -/*static*/ TypedObject * -TypedObject::createUnattached(JSContext *cx, +/*static*/ TypedObject* +TypedObject::createUnattached(JSContext* cx, HandleTypeDescr descr, int32_t length) { @@ -1449,9 +1449,9 @@ TypedObject::createUnattached(JSContext *cx, } -/*static*/ TypedObject * -TypedObject::createUnattachedWithClass(JSContext *cx, - const Class *clasp, +/*static*/ TypedObject* +TypedObject::createUnattachedWithClass(JSContext* cx, + const Class* clasp, HandleTypeDescr type, int32_t length) { @@ -1500,7 +1500,7 @@ TypedObject::createUnattachedWithClass(JSContext *cx, } void -TypedObject::attach(ArrayBufferObject &buffer, int32_t offset) +TypedObject::attach(ArrayBufferObject& buffer, int32_t offset) { JS_ASSERT(offset >= 0); JS_ASSERT((size_t) (offset + size()) <= buffer.byteLength()); @@ -1512,7 +1512,7 @@ TypedObject::attach(ArrayBufferObject &buffer, int32_t offset) } void -TypedObject::attach(TypedObject &typedObj, int32_t offset) +TypedObject::attach(TypedObject& typedObj, int32_t offset) { JS_ASSERT(!typedObj.owner().isNeutered()); JS_ASSERT(typedObj.typedMem() != NULL); @@ -1523,7 +1523,7 @@ TypedObject::attach(TypedObject &typedObj, int32_t offset) // Returns a suitable JS_TYPEDOBJ_SLOT_LENGTH value for an instance of // the type `type`. `type` must not be an unsized array. static int32_t -TypedObjLengthFromType(TypeDescr &descr) +TypedObjLengthFromType(TypeDescr& descr) { switch (descr.kind()) { case TypeDescr::Scalar: @@ -1541,8 +1541,8 @@ TypedObjLengthFromType(TypeDescr &descr) MOZ_ASSUME_UNREACHABLE("Invalid kind"); } -/*static*/ TypedObject * -TypedObject::createDerived(JSContext *cx, HandleSizedTypeDescr type, +/*static*/ TypedObject* +TypedObject::createDerived(JSContext* cx, HandleSizedTypeDescr type, HandleTypedObject typedObj, int32_t offset) { JS_ASSERT(!typedObj->owner().isNeutered()); @@ -1552,7 +1552,7 @@ TypedObject::createDerived(JSContext *cx, HandleSizedTypeDescr type, int32_t length = TypedObjLengthFromType(*type); - const js::Class *clasp = typedObj->getClass(); + const js::Class* clasp = typedObj->getClass(); Rooted obj(cx); obj = createUnattachedWithClass(cx, clasp, type, length); if (!obj) @@ -1562,8 +1562,8 @@ TypedObject::createDerived(JSContext *cx, HandleSizedTypeDescr type, return obj; } -/*static*/ TypedObject * -TypedObject::createZeroed(JSContext *cx, +/*static*/ TypedObject* +TypedObject::createZeroed(JSContext* cx, HandleTypeDescr descr, int32_t length) { @@ -1619,24 +1619,24 @@ TypedObject::createZeroed(JSContext *cx, } static bool -ReportTypedObjTypeError(JSContext *cx, +ReportTypedObjTypeError(JSContext* cx, const unsigned errorNumber, HandleTypedObject obj) { // Serialize type string of obj - char *typeReprStr = JS_EncodeString(cx, &obj->typeDescr().stringRepr()); + char* typeReprStr = JS_EncodeString(cx, &obj->typeDescr().stringRepr()); if (!typeReprStr) return false; JS_ReportErrorNumber(cx, js_GetErrorMessage, nullptr, errorNumber, typeReprStr); - JS_free(cx, (void *) typeReprStr); + JS_free(cx, (void*) typeReprStr); return false; } /*static*/ void -TypedObject::obj_trace(JSTracer *trace, JSObject *object) +TypedObject::obj_trace(JSTracer* trace, JSObject* object) { gc::MarkSlot(trace, &object->getReservedSlotRef(JS_TYPEDOBJ_SLOT_TYPE_DESCR), "TypedObjectTypeDescr"); @@ -1644,10 +1644,10 @@ TypedObject::obj_trace(JSTracer *trace, JSObject *object) ArrayBufferViewObject::trace(trace, object); JS_ASSERT(object->is()); - TypedObject &typedObj = object->as(); - TypeDescr &descr = typedObj.typeDescr(); + TypedObject& typedObj = object->as(); + TypeDescr& descr = typedObj.typeDescr(); if (descr.opaque()) { - uint8_t *mem = typedObj.typedMem(); + uint8_t* mem = typedObj.typedMem(); if (!mem) return; // partially constructed @@ -1671,7 +1671,7 @@ TypedObject::obj_trace(JSTracer *trace, JSObject *object) } bool -TypedObject::obj_lookupGeneric(JSContext *cx, HandleObject obj, HandleId id, +TypedObject::obj_lookupGeneric(JSContext* cx, HandleObject obj, HandleId id, MutableHandleObject objp, MutableHandleShape propp) { JS_ASSERT(obj->is()); @@ -1700,7 +1700,7 @@ TypedObject::obj_lookupGeneric(JSContext *cx, HandleObject obj, HandleId id, case TypeDescr::Struct: { - StructTypeDescr &structDescr = descr->as(); + StructTypeDescr& structDescr = descr->as(); size_t index; if (structDescr.fieldIndex(id, &index)) { MarkNonNativePropertyFound(propp); @@ -1722,7 +1722,7 @@ TypedObject::obj_lookupGeneric(JSContext *cx, HandleObject obj, HandleId id, } bool -TypedObject::obj_lookupProperty(JSContext *cx, +TypedObject::obj_lookupProperty(JSContext* cx, HandleObject obj, HandlePropertyName name, MutableHandleObject objp, @@ -1733,7 +1733,7 @@ TypedObject::obj_lookupProperty(JSContext *cx, } bool -TypedObject::obj_lookupElement(JSContext *cx, HandleObject obj, uint32_t index, +TypedObject::obj_lookupElement(JSContext* cx, HandleObject obj, uint32_t index, MutableHandleObject objp, MutableHandleShape propp) { JS_ASSERT(obj->is()); @@ -1743,7 +1743,7 @@ TypedObject::obj_lookupElement(JSContext *cx, HandleObject obj, uint32_t index, } static bool -ReportPropertyError(JSContext *cx, +ReportPropertyError(JSContext* cx, const unsigned errorNumber, HandleId id) { @@ -1751,7 +1751,7 @@ ReportPropertyError(JSContext *cx, if (!str) return false; - char *propName = JS_EncodeString(cx, str); + char* propName = JS_EncodeString(cx, str); if (!propName) return false; @@ -1763,14 +1763,14 @@ ReportPropertyError(JSContext *cx, } bool -TypedObject::obj_defineGeneric(JSContext *cx, HandleObject obj, HandleId id, HandleValue v, +TypedObject::obj_defineGeneric(JSContext* cx, HandleObject obj, HandleId id, HandleValue v, PropertyOp getter, StrictPropertyOp setter, unsigned attrs) { return ReportPropertyError(cx, JSMSG_UNDEFINED_PROP, id); } bool -TypedObject::obj_defineProperty(JSContext *cx, HandleObject obj, +TypedObject::obj_defineProperty(JSContext* cx, HandleObject obj, HandlePropertyName name, HandleValue v, PropertyOp getter, StrictPropertyOp setter, unsigned attrs) { @@ -1779,7 +1779,7 @@ TypedObject::obj_defineProperty(JSContext *cx, HandleObject obj, } bool -TypedObject::obj_defineElement(JSContext *cx, HandleObject obj, uint32_t index, HandleValue v, +TypedObject::obj_defineElement(JSContext* cx, HandleObject obj, uint32_t index, HandleValue v, PropertyOp getter, StrictPropertyOp setter, unsigned attrs) { AutoRooterGetterSetter gsRoot(cx, attrs, &getter, &setter); @@ -1790,11 +1790,11 @@ TypedObject::obj_defineElement(JSContext *cx, HandleObject obj, uint32_t index, } bool -TypedObject::obj_getGeneric(JSContext *cx, HandleObject obj, HandleObject receiver, +TypedObject::obj_getGeneric(JSContext* cx, HandleObject obj, HandleObject receiver, HandleId id, MutableHandleValue vp) { JS_ASSERT(obj->is()); - Rooted typedObj(cx, &obj->as()); + Rooted typedObj(cx, &obj->as()); // Dispatch elements to obj_getElement: uint32_t index; @@ -1849,7 +1849,7 @@ TypedObject::obj_getGeneric(JSContext *cx, HandleObject obj, HandleObject receiv } bool -TypedObject::obj_getProperty(JSContext *cx, HandleObject obj, HandleObject receiver, +TypedObject::obj_getProperty(JSContext* cx, HandleObject obj, HandleObject receiver, HandlePropertyName name, MutableHandleValue vp) { RootedId id(cx, NameToId(name)); @@ -1857,12 +1857,12 @@ TypedObject::obj_getProperty(JSContext *cx, HandleObject obj, HandleObject recei } bool -TypedObject::obj_getElement(JSContext *cx, HandleObject obj, HandleObject receiver, +TypedObject::obj_getElement(JSContext* cx, HandleObject obj, HandleObject receiver, uint32_t index, MutableHandleValue vp) { JS_ASSERT(obj->is()); - Rooted typedObj(cx, &obj->as()); - Rooted descr(cx, &typedObj->typeDescr()); + Rooted typedObj(cx, &obj->as()); + Rooted descr(cx, &typedObj->typeDescr()); switch (descr->kind()) { case TypeDescr::Scalar: @@ -1891,7 +1891,7 @@ TypedObject::obj_getElement(JSContext *cx, HandleObject obj, HandleObject receiv template /*static*/ bool -TypedObject::obj_getArrayElement(JSContext *cx, +TypedObject::obj_getArrayElement(JSContext* cx, Handle typedObj, Handle typeDescr, uint32_t index, @@ -1910,11 +1910,11 @@ TypedObject::obj_getArrayElement(JSContext *cx, } bool -TypedObject::obj_setGeneric(JSContext *cx, HandleObject obj, HandleId id, +TypedObject::obj_setGeneric(JSContext* cx, HandleObject obj, HandleId id, MutableHandleValue vp, bool strict) { JS_ASSERT(obj->is()); - Rooted typedObj(cx, &obj->as()); + Rooted typedObj(cx, &obj->as()); uint32_t index; if (js_IdIsIndex(id, &index)) @@ -1954,7 +1954,7 @@ TypedObject::obj_setGeneric(JSContext *cx, HandleObject obj, HandleId id, } bool -TypedObject::obj_setProperty(JSContext *cx, HandleObject obj, +TypedObject::obj_setProperty(JSContext* cx, HandleObject obj, HandlePropertyName name, MutableHandleValue vp, bool strict) { @@ -1963,12 +1963,12 @@ TypedObject::obj_setProperty(JSContext *cx, HandleObject obj, } bool -TypedObject::obj_setElement(JSContext *cx, HandleObject obj, uint32_t index, +TypedObject::obj_setElement(JSContext* cx, HandleObject obj, uint32_t index, MutableHandleValue vp, bool strict) { JS_ASSERT(obj->is()); - Rooted typedObj(cx, &obj->as()); - Rooted descr(cx, &typedObj->typeDescr()); + Rooted typedObj(cx, &obj->as()); + Rooted descr(cx, &typedObj->typeDescr()); switch (descr->kind()) { case TypeDescr::Scalar: @@ -1989,7 +1989,7 @@ TypedObject::obj_setElement(JSContext *cx, HandleObject obj, uint32_t index, template /*static*/ bool -TypedObject::obj_setArrayElement(JSContext *cx, +TypedObject::obj_setArrayElement(JSContext* cx, Handle typedObj, Handle descr, uint32_t index, @@ -2010,11 +2010,11 @@ TypedObject::obj_setArrayElement(JSContext *cx, } bool -TypedObject::obj_getGenericAttributes(JSContext *cx, HandleObject obj, - HandleId id, unsigned *attrsp) +TypedObject::obj_getGenericAttributes(JSContext* cx, HandleObject obj, + HandleId id, unsigned* attrsp) { uint32_t index; - Rooted typedObj(cx, &obj->as()); + Rooted typedObj(cx, &obj->as()); switch (typedObj->typeDescr().kind()) { case TypeDescr::Scalar: case TypeDescr::Reference: @@ -2054,10 +2054,10 @@ TypedObject::obj_getGenericAttributes(JSContext *cx, HandleObject obj, } static bool -IsOwnId(JSContext *cx, HandleObject obj, HandleId id) +IsOwnId(JSContext* cx, HandleObject obj, HandleId id) { uint32_t index; - Rooted typedObj(cx, &obj->as()); + Rooted typedObj(cx, &obj->as()); switch (typedObj->typeDescr().kind()) { case TypeDescr::Scalar: case TypeDescr::Reference: @@ -2078,8 +2078,8 @@ IsOwnId(JSContext *cx, HandleObject obj, HandleId id) } bool -TypedObject::obj_setGenericAttributes(JSContext *cx, HandleObject obj, - HandleId id, unsigned *attrsp) +TypedObject::obj_setGenericAttributes(JSContext* cx, HandleObject obj, + HandleId id, unsigned* attrsp) { if (IsOwnId(cx, obj, id)) return ReportPropertyError(cx, JSMSG_CANT_REDEFINE_PROP, id); @@ -2094,8 +2094,8 @@ TypedObject::obj_setGenericAttributes(JSContext *cx, HandleObject obj, } bool -TypedObject::obj_deleteProperty(JSContext *cx, HandleObject obj, - HandlePropertyName name, bool *succeeded) +TypedObject::obj_deleteProperty(JSContext* cx, HandleObject obj, + HandlePropertyName name, bool* succeeded) { Rooted id(cx, NameToId(name)); if (IsOwnId(cx, obj, id)) @@ -2111,8 +2111,8 @@ TypedObject::obj_deleteProperty(JSContext *cx, HandleObject obj, } bool -TypedObject::obj_deleteElement(JSContext *cx, HandleObject obj, uint32_t index, - bool *succeeded) +TypedObject::obj_deleteElement(JSContext* cx, HandleObject obj, uint32_t index, + bool* succeeded) { RootedId id(cx); if (!IndexToId(cx, index, &id)) @@ -2131,14 +2131,14 @@ TypedObject::obj_deleteElement(JSContext *cx, HandleObject obj, uint32_t index, } bool -TypedObject::obj_enumerate(JSContext *cx, HandleObject obj, JSIterateOp enum_op, +TypedObject::obj_enumerate(JSContext* cx, HandleObject obj, JSIterateOp enum_op, MutableHandleValue statep, MutableHandleId idp) { int32_t index; JS_ASSERT(obj->is()); - Rooted typedObj(cx, &obj->as()); - Rooted descr(cx, &typedObj->typeDescr()); + Rooted typedObj(cx, &obj->as()); + Rooted descr(cx, &typedObj->typeDescr()); switch (descr->kind()) { case TypeDescr::Scalar: case TypeDescr::Reference: @@ -2234,7 +2234,7 @@ TypedObject::offsetOfByteOffsetSlot() } void -TypedObject::neuter(void *newData) +TypedObject::neuter(void* newData) { setSlot(JS_TYPEDOBJ_SLOT_LENGTH, Int32Value(0)); setSlot(JS_TYPEDOBJ_SLOT_BYTELENGTH, Int32Value(0)); @@ -2291,7 +2291,7 @@ const Class TransparentTypedObject::class_ = { }; static int32_t -LengthForType(TypeDescr &descr) +LengthForType(TypeDescr& descr) { switch (descr.kind()) { case TypeDescr::Scalar: @@ -2339,7 +2339,7 @@ CheckOffset(int32_t offset, } /*static*/ bool -TypedObject::constructSized(JSContext *cx, unsigned int argc, Value *vp) +TypedObject::constructSized(JSContext* cx, unsigned int argc, Value* vp) { CallArgs args = CallArgsFromVp(argc, vp); @@ -2433,7 +2433,7 @@ TypedObject::constructSized(JSContext *cx, unsigned int argc, Value *vp) } /*static*/ bool -TypedObject::constructUnsized(JSContext *cx, unsigned int argc, Value *vp) +TypedObject::constructUnsized(JSContext* cx, unsigned int argc, Value* vp) { CallArgs args = CallArgsFromVp(argc, vp); @@ -2649,7 +2649,7 @@ const JSFunctionSpec OpaqueTypedObject::handleStaticMethods[] = { */ bool -js::NewOpaqueTypedObject(JSContext *cx, unsigned argc, Value *vp) +js::NewOpaqueTypedObject(JSContext* cx, unsigned argc, Value* vp) { CallArgs args = CallArgsFromVp(argc, vp); JS_ASSERT(args.length() == 1); @@ -2666,7 +2666,7 @@ js::NewOpaqueTypedObject(JSContext *cx, unsigned argc, Value *vp) } bool -js::NewDerivedTypedObject(JSContext *cx, unsigned argc, Value *vp) +js::NewDerivedTypedObject(JSContext* cx, unsigned argc, Value* vp) { CallArgs args = CallArgsFromVp(argc, vp); JS_ASSERT(args.length() == 3); @@ -2688,7 +2688,7 @@ js::NewDerivedTypedObject(JSContext *cx, unsigned argc, Value *vp) } bool -js::AttachTypedObject(ThreadSafeContext *, unsigned argc, Value *vp) +js::AttachTypedObject(ThreadSafeContext*, unsigned argc, Value* vp) { CallArgs args = CallArgsFromVp(argc, vp); JS_ASSERT(args.length() == 3); @@ -2696,8 +2696,8 @@ js::AttachTypedObject(ThreadSafeContext *, unsigned argc, Value *vp) JS_ASSERT(args[1].isObject() && args[1].toObject().is()); JS_ASSERT(args[2].isInt32()); - TypedObject &handle = args[0].toObject().as(); - TypedObject &target = args[1].toObject().as(); + TypedObject& handle = args[0].toObject().as(); + TypedObject& target = args[1].toObject().as(); JS_ASSERT(handle.typedMem() == nullptr); // must not be attached already size_t offset = args[2].toInt32(); handle.attach(target, offset); @@ -2709,14 +2709,14 @@ JS_JITINFO_NATIVE_PARALLEL_THREADSAFE(js::AttachTypedObjectJitInfo, js::AttachTypedObject); bool -js::SetTypedObjectOffset(ThreadSafeContext *, unsigned argc, Value *vp) +js::SetTypedObjectOffset(ThreadSafeContext*, unsigned argc, Value* vp) { CallArgs args = CallArgsFromVp(argc, vp); JS_ASSERT(args.length() == 2); JS_ASSERT(args[0].isObject() && args[0].toObject().is()); JS_ASSERT(args[1].isInt32()); - TypedObject &typedObj = args[0].toObject().as(); + TypedObject& typedObj = args[0].toObject().as(); int32_t offset = args[1].toInt32(); JS_ASSERT(!typedObj.owner().isNeutered()); @@ -2729,7 +2729,7 @@ js::SetTypedObjectOffset(ThreadSafeContext *, unsigned argc, Value *vp) } bool -js::intrinsic_SetTypedObjectOffset(JSContext *cx, unsigned argc, Value *vp) +js::intrinsic_SetTypedObjectOffset(JSContext* cx, unsigned argc, Value* vp) { // Do not use JSNativeThreadSafeWrapper<> so that ion can reference // this function more easily when inlining. @@ -2741,7 +2741,7 @@ JS_JITINFO_NATIVE_PARALLEL_THREADSAFE(js::intrinsic_SetTypedObjectOffsetJitInfo, SetTypedObjectOffset); bool -js::ObjectIsTypeDescr(ThreadSafeContext *, unsigned argc, Value *vp) +js::ObjectIsTypeDescr(ThreadSafeContext*, unsigned argc, Value* vp) { CallArgs args = CallArgsFromVp(argc, vp); JS_ASSERT(args.length() == 1); @@ -2754,7 +2754,7 @@ JS_JITINFO_NATIVE_PARALLEL_THREADSAFE(js::ObjectIsTypeDescrJitInfo, ObjectIsType js::ObjectIsTypeDescr); bool -js::ObjectIsTypedObject(ThreadSafeContext *, unsigned argc, Value *vp) +js::ObjectIsTypedObject(ThreadSafeContext*, unsigned argc, Value* vp) { CallArgs args = CallArgsFromVp(argc, vp); JS_ASSERT(args.length() == 1); @@ -2768,7 +2768,7 @@ JS_JITINFO_NATIVE_PARALLEL_THREADSAFE(js::ObjectIsTypedObjectJitInfo, js::ObjectIsTypedObject); bool -js::ObjectIsOpaqueTypedObject(ThreadSafeContext *, unsigned argc, Value *vp) +js::ObjectIsOpaqueTypedObject(ThreadSafeContext*, unsigned argc, Value* vp) { CallArgs args = CallArgsFromVp(argc, vp); JS_ASSERT(args.length() == 1); @@ -2782,7 +2782,7 @@ JS_JITINFO_NATIVE_PARALLEL_THREADSAFE(js::ObjectIsOpaqueTypedObjectJitInfo, js::ObjectIsOpaqueTypedObject); bool -js::ObjectIsTransparentTypedObject(ThreadSafeContext *, unsigned argc, Value *vp) +js::ObjectIsTransparentTypedObject(ThreadSafeContext*, unsigned argc, Value* vp) { CallArgs args = CallArgsFromVp(argc, vp); JS_ASSERT(args.length() == 1); @@ -2796,7 +2796,7 @@ JS_JITINFO_NATIVE_PARALLEL_THREADSAFE(js::ObjectIsTransparentTypedObjectJitInfo, js::ObjectIsTransparentTypedObject); bool -js::TypeDescrIsSimpleType(ThreadSafeContext *, unsigned argc, Value *vp) +js::TypeDescrIsSimpleType(ThreadSafeContext*, unsigned argc, Value* vp) { CallArgs args = CallArgsFromVp(argc, vp); JS_ASSERT(args.length() == 1); @@ -2811,7 +2811,7 @@ JS_JITINFO_NATIVE_PARALLEL_THREADSAFE(js::TypeDescrIsSimpleTypeJitInfo, js::TypeDescrIsSimpleType); bool -js::TypeDescrIsArrayType(ThreadSafeContext *, unsigned argc, Value *vp) +js::TypeDescrIsArrayType(ThreadSafeContext*, unsigned argc, Value* vp) { CallArgs args = CallArgsFromVp(argc, vp); JS_ASSERT(args.length() == 1); @@ -2828,7 +2828,7 @@ JS_JITINFO_NATIVE_PARALLEL_THREADSAFE(js::TypeDescrIsArrayTypeJitInfo, js::TypeDescrIsArrayType); bool -js::TypeDescrIsSizedArrayType(ThreadSafeContext *, unsigned argc, Value *vp) +js::TypeDescrIsSizedArrayType(ThreadSafeContext*, unsigned argc, Value* vp) { CallArgs args = CallArgsFromVp(argc, vp); JS_ASSERT(args.length() == 1); @@ -2843,7 +2843,7 @@ JS_JITINFO_NATIVE_PARALLEL_THREADSAFE(js::TypeDescrIsSizedArrayTypeJitInfo, js::TypeDescrIsSizedArrayType); bool -js::TypeDescrIsUnsizedArrayType(ThreadSafeContext *, unsigned argc, Value *vp) +js::TypeDescrIsUnsizedArrayType(ThreadSafeContext*, unsigned argc, Value* vp) { CallArgs args = CallArgsFromVp(argc, vp); JS_ASSERT(args.length() == 1); @@ -2858,11 +2858,11 @@ JS_JITINFO_NATIVE_PARALLEL_THREADSAFE(js::TypeDescrIsUnsizedArrayTypeJitInfo, js::TypeDescrIsUnsizedArrayType); bool -js::TypedObjectIsAttached(ThreadSafeContext *cx, unsigned argc, Value *vp) +js::TypedObjectIsAttached(ThreadSafeContext* cx, unsigned argc, Value* vp) { CallArgs args = CallArgsFromVp(argc, vp); JS_ASSERT(args[0].isObject() && args[0].toObject().is()); - TypedObject &typedObj = args[0].toObject().as(); + TypedObject& typedObj = args[0].toObject().as(); args.rval().setBoolean(!typedObj.owner().isNeutered() && typedObj.typedMem() != nullptr); return true; } @@ -2872,7 +2872,7 @@ JS_JITINFO_NATIVE_PARALLEL_THREADSAFE(js::TypedObjectIsAttachedJitInfo, js::TypedObjectIsAttached); bool -js::ClampToUint8(ThreadSafeContext *, unsigned argc, Value *vp) +js::ClampToUint8(ThreadSafeContext*, unsigned argc, Value* vp) { CallArgs args = CallArgsFromVp(argc, vp); JS_ASSERT(args.length() == 1); @@ -2885,7 +2885,7 @@ JS_JITINFO_NATIVE_PARALLEL_THREADSAFE(js::ClampToUint8JitInfo, ClampToUint8JitIn js::ClampToUint8); bool -js::Memcpy(ThreadSafeContext *, unsigned argc, Value *vp) +js::Memcpy(ThreadSafeContext*, unsigned argc, Value* vp) { CallArgs args = CallArgsFromVp(argc, vp); JS_ASSERT(args.length() == 5); @@ -2895,9 +2895,9 @@ js::Memcpy(ThreadSafeContext *, unsigned argc, Value *vp) JS_ASSERT(args[3].isInt32()); JS_ASSERT(args[4].isInt32()); - TypedObject &targetTypedObj = args[0].toObject().as(); + TypedObject& targetTypedObj = args[0].toObject().as(); int32_t targetOffset = args[1].toInt32(); - TypedObject &sourceTypedObj = args[2].toObject().as(); + TypedObject& sourceTypedObj = args[2].toObject().as(); int32_t sourceOffset = args[3].toInt32(); int32_t size = args[4].toInt32(); @@ -2907,8 +2907,8 @@ js::Memcpy(ThreadSafeContext *, unsigned argc, Value *vp) JS_ASSERT(size + targetOffset <= targetTypedObj.size()); JS_ASSERT(size + sourceOffset <= sourceTypedObj.size()); - uint8_t *target = targetTypedObj.typedMem(targetOffset); - uint8_t *source = sourceTypedObj.typedMem(sourceOffset); + uint8_t* target = targetTypedObj.typedMem(targetOffset); + uint8_t* source = sourceTypedObj.typedMem(sourceOffset); memcpy(target, source, size); args.rval().setUndefined(); return true; @@ -2917,7 +2917,7 @@ js::Memcpy(ThreadSafeContext *, unsigned argc, Value *vp) JS_JITINFO_NATIVE_PARALLEL_THREADSAFE(js::MemcpyJitInfo, MemcpyJitInfo, js::Memcpy); bool -js::GetTypedObjectModule(JSContext *cx, unsigned argc, Value *vp) +js::GetTypedObjectModule(JSContext* cx, unsigned argc, Value* vp) { CallArgs args = CallArgsFromVp(argc, vp); Rooted global(cx, cx->global()); @@ -2927,7 +2927,7 @@ js::GetTypedObjectModule(JSContext *cx, unsigned argc, Value *vp) } bool -js::GetFloat32x4TypeDescr(JSContext *cx, unsigned argc, Value *vp) +js::GetFloat32x4TypeDescr(JSContext* cx, unsigned argc, Value* vp) { CallArgs args = CallArgsFromVp(argc, vp); Rooted global(cx, cx->global()); @@ -2937,7 +2937,7 @@ js::GetFloat32x4TypeDescr(JSContext *cx, unsigned argc, Value *vp) } bool -js::GetInt32x4TypeDescr(JSContext *cx, unsigned argc, Value *vp) +js::GetInt32x4TypeDescr(JSContext* cx, unsigned argc, Value* vp) { CallArgs args = CallArgsFromVp(argc, vp); Rooted global(cx, cx->global()); @@ -2948,7 +2948,7 @@ js::GetInt32x4TypeDescr(JSContext *cx, unsigned argc, Value *vp) #define JS_STORE_SCALAR_CLASS_IMPL(_constant, T, _name) \ bool \ -js::StoreScalar##T::Func(ThreadSafeContext *, unsigned argc, Value *vp) \ +js::StoreScalar##T::Func(ThreadSafeContext*, unsigned argc, Value* vp) \ { \ CallArgs args = CallArgsFromVp(argc, vp); \ JS_ASSERT(args.length() == 3); \ @@ -2956,13 +2956,13 @@ js::StoreScalar##T::Func(ThreadSafeContext *, unsigned argc, Value *vp) JS_ASSERT(args[1].isInt32()); \ JS_ASSERT(args[2].isNumber()); \ \ - TypedObject &typedObj = args[0].toObject().as(); \ + TypedObject& typedObj = args[0].toObject().as(); \ int32_t offset = args[1].toInt32(); \ \ /* Should be guaranteed by the typed objects API: */ \ JS_ASSERT(offset % MOZ_ALIGNOF(T) == 0); \ \ - T *target = reinterpret_cast(typedObj.typedMem(offset)); \ + T* target = reinterpret_cast(typedObj.typedMem(offset)); \ double d = args[2].toNumber(); \ *target = ConvertScalar(d); \ args.rval().setUndefined(); \ @@ -2975,20 +2975,20 @@ JS_JITINFO_NATIVE_PARALLEL_THREADSAFE(js::StoreScalar##T::JitInfo, #define JS_STORE_REFERENCE_CLASS_IMPL(_constant, T, _name) \ bool \ -js::StoreReference##T::Func(ThreadSafeContext *, unsigned argc, Value *vp) \ +js::StoreReference##T::Func(ThreadSafeContext*, unsigned argc, Value* vp) \ { \ CallArgs args = CallArgsFromVp(argc, vp); \ JS_ASSERT(args.length() == 3); \ JS_ASSERT(args[0].isObject() && args[0].toObject().is()); \ JS_ASSERT(args[1].isInt32()); \ \ - TypedObject &typedObj = args[0].toObject().as(); \ + TypedObject& typedObj = args[0].toObject().as(); \ int32_t offset = args[1].toInt32(); \ \ /* Should be guaranteed by the typed objects API: */ \ JS_ASSERT(offset % MOZ_ALIGNOF(T) == 0); \ \ - T *target = reinterpret_cast(typedObj.typedMem(offset)); \ + T* target = reinterpret_cast(typedObj.typedMem(offset)); \ store(target, args[2]); \ args.rval().setUndefined(); \ return true; \ @@ -3000,20 +3000,20 @@ JS_JITINFO_NATIVE_PARALLEL_THREADSAFE(js::StoreReference##T::JitInfo, #define JS_LOAD_SCALAR_CLASS_IMPL(_constant, T, _name) \ bool \ -js::LoadScalar##T::Func(ThreadSafeContext *, unsigned argc, Value *vp) \ +js::LoadScalar##T::Func(ThreadSafeContext*, unsigned argc, Value* vp) \ { \ CallArgs args = CallArgsFromVp(argc, vp); \ JS_ASSERT(args.length() == 2); \ JS_ASSERT(args[0].isObject() && args[0].toObject().is()); \ JS_ASSERT(args[1].isInt32()); \ \ - TypedObject &typedObj = args[0].toObject().as(); \ + TypedObject& typedObj = args[0].toObject().as(); \ int32_t offset = args[1].toInt32(); \ \ /* Should be guaranteed by the typed objects API: */ \ JS_ASSERT(offset % MOZ_ALIGNOF(T) == 0); \ \ - T *target = reinterpret_cast(typedObj.typedMem(offset)); \ + T* target = reinterpret_cast(typedObj.typedMem(offset)); \ args.rval().setNumber((double) *target); \ return true; \ } \ @@ -3023,20 +3023,20 @@ JS_JITINFO_NATIVE_PARALLEL_THREADSAFE(js::LoadScalar##T::JitInfo, LoadScalar##T, #define JS_LOAD_REFERENCE_CLASS_IMPL(_constant, T, _name) \ bool \ -js::LoadReference##T::Func(ThreadSafeContext *, unsigned argc, Value *vp) \ +js::LoadReference##T::Func(ThreadSafeContext*, unsigned argc, Value* vp) \ { \ CallArgs args = CallArgsFromVp(argc, vp); \ JS_ASSERT(args.length() == 2); \ JS_ASSERT(args[0].isObject() && args[0].toObject().is()); \ JS_ASSERT(args[1].isInt32()); \ \ - TypedObject &typedObj = args[0].toObject().as(); \ + TypedObject& typedObj = args[0].toObject().as(); \ int32_t offset = args[1].toInt32(); \ \ /* Should be guaranteed by the typed objects API: */ \ JS_ASSERT(offset % MOZ_ALIGNOF(T) == 0); \ \ - T *target = reinterpret_cast(typedObj.typedMem(offset)); \ + T* target = reinterpret_cast(typedObj.typedMem(offset)); \ load(target, args.rval()); \ return true; \ } \ @@ -3050,34 +3050,34 @@ JS_JITINFO_NATIVE_PARALLEL_THREADSAFE(js::LoadReference##T::JitInfo, // private methods `store()` and `load()`. void -StoreReferenceHeapValue::store(HeapValue *heap, const Value &v) +StoreReferenceHeapValue::store(HeapValue* heap, const Value& v) { *heap = v; } void -StoreReferenceHeapPtrObject::store(HeapPtrObject *heap, const Value &v) +StoreReferenceHeapPtrObject::store(HeapPtrObject* heap, const Value& v) { JS_ASSERT(v.isObjectOrNull()); // or else Store_object is being misused *heap = v.toObjectOrNull(); } void -StoreReferenceHeapPtrString::store(HeapPtrString *heap, const Value &v) +StoreReferenceHeapPtrString::store(HeapPtrString* heap, const Value& v) { JS_ASSERT(v.isString()); // or else Store_string is being misused *heap = v.toString(); } void -LoadReferenceHeapValue::load(HeapValue *heap, +LoadReferenceHeapValue::load(HeapValue* heap, MutableHandleValue v) { v.set(*heap); } void -LoadReferenceHeapPtrObject::load(HeapPtrObject *heap, +LoadReferenceHeapPtrObject::load(HeapPtrObject* heap, MutableHandleValue v) { if (*heap) @@ -3087,7 +3087,7 @@ LoadReferenceHeapPtrObject::load(HeapPtrObject *heap, } void -LoadReferenceHeapPtrString::load(HeapPtrString *heap, +LoadReferenceHeapPtrString::load(HeapPtrString* heap, MutableHandleValue v) { v.setString(*heap); @@ -3105,8 +3105,8 @@ JS_FOR_EACH_REFERENCE_TYPE_REPR(JS_LOAD_REFERENCE_CLASS_IMPL) template static void -visitReferences(SizedTypeDescr &descr, - uint8_t *mem, +visitReferences(SizedTypeDescr& descr, + uint8_t* mem, V& visitor) { if (descr.transparent()) @@ -3123,8 +3123,8 @@ visitReferences(SizedTypeDescr &descr, case TypeDescr::SizedArray: { - SizedArrayTypeDescr &arrayDescr = descr.as(); - SizedTypeDescr &elementDescr = arrayDescr.elementType(); + SizedArrayTypeDescr& arrayDescr = descr.as(); + SizedTypeDescr& elementDescr = arrayDescr.elementType(); for (int32_t i = 0; i < arrayDescr.length(); i++) { visitReferences(elementDescr, mem, visitor); mem += elementDescr.size(); @@ -3139,9 +3139,9 @@ visitReferences(SizedTypeDescr &descr, case TypeDescr::Struct: { - StructTypeDescr &structDescr = descr.as(); + StructTypeDescr& structDescr = descr.as(); for (size_t i = 0; i < structDescr.fieldCount(); i++) { - SizedTypeDescr &descr = structDescr.fieldDescr(i); + SizedTypeDescr& descr = structDescr.fieldDescr(i); size_t offset = structDescr.fieldOffset(i); visitReferences(descr, mem + offset, visitor); } @@ -3157,40 +3157,40 @@ visitReferences(SizedTypeDescr &descr, namespace js { class MemoryInitVisitor { - const JSRuntime *rt_; + const JSRuntime* rt_; public: - MemoryInitVisitor(const JSRuntime *rt) + MemoryInitVisitor(const JSRuntime* rt) : rt_(rt) {} - void visitReference(ReferenceTypeDescr &descr, uint8_t *mem); + void visitReference(ReferenceTypeDescr& descr, uint8_t* mem); }; } // namespace js void -js::MemoryInitVisitor::visitReference(ReferenceTypeDescr &descr, uint8_t *mem) +js::MemoryInitVisitor::visitReference(ReferenceTypeDescr& descr, uint8_t* mem) { switch (descr.type()) { case ReferenceTypeDescr::TYPE_ANY: { - js::HeapValue *heapValue = reinterpret_cast(mem); + js::HeapValue* heapValue = reinterpret_cast(mem); heapValue->init(UndefinedValue()); return; } case ReferenceTypeDescr::TYPE_OBJECT: { - js::HeapPtrObject *objectPtr = - reinterpret_cast(mem); + js::HeapPtrObject* objectPtr = + reinterpret_cast(mem); objectPtr->init(nullptr); return; } case ReferenceTypeDescr::TYPE_STRING: { - js::HeapPtrString *stringPtr = - reinterpret_cast(mem); + js::HeapPtrString* stringPtr = + reinterpret_cast(mem); stringPtr->init(rt_->emptyString); return; } @@ -3200,7 +3200,7 @@ js::MemoryInitVisitor::visitReference(ReferenceTypeDescr &descr, uint8_t *mem) } void -SizedTypeDescr::initInstances(const JSRuntime *rt, uint8_t *mem, size_t length) +SizedTypeDescr::initInstances(const JSRuntime* rt, uint8_t* mem, size_t length) { JS_ASSERT(length >= 1); @@ -3212,7 +3212,7 @@ SizedTypeDescr::initInstances(const JSRuntime *rt, uint8_t *mem, size_t length) visitReferences(*this, mem, visitor); // Stamp out N copies of later instances - uint8_t *target = mem; + uint8_t* target = mem; for (size_t i = 1; i < length; i++) { target += size(); memcpy(target, mem, size()); @@ -3224,33 +3224,33 @@ SizedTypeDescr::initInstances(const JSRuntime *rt, uint8_t *mem, size_t length) namespace js { class MemoryTracingVisitor { - JSTracer *trace_; + JSTracer* trace_; public: - MemoryTracingVisitor(JSTracer *trace) + MemoryTracingVisitor(JSTracer* trace) : trace_(trace) {} - void visitReference(ReferenceTypeDescr &descr, uint8_t *mem); + void visitReference(ReferenceTypeDescr& descr, uint8_t* mem); }; } // namespace js void -js::MemoryTracingVisitor::visitReference(ReferenceTypeDescr &descr, uint8_t *mem) +js::MemoryTracingVisitor::visitReference(ReferenceTypeDescr& descr, uint8_t* mem) { switch (descr.type()) { case ReferenceTypeDescr::TYPE_ANY: { - js::HeapValue *heapValue = reinterpret_cast(mem); + js::HeapValue* heapValue = reinterpret_cast(mem); gc::MarkValue(trace_, heapValue, "reference-val"); return; } case ReferenceTypeDescr::TYPE_OBJECT: { - js::HeapPtrObject *objectPtr = - reinterpret_cast(mem); + js::HeapPtrObject* objectPtr = + reinterpret_cast(mem); if (*objectPtr) gc::MarkObject(trace_, objectPtr, "reference-obj"); return; @@ -3258,8 +3258,8 @@ js::MemoryTracingVisitor::visitReference(ReferenceTypeDescr &descr, uint8_t *mem case ReferenceTypeDescr::TYPE_STRING: { - js::HeapPtrString *stringPtr = - reinterpret_cast(mem); + js::HeapPtrString* stringPtr = + reinterpret_cast(mem); if (*stringPtr) gc::MarkString(trace_, stringPtr, "reference-str"); return; @@ -3270,7 +3270,7 @@ js::MemoryTracingVisitor::visitReference(ReferenceTypeDescr &descr, uint8_t *mem } void -SizedTypeDescr::traceInstances(JSTracer *trace, uint8_t *mem, size_t length) +SizedTypeDescr::traceInstances(JSTracer* trace, uint8_t* mem, size_t length) { MemoryTracingVisitor visitor(trace); diff --git a/js/src/builtin/TypedObject.h b/js/src/builtin/TypedObject.h index a0bcdaca13..e9d4b24389 100644 --- a/js/src/builtin/TypedObject.h +++ b/js/src/builtin/TypedObject.h @@ -136,9 +136,9 @@ class TypedProto : public JSObject public: static const Class class_; - inline void initTypeDescrSlot(TypeDescr &descr); + inline void initTypeDescrSlot(TypeDescr& descr); - TypeDescr &typeDescr() const { + TypeDescr& typeDescr() const { return getReservedSlot(JS_TYPROTO_SLOT_DESCR).toObject().as(); } }; @@ -167,7 +167,7 @@ class TypeDescr : public JSObject return kind > JS_TYPEREPR_MAX_UNSIZED_KIND; } - JSAtom &stringRepr() const { + JSAtom& stringRepr() const { return getReservedSlot(JS_DESCR_SLOT_STRING_REPR).toString()->asAtom(); } @@ -197,8 +197,8 @@ class SizedTypeDescr : public TypeDescr return getReservedSlot(JS_DESCR_SLOT_SIZE).toInt32(); } - void initInstances(const JSRuntime *rt, uint8_t *mem, size_t length); - void traceInstances(JSTracer *trace, uint8_t *mem, size_t length); + void initInstances(const JSRuntime* rt, uint8_t* mem, size_t length); + void traceInstances(JSTracer* trace, uint8_t* mem, size_t length); }; typedef Handle HandleSizedTypeDescr; @@ -237,7 +237,7 @@ class ScalarTypeDescr : public SimpleTypeDescr static const bool Opaque = false; static int32_t size(Type t); static int32_t alignment(Type t); - static const char *typeName(Type type); + static const char* typeName(Type type); static const Class class_; static const JSFunctionSpec typeObjectMethods[]; @@ -246,7 +246,7 @@ class ScalarTypeDescr : public SimpleTypeDescr return (ScalarTypeDescr::Type) getReservedSlot(JS_DESCR_SLOT_TYPE).toInt32(); } - static bool call(JSContext *cx, unsigned argc, Value *vp); + static bool call(JSContext* cx, unsigned argc, Value* vp); }; // Enumerates the cases of ScalarTypeDescr::Type which have @@ -280,7 +280,7 @@ class ReferenceTypeDescr : public SimpleTypeDescr TYPE_STRING = JS_REFERENCETYPEREPR_STRING, }; static const int32_t TYPE_MAX = TYPE_STRING + 1; - static const char *typeName(Type type); + static const char* typeName(Type type); static const TypeDescr::Kind Kind = TypeDescr::Reference; static const bool Opaque = true; @@ -293,11 +293,11 @@ class ReferenceTypeDescr : public SimpleTypeDescr return (ReferenceTypeDescr::Type) getReservedSlot(JS_DESCR_SLOT_TYPE).toInt32(); } - const char *typeName() const { + const char* typeName() const { return typeName(type()); } - static bool call(JSContext *cx, unsigned argc, Value *vp); + static bool call(JSContext* cx, unsigned argc, Value* vp); }; #define JS_FOR_EACH_REFERENCE_TYPE_REPR(macro_) \ @@ -312,7 +312,7 @@ class ComplexTypeDescr : public SizedTypeDescr public: // Returns the prototype that instances of this type descriptor // will have. - TypedProto &instancePrototype() const { + TypedProto& instancePrototype() const { return getReservedSlot(JS_DESCR_SLOT_TYPROTO).toObject().as(); } }; @@ -338,18 +338,18 @@ class X4TypeDescr : public ComplexTypeDescr return (X4TypeDescr::Type) getReservedSlot(JS_DESCR_SLOT_TYPE).toInt32(); } - static bool call(JSContext *cx, unsigned argc, Value *vp); - static bool is(const Value &v); + static bool call(JSContext* cx, unsigned argc, Value* vp); + static bool is(const Value& v); }; #define JS_FOR_EACH_X4_TYPE_REPR(macro_) \ macro_(X4TypeDescr::TYPE_INT32, int32_t, int32) \ macro_(X4TypeDescr::TYPE_FLOAT32, float, float32) -bool IsTypedObjectClass(const Class *clasp); // Defined below +bool IsTypedObjectClass(const Class* clasp); // Defined below bool IsTypedObjectArray(JSObject& obj); -bool CreateUserSizeAndAlignmentProperties(JSContext *cx, HandleTypeDescr obj); +bool CreateUserSizeAndAlignmentProperties(JSContext* cx, HandleTypeDescr obj); /* * Properties and methods of the `ArrayType` meta type object. There @@ -373,7 +373,7 @@ class ArrayMetaTypeDescr : public JSObject // - `stringRepr` - canonical string representation for the array // - `size` - length of the array (0 if unsized) template - static T *create(JSContext *cx, + static T* create(JSContext* cx, HandleObject arrayTypePrototype, HandleSizedTypeDescr elementType, HandleAtom stringRepr, @@ -392,7 +392,7 @@ class ArrayMetaTypeDescr : public JSObject // This is the function that gets called when the user // does `new ArrayType(elem)`. It produces an array type object. - static bool construct(JSContext *cx, unsigned argc, Value *vp); + static bool construct(JSContext* cx, unsigned argc, Value* vp); }; /* @@ -411,9 +411,9 @@ class UnsizedArrayTypeDescr : public TypeDescr // This is the sized method on unsized array type objects. It // produces a sized variant. - static bool dimension(JSContext *cx, unsigned int argc, jsval *vp); + static bool dimension(JSContext* cx, unsigned int argc, jsval* vp); - SizedTypeDescr &elementType() { + SizedTypeDescr& elementType() { return getReservedSlot(JS_DESCR_SLOT_ARRAY_ELEM_TYPE).toObject().as(); } }; @@ -427,7 +427,7 @@ class SizedArrayTypeDescr : public ComplexTypeDescr static const Class class_; static const TypeDescr::Kind Kind = TypeDescr::SizedArray; - SizedTypeDescr &elementType() { + SizedTypeDescr& elementType() { return getReservedSlot(JS_DESCR_SLOT_ARRAY_ELEM_TYPE).toObject().as(); } @@ -444,7 +444,7 @@ class SizedArrayTypeDescr : public ComplexTypeDescr class StructMetaTypeDescr : public JSObject { private: - static JSObject *create(JSContext *cx, HandleObject structTypeGlobal, + static JSObject* create(JSContext* cx, HandleObject structTypeGlobal, HandleObject fields); public: @@ -460,7 +460,7 @@ class StructMetaTypeDescr : public JSObject // This is the function that gets called when the user // does `new StructType(...)`. It produces a struct type object. - static bool construct(JSContext *cx, unsigned argc, Value *vp); + static bool construct(JSContext* cx, unsigned argc, Value* vp); }; class StructTypeDescr : public ComplexTypeDescr @@ -473,13 +473,13 @@ class StructTypeDescr : public ComplexTypeDescr // Set `*out` to the index of the field named `id` and returns true, // or return false if no such field exists. - bool fieldIndex(jsid id, size_t *out); + bool fieldIndex(jsid id, size_t* out); // Return the name of the field at index `index`. - JSAtom &fieldName(size_t index); + JSAtom& fieldName(size_t index); // Return the type descr of the field at index `index`. - SizedTypeDescr &fieldDescr(size_t index); + SizedTypeDescr& fieldDescr(size_t index); // Return the offset of the field at index `index`. int32_t fieldOffset(size_t index); @@ -513,75 +513,75 @@ class TypedObject : public ArrayBufferViewObject static const bool IsTypedObjectClass = true; template - static bool obj_getArrayElement(JSContext *cx, + static bool obj_getArrayElement(JSContext* cx, Handle typedObj, Handle typeDescr, uint32_t index, MutableHandleValue vp); template - static bool obj_setArrayElement(JSContext *cx, + static bool obj_setArrayElement(JSContext* cx, Handle typedObj, Handle typeDescr, uint32_t index, MutableHandleValue vp); protected: - static void obj_trace(JSTracer *trace, JSObject *object); + static void obj_trace(JSTracer* trace, JSObject* object); - static bool obj_lookupGeneric(JSContext *cx, HandleObject obj, + static bool obj_lookupGeneric(JSContext* cx, HandleObject obj, HandleId id, MutableHandleObject objp, MutableHandleShape propp); - static bool obj_lookupProperty(JSContext *cx, HandleObject obj, + static bool obj_lookupProperty(JSContext* cx, HandleObject obj, HandlePropertyName name, MutableHandleObject objp, MutableHandleShape propp); - static bool obj_lookupElement(JSContext *cx, HandleObject obj, + static bool obj_lookupElement(JSContext* cx, HandleObject obj, uint32_t index, MutableHandleObject objp, MutableHandleShape propp); - static bool obj_defineGeneric(JSContext *cx, HandleObject obj, HandleId id, HandleValue v, + static bool obj_defineGeneric(JSContext* cx, HandleObject obj, HandleId id, HandleValue v, PropertyOp getter, StrictPropertyOp setter, unsigned attrs); - static bool obj_defineProperty(JSContext *cx, HandleObject obj, + static bool obj_defineProperty(JSContext* cx, HandleObject obj, HandlePropertyName name, HandleValue v, PropertyOp getter, StrictPropertyOp setter, unsigned attrs); - static bool obj_defineElement(JSContext *cx, HandleObject obj, uint32_t index, HandleValue v, + static bool obj_defineElement(JSContext* cx, HandleObject obj, uint32_t index, HandleValue v, PropertyOp getter, StrictPropertyOp setter, unsigned attrs); - static bool obj_getGeneric(JSContext *cx, HandleObject obj, HandleObject receiver, + static bool obj_getGeneric(JSContext* cx, HandleObject obj, HandleObject receiver, HandleId id, MutableHandleValue vp); - static bool obj_getProperty(JSContext *cx, HandleObject obj, HandleObject receiver, + static bool obj_getProperty(JSContext* cx, HandleObject obj, HandleObject receiver, HandlePropertyName name, MutableHandleValue vp); - static bool obj_getElement(JSContext *cx, HandleObject obj, HandleObject receiver, + static bool obj_getElement(JSContext* cx, HandleObject obj, HandleObject receiver, uint32_t index, MutableHandleValue vp); - static bool obj_getUnsizedArrayElement(JSContext *cx, HandleObject obj, HandleObject receiver, + static bool obj_getUnsizedArrayElement(JSContext* cx, HandleObject obj, HandleObject receiver, uint32_t index, MutableHandleValue vp); - static bool obj_setGeneric(JSContext *cx, HandleObject obj, HandleId id, + static bool obj_setGeneric(JSContext* cx, HandleObject obj, HandleId id, MutableHandleValue vp, bool strict); - static bool obj_setProperty(JSContext *cx, HandleObject obj, HandlePropertyName name, + static bool obj_setProperty(JSContext* cx, HandleObject obj, HandlePropertyName name, MutableHandleValue vp, bool strict); - static bool obj_setElement(JSContext *cx, HandleObject obj, uint32_t index, + static bool obj_setElement(JSContext* cx, HandleObject obj, uint32_t index, MutableHandleValue vp, bool strict); - static bool obj_getGenericAttributes(JSContext *cx, HandleObject obj, - HandleId id, unsigned *attrsp); - static bool obj_setGenericAttributes(JSContext *cx, HandleObject obj, - HandleId id, unsigned *attrsp); + static bool obj_getGenericAttributes(JSContext* cx, HandleObject obj, + HandleId id, unsigned* attrsp); + static bool obj_setGenericAttributes(JSContext* cx, HandleObject obj, + HandleId id, unsigned* attrsp); - static bool obj_deleteProperty(JSContext *cx, HandleObject obj, HandlePropertyName name, - bool *succeeded); - static bool obj_deleteElement(JSContext *cx, HandleObject obj, uint32_t index, - bool *succeeded); + static bool obj_deleteProperty(JSContext* cx, HandleObject obj, HandlePropertyName name, + bool* succeeded); + static bool obj_deleteElement(JSContext* cx, HandleObject obj, uint32_t index, + bool* succeeded); - static bool obj_enumerate(JSContext *cx, HandleObject obj, JSIterateOp enum_op, + static bool obj_enumerate(JSContext* cx, HandleObject obj, JSIterateOp enum_op, MutableHandleValue statep, MutableHandleId idp); public: @@ -599,8 +599,8 @@ class TypedObject : public ArrayBufferViewObject static size_t offsetOfByteOffsetSlot(); // Helper for createUnattached() - static TypedObject *createUnattachedWithClass(JSContext *cx, - const Class *clasp, + static TypedObject* createUnattachedWithClass(JSContext* cx, + const Class* clasp, HandleTypeDescr type, int32_t length); @@ -612,13 +612,13 @@ class TypedObject : public ArrayBufferViewObject // Arguments: // - type: type object for resulting object // - length: 0 unless this is an array, otherwise the length - static TypedObject *createUnattached(JSContext *cx, HandleTypeDescr type, + static TypedObject* createUnattached(JSContext* cx, HandleTypeDescr type, int32_t length); // Creates a typedObj that aliases the memory pointed at by `owner` // at the given offset. The typedObj will be a handle iff type is a // handle and a typed object otherwise. - static TypedObject *createDerived(JSContext *cx, + static TypedObject* createDerived(JSContext* cx, HandleSizedTypeDescr type, Handle typedContents, int32_t offset); @@ -626,40 +626,40 @@ class TypedObject : public ArrayBufferViewObject // Creates a new typed object whose memory is freshly allocated // and initialized with zeroes (or, in the case of references, an // appropriate default value). - static TypedObject *createZeroed(JSContext *cx, + static TypedObject* createZeroed(JSContext* cx, HandleTypeDescr typeObj, int32_t length); // User-accessible constructor (`new TypeDescriptor(...)`) // used for sized types. Note that the callee here is the *type descriptor*, // not the typedObj. - static bool constructSized(JSContext *cx, unsigned argc, Value *vp); + static bool constructSized(JSContext* cx, unsigned argc, Value* vp); // As `constructSized`, but for unsized array types. - static bool constructUnsized(JSContext *cx, unsigned argc, Value *vp); + static bool constructUnsized(JSContext* cx, unsigned argc, Value* vp); // Use this method when `buffer` is the owner of the memory. - void attach(ArrayBufferObject &buffer, int32_t offset); + void attach(ArrayBufferObject& buffer, int32_t offset); // Otherwise, use this to attach to memory referenced by another typedObj. - void attach(TypedObject &typedObj, int32_t offset); + void attach(TypedObject& typedObj, int32_t offset); // Invoked when array buffer is transferred elsewhere - void neuter(void *newData); + void neuter(void* newData); int32_t offset() const { return getReservedSlot(JS_TYPEDOBJ_SLOT_BYTEOFFSET).toInt32(); } - ArrayBufferObject &owner() const { + ArrayBufferObject& owner() const { return getReservedSlot(JS_TYPEDOBJ_SLOT_OWNER).toObject().as(); } - TypeDescr &typeDescr() const { + TypeDescr& typeDescr() const { return getReservedSlot(JS_TYPEDOBJ_SLOT_TYPE_DESCR).toObject().as(); } - uint8_t *typedMem() const { + uint8_t* typedMem() const { return (uint8_t*) getPrivate(); } @@ -681,14 +681,14 @@ class TypedObject : public ArrayBufferViewObject return typeDescr().as().size(); case TypeDescr::UnsizedArray: { - SizedTypeDescr &elementType = typeDescr().as().elementType(); + SizedTypeDescr& elementType = typeDescr().as().elementType(); return elementType.size() * length(); } } MOZ_ASSUME_UNREACHABLE("unhandled typerepresentation kind"); } - uint8_t *typedMem(size_t offset) const { + uint8_t* typedMem(size_t offset) const { // It seems a bit surprising that one might request an offset // == size(), but it can happen when taking the "address of" a // 0-sized value. (In other words, we maintain the invariant @@ -721,14 +721,14 @@ class OpaqueTypedObject : public TypedObject * * Constructs a new, unattached instance of `Handle`. */ -bool NewOpaqueTypedObject(JSContext *cx, unsigned argc, Value *vp); +bool NewOpaqueTypedObject(JSContext* cx, unsigned argc, Value* vp); /* * Usage: NewDerivedTypedObject(typeObj, owner, offset) * * Constructs a new, unattached instance of `Handle`. */ -bool NewDerivedTypedObject(JSContext *cx, unsigned argc, Value *vp); +bool NewDerivedTypedObject(JSContext* cx, unsigned argc, Value* vp); /* * Usage: AttachTypedObject(typedObj, newDatum, newOffset) @@ -736,7 +736,7 @@ bool NewDerivedTypedObject(JSContext *cx, unsigned argc, Value *vp); * Moves `typedObj` to point at the memory referenced by `newDatum` with * the offset `newOffset`. */ -bool AttachTypedObject(ThreadSafeContext *cx, unsigned argc, Value *vp); +bool AttachTypedObject(ThreadSafeContext* cx, unsigned argc, Value* vp); extern const JSJitInfo AttachTypedObjectJitInfo; /* @@ -745,8 +745,8 @@ extern const JSJitInfo AttachTypedObjectJitInfo; * Changes the offset for `typedObj` within its buffer to `offset`. * `typedObj` must already be attached. */ -bool intrinsic_SetTypedObjectOffset(JSContext *cx, unsigned argc, Value *vp); -bool SetTypedObjectOffset(ThreadSafeContext *, unsigned argc, Value *vp); +bool intrinsic_SetTypedObjectOffset(JSContext* cx, unsigned argc, Value* vp); +bool SetTypedObjectOffset(ThreadSafeContext*, unsigned argc, Value* vp); extern const JSJitInfo intrinsic_SetTypedObjectOffsetJitInfo; /* @@ -754,7 +754,7 @@ extern const JSJitInfo intrinsic_SetTypedObjectOffsetJitInfo; * * True if `obj` is a type object. */ -bool ObjectIsTypeDescr(ThreadSafeContext *cx, unsigned argc, Value *vp); +bool ObjectIsTypeDescr(ThreadSafeContext* cx, unsigned argc, Value* vp); extern const JSJitInfo ObjectIsTypeDescrJitInfo; /* @@ -762,7 +762,7 @@ extern const JSJitInfo ObjectIsTypeDescrJitInfo; * * True if `obj` is a transparent or opaque typed object. */ -bool ObjectIsTypedObject(ThreadSafeContext *cx, unsigned argc, Value *vp); +bool ObjectIsTypedObject(ThreadSafeContext* cx, unsigned argc, Value* vp); extern const JSJitInfo ObjectIsTypedObjectJitInfo; /* @@ -770,7 +770,7 @@ extern const JSJitInfo ObjectIsTypedObjectJitInfo; * * True if `obj` is an opaque typed object. */ -bool ObjectIsOpaqueTypedObject(ThreadSafeContext *cx, unsigned argc, Value *vp); +bool ObjectIsOpaqueTypedObject(ThreadSafeContext* cx, unsigned argc, Value* vp); extern const JSJitInfo ObjectIsOpaqueTypedObjectJitInfo; /* @@ -778,21 +778,21 @@ extern const JSJitInfo ObjectIsOpaqueTypedObjectJitInfo; * * True if `obj` is a transparent typed object. */ -bool ObjectIsTransparentTypedObject(ThreadSafeContext *cx, unsigned argc, Value *vp); +bool ObjectIsTransparentTypedObject(ThreadSafeContext* cx, unsigned argc, Value* vp); extern const JSJitInfo ObjectIsTransparentTypedObjectJitInfo; /* Predicates on type descriptor objects. In all cases, 'obj' must be a type descriptor. */ -bool TypeDescrIsSimpleType(ThreadSafeContext *, unsigned argc, Value *vp); +bool TypeDescrIsSimpleType(ThreadSafeContext*, unsigned argc, Value* vp); extern const JSJitInfo TypeDescrIsSimpleTypeJitInfo; -bool TypeDescrIsArrayType(ThreadSafeContext *, unsigned argc, Value *vp); +bool TypeDescrIsArrayType(ThreadSafeContext*, unsigned argc, Value* vp); extern const JSJitInfo TypeDescrIsArrayTypeJitInfo; -bool TypeDescrIsSizedArrayType(ThreadSafeContext *, unsigned argc, Value *vp); +bool TypeDescrIsSizedArrayType(ThreadSafeContext*, unsigned argc, Value* vp); extern const JSJitInfo TypeDescrIsSizedArrayTypeJitInfo; -bool TypeDescrIsUnsizedArrayType(ThreadSafeContext *, unsigned argc, Value *vp); +bool TypeDescrIsUnsizedArrayType(ThreadSafeContext*, unsigned argc, Value* vp); extern const JSJitInfo TypeDescrIsUnsizedArrayTypeJitInfo; /* @@ -801,7 +801,7 @@ extern const JSJitInfo TypeDescrIsUnsizedArrayTypeJitInfo; * Given a TypedObject `obj`, returns true if `obj` is * "attached" (i.e., its data pointer is nullptr). */ -bool TypedObjectIsAttached(ThreadSafeContext *cx, unsigned argc, Value *vp); +bool TypedObjectIsAttached(ThreadSafeContext* cx, unsigned argc, Value* vp); extern const JSJitInfo TypedObjectIsAttachedJitInfo; /* @@ -809,7 +809,7 @@ extern const JSJitInfo TypedObjectIsAttachedJitInfo; * * Same as the C function ClampDoubleToUint8. `v` must be a number. */ -bool ClampToUint8(ThreadSafeContext *cx, unsigned argc, Value *vp); +bool ClampToUint8(ThreadSafeContext* cx, unsigned argc, Value* vp); extern const JSJitInfo ClampToUint8JitInfo; /* @@ -823,7 +823,7 @@ extern const JSJitInfo ClampToUint8JitInfo; * * Both `sourceDatum` and `targetDatum` must be attached. */ -bool Memcpy(ThreadSafeContext *cx, unsigned argc, Value *vp); +bool Memcpy(ThreadSafeContext* cx, unsigned argc, Value* vp); extern const JSJitInfo MemcpyJitInfo; /* @@ -835,7 +835,7 @@ extern const JSJitInfo MemcpyJitInfo; * to access them; eventually this should be linked into the module * system. */ -bool GetTypedObjectModule(JSContext *cx, unsigned argc, Value *vp); +bool GetTypedObjectModule(JSContext* cx, unsigned argc, Value* vp); /* * Usage: GetFloat32x4TypeDescr() @@ -843,7 +843,7 @@ bool GetTypedObjectModule(JSContext *cx, unsigned argc, Value *vp); * Returns the float32x4 type object. SIMD pseudo-module must have * been initialized for this to be safe. */ -bool GetFloat32x4TypeDescr(JSContext *cx, unsigned argc, Value *vp); +bool GetFloat32x4TypeDescr(JSContext* cx, unsigned argc, Value* vp); /* * Usage: GetInt32x4TypeDescr() @@ -851,7 +851,7 @@ bool GetFloat32x4TypeDescr(JSContext *cx, unsigned argc, Value *vp); * Returns the int32x4 type object. SIMD pseudo-module must have * been initialized for this to be safe. */ -bool GetInt32x4TypeDescr(JSContext *cx, unsigned argc, Value *vp); +bool GetInt32x4TypeDescr(JSContext* cx, unsigned argc, Value* vp); /* * Usage: Store_int8(targetDatum, targetOffset, value) @@ -872,7 +872,7 @@ bool GetInt32x4TypeDescr(JSContext *cx, unsigned argc, Value *vp); #define JS_STORE_SCALAR_CLASS_DEFN(_constant, T, _name) \ class StoreScalar##T { \ public: \ - static bool Func(ThreadSafeContext *cx, unsigned argc, Value *vp); \ + static bool Func(ThreadSafeContext* cx, unsigned argc, Value* vp); \ static const JSJitInfo JitInfo; \ }; @@ -892,10 +892,10 @@ class StoreScalar##T { \ #define JS_STORE_REFERENCE_CLASS_DEFN(_constant, T, _name) \ class StoreReference##T { \ private: \ - static void store(T* heap, const Value &v); \ + static void store(T* heap, const Value& v); \ \ public: \ - static bool Func(ThreadSafeContext *cx, unsigned argc, Value *vp); \ + static bool Func(ThreadSafeContext* cx, unsigned argc, Value* vp); \ static const JSJitInfo JitInfo; \ }; @@ -910,7 +910,7 @@ class StoreReference##T { \ #define JS_LOAD_SCALAR_CLASS_DEFN(_constant, T, _name) \ class LoadScalar##T { \ public: \ - static bool Func(ThreadSafeContext *cx, unsigned argc, Value *vp); \ + static bool Func(ThreadSafeContext* cx, unsigned argc, Value* vp); \ static const JSJitInfo JitInfo; \ }; @@ -928,7 +928,7 @@ class LoadReference##T { \ static void load(T* heap, MutableHandleValue v); \ \ public: \ - static bool Func(ThreadSafeContext *cx, unsigned argc, Value *vp); \ + static bool Func(ThreadSafeContext* cx, unsigned argc, Value* vp); \ static const JSJitInfo JitInfo; \ }; @@ -940,7 +940,7 @@ JS_FOR_EACH_REFERENCE_TYPE_REPR(JS_STORE_REFERENCE_CLASS_DEFN) JS_FOR_EACH_REFERENCE_TYPE_REPR(JS_LOAD_REFERENCE_CLASS_DEFN) inline bool -IsTypedObjectClass(const Class *class_) +IsTypedObjectClass(const Class* class_) { return class_ == &TransparentTypedObject::class_ || class_ == &OpaqueTypedObject::class_; @@ -977,8 +977,8 @@ IsTypeDescrClass(const Class* clasp) } // namespace js -JSObject * -js_InitTypedObjectModuleObject(JSContext *cx, JS::HandleObject obj); +JSObject* +js_InitTypedObjectModuleObject(JSContext* cx, JS::HandleObject obj); template <> inline bool @@ -1030,7 +1030,7 @@ JSObject::is() const } inline void -js::TypedProto::initTypeDescrSlot(TypeDescr &descr) +js::TypedProto::initTypeDescrSlot(TypeDescr& descr) { initReservedSlot(JS_TYPROTO_SLOT_DESCR, ObjectValue(descr)); } diff --git a/js/src/ctypes/CTypes.cpp b/js/src/ctypes/CTypes.cpp index 2761e23857..a0a7bf130d 100644 --- a/js/src/ctypes/CTypes.cpp +++ b/js/src/ctypes/CTypes.cpp @@ -46,11 +46,11 @@ namespace js { namespace ctypes { size_t -GetDeflatedUTF8StringLength(JSContext *maybecx, const jschar *chars, +GetDeflatedUTF8StringLength(JSContext* maybecx, const jschar* chars, size_t nchars) { size_t nbytes; - const jschar *end; + const jschar* end; unsigned c, c2; char buffer[10]; @@ -91,8 +91,8 @@ GetDeflatedUTF8StringLength(JSContext *maybecx, const jschar *chars, } bool -DeflateStringToUTF8Buffer(JSContext *maybecx, const jschar *src, size_t srclen, - char *dst, size_t *dstlenp) +DeflateStringToUTF8Buffer(JSContext* maybecx, const jschar* src, size_t srclen, + char* dst, size_t* dstlenp) { size_t i, utf8Len; jschar c, c2; @@ -179,7 +179,7 @@ namespace CType { static bool ConstructBasic(JSContext* cx, HandleObject obj, const CallArgs& args); static void Trace(JSTracer* trc, JSObject* obj); - static void Finalize(JSFreeOp *fop, JSObject* obj); + static void Finalize(JSFreeOp* fop, JSObject* obj); bool IsCType(HandleValue v); bool IsCTypeOrProto(HandleValue v); @@ -278,7 +278,7 @@ namespace FunctionType { namespace CClosure { static void Trace(JSTracer* trc, JSObject* obj); - static void Finalize(JSFreeOp *fop, JSObject* obj); + static void Finalize(JSFreeOp* fop, JSObject* obj); // libffi callback static void ClosureStub(ffi_cif* cif, void* result, void** args, @@ -286,7 +286,7 @@ namespace CClosure { } namespace CData { - static void Finalize(JSFreeOp *fop, JSObject* obj); + static void Finalize(JSFreeOp* fop, JSObject* obj); bool ValueGetter(JSContext* cx, JS::CallArgs args); bool ValueSetter(JSContext* cx, JS::CallArgs args); @@ -295,8 +295,8 @@ namespace CData { static bool ReadString(JSContext* cx, unsigned argc, jsval* vp); static bool ReadStringReplaceMalformed(JSContext* cx, unsigned argc, jsval* vp); static bool ToSource(JSContext* cx, unsigned argc, jsval* vp); - static JSString *GetSourceString(JSContext *cx, HandleObject typeObj, - void *data); + static JSString* GetSourceString(JSContext* cx, HandleObject typeObj, + void* data); bool ErrnoGetter(JSContext* cx, JS::CallArgs args); @@ -318,7 +318,7 @@ namespace CDataFinalizer { * Where |finalizer| is a one-argument function taking a value * with the same type as |value|. */ - static bool Construct(JSContext* cx, unsigned argc, jsval *vp); + static bool Construct(JSContext* cx, unsigned argc, jsval* vp); /* * Private data held by |CDataFinalizer|. @@ -334,7 +334,7 @@ namespace CDataFinalizer { * The C data to pass to the code. * Finalization/|dispose|/|forget| release this memory. */ - void *cargs; + void* cargs; /* * The total size of the buffer pointed by |cargs| @@ -357,17 +357,17 @@ namespace CDataFinalizer { * A buffer for holding the return value. * Finalization/|dispose|/|forget| release this memory. */ - void *rvalue; + void* rvalue; }; /* * Methods of instances of |CDataFinalizer| */ namespace Methods { - static bool Dispose(JSContext* cx, unsigned argc, jsval *vp); - static bool Forget(JSContext* cx, unsigned argc, jsval *vp); - static bool ToSource(JSContext* cx, unsigned argc, jsval *vp); - static bool ToString(JSContext* cx, unsigned argc, jsval *vp); + static bool Dispose(JSContext* cx, unsigned argc, jsval* vp); + static bool Forget(JSContext* cx, unsigned argc, jsval* vp); + static bool ToSource(JSContext* cx, unsigned argc, jsval* vp); + static bool ToString(JSContext* cx, unsigned argc, jsval* vp); } /* @@ -375,7 +375,7 @@ namespace CDataFinalizer { * * @return true if |obj| is a CDataFinalizer, false otherwise. */ - static bool IsCDataFinalizer(JSObject *obj); + static bool IsCDataFinalizer(JSObject* obj); /* * Clean up the finalization information of a CDataFinalizer. @@ -388,12 +388,12 @@ namespace CDataFinalizer { * during finalization) or a CDataFinalizer JSObject. Always use nullptr * if you are calling from a finalizer. */ - static void Cleanup(Private *p, JSObject *obj); + static void Cleanup(Private* p, JSObject* obj); /* * Perform the actual call to the finalizer code. */ - static void CallFinalizer(CDataFinalizer::Private *p, + static void CallFinalizer(CDataFinalizer::Private* p, int* errnoStatus, int32_t* lastErrorStatus); @@ -401,21 +401,21 @@ namespace CDataFinalizer { * Return the CType of a CDataFinalizer object, or nullptr if the object * has been cleaned-up already. */ - static JSObject *GetCType(JSContext *cx, JSObject *obj); + static JSObject* GetCType(JSContext* cx, JSObject* obj); /* * Perform finalization of a |CDataFinalizer| */ - static void Finalize(JSFreeOp *fop, JSObject *obj); + static void Finalize(JSFreeOp* fop, JSObject* obj); /* * Return the jsval contained by this finalizer. * * Note that the jsval is actually not recorded, but converted back from C. */ - static bool GetValue(JSContext *cx, JSObject *obj, jsval *result); + static bool GetValue(JSContext* cx, JSObject* obj, jsval* result); - static JSObject* GetCData(JSContext *cx, JSObject *obj); + static JSObject* GetCData(JSContext* cx, JSObject* obj); } @@ -432,7 +432,7 @@ namespace Int64Base { bool ToSource(JSContext* cx, JSObject* obj, const CallArgs& args, bool isUnsigned); - static void Finalize(JSFreeOp *fop, JSObject* obj); + static void Finalize(JSFreeOp* fop, JSObject* obj); } namespace Int64 { @@ -862,7 +862,7 @@ TypeError(JSContext* cx, const char* expected, HandleValue actual) static JSObject* InitCTypeClass(JSContext* cx, HandleObject parent) { - JSFunction *fun = JS_DefineFunction(cx, parent, "CType", ConstructAbstract, 0, + JSFunction* fun = JS_DefineFunction(cx, parent, "CType", ConstructAbstract, 0, CTYPESCTOR_FLAGS); if (!fun) return nullptr; @@ -1295,8 +1295,8 @@ GetCallbacks(JSObject* obj) // Utility function to access a property of an object as an object // returns false and sets the error if the property does not exist // or is not an object -static bool GetObjectProperty(JSContext *cx, HandleObject obj, - const char *property, MutableHandleObject result) +static bool GetObjectProperty(JSContext* cx, HandleObject obj, + const char* property, MutableHandleObject result) { RootedValue val(cx); if (!JS_GetProperty(cx, obj, property, &val)) { @@ -1365,7 +1365,7 @@ JS_InitCTypesClass(JSContext* cx, HandleObject global) } JS_PUBLIC_API(void) -JS_SetCTypesCallbacks(JSObject *ctypesObj, JSCTypesCallbacks* callbacks) +JS_SetCTypesCallbacks(JSObject* ctypesObj, JSCTypesCallbacks* callbacks) { JS_ASSERT(callbacks); JS_ASSERT(IsCTypesGlobal(ctypesObj)); @@ -1377,7 +1377,7 @@ JS_SetCTypesCallbacks(JSObject *ctypesObj, JSCTypesCallbacks* callbacks) namespace js { JS_FRIEND_API(size_t) -SizeOfDataIfCDataObject(mozilla::MallocSizeOf mallocSizeOf, JSObject *obj) +SizeOfDataIfCDataObject(mozilla::MallocSizeOf mallocSizeOf, JSObject* obj) { if (!CData::IsCData(obj)) return 0; @@ -1688,7 +1688,7 @@ jsvalToInteger(JSContext* cx, jsval val, IntegerType* result) // representable by FloatType. template static bool -jsvalToFloat(JSContext *cx, jsval val, FloatType* result) +jsvalToFloat(JSContext* cx, jsval val, FloatType* result) { JS_STATIC_ASSERT(!NumericLimits::is_exact); @@ -2177,7 +2177,7 @@ ConvertToJS(JSContext* cx, // Determine if the contents of a typed array can be converted without // ambiguity to a C type. Elements of a Int8Array are converted to // ctypes.int8_t, UInt8Array to ctypes.uint8_t, etc. -bool CanConvertTypedArrayItemTo(JSObject *baseType, JSObject *valObj, JSContext *cx) { +bool CanConvertTypedArrayItemTo(JSObject* baseType, JSObject* valObj, JSContext* cx) { TypeCode baseTypeCode = CType::GetTypeCode(baseType); if (baseTypeCode == TYPE_void_t) { return true; @@ -2259,7 +2259,7 @@ ImplicitConvert(JSContext* cx, sourceData = valObj; sourceType = CDataFinalizer::GetCType(cx, sourceData); - CDataFinalizer::Private *p = (CDataFinalizer::Private *) + CDataFinalizer::Private* p = (CDataFinalizer::Private*) JS_GetPrivate(sourceData); if (!p) { @@ -2316,7 +2316,7 @@ ImplicitConvert(JSContext* cx, JSString* str = JSVAL_TO_STRING(val); \ if (str->length() != 1) \ return TypeError(cx, #name, val); \ - const jschar *chars = str->getChars(cx); \ + const jschar* chars = str->getChars(cx); \ if (!chars) \ return false; \ result = chars[0]; \ @@ -2580,7 +2580,7 @@ ImplicitConvert(JSContext* cx, return false; } - JSFlatString *name = JSID_TO_FLAT_STRING(id); + JSFlatString* name = JSID_TO_FLAT_STRING(id); const FieldInfo* field = StructType::LookupField(cx, targetType, name); if (!field) return false; @@ -3288,7 +3288,7 @@ CType::DefineBuiltin(JSContext* cx, } void -CType::Finalize(JSFreeOp *fop, JSObject* obj) +CType::Finalize(JSFreeOp* fop, JSObject* obj) { // Make sure our TypeCode slot is legit. If it's not, bail. jsval slot = JS_GetReservedSlot(obj, SLOT_TYPECODE); @@ -3350,7 +3350,7 @@ CType::Trace(JSTracer* trc, JSObject* obj) FieldInfoHash* fields = static_cast(JSVAL_TO_PRIVATE(slot)); for (FieldInfoHash::Enum e(*fields); !e.empty(); e.popFront()) { - JSString *key = e.front().key(); + JSString* key = e.front().key(); JS_CallStringTracer(trc, &key, "fieldName"); if (key != e.front().key()) e.rekeyFront(JS_ASSERT_STRING_IS_FLAT(key)); @@ -4490,7 +4490,7 @@ ArrayType::ElementTypeGetter(JSContext* cx, JS::CallArgs args) bool ArrayType::LengthGetter(JSContext* cx, JS::CallArgs args) { - JSObject *obj = &args.thisv().toObject(); + JSObject* obj = &args.thisv().toObject(); // This getter exists for both CTypes and CDatas of the ArrayType persuasion. // If we're dealing with a CData, get the CType from it. @@ -4758,15 +4758,15 @@ StructType::Create(JSContext* cx, unsigned argc, jsval* vp) } static void -PostBarrierCallback(JSTracer *trc, JSString *key, void *data) +PostBarrierCallback(JSTracer* trc, JSString* key, void* data) { typedef HashMap UnbarrieredFieldInfoHash; - UnbarrieredFieldInfoHash *table = reinterpret_cast(data); - JSString *prior = key; + UnbarrieredFieldInfoHash* table = reinterpret_cast(data); + JSString* prior = key; JS_CallStringTracer(trc, &key, "CType fieldName"); table->rekeyIfMoved(JS_ASSERT_STRING_IS_FLAT(prior), JS_ASSERT_STRING_IS_FLAT(key)); } @@ -5100,7 +5100,7 @@ StructType::GetFieldInfo(JSObject* obj) } const FieldInfo* -StructType::LookupField(JSContext* cx, JSObject* obj, JSFlatString *name) +StructType::LookupField(JSContext* cx, JSObject* obj, JSFlatString* name) { JS_ASSERT(CType::IsCType(obj)); JS_ASSERT(CType::GetTypeCode(obj) == TYPE_struct); @@ -5255,7 +5255,7 @@ StructType::AddressOfField(JSContext* cx, unsigned argc, jsval* vp) return false; } - JSFlatString *str = JS_FlattenString(cx, args[0].toString()); + JSFlatString* str = JS_FlattenString(cx, args[0].toString()); if (!str) return false; @@ -5872,7 +5872,7 @@ FunctionType::Call(JSContext* cx, autoCallback.DoEndCallback(); // Store the error value for later consultation with |ctypes.getStatus| - JSObject *objCTypes = CType::GetGlobalCTypes(cx, typeObj); + JSObject* objCTypes = CType::GetGlobalCTypes(cx, typeObj); if (!objCTypes) return false; @@ -6106,7 +6106,7 @@ CClosure::Trace(JSTracer* trc, JSObject* obj) } void -CClosure::Finalize(JSFreeOp *fop, JSObject* obj) +CClosure::Finalize(JSFreeOp* fop, JSObject* obj) { // Make sure our ClosureInfo slot is legit. If it's not, bail. jsval slot = JS_GetReservedSlot(obj, SLOT_CLOSUREINFO); @@ -6350,7 +6350,7 @@ CData::Create(JSContext* cx, } void -CData::Finalize(JSFreeOp *fop, JSObject* obj) +CData::Finalize(JSFreeOp* fop, JSObject* obj) { // Delete our buffer, and the data it contains if we own it. jsval slot = JS_GetReservedSlot(obj, SLOT_OWNS); @@ -6539,10 +6539,10 @@ CData::GetRuntime(JSContext* cx, unsigned argc, jsval* vp) return true; } -typedef JS::TwoByteCharsZ (*InflateUTF8Method)(JSContext *, const JS::UTF8Chars, size_t *); +typedef JS::TwoByteCharsZ (*InflateUTF8Method)(JSContext*, const JS::UTF8Chars, size_t*); static bool -ReadStringCommon(JSContext* cx, InflateUTF8Method inflateUTF8, unsigned argc, jsval *vp) +ReadStringCommon(JSContext* cx, InflateUTF8Method inflateUTF8, unsigned argc, jsval* vp) { CallArgs args = CallArgsFromVp(argc, vp); if (args.length() != 0) { @@ -6595,7 +6595,7 @@ ReadStringCommon(JSContext* cx, InflateUTF8Method inflateUTF8, unsigned argc, js size_t length = strnlen(bytes, maxLength); // Determine the length. - jschar *dst = inflateUTF8(cx, JS::UTF8Chars(bytes, length), &length).get(); + jschar* dst = inflateUTF8(cx, JS::UTF8Chars(bytes, length), &length).get(); if (!dst) return false; @@ -6637,8 +6637,8 @@ CData::ReadStringReplaceMalformed(JSContext* cx, unsigned argc, jsval* vp) return ReadStringCommon(cx, JS::LossyUTF8CharsToNewTwoByteCharsZ, argc, vp); } -JSString * -CData::GetSourceString(JSContext *cx, HandleObject typeObj, void *data) +JSString* +CData::GetSourceString(JSContext* cx, HandleObject typeObj, void* data) { // Walk the types, building up the toSource() string. // First, we build up the type expression: @@ -6708,7 +6708,7 @@ CData::LastErrorGetter(JSContext* cx, JS::CallArgs args) #endif // defined(XP_WIN) bool -CDataFinalizer::Methods::ToSource(JSContext *cx, unsigned argc, jsval *vp) +CDataFinalizer::Methods::ToSource(JSContext* cx, unsigned argc, jsval* vp) { CallArgs args = CallArgsFromVp(argc, vp); RootedObject objThis(cx, JS_THIS_OBJECT(cx, vp)); @@ -6719,10 +6719,10 @@ CDataFinalizer::Methods::ToSource(JSContext *cx, unsigned argc, jsval *vp) return false; } - CDataFinalizer::Private *p = (CDataFinalizer::Private *) + CDataFinalizer::Private* p = (CDataFinalizer::Private*) JS_GetPrivate(objThis); - JSString *strMessage; + JSString* strMessage; if (!p) { strMessage = JS_NewStringCopyZ(cx, "ctypes.CDataFinalizer()"); } else { @@ -6734,7 +6734,7 @@ CDataFinalizer::Methods::ToSource(JSContext *cx, unsigned argc, jsval *vp) AutoString source; AppendString(source, "ctypes.CDataFinalizer("); - JSString *srcValue = CData::GetSourceString(cx, objType, p->cargs); + JSString* srcValue = CData::GetSourceString(cx, objType, p->cargs); if (!srcValue) { return false; } @@ -6747,7 +6747,7 @@ CDataFinalizer::Methods::ToSource(JSContext *cx, unsigned argc, jsval *vp) } RootedObject typeObj(cx, JSVAL_TO_OBJECT(valCodePtrType)); - JSString *srcDispose = CData::GetSourceString(cx, typeObj, &(p->code)); + JSString* srcDispose = CData::GetSourceString(cx, typeObj, &(p->code)); if (!srcDispose) { return false; } @@ -6767,7 +6767,7 @@ CDataFinalizer::Methods::ToSource(JSContext *cx, unsigned argc, jsval *vp) } bool -CDataFinalizer::Methods::ToString(JSContext *cx, unsigned argc, jsval *vp) +CDataFinalizer::Methods::ToString(JSContext* cx, unsigned argc, jsval* vp) { CallArgs args = CallArgsFromVp(argc, vp); JSObject* objThis = JS_THIS_OBJECT(cx, vp); @@ -6778,7 +6778,7 @@ CDataFinalizer::Methods::ToString(JSContext *cx, unsigned argc, jsval *vp) return false; } - JSString *strMessage; + JSString* strMessage; RootedValue value(cx); if (!JS_GetPrivate(objThis)) { // Pre-check whether CDataFinalizer::GetValue can fail @@ -6800,14 +6800,14 @@ CDataFinalizer::Methods::ToString(JSContext *cx, unsigned argc, jsval *vp) } bool -CDataFinalizer::IsCDataFinalizer(JSObject *obj) +CDataFinalizer::IsCDataFinalizer(JSObject* obj) { return JS_GetClass(obj) == &sCDataFinalizerClass; } -JSObject * -CDataFinalizer::GetCType(JSContext *cx, JSObject *obj) +JSObject* +CDataFinalizer::GetCType(JSContext* cx, JSObject* obj) { MOZ_ASSERT(IsCDataFinalizer(obj)); @@ -6821,7 +6821,7 @@ CDataFinalizer::GetCType(JSContext *cx, JSObject *obj) } JSObject* -CDataFinalizer::GetCData(JSContext *cx, JSObject *obj) +CDataFinalizer::GetCData(JSContext* cx, JSObject* obj) { if (!obj) { JS_ReportError(cx, "No C data"); @@ -6843,11 +6843,11 @@ CDataFinalizer::GetCData(JSContext *cx, JSObject *obj) } bool -CDataFinalizer::GetValue(JSContext *cx, JSObject *obj, jsval *aResult) +CDataFinalizer::GetValue(JSContext* cx, JSObject* obj, jsval* aResult) { MOZ_ASSERT(IsCDataFinalizer(obj)); - CDataFinalizer::Private *p = (CDataFinalizer::Private *) + CDataFinalizer::Private* p = (CDataFinalizer::Private*) JS_GetPrivate(obj); if (!p) { @@ -6873,7 +6873,7 @@ CDataFinalizer::GetValue(JSContext *cx, JSObject *obj, jsval *aResult) * CData functions are initialized during creation. */ bool -CDataFinalizer::Construct(JSContext* cx, unsigned argc, jsval *vp) +CDataFinalizer::Construct(JSContext* cx, unsigned argc, jsval* vp) { CallArgs args = CallArgsFromVp(argc, vp); RootedObject objSelf(cx, &args.callee()); @@ -6885,7 +6885,7 @@ CDataFinalizer::Construct(JSContext* cx, unsigned argc, jsval *vp) // Get arguments if (args.length() == 0) { // Special case: the empty (already finalized) object - JSObject *objResult = JS_NewObject(cx, &sCDataFinalizerClass, objProto, NullPtr()); + JSObject* objResult = JS_NewObject(cx, &sCDataFinalizerClass, objProto, NullPtr()); args.rval().setObject(*objResult); return true; } @@ -6900,7 +6900,7 @@ CDataFinalizer::Construct(JSContext* cx, unsigned argc, jsval *vp) return TypeError(cx, "_a CData object_ of a function pointer type", valCodePtr); } - JSObject *objCodePtr = &valCodePtr.toObject(); + JSObject* objCodePtr = &valCodePtr.toObject(); //Note: Using a custom argument formatter here would be awkward (requires //a destructor just to uninstall the formatter). @@ -6920,7 +6920,7 @@ CDataFinalizer::Construct(JSContext* cx, unsigned argc, jsval *vp) valCodePtrType); } - JSObject *objCodeType = PointerType::GetBaseType(objCodePtrType); + JSObject* objCodeType = PointerType::GetBaseType(objCodePtrType); MOZ_ASSERT(objCodeType); TypeCode typCode = CType::GetTypeCode(objCodeType); @@ -6984,7 +6984,7 @@ CDataFinalizer::Construct(JSContext* cx, unsigned argc, jsval *vp) // 5. Create |objResult| - JSObject *objResult = JS_NewObject(cx, &sCDataFinalizerClass, objProto, NullPtr()); + JSObject* objResult = JS_NewObject(cx, &sCDataFinalizerClass, objProto, NullPtr()); if (!objResult) { return false; } @@ -6992,9 +6992,9 @@ CDataFinalizer::Construct(JSContext* cx, unsigned argc, jsval *vp) // If our argument is a CData, it holds a type. // This is the type that we should capture, not that // of the function, which may be less precise. - JSObject *objBestArgType = objArgType; + JSObject* objBestArgType = objArgType; if (!JSVAL_IS_PRIMITIVE(valData)) { - JSObject *objData = &valData.toObject(); + JSObject* objData = &valData.toObject(); if (CData::IsCData(objData)) { objBestArgType = CData::GetCType(objData); size_t sizeBestArg; @@ -7064,7 +7064,7 @@ CDataFinalizer::Construct(JSContext* cx, unsigned argc, jsval *vp) * the call. On other platforms, |lastErrorStatus| is ignored. */ void -CDataFinalizer::CallFinalizer(CDataFinalizer::Private *p, +CDataFinalizer::CallFinalizer(CDataFinalizer::Private* p, int* errnoStatus, int32_t* lastErrorStatus) { @@ -7100,7 +7100,7 @@ CDataFinalizer::CallFinalizer(CDataFinalizer::Private *p, * strong references. */ bool -CDataFinalizer::Methods::Forget(JSContext* cx, unsigned argc, jsval *vp) +CDataFinalizer::Methods::Forget(JSContext* cx, unsigned argc, jsval* vp) { CallArgs args = CallArgsFromVp(argc, vp); if (args.length() != 0) { @@ -7116,7 +7116,7 @@ CDataFinalizer::Methods::Forget(JSContext* cx, unsigned argc, jsval *vp) return TypeError(cx, "a CDataFinalizer", val); } - CDataFinalizer::Private *p = (CDataFinalizer::Private *) + CDataFinalizer::Private* p = (CDataFinalizer::Private*) JS_GetPrivate(obj); if (!p) { @@ -7148,7 +7148,7 @@ CDataFinalizer::Methods::Forget(JSContext* cx, unsigned argc, jsval *vp) * strong references. */ bool -CDataFinalizer::Methods::Dispose(JSContext* cx, unsigned argc, jsval *vp) +CDataFinalizer::Methods::Dispose(JSContext* cx, unsigned argc, jsval* vp) { CallArgs args = CallArgsFromVp(argc, vp); if (args.length() != 0) { @@ -7164,7 +7164,7 @@ CDataFinalizer::Methods::Dispose(JSContext* cx, unsigned argc, jsval *vp) return TypeError(cx, "a CDataFinalizer", val); } - CDataFinalizer::Private *p = (CDataFinalizer::Private *) + CDataFinalizer::Private* p = (CDataFinalizer::Private*) JS_GetPrivate(obj); if (!p) { @@ -7175,15 +7175,15 @@ CDataFinalizer::Methods::Dispose(JSContext* cx, unsigned argc, jsval *vp) jsval valType = JS_GetReservedSlot(obj, SLOT_DATAFINALIZER_VALTYPE); JS_ASSERT(!JSVAL_IS_PRIMITIVE(valType)); - JSObject *objCTypes = CType::GetGlobalCTypes(cx, &valType.toObject()); + JSObject* objCTypes = CType::GetGlobalCTypes(cx, &valType.toObject()); if (!objCTypes) return false; jsval valCodePtrType = JS_GetReservedSlot(obj, SLOT_DATAFINALIZER_CODETYPE); JS_ASSERT(!JSVAL_IS_PRIMITIVE(valCodePtrType)); - JSObject *objCodePtrType = &valCodePtrType.toObject(); + JSObject* objCodePtrType = &valCodePtrType.toObject(); - JSObject *objCodeType = PointerType::GetBaseType(objCodePtrType); + JSObject* objCodeType = PointerType::GetBaseType(objCodePtrType); JS_ASSERT(objCodeType); JS_ASSERT(CType::GetTypeCode(objCodeType) == TYPE_function); @@ -7225,7 +7225,7 @@ CDataFinalizer::Methods::Dispose(JSContext* cx, unsigned argc, jsval *vp) void CDataFinalizer::Finalize(JSFreeOp* fop, JSObject* obj) { - CDataFinalizer::Private *p = (CDataFinalizer::Private *) + CDataFinalizer::Private* p = (CDataFinalizer::Private*) JS_GetPrivate(obj); if (!p) { @@ -7248,7 +7248,7 @@ CDataFinalizer::Finalize(JSFreeOp* fop, JSObject* obj) * CDataFinalizer object otherwise. */ void -CDataFinalizer::Cleanup(CDataFinalizer::Private *p, JSObject *obj) +CDataFinalizer::Cleanup(CDataFinalizer::Private* p, JSObject* obj) { if (!p) { return; // We have already cleaned up @@ -7303,7 +7303,7 @@ Int64Base::Construct(JSContext* cx, } void -Int64Base::Finalize(JSFreeOp *fop, JSObject* obj) +Int64Base::Finalize(JSFreeOp* fop, JSObject* obj) { jsval slot = JS_GetReservedSlot(obj, SLOT_INT64); if (JSVAL_IS_VOID(slot)) @@ -7349,7 +7349,7 @@ Int64Base::ToString(JSContext* cx, IntegerToString(static_cast(GetInt(obj)), radix, intString); } - JSString *result = NewUCString(cx, intString); + JSString* result = NewUCString(cx, intString); if (!result) return false; @@ -7379,7 +7379,7 @@ Int64Base::ToSource(JSContext* cx, } AppendString(source, "\")"); - JSString *result = NewUCString(cx, source); + JSString* result = NewUCString(cx, source); if (!result) return false; diff --git a/js/src/ctypes/CTypes.h b/js/src/ctypes/CTypes.h index 5c9ff51447..58b0bea0ed 100644 --- a/js/src/ctypes/CTypes.h +++ b/js/src/ctypes/CTypes.h @@ -71,7 +71,7 @@ typedef Vector AutoCString; // Convenience functions to append, insert, and compare Strings. template void -AppendString(Vector &v, const char (&array)[ArrayLength]) +AppendString(Vector& v, const char (&array)[ArrayLength]) { // Don't include the trailing '\0'. size_t alen = ArrayLength - 1; @@ -85,17 +85,17 @@ AppendString(Vector &v, const char (&array)[ArrayLength]) template void -AppendString(Vector &v, Vector &w) +AppendString(Vector& v, Vector& w) { v.append(w.begin(), w.length()); } template void -AppendString(Vector &v, JSString* str) +AppendString(Vector& v, JSString* str) { JS_ASSERT(str); - const jschar *chars = str->getChars(nullptr); + const jschar* chars = str->getChars(nullptr); if (!chars) return; v.append(chars, str->length()); @@ -103,7 +103,7 @@ AppendString(Vector &v, JSString* str) template void -AppendString(Vector &v, JSString* str) +AppendString(Vector& v, JSString* str) { JS_ASSERT(str); size_t vlen = v.length(); @@ -111,7 +111,7 @@ AppendString(Vector &v, JSString* str) if (!v.resize(vlen + alen)) return; - const jschar *chars = str->getChars(nullptr); + const jschar* chars = str->getChars(nullptr); if (!chars) return; @@ -121,7 +121,7 @@ AppendString(Vector &v, JSString* str) template void -PrependString(Vector &v, const char (&array)[ArrayLength]) +PrependString(Vector& v, const char (&array)[ArrayLength]) { // Don't include the trailing '\0'. size_t alen = ArrayLength - 1; @@ -139,7 +139,7 @@ PrependString(Vector &v, const char (&array)[ArrayLength]) template void -PrependString(Vector &v, JSString* str) +PrependString(Vector& v, JSString* str) { JS_ASSERT(str); size_t vlen = v.length(); @@ -147,7 +147,7 @@ PrependString(Vector &v, JSString* str) if (!v.resize(vlen + alen)) return; - const jschar *chars = str->getChars(nullptr); + const jschar* chars = str->getChars(nullptr); if (!chars) return; @@ -159,12 +159,12 @@ PrependString(Vector &v, JSString* str) } extern size_t -GetDeflatedUTF8StringLength(JSContext *maybecx, const jschar *chars, +GetDeflatedUTF8StringLength(JSContext* maybecx, const jschar* chars, size_t charsLength); bool -DeflateStringToUTF8Buffer(JSContext *maybecx, const jschar *src, size_t srclen, - char *dst, size_t *dstlenp); +DeflateStringToUTF8Buffer(JSContext* maybecx, const jschar* src, size_t srclen, + char* dst, size_t* dstlenp); /******************************************************************************* @@ -234,7 +234,7 @@ struct FieldHashPolicy : DefaultHasher typedef JSFlatString* Key; typedef Key Lookup; - static uint32_t hash(const Lookup &l) { + static uint32_t hash(const Lookup& l) { const jschar* s = l->chars(); size_t n = l->length(); uint32_t hash = 0; @@ -243,7 +243,7 @@ struct FieldHashPolicy : DefaultHasher return hash; } - static bool match(const Key &k, const Lookup &l) { + static bool match(const Key& k, const Lookup& l) { if (k == l) return true; @@ -457,7 +457,7 @@ namespace StructType { bool DefineInternal(JSContext* cx, JSObject* typeObj, JSObject* fieldsObj); const FieldInfoHash* GetFieldInfo(JSObject* obj); - const FieldInfo* LookupField(JSContext* cx, JSObject* obj, JSFlatString *name); + const FieldInfo* LookupField(JSContext* cx, JSObject* obj, JSFlatString* name); JSObject* BuildFieldsArray(JSContext* cx, JSObject* obj); ffi_type* BuildFFIType(JSContext* cx, JSObject* obj); } diff --git a/js/src/ctypes/Library.cpp b/js/src/ctypes/Library.cpp index 07945596b5..61aab5d8a8 100644 --- a/js/src/ctypes/Library.cpp +++ b/js/src/ctypes/Library.cpp @@ -19,7 +19,7 @@ namespace ctypes { namespace Library { - static void Finalize(JSFreeOp *fop, JSObject* obj); + static void Finalize(JSFreeOp* fop, JSObject* obj); static bool Close(JSContext* cx, unsigned argc, jsval* vp); static bool Declare(JSContext* cx, unsigned argc, jsval* vp); @@ -48,7 +48,7 @@ static const JSFunctionSpec sLibraryFunctions[] = { }; bool -Library::Name(JSContext* cx, unsigned argc, jsval *vp) +Library::Name(JSContext* cx, unsigned argc, jsval* vp) { CallArgs args = CallArgsFromVp(argc, vp); if (args.length() != 1) { @@ -71,7 +71,7 @@ Library::Name(JSContext* cx, unsigned argc, jsval *vp) AppendString(resultString, str); AppendString(resultString, DLL_SUFFIX); - JSString *result = JS_NewUCStringCopyN(cx, resultString.begin(), + JSString* result = JS_NewUCStringCopyN(cx, resultString.begin(), resultString.length()); if (!result) return false; @@ -191,13 +191,13 @@ UnloadLibrary(JSObject* obj) } void -Library::Finalize(JSFreeOp *fop, JSObject* obj) +Library::Finalize(JSFreeOp* fop, JSObject* obj) { UnloadLibrary(obj); } bool -Library::Open(JSContext* cx, unsigned argc, jsval *vp) +Library::Open(JSContext* cx, unsigned argc, jsval* vp) { CallArgs args = CallArgsFromVp(argc, vp); JSObject* ctypesObj = JS_THIS_OBJECT(cx, vp); diff --git a/js/src/ctypes/Library.h b/js/src/ctypes/Library.h index e37ea0f951..89885610ed 100644 --- a/js/src/ctypes/Library.h +++ b/js/src/ctypes/Library.h @@ -21,7 +21,7 @@ enum LibrarySlot { namespace Library { - bool Name(JSContext* cx, unsigned argc, JS::Value *vp); + bool Name(JSContext* cx, unsigned argc, JS::Value* vp); JSObject* Create(JSContext* cx, JS::Value path, JSCTypesCallbacks* callbacks); diff --git a/js/src/devtools/Instruments.cpp b/js/src/devtools/Instruments.cpp index c10e073b28..649d694249 100644 --- a/js/src/devtools/Instruments.cpp +++ b/js/src/devtools/Instruments.cpp @@ -84,7 +84,7 @@ LoadDTPerformanceLibraries(bool dontLoad) flags |= RTLD_NOLOAD; } - void *DTPerformanceLibrary = dlopen(DTPerformanceLibraryPath, flags); + void* DTPerformanceLibrary = dlopen(DTPerformanceLibraryPath, flags); if (!DTPerformanceLibrary) { DTPerformanceLibrary = dlopen(OldDTPerformanceLibraryPath, flags); } @@ -94,7 +94,7 @@ LoadDTPerformanceLibraries(bool dontLoad) bool LoadDTPerformanceLibrary() { - void *DTPerformanceLibrary = LoadDTPerformanceLibraries(true); + void* DTPerformanceLibrary = LoadDTPerformanceLibraries(true); if (!DTPerformanceLibrary) { DTPerformanceLibrary = LoadDTPerformanceLibraries(false); if (!DTPerformanceLibrary) { diff --git a/js/src/devtools/sharkctl.cpp b/js/src/devtools/sharkctl.cpp index 86fdfc936d..9d5a594d6d 100644 --- a/js/src/devtools/sharkctl.cpp +++ b/js/src/devtools/sharkctl.cpp @@ -22,8 +22,8 @@ #define RECV_SIZEOF(ty) offsetof(ty, out) // Private API in libSystem.dylib -extern "C" void bootstrap_look_up(mach_port_t special_port, const char *name, - mach_port_t *dest_port); +extern "C" void bootstrap_look_up(mach_port_t special_port, const char* name, + mach_port_t* dest_port); struct chud_client_acquire_msg { mach_msg_header_t hdr; diff --git a/js/src/ds/BitArray.h b/js/src/ds/BitArray.h index b39ffae286..2a55142f91 100644 --- a/js/src/ds/BitArray.h +++ b/js/src/ds/BitArray.h @@ -62,7 +62,7 @@ class BitArray private: inline void getMarkWordAndMask(size_t offset, - uintptr_t *indexp, uintptr_t *maskp) const { + uintptr_t* indexp, uintptr_t* maskp) const { static_assert(bitsPerElement == 32 || bitsPerElement == 64, "unexpected bitsPerElement value"); *indexp = offset / bitsPerElement; diff --git a/js/src/ds/FixedSizeHash.h b/js/src/ds/FixedSizeHash.h index 5a6985de7e..be2923a0b5 100644 --- a/js/src/ds/FixedSizeHash.h +++ b/js/src/ds/FixedSizeHash.h @@ -30,7 +30,7 @@ namespace js { * * void hash(Lookup, HashNumber[NumHashes]) - Compute all hashes for an entry. * - * void clear(T *) - Clear an entry, such that isCleared() holds afterwards. + * void clear(T*) - Clear an entry, such that isCleared() holds afterwards. * * bool isCleared(T) - Test whether an entry has been cleared. */ @@ -53,7 +53,7 @@ class FixedSizeHashSet JS_ASSERT(HashPolicy::isCleared(entries[0])); } - bool lookup(const Lookup &lookup, T *pentry) + bool lookup(const Lookup& lookup, T* pentry) { size_t bucket; if (lookupReference(lookup, &bucket)) { @@ -64,14 +64,14 @@ class FixedSizeHashSet return false; } - void insert(const Lookup &lookup, const T &entry) + void insert(const Lookup& lookup, const T& entry) { size_t buckets[NumHashes]; getBuckets(lookup, buckets); size_t min = buckets[0]; for (size_t i = 0; i < NumHashes; i++) { - const T &entry = entries[buckets[i]]; + const T& entry = entries[buckets[i]]; if (HashPolicy::isCleared(entry)) { entries[buckets[i]] = entry; lastOperations[buckets[i]] = numOperations++; @@ -86,7 +86,7 @@ class FixedSizeHashSet } template - void remove(const S &s) + void remove(const S& s) { size_t bucket; if (lookupReference(s, &bucket)) @@ -95,13 +95,13 @@ class FixedSizeHashSet private: template - bool lookupReference(const S &s, size_t *pbucket) + bool lookupReference(const S& s, size_t* pbucket) { size_t buckets[NumHashes]; getBuckets(s, buckets); for (size_t i = 0; i < NumHashes; i++) { - const T &entry = entries[buckets[i]]; + const T& entry = entries[buckets[i]]; if (!HashPolicy::isCleared(entry) && HashPolicy::match(entry, s)) { *pbucket = buckets[i]; return true; @@ -112,7 +112,7 @@ class FixedSizeHashSet } template - void getBuckets(const S &s, size_t buckets[NumHashes]) + void getBuckets(const S& s, size_t buckets[NumHashes]) { HashNumber hashes[NumHashes]; HashPolicy::hash(s, hashes); diff --git a/js/src/ds/InlineMap.h b/js/src/ds/InlineMap.h index ff6f2d06ad..0cadddf16b 100644 --- a/js/src/ds/InlineMap.h +++ b/js/src/ds/InlineMap.h @@ -18,7 +18,7 @@ namespace js { * (and thus may be used as a tombstone value by InlineMap). */ template struct ZeroIsReserved { static const bool result = false; }; -template struct ZeroIsReserved { static const bool result = true; }; +template struct ZeroIsReserved { static const bool result = true; }; template class InlineMap @@ -61,7 +61,7 @@ class InlineMap JS_ASSERT(map.initialized()); } - for (InlineElem *it = inl, *end = inl + inlNext; it != end; ++it) { + for (InlineElem* it = inl, *end = inl + inlNext; it != end; ++it) { if (it->key && !map.putNew(it->key, it->value)) return false; } @@ -73,7 +73,7 @@ class InlineMap } MOZ_NEVER_INLINE - bool switchAndAdd(const K &key, const V &value) { + bool switchAndAdd(const K& key, const V& value) { if (!switchToMap()) return false; @@ -89,14 +89,14 @@ class InlineMap class Entry { friend class InlineMap; - const K &key_; - V &value_; + const K& key_; + V& value_; - Entry(const K &key, V &value) : key_(key), value_(value) {} + Entry(const K& key, V& value) : key_(key), value_(value) {} public: - const K &key() { return key_; } - V &value() { return value_; } + const K& key() { return key_; } + V& value() { return value_; } }; /* class Entry */ class Ptr @@ -104,20 +104,20 @@ class InlineMap friend class InlineMap; WordMapPtr mapPtr; - InlineElem *inlPtr; + InlineElem* inlPtr; bool isInlinePtr; typedef Ptr ******* ConvertibleToBool; explicit Ptr(WordMapPtr p) : mapPtr(p), isInlinePtr(false) {} - explicit Ptr(InlineElem *ie) : inlPtr(ie), isInlinePtr(true) {} - void operator==(const Ptr &other); + explicit Ptr(InlineElem* ie) : inlPtr(ie), isInlinePtr(true) {} + void operator==(const Ptr& other); public: /* Leaves Ptr uninitialized. */ Ptr() { #ifdef DEBUG - inlPtr = (InlineElem *) 0xbad; + inlPtr = (InlineElem*) 0xbad; isInlinePtr = true; #endif } @@ -132,12 +132,12 @@ class InlineMap return ConvertibleToBool(found()); } - K &key() { + K& key() { JS_ASSERT(found()); return isInlinePtr ? inlPtr->key : mapPtr->key(); } - V &value() { + V& value() { JS_ASSERT(found()); return isInlinePtr ? inlPtr->value : mapPtr->value(); } @@ -148,18 +148,18 @@ class InlineMap friend class InlineMap; WordMapAddPtr mapAddPtr; - InlineElem *inlAddPtr; + InlineElem* inlAddPtr; bool isInlinePtr; /* Indicates whether inlAddPtr is a found result or an add pointer. */ bool inlPtrFound; - AddPtr(InlineElem *ptr, bool found) + AddPtr(InlineElem* ptr, bool found) : inlAddPtr(ptr), isInlinePtr(true), inlPtrFound(found) {} - AddPtr(const WordMapAddPtr &p) : mapAddPtr(p), isInlinePtr(false) {} + AddPtr(const WordMapAddPtr& p) : mapAddPtr(p), isInlinePtr(false) {} - void operator==(const AddPtr &other); + void operator==(const AddPtr& other); typedef AddPtr ******* ConvertibleToBool; @@ -174,7 +174,7 @@ class InlineMap return found() ? ConvertibleToBool(1) : ConvertibleToBool(0); } - V &value() { + V& value() { JS_ASSERT(found()); if (isInlinePtr) return inlAddPtr->value; @@ -199,27 +199,27 @@ class InlineMap return usingMap(); } - const WordMap &asMap() const { + const WordMap& asMap() const { JS_ASSERT(isMap()); return map; } - const InlineElem *asInline() const { + const InlineElem* asInline() const { JS_ASSERT(!isMap()); return inl; } - const InlineElem *inlineEnd() const { + const InlineElem* inlineEnd() const { JS_ASSERT(!isMap()); return inl + inlNext; } MOZ_ALWAYS_INLINE - Ptr lookup(const K &key) { + Ptr lookup(const K& key) { if (usingMap()) return Ptr(map.lookup(key)); - for (InlineElem *it = inl, *end = inl + inlNext; it != end; ++it) { + for (InlineElem* it = inl, *end = inl + inlNext; it != end; ++it) { if (it->key == key) return Ptr(it); } @@ -228,11 +228,11 @@ class InlineMap } MOZ_ALWAYS_INLINE - AddPtr lookupForAdd(const K &key) { + AddPtr lookupForAdd(const K& key) { if (usingMap()) return AddPtr(map.lookupForAdd(key)); - for (InlineElem *it = inl, *end = inl + inlNext; it != end; ++it) { + for (InlineElem* it = inl, *end = inl + inlNext; it != end; ++it) { if (it->key == key) return AddPtr(it, true); } @@ -246,11 +246,11 @@ class InlineMap } MOZ_ALWAYS_INLINE - bool add(AddPtr &p, const K &key, const V &value) { + bool add(AddPtr& p, const K& key, const V& value) { JS_ASSERT(!p); if (p.isInlinePtr) { - InlineElem *addPtr = p.inlAddPtr; + InlineElem* addPtr = p.inlAddPtr; JS_ASSERT(addPtr == inl + inlNext); /* Switching to map mode before we add this pointer. */ @@ -270,7 +270,7 @@ class InlineMap } MOZ_ALWAYS_INLINE - bool put(const K &key, const V &value) { + bool put(const K& key, const V& value) { AddPtr p = lookupForAdd(key); if (p) { p.value() = value; @@ -292,7 +292,7 @@ class InlineMap map.remove(p.mapPtr); } - void remove(const K &key) { + void remove(const K& key) { if (Ptr p = lookup(key)) remove(p); } @@ -302,8 +302,8 @@ class InlineMap friend class InlineMap; WordMapRange mapRange; - InlineElem *cur; - InlineElem *end; + InlineElem* cur; + InlineElem* end; bool isInline; explicit Range(WordMapRange r) @@ -313,9 +313,9 @@ class InlineMap JS_ASSERT(!isInlineRange()); } - Range(const InlineElem *begin, const InlineElem *end_) - : cur(const_cast(begin)), - end(const_cast(end_)), + Range(const InlineElem* begin, const InlineElem* end_) + : cur(const_cast(begin)), + end(const_cast(end_)), isInline(true) { advancePastNulls(cur); JS_ASSERT(isInlineRange()); @@ -332,8 +332,8 @@ class InlineMap return isInline; } - void advancePastNulls(InlineElem *begin) { - InlineElem *newCur = begin; + void advancePastNulls(InlineElem* begin) { + InlineElem* newCur = begin; while (newCur < end && nullptr == newCur->key) ++newCur; JS_ASSERT(uintptr_t(newCur) <= uintptr_t(end)); @@ -345,7 +345,7 @@ class InlineMap advancePastNulls(cur + 1); } - void operator==(const Range &other); + void operator==(const Range& other); public: bool empty() const { diff --git a/js/src/ds/LifoAlloc.cpp b/js/src/ds/LifoAlloc.cpp index 950858089c..6015dbf1e3 100644 --- a/js/src/ds/LifoAlloc.cpp +++ b/js/src/ds/LifoAlloc.cpp @@ -16,14 +16,14 @@ using mozilla::tl::BitSize; namespace js { namespace detail { -BumpChunk * +BumpChunk* BumpChunk::new_(size_t chunkSize) { JS_ASSERT(RoundUpPow2(chunkSize) == chunkSize); - void *mem = js_malloc(chunkSize); + void* mem = js_malloc(chunkSize); if (!mem) return nullptr; - BumpChunk *result = new (mem) BumpChunk(chunkSize - sizeof(BumpChunk)); + BumpChunk* result = new (mem) BumpChunk(chunkSize - sizeof(BumpChunk)); // We assume that the alignment of sAlign is less than that of // the underlying memory allocator -- creating a new BumpChunk should @@ -33,7 +33,7 @@ BumpChunk::new_(size_t chunkSize) } void -BumpChunk::delete_(BumpChunk *chunk) +BumpChunk::delete_(BumpChunk* chunk) { #ifdef DEBUG // Part of the chunk may have been marked as poisoned/noaccess. Undo that @@ -48,8 +48,8 @@ BumpChunk::delete_(BumpChunk *chunk) bool BumpChunk::canAlloc(size_t n) { - char *aligned = AlignPtr(bump); - char *bumped = aligned + n; + char* aligned = AlignPtr(bump); + char* bumped = aligned + n; return bumped <= limit && bumped > headerBase(); } @@ -60,7 +60,7 @@ void LifoAlloc::freeAll() { while (first) { - BumpChunk *victim = first; + BumpChunk* victim = first; first = first->next(); decrementCurSize(victim->computedSizeOfIncludingThis()); BumpChunk::delete_(victim); @@ -72,7 +72,7 @@ LifoAlloc::freeAll() JS_ASSERT(curSize_ == 0); } -LifoAlloc::BumpChunk * +LifoAlloc::BumpChunk* LifoAlloc::getOrCreateChunk(size_t n) { if (first) { @@ -102,7 +102,7 @@ LifoAlloc::getOrCreateChunk(size_t n) } // If we get here, we couldn't find an existing BumpChunk to fill the request. - BumpChunk *newChunk = BumpChunk::new_(chunkSize); + BumpChunk* newChunk = BumpChunk::new_(chunkSize); if (!newChunk) return nullptr; if (!first) { @@ -121,7 +121,7 @@ LifoAlloc::getOrCreateChunk(size_t n) } void -LifoAlloc::transferFrom(LifoAlloc *other) +LifoAlloc::transferFrom(LifoAlloc* other) { JS_ASSERT(!markCount); JS_ASSERT(!other->markCount); @@ -139,7 +139,7 @@ LifoAlloc::transferFrom(LifoAlloc *other) } void -LifoAlloc::transferUnusedFrom(LifoAlloc *other) +LifoAlloc::transferUnusedFrom(LifoAlloc* other) { JS_ASSERT(!markCount); JS_ASSERT(latest == first); @@ -156,7 +156,7 @@ LifoAlloc::transferUnusedFrom(LifoAlloc *other) other->decrementCurSize(delta); incrementCurSize(delta); } else { - for (BumpChunk *chunk = other->latest->next(); chunk; chunk = chunk->next()) { + for (BumpChunk* chunk = other->latest->next(); chunk; chunk = chunk->next()) { size_t size = chunk->computedSizeOfIncludingThis(); incrementCurSize(size); other->decrementCurSize(size); diff --git a/js/src/ds/LifoAlloc.h b/js/src/ds/LifoAlloc.h index b1123537dd..fa6a38cf24 100644 --- a/js/src/ds/LifoAlloc.h +++ b/js/src/ds/LifoAlloc.h @@ -29,14 +29,14 @@ namespace detail { static const size_t LIFO_ALLOC_ALIGN = 8; MOZ_ALWAYS_INLINE -char * -AlignPtr(void *orig) +char* +AlignPtr(void* orig) { static_assert(mozilla::tl::FloorLog2::value == mozilla::tl::CeilingLog2::value, "LIFO_ALLOC_ALIGN must be a power of two"); - char *result = (char *) ((uintptr_t(orig) + (LIFO_ALLOC_ALIGN - 1)) & (~LIFO_ALLOC_ALIGN + 1)); + char* result = (char*) ((uintptr_t(orig) + (LIFO_ALLOC_ALIGN - 1)) & (~LIFO_ALLOC_ALIGN + 1)); JS_ASSERT(uintptr_t(result) % LIFO_ALLOC_ALIGN == 0); return result; } @@ -44,29 +44,29 @@ AlignPtr(void *orig) // Header for a chunk of memory wrangled by the LifoAlloc. class BumpChunk { - char *bump; // start of the available data - char *limit; // end of the data - BumpChunk *next_; // the next BumpChunk + char* bump; // start of the available data + char* limit; // end of the data + BumpChunk* next_; // the next BumpChunk size_t bumpSpaceSize; // size of the data area - char *headerBase() { return reinterpret_cast(this); } - char *bumpBase() const { return limit - bumpSpaceSize; } + char* headerBase() { return reinterpret_cast(this); } + char* bumpBase() const { return limit - bumpSpaceSize; } explicit BumpChunk(size_t bumpSpaceSize) - : bump(reinterpret_cast(MOZ_THIS_IN_INITIALIZER_LIST()) + sizeof(BumpChunk)), + : bump(reinterpret_cast(MOZ_THIS_IN_INITIALIZER_LIST()) + sizeof(BumpChunk)), limit(bump + bumpSpaceSize), next_(nullptr), bumpSpaceSize(bumpSpaceSize) { JS_ASSERT(bump == AlignPtr(bump)); } - void setBump(void *ptr) { + void setBump(void* ptr) { JS_ASSERT(bumpBase() <= ptr); JS_ASSERT(ptr <= limit); #if defined(DEBUG) || defined(MOZ_HAVE_MEM_CHECKS) char* prevBump = bump; #endif - bump = static_cast(ptr); + bump = static_cast(ptr); #ifdef DEBUG JS_ASSERT(contains(prevBump)); @@ -85,13 +85,13 @@ class BumpChunk } public: - BumpChunk *next() const { return next_; } - void setNext(BumpChunk *succ) { next_ = succ; } + BumpChunk* next() const { return next_; } + void setNext(BumpChunk* succ) { next_ = succ; } size_t used() const { return bump - bumpBase(); } - void *start() const { return bumpBase(); } - void *end() const { return limit; } + void* start() const { return bumpBase(); } + void* end() const { return limit; } size_t sizeOfIncludingThis(mozilla::MallocSizeOf mallocSizeOf) { return mallocSizeOf(this); @@ -105,15 +105,15 @@ class BumpChunk setBump(headerBase() + sizeof(BumpChunk)); } - void *mark() const { return bump; } + void* mark() const { return bump; } - void release(void *mark) { + void release(void* mark) { JS_ASSERT(contains(mark)); JS_ASSERT(mark <= bump); setBump(mark); } - bool contains(void *mark) const { + bool contains(void* mark) const { return bumpBase() <= mark && mark <= limit; } @@ -125,9 +125,9 @@ class BumpChunk // Try to perform an allocation of size |n|, return null if not possible. MOZ_ALWAYS_INLINE - void *tryAlloc(size_t n) { - char *aligned = AlignPtr(bump); - char *newBump = aligned + n; + void* tryAlloc(size_t n) { + char* aligned = AlignPtr(bump); + char* newBump = aligned + n; if (newBump > limit) return nullptr; @@ -141,8 +141,8 @@ class BumpChunk return aligned; } - static BumpChunk *new_(size_t chunkSize); - static void delete_(BumpChunk *chunk); + static BumpChunk* new_(size_t chunkSize); + static void delete_(BumpChunk* chunk); }; } // namespace detail @@ -155,23 +155,23 @@ class LifoAlloc { typedef detail::BumpChunk BumpChunk; - BumpChunk *first; - BumpChunk *latest; - BumpChunk *last; + BumpChunk* first; + BumpChunk* latest; + BumpChunk* last; size_t markCount; size_t defaultChunkSize_; size_t curSize_; size_t peakSize_; - void operator=(const LifoAlloc &) MOZ_DELETE; - LifoAlloc(const LifoAlloc &) MOZ_DELETE; + void operator=(const LifoAlloc&) MOZ_DELETE; + LifoAlloc(const LifoAlloc&) MOZ_DELETE; // Return a BumpChunk that can perform an allocation of at least size |n| // and add it to the chain appropriately. // // Side effect: if retval is non-null, |first| and |latest| are initialized // appropriately. - BumpChunk *getOrCreateChunk(size_t n); + BumpChunk* getOrCreateChunk(size_t n); void reset(size_t defaultChunkSize) { JS_ASSERT(mozilla::RoundUpPow2(defaultChunkSize) == defaultChunkSize); @@ -182,7 +182,7 @@ class LifoAlloc } // Append unused chunks to the end of this LifoAlloc. - void appendUnused(BumpChunk *start, BumpChunk *end) { + void appendUnused(BumpChunk* start, BumpChunk* end) { JS_ASSERT(start && end); if (last) last->setNext(start); @@ -193,7 +193,7 @@ class LifoAlloc // Append used chunks to the end of this LifoAlloc. We act as if all the // chunks in |this| are used, even if they're not, so memory may be wasted. - void appendUsed(BumpChunk *otherFirst, BumpChunk *otherLatest, BumpChunk *otherLast) { + void appendUsed(BumpChunk* otherFirst, BumpChunk* otherLatest, BumpChunk* otherLast) { JS_ASSERT(otherFirst && otherLatest && otherLast); if (last) last->setNext(otherFirst); @@ -221,7 +221,7 @@ class LifoAlloc } // Steal allocated chunks from |other|. - void steal(LifoAlloc *other) { + void steal(LifoAlloc* other) { JS_ASSERT(!other->markCount); // Copy everything from |other| to |this| except for |peakSize_|, which @@ -234,10 +234,10 @@ class LifoAlloc } // Append all chunks from |other|. They are removed from |other|. - void transferFrom(LifoAlloc *other); + void transferFrom(LifoAlloc* other); // Append unused chunks from |other|. They are removed from |other|. - void transferUnusedFrom(LifoAlloc *other); + void transferUnusedFrom(LifoAlloc* other); ~LifoAlloc() { freeAll(); } @@ -253,10 +253,10 @@ class LifoAlloc } MOZ_ALWAYS_INLINE - void *alloc(size_t n) { + void* alloc(size_t n) { JS_OOM_POSSIBLY_FAIL(); - void *result; + void* result; if (latest && (result = latest->tryAlloc(n))) return result; @@ -275,12 +275,12 @@ class LifoAlloc MOZ_ALWAYS_INLINE bool ensureUnusedApproximate(size_t n) { size_t total = 0; - for (BumpChunk *chunk = latest; chunk; chunk = chunk->next()) { + for (BumpChunk* chunk = latest; chunk; chunk = chunk->next()) { total += chunk->unused(); if (total >= n) return true; } - BumpChunk *latestBefore = latest; + BumpChunk* latestBefore = latest; if (!getOrCreateChunk(n)) return false; if (latestBefore) @@ -289,7 +289,7 @@ class LifoAlloc } template - T *newArray(size_t count) { + T* newArray(size_t count) { JS_STATIC_ASSERT(mozilla::IsPod::value); return newArrayUninitialized(count); } @@ -297,17 +297,17 @@ class LifoAlloc // Create an array with uninitialized elements of type |T|. // The caller is responsible for initialization. template - T *newArrayUninitialized(size_t count) { + T* newArrayUninitialized(size_t count) { if (count & mozilla::tl::MulOverflowMask::value) return nullptr; - return static_cast(alloc(sizeof(T) * count)); + return static_cast(alloc(sizeof(T) * count)); } class Mark { - BumpChunk *chunk; - void *markInChunk; + BumpChunk* chunk; + void* markInChunk; friend class LifoAlloc; - Mark(BumpChunk *chunk, void *markInChunk) : chunk(chunk), markInChunk(markInChunk) {} + Mark(BumpChunk* chunk, void* markInChunk) : chunk(chunk), markInChunk(markInChunk) {} public: Mark() : chunk(nullptr), markInChunk(nullptr) {} }; @@ -339,7 +339,7 @@ class LifoAlloc // Get the total "used" (occupied bytes) count for the arena chunks. size_t used() const { size_t accum = 0; - for (BumpChunk *chunk = first; chunk; chunk = chunk->next()) { + for (BumpChunk* chunk = first; chunk; chunk = chunk->next()) { accum += chunk->used(); if (chunk == latest) break; @@ -363,7 +363,7 @@ class LifoAlloc // Get the total size of the arena chunks (including unused space). size_t sizeOfExcludingThis(mozilla::MallocSizeOf mallocSizeOf) const { size_t n = 0; - for (BumpChunk *chunk = first; chunk; chunk = chunk->next()) + for (BumpChunk* chunk = first; chunk; chunk = chunk->next()) n += chunk->sizeOfIncludingThis(mallocSizeOf); return n; } @@ -380,8 +380,8 @@ class LifoAlloc // Doesn't perform construction; useful for lazily-initialized POD types. template MOZ_ALWAYS_INLINE - T *newPod() { - return static_cast(alloc(sizeof(T))); + T* newPod() { + return static_cast(alloc(sizeof(T))); } JS_DECLARE_NEW_METHODS(new_, alloc, MOZ_ALWAYS_INLINE) @@ -392,18 +392,18 @@ class LifoAlloc friend class LifoAlloc; friend class detail::BumpChunk; - LifoAlloc *alloc_; // The LifoAlloc being traversed. - BumpChunk *chunk_; // The current chunk. - char *position_; // The current position (must be within chunk_). + LifoAlloc* alloc_; // The LifoAlloc being traversed. + BumpChunk* chunk_; // The current chunk. + char* position_; // The current position (must be within chunk_). // If there is not enough room in the remaining block for |size|, // advance to the next block and update the position. void ensureSpaceAndAlignment(size_t size) { JS_ASSERT(!empty()); - char *aligned = detail::AlignPtr(position_); + char* aligned = detail::AlignPtr(position_); if (aligned + size > chunk_->end()) { chunk_ = chunk_->next(); - position_ = static_cast(chunk_->start()); + position_ = static_cast(chunk_->start()); } else { position_ = aligned; } @@ -411,10 +411,10 @@ class LifoAlloc } public: - Enum(LifoAlloc &alloc) + Enum(LifoAlloc& alloc) : alloc_(&alloc), chunk_(alloc.first), - position_(static_cast(alloc.first ? alloc.first->start() : nullptr)) + position_(static_cast(alloc.first ? alloc.first->start() : nullptr)) {} // Return true if there are no more bytes to enumerate. @@ -436,7 +436,7 @@ class LifoAlloc // Update the bytes at the current position with a new value. template - void updateFront(const T &t) { + void updateFront(const T& t) { ensureSpaceAndAlignment(sizeof(T)); memmove(position_, &t, sizeof(T)); } @@ -444,9 +444,9 @@ class LifoAlloc // Return a pointer to the item at the current position. This // returns a pointer to the inline storage, not a copy. template - T *get(size_t size = sizeof(T)) { + T* get(size_t size = sizeof(T)) { ensureSpaceAndAlignment(size); - return reinterpret_cast(position_); + return reinterpret_cast(position_); } // Return a Mark at the current position of the Enum. @@ -459,13 +459,13 @@ class LifoAlloc class LifoAllocScope { - LifoAlloc *lifoAlloc; + LifoAlloc* lifoAlloc; LifoAlloc::Mark mark; bool shouldRelease; MOZ_DECL_USE_GUARD_OBJECT_NOTIFIER public: - explicit LifoAllocScope(LifoAlloc *lifoAlloc + explicit LifoAllocScope(LifoAlloc* lifoAlloc MOZ_GUARD_OBJECT_NOTIFIER_PARAM) : lifoAlloc(lifoAlloc), mark(lifoAlloc->mark()), @@ -479,7 +479,7 @@ class LifoAllocScope lifoAlloc->release(mark); } - LifoAlloc &alloc() { + LifoAlloc& alloc() { return *lifoAlloc; } @@ -492,29 +492,29 @@ class LifoAllocScope class LifoAllocPolicy { - LifoAlloc &alloc_; + LifoAlloc& alloc_; public: - LifoAllocPolicy(LifoAlloc &alloc) + LifoAllocPolicy(LifoAlloc& alloc) : alloc_(alloc) {} - void *malloc_(size_t bytes) { + void* malloc_(size_t bytes) { return alloc_.alloc(bytes); } - void *calloc_(size_t bytes) { - void *p = malloc_(bytes); + void* calloc_(size_t bytes) { + void* p = malloc_(bytes); if (p) memset(p, 0, bytes); return p; } - void *realloc_(void *p, size_t oldBytes, size_t bytes) { - void *n = malloc_(bytes); + void* realloc_(void* p, size_t oldBytes, size_t bytes) { + void* n = malloc_(bytes); if (!n) return n; memcpy(n, p, Min(oldBytes, bytes)); return n; } - void free_(void *p) { + void free_(void* p) { } void reportAllocOverflow() const { } diff --git a/js/src/ds/PriorityQueue.h b/js/src/ds/PriorityQueue.h index 6009b2bc39..a1e5ab1570 100644 --- a/js/src/ds/PriorityQueue.h +++ b/js/src/ds/PriorityQueue.h @@ -26,8 +26,8 @@ class PriorityQueue { Vector heap; - PriorityQueue(const PriorityQueue &) MOZ_DELETE; - PriorityQueue &operator=(const PriorityQueue &) MOZ_DELETE; + PriorityQueue(const PriorityQueue&) MOZ_DELETE; + PriorityQueue& operator=(const PriorityQueue&) MOZ_DELETE; public: @@ -57,14 +57,14 @@ class PriorityQueue return highest; } - bool insert(const T &v) { + bool insert(const T& v) { if (!heap.append(v)) return false; siftUp(heap.length() - 1); return true; } - void infallibleInsert(const T &v) { + void infallibleInsert(const T& v) { heap.infallibleAppend(v); siftUp(heap.length() - 1); } diff --git a/js/src/ds/Sort.h b/js/src/ds/Sort.h index 39dfbdfd19..33460cd1b8 100644 --- a/js/src/ds/Sort.h +++ b/js/src/ds/Sort.h @@ -15,10 +15,10 @@ namespace detail { template MOZ_ALWAYS_INLINE void -CopyNonEmptyArray(T *dst, const T *src, size_t nelems) +CopyNonEmptyArray(T* dst, const T* src, size_t nelems) { JS_ASSERT(nelems != 0); - const T *end = src + nelems; + const T* end = src + nelems; do { *dst++ = *src++; } while (src != end); @@ -27,20 +27,20 @@ CopyNonEmptyArray(T *dst, const T *src, size_t nelems) /* Helper function for MergeSort. */ template MOZ_ALWAYS_INLINE bool -MergeArrayRuns(T *dst, const T *src, size_t run1, size_t run2, Comparator c) +MergeArrayRuns(T* dst, const T* src, size_t run1, size_t run2, Comparator c) { JS_ASSERT(run1 >= 1); JS_ASSERT(run2 >= 1); /* Copy runs already in sorted order. */ - const T *b = src + run1; + const T* b = src + run1; bool lessOrEqual; if (!c(b[-1], b[0], &lessOrEqual)) return false; if (!lessOrEqual) { /* Runs are not already sorted, merge them. */ - for (const T *a = src;;) { + for (const T* a = src;;) { if (!c(*a, *b, &lessOrEqual)) return false; if (lessOrEqual) { @@ -70,7 +70,7 @@ MergeArrayRuns(T *dst, const T *src, size_t run1, size_t run2, Comparator c) * * The comparator must provide the () operator with the following signature: * - * bool operator()(const T& a, const T& a, bool *lessOrEqualp); + * bool operator()(const T& a, const T& a, bool* lessOrEqualp); * * It should return true on success and set *lessOrEqualp to the result of * a <= b operation. If it returns false, the sort terminates immediately with @@ -79,7 +79,7 @@ MergeArrayRuns(T *dst, const T *src, size_t run1, size_t run2, Comparator c) */ template bool -MergeSort(T *array, size_t nelems, T *scratch, Comparator c) +MergeSort(T* array, size_t nelems, T* scratch, Comparator c) { const size_t INS_SORT_LIMIT = 3; @@ -110,8 +110,8 @@ MergeSort(T *array, size_t nelems, T *scratch, Comparator c) } } - T *vec1 = array; - T *vec2 = scratch; + T* vec1 = array; + T* vec2 = scratch; for (size_t run = INS_SORT_LIMIT; run < nelems; run *= 2) { for (size_t lo = 0; lo < nelems; lo += 2 * run) { size_t hi = lo + run; @@ -123,7 +123,7 @@ MergeSort(T *array, size_t nelems, T *scratch, Comparator c) if (!detail::MergeArrayRuns(vec2 + lo, vec1 + lo, run, run2, c)) return false; } - T *swap = vec1; + T* swap = vec1; vec1 = vec2; vec2 = swap; } diff --git a/js/src/ds/SplayTree.h b/js/src/ds/SplayTree.h index 019b008a01..d8300040d8 100644 --- a/js/src/ds/SplayTree.h +++ b/js/src/ds/SplayTree.h @@ -25,26 +25,26 @@ class SplayTree { struct Node { T item; - Node *left, *right, *parent; + Node* left, *right, *parent; - Node(const T &item) + Node(const T& item) : item(item), left(nullptr), right(nullptr), parent(nullptr) {} }; - LifoAlloc *alloc; - Node *root, *freeList; + LifoAlloc* alloc; + Node* root, *freeList; - SplayTree(const SplayTree &) MOZ_DELETE; - SplayTree &operator=(const SplayTree &) MOZ_DELETE; + SplayTree(const SplayTree&) MOZ_DELETE; + SplayTree& operator=(const SplayTree&) MOZ_DELETE; public: - SplayTree(LifoAlloc *alloc = nullptr) + SplayTree(LifoAlloc* alloc = nullptr) : alloc(alloc), root(nullptr), freeList(nullptr) {} - void setAllocator(LifoAlloc *alloc) { + void setAllocator(LifoAlloc* alloc) { this->alloc = alloc; } @@ -52,11 +52,11 @@ class SplayTree return !root; } - bool contains(const T &v, T *res) + bool contains(const T& v, T* res) { if (!root) return false; - Node *last = lookup(v); + Node* last = lookup(v); splay(last); checkCoherency(root, nullptr); if (C::compare(v, last->item) == 0) { @@ -66,9 +66,9 @@ class SplayTree return false; } - bool insert(const T &v) + bool insert(const T& v) { - Node *element = allocateNode(v); + Node* element = allocateNode(v); if (!element) return false; @@ -76,13 +76,13 @@ class SplayTree root = element; return true; } - Node *last = lookup(v); + Node* last = lookup(v); int cmp = C::compare(v, last->item); // Don't tolerate duplicate elements. JS_ASSERT(cmp); - Node *&parentPointer = (cmp < 0) ? last->left : last->right; + Node*& parentPointer = (cmp < 0) ? last->left : last->right; JS_ASSERT(!parentPointer); parentPointer = element; element->parent = last; @@ -92,9 +92,9 @@ class SplayTree return true; } - void remove(const T &v) + void remove(const T& v) { - Node *last = lookup(v); + Node* last = lookup(v); JS_ASSERT(last && C::compare(v, last->item) == 0); splay(last); @@ -103,7 +103,7 @@ class SplayTree // Find another node which can be swapped in for the root: either the // rightmost child of the root's left, or the leftmost child of the // root's right. - Node *swap, *swapChild; + Node* swap, *swapChild; if (root->left) { swap = root->left; while (swap->right) @@ -143,10 +143,10 @@ class SplayTree private: - Node *lookup(const T &v) + Node* lookup(const T& v) { JS_ASSERT(root); - Node *node = root, *parent; + Node* node = root, *parent; do { parent = node; int c = C::compare(v, node->item); @@ -160,9 +160,9 @@ class SplayTree return parent; } - Node *allocateNode(const T &v) + Node* allocateNode(const T& v) { - Node *node = freeList; + Node* node = freeList; if (node) { freeList = node->left; new(node) Node(v); @@ -171,27 +171,27 @@ class SplayTree return alloc->new_(v); } - void freeNode(Node *node) + void freeNode(Node* node) { node->left = freeList; freeList = node; } - void splay(Node *node) + void splay(Node* node) { // Rotate the element until it is at the root of the tree. Performing // the rotations in this fashion preserves the amortized balancing of // the tree. JS_ASSERT(node); while (node != root) { - Node *parent = node->parent; + Node* parent = node->parent; if (parent == root) { // Zig rotation. rotate(node); JS_ASSERT(node == root); return; } - Node *grandparent = parent->parent; + Node* grandparent = parent->parent; if ((parent->left == node) == (grandparent->left == parent)) { // Zig-zig rotation. rotate(parent); @@ -204,11 +204,11 @@ class SplayTree } } - void rotate(Node *node) + void rotate(Node* node) { // Rearrange nodes so that node becomes the parent of its current // parent, while preserving the sortedness of the tree. - Node *parent = node->parent; + Node* parent = node->parent; if (parent->left == node) { // x y // y c ==> a x @@ -229,7 +229,7 @@ class SplayTree } node->parent = parent->parent; parent->parent = node; - if (Node *grandparent = node->parent) { + if (Node* grandparent = node->parent) { if (grandparent->left == parent) grandparent->left = node; else @@ -240,7 +240,7 @@ class SplayTree } template - void forEachInner(Op op, Node *node) + void forEachInner(Op op, Node* node) { if (!node) return; @@ -250,7 +250,7 @@ class SplayTree forEachInner(op, node->right); } - Node *checkCoherency(Node *node, Node *minimum) + Node* checkCoherency(Node* node, Node* minimum) { #ifdef DEBUG if (!node) { @@ -261,7 +261,7 @@ class SplayTree JS_ASSERT_IF(minimum, C::compare(minimum->item, node->item) < 0); if (node->left) { JS_ASSERT(node->left->parent == node); - Node *leftMaximum = checkCoherency(node->left, minimum); + Node* leftMaximum = checkCoherency(node->left, minimum); JS_ASSERT(C::compare(leftMaximum->item, node->item) < 0); } if (node->right) { diff --git a/js/src/editline/editline.h b/js/src/editline/editline.h index 42e613531a..b849e58ad6 100644 --- a/js/src/editline/editline.h +++ b/js/src/editline/editline.h @@ -58,13 +58,13 @@ typedef unsigned char CHAR; #define MEM_INC 64 #define SCREEN_INC 256 -#define DISPOSE(p) free((char *)(p)) +#define DISPOSE(p) free((char*)(p)) #define NEW(T, c) \ - ((T *)malloc((unsigned int)(sizeof (T) * (c)))) + ((T*)malloc((unsigned int)(sizeof (T) * (c)))) #define RENEW(p, T, c) \ - (p = (T *)realloc((char *)(p), (unsigned int)(sizeof (T) * (c)))) + (p = (T*)realloc((char*)(p), (unsigned int)(sizeof (T) * (c)))) #define COPYFROMTO(new, p, len) \ - (void)memcpy((char *)(new), (char *)(p), (int)(len)) + (void)memcpy((char*)(new), (char*)(p), (int)(len)) /* diff --git a/js/src/frontend/BytecodeCompiler.cpp b/js/src/frontend/BytecodeCompiler.cpp index 5aacc23930..966daaed5a 100644 --- a/js/src/frontend/BytecodeCompiler.cpp +++ b/js/src/frontend/BytecodeCompiler.cpp @@ -27,7 +27,7 @@ using namespace js::frontend; using mozilla::Maybe; static bool -CheckLength(ExclusiveContext *cx, SourceBufferHolder &srcBuf) +CheckLength(ExclusiveContext* cx, SourceBufferHolder& srcBuf) { // Note this limit is simply so we can store sourceStart and sourceEnd in // JSScript as 32-bits. It could be lifted fairly easily, since the compiler @@ -42,7 +42,7 @@ CheckLength(ExclusiveContext *cx, SourceBufferHolder &srcBuf) } static bool -SetDisplayURL(ExclusiveContext *cx, TokenStream &tokenStream, ScriptSource *ss) +SetDisplayURL(ExclusiveContext* cx, TokenStream& tokenStream, ScriptSource* ss) { if (tokenStream.hasDisplayURL()) { if (!ss->setDisplayURL(cx, tokenStream.displayURL())) @@ -52,7 +52,7 @@ SetDisplayURL(ExclusiveContext *cx, TokenStream &tokenStream, ScriptSource *ss) } static bool -SetSourceMap(ExclusiveContext *cx, TokenStream &tokenStream, ScriptSource *ss) +SetSourceMap(ExclusiveContext* cx, TokenStream& tokenStream, ScriptSource* ss) { if (tokenStream.hasSourceMapURL()) { if (!ss->setSourceMapURL(cx, tokenStream.sourceMapURL())) @@ -62,7 +62,7 @@ SetSourceMap(ExclusiveContext *cx, TokenStream &tokenStream, ScriptSource *ss) } static bool -CheckArgumentsWithinEval(JSContext *cx, Parser &parser, HandleFunction fun) +CheckArgumentsWithinEval(JSContext* cx, Parser& parser, HandleFunction fun) { if (fun->hasRest()) { // It's an error to use |arguments| in a function that has a rest @@ -91,15 +91,15 @@ CheckArgumentsWithinEval(JSContext *cx, Parser &parser, Handle } static bool -MaybeCheckEvalFreeVariables(ExclusiveContext *cxArg, HandleScript evalCaller, HandleObject scopeChain, - Parser &parser, - ParseContext &pc) +MaybeCheckEvalFreeVariables(ExclusiveContext* cxArg, HandleScript evalCaller, HandleObject scopeChain, + Parser& parser, + ParseContext& pc) { if (!evalCaller || !evalCaller->functionOrCallerFunction()) return true; // Eval scripts are only compiled on the main thread. - JSContext *cx = cxArg->asJSContext(); + JSContext* cx = cxArg->asJSContext(); // Watch for uses of 'arguments' within the evaluated script, both as // free variables and as variables redeclared with 'var'. @@ -142,7 +142,7 @@ MaybeCheckEvalFreeVariables(ExclusiveContext *cxArg, HandleScript evalCaller, Ha } static inline bool -CanLazilyParse(ExclusiveContext *cx, const ReadOnlyCompileOptions &options) +CanLazilyParse(ExclusiveContext* cx, const ReadOnlyCompileOptions& options) { return options.canLazilyParse && options.compileAndGo && @@ -153,7 +153,7 @@ CanLazilyParse(ExclusiveContext *cx, const ReadOnlyCompileOptions &options) } static void -MarkFunctionsWithinEvalScript(JSScript *script) +MarkFunctionsWithinEvalScript(JSScript* script) { // Mark top level functions in an eval script as being within an eval and, // if applicable, inside a with statement. @@ -161,13 +161,13 @@ MarkFunctionsWithinEvalScript(JSScript *script) if (!script->hasObjects()) return; - ObjectArray *objects = script->objects(); + ObjectArray* objects = script->objects(); size_t start = script->innerObjectsStart(); for (size_t i = start; i < objects->length; i++) { - JSObject *obj = objects->vector[i]; + JSObject* obj = objects->vector[i]; if (obj->is()) { - JSFunction *fun = &obj->as(); + JSFunction* fun = &obj->as(); if (fun->hasScript()) fun->nonLazyScript()->setDirectlyInsideEval(); else if (fun->isInterpretedLazy()) @@ -177,23 +177,23 @@ MarkFunctionsWithinEvalScript(JSScript *script) } void -frontend::MaybeCallSourceHandler(JSContext *cx, const ReadOnlyCompileOptions &options, - SourceBufferHolder &srcBuf) +frontend::MaybeCallSourceHandler(JSContext* cx, const ReadOnlyCompileOptions& options, + SourceBufferHolder& srcBuf) { JSSourceHandler listener = cx->runtime()->debugHooks.sourceHandler; - void *listenerData = cx->runtime()->debugHooks.sourceHandlerData; + void* listenerData = cx->runtime()->debugHooks.sourceHandlerData; if (listener) { - void *listenerTSData; + void* listenerTSData; listener(options.filename(), options.lineno, srcBuf.get(), srcBuf.length(), &listenerTSData, listenerData); } } -ScriptSourceObject * -frontend::CreateScriptSourceObject(ExclusiveContext *cx, const ReadOnlyCompileOptions &options) +ScriptSourceObject* +frontend::CreateScriptSourceObject(ExclusiveContext* cx, const ReadOnlyCompileOptions& options) { - ScriptSource *ss = cx->new_(); + ScriptSource* ss = cx->new_(); if (!ss) return nullptr; ScriptSourceHolder ssHolder(ss); @@ -204,20 +204,20 @@ frontend::CreateScriptSourceObject(ExclusiveContext *cx, const ReadOnlyCompileOp return ScriptSourceObject::create(cx, ss, options); } -JSScript * -frontend::CompileScript(ExclusiveContext *cx, LifoAlloc *alloc, HandleObject scopeChain, +JSScript* +frontend::CompileScript(ExclusiveContext* cx, LifoAlloc* alloc, HandleObject scopeChain, HandleScript evalCaller, - const ReadOnlyCompileOptions &options, - SourceBufferHolder &srcBuf, - JSString *source_ /* = nullptr */, + const ReadOnlyCompileOptions& options, + SourceBufferHolder& srcBuf, + JSString* source_ /* = nullptr */, unsigned staticLevel /* = 0 */, - SourceCompressionTask *extraSct /* = nullptr */) + SourceCompressionTask* extraSct /* = nullptr */) { JS_ASSERT(srcBuf.get()); RootedString source(cx, source_); - js::TraceLogger *logger = nullptr; + js::TraceLogger* logger = nullptr; if (cx->isJSContext()) logger = TraceLoggerForMainThread(cx->asJSContext()->runtime()); else @@ -245,10 +245,10 @@ frontend::CompileScript(ExclusiveContext *cx, LifoAlloc *alloc, HandleObject sco if (!sourceObject) return nullptr; - ScriptSource *ss = sourceObject->source(); + ScriptSource* ss = sourceObject->source(); SourceCompressionTask mysct(cx); - SourceCompressionTask *sct = extraSct ? extraSct : &mysct; + SourceCompressionTask* sct = extraSct ? extraSct : &mysct; if (!cx->compartment()->options().discardSource()) { if (options.sourceIsLazy) @@ -263,8 +263,8 @@ frontend::CompileScript(ExclusiveContext *cx, LifoAlloc *alloc, HandleObject sco if (canLazilyParse) { syntaxParser.construct(cx, alloc, options, srcBuf.get(), srcBuf.length(), /* foldConstants = */ false, - (Parser *) nullptr, - (LazyScript *) nullptr); + (Parser*) nullptr, + (LazyScript*) nullptr); } Parser parser(cx, alloc, options, srcBuf.get(), srcBuf.length(), @@ -285,7 +285,7 @@ frontend::CompileScript(ExclusiveContext *cx, LifoAlloc *alloc, HandleObject sco return nullptr; // We can specialize a bit for the given scope chain if that scope chain is the global object. - JSObject *globalScope = + JSObject* globalScope = scopeChain && scopeChain == &scopeChain->global() ? (JSObject*) scopeChain : nullptr; JS_ASSERT_IF(globalScope, globalScope->isNative()); JS_ASSERT_IF(globalScope, JSCLASS_HAS_GLOBAL_FLAG_AND_SLOTS(globalScope->getClass())); @@ -302,8 +302,8 @@ frontend::CompileScript(ExclusiveContext *cx, LifoAlloc *alloc, HandleObject sco // reset when this occurs. Maybe > pc; - pc.construct(&parser, (GenericParseContext *) nullptr, (ParseNode *) nullptr, &globalsc, - (Directives *) nullptr, staticLevel, /* bodyid = */ 0, + pc.construct(&parser, (GenericParseContext*) nullptr, (ParseNode*) nullptr, &globalsc, + (Directives*) nullptr, staticLevel, /* bodyid = */ 0, /* blockScopeDepth = */ 0); if (!pc.ref().init(parser.tokenStream)) return nullptr; @@ -318,7 +318,7 @@ frontend::CompileScript(ExclusiveContext *cx, LifoAlloc *alloc, HandleObject sco * Save eval program source in script->atoms[0] for the * eval cache (see EvalCacheLookup in jsobj.cpp). */ - JSAtom *atom = AtomizeString(cx, source); + JSAtom* atom = AtomizeString(cx, source); jsatomid _; if (!atom || !bce.makeAtomIndex(atom, &_)) return nullptr; @@ -330,9 +330,9 @@ frontend::CompileScript(ExclusiveContext *cx, LifoAlloc *alloc, HandleObject sco * function captured in case it refers to an upvar, and someone * wishes to decompile it while it's running. */ - JSFunction *fun = evalCaller->functionOrCallerFunction(); + JSFunction* fun = evalCaller->functionOrCallerFunction(); Directives directives(/* strict = */ fun->strict()); - ObjectBox *funbox = parser.newFunctionBox(/* fn = */ nullptr, fun, pc.addr(), + ObjectBox* funbox = parser.newFunctionBox(/* fn = */ nullptr, fun, pc.addr(), directives, fun->generatorKind()); if (!funbox) return nullptr; @@ -353,7 +353,7 @@ frontend::CompileScript(ExclusiveContext *cx, LifoAlloc *alloc, HandleObject sco TokenStream::Position pos(parser.keepAtoms); parser.tokenStream.tell(&pos); - ParseNode *pn = parser.statement(canHaveDirectives); + ParseNode* pn = parser.statement(canHaveDirectives); if (!pn) { if (parser.hadAbortedSyntaxParse()) { // Parsing inner functions lazily may lead the parser into an @@ -370,8 +370,8 @@ frontend::CompileScript(ExclusiveContext *cx, LifoAlloc *alloc, HandleObject sco return nullptr; pc.destroy(); - pc.construct(&parser, (GenericParseContext *) nullptr, (ParseNode *) nullptr, - &globalsc, (Directives *) nullptr, staticLevel, /* bodyid = */ 0, + pc.construct(&parser, (GenericParseContext*) nullptr, (ParseNode*) nullptr, + &globalsc, (Directives*) nullptr, staticLevel, /* bodyid = */ 0, script->bindings.numBlockScoped()); if (!pc.ref().init(parser.tokenStream)) return nullptr; @@ -459,7 +459,7 @@ frontend::CompileScript(ExclusiveContext *cx, LifoAlloc *alloc, HandleObject sco } bool -frontend::CompileLazyFunction(JSContext *cx, Handle lazy, const jschar *chars, size_t length) +frontend::CompileLazyFunction(JSContext* cx, Handle lazy, const jschar* chars, size_t length) { JS_ASSERT(cx->compartment() == lazy->functionNonDelazifying()->compartment()); @@ -471,7 +471,7 @@ frontend::CompileLazyFunction(JSContext *cx, Handle lazy, const jsc .setNoScriptRval(false) .setSelfHostingMode(false); - js::TraceLogger *logger = js::TraceLoggerForMainThread(cx->runtime()); + js::TraceLogger* logger = js::TraceLoggerForMainThread(cx->runtime()); uint32_t logId = js::TraceLogCreateTextId(logger, options); js::AutoTraceLog scriptLogger(logger, logId); js::AutoTraceLog typeLogger(logger, TraceLogger::ParserCompileLazy); @@ -483,7 +483,7 @@ frontend::CompileLazyFunction(JSContext *cx, Handle lazy, const jsc Rooted fun(cx, lazy->functionNonDelazifying()); JS_ASSERT(!lazy->isLegacyGenerator()); - ParseNode *pn = parser.standaloneLazyFunction(fun, staticLevel, lazy->strict(), + ParseNode* pn = parser.standaloneLazyFunction(fun, staticLevel, lazy->strict(), lazy->generatorKind()); if (!pn) return false; @@ -525,11 +525,11 @@ frontend::CompileLazyFunction(JSContext *cx, Handle lazy, const jsc // Compile a JS function body, which might appear as the value of an event // handler attribute in an HTML tag, or in a Function() constructor. static bool -CompileFunctionBody(JSContext *cx, MutableHandleFunction fun, const ReadOnlyCompileOptions &options, - const AutoNameVector &formals, SourceBufferHolder &srcBuf, +CompileFunctionBody(JSContext* cx, MutableHandleFunction fun, const ReadOnlyCompileOptions& options, + const AutoNameVector& formals, SourceBufferHolder& srcBuf, GeneratorKind generatorKind) { - js::TraceLogger *logger = js::TraceLoggerForMainThread(cx->runtime()); + js::TraceLogger* logger = js::TraceLoggerForMainThread(cx->runtime()); uint32_t logId = js::TraceLogCreateTextId(logger, options); js::AutoTraceLog scriptLogger(logger, logId); js::AutoTraceLog typeLogger(logger, TraceLogger::ParserCompileFunction); @@ -545,7 +545,7 @@ CompileFunctionBody(JSContext *cx, MutableHandleFunction fun, const ReadOnlyComp RootedScriptSource sourceObject(cx, CreateScriptSourceObject(cx, options)); if (!sourceObject) return nullptr; - ScriptSource *ss = sourceObject->source(); + ScriptSource* ss = sourceObject->source(); SourceCompressionTask sct(cx); JS_ASSERT(!options.sourceIsLazy); @@ -561,8 +561,8 @@ CompileFunctionBody(JSContext *cx, MutableHandleFunction fun, const ReadOnlyComp syntaxParser.construct(cx, &cx->tempLifoAlloc(), options, srcBuf.get(), srcBuf.length(), /* foldConstants = */ false, - (Parser *) nullptr, - (LazyScript *) nullptr); + (Parser*) nullptr, + (LazyScript*) nullptr); } JS_ASSERT(!options.forEval); @@ -588,7 +588,7 @@ CompileFunctionBody(JSContext *cx, MutableHandleFunction fun, const ReadOnlyComp TokenStream::Position start(parser.keepAtoms); parser.tokenStream.tell(&start); - ParseNode *fn; + ParseNode* fn; while (true) { Directives newDirectives = directives; fn = parser.standaloneFunctionBody(fun, formals, generatorKind, directives, &newDirectives); @@ -661,17 +661,17 @@ CompileFunctionBody(JSContext *cx, MutableHandleFunction fun, const ReadOnlyComp } bool -frontend::CompileFunctionBody(JSContext *cx, MutableHandleFunction fun, - const ReadOnlyCompileOptions &options, - const AutoNameVector &formals, JS::SourceBufferHolder &srcBuf) +frontend::CompileFunctionBody(JSContext* cx, MutableHandleFunction fun, + const ReadOnlyCompileOptions& options, + const AutoNameVector& formals, JS::SourceBufferHolder& srcBuf) { return CompileFunctionBody(cx, fun, options, formals, srcBuf, NotGenerator); } bool -frontend::CompileStarGeneratorBody(JSContext *cx, MutableHandleFunction fun, - const ReadOnlyCompileOptions &options, const AutoNameVector &formals, - JS::SourceBufferHolder &srcBuf) +frontend::CompileStarGeneratorBody(JSContext* cx, MutableHandleFunction fun, + const ReadOnlyCompileOptions& options, const AutoNameVector& formals, + JS::SourceBufferHolder& srcBuf) { return CompileFunctionBody(cx, fun, options, formals, srcBuf, StarGenerator); } diff --git a/js/src/frontend/BytecodeCompiler.h b/js/src/frontend/BytecodeCompiler.h index e236b68ebd..ffb4c40e57 100644 --- a/js/src/frontend/BytecodeCompiler.h +++ b/js/src/frontend/BytecodeCompiler.h @@ -20,35 +20,35 @@ struct SourceCompressionTask; namespace frontend { -JSScript * -CompileScript(ExclusiveContext *cx, LifoAlloc *alloc, +JSScript* +CompileScript(ExclusiveContext* cx, LifoAlloc* alloc, HandleObject scopeChain, HandleScript evalCaller, - const ReadOnlyCompileOptions &options, SourceBufferHolder &srcBuf, - JSString *source_ = nullptr, unsigned staticLevel = 0, - SourceCompressionTask *extraSct = nullptr); + const ReadOnlyCompileOptions& options, SourceBufferHolder& srcBuf, + JSString* source_ = nullptr, unsigned staticLevel = 0, + SourceCompressionTask* extraSct = nullptr); bool -CompileLazyFunction(JSContext *cx, Handle lazy, const jschar *chars, size_t length); +CompileLazyFunction(JSContext* cx, Handle lazy, const jschar* chars, size_t length); bool -CompileFunctionBody(JSContext *cx, MutableHandleFunction fun, - const ReadOnlyCompileOptions &options, - const AutoNameVector &formals, JS::SourceBufferHolder &srcBuf); +CompileFunctionBody(JSContext* cx, MutableHandleFunction fun, + const ReadOnlyCompileOptions& options, + const AutoNameVector& formals, JS::SourceBufferHolder& srcBuf); bool -CompileStarGeneratorBody(JSContext *cx, MutableHandleFunction fun, - const ReadOnlyCompileOptions &options, - const AutoNameVector &formals, JS::SourceBufferHolder &srcBuf); +CompileStarGeneratorBody(JSContext* cx, MutableHandleFunction fun, + const ReadOnlyCompileOptions& options, + const AutoNameVector& formals, JS::SourceBufferHolder& srcBuf); -ScriptSourceObject * -CreateScriptSourceObject(ExclusiveContext *cx, const ReadOnlyCompileOptions &options); +ScriptSourceObject* +CreateScriptSourceObject(ExclusiveContext* cx, const ReadOnlyCompileOptions& options); /* * This should be called while still on the main thread if compilation will * occur on a worker thread. */ void -MaybeCallSourceHandler(JSContext *cx, const ReadOnlyCompileOptions &options, - JS::SourceBufferHolder &srcBuf); +MaybeCallSourceHandler(JSContext* cx, const ReadOnlyCompileOptions& options, + JS::SourceBufferHolder& srcBuf); /* * True if str consists of an IdentifierStart character, followed by one or @@ -60,15 +60,15 @@ MaybeCallSourceHandler(JSContext *cx, const ReadOnlyCompileOptions &options, * Defined in TokenStream.cpp. */ bool -IsIdentifier(JSLinearString *str); +IsIdentifier(JSLinearString* str); /* True if str is a keyword. Defined in TokenStream.cpp. */ bool -IsKeyword(JSLinearString *str); +IsKeyword(JSLinearString* str); /* GC marking. Defined in Parser.cpp. */ void -MarkParser(JSTracer *trc, AutoGCRooter *parser); +MarkParser(JSTracer* trc, AutoGCRooter* parser); } /* namespace frontend */ } /* namespace js */ diff --git a/js/src/frontend/BytecodeEmitter.cpp b/js/src/frontend/BytecodeEmitter.cpp index c693192274..5441b7f9f2 100644 --- a/js/src/frontend/BytecodeEmitter.cpp +++ b/js/src/frontend/BytecodeEmitter.cpp @@ -48,19 +48,19 @@ using mozilla::NumberIsInt32; using mozilla::PodCopy; static bool -SetSrcNoteOffset(ExclusiveContext *cx, BytecodeEmitter *bce, unsigned index, unsigned which, ptrdiff_t offset); +SetSrcNoteOffset(ExclusiveContext* cx, BytecodeEmitter* bce, unsigned index, unsigned which, ptrdiff_t offset); struct frontend::StmtInfoBCE : public StmtInfoBase { - StmtInfoBCE *down; /* info for enclosing statement */ - StmtInfoBCE *downScope; /* next enclosing lexical scope */ + StmtInfoBCE* down; /* info for enclosing statement */ + StmtInfoBCE* downScope; /* next enclosing lexical scope */ ptrdiff_t update; /* loop update offset (top if none) */ ptrdiff_t breaks; /* offset of last break in loop */ ptrdiff_t continues; /* offset of last continue in loop */ uint32_t blockScopeIndex; /* index of scope in BlockScopeArray */ - StmtInfoBCE(ExclusiveContext *cx) : StmtInfoBase(cx) {} + StmtInfoBCE(ExclusiveContext* cx) : StmtInfoBase(cx) {} /* * To reuse space, alias two of the ptrdiff_t fields for use during @@ -71,12 +71,12 @@ struct frontend::StmtInfoBCE : public StmtInfoBase * safe to overlay these for the "trying" StmtTypes. */ - ptrdiff_t &gosubs() { + ptrdiff_t& gosubs() { JS_ASSERT(type == STMT_FINALLY); return breaks; } - ptrdiff_t &guardJump() { + ptrdiff_t& guardJump() { JS_ASSERT(type == STMT_TRY || type == STMT_FINALLY); return continues; } @@ -93,9 +93,9 @@ struct LoopStmtInfo : public StmtInfoBCE // Can we OSR into Ion from here? True unless there is non-loop state on the stack. bool canIonOsr; - LoopStmtInfo(ExclusiveContext *cx) : StmtInfoBCE(cx) {} + LoopStmtInfo(ExclusiveContext* cx) : StmtInfoBCE(cx) {} - static LoopStmtInfo* fromStmtInfo(StmtInfoBCE *stmt) { + static LoopStmtInfo* fromStmtInfo(StmtInfoBCE* stmt) { JS_ASSERT(stmt->isLoop()); return static_cast(stmt); } @@ -103,8 +103,8 @@ struct LoopStmtInfo : public StmtInfoBCE } // anonymous namespace -BytecodeEmitter::BytecodeEmitter(BytecodeEmitter *parent, - Parser *parser, SharedContext *sc, +BytecodeEmitter::BytecodeEmitter(BytecodeEmitter* parent, + Parser* parser, SharedContext* sc, HandleScript script, bool insideEval, HandleScript evalCaller, bool hasGlobalScope, uint32_t lineNum, EmitterMode emitterMode) : sc(sc), @@ -145,7 +145,7 @@ BytecodeEmitter::init() } static ptrdiff_t -EmitCheck(ExclusiveContext *cx, BytecodeEmitter *bce, ptrdiff_t delta) +EmitCheck(ExclusiveContext* cx, BytecodeEmitter* bce, ptrdiff_t delta) { ptrdiff_t offset = bce->code().length(); @@ -162,11 +162,11 @@ EmitCheck(ExclusiveContext *cx, BytecodeEmitter *bce, ptrdiff_t delta) } static void -UpdateDepth(ExclusiveContext *cx, BytecodeEmitter *bce, ptrdiff_t target) +UpdateDepth(ExclusiveContext* cx, BytecodeEmitter* bce, ptrdiff_t target) { - jsbytecode *pc = bce->code(target); + jsbytecode* pc = bce->code(target); JSOp op = (JSOp) *pc; - const JSCodeSpec *cs = &js_CodeSpec[op]; + const JSCodeSpec* cs = &js_CodeSpec[op]; if (cs->format & JOF_TMPSLOT_MASK) { /* @@ -190,26 +190,26 @@ UpdateDepth(ExclusiveContext *cx, BytecodeEmitter *bce, ptrdiff_t target) } ptrdiff_t -frontend::Emit1(ExclusiveContext *cx, BytecodeEmitter *bce, JSOp op) +frontend::Emit1(ExclusiveContext* cx, BytecodeEmitter* bce, JSOp op) { ptrdiff_t offset = EmitCheck(cx, bce, 1); if (offset < 0) return -1; - jsbytecode *code = bce->code(offset); + jsbytecode* code = bce->code(offset); code[0] = jsbytecode(op); UpdateDepth(cx, bce, offset); return offset; } ptrdiff_t -frontend::Emit2(ExclusiveContext *cx, BytecodeEmitter *bce, JSOp op, jsbytecode op1) +frontend::Emit2(ExclusiveContext* cx, BytecodeEmitter* bce, JSOp op, jsbytecode op1) { ptrdiff_t offset = EmitCheck(cx, bce, 2); if (offset < 0) return -1; - jsbytecode *code = bce->code(offset); + jsbytecode* code = bce->code(offset); code[0] = jsbytecode(op); code[1] = op1; UpdateDepth(cx, bce, offset); @@ -217,7 +217,7 @@ frontend::Emit2(ExclusiveContext *cx, BytecodeEmitter *bce, JSOp op, jsbytecode } ptrdiff_t -frontend::Emit3(ExclusiveContext *cx, BytecodeEmitter *bce, JSOp op, jsbytecode op1, +frontend::Emit3(ExclusiveContext* cx, BytecodeEmitter* bce, JSOp op, jsbytecode op1, jsbytecode op2) { /* These should filter through EmitVarOp. */ @@ -228,7 +228,7 @@ frontend::Emit3(ExclusiveContext *cx, BytecodeEmitter *bce, JSOp op, jsbytecode if (offset < 0) return -1; - jsbytecode *code = bce->code(offset); + jsbytecode* code = bce->code(offset); code[0] = jsbytecode(op); code[1] = op1; code[2] = op2; @@ -237,14 +237,14 @@ frontend::Emit3(ExclusiveContext *cx, BytecodeEmitter *bce, JSOp op, jsbytecode } ptrdiff_t -frontend::EmitN(ExclusiveContext *cx, BytecodeEmitter *bce, JSOp op, size_t extra) +frontend::EmitN(ExclusiveContext* cx, BytecodeEmitter* bce, JSOp op, size_t extra) { ptrdiff_t length = 1 + (ptrdiff_t)extra; ptrdiff_t offset = EmitCheck(cx, bce, length); if (offset < 0) return -1; - jsbytecode *code = bce->code(offset); + jsbytecode* code = bce->code(offset); code[0] = jsbytecode(op); /* The remaining |extra| bytes are set by the caller */ @@ -259,13 +259,13 @@ frontend::EmitN(ExclusiveContext *cx, BytecodeEmitter *bce, JSOp op, size_t extr } static ptrdiff_t -EmitJump(ExclusiveContext *cx, BytecodeEmitter *bce, JSOp op, ptrdiff_t off) +EmitJump(ExclusiveContext* cx, BytecodeEmitter* bce, JSOp op, ptrdiff_t off) { ptrdiff_t offset = EmitCheck(cx, bce, 5); if (offset < 0) return -1; - jsbytecode *code = bce->code(offset); + jsbytecode* code = bce->code(offset); code[0] = jsbytecode(op); SET_JUMP_OFFSET(code, off); UpdateDepth(cx, bce, offset); @@ -273,7 +273,7 @@ EmitJump(ExclusiveContext *cx, BytecodeEmitter *bce, JSOp op, ptrdiff_t off) } static ptrdiff_t -EmitCall(ExclusiveContext *cx, BytecodeEmitter *bce, JSOp op, uint16_t argc) +EmitCall(ExclusiveContext* cx, BytecodeEmitter* bce, JSOp op, uint16_t argc) { return Emit3(cx, bce, op, ARGC_HI(argc), ARGC_LO(argc)); } @@ -289,7 +289,7 @@ EmitCall(ExclusiveContext *cx, BytecodeEmitter *bce, JSOp op, uint16_t argc) // separately, but they all together form one script with one fixed stack // frame). static bool -EmitDupAt(ExclusiveContext *cx, BytecodeEmitter *bce, unsigned slot) +EmitDupAt(ExclusiveContext* cx, BytecodeEmitter* bce, unsigned slot) { JS_ASSERT(slot < unsigned(bce->stackDepth)); // The slot's position on the operand stack, measured from the top. @@ -301,7 +301,7 @@ EmitDupAt(ExclusiveContext *cx, BytecodeEmitter *bce, unsigned slot) ptrdiff_t off = EmitN(cx, bce, JSOP_DUPAT, 3); if (off < 0) return false; - jsbytecode *pc = bce->code(off); + jsbytecode* pc = bce->code(off); SET_UINT24(pc, slotFromTop); return true; } @@ -332,8 +332,8 @@ static const char * const statementName[] = { JS_STATIC_ASSERT(JS_ARRAY_LENGTH(statementName) == STMT_LIMIT); -static const char * -StatementName(StmtInfoBCE *topStmt) +static const char* +StatementName(StmtInfoBCE* topStmt) { if (!topStmt) return js_script_str; @@ -341,7 +341,7 @@ StatementName(StmtInfoBCE *topStmt) } static void -ReportStatementTooLarge(TokenStream &ts, StmtInfoBCE *topStmt) +ReportStatementTooLarge(TokenStream& ts, StmtInfoBCE* topStmt) { ts.reportError(JSMSG_NEED_DIET, StatementName(topStmt)); } @@ -351,7 +351,7 @@ ReportStatementTooLarge(TokenStream &ts, StmtInfoBCE *topStmt) * so that we can walk back up the chain fixing up the op and jump offset. */ static ptrdiff_t -EmitBackPatchOp(ExclusiveContext *cx, BytecodeEmitter *bce, ptrdiff_t *lastp) +EmitBackPatchOp(ExclusiveContext* cx, BytecodeEmitter* bce, ptrdiff_t* lastp) { ptrdiff_t offset, delta; @@ -370,9 +370,9 @@ LengthOfSetLine(unsigned line) /* Updates line number notes, not column notes. */ static inline bool -UpdateLineNumberNotes(ExclusiveContext *cx, BytecodeEmitter *bce, uint32_t offset) +UpdateLineNumberNotes(ExclusiveContext* cx, BytecodeEmitter* bce, uint32_t offset) { - TokenStream *ts = &bce->parser->tokenStream; + TokenStream* ts = &bce->parser->tokenStream; if (!ts->srcCoords.isOnThisLine(offset, bce->currentLine())) { unsigned line = ts->srcCoords.lineNum(offset); unsigned delta = line - bce->currentLine(); @@ -405,7 +405,7 @@ UpdateLineNumberNotes(ExclusiveContext *cx, BytecodeEmitter *bce, uint32_t offse /* A function, so that we avoid macro-bloating all the other callsites. */ static bool -UpdateSourceCoordNotes(ExclusiveContext *cx, BytecodeEmitter *bce, uint32_t offset) +UpdateSourceCoordNotes(ExclusiveContext* cx, BytecodeEmitter* bce, uint32_t offset) { if (!UpdateLineNumberNotes(cx, bce, offset)) return false; @@ -431,7 +431,7 @@ UpdateSourceCoordNotes(ExclusiveContext *cx, BytecodeEmitter *bce, uint32_t offs } static ptrdiff_t -EmitLoopHead(ExclusiveContext *cx, BytecodeEmitter *bce, ParseNode *nextpn) +EmitLoopHead(ExclusiveContext* cx, BytecodeEmitter* bce, ParseNode* nextpn) { if (nextpn) { /* @@ -450,7 +450,7 @@ EmitLoopHead(ExclusiveContext *cx, BytecodeEmitter *bce, ParseNode *nextpn) } static bool -EmitLoopEntry(ExclusiveContext *cx, BytecodeEmitter *bce, ParseNode *nextpn) +EmitLoopEntry(ExclusiveContext* cx, BytecodeEmitter* bce, ParseNode* nextpn) { if (nextpn) { /* Update the line number, as for LOOPHEAD. */ @@ -461,7 +461,7 @@ EmitLoopEntry(ExclusiveContext *cx, BytecodeEmitter *bce, ParseNode *nextpn) return false; } - LoopStmtInfo *loop = LoopStmtInfo::fromStmtInfo(bce->topStmt); + LoopStmtInfo* loop = LoopStmtInfo::fromStmtInfo(bce->topStmt); JS_ASSERT(loop->loopDepth > 0); uint8_t loopDepthAndFlags = PackLoopEntryDepthHintAndFlags(loop->loopDepth, loop->canIonOsr); @@ -473,7 +473,7 @@ EmitLoopEntry(ExclusiveContext *cx, BytecodeEmitter *bce, ParseNode *nextpn) * a type set to store its result. */ static inline void -CheckTypeSet(ExclusiveContext *cx, BytecodeEmitter *bce, JSOp op) +CheckTypeSet(ExclusiveContext* cx, BytecodeEmitter* bce, JSOp op) { if (js_CodeSpec[op].format & JOF_TYPESET) { if (bce->typesetCount < UINT16_MAX) @@ -496,7 +496,7 @@ CheckTypeSet(ExclusiveContext *cx, BytecodeEmitter *bce, JSOp op) JS_END_MACRO static bool -FlushPops(ExclusiveContext *cx, BytecodeEmitter *bce, int *npops) +FlushPops(ExclusiveContext* cx, BytecodeEmitter* bce, int* npops) { JS_ASSERT(*npops != 0); EMIT_UINT16_IMM_OP(JSOP_POPN, *npops); @@ -505,7 +505,7 @@ FlushPops(ExclusiveContext *cx, BytecodeEmitter *bce, int *npops) } static bool -PopIterator(ExclusiveContext *cx, BytecodeEmitter *bce) +PopIterator(ExclusiveContext* cx, BytecodeEmitter* bce) { if (Emit1(cx, bce, JSOP_ENDITER) < 0) return false; @@ -515,23 +515,23 @@ PopIterator(ExclusiveContext *cx, BytecodeEmitter *bce) namespace { class NonLocalExitScope { - ExclusiveContext *cx; - BytecodeEmitter *bce; + ExclusiveContext* cx; + BytecodeEmitter* bce; const uint32_t savedScopeIndex; const int savedDepth; uint32_t openScopeIndex; - NonLocalExitScope(const NonLocalExitScope &) MOZ_DELETE; + NonLocalExitScope(const NonLocalExitScope&) MOZ_DELETE; public: - explicit NonLocalExitScope(ExclusiveContext *cx_, BytecodeEmitter *bce_) + explicit NonLocalExitScope(ExclusiveContext* cx_, BytecodeEmitter* bce_) : cx(cx_), bce(bce_), savedScopeIndex(bce->blockScopeList.length()), savedDepth(bce->stackDepth), openScopeIndex(UINT32_MAX) { if (bce->staticScope) { - StmtInfoBCE *stmt = bce->topStmt; + StmtInfoBCE* stmt = bce->topStmt; while (1) { JS_ASSERT(stmt); if (stmt->isNestedScope) { @@ -559,20 +559,20 @@ class NonLocalExitScope { return true; } - bool prepareForNonLocalJump(StmtInfoBCE *toStmt); + bool prepareForNonLocalJump(StmtInfoBCE* toStmt); }; /* * Emit additional bytecode(s) for non-local jumps. */ bool -NonLocalExitScope::prepareForNonLocalJump(StmtInfoBCE *toStmt) +NonLocalExitScope::prepareForNonLocalJump(StmtInfoBCE* toStmt) { int npops = 0; #define FLUSH_POPS() if (npops && !FlushPops(cx, bce, &npops)) return false - for (StmtInfoBCE *stmt = bce->topStmt; stmt != toStmt; stmt = stmt->down) { + for (StmtInfoBCE* stmt = bce->topStmt; stmt != toStmt; stmt = stmt->down) { switch (stmt->type) { case STMT_FINALLY: FLUSH_POPS(); @@ -611,7 +611,7 @@ NonLocalExitScope::prepareForNonLocalJump(StmtInfoBCE *toStmt) if (stmt->isBlockScope) { JS_ASSERT(stmt->isNestedScope); - StaticBlockObject &blockObj = stmt->staticBlock(); + StaticBlockObject& blockObj = stmt->staticBlock(); if (Emit1(cx, bce, JSOP_DEBUGLEAVEBLOCK) < 0) return false; if (!popScopeForNonLocalExit(stmt->blockScopeIndex)) @@ -632,7 +632,7 @@ NonLocalExitScope::prepareForNonLocalJump(StmtInfoBCE *toStmt) } // anonymous namespace static ptrdiff_t -EmitGoto(ExclusiveContext *cx, BytecodeEmitter *bce, StmtInfoBCE *toStmt, ptrdiff_t *lastp, +EmitGoto(ExclusiveContext* cx, BytecodeEmitter* bce, StmtInfoBCE* toStmt, ptrdiff_t* lastp, SrcNoteType noteType = SRC_NULL) { NonLocalExitScope nle(cx, bce); @@ -649,9 +649,9 @@ EmitGoto(ExclusiveContext *cx, BytecodeEmitter *bce, StmtInfoBCE *toStmt, ptrdif } static bool -BackPatch(ExclusiveContext *cx, BytecodeEmitter *bce, ptrdiff_t last, jsbytecode *target, jsbytecode op) +BackPatch(ExclusiveContext* cx, BytecodeEmitter* bce, ptrdiff_t last, jsbytecode* target, jsbytecode op) { - jsbytecode *pc, *stop; + jsbytecode* pc, *stop; ptrdiff_t delta, span; pc = bce->code(last); @@ -670,27 +670,27 @@ BackPatch(ExclusiveContext *cx, BytecodeEmitter *bce, ptrdiff_t last, jsbytecode ((stmt)->update = (top), (stmt)->breaks = (stmt)->continues = (-1)) static void -PushStatementInner(BytecodeEmitter *bce, StmtInfoBCE *stmt, StmtType type, ptrdiff_t top) +PushStatementInner(BytecodeEmitter* bce, StmtInfoBCE* stmt, StmtType type, ptrdiff_t top) { SET_STATEMENT_TOP(stmt, top); PushStatement(bce, stmt, type); } static void -PushStatementBCE(BytecodeEmitter *bce, StmtInfoBCE *stmt, StmtType type, ptrdiff_t top) +PushStatementBCE(BytecodeEmitter* bce, StmtInfoBCE* stmt, StmtType type, ptrdiff_t top) { PushStatementInner(bce, stmt, type, top); JS_ASSERT(!stmt->isLoop()); } static void -PushLoopStatement(BytecodeEmitter *bce, LoopStmtInfo *stmt, StmtType type, ptrdiff_t top) +PushLoopStatement(BytecodeEmitter* bce, LoopStmtInfo* stmt, StmtType type, ptrdiff_t top) { PushStatementInner(bce, stmt, type, top); JS_ASSERT(stmt->isLoop()); - LoopStmtInfo *downLoop = nullptr; - for (StmtInfoBCE *outer = stmt->down; outer; outer = outer->down) { + LoopStmtInfo* downLoop = nullptr; + for (StmtInfoBCE* outer = stmt->down; outer; outer = outer->down) { if (outer->isLoop()) { downLoop = LoopStmtInfo::fromStmtInfo(outer); break; @@ -719,8 +719,8 @@ PushLoopStatement(BytecodeEmitter *bce, LoopStmtInfo *stmt, StmtType type, ptrdi * Return the enclosing lexical scope, which is the innermost enclosing static * block object or compiler created function. */ -static JSObject * -EnclosingStaticScope(BytecodeEmitter *bce) +static JSObject* +EnclosingStaticScope(BytecodeEmitter* bce) { if (bce->staticScope) return bce->staticScope; @@ -735,7 +735,7 @@ EnclosingStaticScope(BytecodeEmitter *bce) #ifdef DEBUG static bool -AllLocalsAliased(StaticBlockObject &obj) +AllLocalsAliased(StaticBlockObject& obj) { for (unsigned i = 0; i < obj.numVariables(); i++) if (!obj.isAliased(i)) @@ -745,10 +745,10 @@ AllLocalsAliased(StaticBlockObject &obj) #endif static bool -ComputeAliasedSlots(ExclusiveContext *cx, BytecodeEmitter *bce, Handle blockObj) +ComputeAliasedSlots(ExclusiveContext* cx, BytecodeEmitter* bce, Handle blockObj) { for (unsigned i = 0; i < blockObj->numVariables(); i++) { - Definition *dn = blockObj->definitionParseNode(i); + Definition* dn = blockObj->definitionParseNode(i); JS_ASSERT(dn->isDefn()); if (!dn->pn_cookie.set(bce->parser->tokenStream, dn->pn_cookie.level(), @@ -758,7 +758,7 @@ ComputeAliasedSlots(ExclusiveContext *cx, BytecodeEmitter *bce, Handledn_uses; pnu; pnu = pnu->pn_link) { + for (ParseNode* pnu = dn->dn_uses; pnu; pnu = pnu->pn_link) { JS_ASSERT(pnu->pn_lexdef == dn); JS_ASSERT(!(pnu->pn_dflags & PND_BOUND)); JS_ASSERT(pnu->pn_cookie.isFree()); @@ -774,23 +774,23 @@ ComputeAliasedSlots(ExclusiveContext *cx, BytecodeEmitter *bce, Handle blockObj) +ComputeLocalOffset(ExclusiveContext* cx, BytecodeEmitter* bce, Handle blockObj) { unsigned nfixedvars = bce->sc->isFunctionBox() ? bce->script->bindings.numVars() : 0; unsigned localOffset = nfixedvars; if (bce->staticScope) { - Rooted outer(cx, bce->staticScope); + Rooted outer(cx, bce->staticScope); for (; outer; outer = outer->enclosingNestedScope()) { if (outer->is()) { - StaticBlockObject &outerBlock = outer->as(); + StaticBlockObject& outerBlock = outer->as(); localOffset = outerBlock.localOffset() + outerBlock.numVariables(); break; } @@ -826,7 +826,7 @@ ComputeLocalOffset(ExclusiveContext *cx, BytecodeEmitter *bce, Handle scopeObj(cx, &objbox->object->as()); + Rooted scopeObj(cx, &objbox->object->as()); uint32_t scopeObjectIndex = bce->objectList.add(objbox); switch (stmtType) { case STMT_BLOCK: { - Rooted blockObj(cx, &scopeObj->as()); + Rooted blockObj(cx, &scopeObj->as()); ComputeLocalOffset(cx, bce, blockObj); @@ -881,7 +881,7 @@ EnterNestedScope(ExclusiveContext *cx, BytecodeEmitter *bce, StmtInfoBCE *stmt, } uint32_t parent = BlockScopeNote::NoBlockScopeIndex; - if (StmtInfoBCE *stmt = bce->topScopeStmt) { + if (StmtInfoBCE* stmt = bce->topScopeStmt) { for (; stmt->staticScope != bce->staticScope; stmt = stmt->down) {} parent = stmt->blockScopeIndex; } @@ -902,9 +902,9 @@ EnterNestedScope(ExclusiveContext *cx, BytecodeEmitter *bce, StmtInfoBCE *stmt, // Patches |breaks| and |continues| unless the top statement info record // represents a try-catch-finally suite. May fail if a jump offset overflows. static bool -PopStatementBCE(ExclusiveContext *cx, BytecodeEmitter *bce) +PopStatementBCE(ExclusiveContext* cx, BytecodeEmitter* bce) { - StmtInfoBCE *stmt = bce->topStmt; + StmtInfoBCE* stmt = bce->topStmt; if (!stmt->isTrying() && (!BackPatch(cx, bce, stmt->breaks, bce->code().end(), JSOP_GOTO) || !BackPatch(cx, bce, stmt->continues, bce->code(stmt->update), JSOP_GOTO))) @@ -917,7 +917,7 @@ PopStatementBCE(ExclusiveContext *cx, BytecodeEmitter *bce) } static bool -LeaveNestedScope(ExclusiveContext *cx, BytecodeEmitter *bce, StmtInfoBCE *stmt) +LeaveNestedScope(ExclusiveContext* cx, BytecodeEmitter* bce, StmtInfoBCE* stmt) { JS_ASSERT(stmt == bce->topStmt); JS_ASSERT(stmt->isNestedScope); @@ -927,8 +927,8 @@ LeaveNestedScope(ExclusiveContext *cx, BytecodeEmitter *bce, StmtInfoBCE *stmt) #ifdef DEBUG JS_ASSERT(bce->blockScopeList.list[blockScopeIndex].length == 0); uint32_t blockObjIndex = bce->blockScopeList.list[blockScopeIndex].index; - ObjectBox *blockObjBox = bce->objectList.find(blockObjIndex); - NestedScopeObject *staticScope = &blockObjBox->object->as(); + ObjectBox* blockObjBox = bce->objectList.find(blockObjIndex); + NestedScopeObject* staticScope = &blockObjBox->object->as(); JS_ASSERT(stmt->staticScope == staticScope); JS_ASSERT(staticScope == bce->staticScope); JS_ASSERT_IF(!stmt->isBlockScope, staticScope->is()); @@ -951,7 +951,7 @@ LeaveNestedScope(ExclusiveContext *cx, BytecodeEmitter *bce, StmtInfoBCE *stmt) } static bool -EmitIndex32(ExclusiveContext *cx, JSOp op, uint32_t index, BytecodeEmitter *bce) +EmitIndex32(ExclusiveContext* cx, JSOp op, uint32_t index, BytecodeEmitter* bce) { const size_t len = 1 + UINT32_INDEX_LEN; JS_ASSERT(len == size_t(js_CodeSpec[op].length)); @@ -959,7 +959,7 @@ EmitIndex32(ExclusiveContext *cx, JSOp op, uint32_t index, BytecodeEmitter *bce) if (offset < 0) return false; - jsbytecode *code = bce->code(offset); + jsbytecode* code = bce->code(offset); code[0] = jsbytecode(op); SET_UINT32_INDEX(code, index); UpdateDepth(cx, bce, offset); @@ -968,7 +968,7 @@ EmitIndex32(ExclusiveContext *cx, JSOp op, uint32_t index, BytecodeEmitter *bce) } static bool -EmitIndexOp(ExclusiveContext *cx, JSOp op, uint32_t index, BytecodeEmitter *bce) +EmitIndexOp(ExclusiveContext* cx, JSOp op, uint32_t index, BytecodeEmitter* bce) { const size_t len = js_CodeSpec[op].length; JS_ASSERT(len >= 1 + UINT32_INDEX_LEN); @@ -976,7 +976,7 @@ EmitIndexOp(ExclusiveContext *cx, JSOp op, uint32_t index, BytecodeEmitter *bce) if (offset < 0) return false; - jsbytecode *code = bce->code(offset); + jsbytecode* code = bce->code(offset); code[0] = jsbytecode(op); SET_UINT32_INDEX(code, index); UpdateDepth(cx, bce, offset); @@ -985,7 +985,7 @@ EmitIndexOp(ExclusiveContext *cx, JSOp op, uint32_t index, BytecodeEmitter *bce) } static bool -EmitAtomOp(ExclusiveContext *cx, JSAtom *atom, JSOp op, BytecodeEmitter *bce) +EmitAtomOp(ExclusiveContext* cx, JSAtom* atom, JSOp op, BytecodeEmitter* bce) { JS_ASSERT(JOF_OPTYPE(op) == JOF_ATOM); @@ -1002,14 +1002,14 @@ EmitAtomOp(ExclusiveContext *cx, JSAtom *atom, JSOp op, BytecodeEmitter *bce) } static bool -EmitAtomOp(ExclusiveContext *cx, ParseNode *pn, JSOp op, BytecodeEmitter *bce) +EmitAtomOp(ExclusiveContext* cx, ParseNode* pn, JSOp op, BytecodeEmitter* bce) { JS_ASSERT(pn->pn_atom != nullptr); return EmitAtomOp(cx, pn->pn_atom, op, bce); } static bool -EmitInternedObjectOp(ExclusiveContext *cx, uint32_t index, JSOp op, BytecodeEmitter *bce) +EmitInternedObjectOp(ExclusiveContext* cx, uint32_t index, JSOp op, BytecodeEmitter* bce) { JS_ASSERT(JOF_OPTYPE(op) == JOF_OBJECT); JS_ASSERT(index < bce->objectList.length); @@ -1017,13 +1017,13 @@ EmitInternedObjectOp(ExclusiveContext *cx, uint32_t index, JSOp op, BytecodeEmit } static bool -EmitObjectOp(ExclusiveContext *cx, ObjectBox *objbox, JSOp op, BytecodeEmitter *bce) +EmitObjectOp(ExclusiveContext* cx, ObjectBox* objbox, JSOp op, BytecodeEmitter* bce) { return EmitInternedObjectOp(cx, bce->objectList.add(objbox), op, bce); } static bool -EmitRegExp(ExclusiveContext *cx, uint32_t index, BytecodeEmitter *bce) +EmitRegExp(ExclusiveContext* cx, uint32_t index, BytecodeEmitter* bce) { return EmitIndex32(cx, JSOP_REGEXP, index, bce); } @@ -1036,7 +1036,7 @@ EmitRegExp(ExclusiveContext *cx, uint32_t index, BytecodeEmitter *bce) * used as a non-asserting version of EMIT_UINT16_IMM_OP. */ static bool -EmitUnaliasedVarOp(ExclusiveContext *cx, JSOp op, uint32_t slot, BytecodeEmitter *bce) +EmitUnaliasedVarOp(ExclusiveContext* cx, JSOp op, uint32_t slot, BytecodeEmitter* bce) { JS_ASSERT(JOF_OPTYPE(op) != JOF_SCOPECOORD); @@ -1059,7 +1059,7 @@ EmitUnaliasedVarOp(ExclusiveContext *cx, JSOp op, uint32_t slot, BytecodeEmitter } static bool -EmitAliasedVarOp(ExclusiveContext *cx, JSOp op, ScopeCoordinate sc, BytecodeEmitter *bce) +EmitAliasedVarOp(ExclusiveContext* cx, JSOp op, ScopeCoordinate sc, BytecodeEmitter* bce) { JS_ASSERT(JOF_OPTYPE(op) == JOF_SCOPECOORD); @@ -1070,7 +1070,7 @@ EmitAliasedVarOp(ExclusiveContext *cx, JSOp op, ScopeCoordinate sc, BytecodeEmit if (off < 0) return false; - jsbytecode *pc = bce->code(off); + jsbytecode* pc = bce->code(off); SET_SCOPECOORD_HOPS(pc, sc.hops()); pc += SCOPECOORD_HOPS_LEN; SET_SCOPECOORD_SLOT(pc, sc.slot()); @@ -1082,10 +1082,10 @@ EmitAliasedVarOp(ExclusiveContext *cx, JSOp op, ScopeCoordinate sc, BytecodeEmit // Compute the number of nested scope objects that will actually be on the scope // chain at runtime, given the BCE's current staticScope. static unsigned -DynamicNestedScopeDepth(BytecodeEmitter *bce) +DynamicNestedScopeDepth(BytecodeEmitter* bce) { unsigned depth = 0; - for (NestedScopeObject *b = bce->staticScope; b; b = b->enclosingNestedScope()) { + for (NestedScopeObject* b = bce->staticScope; b; b = b->enclosingNestedScope()) { if (!b->is() || b->as().needsClone()) ++depth; } @@ -1094,7 +1094,7 @@ DynamicNestedScopeDepth(BytecodeEmitter *bce) } static bool -LookupAliasedName(HandleScript script, PropertyName *name, uint32_t *pslot) +LookupAliasedName(HandleScript script, PropertyName* name, uint32_t* pslot) { /* * Beware: BindingIter may contain more than one Binding for a given name @@ -1114,7 +1114,7 @@ LookupAliasedName(HandleScript script, PropertyName *name, uint32_t *pslot) } static bool -LookupAliasedNameSlot(HandleScript script, PropertyName *name, ScopeCoordinate *sc) +LookupAliasedNameSlot(HandleScript script, PropertyName* name, ScopeCoordinate* sc) { uint32_t slot; if (!LookupAliasedName(script, name, &slot)) @@ -1129,7 +1129,7 @@ LookupAliasedNameSlot(HandleScript script, PropertyName *name, ScopeCoordinate * * uint8_t overflows. */ static bool -AssignHops(BytecodeEmitter *bce, ParseNode *pn, unsigned src, ScopeCoordinate *dst) +AssignHops(BytecodeEmitter* bce, ParseNode* pn, unsigned src, ScopeCoordinate* dst) { if (src > UINT8_MAX) { bce->reportError(pn, JSMSG_TOO_DEEP, js_function_str); @@ -1141,7 +1141,7 @@ AssignHops(BytecodeEmitter *bce, ParseNode *pn, unsigned src, ScopeCoordinate *d } static bool -EmitAliasedVarOp(ExclusiveContext *cx, JSOp op, ParseNode *pn, BytecodeEmitter *bce) +EmitAliasedVarOp(ExclusiveContext* cx, JSOp op, ParseNode* pn, BytecodeEmitter* bce) { /* * While pn->pn_cookie tells us how many function scopes are between the use and the def this @@ -1153,7 +1153,7 @@ EmitAliasedVarOp(ExclusiveContext *cx, JSOp op, ParseNode *pn, BytecodeEmitter * * - all the intervening let/catch blocks must be counted. */ unsigned skippedScopes = 0; - BytecodeEmitter *bceOfDef = bce; + BytecodeEmitter* bceOfDef = bce; if (pn->isUsed()) { /* * As explained in BindNameToSlot, the 'level' of a use indicates how @@ -1162,7 +1162,7 @@ EmitAliasedVarOp(ExclusiveContext *cx, JSOp op, ParseNode *pn, BytecodeEmitter * */ for (unsigned i = pn->pn_cookie.level(); i; i--) { skippedScopes += DynamicNestedScopeDepth(bceOfDef); - FunctionBox *funbox = bceOfDef->sc->asFunctionBox(); + FunctionBox* funbox = bceOfDef->sc->asFunctionBox(); if (funbox->isHeavyweight()) { skippedScopes++; if (funbox->function()->isNamedLambda()) @@ -1213,7 +1213,7 @@ EmitAliasedVarOp(ExclusiveContext *cx, JSOp op, ParseNode *pn, BytecodeEmitter * } static bool -EmitVarOp(ExclusiveContext *cx, ParseNode *pn, JSOp op, BytecodeEmitter *bce) +EmitVarOp(ExclusiveContext* cx, ParseNode* pn, JSOp op, BytecodeEmitter* bce) { JS_ASSERT(pn->isKind(PNK_FUNCTION) || pn->isKind(PNK_NAME)); JS_ASSERT(!pn->pn_cookie.isFree()); @@ -1244,7 +1244,7 @@ EmitVarOp(ExclusiveContext *cx, ParseNode *pn, JSOp op, BytecodeEmitter *bce) } static JSOp -GetIncDecInfo(ParseNodeKind kind, bool *post) +GetIncDecInfo(ParseNodeKind kind, bool* post) { JS_ASSERT(kind == PNK_POSTINCREMENT || kind == PNK_PREINCREMENT || kind == PNK_POSTDECREMENT || kind == PNK_PREDECREMENT); @@ -1253,7 +1253,7 @@ GetIncDecInfo(ParseNodeKind kind, bool *post) } static bool -EmitVarIncDec(ExclusiveContext *cx, ParseNode *pn, BytecodeEmitter *bce) +EmitVarIncDec(ExclusiveContext* cx, ParseNode* pn, BytecodeEmitter* bce) { JSOp op = pn->pn_kid->getOp(); JS_ASSERT(IsArgOp(op) || IsLocalOp(op) || IsAliasedVarOp(op)); @@ -1294,9 +1294,9 @@ EmitVarIncDec(ExclusiveContext *cx, ParseNode *pn, BytecodeEmitter *bce) } bool -BytecodeEmitter::isAliasedName(ParseNode *pn) +BytecodeEmitter::isAliasedName(ParseNode* pn) { - Definition *dn = pn->resolve(); + Definition* dn = pn->resolve(); JS_ASSERT(dn->isDefn()); JS_ASSERT(!dn->isPlaceholder()); JS_ASSERT(dn->isBound()); @@ -1348,7 +1348,7 @@ BytecodeEmitter::isAliasedName(ParseNode *pn) * Return true if a conversion was made. */ static bool -TryConvertFreeName(BytecodeEmitter *bce, ParseNode *pn) +TryConvertFreeName(BytecodeEmitter* bce, ParseNode* pn) { /* * In self-hosting mode, JSOP_*NAME is unconditionally converted to @@ -1376,13 +1376,13 @@ TryConvertFreeName(BytecodeEmitter *bce, ParseNode *pn) if (bce->emitterMode == BytecodeEmitter::LazyFunction) { // The only statements within a lazy function which can push lexical // scopes are try/catch blocks. Use generic ops in this case. - for (StmtInfoBCE *stmt = bce->topStmt; stmt; stmt = stmt->down) { + for (StmtInfoBCE* stmt = bce->topStmt; stmt; stmt = stmt->down) { if (stmt->type == STMT_CATCH) return true; } size_t hops = 0; - FunctionBox *funbox = bce->sc->asFunctionBox(); + FunctionBox* funbox = bce->sc->asFunctionBox(); if (funbox->hasExtensibleScope()) return false; if (funbox->function()->isNamedLambda() && funbox->function()->atom() == pn->pn_atom) @@ -1442,7 +1442,7 @@ TryConvertFreeName(BytecodeEmitter *bce, ParseNode *pn) // Unbound names in function code may not be globals if new locals can // be added to this function (or an enclosing one) to alias a global // reference. - FunctionBox *funbox = bce->sc->asFunctionBox(); + FunctionBox* funbox = bce->sc->asFunctionBox(); if (funbox->mightAliasLocals()) return false; } @@ -1496,7 +1496,7 @@ TryConvertFreeName(BytecodeEmitter *bce, ParseNode *pn) * op=, e.g. +=). */ static bool -BindNameToSlotHelper(ExclusiveContext *cx, BytecodeEmitter *bce, ParseNode *pn) +BindNameToSlotHelper(ExclusiveContext* cx, BytecodeEmitter* bce, ParseNode* pn) { JS_ASSERT(pn->isKind(PNK_NAME)); @@ -1515,14 +1515,14 @@ BindNameToSlotHelper(ExclusiveContext *cx, BytecodeEmitter *bce, ParseNode *pn) * The parser already linked name uses to definitions when (where not * prevented by non-lexical constructs like 'with' and 'eval'). */ - Definition *dn; + Definition* dn; if (pn->isUsed()) { JS_ASSERT(pn->pn_cookie.isFree()); dn = pn->pn_lexdef; JS_ASSERT(dn->isDefn()); pn->pn_dflags |= (dn->pn_dflags & PND_CONST); } else if (pn->isDefn()) { - dn = (Definition *) pn; + dn = (Definition*) pn; } else { return true; } @@ -1645,7 +1645,7 @@ BindNameToSlotHelper(ExclusiveContext *cx, BytecodeEmitter *bce, ParseNode *pn) if (dn->pn_cookie.level() != bce->script->staticLevel()) return true; - DebugOnly fun = bce->sc->asFunctionBox()->function(); + DebugOnly fun = bce->sc->asFunctionBox()->function(); JS_ASSERT(fun->isLambda()); JS_ASSERT(pn->pn_atom == fun->atom()); @@ -1708,7 +1708,7 @@ BindNameToSlotHelper(ExclusiveContext *cx, BytecodeEmitter *bce, ParseNode *pn) * associated types::TypeSet. */ if (skip) { - BytecodeEmitter *bceSkipped = bce; + BytecodeEmitter* bceSkipped = bce; for (unsigned i = 0; i < skip; i++) bceSkipped = bceSkipped->parent; if (!bceSkipped->sc->isFunctionBox()) @@ -1730,7 +1730,7 @@ BindNameToSlotHelper(ExclusiveContext *cx, BytecodeEmitter *bce, ParseNode *pn) * and we do not want to allow self-hosted code to use the dynamic scope. */ static bool -BindNameToSlot(ExclusiveContext *cx, BytecodeEmitter *bce, ParseNode *pn) +BindNameToSlot(ExclusiveContext* cx, BytecodeEmitter* bce, ParseNode* pn) { if (!BindNameToSlotHelper(cx, bce, pn)) return false; @@ -1756,7 +1756,7 @@ BindNameToSlot(ExclusiveContext *cx, BytecodeEmitter *bce, ParseNode *pn) * pop bytecode. */ static bool -CheckSideEffects(ExclusiveContext *cx, BytecodeEmitter *bce, ParseNode *pn, bool *answer) +CheckSideEffects(ExclusiveContext* cx, BytecodeEmitter* bce, ParseNode* pn, bool* answer) { if (!pn || *answer) return true; @@ -1781,7 +1781,7 @@ CheckSideEffects(ExclusiveContext *cx, BytecodeEmitter *bce, ParseNode *pn, bool * toString or valueOf. */ bool ok = true; - for (ParseNode *pn2 = pn->pn_head; pn2; pn2 = pn2->pn_next) + for (ParseNode* pn2 = pn->pn_head; pn2; pn2 = pn2->pn_next) ok &= CheckSideEffects(cx, bce, pn2, answer); return ok; } @@ -1826,7 +1826,7 @@ CheckSideEffects(ExclusiveContext *cx, BytecodeEmitter *bce, ParseNode *pn, bool * The only exception is assignment of a useless value to a const * declared in the function currently being compiled. */ - ParseNode *pn2 = pn->pn_left; + ParseNode* pn2 = pn->pn_left; if (!pn2->isKind(PNK_NAME)) { *answer = true; } else { @@ -1861,7 +1861,7 @@ CheckSideEffects(ExclusiveContext *cx, BytecodeEmitter *bce, ParseNode *pn, bool switch (pn->getKind()) { case PNK_DELETE: { - ParseNode *pn2 = pn->pn_kid; + ParseNode* pn2 = pn->pn_kid; switch (pn2->getKind()) { case PNK_NAME: if (!BindNameToSlot(cx, bce, pn2)) @@ -1940,7 +1940,7 @@ CheckSideEffects(ExclusiveContext *cx, BytecodeEmitter *bce, ParseNode *pn, bool bool BytecodeEmitter::isInLoop() { - for (StmtInfoBCE *stmt = topStmt; stmt; stmt = stmt->down) { + for (StmtInfoBCE* stmt = topStmt; stmt; stmt = stmt->down) { if (stmt->isLoop()) return true; } @@ -1966,7 +1966,7 @@ BytecodeEmitter::needsImplicitThis() if (sc->asFunctionBox()->inWith) return true; } else { - JSObject *scope = sc->asGlobalSharedContext()->scopeChain(); + JSObject* scope = sc->asGlobalSharedContext()->scopeChain(); while (scope) { if (scope->is()) return true; @@ -1974,7 +1974,7 @@ BytecodeEmitter::needsImplicitThis() } } - for (StmtInfoBCE *stmt = topStmt; stmt; stmt = stmt->down) { + for (StmtInfoBCE* stmt = topStmt; stmt; stmt = stmt->down) { if (stmt->type == STMT_WITH) return true; } @@ -1982,7 +1982,7 @@ BytecodeEmitter::needsImplicitThis() } void -BytecodeEmitter::tellDebuggerAboutCompiledScript(ExclusiveContext *cx) +BytecodeEmitter::tellDebuggerAboutCompiledScript(ExclusiveContext* cx) { // Note: when parsing off thread the resulting scripts need to be handed to // the debugger after rejoining to the main thread. @@ -1994,21 +1994,21 @@ BytecodeEmitter::tellDebuggerAboutCompiledScript(ExclusiveContext *cx) // Lazy scripts are never top level (despite always being invoked with a // nullptr parent), and so the hook should never be fired. if (emitterMode != LazyFunction && !parent) { - GlobalObject *compileAndGoGlobal = nullptr; + GlobalObject* compileAndGoGlobal = nullptr; if (script->compileAndGo()) compileAndGoGlobal = &script->global(); Debugger::onNewScript(cx->asJSContext(), script, compileAndGoGlobal); } } -inline TokenStream * +inline TokenStream* BytecodeEmitter::tokenStream() { return &parser->tokenStream; } bool -BytecodeEmitter::reportError(ParseNode *pn, unsigned errorNumber, ...) +BytecodeEmitter::reportError(ParseNode* pn, unsigned errorNumber, ...) { TokenPos pos = pn ? pn->pn_pos : tokenStream()->currentToken().pos; @@ -2021,7 +2021,7 @@ BytecodeEmitter::reportError(ParseNode *pn, unsigned errorNumber, ...) } bool -BytecodeEmitter::reportStrictWarning(ParseNode *pn, unsigned errorNumber, ...) +BytecodeEmitter::reportStrictWarning(ParseNode* pn, unsigned errorNumber, ...) { TokenPos pos = pn ? pn->pn_pos : tokenStream()->currentToken().pos; @@ -2033,7 +2033,7 @@ BytecodeEmitter::reportStrictWarning(ParseNode *pn, unsigned errorNumber, ...) } bool -BytecodeEmitter::reportStrictModeError(ParseNode *pn, unsigned errorNumber, ...) +BytecodeEmitter::reportStrictModeError(ParseNode* pn, unsigned errorNumber, ...) { TokenPos pos = pn ? pn->pn_pos : tokenStream()->currentToken().pos; @@ -2046,14 +2046,14 @@ BytecodeEmitter::reportStrictModeError(ParseNode *pn, unsigned errorNumber, ...) } static bool -EmitNewInit(ExclusiveContext *cx, BytecodeEmitter *bce, JSProtoKey key) +EmitNewInit(ExclusiveContext* cx, BytecodeEmitter* bce, JSProtoKey key) { const size_t len = 1 + UINT32_INDEX_LEN; ptrdiff_t offset = EmitCheck(cx, bce, len); if (offset < 0) return false; - jsbytecode *code = bce->code(offset); + jsbytecode* code = bce->code(offset); code[0] = JSOP_NEWINIT; code[1] = jsbytecode(key); code[2] = 0; @@ -2065,7 +2065,7 @@ EmitNewInit(ExclusiveContext *cx, BytecodeEmitter *bce, JSProtoKey key) } static bool -IteratorResultShape(ExclusiveContext *cx, BytecodeEmitter *bce, unsigned *shape) +IteratorResultShape(ExclusiveContext* cx, BytecodeEmitter* bce, unsigned* shape) { JS_ASSERT(bce->script->compileAndGo()); @@ -2084,7 +2084,7 @@ IteratorResultShape(ExclusiveContext *cx, BytecodeEmitter *bce, unsigned *shape) JSPROP_ENUMERATE)) return false; - ObjectBox *objbox = bce->parser->newObjectBox(obj); + ObjectBox* objbox = bce->parser->newObjectBox(obj); if (!objbox) return false; @@ -2094,7 +2094,7 @@ IteratorResultShape(ExclusiveContext *cx, BytecodeEmitter *bce, unsigned *shape) } static bool -EmitPrepareIteratorResult(ExclusiveContext *cx, BytecodeEmitter *bce) +EmitPrepareIteratorResult(ExclusiveContext* cx, BytecodeEmitter* bce) { if (bce->script->compileAndGo()) { unsigned shape; @@ -2107,7 +2107,7 @@ EmitPrepareIteratorResult(ExclusiveContext *cx, BytecodeEmitter *bce) } static bool -EmitFinishIteratorResult(ExclusiveContext *cx, BytecodeEmitter *bce, bool done) +EmitFinishIteratorResult(ExclusiveContext* cx, BytecodeEmitter* bce, bool done) { jsatomid value_id; if (!bce->makeAtomIndex(cx->names().value, &value_id)) @@ -2128,7 +2128,7 @@ EmitFinishIteratorResult(ExclusiveContext *cx, BytecodeEmitter *bce, bool done) } static bool -EmitNameOp(ExclusiveContext *cx, BytecodeEmitter *bce, ParseNode *pn, bool callContext) +EmitNameOp(ExclusiveContext* cx, BytecodeEmitter* bce, ParseNode* pn, bool callContext) { if (!BindNameToSlot(cx, bce, pn)) return false; @@ -2164,10 +2164,10 @@ EmitNameOp(ExclusiveContext *cx, BytecodeEmitter *bce, ParseNode *pn, bool callC } static bool -EmitPropLHS(ExclusiveContext *cx, ParseNode *pn, JSOp op, BytecodeEmitter *bce) +EmitPropLHS(ExclusiveContext* cx, ParseNode* pn, JSOp op, BytecodeEmitter* bce) { JS_ASSERT(pn->isKind(PNK_DOT)); - ParseNode *pn2 = pn->maybeExpr(); + ParseNode* pn2 = pn->maybeExpr(); /* * If the object operand is also a dotted property reference, reverse the @@ -2175,8 +2175,8 @@ EmitPropLHS(ExclusiveContext *cx, ParseNode *pn, JSOp op, BytecodeEmitter *bce) * bottom up (reversing again as we go), to avoid excessive recursion. */ if (pn2->isKind(PNK_DOT)) { - ParseNode *pndot = pn2; - ParseNode *pnup = nullptr, *pndown; + ParseNode* pndot = pn2; + ParseNode* pnup = nullptr, *pndown; ptrdiff_t top = bce->offset(); for (;;) { /* Reverse pndot->pn_expr to point up, not down. */ @@ -2212,7 +2212,7 @@ EmitPropLHS(ExclusiveContext *cx, ParseNode *pn, JSOp op, BytecodeEmitter *bce) } static bool -EmitPropOp(ExclusiveContext *cx, ParseNode *pn, JSOp op, BytecodeEmitter *bce) +EmitPropOp(ExclusiveContext* cx, ParseNode* pn, JSOp op, BytecodeEmitter* bce) { JS_ASSERT(pn->isArity(PN_NAME)); @@ -2232,7 +2232,7 @@ EmitPropOp(ExclusiveContext *cx, ParseNode *pn, JSOp op, BytecodeEmitter *bce) } static bool -EmitPropIncDec(ExclusiveContext *cx, ParseNode *pn, BytecodeEmitter *bce) +EmitPropIncDec(ExclusiveContext* cx, ParseNode* pn, BytecodeEmitter* bce) { JS_ASSERT(pn->pn_kid->getKind() == PNK_DOT); @@ -2271,9 +2271,9 @@ EmitPropIncDec(ExclusiveContext *cx, ParseNode *pn, BytecodeEmitter *bce) } static bool -EmitNameIncDec(ExclusiveContext *cx, ParseNode *pn, BytecodeEmitter *bce) +EmitNameIncDec(ExclusiveContext* cx, ParseNode* pn, BytecodeEmitter* bce) { - const JSCodeSpec *cs = &js_CodeSpec[pn->pn_kid->getOp()]; + const JSCodeSpec* cs = &js_CodeSpec[pn->pn_kid->getOp()]; bool global = (cs->format & JOF_GNAME); bool post; @@ -2313,7 +2313,7 @@ EmitNameIncDec(ExclusiveContext *cx, ParseNode *pn, BytecodeEmitter *bce) * value to be assigned must already be pushed. */ static bool -EmitElemOperands(ExclusiveContext *cx, ParseNode *pn, JSOp op, BytecodeEmitter *bce) +EmitElemOperands(ExclusiveContext* cx, ParseNode* pn, JSOp op, BytecodeEmitter* bce) { JS_ASSERT(pn->isArity(PN_BINARY)); if (!EmitTree(cx, bce, pn->pn_left)) @@ -2328,7 +2328,7 @@ EmitElemOperands(ExclusiveContext *cx, ParseNode *pn, JSOp op, BytecodeEmitter * } static inline bool -EmitElemOpBase(ExclusiveContext *cx, BytecodeEmitter *bce, JSOp op) +EmitElemOpBase(ExclusiveContext* cx, BytecodeEmitter* bce, JSOp op) { if (Emit1(cx, bce, op) < 0) return false; @@ -2342,13 +2342,13 @@ EmitElemOpBase(ExclusiveContext *cx, BytecodeEmitter *bce, JSOp op) } static bool -EmitElemOp(ExclusiveContext *cx, ParseNode *pn, JSOp op, BytecodeEmitter *bce) +EmitElemOp(ExclusiveContext* cx, ParseNode* pn, JSOp op, BytecodeEmitter* bce) { return EmitElemOperands(cx, pn, op, bce) && EmitElemOpBase(cx, bce, op); } static bool -EmitElemIncDec(ExclusiveContext *cx, ParseNode *pn, BytecodeEmitter *bce) +EmitElemIncDec(ExclusiveContext* cx, ParseNode* pn, BytecodeEmitter* bce) { JS_ASSERT(pn->pn_kid->getKind() == PNK_ELEM); @@ -2396,12 +2396,12 @@ EmitElemIncDec(ExclusiveContext *cx, ParseNode *pn, BytecodeEmitter *bce) } static bool -EmitNumberOp(ExclusiveContext *cx, double dval, BytecodeEmitter *bce) +EmitNumberOp(ExclusiveContext* cx, double dval, BytecodeEmitter* bce) { int32_t ival; uint32_t u; ptrdiff_t off; - jsbytecode *pc; + jsbytecode* pc; if (NumberIsInt32(dval, &ival)) { if (ival == 0) @@ -2437,13 +2437,13 @@ EmitNumberOp(ExclusiveContext *cx, double dval, BytecodeEmitter *bce) } static inline void -SetJumpOffsetAt(BytecodeEmitter *bce, ptrdiff_t off) +SetJumpOffsetAt(BytecodeEmitter* bce, ptrdiff_t off) { SET_JUMP_OFFSET(bce->code(off), bce->offset() - off); } static bool -PushUndefinedValues(ExclusiveContext *cx, BytecodeEmitter *bce, unsigned n) +PushUndefinedValues(ExclusiveContext* cx, BytecodeEmitter* bce, unsigned n) { for (unsigned i = 0; i < n; ++i) { if (Emit1(cx, bce, JSOP_UNDEFINED) < 0) @@ -2453,8 +2453,8 @@ PushUndefinedValues(ExclusiveContext *cx, BytecodeEmitter *bce, unsigned n) } static bool -InitializeBlockScopedLocalsFromStack(ExclusiveContext *cx, BytecodeEmitter *bce, - Handle blockObj) +InitializeBlockScopedLocalsFromStack(ExclusiveContext* cx, BytecodeEmitter* bce, + Handle blockObj) { for (unsigned i = blockObj->numVariables(); i > 0; --i) { if (blockObj->isAliased(i - 1)) { @@ -2475,11 +2475,11 @@ InitializeBlockScopedLocalsFromStack(ExclusiveContext *cx, BytecodeEmitter *bce, } static bool -EnterBlockScope(ExclusiveContext *cx, BytecodeEmitter *bce, StmtInfoBCE *stmtInfo, - ObjectBox *objbox, unsigned alreadyPushed = 0) +EnterBlockScope(ExclusiveContext* cx, BytecodeEmitter* bce, StmtInfoBCE* stmtInfo, + ObjectBox* objbox, unsigned alreadyPushed = 0) { // Initial values for block-scoped locals. - Rooted blockObj(cx, &objbox->object->as()); + Rooted blockObj(cx, &objbox->object->as()); if (!PushUndefinedValues(cx, bce, blockObj->numVariables() - alreadyPushed)) return false; @@ -2498,16 +2498,16 @@ EnterBlockScope(ExclusiveContext *cx, BytecodeEmitter *bce, StmtInfoBCE *stmtInf * into EmitTree which is recursive and uses relatively little stack space. */ MOZ_NEVER_INLINE static bool -EmitSwitch(ExclusiveContext *cx, BytecodeEmitter *bce, ParseNode *pn) +EmitSwitch(ExclusiveContext* cx, BytecodeEmitter* bce, ParseNode* pn) { JSOp switchOp; bool hasDefault; ptrdiff_t top, off, defaultOffset; - ParseNode *pn2, *pn3, *pn4; + ParseNode* pn2, *pn3, *pn4; int32_t low, high; int noteIndex; size_t switchSize; - jsbytecode *pc; + jsbytecode* pc; /* Try for most optimal, fall back if not dense ints. */ switchOp = JSOP_TABLESWITCH; @@ -2556,7 +2556,7 @@ EmitSwitch(ExclusiveContext *cx, BytecodeEmitter *bce, ParseNode *pn) bool ok = true; #define INTMAP_LENGTH 256 jsbitmap intmap_space[INTMAP_LENGTH]; - jsbitmap *intmap = nullptr; + jsbitmap* intmap = nullptr; int32_t intmap_bitlen = 0; low = JSVAL_INT_MAX; @@ -2829,14 +2829,14 @@ BytecodeEmitter::isRunOnceLambda() if (!(parent && parent->emittingRunOnceLambda) && !lazyRunOnceLambda) return false; - FunctionBox *funbox = sc->asFunctionBox(); + FunctionBox* funbox = sc->asFunctionBox(); return !funbox->argumentsHasLocalBinding() && !funbox->isGenerator() && !funbox->function()->name(); } bool -frontend::EmitFunctionScript(ExclusiveContext *cx, BytecodeEmitter *bce, ParseNode *body) +frontend::EmitFunctionScript(ExclusiveContext* cx, BytecodeEmitter* bce, ParseNode* body) { /* * IonBuilder has assumptions about what may occur immediately after @@ -2845,7 +2845,7 @@ frontend::EmitFunctionScript(ExclusiveContext *cx, BytecodeEmitter *bce, ParseNo * execution starts from script->code, so this has no semantic effect. */ - FunctionBox *funbox = bce->sc->asFunctionBox(); + FunctionBox* funbox = bce->sc->asFunctionBox(); if (funbox->argumentsHasLocalBinding()) { JS_ASSERT(bce->offset() == 0); /* See JSScript::argumentsBytecode. */ bce->switchToProlog(); @@ -2940,8 +2940,8 @@ frontend::EmitFunctionScript(ExclusiveContext *cx, BytecodeEmitter *bce, ParseNo } static bool -MaybeEmitVarDecl(ExclusiveContext *cx, BytecodeEmitter *bce, JSOp prologOp, ParseNode *pn, - jsatomid *result) +MaybeEmitVarDecl(ExclusiveContext* cx, BytecodeEmitter* bce, JSOp prologOp, ParseNode* pn, + jsatomid* result) { jsatomid atomIndex; @@ -2984,10 +2984,10 @@ enum VarEmitOption }; typedef bool -(*DestructuringDeclEmitter)(ExclusiveContext *cx, BytecodeEmitter *bce, JSOp prologOp, ParseNode *pn); +(*DestructuringDeclEmitter)(ExclusiveContext* cx, BytecodeEmitter* bce, JSOp prologOp, ParseNode* pn); static bool -EmitDestructuringDecl(ExclusiveContext *cx, BytecodeEmitter *bce, JSOp prologOp, ParseNode *pn) +EmitDestructuringDecl(ExclusiveContext* cx, BytecodeEmitter* bce, JSOp prologOp, ParseNode* pn) { JS_ASSERT(pn->isKind(PNK_NAME)); if (!BindNameToSlot(cx, bce, pn)) @@ -2998,11 +2998,11 @@ EmitDestructuringDecl(ExclusiveContext *cx, BytecodeEmitter *bce, JSOp prologOp, } static bool -EmitDestructuringDecls(ExclusiveContext *cx, BytecodeEmitter *bce, JSOp prologOp, - ParseNode *pattern) +EmitDestructuringDecls(ExclusiveContext* cx, BytecodeEmitter* bce, JSOp prologOp, + ParseNode* pattern) { if (pattern->isKind(PNK_ARRAY)) { - for (ParseNode *element = pattern->pn_head; element; element = element->pn_next) { + for (ParseNode* element = pattern->pn_head; element; element = element->pn_next) { if (element->isKind(PNK_ELISION)) continue; DestructuringDeclEmitter emitter = @@ -3014,8 +3014,8 @@ EmitDestructuringDecls(ExclusiveContext *cx, BytecodeEmitter *bce, JSOp prologOp } MOZ_ASSERT(pattern->isKind(PNK_OBJECT)); - for (ParseNode *member = pattern->pn_head; member; member = member->pn_next) { - ParseNode *target = member->pn_right; + for (ParseNode* member = pattern->pn_head; member; member = member->pn_next) { + ParseNode* target = member->pn_right; DestructuringDeclEmitter emitter = target->isKind(PNK_NAME) ? EmitDestructuringDecl : EmitDestructuringDecls; if (!emitter(cx, bce, prologOp, target)) @@ -3025,7 +3025,7 @@ EmitDestructuringDecls(ExclusiveContext *cx, BytecodeEmitter *bce, JSOp prologOp } static bool -EmitDestructuringOpsHelper(ExclusiveContext *cx, BytecodeEmitter *bce, ParseNode *pn, +EmitDestructuringOpsHelper(ExclusiveContext* cx, BytecodeEmitter* bce, ParseNode* pn, VarEmitOption emitOption); /* @@ -3041,7 +3041,7 @@ EmitDestructuringOpsHelper(ExclusiveContext *cx, BytecodeEmitter *bce, ParseNode * lhs expression. (Same post-condition as EmitDestructuringOpsHelper) */ static bool -EmitDestructuringLHS(ExclusiveContext *cx, BytecodeEmitter *bce, ParseNode *pn, VarEmitOption emitOption) +EmitDestructuringLHS(ExclusiveContext* cx, BytecodeEmitter* bce, ParseNode* pn, VarEmitOption emitOption) { JS_ASSERT(emitOption != DefineVars); @@ -3180,13 +3180,13 @@ EmitDestructuringLHS(ExclusiveContext *cx, BytecodeEmitter *bce, ParseNode *pn, * lhs expression. (Same post-condition as EmitDestructuringLHS) */ static bool -EmitDestructuringOpsHelper(ExclusiveContext *cx, BytecodeEmitter *bce, ParseNode *pn, +EmitDestructuringOpsHelper(ExclusiveContext* cx, BytecodeEmitter* bce, ParseNode* pn, VarEmitOption emitOption) { JS_ASSERT(emitOption != DefineVars); unsigned index; - ParseNode *pn2, *pn3; + ParseNode* pn2, *pn3; bool doElemOp; #ifdef DEBUG @@ -3217,13 +3217,13 @@ EmitDestructuringOpsHelper(ExclusiveContext *cx, BytecodeEmitter *bce, ParseNode JS_ASSERT(pn->isKind(PNK_OBJECT)); JS_ASSERT(pn2->isKind(PNK_COLON)); - ParseNode *key = pn2->pn_left; + ParseNode* key = pn2->pn_left; if (key->isKind(PNK_NUMBER)) { if (!EmitNumberOp(cx, key->pn_dval, bce)) return false; } else { MOZ_ASSERT(key->isKind(PNK_STRING) || key->isKind(PNK_NAME)); - PropertyName *name = key->pn_atom->asPropertyName(); + PropertyName* name = key->pn_atom->asPropertyName(); // The parser already checked for atoms representing indexes and // used PNK_NUMBER instead, but also watch for ids which TI treats @@ -3304,7 +3304,7 @@ EmitDestructuringOpsHelper(ExclusiveContext *cx, BytecodeEmitter *bce, ParseNode } static bool -EmitDestructuringOps(ExclusiveContext *cx, BytecodeEmitter *bce, ParseNode *pn, bool isLet = false) +EmitDestructuringOps(ExclusiveContext* cx, BytecodeEmitter* bce, ParseNode* pn, bool isLet = false) { /* * Call our recursive helper to emit the destructuring assignments and @@ -3315,11 +3315,11 @@ EmitDestructuringOps(ExclusiveContext *cx, BytecodeEmitter *bce, ParseNode *pn, } static bool -EmitGroupAssignment(ExclusiveContext *cx, BytecodeEmitter *bce, JSOp prologOp, - ParseNode *lhs, ParseNode *rhs) +EmitGroupAssignment(ExclusiveContext* cx, BytecodeEmitter* bce, JSOp prologOp, + ParseNode* lhs, ParseNode* rhs) { uint32_t depth, limit, i, nslots; - ParseNode *pn; + ParseNode* pn; depth = limit = (uint32_t) bce->stackDepth; for (pn = rhs->pn_head; pn; pn = pn->pn_next) { @@ -3366,15 +3366,15 @@ enum GroupOption { GroupIsDecl, GroupIsNotDecl }; * we set *pop to JSOP_NOP so callers can veto emitting pn followed by a pop. */ static bool -MaybeEmitGroupAssignment(ExclusiveContext *cx, BytecodeEmitter *bce, JSOp prologOp, ParseNode *pn, - GroupOption groupOption, JSOp *pop) +MaybeEmitGroupAssignment(ExclusiveContext* cx, BytecodeEmitter* bce, JSOp prologOp, ParseNode* pn, + GroupOption groupOption, JSOp* pop) { JS_ASSERT(pn->isKind(PNK_ASSIGN)); JS_ASSERT(pn->isOp(JSOP_NOP)); JS_ASSERT(*pop == JSOP_POP || *pop == JSOP_SETRVAL); - ParseNode *lhs = pn->pn_left; - ParseNode *rhs = pn->pn_right; + ParseNode* lhs = pn->pn_left; + ParseNode* rhs = pn->pn_right; if (lhs->isKind(PNK_ARRAY) && rhs->isKind(PNK_ARRAY) && !(rhs->pn_xflags & PNX_SPECIALARRAYINIT) && lhs->pn_count <= rhs->pn_count) @@ -3399,25 +3399,25 @@ MaybeEmitGroupAssignment(ExclusiveContext *cx, BytecodeEmitter *bce, JSOp prolog * 1:1 correspondence and lhs elements are simple names. */ static bool -MaybeEmitLetGroupDecl(ExclusiveContext *cx, BytecodeEmitter *bce, ParseNode *pn, JSOp *pop) +MaybeEmitLetGroupDecl(ExclusiveContext* cx, BytecodeEmitter* bce, ParseNode* pn, JSOp* pop) { JS_ASSERT(pn->isKind(PNK_ASSIGN)); JS_ASSERT(pn->isOp(JSOP_NOP)); JS_ASSERT(*pop == JSOP_POP || *pop == JSOP_SETRVAL); - ParseNode *lhs = pn->pn_left; - ParseNode *rhs = pn->pn_right; + ParseNode* lhs = pn->pn_left; + ParseNode* rhs = pn->pn_right; if (lhs->isKind(PNK_ARRAY) && rhs->isKind(PNK_ARRAY) && !(rhs->pn_xflags & PNX_SPECIALARRAYINIT) && !(lhs->pn_xflags & PNX_SPECIALARRAYINIT) && lhs->pn_count == rhs->pn_count) { - for (ParseNode *l = lhs->pn_head; l; l = l->pn_next) { + for (ParseNode* l = lhs->pn_head; l; l = l->pn_next) { if (l->getOp() != JSOP_SETLOCAL) return true; } - for (ParseNode *r = rhs->pn_head; r; r = r->pn_next) { + for (ParseNode* r = rhs->pn_head; r; r = r->pn_next) { if (!EmitTree(cx, bce, r)) return false; } @@ -3428,19 +3428,19 @@ MaybeEmitLetGroupDecl(ExclusiveContext *cx, BytecodeEmitter *bce, ParseNode *pn, } static bool -EmitVariables(ExclusiveContext *cx, BytecodeEmitter *bce, ParseNode *pn, VarEmitOption emitOption, +EmitVariables(ExclusiveContext* cx, BytecodeEmitter* bce, ParseNode* pn, VarEmitOption emitOption, bool isLet = false) { JS_ASSERT(pn->isArity(PN_LIST)); JS_ASSERT(isLet == (emitOption == PushInitialValues)); - ParseNode *next; - for (ParseNode *pn2 = pn->pn_head; ; pn2 = next) { + ParseNode* next; + for (ParseNode* pn2 = pn->pn_head; ; pn2 = next) { if (!UpdateSourceCoordNotes(cx, bce, pn2->pn_pos.begin)) return false; next = pn2->pn_next; - ParseNode *pn3; + ParseNode* pn3; if (!pn2->isKind(PNK_NAME)) { if (pn2->isKind(PNK_ARRAY) || pn2->isKind(PNK_OBJECT)) { /* @@ -3599,7 +3599,7 @@ EmitVariables(ExclusiveContext *cx, BytecodeEmitter *bce, ParseNode *pn, VarEmit } static bool -EmitAssignment(ExclusiveContext *cx, BytecodeEmitter *bce, ParseNode *lhs, JSOp op, ParseNode *rhs) +EmitAssignment(ExclusiveContext* cx, BytecodeEmitter* bce, ParseNode* lhs, JSOp op, ParseNode* rhs) { /* * Check left operand type and generate specialized code for it. @@ -3801,7 +3801,7 @@ EmitAssignment(ExclusiveContext *cx, BytecodeEmitter *bce, ParseNode *lhs, JSOp } bool -ParseNode::getConstantValue(ExclusiveContext *cx, bool strictChecks, MutableHandleValue vp) +ParseNode::getConstantValue(ExclusiveContext* cx, bool strictChecks, MutableHandleValue vp) { switch (getKind()) { case PNK_NUMBER: @@ -3832,7 +3832,7 @@ ParseNode::getConstantValue(ExclusiveContext *cx, bool strictChecks, MutableHand unsigned idx = 0; RootedId id(cx); RootedValue value(cx); - for (ParseNode *pn = pn_head; pn; idx++, pn = pn->pn_next) { + for (ParseNode* pn = pn_head; pn; idx++, pn = pn->pn_next) { if (!pn->getConstantValue(cx, strictChecks, &value)) return false; id = INT_TO_JSID(idx); @@ -3855,11 +3855,11 @@ ParseNode::getConstantValue(ExclusiveContext *cx, bool strictChecks, MutableHand return false; RootedValue value(cx), idvalue(cx); - for (ParseNode *pn = pn_head; pn; pn = pn->pn_next) { + for (ParseNode* pn = pn_head; pn; pn = pn->pn_next) { if (!pn->pn_right->getConstantValue(cx, strictChecks, &value)) return false; - ParseNode *pnid = pn->pn_left; + ParseNode* pnid = pn->pn_left; if (pnid->isKind(PNK_NUMBER)) { idvalue = NumberValue(pnid->pn_dval); } else { @@ -3879,7 +3879,7 @@ ParseNode::getConstantValue(ExclusiveContext *cx, bool strictChecks, MutableHand continue; } - JSAtom *name = ToAtom(cx, idvalue); + JSAtom* name = ToAtom(cx, idvalue); if (!name) return false; @@ -3907,14 +3907,14 @@ ParseNode::getConstantValue(ExclusiveContext *cx, bool strictChecks, MutableHand } static bool -EmitSingletonInitialiser(ExclusiveContext *cx, BytecodeEmitter *bce, ParseNode *pn) +EmitSingletonInitialiser(ExclusiveContext* cx, BytecodeEmitter* bce, ParseNode* pn) { RootedValue value(cx); if (!pn->getConstantValue(cx, bce->sc->needStrictChecks(), &value)) return false; JS_ASSERT(value.isObject()); - ObjectBox *objbox = bce->parser->newObjectBox(&value.toObject()); + ObjectBox* objbox = bce->parser->newObjectBox(&value.toObject()); if (!objbox) return false; @@ -3929,22 +3929,22 @@ namespace { class EmitLevelManager { - BytecodeEmitter *bce; + BytecodeEmitter* bce; public: - EmitLevelManager(BytecodeEmitter *bce) : bce(bce) { bce->emitLevel++; } + EmitLevelManager(BytecodeEmitter* bce) : bce(bce) { bce->emitLevel++; } ~EmitLevelManager() { bce->emitLevel--; } }; } /* anonymous namespace */ static bool -EmitCatch(ExclusiveContext *cx, BytecodeEmitter *bce, ParseNode *pn) +EmitCatch(ExclusiveContext* cx, BytecodeEmitter* bce, ParseNode* pn) { /* * Morph STMT_BLOCK to STMT_CATCH, note the block entry code offset, * and save the block object atom. */ - StmtInfoBCE *stmt = bce->topStmt; + StmtInfoBCE* stmt = bce->topStmt; JS_ASSERT(stmt->type == STMT_BLOCK && stmt->isBlockScope); stmt->type = STMT_CATCH; @@ -3963,7 +3963,7 @@ EmitCatch(ExclusiveContext *cx, BytecodeEmitter *bce, ParseNode *pn) if (pn->pn_kid2 && Emit1(cx, bce, JSOP_DUP) < 0) return false; - ParseNode *pn2 = pn->pn_kid1; + ParseNode* pn2 = pn->pn_kid1; switch (pn2->getKind()) { case PNK_ARRAY: case PNK_OBJECT: @@ -4034,7 +4034,7 @@ EmitCatch(ExclusiveContext *cx, BytecodeEmitter *bce, ParseNode *pn) // comment on EmitSwitch. // MOZ_NEVER_INLINE static bool -EmitTry(ExclusiveContext *cx, BytecodeEmitter *bce, ParseNode *pn) +EmitTry(ExclusiveContext* cx, BytecodeEmitter* bce, ParseNode* pn) { StmtInfoBCE stmtInfo(cx); @@ -4085,7 +4085,7 @@ EmitTry(ExclusiveContext *cx, BytecodeEmitter *bce, ParseNode *pn) ptrdiff_t tryEnd = bce->offset(); // If this try has a catch block, emit it. - if (ParseNode *pn2 = pn->pn_kid2) { + if (ParseNode* pn2 = pn->pn_kid2) { // The emitted code for a catch block looks like: // // [pushblockscope] only if any local aliased @@ -4111,7 +4111,7 @@ EmitTry(ExclusiveContext *cx, BytecodeEmitter *bce, ParseNode *pn) // code if appropriate, and is also used for the catch-all trynote for // capturing exceptions thrown from catch{} blocks. // - for (ParseNode *pn3 = pn2->pn_head; pn3; pn3 = pn3->pn_next) { + for (ParseNode* pn3 = pn2->pn_head; pn3; pn3 = pn3->pn_next) { JS_ASSERT(bce->stackDepth == depth); // Emit the lexical scope and catch body. @@ -4199,7 +4199,7 @@ EmitTry(ExclusiveContext *cx, BytecodeEmitter *bce, ParseNode *pn) } static bool -EmitIf(ExclusiveContext *cx, BytecodeEmitter *bce, ParseNode *pn) +EmitIf(ExclusiveContext* cx, BytecodeEmitter* bce, ParseNode* pn) { StmtInfoBCE stmtInfo(cx); @@ -4230,7 +4230,7 @@ EmitIf(ExclusiveContext *cx, BytecodeEmitter *bce, ParseNode *pn) } /* Emit an annotated branch-if-false around the then part. */ - ParseNode *pn3 = pn->pn_kid3; + ParseNode* pn3 = pn->pn_kid3; noteIndex = NewSrcNote(cx, bce, pn3 ? SRC_IF_ELSE : SRC_IF); if (noteIndex < 0) return false; @@ -4316,12 +4316,12 @@ EmitIf(ExclusiveContext *cx, BytecodeEmitter *bce, ParseNode *pn) * the comment on EmitSwitch. */ MOZ_NEVER_INLINE static bool -EmitLet(ExclusiveContext *cx, BytecodeEmitter *bce, ParseNode *pnLet) +EmitLet(ExclusiveContext* cx, BytecodeEmitter* bce, ParseNode* pnLet) { JS_ASSERT(pnLet->isArity(PN_BINARY)); - ParseNode *varList = pnLet->pn_left; + ParseNode* varList = pnLet->pn_left; JS_ASSERT(varList->isArity(PN_LIST)); - ParseNode *letBody = pnLet->pn_right; + ParseNode* letBody = pnLet->pn_right; JS_ASSERT(letBody->isLet() && letBody->isKind(PNK_LEXICALSCOPE)); int letHeadDepth = bce->stackDepth; @@ -4349,7 +4349,7 @@ EmitLet(ExclusiveContext *cx, BytecodeEmitter *bce, ParseNode *pnLet) * the comment on EmitSwitch. */ MOZ_NEVER_INLINE static bool -EmitLexicalScope(ExclusiveContext *cx, BytecodeEmitter *bce, ParseNode *pn) +EmitLexicalScope(ExclusiveContext* cx, BytecodeEmitter* bce, ParseNode* pn) { JS_ASSERT(pn->isKind(PNK_LEXICALSCOPE)); @@ -4367,7 +4367,7 @@ EmitLexicalScope(ExclusiveContext *cx, BytecodeEmitter *bce, ParseNode *pn) } static bool -EmitWith(ExclusiveContext *cx, BytecodeEmitter *bce, ParseNode *pn) +EmitWith(ExclusiveContext* cx, BytecodeEmitter* bce, ParseNode* pn) { StmtInfoBCE stmtInfo(cx); if (!EmitTree(cx, bce, pn->pn_left)) @@ -4382,19 +4382,19 @@ EmitWith(ExclusiveContext *cx, BytecodeEmitter *bce, ParseNode *pn) } static bool -EmitForOf(ExclusiveContext *cx, BytecodeEmitter *bce, ParseNode *pn, ptrdiff_t top) +EmitForOf(ExclusiveContext* cx, BytecodeEmitter* bce, ParseNode* pn, ptrdiff_t top) { - ParseNode *forHead = pn->pn_left; - ParseNode *forBody = pn->pn_right; + ParseNode* forHead = pn->pn_left; + ParseNode* forBody = pn->pn_right; - ParseNode *pn1 = forHead->pn_kid1; + ParseNode* pn1 = forHead->pn_kid1; bool letDecl = pn1 && pn1->isKind(PNK_LEXICALSCOPE); JS_ASSERT_IF(letDecl, pn1->isLet()); // If the left part is 'var x', emit code to define x if necessary using a // prolog opcode, but do not emit a pop. if (pn1) { - ParseNode *decl = letDecl ? pn1->pn_expr : pn1; + ParseNode* decl = letDecl ? pn1->pn_expr : pn1; JS_ASSERT(decl->isKind(PNK_VAR) || decl->isKind(PNK_LET)); bce->emittingForInit = true; if (!EmitVariables(cx, bce, decl, DefineVars)) @@ -4471,7 +4471,7 @@ EmitForOf(ExclusiveContext *cx, BytecodeEmitter *bce, ParseNode *pn, ptrdiff_t t return false; // Set loop and enclosing "update" offsets, for continue. - StmtInfoBCE *stmt = &stmtInfo; + StmtInfoBCE* stmt = &stmtInfo; do { stmt->update = bce->offset(); } while ((stmt = stmt->down) != nullptr && stmt->type == STMT_LABEL); @@ -4527,12 +4527,12 @@ EmitForOf(ExclusiveContext *cx, BytecodeEmitter *bce, ParseNode *pn, ptrdiff_t t } static bool -EmitForIn(ExclusiveContext *cx, BytecodeEmitter *bce, ParseNode *pn, ptrdiff_t top) +EmitForIn(ExclusiveContext* cx, BytecodeEmitter* bce, ParseNode* pn, ptrdiff_t top) { - ParseNode *forHead = pn->pn_left; - ParseNode *forBody = pn->pn_right; + ParseNode* forHead = pn->pn_left; + ParseNode* forBody = pn->pn_right; - ParseNode *pn1 = forHead->pn_kid1; + ParseNode* pn1 = forHead->pn_kid1; bool letDecl = pn1 && pn1->isKind(PNK_LEXICALSCOPE); JS_ASSERT_IF(letDecl, pn1->isLet()); @@ -4543,7 +4543,7 @@ EmitForIn(ExclusiveContext *cx, BytecodeEmitter *bce, ParseNode *pn, ptrdiff_t t * Parser::forStatement. 'for (let x = i in o)' is mercifully banned. */ if (pn1) { - ParseNode *decl = letDecl ? pn1->pn_expr : pn1; + ParseNode* decl = letDecl ? pn1->pn_expr : pn1; JS_ASSERT(decl->isKind(PNK_VAR) || decl->isKind(PNK_LET)); bce->emittingForInit = true; if (!EmitVariables(cx, bce, decl, DefineVars)) @@ -4616,7 +4616,7 @@ EmitForIn(ExclusiveContext *cx, BytecodeEmitter *bce, ParseNode *pn, ptrdiff_t t return false; /* Set loop and enclosing "update" offsets, for continue. */ - StmtInfoBCE *stmt = &stmtInfo; + StmtInfoBCE* stmt = &stmtInfo; do { stmt->update = bce->offset(); } while ((stmt = stmt->down) != nullptr && stmt->type == STMT_LABEL); @@ -4655,17 +4655,17 @@ EmitForIn(ExclusiveContext *cx, BytecodeEmitter *bce, ParseNode *pn, ptrdiff_t t } static bool -EmitNormalFor(ExclusiveContext *cx, BytecodeEmitter *bce, ParseNode *pn, ptrdiff_t top) +EmitNormalFor(ExclusiveContext* cx, BytecodeEmitter* bce, ParseNode* pn, ptrdiff_t top) { LoopStmtInfo stmtInfo(cx); PushLoopStatement(bce, &stmtInfo, STMT_FOR_LOOP, top); - ParseNode *forHead = pn->pn_left; - ParseNode *forBody = pn->pn_right; + ParseNode* forHead = pn->pn_left; + ParseNode* forBody = pn->pn_right; /* C-style for (init; cond; update) ... loop. */ JSOp op = JSOP_POP; - ParseNode *pn3 = forHead->pn_kid1; + ParseNode* pn3 = forHead->pn_kid1; if (!pn3) { // No initializer, but emit a nop so that there's somewhere to put the // SRC_FOR annotation that IonBuilder will look for. @@ -4735,7 +4735,7 @@ EmitNormalFor(ExclusiveContext *cx, BytecodeEmitter *bce, ParseNode *pn, ptrdiff ptrdiff_t tmp2 = bce->offset(); /* Set loop and enclosing "update" offsets, for continue. */ - StmtInfoBCE *stmt = &stmtInfo; + StmtInfoBCE* stmt = &stmtInfo; do { stmt->update = bce->offset(); } while ((stmt = stmt->down) != nullptr && stmt->type == STMT_LABEL); @@ -4803,7 +4803,7 @@ EmitNormalFor(ExclusiveContext *cx, BytecodeEmitter *bce, ParseNode *pn, ptrdiff } static inline bool -EmitFor(ExclusiveContext *cx, BytecodeEmitter *bce, ParseNode *pn, ptrdiff_t top) +EmitFor(ExclusiveContext* cx, BytecodeEmitter* bce, ParseNode* pn, ptrdiff_t top) { if (pn->pn_left->isKind(PNK_FORIN)) return EmitForIn(cx, bce, pn, top); @@ -4816,9 +4816,9 @@ EmitFor(ExclusiveContext *cx, BytecodeEmitter *bce, ParseNode *pn, ptrdiff_t top } static MOZ_NEVER_INLINE bool -EmitFunc(ExclusiveContext *cx, BytecodeEmitter *bce, ParseNode *pn) +EmitFunc(ExclusiveContext* cx, BytecodeEmitter* bce, ParseNode* pn) { - FunctionBox *funbox = pn->pn_funbox; + FunctionBox* funbox = pn->pn_funbox; RootedFunction fun(cx, funbox->function()); JS_ASSERT_IF(fun->isInterpretedLazy(), fun->lazyScript()); @@ -4853,16 +4853,16 @@ EmitFunc(ExclusiveContext *cx, BytecodeEmitter *bce, ParseNode *pn) if (fun->isInterpretedLazy()) { if (!fun->lazyScript()->sourceObject()) { - JSObject *scope = bce->staticScope; + JSObject* scope = bce->staticScope; if (!scope && bce->sc->isFunctionBox()) scope = bce->sc->asFunctionBox()->function(); - JSObject *source = bce->script->sourceObject(); + JSObject* source = bce->script->sourceObject(); fun->lazyScript()->setParent(scope, &source->as()); } if (bce->emittingRunOnceLambda) fun->lazyScript()->setTreatAsRunOnce(); } else { - SharedContext *outersc = bce->sc; + SharedContext* outersc = bce->sc; if (outersc->isFunctionBox() && outersc->asFunctionBox()->mightAliasLocals()) funbox->setMightAliasLocals(); // inherit mightAliasLocals from parent @@ -4962,7 +4962,7 @@ EmitFunc(ExclusiveContext *cx, BytecodeEmitter *bce, ParseNode *pn) } static bool -EmitDo(ExclusiveContext *cx, BytecodeEmitter *bce, ParseNode *pn) +EmitDo(ExclusiveContext* cx, BytecodeEmitter* bce, ParseNode* pn) { /* Emit an annotated nop so IonBuilder can recognize the 'do' loop. */ ptrdiff_t noteIndex = NewSrcNote(cx, bce, SRC_WHILE); @@ -4989,7 +4989,7 @@ EmitDo(ExclusiveContext *cx, BytecodeEmitter *bce, ParseNode *pn) /* Set loop and enclosing label update offsets, for continue. */ ptrdiff_t off = bce->offset(); - StmtInfoBCE *stmt = &stmtInfo; + StmtInfoBCE* stmt = &stmtInfo; do { stmt->update = off; } while ((stmt = stmt->down) != nullptr && stmt->type == STMT_LABEL); @@ -5021,7 +5021,7 @@ EmitDo(ExclusiveContext *cx, BytecodeEmitter *bce, ParseNode *pn) } static bool -EmitWhile(ExclusiveContext *cx, BytecodeEmitter *bce, ParseNode *pn, ptrdiff_t top) +EmitWhile(ExclusiveContext* cx, BytecodeEmitter* bce, ParseNode* pn, ptrdiff_t top) { /* * Minimize bytecodes issued for one or more iterations by jumping to @@ -5074,9 +5074,9 @@ EmitWhile(ExclusiveContext *cx, BytecodeEmitter *bce, ParseNode *pn, ptrdiff_t t } static bool -EmitBreak(ExclusiveContext *cx, BytecodeEmitter *bce, PropertyName *label) +EmitBreak(ExclusiveContext* cx, BytecodeEmitter* bce, PropertyName* label) { - StmtInfoBCE *stmt = bce->topStmt; + StmtInfoBCE* stmt = bce->topStmt; SrcNoteType noteType; if (label) { while (stmt->type != STMT_LABEL || stmt->label != label) @@ -5092,12 +5092,12 @@ EmitBreak(ExclusiveContext *cx, BytecodeEmitter *bce, PropertyName *label) } static bool -EmitContinue(ExclusiveContext *cx, BytecodeEmitter *bce, PropertyName *label) +EmitContinue(ExclusiveContext* cx, BytecodeEmitter* bce, PropertyName* label) { - StmtInfoBCE *stmt = bce->topStmt; + StmtInfoBCE* stmt = bce->topStmt; if (label) { /* Find the loop statement enclosed by the matching label. */ - StmtInfoBCE *loop = nullptr; + StmtInfoBCE* loop = nullptr; while (stmt->type != STMT_LABEL || stmt->label != label) { if (stmt->isLoop()) loop = stmt; @@ -5113,7 +5113,7 @@ EmitContinue(ExclusiveContext *cx, BytecodeEmitter *bce, PropertyName *label) } static bool -EmitReturn(ExclusiveContext *cx, BytecodeEmitter *bce, ParseNode *pn) +EmitReturn(ExclusiveContext* cx, BytecodeEmitter* bce, ParseNode* pn) { if (!UpdateSourceCoordNotes(cx, bce, pn->pn_pos.begin)) return false; @@ -5124,7 +5124,7 @@ EmitReturn(ExclusiveContext *cx, BytecodeEmitter *bce, ParseNode *pn) } /* Push a return value */ - if (ParseNode *pn2 = pn->pn_kid) { + if (ParseNode* pn2 = pn->pn_kid) { if (!EmitTree(cx, bce, pn2)) return false; } else { @@ -5169,7 +5169,7 @@ EmitReturn(ExclusiveContext *cx, BytecodeEmitter *bce, ParseNode *pn) } static bool -EmitYieldStar(ExclusiveContext *cx, BytecodeEmitter *bce, ParseNode *iter) +EmitYieldStar(ExclusiveContext* cx, BytecodeEmitter* bce, ParseNode* iter) { JS_ASSERT(bce->sc->isFunctionBox()); JS_ASSERT(bce->sc->asFunctionBox()->isStarGenerator()); @@ -5323,19 +5323,19 @@ EmitYieldStar(ExclusiveContext *cx, BytecodeEmitter *bce, ParseNode *iter) } static bool -EmitStatementList(ExclusiveContext *cx, BytecodeEmitter *bce, ParseNode *pn, ptrdiff_t top) +EmitStatementList(ExclusiveContext* cx, BytecodeEmitter* bce, ParseNode* pn, ptrdiff_t top) { JS_ASSERT(pn->isArity(PN_LIST)); StmtInfoBCE stmtInfo(cx); PushStatementBCE(bce, &stmtInfo, STMT_BLOCK, top); - ParseNode *pnchild = pn->pn_head; + ParseNode* pnchild = pn->pn_head; if (pn->pn_xflags & PNX_DESTRUCT) pnchild = pnchild->pn_next; - for (ParseNode *pn2 = pnchild; pn2; pn2 = pn2->pn_next) { + for (ParseNode* pn2 = pnchild; pn2; pn2 = pn2->pn_next) { if (!EmitTree(cx, bce, pn2)) return false; } @@ -5344,11 +5344,11 @@ EmitStatementList(ExclusiveContext *cx, BytecodeEmitter *bce, ParseNode *pn, ptr } static bool -EmitStatement(ExclusiveContext *cx, BytecodeEmitter *bce, ParseNode *pn) +EmitStatement(ExclusiveContext* cx, BytecodeEmitter* bce, ParseNode* pn) { JS_ASSERT(pn->isKind(PNK_SEMI)); - ParseNode *pn2 = pn->pn_kid; + ParseNode* pn2 = pn->pn_kid; if (!pn2) return true; @@ -5418,13 +5418,13 @@ EmitStatement(ExclusiveContext *cx, BytecodeEmitter *bce, ParseNode *pn) } static bool -EmitDelete(ExclusiveContext *cx, BytecodeEmitter *bce, ParseNode *pn) +EmitDelete(ExclusiveContext* cx, BytecodeEmitter* bce, ParseNode* pn) { /* * Under ECMA 3, deleting a non-reference returns true -- but alas we * must evaluate the operand if it appears it might have side effects. */ - ParseNode *pn2 = pn->pn_kid; + ParseNode* pn2 = pn->pn_kid; switch (pn2->getKind()) { case PNK_NAME: { @@ -5475,10 +5475,10 @@ EmitDelete(ExclusiveContext *cx, BytecodeEmitter *bce, ParseNode *pn) } static bool -EmitArray(ExclusiveContext *cx, BytecodeEmitter *bce, ParseNode *pn, uint32_t count); +EmitArray(ExclusiveContext* cx, BytecodeEmitter* bce, ParseNode* pn, uint32_t count); static bool -EmitCallOrNew(ExclusiveContext *cx, BytecodeEmitter *bce, ParseNode *pn) +EmitCallOrNew(ExclusiveContext* cx, BytecodeEmitter* bce, ParseNode* pn) { bool callop = pn->isKind(PNK_CALL); @@ -5507,7 +5507,7 @@ EmitCallOrNew(ExclusiveContext *cx, BytecodeEmitter *bce, ParseNode *pn) } bool emitArgs = true; - ParseNode *pn2 = pn->pn_head; + ParseNode* pn2 = pn->pn_head; bool spread = JOF_OPTYPE(pn->getOp()) == JOF_BYTE; switch (pn2->getKind()) { case PNK_NAME: @@ -5530,15 +5530,15 @@ EmitCallOrNew(ExclusiveContext *cx, BytecodeEmitter *bce, ParseNode *pn) bce->reportError(pn, JSMSG_MORE_ARGS_NEEDED, "callFunction", "1", "s"); return false; } - ParseNode *funNode = pn2->pn_next; + ParseNode* funNode = pn2->pn_next; if (!EmitTree(cx, bce, funNode)) return false; - ParseNode *thisArg = funNode->pn_next; + ParseNode* thisArg = funNode->pn_next; if (!EmitTree(cx, bce, thisArg)) return false; bool oldEmittingForInit = bce->emittingForInit; bce->emittingForInit = false; - for (ParseNode *argpn = thisArg->pn_next; argpn; argpn = argpn->pn_next) { + for (ParseNode* argpn = thisArg->pn_next; argpn; argpn = argpn->pn_next) { if (!EmitTree(cx, bce, argpn)) return false; } @@ -5602,7 +5602,7 @@ EmitCallOrNew(ExclusiveContext *cx, BytecodeEmitter *bce, ParseNode *pn) bool oldEmittingForInit = bce->emittingForInit; bce->emittingForInit = false; if (!spread) { - for (ParseNode *pn3 = pn2->pn_next; pn3; pn3 = pn3->pn_next) { + for (ParseNode* pn3 = pn2->pn_next; pn3; pn3 = pn3->pn_next) { if (!EmitTree(cx, bce, pn3)) return false; } @@ -5633,7 +5633,7 @@ EmitCallOrNew(ExclusiveContext *cx, BytecodeEmitter *bce, ParseNode *pn) } static bool -EmitLogical(ExclusiveContext *cx, BytecodeEmitter *bce, ParseNode *pn) +EmitLogical(ExclusiveContext* cx, BytecodeEmitter* bce, ParseNode* pn) { /* * JSOP_OR converts the operand on the stack to boolean, leaves the original @@ -5656,7 +5656,7 @@ EmitLogical(ExclusiveContext *cx, BytecodeEmitter *bce, ParseNode *pn) if (!EmitTree(cx, bce, pn->pn_right)) return false; ptrdiff_t off = bce->offset(); - jsbytecode *pc = bce->code(top); + jsbytecode* pc = bce->code(top); SET_JUMP_OFFSET(pc, off - top); *pc = pn->getOp(); return true; @@ -5666,7 +5666,7 @@ EmitLogical(ExclusiveContext *cx, BytecodeEmitter *bce, ParseNode *pn) JS_ASSERT(pn->pn_head->pn_next->pn_next); /* Left-associative operator chain: avoid too much recursion. */ - ParseNode *pn2 = pn->pn_head; + ParseNode* pn2 = pn->pn_head; if (!EmitTree(cx, bce, pn2)) return false; ptrdiff_t top = EmitJump(cx, bce, JSOP_BACKPATCH, 0); @@ -5694,7 +5694,7 @@ EmitLogical(ExclusiveContext *cx, BytecodeEmitter *bce, ParseNode *pn) pn2 = pn->pn_head; ptrdiff_t off = bce->offset(); do { - jsbytecode *pc = bce->code(top); + jsbytecode* pc = bce->code(top); ptrdiff_t tmp = GET_JUMP_OFFSET(pc); SET_JUMP_OFFSET(pc, off - top); *pc = pn->getOp(); @@ -5709,10 +5709,10 @@ EmitLogical(ExclusiveContext *cx, BytecodeEmitter *bce, ParseNode *pn) * the comment on EmitSwitch. */ MOZ_NEVER_INLINE static bool -EmitIncOrDec(ExclusiveContext *cx, BytecodeEmitter *bce, ParseNode *pn) +EmitIncOrDec(ExclusiveContext* cx, BytecodeEmitter* bce, ParseNode* pn) { /* Emit lvalue-specialized code for ++/-- operators. */ - ParseNode *pn2 = pn->pn_kid; + ParseNode* pn2 = pn->pn_kid; switch (pn2->getKind()) { case PNK_DOT: if (!EmitPropIncDec(cx, pn, bce)) @@ -5788,7 +5788,7 @@ EmitIncOrDec(ExclusiveContext *cx, BytecodeEmitter *bce, ParseNode *pn) * the comment on EmitSwitch. */ MOZ_NEVER_INLINE static bool -EmitLabeledStatement(ExclusiveContext *cx, BytecodeEmitter *bce, const LabeledStatement *pn) +EmitLabeledStatement(ExclusiveContext* cx, BytecodeEmitter* bce, const LabeledStatement* pn) { /* * Emit a JSOP_LABEL instruction. The argument is the offset to the statement @@ -5817,12 +5817,12 @@ EmitLabeledStatement(ExclusiveContext *cx, BytecodeEmitter *bce, const LabeledSt } static bool -EmitSyntheticStatements(ExclusiveContext *cx, BytecodeEmitter *bce, ParseNode *pn, ptrdiff_t top) +EmitSyntheticStatements(ExclusiveContext* cx, BytecodeEmitter* bce, ParseNode* pn, ptrdiff_t top) { JS_ASSERT(pn->isArity(PN_LIST)); StmtInfoBCE stmtInfo(cx); PushStatementBCE(bce, &stmtInfo, STMT_SEQ, top); - ParseNode *pn2 = pn->pn_head; + ParseNode* pn2 = pn->pn_head; if (pn->pn_xflags & PNX_DESTRUCT) pn2 = pn2->pn_next; for (; pn2; pn2 = pn2->pn_next) { @@ -5833,7 +5833,7 @@ EmitSyntheticStatements(ExclusiveContext *cx, BytecodeEmitter *bce, ParseNode *p } static bool -EmitConditionalExpression(ExclusiveContext *cx, BytecodeEmitter *bce, ConditionalExpression &conditional) +EmitConditionalExpression(ExclusiveContext* cx, BytecodeEmitter* bce, ConditionalExpression& conditional) { /* Emit the condition, then branch if false to the else part. */ if (!EmitTree(cx, bce, &conditional.condition())) @@ -5874,7 +5874,7 @@ EmitConditionalExpression(ExclusiveContext *cx, BytecodeEmitter *bce, Conditiona * the comment on EmitSwitch. */ MOZ_NEVER_INLINE static bool -EmitObject(ExclusiveContext *cx, BytecodeEmitter *bce, ParseNode *pn) +EmitObject(ExclusiveContext* cx, BytecodeEmitter* bce, ParseNode* pn) { if (pn->pn_xflags & PNX_DESTRUCT) { bce->reportError(pn, JSMSG_BAD_OBJECT_INIT); @@ -5905,12 +5905,12 @@ EmitObject(ExclusiveContext *cx, BytecodeEmitter *bce, ParseNode *pn) return false; } - for (ParseNode *pn2 = pn->pn_head; pn2; pn2 = pn2->pn_next) { + for (ParseNode* pn2 = pn->pn_head; pn2; pn2 = pn2->pn_next) { if (!UpdateSourceCoordNotes(cx, bce, pn2->pn_pos.begin)) return false; /* Emit an index for t[2] for later consumption by JSOP_INITELEM. */ - ParseNode *pn3 = pn2->pn_left; + ParseNode* pn3 = pn2->pn_left; bool isIndex = false; if (pn3->isKind(PNK_NUMBER)) { if (!EmitNumberOp(cx, pn3->pn_dval, bce)) @@ -5996,7 +5996,7 @@ EmitObject(ExclusiveContext *cx, BytecodeEmitter *bce, ParseNode *pn) * The object survived and has a predictable shape: update the original * bytecode. */ - ObjectBox *objbox = bce->parser->newObjectBox(obj); + ObjectBox* objbox = bce->parser->newObjectBox(obj); if (!objbox) return false; @@ -6004,7 +6004,7 @@ EmitObject(ExclusiveContext *cx, BytecodeEmitter *bce, ParseNode *pn) "newinit and newobject must have equal length to edit in-place"); uint32_t index = bce->objectList.add(objbox); - jsbytecode *code = bce->code(offset); + jsbytecode* code = bce->code(offset); code[0] = JSOP_NEWOBJECT; code[1] = jsbytecode(index >> 24); code[2] = jsbytecode(index >> 16); @@ -6016,7 +6016,7 @@ EmitObject(ExclusiveContext *cx, BytecodeEmitter *bce, ParseNode *pn) } static bool -EmitArrayComp(ExclusiveContext *cx, BytecodeEmitter *bce, ParseNode *pn) +EmitArrayComp(ExclusiveContext* cx, BytecodeEmitter* bce, ParseNode* pn) { if (!EmitNewInit(cx, bce, JSProto_Array)) return false; @@ -6038,7 +6038,7 @@ EmitArrayComp(ExclusiveContext *cx, BytecodeEmitter *bce, ParseNode *pn) } static bool -EmitArray(ExclusiveContext *cx, BytecodeEmitter *bce, ParseNode *pn, uint32_t count) +EmitArray(ExclusiveContext* cx, BytecodeEmitter* bce, ParseNode* pn, uint32_t count) { /* * Emit code for [a, b, c] that is equivalent to constructing a new @@ -6050,7 +6050,7 @@ EmitArray(ExclusiveContext *cx, BytecodeEmitter *bce, ParseNode *pn, uint32_t co */ int32_t nspread = 0; - for (ParseNode *elt = pn; elt; elt = elt->pn_next) { + for (ParseNode* elt = pn; elt; elt = elt->pn_next) { if (elt->isKind(PNK_SPREAD)) nspread++; } @@ -6059,13 +6059,13 @@ EmitArray(ExclusiveContext *cx, BytecodeEmitter *bce, ParseNode *pn, uint32_t co if (off < 0) return false; CheckTypeSet(cx, bce, JSOP_NEWARRAY); - jsbytecode *pc = bce->code(off); + jsbytecode* pc = bce->code(off); // For arrays with spread, this is a very pessimistic allocation, the // minimum possible final size. SET_UINT24(pc, count - nspread); - ParseNode *pn2 = pn; + ParseNode* pn2 = pn; jsatomid atomIndex; if (nspread && !EmitNumberOp(cx, 0, bce)) return false; @@ -6076,7 +6076,7 @@ EmitArray(ExclusiveContext *cx, BytecodeEmitter *bce, ParseNode *pn, uint32_t co if (Emit1(cx, bce, JSOP_HOLE) < 0) return false; } else { - ParseNode *expr = pn2->isKind(PNK_SPREAD) ? pn2->pn_kid : pn2; + ParseNode* expr = pn2->isKind(PNK_SPREAD) ? pn2->pn_kid : pn2; if (!EmitTree(cx, bce, expr)) return false; } @@ -6104,13 +6104,13 @@ EmitArray(ExclusiveContext *cx, BytecodeEmitter *bce, ParseNode *pn, uint32_t co } static bool -EmitUnary(ExclusiveContext *cx, BytecodeEmitter *bce, ParseNode *pn) +EmitUnary(ExclusiveContext* cx, BytecodeEmitter* bce, ParseNode* pn) { if (!UpdateSourceCoordNotes(cx, bce, pn->pn_pos.begin)) return false; /* Unary op, including unary +/-. */ JSOp op = pn->getOp(); - ParseNode *pn2 = pn->pn_kid; + ParseNode* pn2 = pn->pn_kid; if (op == JSOP_TYPEOF && !pn2->isKind(PNK_NAME)) op = JSOP_TYPEOFEXPR; @@ -6125,11 +6125,11 @@ EmitUnary(ExclusiveContext *cx, BytecodeEmitter *bce, ParseNode *pn) } static bool -EmitDefaults(ExclusiveContext *cx, BytecodeEmitter *bce, ParseNode *pn) +EmitDefaults(ExclusiveContext* cx, BytecodeEmitter* bce, ParseNode* pn) { JS_ASSERT(pn->isKind(PNK_ARGSBODY)); - ParseNode *arg, *pnlast = pn->last(); + ParseNode* arg, *pnlast = pn->last(); for (arg = pn->pn_head; arg != pnlast; arg = arg->pn_next) { if (!(arg->pn_dflags & PND_DEFAULT) || !arg->isKind(PNK_NAME)) continue; @@ -6160,7 +6160,7 @@ EmitDefaults(ExclusiveContext *cx, BytecodeEmitter *bce, ParseNode *pn) } bool -frontend::EmitTree(ExclusiveContext *cx, BytecodeEmitter *bce, ParseNode *pn) +frontend::EmitTree(ExclusiveContext* cx, BytecodeEmitter* bce, ParseNode* pn) { JS_CHECK_RECURSION(cx, return false); @@ -6182,13 +6182,13 @@ frontend::EmitTree(ExclusiveContext *cx, BytecodeEmitter *bce, ParseNode *pn) case PNK_ARGSBODY: { RootedFunction fun(cx, bce->sc->asFunctionBox()->function()); - ParseNode *pnlast = pn->last(); + ParseNode* pnlast = pn->last(); // Carefully emit everything in the right order: // 1. Destructuring // 2. Functions // 3. Defaults - ParseNode *pnchild = pnlast->pn_head; + ParseNode* pnchild = pnlast->pn_head; if (pnlast->pn_xflags & PNX_DESTRUCT) { // Assign the destructuring arguments before defining any functions, // see bug 419662. @@ -6208,7 +6208,7 @@ frontend::EmitTree(ExclusiveContext *cx, BytecodeEmitter *bce, ParseNode *pn) // // Currently this is used only for functions, as compile-as-we go // mode for scripts does not allow separate emitter passes. - for (ParseNode *pn2 = pnchild; pn2; pn2 = pn2->pn_next) { + for (ParseNode* pn2 = pnchild; pn2; pn2 = pn2->pn_next) { if (pn2->isKind(PNK_FUNCTION) && pn2->functionIsHoisted()) { if (!EmitTree(cx, bce, pn2)) return false; @@ -6217,7 +6217,7 @@ frontend::EmitTree(ExclusiveContext *cx, BytecodeEmitter *bce, ParseNode *pn) } bool hasDefaults = bce->sc->asFunctionBox()->hasDefaults(); if (hasDefaults) { - ParseNode *rest = nullptr; + ParseNode* rest = nullptr; bool restIsDefn = false; if (fun->hasRest()) { JS_ASSERT(!bce->sc->asFunctionBox()->argumentsHasLocalBinding()); @@ -6258,7 +6258,7 @@ frontend::EmitTree(ExclusiveContext *cx, BytecodeEmitter *bce, ParseNode *pn) return false; } } - for (ParseNode *pn2 = pn->pn_head; pn2 != pnlast; pn2 = pn2->pn_next) { + for (ParseNode* pn2 = pn->pn_head; pn2 != pnlast; pn2 = pn2->pn_next) { // Only bind the parameter if it's not aliased by a nested function // in the body. if (!pn2->isDefn()) @@ -6378,7 +6378,7 @@ frontend::EmitTree(ExclusiveContext *cx, BytecodeEmitter *bce, ParseNode *pn) case PNK_COMMA: { - for (ParseNode *pn2 = pn->pn_head; ; pn2 = pn2->pn_next) { + for (ParseNode* pn2 = pn->pn_head; ; pn2 = pn2->pn_next) { if (!UpdateSourceCoordNotes(cx, bce, pn2->pn_pos.begin)) return false; if (!EmitTree(cx, bce, pn2)) @@ -6439,7 +6439,7 @@ frontend::EmitTree(ExclusiveContext *cx, BytecodeEmitter *bce, ParseNode *pn) case PNK_MOD: if (pn->isArity(PN_LIST)) { /* Left-associative operator chain: avoid too much recursion. */ - ParseNode *pn2 = pn->pn_head; + ParseNode* pn2 = pn->pn_head; if (!EmitTree(cx, bce, pn2)) return false; JSOp op = pn->getOp(); @@ -6592,7 +6592,7 @@ frontend::EmitTree(ExclusiveContext *cx, BytecodeEmitter *bce, ParseNode *pn) } static int -AllocSrcNote(ExclusiveContext *cx, SrcNotesVector ¬es) +AllocSrcNote(ExclusiveContext* cx, SrcNotesVector& notes) { // Start it off moderately large to avoid repeated resizings early on. if (notes.capacity() == 0 && !notes.reserve(1024)) @@ -6607,9 +6607,9 @@ AllocSrcNote(ExclusiveContext *cx, SrcNotesVector ¬es) } int -frontend::NewSrcNote(ExclusiveContext *cx, BytecodeEmitter *bce, SrcNoteType type) +frontend::NewSrcNote(ExclusiveContext* cx, BytecodeEmitter* bce, SrcNoteType type) { - SrcNotesVector ¬es = bce->notes(); + SrcNotesVector& notes = bce->notes(); int index; index = AllocSrcNote(cx, notes); @@ -6648,7 +6648,7 @@ frontend::NewSrcNote(ExclusiveContext *cx, BytecodeEmitter *bce, SrcNoteType typ } int -frontend::NewSrcNote2(ExclusiveContext *cx, BytecodeEmitter *bce, SrcNoteType type, ptrdiff_t offset) +frontend::NewSrcNote2(ExclusiveContext* cx, BytecodeEmitter* bce, SrcNoteType type, ptrdiff_t offset) { int index; @@ -6661,7 +6661,7 @@ frontend::NewSrcNote2(ExclusiveContext *cx, BytecodeEmitter *bce, SrcNoteType ty } int -frontend::NewSrcNote3(ExclusiveContext *cx, BytecodeEmitter *bce, SrcNoteType type, ptrdiff_t offset1, +frontend::NewSrcNote3(ExclusiveContext* cx, BytecodeEmitter* bce, SrcNoteType type, ptrdiff_t offset1, ptrdiff_t offset2) { int index; @@ -6677,7 +6677,7 @@ frontend::NewSrcNote3(ExclusiveContext *cx, BytecodeEmitter *bce, SrcNoteType ty } bool -frontend::AddToSrcNoteDelta(ExclusiveContext *cx, BytecodeEmitter *bce, jssrcnote *sn, ptrdiff_t delta) +frontend::AddToSrcNoteDelta(ExclusiveContext* cx, BytecodeEmitter* bce, jssrcnote* sn, ptrdiff_t delta) { /* * Called only from FinishTakingSrcNotes to add to main script note @@ -6701,7 +6701,7 @@ frontend::AddToSrcNoteDelta(ExclusiveContext *cx, BytecodeEmitter *bce, jssrcnot } static bool -SetSrcNoteOffset(ExclusiveContext *cx, BytecodeEmitter *bce, unsigned index, unsigned which, +SetSrcNoteOffset(ExclusiveContext* cx, BytecodeEmitter* bce, unsigned index, unsigned which, ptrdiff_t offset) { if (size_t(offset) > SN_MAX_OFFSET) { @@ -6709,10 +6709,10 @@ SetSrcNoteOffset(ExclusiveContext *cx, BytecodeEmitter *bce, unsigned index, uns return false; } - SrcNotesVector ¬es = bce->notes(); + SrcNotesVector& notes = bce->notes(); /* Find the offset numbered which (i.e., skip exactly which offsets). */ - jssrcnote *sn = notes.begin() + index; + jssrcnote* sn = notes.begin() + index; JS_ASSERT(SN_TYPE(sn) != SRC_XDELTA); JS_ASSERT((int) which < js_SrcNoteSpec[SN_TYPE(sn)].arity); for (sn++; which; sn++, which--) { @@ -6751,7 +6751,7 @@ SetSrcNoteOffset(ExclusiveContext *cx, BytecodeEmitter *bce, unsigned index, uns * If successful, the final source note count is stored in the out outparam. */ bool -frontend::FinishTakingSrcNotes(ExclusiveContext *cx, BytecodeEmitter *bce, uint32_t *out) +frontend::FinishTakingSrcNotes(ExclusiveContext* cx, BytecodeEmitter* bce, uint32_t* out) { JS_ASSERT(bce->current == &bce->main); @@ -6773,7 +6773,7 @@ frontend::FinishTakingSrcNotes(ExclusiveContext *cx, BytecodeEmitter *bce, uint3 JS_ASSERT(offset >= 0); if (offset > 0 && bce->main.notes.length() != 0) { /* NB: Use as much of the first main note's delta as we can. */ - jssrcnote *sn = bce->main.notes.begin(); + jssrcnote* sn = bce->main.notes.begin(); ptrdiff_t delta = SN_IS_XDELTA(sn) ? SN_XDELTA_MASK - (*sn & SN_XDELTA_MASK) : SN_DELTA_MASK - (*sn & SN_DELTA_MASK); @@ -6799,7 +6799,7 @@ frontend::FinishTakingSrcNotes(ExclusiveContext *cx, BytecodeEmitter *bce, uint3 } void -frontend::CopySrcNotes(BytecodeEmitter *bce, jssrcnote *destination, uint32_t nsrcnotes) +frontend::CopySrcNotes(BytecodeEmitter* bce, jssrcnote* destination, uint32_t nsrcnotes) { unsigned prologCount = bce->prolog.notes.length(); unsigned mainCount = bce->main.notes.length(); @@ -6812,7 +6812,7 @@ frontend::CopySrcNotes(BytecodeEmitter *bce, jssrcnote *destination, uint32_t ns } void -CGConstList::finish(ConstArray *array) +CGConstList::finish(ConstArray* array) { JS_ASSERT(length() == array->length); @@ -6863,7 +6863,7 @@ CGConstList::finish(ConstArray *array) * the pre-compilation prototype, a pigeon-hole problem for instanceof tests. */ unsigned -CGObjectList::add(ObjectBox *objbox) +CGObjectList::add(ObjectBox* objbox) { JS_ASSERT(!objbox->emitLink); objbox->emitLink = lastbox; @@ -6872,23 +6872,23 @@ CGObjectList::add(ObjectBox *objbox) } unsigned -CGObjectList::indexOf(JSObject *obj) +CGObjectList::indexOf(JSObject* obj) { JS_ASSERT(length > 0); unsigned index = length - 1; - for (ObjectBox *box = lastbox; box->object != obj; box = box->emitLink) + for (ObjectBox* box = lastbox; box->object != obj; box = box->emitLink) index--; return index; } void -CGObjectList::finish(ObjectArray *array) +CGObjectList::finish(ObjectArray* array) { JS_ASSERT(length <= INDEX_LIMIT); JS_ASSERT(length == array->length); - js::HeapPtrObject *cursor = array->vector + array->length; - ObjectBox *objbox = lastbox; + js::HeapPtrObject* cursor = array->vector + array->length; + ObjectBox* objbox = lastbox; do { --cursor; JS_ASSERT(!*cursor); @@ -6901,7 +6901,7 @@ ObjectBox* CGObjectList::find(uint32_t index) { JS_ASSERT(index < length); - ObjectBox *box = lastbox; + ObjectBox* box = lastbox; for (unsigned n = length - 1; n > index; n--) box = box->emitLink; return box; @@ -6924,7 +6924,7 @@ CGTryNoteList::append(JSTryNoteKind kind, uint32_t stackDepth, size_t start, siz } void -CGTryNoteList::finish(TryNoteArray *array) +CGTryNoteList::finish(TryNoteArray* array) { JS_ASSERT(length() == array->length); @@ -6980,7 +6980,7 @@ CGBlockScopeList::recordEnd(uint32_t index, uint32_t offset) } void -CGBlockScopeList::finish(BlockScopeArray *array) +CGBlockScopeList::finish(BlockScopeArray* array) { JS_ASSERT(length() == array->length); @@ -6999,17 +6999,17 @@ const JSSrcNoteSpec js_SrcNoteSpec[] = { }; static int -SrcNoteArity(jssrcnote *sn) +SrcNoteArity(jssrcnote* sn) { JS_ASSERT(SN_TYPE(sn) < SRC_LAST); return js_SrcNoteSpec[SN_TYPE(sn)].arity; } JS_FRIEND_API(unsigned) -js_SrcNoteLength(jssrcnote *sn) +js_SrcNoteLength(jssrcnote* sn) { unsigned arity; - jssrcnote *base; + jssrcnote* base; arity = SrcNoteArity(sn); for (base = sn++; arity; sn++, arity--) { @@ -7020,7 +7020,7 @@ js_SrcNoteLength(jssrcnote *sn) } JS_FRIEND_API(ptrdiff_t) -js_GetSrcNoteOffset(jssrcnote *sn, unsigned which) +js_GetSrcNoteOffset(jssrcnote* sn, unsigned which) { /* Find the offset numbered which (i.e., skip exactly which offsets). */ JS_ASSERT(SN_TYPE(sn) != SRC_XDELTA); diff --git a/js/src/frontend/BytecodeEmitter.h b/js/src/frontend/BytecodeEmitter.h index b75389d98e..37c864dafc 100644 --- a/js/src/frontend/BytecodeEmitter.h +++ b/js/src/frontend/BytecodeEmitter.h @@ -31,42 +31,42 @@ class TokenStream; class CGConstList { Vector list; public: - CGConstList(ExclusiveContext *cx) : list(cx) {} + CGConstList(ExclusiveContext* cx) : list(cx) {} bool append(Value v) { JS_ASSERT_IF(v.isString(), v.toString()->isAtom()); return list.append(v); } size_t length() const { return list.length(); } - void finish(ConstArray *array); + void finish(ConstArray* array); }; struct CGObjectList { uint32_t length; /* number of emitted so far objects */ - ObjectBox *lastbox; /* last emitted object */ + ObjectBox* lastbox; /* last emitted object */ CGObjectList() : length(0), lastbox(nullptr) {} - unsigned add(ObjectBox *objbox); - unsigned indexOf(JSObject *obj); - void finish(ObjectArray *array); + unsigned add(ObjectBox* objbox); + unsigned indexOf(JSObject* obj); + void finish(ObjectArray* array); ObjectBox* find(uint32_t index); }; struct CGTryNoteList { Vector list; - CGTryNoteList(ExclusiveContext *cx) : list(cx) {} + CGTryNoteList(ExclusiveContext* cx) : list(cx) {} bool append(JSTryNoteKind kind, uint32_t stackDepth, size_t start, size_t end); size_t length() const { return list.length(); } - void finish(TryNoteArray *array); + void finish(TryNoteArray* array); }; struct CGBlockScopeList { Vector list; - CGBlockScopeList(ExclusiveContext *cx) : list(cx) {} + CGBlockScopeList(ExclusiveContext* cx) : list(cx) {} bool append(uint32_t scopeObject, uint32_t offset, uint32_t parent); uint32_t findEnclosingScope(uint32_t index); void recordEnd(uint32_t index, uint32_t offset); size_t length() const { return list.length(); } - void finish(BlockScopeArray *array); + void finish(BlockScopeArray* array); }; struct StmtInfoBCE; @@ -80,9 +80,9 @@ struct BytecodeEmitter { typedef StmtInfoBCE StmtInfo; - SharedContext *const sc; /* context shared between parsing and bytecode generation */ + SharedContext* const sc; /* context shared between parsing and bytecode generation */ - BytecodeEmitter *const parent; /* enclosing function or global context */ + BytecodeEmitter* const parent; /* enclosing function or global context */ Rooted script; /* the JSScript we're ultimately producing */ @@ -94,20 +94,20 @@ struct BytecodeEmitter uint32_t lastColumn; /* zero-based column index on currentLine of last SRC_COLSPAN-annotated opcode */ - EmitSection(ExclusiveContext *cx, uint32_t lineNum) + EmitSection(ExclusiveContext* cx, uint32_t lineNum) : code(cx), notes(cx), lastNoteOffset(0), currentLine(lineNum), lastColumn(0) {} }; EmitSection prolog, main, *current; /* the parser */ - Parser *const parser; + Parser* const parser; HandleScript evalCaller; /* scripted caller info for eval and dbgapi */ - StmtInfoBCE *topStmt; /* top of statement info stack */ - StmtInfoBCE *topScopeStmt; /* top lexical scope statement */ - Rooted staticScope; + StmtInfoBCE* topStmt; /* top of statement info stack */ + StmtInfoBCE* topScopeStmt; /* top lexical scope statement */ + Rooted staticScope; /* compile time scope chain */ OwnedAtomIndexMapPtr atomIndices; /* literals indexed for mapping */ @@ -172,15 +172,15 @@ struct BytecodeEmitter * tempLifoAlloc and save the pointer beyond the next BytecodeEmitter * destruction. */ - BytecodeEmitter(BytecodeEmitter *parent, Parser *parser, SharedContext *sc, + BytecodeEmitter(BytecodeEmitter* parent, Parser* parser, SharedContext* sc, HandleScript script, bool insideEval, HandleScript evalCaller, bool hasGlobalScope, uint32_t lineNum, EmitterMode emitterMode = Normal); bool init(); - bool isAliasedName(ParseNode *pn); + bool isAliasedName(ParseNode* pn); MOZ_ALWAYS_INLINE - bool makeAtomIndex(JSAtom *atom, jsatomid *indexp) { + bool makeAtomIndex(JSAtom* atom, jsatomid* indexp) { AtomIndexAddPtr p = atomIndices->lookupForAdd(atom); if (p) { *indexp = p.value(); @@ -200,62 +200,62 @@ struct BytecodeEmitter bool needsImplicitThis(); - void tellDebuggerAboutCompiledScript(ExclusiveContext *cx); + void tellDebuggerAboutCompiledScript(ExclusiveContext* cx); - inline TokenStream *tokenStream(); + inline TokenStream* tokenStream(); - BytecodeVector &code() const { return current->code; } - jsbytecode *code(ptrdiff_t offset) const { return current->code.begin() + offset; } + BytecodeVector& code() const { return current->code; } + jsbytecode* code(ptrdiff_t offset) const { return current->code.begin() + offset; } ptrdiff_t offset() const { return current->code.end() - current->code.begin(); } ptrdiff_t prologOffset() const { return prolog.code.end() - prolog.code.begin(); } void switchToMain() { current = &main; } void switchToProlog() { current = &prolog; } - SrcNotesVector ¬es() const { return current->notes; } + SrcNotesVector& notes() const { return current->notes; } ptrdiff_t lastNoteOffset() const { return current->lastNoteOffset; } unsigned currentLine() const { return current->currentLine; } unsigned lastColumn() const { return current->lastColumn; } - bool reportError(ParseNode *pn, unsigned errorNumber, ...); - bool reportStrictWarning(ParseNode *pn, unsigned errorNumber, ...); - bool reportStrictModeError(ParseNode *pn, unsigned errorNumber, ...); + bool reportError(ParseNode* pn, unsigned errorNumber, ...); + bool reportStrictWarning(ParseNode* pn, unsigned errorNumber, ...); + bool reportStrictModeError(ParseNode* pn, unsigned errorNumber, ...); }; /* * Emit one bytecode. */ ptrdiff_t -Emit1(ExclusiveContext *cx, BytecodeEmitter *bce, JSOp op); +Emit1(ExclusiveContext* cx, BytecodeEmitter* bce, JSOp op); /* * Emit two bytecodes, an opcode (op) with a byte of immediate operand (op1). */ ptrdiff_t -Emit2(ExclusiveContext *cx, BytecodeEmitter *bce, JSOp op, jsbytecode op1); +Emit2(ExclusiveContext* cx, BytecodeEmitter* bce, JSOp op, jsbytecode op1); /* * Emit three bytecodes, an opcode with two bytes of immediate operands. */ ptrdiff_t -Emit3(ExclusiveContext *cx, BytecodeEmitter *bce, JSOp op, jsbytecode op1, jsbytecode op2); +Emit3(ExclusiveContext* cx, BytecodeEmitter* bce, JSOp op, jsbytecode op1, jsbytecode op2); /* * Emit (1 + extra) bytecodes, for N bytes of op and its immediate operand. */ ptrdiff_t -EmitN(ExclusiveContext *cx, BytecodeEmitter *bce, JSOp op, size_t extra); +EmitN(ExclusiveContext* cx, BytecodeEmitter* bce, JSOp op, size_t extra); /* * Emit code into bce for the tree rooted at pn. */ bool -EmitTree(ExclusiveContext *cx, BytecodeEmitter *bce, ParseNode *pn); +EmitTree(ExclusiveContext* cx, BytecodeEmitter* bce, ParseNode* pn); /* * Emit function code using bce for the tree rooted at body. */ bool -EmitFunctionScript(ExclusiveContext *cx, BytecodeEmitter *bce, ParseNode *body); +EmitFunctionScript(ExclusiveContext* cx, BytecodeEmitter* bce, ParseNode* body); /* * Append a new source note of the given type (and therefore size) to bce's @@ -264,24 +264,24 @@ EmitFunctionScript(ExclusiveContext *cx, BytecodeEmitter *bce, ParseNode *body); * memory. */ int -NewSrcNote(ExclusiveContext *cx, BytecodeEmitter *bce, SrcNoteType type); +NewSrcNote(ExclusiveContext* cx, BytecodeEmitter* bce, SrcNoteType type); int -NewSrcNote2(ExclusiveContext *cx, BytecodeEmitter *bce, SrcNoteType type, ptrdiff_t offset); +NewSrcNote2(ExclusiveContext* cx, BytecodeEmitter* bce, SrcNoteType type, ptrdiff_t offset); int -NewSrcNote3(ExclusiveContext *cx, BytecodeEmitter *bce, SrcNoteType type, ptrdiff_t offset1, +NewSrcNote3(ExclusiveContext* cx, BytecodeEmitter* bce, SrcNoteType type, ptrdiff_t offset1, ptrdiff_t offset2); /* NB: this function can add at most one extra extended delta note. */ bool -AddToSrcNoteDelta(ExclusiveContext *cx, BytecodeEmitter *bce, jssrcnote *sn, ptrdiff_t delta); +AddToSrcNoteDelta(ExclusiveContext* cx, BytecodeEmitter* bce, jssrcnote* sn, ptrdiff_t delta); bool -FinishTakingSrcNotes(ExclusiveContext *cx, BytecodeEmitter *bce, uint32_t *out); +FinishTakingSrcNotes(ExclusiveContext* cx, BytecodeEmitter* bce, uint32_t* out); void -CopySrcNotes(BytecodeEmitter *bce, jssrcnote *destination, uint32_t nsrcnotes); +CopySrcNotes(BytecodeEmitter* bce, jssrcnote* destination, uint32_t nsrcnotes); } /* namespace frontend */ } /* namespace js */ diff --git a/js/src/frontend/FoldConstants.cpp b/js/src/frontend/FoldConstants.cpp index 8839cd627b..4d0c22f1fe 100644 --- a/js/src/frontend/FoldConstants.cpp +++ b/js/src/frontend/FoldConstants.cpp @@ -29,7 +29,7 @@ using mozilla::PositiveInfinity; using JS::GenericNaN; static bool -ContainsVarOrConst(ExclusiveContext *cx, ParseNode *pn, ParseNode **resultp) +ContainsVarOrConst(ExclusiveContext* cx, ParseNode* pn, ParseNode** resultp) { JS_CHECK_RECURSION(cx, return false); @@ -43,7 +43,7 @@ ContainsVarOrConst(ExclusiveContext *cx, ParseNode *pn, ParseNode **resultp) } switch (pn->getArity()) { case PN_LIST: - for (ParseNode *pn2 = pn->pn_head; pn2; pn2 = pn2->pn_next) { + for (ParseNode* pn2 = pn->pn_head; pn2; pn2 = pn2->pn_next) { if (!ContainsVarOrConst(cx, pn2, resultp)) return false; if (*resultp) @@ -97,7 +97,7 @@ ContainsVarOrConst(ExclusiveContext *cx, ParseNode *pn, ParseNode **resultp) * XXX handles only strings and numbers for now */ static bool -FoldType(ExclusiveContext *cx, ParseNode *pn, ParseNodeKind kind) +FoldType(ExclusiveContext* cx, ParseNode* pn, ParseNodeKind kind) { if (!pn->isKind(kind)) { switch (kind) { @@ -134,8 +134,8 @@ FoldType(ExclusiveContext *cx, ParseNode *pn, ParseNodeKind kind) * a successful call to this function. */ static bool -FoldBinaryNumeric(ExclusiveContext *cx, JSOp op, ParseNode *pn1, ParseNode *pn2, - ParseNode *pn) +FoldBinaryNumeric(ExclusiveContext* cx, JSOp op, ParseNode* pn1, ParseNode* pn2, + ParseNode* pn) { double d, d2; int32_t i, j; @@ -216,7 +216,7 @@ FoldBinaryNumeric(ExclusiveContext *cx, JSOp op, ParseNode *pn1, ParseNode *pn2, // for its pn_next pointer; updating that is necessary if *pn's new parent is a // list node. static void -ReplaceNode(ParseNode **pnp, ParseNode *pn) +ReplaceNode(ParseNode** pnp, ParseNode* pn) { pn->pn_next = (*pnp)->pn_next; *pnp = pn; @@ -225,7 +225,7 @@ ReplaceNode(ParseNode **pnp, ParseNode *pn) enum Truthiness { Truthy, Falsy, Unknown }; static Truthiness -Boolish(ParseNode *pn) +Boolish(ParseNode* pn) { switch (pn->getKind()) { case PNK_NUMBER: @@ -265,18 +265,18 @@ MOZ_BEGIN_ENUM_CLASS(SyntacticContext, int) MOZ_END_ENUM_CLASS(SyntacticContext) static SyntacticContext -condIf(const ParseNode *pn, ParseNodeKind kind) +condIf(const ParseNode* pn, ParseNodeKind kind) { return pn->isKind(kind) ? SyntacticContext::Condition : SyntacticContext::Other; } static bool -Fold(ExclusiveContext *cx, ParseNode **pnp, - FullParseHandler &handler, const ReadOnlyCompileOptions &options, +Fold(ExclusiveContext* cx, ParseNode** pnp, + FullParseHandler& handler, const ReadOnlyCompileOptions& options, bool inGenexpLambda, SyntacticContext sc) { - ParseNode *pn = *pnp; - ParseNode *pn1 = nullptr, *pn2 = nullptr, *pn3 = nullptr; + ParseNode* pn = *pnp; + ParseNode* pn1 = nullptr, *pn2 = nullptr, *pn3 = nullptr; JS_CHECK_RECURSION(cx, return false); @@ -306,7 +306,7 @@ Fold(ExclusiveContext *cx, ParseNode **pnp, kidsc = sc; // Don't fold a parenthesized call expression. See bug 537673. - ParseNode **listp = &pn->pn_head; + ParseNode** listp = &pn->pn_head; if ((pn->isKind(PNK_CALL) || pn->isKind(PNK_NEW)) && (*listp)->isInParens()) listp = &(*listp)->pn_next; @@ -407,7 +407,7 @@ Fold(ExclusiveContext *cx, ParseNode **pnp, * dot in the chain. */ if (!pn->isUsed()) { - ParseNode **lhsp = &pn->pn_expr; + ParseNode** lhsp = &pn->pn_expr; while (*lhsp && (*lhsp)->isArity(PN_NAME) && !(*lhsp)->isUsed()) lhsp = &(*lhsp)->pn_expr; if (*lhsp && !Fold(cx, lhsp, handler, options, inGenexpLambda, SyntacticContext::Other)) @@ -432,7 +432,7 @@ Fold(ExclusiveContext *cx, ParseNode **pnp, switch (pn->getKind()) { case PNK_IF: { - ParseNode *decl; + ParseNode* decl; if (!ContainsVarOrConst(cx, pn2, &decl)) return false; if (decl) @@ -496,7 +496,7 @@ Fold(ExclusiveContext *cx, ParseNode **pnp, case PNK_AND: if (sc == SyntacticContext::Condition) { if (pn->isArity(PN_LIST)) { - ParseNode **listp = &pn->pn_head; + ParseNode** listp = &pn->pn_head; JS_ASSERT(*listp == pn1); uint32_t orig = pn->pn_count; do { @@ -806,9 +806,9 @@ Fold(ExclusiveContext *cx, ParseNode **pnp, case PNK_ELEM: { // An indexed expression, pn1[pn2]. A few cases can be improved. - PropertyName *name = nullptr; + PropertyName* name = nullptr; if (pn2->isKind(PNK_STRING)) { - JSAtom *atom = pn2->pn_atom; + JSAtom* atom = pn2->pn_atom; uint32_t index; if (atom->isIndex(&index)) { @@ -826,7 +826,7 @@ Fold(ExclusiveContext *cx, ParseNode **pnp, // Optimization 2: We have something like pn1[3.14]. The number // is not an array index. This is equivalent to pn1["3.14"] // which enables optimization 3 below. - JSAtom *atom = ToAtom(cx, DoubleValue(number)); + JSAtom* atom = ToAtom(cx, DoubleValue(number)); if (!atom) return false; name = atom->asPropertyName(); @@ -838,7 +838,7 @@ Fold(ExclusiveContext *cx, ParseNode **pnp, // Convert to a property access (like pn1.foo) which we optimize // better downstream. Don't bother with this for names which TI // considers to be indexes, to simplify downstream analysis. - ParseNode *expr = handler.newPropertyAccess(pn->pn_left, name, pn->pn_pos.end); + ParseNode* expr = handler.newPropertyAccess(pn->pn_left, name, pn->pn_pos.end); if (!expr) return false; ReplaceNode(pnp, expr); @@ -879,7 +879,7 @@ Fold(ExclusiveContext *cx, ParseNode **pnp, } bool -frontend::FoldConstants(ExclusiveContext *cx, ParseNode **pnp, Parser *parser) +frontend::FoldConstants(ExclusiveContext* cx, ParseNode** pnp, Parser* parser) { // Don't fold constants if the code has requested "use asm" as // constant-folding will misrepresent the source text for the purpose diff --git a/js/src/frontend/FoldConstants.h b/js/src/frontend/FoldConstants.h index 895a9025f9..a3d7a96c5f 100644 --- a/js/src/frontend/FoldConstants.h +++ b/js/src/frontend/FoldConstants.h @@ -26,11 +26,11 @@ namespace frontend { // if (!FoldConstants(cx, &pn, parser)) // return false; bool -FoldConstants(ExclusiveContext *cx, ParseNode **pnp, Parser *parser); +FoldConstants(ExclusiveContext* cx, ParseNode** pnp, Parser* parser); inline bool -FoldConstants(ExclusiveContext *cx, SyntaxParseHandler::Node *pnp, - Parser *parser) +FoldConstants(ExclusiveContext* cx, SyntaxParseHandler::Node* pnp, + Parser* parser) { return true; } diff --git a/js/src/frontend/FullParseHandler.h b/js/src/frontend/FullParseHandler.h index c5d1ed088d..72ac7b5948 100644 --- a/js/src/frontend/FullParseHandler.h +++ b/js/src/frontend/FullParseHandler.h @@ -25,16 +25,16 @@ class SyntaxParseHandler; class FullParseHandler { ParseNodeAllocator allocator; - TokenStream &tokenStream; + TokenStream& tokenStream; bool foldConstants; - ParseNode *allocParseNode(size_t size) { + ParseNode* allocParseNode(size_t size) { JS_ASSERT(size == sizeof(ParseNode)); - return static_cast(allocator.allocNode()); + return static_cast(allocator.allocNode()); } - ParseNode *cloneNode(const ParseNode &other) { - ParseNode *node = allocParseNode(sizeof(ParseNode)); + ParseNode* cloneNode(const ParseNode& other) { + ParseNode* node = allocParseNode(sizeof(ParseNode)); if (!node) return nullptr; mozilla::PodAssign(node, &other); @@ -49,7 +49,7 @@ class FullParseHandler LazyScript * const lazyOuterFunction_; size_t lazyInnerFunctionIndex; - const TokenPos &pos() { + const TokenPos& pos() { return tokenStream.currentToken().pos; } @@ -61,17 +61,17 @@ class FullParseHandler * are encountered, in which case all future activity will use the full * parser. */ - Parser *syntaxParser; + Parser* syntaxParser; /* new_ methods for creating parse nodes. These report OOM on context. */ JS_DECLARE_NEW_METHODS(new_, allocParseNode, inline) - typedef ParseNode *Node; - typedef Definition *DefinitionNode; + typedef ParseNode* Node; + typedef Definition* DefinitionNode; - FullParseHandler(ExclusiveContext *cx, LifoAlloc &alloc, - TokenStream &tokenStream, bool foldConstants, - Parser *syntaxParser, LazyScript *lazyOuterFunction) + FullParseHandler(ExclusiveContext* cx, LifoAlloc& alloc, + TokenStream& tokenStream, bool foldConstants, + Parser* syntaxParser, LazyScript* lazyOuterFunction) : allocator(cx, alloc), tokenStream(tokenStream), foldConstants(foldConstants), @@ -80,19 +80,19 @@ class FullParseHandler syntaxParser(syntaxParser) {} - static ParseNode *null() { return nullptr; } + static ParseNode* null() { return nullptr; } - ParseNode *freeTree(ParseNode *pn) { return allocator.freeTree(pn); } - void prepareNodeForMutation(ParseNode *pn) { return allocator.prepareNodeForMutation(pn); } - const Token ¤tToken() { return tokenStream.currentToken(); } + ParseNode* freeTree(ParseNode* pn) { return allocator.freeTree(pn); } + void prepareNodeForMutation(ParseNode* pn) { return allocator.prepareNodeForMutation(pn); } + const Token& currentToken() { return tokenStream.currentToken(); } - ParseNode *newName(PropertyName *name, uint32_t blockid, const TokenPos &pos) { + ParseNode* newName(PropertyName* name, uint32_t blockid, const TokenPos& pos) { return new_(PNK_NAME, JSOP_NAME, name, blockid, pos); } - Definition *newPlaceholder(JSAtom *atom, uint32_t blockid, const TokenPos &pos) { - Definition *dn = - (Definition *) new_(PNK_NAME, JSOP_NOP, atom, blockid, pos); + Definition* newPlaceholder(JSAtom* atom, uint32_t blockid, const TokenPos& pos) { + Definition* dn = + (Definition*) new_(PNK_NAME, JSOP_NOP, atom, blockid, pos); if (!dn) return nullptr; dn->setDefn(true); @@ -100,31 +100,31 @@ class FullParseHandler return dn; } - ParseNode *newIdentifier(JSAtom *atom, const TokenPos &pos) { + ParseNode* newIdentifier(JSAtom* atom, const TokenPos& pos) { return new_(PNK_NAME, JSOP_NOP, pos, atom); } - ParseNode *newNumber(double value, DecimalPoint decimalPoint, const TokenPos &pos) { - ParseNode *pn = new_(PNK_NUMBER, pos); + ParseNode* newNumber(double value, DecimalPoint decimalPoint, const TokenPos& pos) { + ParseNode* pn = new_(PNK_NUMBER, pos); if (!pn) return nullptr; pn->initNumber(value, decimalPoint); return pn; } - ParseNode *newBooleanLiteral(bool cond, const TokenPos &pos) { + ParseNode* newBooleanLiteral(bool cond, const TokenPos& pos) { return new_(cond, pos); } - ParseNode *newStringLiteral(JSAtom *atom, const TokenPos &pos) { + ParseNode* newStringLiteral(JSAtom* atom, const TokenPos& pos) { return new_(PNK_STRING, JSOP_STRING, pos, atom); } - ParseNode *newThisLiteral(const TokenPos &pos) { + ParseNode* newThisLiteral(const TokenPos& pos) { return new_(pos); } - ParseNode *newNullLiteral(const TokenPos &pos) { + ParseNode* newNullLiteral(const TokenPos& pos) { return new_(pos); } @@ -132,22 +132,22 @@ class FullParseHandler // Specifically, a Boxer has a .newObjectBox(T) method that accepts a // Rooted argument and returns an ObjectBox*. template - ParseNode *newRegExp(HandleObject reobj, const TokenPos &pos, Boxer &boxer) { - ObjectBox *objbox = boxer.newObjectBox(reobj); + ParseNode* newRegExp(HandleObject reobj, const TokenPos& pos, Boxer& boxer) { + ObjectBox* objbox = boxer.newObjectBox(reobj); if (!objbox) return null(); return new_(objbox, pos); } - ParseNode *newConditional(ParseNode *cond, ParseNode *thenExpr, ParseNode *elseExpr) { + ParseNode* newConditional(ParseNode* cond, ParseNode* thenExpr, ParseNode* elseExpr) { return new_(cond, thenExpr, elseExpr); } - void markAsSetCall(ParseNode *pn) { + void markAsSetCall(ParseNode* pn) { pn->pn_xflags |= PNX_SETCALL; } - ParseNode *newDelete(uint32_t begin, ParseNode *expr) { + ParseNode* newDelete(uint32_t begin, ParseNode* expr) { if (expr->getKind() == PNK_NAME) { expr->pn_dflags |= PND_DEOPTIMIZED; expr->setOp(JSOP_DELNAME); @@ -155,35 +155,35 @@ class FullParseHandler return newUnary(PNK_DELETE, JSOP_NOP, begin, expr); } - ParseNode *newNullary(ParseNodeKind kind, JSOp op, const TokenPos &pos) { + ParseNode* newNullary(ParseNodeKind kind, JSOp op, const TokenPos& pos) { return new_(kind, op, pos); } - ParseNode *newUnary(ParseNodeKind kind, JSOp op, uint32_t begin, ParseNode *kid) { + ParseNode* newUnary(ParseNodeKind kind, JSOp op, uint32_t begin, ParseNode* kid) { TokenPos pos(begin, kid ? kid->pn_pos.end : begin + 1); return new_(kind, op, pos, kid); } - ParseNode *newBinary(ParseNodeKind kind, JSOp op = JSOP_NOP) { - return new_(kind, op, pos(), (ParseNode *) nullptr, (ParseNode *) nullptr); + ParseNode* newBinary(ParseNodeKind kind, JSOp op = JSOP_NOP) { + return new_(kind, op, pos(), (ParseNode*) nullptr, (ParseNode*) nullptr); } - ParseNode *newBinary(ParseNodeKind kind, ParseNode *left, + ParseNode* newBinary(ParseNodeKind kind, ParseNode* left, JSOp op = JSOP_NOP) { - return new_(kind, op, left->pn_pos, left, (ParseNode *) nullptr); + return new_(kind, op, left->pn_pos, left, (ParseNode*) nullptr); } - ParseNode *newBinary(ParseNodeKind kind, ParseNode *left, ParseNode *right, + ParseNode* newBinary(ParseNodeKind kind, ParseNode* left, ParseNode* right, JSOp op = JSOP_NOP) { TokenPos pos(left->pn_pos.begin, right->pn_pos.end); return new_(kind, op, pos, left, right); } - ParseNode *newBinaryOrAppend(ParseNodeKind kind, ParseNode *left, ParseNode *right, - ParseContext *pc, JSOp op = JSOP_NOP) + ParseNode* newBinaryOrAppend(ParseNodeKind kind, ParseNode* left, ParseNode* right, + ParseContext* pc, JSOp op = JSOP_NOP) { return ParseNode::newBinaryOrAppend(kind, op, left, right, this, pc, foldConstants); } - ParseNode *newTernary(ParseNodeKind kind, - ParseNode *first, ParseNode *second, ParseNode *third, + ParseNode* newTernary(ParseNodeKind kind, + ParseNode* first, ParseNode* second, ParseNode* third, JSOp op = JSOP_NOP) { return new_(kind, op, first, second, third); @@ -191,10 +191,10 @@ class FullParseHandler // Expressions - ParseNode *newArrayComprehension(ParseNode *body, unsigned blockid, const TokenPos &pos) { + ParseNode* newArrayComprehension(ParseNode* body, unsigned blockid, const TokenPos& pos) { JS_ASSERT(pos.begin <= body->pn_pos.begin); JS_ASSERT(body->pn_pos.end <= pos.end); - ParseNode *pn = new_(PNK_ARRAYCOMP, pos); + ParseNode* pn = new_(PNK_ARRAYCOMP, pos); if (!pn) return nullptr; pn->pn_blockid = blockid; @@ -202,8 +202,8 @@ class FullParseHandler return pn; } - ParseNode *newArrayLiteral(uint32_t begin, unsigned blockid) { - ParseNode *literal = new_(PNK_ARRAY, TokenPos(begin, begin + 1)); + ParseNode* newArrayLiteral(uint32_t begin, unsigned blockid) { + ParseNode* literal = new_(PNK_ARRAY, TokenPos(begin, begin + 1)); // Later in this stack: remove dependency on this opcode. if (literal) { literal->setOp(JSOP_NEWINIT); @@ -212,8 +212,8 @@ class FullParseHandler return literal; } - bool addElision(ParseNode *literal, const TokenPos &pos) { - ParseNode *elision = new_(PNK_ELISION, pos); + bool addElision(ParseNode* literal, const TokenPos& pos) { + ParseNode* elision = new_(PNK_ELISION, pos); if (!elision) return false; literal->append(elision); @@ -221,9 +221,9 @@ class FullParseHandler return true; } - bool addSpreadElement(ParseNode *literal, uint32_t begin, ParseNode *inner) { + bool addSpreadElement(ParseNode* literal, uint32_t begin, ParseNode* inner) { TokenPos pos(begin, inner->pn_pos.end); - ParseNode *spread = new_(PNK_SPREAD, JSOP_NOP, pos, inner); + ParseNode* spread = new_(PNK_SPREAD, JSOP_NOP, pos, inner); if (!spread) return null(); literal->append(spread); @@ -231,41 +231,41 @@ class FullParseHandler return true; } - bool addArrayElement(ParseNode *literal, ParseNode *element) { + bool addArrayElement(ParseNode* literal, ParseNode* element) { if (!element->isConstant()) literal->pn_xflags |= PNX_NONCONST; literal->append(element); return true; } - ParseNode *newObjectLiteral(uint32_t begin) { - ParseNode *literal = new_(PNK_OBJECT, TokenPos(begin, begin + 1)); + ParseNode* newObjectLiteral(uint32_t begin) { + ParseNode* literal = new_(PNK_OBJECT, TokenPos(begin, begin + 1)); // Later in this stack: remove dependency on this opcode. if (literal) literal->setOp(JSOP_NEWINIT); return literal; } - bool addPropertyDefinition(ParseNode *literal, ParseNode *name, ParseNode *expr) { - ParseNode *propdef = newBinary(PNK_COLON, name, expr, JSOP_INITPROP); + bool addPropertyDefinition(ParseNode* literal, ParseNode* name, ParseNode* expr) { + ParseNode* propdef = newBinary(PNK_COLON, name, expr, JSOP_INITPROP); if (!propdef) return false; literal->append(propdef); return true; } - bool addShorthandPropertyDefinition(ParseNode *literal, ParseNode *name) { + bool addShorthandPropertyDefinition(ParseNode* literal, ParseNode* name) { JS_ASSERT(literal->isArity(PN_LIST)); literal->pn_xflags |= PNX_DESTRUCT | PNX_NONCONST; // XXX why PNX_DESTRUCT? return addPropertyDefinition(literal, name, name); } - bool addAccessorPropertyDefinition(ParseNode *literal, ParseNode *name, ParseNode *fn, JSOp op) + bool addAccessorPropertyDefinition(ParseNode* literal, ParseNode* name, ParseNode* fn, JSOp op) { JS_ASSERT(literal->isArity(PN_LIST)); literal->pn_xflags |= PNX_NONCONST; - ParseNode *propdef = newBinary(PNK_COLON, name, fn, op); + ParseNode* propdef = newBinary(PNK_COLON, name, fn, op); if (!propdef) return false; literal->append(propdef); @@ -274,15 +274,15 @@ class FullParseHandler // Statements - ParseNode *newStatementList(unsigned blockid, const TokenPos &pos) { - ParseNode *pn = new_(PNK_STATEMENTLIST, pos); + ParseNode* newStatementList(unsigned blockid, const TokenPos& pos) { + ParseNode* pn = new_(PNK_STATEMENTLIST, pos); if (pn) pn->pn_blockid = blockid; return pn; } template - void addStatementToList(ParseNode *list, ParseNode *stmt, PC *pc) { + void addStatementToList(ParseNode* list, ParseNode* stmt, PC* pc) { JS_ASSERT(list->isKind(PNK_STATEMENTLIST)); if (stmt->isKind(PNK_FUNCTION)) { @@ -301,64 +301,64 @@ class FullParseHandler list->append(stmt); } - ParseNode *newEmptyStatement(const TokenPos &pos) { - return new_(PNK_SEMI, JSOP_NOP, pos, (ParseNode *) nullptr); + ParseNode* newEmptyStatement(const TokenPos& pos) { + return new_(PNK_SEMI, JSOP_NOP, pos, (ParseNode*) nullptr); } - ParseNode *newImportDeclaration(ParseNode *importSpecSet, - ParseNode *moduleSpec, const TokenPos &pos) + ParseNode* newImportDeclaration(ParseNode* importSpecSet, + ParseNode* moduleSpec, const TokenPos& pos) { - ParseNode *pn = new_(PNK_IMPORT, JSOP_NOP, pos, + ParseNode* pn = new_(PNK_IMPORT, JSOP_NOP, pos, importSpecSet, moduleSpec); if (!pn) return null(); return pn; } - ParseNode *newExportDeclaration(ParseNode *kid, const TokenPos &pos) { + ParseNode* newExportDeclaration(ParseNode* kid, const TokenPos& pos) { return new_(PNK_EXPORT, JSOP_NOP, pos, kid); } - ParseNode *newExportFromDeclaration(uint32_t begin, ParseNode *exportSpecSet, - ParseNode *moduleSpec) + ParseNode* newExportFromDeclaration(uint32_t begin, ParseNode* exportSpecSet, + ParseNode* moduleSpec) { - ParseNode *pn = new_(PNK_EXPORT_FROM, JSOP_NOP, exportSpecSet, moduleSpec); + ParseNode* pn = new_(PNK_EXPORT_FROM, JSOP_NOP, exportSpecSet, moduleSpec); if (!pn) return null(); pn->pn_pos.begin = begin; return pn; } - ParseNode *newExprStatement(ParseNode *expr, uint32_t end) { + ParseNode* newExprStatement(ParseNode* expr, uint32_t end) { JS_ASSERT(expr->pn_pos.end <= end); return new_(PNK_SEMI, JSOP_NOP, TokenPos(expr->pn_pos.begin, end), expr); } - ParseNode *newIfStatement(uint32_t begin, ParseNode *cond, ParseNode *thenBranch, - ParseNode *elseBranch) + ParseNode* newIfStatement(uint32_t begin, ParseNode* cond, ParseNode* thenBranch, + ParseNode* elseBranch) { - ParseNode *pn = new_(PNK_IF, JSOP_NOP, cond, thenBranch, elseBranch); + ParseNode* pn = new_(PNK_IF, JSOP_NOP, cond, thenBranch, elseBranch); if (!pn) return null(); pn->pn_pos.begin = begin; return pn; } - ParseNode *newDoWhileStatement(ParseNode *body, ParseNode *cond, const TokenPos &pos) { + ParseNode* newDoWhileStatement(ParseNode* body, ParseNode* cond, const TokenPos& pos) { return new_(PNK_DOWHILE, JSOP_NOP, pos, body, cond); } - ParseNode *newWhileStatement(uint32_t begin, ParseNode *cond, ParseNode *body) { + ParseNode* newWhileStatement(uint32_t begin, ParseNode* cond, ParseNode* body) { TokenPos pos(begin, body->pn_pos.end); return new_(PNK_WHILE, JSOP_NOP, pos, cond, body); } - ParseNode *newForStatement(uint32_t begin, ParseNode *forHead, ParseNode *body, + ParseNode* newForStatement(uint32_t begin, ParseNode* forHead, ParseNode* body, unsigned iflags) { /* A FOR node is binary, left is loop control and right is the body. */ JSOp op = forHead->isKind(PNK_FORIN) ? JSOP_ITER : JSOP_NOP; - BinaryNode *pn = new_(PNK_FOR, op, TokenPos(begin, body->pn_pos.end), + BinaryNode* pn = new_(PNK_FOR, op, TokenPos(begin, body->pn_pos.end), forHead, body); if (!pn) return null(); @@ -366,119 +366,119 @@ class FullParseHandler return pn; } - ParseNode *newForHead(ParseNodeKind kind, ParseNode *pn1, ParseNode *pn2, ParseNode *pn3, - const TokenPos &pos) + ParseNode* newForHead(ParseNodeKind kind, ParseNode* pn1, ParseNode* pn2, ParseNode* pn3, + const TokenPos& pos) { JS_ASSERT(kind == PNK_FORIN || kind == PNK_FOROF || kind == PNK_FORHEAD); return new_(kind, JSOP_NOP, pn1, pn2, pn3, pos); } - ParseNode *newSwitchStatement(uint32_t begin, ParseNode *discriminant, ParseNode *caseList) { + ParseNode* newSwitchStatement(uint32_t begin, ParseNode* discriminant, ParseNode* caseList) { TokenPos pos(begin, caseList->pn_pos.end); return new_(PNK_SWITCH, JSOP_NOP, pos, discriminant, caseList); } - ParseNode *newCaseOrDefault(uint32_t begin, ParseNode *expr, ParseNode *body) { + ParseNode* newCaseOrDefault(uint32_t begin, ParseNode* expr, ParseNode* body) { TokenPos pos(begin, body->pn_pos.end); return new_(expr ? PNK_CASE : PNK_DEFAULT, JSOP_NOP, pos, expr, body); } - ParseNode *newContinueStatement(PropertyName *label, const TokenPos &pos) { + ParseNode* newContinueStatement(PropertyName* label, const TokenPos& pos) { return new_(label, pos); } - ParseNode *newBreakStatement(PropertyName *label, const TokenPos &pos) { + ParseNode* newBreakStatement(PropertyName* label, const TokenPos& pos) { return new_(label, pos); } - ParseNode *newReturnStatement(ParseNode *expr, const TokenPos &pos) { + ParseNode* newReturnStatement(ParseNode* expr, const TokenPos& pos) { JS_ASSERT_IF(expr, pos.encloses(expr->pn_pos)); return new_(PNK_RETURN, JSOP_RETURN, pos, expr); } - ParseNode *newWithStatement(uint32_t begin, ParseNode *expr, ParseNode *body, - ObjectBox *staticWith) { + ParseNode* newWithStatement(uint32_t begin, ParseNode* expr, ParseNode* body, + ObjectBox* staticWith) { return new_(PNK_WITH, JSOP_NOP, TokenPos(begin, body->pn_pos.end), expr, body, staticWith); } - ParseNode *newLabeledStatement(PropertyName *label, ParseNode *stmt, uint32_t begin) { + ParseNode* newLabeledStatement(PropertyName* label, ParseNode* stmt, uint32_t begin) { return new_(label, stmt, begin); } - ParseNode *newThrowStatement(ParseNode *expr, const TokenPos &pos) { + ParseNode* newThrowStatement(ParseNode* expr, const TokenPos& pos) { JS_ASSERT(pos.encloses(expr->pn_pos)); return new_(PNK_THROW, JSOP_THROW, pos, expr); } - ParseNode *newTryStatement(uint32_t begin, ParseNode *body, ParseNode *catchList, - ParseNode *finallyBlock) { + ParseNode* newTryStatement(uint32_t begin, ParseNode* body, ParseNode* catchList, + ParseNode* finallyBlock) { TokenPos pos(begin, (finallyBlock ? finallyBlock : catchList)->pn_pos.end); return new_(PNK_TRY, JSOP_NOP, body, catchList, finallyBlock, pos); } - ParseNode *newDebuggerStatement(const TokenPos &pos) { + ParseNode* newDebuggerStatement(const TokenPos& pos) { return new_(pos); } - ParseNode *newPropertyAccess(ParseNode *pn, PropertyName *name, uint32_t end) { + ParseNode* newPropertyAccess(ParseNode* pn, PropertyName* name, uint32_t end) { return new_(pn, name, pn->pn_pos.begin, end); } - ParseNode *newPropertyByValue(ParseNode *lhs, ParseNode *index, uint32_t end) { + ParseNode* newPropertyByValue(ParseNode* lhs, ParseNode* index, uint32_t end) { return new_(lhs, index, lhs->pn_pos.begin, end); } - inline bool addCatchBlock(ParseNode *catchList, ParseNode *letBlock, - ParseNode *catchName, ParseNode *catchGuard, ParseNode *catchBody); + inline bool addCatchBlock(ParseNode* catchList, ParseNode* letBlock, + ParseNode* catchName, ParseNode* catchGuard, ParseNode* catchBody); - inline void setLastFunctionArgumentDefault(ParseNode *funcpn, ParseNode *pn); - inline ParseNode *newFunctionDefinition(); - void setFunctionBody(ParseNode *pn, ParseNode *kid) { + inline void setLastFunctionArgumentDefault(ParseNode* funcpn, ParseNode* pn); + inline ParseNode* newFunctionDefinition(); + void setFunctionBody(ParseNode* pn, ParseNode* kid) { pn->pn_body = kid; } - void setFunctionBox(ParseNode *pn, FunctionBox *funbox) { + void setFunctionBox(ParseNode* pn, FunctionBox* funbox) { JS_ASSERT(pn->isKind(PNK_FUNCTION)); pn->pn_funbox = funbox; } - void addFunctionArgument(ParseNode *pn, ParseNode *argpn) { + void addFunctionArgument(ParseNode* pn, ParseNode* argpn) { pn->pn_body->append(argpn); } - inline ParseNode *newLexicalScope(ObjectBox *blockbox); - inline void setLexicalScopeBody(ParseNode *block, ParseNode *body); + inline ParseNode* newLexicalScope(ObjectBox* blockbox); + inline void setLexicalScopeBody(ParseNode* block, ParseNode* body); - bool isOperationWithoutParens(ParseNode *pn, ParseNodeKind kind) { + bool isOperationWithoutParens(ParseNode* pn, ParseNodeKind kind) { return pn->isKind(kind) && !pn->isInParens(); } - inline bool finishInitializerAssignment(ParseNode *pn, ParseNode *init, JSOp op); + inline bool finishInitializerAssignment(ParseNode* pn, ParseNode* init, JSOp op); - void setBeginPosition(ParseNode *pn, ParseNode *oth) { + void setBeginPosition(ParseNode* pn, ParseNode* oth) { setBeginPosition(pn, oth->pn_pos.begin); } - void setBeginPosition(ParseNode *pn, uint32_t begin) { + void setBeginPosition(ParseNode* pn, uint32_t begin) { pn->pn_pos.begin = begin; JS_ASSERT(pn->pn_pos.begin <= pn->pn_pos.end); } - void setEndPosition(ParseNode *pn, ParseNode *oth) { + void setEndPosition(ParseNode* pn, ParseNode* oth) { setEndPosition(pn, oth->pn_pos.end); } - void setEndPosition(ParseNode *pn, uint32_t end) { + void setEndPosition(ParseNode* pn, uint32_t end) { pn->pn_pos.end = end; JS_ASSERT(pn->pn_pos.begin <= pn->pn_pos.end); } - void setPosition(ParseNode *pn, const TokenPos &pos) { + void setPosition(ParseNode* pn, const TokenPos& pos) { pn->pn_pos = pos; } - TokenPos getPosition(ParseNode *pn) { + TokenPos getPosition(ParseNode* pn) { return pn->pn_pos; } - ParseNode *newList(ParseNodeKind kind, ParseNode *kid = nullptr, JSOp op = JSOP_NOP) { - ParseNode *pn = ListNode::create(kind, this); + ParseNode* newList(ParseNodeKind kind, ParseNode* kid = nullptr, JSOp op = JSOP_NOP) { + ParseNode* pn = ListNode::create(kind, this); if (!pn) return nullptr; pn->setOp(op); @@ -489,64 +489,64 @@ class FullParseHandler } return pn; } - void addList(ParseNode *pn, ParseNode *kid) { + void addList(ParseNode* pn, ParseNode* kid) { pn->append(kid); } - bool isUnparenthesizedYield(ParseNode *pn) { + bool isUnparenthesizedYield(ParseNode* pn) { return pn->isKind(PNK_YIELD) && !pn->isInParens(); } - void setOp(ParseNode *pn, JSOp op) { + void setOp(ParseNode* pn, JSOp op) { pn->setOp(op); } - void setBlockId(ParseNode *pn, unsigned blockid) { + void setBlockId(ParseNode* pn, unsigned blockid) { pn->pn_blockid = blockid; } - void setFlag(ParseNode *pn, unsigned flag) { + void setFlag(ParseNode* pn, unsigned flag) { pn->pn_dflags |= flag; } - void setListFlag(ParseNode *pn, unsigned flag) { + void setListFlag(ParseNode* pn, unsigned flag) { JS_ASSERT(pn->isArity(PN_LIST)); pn->pn_xflags |= flag; } - ParseNode *setInParens(ParseNode *pn) { + ParseNode* setInParens(ParseNode* pn) { pn->setInParens(true); return pn; } - void setPrologue(ParseNode *pn) { + void setPrologue(ParseNode* pn) { pn->pn_prologue = true; } - bool isConstant(ParseNode *pn) { + bool isConstant(ParseNode* pn) { return pn->isConstant(); } - PropertyName *isName(ParseNode *pn) { + PropertyName* isName(ParseNode* pn) { return pn->isKind(PNK_NAME) ? pn->pn_atom->asPropertyName() : nullptr; } - bool isCall(ParseNode *pn) { + bool isCall(ParseNode* pn) { return pn->isKind(PNK_CALL); } - PropertyName *isGetProp(ParseNode *pn) { + PropertyName* isGetProp(ParseNode* pn) { return pn->is() ? &pn->as().name() : nullptr; } - JSAtom *isStringExprStatement(ParseNode *pn, TokenPos *pos) { - if (JSAtom *atom = pn->isStringExprStatement()) { + JSAtom* isStringExprStatement(ParseNode* pn, TokenPos* pos) { + if (JSAtom* atom = pn->isStringExprStatement()) { *pos = pn->pn_kid->pn_pos; return atom; } return nullptr; } - inline ParseNode *makeAssignment(ParseNode *pn, ParseNode *rhs); + inline ParseNode* makeAssignment(ParseNode* pn, ParseNode* rhs); - static Definition *getDefinitionNode(Definition *dn) { + static Definition* getDefinitionNode(Definition* dn) { return dn; } - static Definition::Kind getDefinitionKind(Definition *dn) { + static Definition::Kind getDefinitionKind(Definition* dn) { return dn->kind(); } - void linkUseToDef(ParseNode *pn, Definition *dn) + void linkUseToDef(ParseNode* pn, Definition* dn) { JS_ASSERT(!pn->isUsed()); JS_ASSERT(!pn->isDefn()); @@ -558,49 +558,49 @@ class FullParseHandler pn->setUsed(true); pn->pn_lexdef = dn; } - Definition *resolve(Definition *dn) { + Definition* resolve(Definition* dn) { return dn->resolve(); } - void deoptimizeUsesWithin(Definition *dn, const TokenPos &pos) + void deoptimizeUsesWithin(Definition* dn, const TokenPos& pos) { - for (ParseNode *pnu = dn->dn_uses; pnu; pnu = pnu->pn_link) { + for (ParseNode* pnu = dn->dn_uses; pnu; pnu = pnu->pn_link) { JS_ASSERT(pnu->isUsed()); JS_ASSERT(!pnu->isDefn()); if (pnu->pn_pos.begin >= pos.begin && pnu->pn_pos.end <= pos.end) pnu->pn_dflags |= PND_DEOPTIMIZED; } } - bool dependencyCovered(ParseNode *pn, unsigned blockid, bool functionScope) { + bool dependencyCovered(ParseNode* pn, unsigned blockid, bool functionScope) { return pn->pn_blockid >= blockid; } - static uintptr_t definitionToBits(Definition *dn) { + static uintptr_t definitionToBits(Definition* dn) { return uintptr_t(dn); } - static Definition *definitionFromBits(uintptr_t bits) { - return (Definition *) bits; + static Definition* definitionFromBits(uintptr_t bits) { + return (Definition*) bits; } - static Definition *nullDefinition() { + static Definition* nullDefinition() { return nullptr; } void disableSyntaxParser() { syntaxParser = nullptr; } - LazyScript *lazyOuterFunction() { + LazyScript* lazyOuterFunction() { return lazyOuterFunction_; } - JSFunction *nextLazyInnerFunction() { + JSFunction* nextLazyInnerFunction() { JS_ASSERT(lazyInnerFunctionIndex < lazyOuterFunction()->numInnerFunctions()); return lazyOuterFunction()->innerFunctions()[lazyInnerFunctionIndex++]; } }; inline bool -FullParseHandler::addCatchBlock(ParseNode *catchList, ParseNode *letBlock, - ParseNode *catchName, ParseNode *catchGuard, ParseNode *catchBody) +FullParseHandler::addCatchBlock(ParseNode* catchList, ParseNode* letBlock, + ParseNode* catchName, ParseNode* catchGuard, ParseNode* catchBody) { - ParseNode *catchpn = newTernary(PNK_CATCH, catchName, catchGuard, catchBody); + ParseNode* catchpn = newTernary(PNK_CATCH, catchName, catchGuard, catchBody); if (!catchpn) return false; @@ -610,17 +610,17 @@ FullParseHandler::addCatchBlock(ParseNode *catchList, ParseNode *letBlock, } inline void -FullParseHandler::setLastFunctionArgumentDefault(ParseNode *funcpn, ParseNode *defaultValue) +FullParseHandler::setLastFunctionArgumentDefault(ParseNode* funcpn, ParseNode* defaultValue) { - ParseNode *arg = funcpn->pn_body->last(); + ParseNode* arg = funcpn->pn_body->last(); arg->pn_dflags |= PND_DEFAULT; arg->pn_expr = defaultValue; } -inline ParseNode * +inline ParseNode* FullParseHandler::newFunctionDefinition() { - ParseNode *pn = CodeNode::create(PNK_FUNCTION, this); + ParseNode* pn = CodeNode::create(PNK_FUNCTION, this); if (!pn) return nullptr; pn->pn_body = nullptr; @@ -630,10 +630,10 @@ FullParseHandler::newFunctionDefinition() return pn; } -inline ParseNode * -FullParseHandler::newLexicalScope(ObjectBox *blockbox) +inline ParseNode* +FullParseHandler::newLexicalScope(ObjectBox* blockbox) { - ParseNode *pn = LexicalScopeNode::create(PNK_LEXICALSCOPE, this); + ParseNode* pn = LexicalScopeNode::create(PNK_LEXICALSCOPE, this); if (!pn) return nullptr; @@ -644,13 +644,13 @@ FullParseHandler::newLexicalScope(ObjectBox *blockbox) } inline void -FullParseHandler::setLexicalScopeBody(ParseNode *block, ParseNode *kid) +FullParseHandler::setLexicalScopeBody(ParseNode* block, ParseNode* kid) { block->pn_expr = kid; } inline bool -FullParseHandler::finishInitializerAssignment(ParseNode *pn, ParseNode *init, JSOp op) +FullParseHandler::finishInitializerAssignment(ParseNode* pn, ParseNode* init, JSOp op) { if (pn->isUsed()) { pn = makeAssignment(pn, init); @@ -673,16 +673,16 @@ FullParseHandler::finishInitializerAssignment(ParseNode *pn, ParseNode *init, JS return true; } -inline ParseNode * -FullParseHandler::makeAssignment(ParseNode *pn, ParseNode *rhs) +inline ParseNode* +FullParseHandler::makeAssignment(ParseNode* pn, ParseNode* rhs) { - ParseNode *lhs = cloneNode(*pn); + ParseNode* lhs = cloneNode(*pn); if (!lhs) return nullptr; if (pn->isUsed()) { - Definition *dn = pn->pn_lexdef; - ParseNode **pnup = &dn->dn_uses; + Definition* dn = pn->pn_lexdef; + ParseNode** pnup = &dn->dn_uses; while (*pnup != pn) pnup = &(*pnup)->pn_link; diff --git a/js/src/frontend/NameFunctions.cpp b/js/src/frontend/NameFunctions.cpp index 29c0eb9a96..45a63a485a 100644 --- a/js/src/frontend/NameFunctions.cpp +++ b/js/src/frontend/NameFunctions.cpp @@ -23,13 +23,13 @@ class NameResolver { static const size_t MaxParents = 100; - ExclusiveContext *cx; + ExclusiveContext* cx; size_t nparents; /* number of parents in the parents array */ - ParseNode *parents[MaxParents]; /* history of ParseNodes we've been looking at */ - StringBuffer *buf; /* when resolving, buffer to append to */ + ParseNode* parents[MaxParents]; /* history of ParseNodes we've been looking at */ + StringBuffer* buf; /* when resolving, buffer to append to */ /* Test whether a ParseNode represents a function invocation */ - bool call(ParseNode *pn) { + bool call(ParseNode* pn) { return pn && pn->isKind(PNK_CALL); } @@ -43,12 +43,12 @@ class NameResolver * front end will produce a PNK_DOT with a PNK_NAME child whose name * contains spaces. */ - bool appendPropertyReference(JSAtom *name) { + bool appendPropertyReference(JSAtom* name) { if (IsIdentifier(name)) return buf->append(".") && buf->append(name); /* Quote the string as needed. */ - JSString *source = js_QuoteString(cx, name, '"'); + JSString* source = js_QuoteString(cx, name, '"'); return source && buf->append("[") && buf->append(source) && buf->append("]"); } @@ -68,7 +68,7 @@ class NameResolver * Walk over the given ParseNode, converting it to a stringified name that * respresents where the function is being assigned to. */ - bool nameExpression(ParseNode *n) { + bool nameExpression(ParseNode* n) { switch (n->getKind()) { case PNK_DOT: return nameExpression(n->expr()) && appendPropertyReference(n->pn_atom); @@ -111,11 +111,11 @@ class NameResolver * innermost node relevant to naming, and the last element will be the * outermost node. */ - ParseNode *gatherNameable(ParseNode **nameable, size_t *size) { + ParseNode* gatherNameable(ParseNode** nameable, size_t* size) { *size = 0; for (int pos = nparents - 1; pos >= 0; pos--) { - ParseNode *cur = parents[pos]; + ParseNode* cur = parents[pos]; if (cur->isAssignment()) return cur; @@ -173,7 +173,7 @@ class NameResolver * listed, then it is skipped. Otherwise an intelligent name is guessed to * assign to the function's displayAtom field */ - bool resolveFun(ParseNode *pn, HandleAtom prefix, MutableHandleAtom retAtom) { + bool resolveFun(ParseNode* pn, HandleAtom prefix, MutableHandleAtom retAtom) { JS_ASSERT(pn != nullptr && pn->isKind(PNK_FUNCTION)); RootedFunction fun(cx, pn->pn_funbox->function()); @@ -201,9 +201,9 @@ class NameResolver return false; /* Gather all nodes relevant to naming */ - ParseNode *toName[MaxParents]; + ParseNode* toName[MaxParents]; size_t size; - ParseNode *assignment = gatherNameable(toName, &size); + ParseNode* assignment = gatherNameable(toName, &size); /* If the function is assigned to something, then that is very relevant */ if (assignment) { @@ -219,10 +219,10 @@ class NameResolver * contribution. */ for (int pos = size - 1; pos >= 0; pos--) { - ParseNode *node = toName[pos]; + ParseNode* node = toName[pos]; if (node->isKind(PNK_COLON)) { - ParseNode *left = node->pn_left; + ParseNode* left = node->pn_left; if (left->isKind(PNK_NAME) || left->isKind(PNK_STRING)) { if (!appendPropertyReference(left->pn_atom)) return false; @@ -263,19 +263,19 @@ class NameResolver * This is the case for functions which do things like simply create a scope * for new variables and then return an anonymous function using this scope. */ - bool isDirectCall(int pos, ParseNode *cur) { + bool isDirectCall(int pos, ParseNode* cur) { return pos >= 0 && call(parents[pos]) && parents[pos]->pn_head == cur; } public: - explicit NameResolver(ExclusiveContext *cx) : cx(cx), nparents(0), buf(nullptr) {} + explicit NameResolver(ExclusiveContext* cx) : cx(cx), nparents(0), buf(nullptr) {} /* * Resolve all names for anonymous functions recursively within the * ParseNode instance given. The prefix is for each subsequent name, and * should initially be nullptr. */ - bool resolve(ParseNode *cur, HandleAtom prefixArg = js::NullPtr()) { + bool resolve(ParseNode* cur, HandleAtom prefixArg = js::NullPtr()) { RootedAtom prefix(cx, prefixArg); if (cur == nullptr) return true; @@ -338,7 +338,7 @@ class NameResolver return false; break; case PN_LIST: - for (ParseNode *nxt = cur->pn_head; nxt; nxt = nxt->pn_next) + for (ParseNode* nxt = cur->pn_head; nxt; nxt = nxt->pn_next) if (!resolve(nxt, prefix)) return false; break; @@ -351,7 +351,7 @@ class NameResolver } /* anonymous namespace */ bool -frontend::NameFunctions(ExclusiveContext *cx, ParseNode *pn) +frontend::NameFunctions(ExclusiveContext* cx, ParseNode* pn) { NameResolver nr(cx); return nr.resolve(pn); diff --git a/js/src/frontend/NameFunctions.h b/js/src/frontend/NameFunctions.h index 0f8717e744..0773db60b7 100644 --- a/js/src/frontend/NameFunctions.h +++ b/js/src/frontend/NameFunctions.h @@ -18,7 +18,7 @@ namespace frontend { class ParseNode; bool -NameFunctions(ExclusiveContext *cx, ParseNode *pn); +NameFunctions(ExclusiveContext* cx, ParseNode* pn); } /* namespace frontend */ } /* namespace js */ diff --git a/js/src/frontend/ParseMaps-inl.h b/js/src/frontend/ParseMaps-inl.h index 6a66b71a99..0f14d7ff08 100644 --- a/js/src/frontend/ParseMaps-inl.h +++ b/js/src/frontend/ParseMaps-inl.h @@ -16,7 +16,7 @@ namespace frontend { template inline bool -AtomThingMapPtr::ensureMap(ExclusiveContext *cx) +AtomThingMapPtr::ensureMap(ExclusiveContext* cx) { if (map_) return true; @@ -28,7 +28,7 @@ AtomThingMapPtr::ensureMap(ExclusiveContext *cx) template inline void -AtomThingMapPtr::releaseMap(ExclusiveContext *cx) +AtomThingMapPtr::releaseMap(ExclusiveContext* cx) { if (!map_) return; diff --git a/js/src/frontend/ParseMaps.cpp b/js/src/frontend/ParseMaps.cpp index ec670eaa49..a3091caa4d 100644 --- a/js/src/frontend/ParseMaps.cpp +++ b/js/src/frontend/ParseMaps.cpp @@ -21,8 +21,8 @@ ParseMapPool::checkInvariants() * Having all values be of the same size permits us to easily reuse the * allocated space for each of the map types. */ - JS_STATIC_ASSERT(sizeof(Definition *) == sizeof(jsatomid)); - JS_STATIC_ASSERT(sizeof(Definition *) == sizeof(DefinitionList)); + JS_STATIC_ASSERT(sizeof(Definition*) == sizeof(jsatomid)); + JS_STATIC_ASSERT(sizeof(Definition*) == sizeof(DefinitionList)); JS_STATIC_ASSERT(sizeof(AtomDefnMap::Entry) == sizeof(AtomIndexMap::Entry)); JS_STATIC_ASSERT(sizeof(AtomDefnMap::Entry) == sizeof(AtomDefnListMap::Entry)); JS_STATIC_ASSERT(sizeof(AtomMapT::Entry) == sizeof(AtomDefnListMap::Entry)); @@ -35,32 +35,32 @@ ParseMapPool::checkInvariants() void ParseMapPool::purgeAll() { - for (void **it = all.begin(), **end = all.end(); it != end; ++it) + for (void** it = all.begin(), **end = all.end(); it != end; ++it) js_delete(asAtomMap(*it)); all.clearAndFree(); recyclable.clearAndFree(); } -void * +void* ParseMapPool::allocateFresh() { size_t newAllLength = all.length() + 1; if (!all.reserve(newAllLength) || !recyclable.reserve(newAllLength)) return nullptr; - AtomMapT *map = js_new(); + AtomMapT* map = js_new(); if (!map) return nullptr; all.infallibleAppend(map); - return (void *) map; + return (void*) map; } -DefinitionList::Node * -DefinitionList::allocNode(ExclusiveContext *cx, LifoAlloc &alloc, uintptr_t head, Node *tail) +DefinitionList::Node* +DefinitionList::allocNode(ExclusiveContext* cx, LifoAlloc& alloc, uintptr_t head, Node* tail) { - Node *result = alloc.new_(head, tail); + Node* result = alloc.new_(head, tail); if (!result) js_ReportOutOfMemory(cx); return result; @@ -74,15 +74,15 @@ AtomDecls::dump() for (AtomDefnListRange r = map->all(); !r.empty(); r.popFront()) { fprintf(stderr, "atom: "); js_DumpAtom(r.front().key()); - const DefinitionList &dlist = r.front().value(); + const DefinitionList& dlist = r.front().value(); for (DefinitionList::Range dr = dlist.all(); !dr.empty(); dr.popFront()) { - fprintf(stderr, " defn: %p\n", (void *) dr.front()); + fprintf(stderr, " defn: %p\n", (void*) dr.front()); } } } void -DumpAtomDefnMap(const AtomDefnMapPtr &map) +DumpAtomDefnMap(const AtomDefnMapPtr& map) { if (map->empty()) { fprintf(stderr, "empty\n"); @@ -92,14 +92,14 @@ DumpAtomDefnMap(const AtomDefnMapPtr &map) for (AtomDefnRange r = map->all(); !r.empty(); r.popFront()) { fprintf(stderr, "atom: "); js_DumpAtom(r.front().key()); - fprintf(stderr, "defn: %p\n", (void *) r.front().value().get()); + fprintf(stderr, "defn: %p\n", (void*) r.front().value().get()); } } #endif template bool -AtomDecls::addShadow(JSAtom *atom, typename ParseHandler::DefinitionNode defn) +AtomDecls::addShadow(JSAtom* atom, typename ParseHandler::DefinitionNode defn) { AtomDefnListAddPtr p = map->lookupForAdd(atom); if (!p) @@ -109,21 +109,21 @@ AtomDecls::addShadow(JSAtom *atom, typename ParseHandler::Definiti } void -frontend::InitAtomMap(frontend::AtomIndexMap *indices, HeapPtrAtom *atoms) +frontend::InitAtomMap(frontend::AtomIndexMap* indices, HeapPtrAtom* atoms) { if (indices->isMap()) { typedef AtomIndexMap::WordMap WordMap; - const WordMap &wm = indices->asMap(); + const WordMap& wm = indices->asMap(); for (WordMap::Range r = wm.all(); !r.empty(); r.popFront()) { - JSAtom *atom = r.front().key(); + JSAtom* atom = r.front().key(); jsatomid index = r.front().value(); JS_ASSERT(index < indices->count()); atoms[index].init(atom); } } else { - for (const AtomIndexMap::InlineElem *it = indices->asInline(), *end = indices->inlineEnd(); + for (const AtomIndexMap::InlineElem* it = indices->asInline(), *end = indices->inlineEnd(); it != end; ++it) { - JSAtom *atom = it->key; + JSAtom* atom = it->key; if (!atom) continue; JS_ASSERT(it->value < indices->count()); diff --git a/js/src/frontend/ParseMaps.h b/js/src/frontend/ParseMaps.h index 96be43dbd4..05527c7702 100644 --- a/js/src/frontend/ParseMaps.h +++ b/js/src/frontend/ParseMaps.h @@ -27,9 +27,9 @@ namespace frontend { class DefinitionSingle; class DefinitionList; -typedef InlineMap AtomIndexMap; -typedef InlineMap AtomDefnMap; -typedef InlineMap AtomDefnListMap; +typedef InlineMap AtomIndexMap; +typedef InlineMap AtomDefnMap; +typedef InlineMap AtomDefnListMap; /* * For all unmapped atoms recorded in al, add a mapping from the atom's index @@ -37,7 +37,7 @@ typedef InlineMap AtomDefnListMap; * the list and map->vector must point to pre-allocated memory. */ void -InitAtomMap(AtomIndexMap *indices, HeapPtr *atoms); +InitAtomMap(AtomIndexMap* indices, HeapPtr* atoms); /* * A pool that permits the reuse of the backing storage for the defn, index, or @@ -48,38 +48,38 @@ InitAtomMap(AtomIndexMap *indices, HeapPtr *atoms); */ class ParseMapPool { - typedef Vector RecyclableMaps; + typedef Vector RecyclableMaps; RecyclableMaps all; RecyclableMaps recyclable; void checkInvariants(); - void recycle(void *map) { + void recycle(void* map) { JS_ASSERT(map); #ifdef DEBUG bool ok = false; /* Make sure the map is in |all| but not already in |recyclable|. */ - for (void **it = all.begin(), **end = all.end(); it != end; ++it) { + for (void** it = all.begin(), **end = all.end(); it != end; ++it) { if (*it == map) { ok = true; break; } } JS_ASSERT(ok); - for (void **it = recyclable.begin(), **end = recyclable.end(); it != end; ++it) + for (void** it = recyclable.begin(), **end = recyclable.end(); it != end; ++it) JS_ASSERT(*it != map); #endif JS_ASSERT(recyclable.length() < all.length()); recyclable.infallibleAppend(map); /* Reserved in allocateFresh. */ } - void *allocateFresh(); - void *allocate() { + void* allocateFresh(); + void* allocate() { if (recyclable.empty()) return allocateFresh(); - void *map = recyclable.popCopy(); + void* map = recyclable.popCopy(); asAtomMap(map)->clear(); return map; } @@ -87,8 +87,8 @@ class ParseMapPool /* Arbitrary atom map type, that has keys and values of the same kind. */ typedef AtomIndexMap AtomMapT; - static AtomMapT *asAtomMap(void *ptr) { - return reinterpret_cast(ptr); + static AtomMapT* asAtomMap(void* ptr) { + return reinterpret_cast(ptr); } public: @@ -104,22 +104,22 @@ class ParseMapPool /* Fallibly aquire one of the supported map types from the pool. */ template - T *acquire() { - return reinterpret_cast(allocate()); + T* acquire() { + return reinterpret_cast(allocate()); } /* Release one of the supported map types back to the pool. */ - void release(AtomIndexMap *map) { - recycle((void *) map); + void release(AtomIndexMap* map) { + recycle((void*) map); } - void release(AtomDefnMap *map) { - recycle((void *) map); + void release(AtomDefnMap* map) { + recycle((void*) map); } - void release(AtomDefnListMap *map) { - recycle((void *) map); + void release(AtomDefnListMap* map) { + recycle((void*) map); } }; /* ParseMapPool */ @@ -130,21 +130,21 @@ class ParseMapPool template struct AtomThingMapPtr { - Map *map_; + Map* map_; void init() { clearMap(); } - bool ensureMap(ExclusiveContext *cx); - void releaseMap(ExclusiveContext *cx); + bool ensureMap(ExclusiveContext* cx); + void releaseMap(ExclusiveContext* cx); bool hasMap() const { return map_; } - Map *getMap() { return map_; } - void setMap(Map *newMap) { JS_ASSERT(!map_); map_ = newMap; } + Map* getMap() { return map_; } + void setMap(Map* newMap) { JS_ASSERT(!map_); map_ = newMap; } void clearMap() { map_ = nullptr; } - Map *operator->() { return map_; } - const Map *operator->() const { return map_; } - Map &operator*() const { return *map_; } + Map* operator->() { return map_; } + const Map* operator->() const { return map_; } + Map& operator*() const { return *map_; } }; typedef AtomThingMapPtr AtomIndexMapPtr; @@ -156,10 +156,10 @@ typedef AtomThingMapPtr AtomIndexMapPtr; template class OwnedAtomThingMapPtr : public AtomThingMapPtrT { - ExclusiveContext *cx; + ExclusiveContext* cx; public: - explicit OwnedAtomThingMapPtr(ExclusiveContext *cx) : cx(cx) { + explicit OwnedAtomThingMapPtr(ExclusiveContext* cx) : cx(cx) { AtomThingMapPtrT::init(); } @@ -203,7 +203,7 @@ struct AtomDefnMapPtr : public AtomThingMapPtr { template MOZ_ALWAYS_INLINE - typename ParseHandler::DefinitionNode lookupDefn(JSAtom *atom) { + typename ParseHandler::DefinitionNode lookupDefn(JSAtom* atom) { AtomDefnMap::Ptr p = map_->lookup(atom); return p ? p.value().get() : ParseHandler::nullDefinition(); } @@ -235,33 +235,33 @@ class DefinitionList struct Node { uintptr_t bits; - Node *next; + Node* next; - Node(uintptr_t bits, Node *next) : bits(bits), next(next) {} + Node(uintptr_t bits, Node* next) : bits(bits), next(next) {} }; union { uintptr_t bits; - Node *head; + Node* head; } u; - Node *firstNode() const { + Node* firstNode() const { JS_ASSERT(isMultiple()); - return (Node *) (u.bits & ~0x1); + return (Node*) (u.bits & ~0x1); } - static Node * - allocNode(ExclusiveContext *cx, LifoAlloc &alloc, uintptr_t bits, Node *tail); + static Node* + allocNode(ExclusiveContext* cx, LifoAlloc& alloc, uintptr_t bits, Node* tail); public: class Range { friend class DefinitionList; - Node *node; + Node* node; uintptr_t bits; - explicit Range(const DefinitionList &list) { + explicit Range(const DefinitionList& list) { if (list.isMultiple()) { node = list.firstNode(); bits = node->bits; @@ -306,7 +306,7 @@ class DefinitionList JS_ASSERT(!isMultiple()); } - explicit DefinitionList(Node *node) { + explicit DefinitionList(Node* node) { u.head = node; u.bits |= 0x1; JS_ASSERT(isMultiple()); @@ -328,8 +328,8 @@ class DefinitionList if (!isMultiple()) return false; - Node *node = firstNode(); - Node *next = node->next; + Node* node = firstNode(); + Node* next = node->next; if (next->next) *this = DefinitionList(next); else @@ -343,9 +343,9 @@ class DefinitionList * Return true on success. On OOM, report on cx and return false. */ template - bool pushFront(ExclusiveContext *cx, LifoAlloc &alloc, + bool pushFront(ExclusiveContext* cx, LifoAlloc& alloc, typename ParseHandler::DefinitionNode defn) { - Node *tail; + Node* tail; if (isMultiple()) { tail = firstNode(); } else { @@ -354,7 +354,7 @@ class DefinitionList return false; } - Node *node = allocNode(cx, alloc, ParseHandler::definitionToBits(defn), tail); + Node* node = allocNode(cx, alloc, ParseHandler::definitionToBits(defn), tail); if (!node) return false; *this = DefinitionList(node); @@ -412,15 +412,15 @@ class AtomDecls /* AtomDeclsIter needs to get at the DefnListMap directly. */ friend class AtomDeclsIter; - ExclusiveContext *cx; - LifoAlloc &alloc; - AtomDefnListMap *map; + ExclusiveContext* cx; + LifoAlloc& alloc; + AtomDefnListMap* map; - AtomDecls(const AtomDecls &other) MOZ_DELETE; - void operator=(const AtomDecls &other) MOZ_DELETE; + AtomDecls(const AtomDecls& other) MOZ_DELETE; + void operator=(const AtomDecls& other) MOZ_DELETE; public: - explicit AtomDecls(ExclusiveContext *cx, LifoAlloc &alloc) : cx(cx), + explicit AtomDecls(ExclusiveContext* cx, LifoAlloc& alloc) : cx(cx), alloc(alloc), map(nullptr) {} @@ -433,7 +433,7 @@ class AtomDecls } /* Return the definition at the head of the chain for |atom|. */ - DefinitionNode lookupFirst(JSAtom *atom) const { + DefinitionNode lookupFirst(JSAtom* atom) const { JS_ASSERT(map); AtomDefnListPtr p = map->lookup(atom); if (!p) @@ -442,7 +442,7 @@ class AtomDecls } /* Perform a lookup that can iterate over the definitions associated with |atom|. */ - DefinitionList::Range lookupMulti(JSAtom *atom) const { + DefinitionList::Range lookupMulti(JSAtom* atom) const { JS_ASSERT(map); if (AtomDefnListPtr p = map->lookup(atom)) return p.value().all(); @@ -450,7 +450,7 @@ class AtomDecls } /* Add-or-update a known-unique definition for |atom|. */ - bool addUnique(JSAtom *atom, DefinitionNode defn) { + bool addUnique(JSAtom* atom, DefinitionNode defn) { JS_ASSERT(map); AtomDefnListAddPtr p = map->lookupForAdd(atom); if (!p) @@ -460,10 +460,10 @@ class AtomDecls return true; } - bool addShadow(JSAtom *atom, DefinitionNode defn); + bool addShadow(JSAtom* atom, DefinitionNode defn); /* Updating the definition for an entry that is known to exist is infallible. */ - void updateFirst(JSAtom *atom, DefinitionNode defn) { + void updateFirst(JSAtom* atom, DefinitionNode defn) { JS_ASSERT(map); AtomDefnListMap::Ptr p = map->lookup(atom); JS_ASSERT(p); @@ -471,13 +471,13 @@ class AtomDecls } /* Remove the node at the head of the chain for |atom|. */ - void remove(JSAtom *atom) { + void remove(JSAtom* atom) { JS_ASSERT(map); AtomDefnListMap::Ptr p = map->lookup(atom); if (!p) return; - DefinitionList &list = p.value(); + DefinitionList& list = p.value(); if (!list.popFront()) { map->remove(p); return; diff --git a/js/src/frontend/ParseNode-inl.h b/js/src/frontend/ParseNode-inl.h index 64addc2358..07710a71af 100644 --- a/js/src/frontend/ParseNode-inl.h +++ b/js/src/frontend/ParseNode-inl.h @@ -14,15 +14,15 @@ namespace js { namespace frontend { -inline PropertyName * +inline PropertyName* ParseNode::name() const { JS_ASSERT(isKind(PNK_FUNCTION) || isKind(PNK_NAME)); - JSAtom *atom = isKind(PNK_FUNCTION) ? pn_funbox->function()->atom() : pn_atom; + JSAtom* atom = isKind(PNK_FUNCTION) ? pn_funbox->function()->atom() : pn_atom; return atom->asPropertyName(); } -inline JSAtom * +inline JSAtom* ParseNode::atom() const { JS_ASSERT(isKind(PNK_STRING)); diff --git a/js/src/frontend/ParseNode.cpp b/js/src/frontend/ParseNode.cpp index 346d4d4292..0453ebc22f 100644 --- a/js/src/frontend/ParseNode.cpp +++ b/js/src/frontend/ParseNode.cpp @@ -29,10 +29,10 @@ void ParseNode::checkListConsistency() { JS_ASSERT(isArity(PN_LIST)); - ParseNode **tail; + ParseNode** tail; uint32_t count = 0; if (pn_head) { - ParseNode *pn, *last; + ParseNode* pn, *last; for (pn = last = pn_head; pn; last = pn, pn = pn->pn_next, count++) ; tail = &last->pn_next; @@ -46,7 +46,7 @@ ParseNode::checkListConsistency() /* Add |node| to |parser|'s free node list. */ void -ParseNodeAllocator::freeNode(ParseNode *pn) +ParseNodeAllocator::freeNode(ParseNode* pn) { /* Catch back-to-back dup recycles. */ JS_ASSERT(pn != freelist); @@ -84,25 +84,25 @@ class NodeStack { public: NodeStack() : top(nullptr) { } bool empty() { return top == nullptr; } - void push(ParseNode *pn) { + void push(ParseNode* pn) { pn->pn_next = top; top = pn; } - void pushUnlessNull(ParseNode *pn) { if (pn) push(pn); } + void pushUnlessNull(ParseNode* pn) { if (pn) push(pn); } /* Push the children of the PN_LIST node |pn| on the stack. */ - void pushList(ParseNode *pn) { + void pushList(ParseNode* pn) { /* This clobbers pn->pn_head if the list is empty; should be okay. */ *pn->pn_tail = top; top = pn->pn_head; } - ParseNode *pop() { + ParseNode* pop() { JS_ASSERT(!empty()); - ParseNode *hold = top; /* my kingdom for a prog1 */ + ParseNode* hold = top; /* my kingdom for a prog1 */ top = top->pn_next; return hold; } private: - ParseNode *top; + ParseNode* top; }; } /* anonymous namespace */ @@ -116,7 +116,7 @@ class NodeStack { * just need to take care of its children. */ static bool -PushNodeChildren(ParseNode *pn, NodeStack *stack) +PushNodeChildren(ParseNode* pn, NodeStack* stack) { switch (pn->getArity()) { case PN_CODE: @@ -193,7 +193,7 @@ PushNodeChildren(ParseNode *pn, NodeStack *stack) * metadata structures (the function box tree). */ void -ParseNodeAllocator::prepareNodeForMutation(ParseNode *pn) +ParseNodeAllocator::prepareNodeForMutation(ParseNode* pn) { if (!pn->isArity(PN_NULLARY)) { /* Put |pn|'s children (but not |pn| itself) on a work stack. */ @@ -215,13 +215,13 @@ ParseNodeAllocator::prepareNodeForMutation(ParseNode *pn) * Return the nodes in the subtree |pn| to the parser's free node list, for * reallocation. */ -ParseNode * -ParseNodeAllocator::freeTree(ParseNode *pn) +ParseNode* +ParseNodeAllocator::freeTree(ParseNode* pn) { if (!pn) return nullptr; - ParseNode *savedNext = pn->pn_next; + ParseNode* savedNext = pn->pn_next; NodeStack stack; for (;;) { @@ -239,15 +239,15 @@ ParseNodeAllocator::freeTree(ParseNode *pn) * Allocate a ParseNode from parser's node freelist or, failing that, from * cx's temporary arena. */ -void * +void* ParseNodeAllocator::allocNode() { - if (ParseNode *pn = freelist) { + if (ParseNode* pn = freelist) { freelist = pn->pn_next; return pn; } - void *p = alloc.alloc(sizeof (ParseNode)); + void* p = alloc.alloc(sizeof (ParseNode)); if (!p) js_ReportOutOfMemory(cx); return p; @@ -255,27 +255,27 @@ ParseNodeAllocator::allocNode() /* used only by static create methods of subclasses */ -ParseNode * -ParseNode::create(ParseNodeKind kind, ParseNodeArity arity, FullParseHandler *handler) +ParseNode* +ParseNode::create(ParseNodeKind kind, ParseNodeArity arity, FullParseHandler* handler) { - const Token &tok = handler->currentToken(); + const Token& tok = handler->currentToken(); return handler->new_(kind, JSOP_NOP, arity, tok.pos); } -ParseNode * -ParseNode::append(ParseNodeKind kind, JSOp op, ParseNode *left, ParseNode *right, - FullParseHandler *handler) +ParseNode* +ParseNode::append(ParseNodeKind kind, JSOp op, ParseNode* left, ParseNode* right, + FullParseHandler* handler) { if (!left || !right) return nullptr; JS_ASSERT(left->isKind(kind) && left->isOp(op) && (js_CodeSpec[op].format & JOF_LEFTASSOC)); - ListNode *list; + ListNode* list; if (left->pn_arity == PN_LIST) { list = &left->as(); } else { - ParseNode *pn1 = left->pn_left, *pn2 = left->pn_right; + ParseNode* pn1 = left->pn_left, *pn2 = left->pn_right; list = handler->new_(kind, op, pn1); if (!list) return nullptr; @@ -288,9 +288,9 @@ ParseNode::append(ParseNodeKind kind, JSOp op, ParseNode *left, ParseNode *right return list; } -ParseNode * -ParseNode::newBinaryOrAppend(ParseNodeKind kind, JSOp op, ParseNode *left, ParseNode *right, - FullParseHandler *handler, ParseContext *pc, +ParseNode* +ParseNode::newBinaryOrAppend(ParseNodeKind kind, JSOp op, ParseNode* left, ParseNode* right, + FullParseHandler* handler, ParseContext* pc, bool foldConstants) { if (!left || !right) @@ -313,7 +313,7 @@ ParseNode::newBinaryOrAppend(ParseNodeKind kind, JSOp op, ParseNode *left, Parse return handler->new_(kind, op, left, right); } -const char * +const char* Definition::kindString(Kind kind) { static const char * const table[] = { @@ -332,12 +332,12 @@ namespace frontend { * binding context as the original tree. */ template <> -ParseNode * -Parser::cloneParseTree(ParseNode *opn) +ParseNode* +Parser::cloneParseTree(ParseNode* opn) { JS_CHECK_RECURSION(context, return nullptr); - ParseNode *pn = handler.new_(opn->getKind(), opn->getOp(), opn->getArity(), + ParseNode* pn = handler.new_(opn->getKind(), opn->getOp(), opn->getArity(), opn->pn_pos); if (!pn) return nullptr; @@ -360,8 +360,8 @@ Parser::cloneParseTree(ParseNode *opn) case PN_LIST: pn->makeEmpty(); - for (ParseNode *opn2 = opn->pn_head; opn2; opn2 = opn2->pn_next) { - ParseNode *pn2; + for (ParseNode* opn2 = opn->pn_head; opn2; opn2 = opn2->pn_next) { + ParseNode* pn2; NULLCHECK(pn2 = cloneParseTree(opn2)); pn->append(pn2); } @@ -404,7 +404,7 @@ Parser::cloneParseTree(ParseNode *opn) * The old name is a use of its pn_lexdef. Make the clone also be a * use of that definition. */ - Definition *dn = pn->pn_lexdef; + Definition* dn = pn->pn_lexdef; pn->pn_link = dn->dn_uses; dn->dn_uses = pn; @@ -417,7 +417,7 @@ Parser::cloneParseTree(ParseNode *opn) */ if (opn->isDefn()) { opn->setDefn(false); - handler.linkUseToDef(opn, (Definition *) pn); + handler.linkUseToDef(opn, (Definition*) pn); } } break; @@ -442,10 +442,10 @@ Parser::cloneParseTree(ParseNode *opn) * the original tree. */ template <> -ParseNode * -Parser::cloneLeftHandSide(ParseNode *opn) +ParseNode* +Parser::cloneLeftHandSide(ParseNode* opn) { - ParseNode *pn = handler.new_(opn->getKind(), opn->getOp(), opn->getArity(), + ParseNode* pn = handler.new_(opn->getKind(), opn->getOp(), opn->getArity(), opn->pn_pos); if (!pn) return nullptr; @@ -456,16 +456,16 @@ Parser::cloneLeftHandSide(ParseNode *opn) if (opn->isArity(PN_LIST)) { JS_ASSERT(opn->isKind(PNK_ARRAY) || opn->isKind(PNK_OBJECT)); pn->makeEmpty(); - for (ParseNode *opn2 = opn->pn_head; opn2; opn2 = opn2->pn_next) { - ParseNode *pn2; + for (ParseNode* opn2 = opn->pn_head; opn2; opn2 = opn2->pn_next) { + ParseNode* pn2; if (opn->isKind(PNK_OBJECT)) { JS_ASSERT(opn2->isArity(PN_BINARY)); JS_ASSERT(opn2->isKind(PNK_COLON)); - ParseNode *tag = cloneParseTree(opn2->pn_left); + ParseNode* tag = cloneParseTree(opn2->pn_left); if (!tag) return nullptr; - ParseNode *target = cloneLeftHandSide(opn2->pn_right); + ParseNode* target = cloneLeftHandSide(opn2->pn_right); if (!target) return nullptr; @@ -492,7 +492,7 @@ Parser::cloneLeftHandSide(ParseNode *opn) pn->pn_u.name = opn->pn_u.name; pn->setOp(JSOP_SETNAME); if (opn->isUsed()) { - Definition *dn = pn->pn_lexdef; + Definition* dn = pn->pn_lexdef; pn->pn_link = dn->dn_uses; dn->dn_uses = pn; @@ -504,7 +504,7 @@ Parser::cloneLeftHandSide(ParseNode *opn) pn->pn_dflags &= ~PND_BOUND; pn->setDefn(false); - handler.linkUseToDef(pn, (Definition *) opn); + handler.linkUseToDef(pn, (Definition*) opn); } } return pn; @@ -522,7 +522,7 @@ static const char * const parseNodeNames[] = { }; void -frontend::DumpParseTree(ParseNode *pn, int indent) +frontend::DumpParseTree(ParseNode* pn, int indent) { if (pn == nullptr) fprintf(stderr, "#NULL"); @@ -550,32 +550,32 @@ ParseNode::dump(int indent) { switch (pn_arity) { case PN_NULLARY: - ((NullaryNode *) this)->dump(); + ((NullaryNode*) this)->dump(); break; case PN_UNARY: - ((UnaryNode *) this)->dump(indent); + ((UnaryNode*) this)->dump(indent); break; case PN_BINARY: - ((BinaryNode *) this)->dump(indent); + ((BinaryNode*) this)->dump(indent); break; case PN_BINARY_OBJ: - ((BinaryObjNode *) this)->dump(indent); + ((BinaryObjNode*) this)->dump(indent); break; case PN_TERNARY: - ((TernaryNode *) this)->dump(indent); + ((TernaryNode*) this)->dump(indent); break; case PN_CODE: - ((CodeNode *) this)->dump(indent); + ((CodeNode*) this)->dump(indent); break; case PN_LIST: - ((ListNode *) this)->dump(indent); + ((ListNode*) this)->dump(indent); break; case PN_NAME: - ((NameNode *) this)->dump(indent); + ((NameNode*) this)->dump(indent); break; default: fprintf(stderr, "#", - (void *) this, unsigned(getKind()), unsigned(pn_arity)); + (void*) this, unsigned(getKind()), unsigned(pn_arity)); break; } } @@ -590,7 +590,7 @@ NullaryNode::dump() case PNK_NUMBER: { ToCStringBuf cbuf; - const char *cstr = NumberToCString(nullptr, &cbuf, pn_dval); + const char* cstr = NumberToCString(nullptr, &cbuf, pn_dval); if (!IsFinite(pn_dval)) fputc('#', stderr); if (cstr) @@ -612,7 +612,7 @@ NullaryNode::dump() void UnaryNode::dump(int indent) { - const char *name = parseNodeNames[getKind()]; + const char* name = parseNodeNames[getKind()]; fprintf(stderr, "(%s ", name); indent += strlen(name) + 2; DumpParseTree(pn_kid, indent); @@ -622,7 +622,7 @@ UnaryNode::dump(int indent) void BinaryNode::dump(int indent) { - const char *name = parseNodeNames[getKind()]; + const char* name = parseNodeNames[getKind()]; fprintf(stderr, "(%s ", name); indent += strlen(name) + 2; DumpParseTree(pn_left, indent); @@ -634,7 +634,7 @@ BinaryNode::dump(int indent) void BinaryObjNode::dump(int indent) { - const char *name = parseNodeNames[getKind()]; + const char* name = parseNodeNames[getKind()]; fprintf(stderr, "(%s ", name); indent += strlen(name) + 2; DumpParseTree(pn_left, indent); @@ -646,7 +646,7 @@ BinaryObjNode::dump(int indent) void TernaryNode::dump(int indent) { - const char *name = parseNodeNames[getKind()]; + const char* name = parseNodeNames[getKind()]; fprintf(stderr, "(%s ", name); indent += strlen(name) + 2; DumpParseTree(pn_kid1, indent); @@ -660,7 +660,7 @@ TernaryNode::dump(int indent) void CodeNode::dump(int indent) { - const char *name = parseNodeNames[getKind()]; + const char* name = parseNodeNames[getKind()]; fprintf(stderr, "(%s ", name); indent += strlen(name) + 2; DumpParseTree(pn_body, indent); @@ -670,12 +670,12 @@ CodeNode::dump(int indent) void ListNode::dump(int indent) { - const char *name = parseNodeNames[getKind()]; + const char* name = parseNodeNames[getKind()]; fprintf(stderr, "(%s [", name); if (pn_head != nullptr) { indent += strlen(name) + 3; DumpParseTree(pn_head, indent); - ParseNode *pn = pn_head->pn_next; + ParseNode* pn = pn_head->pn_next; while (pn != nullptr) { IndentNewLine(indent); DumpParseTree(pn, indent); @@ -695,7 +695,7 @@ NameNode::dump(int indent) if (!pn_atom) { fprintf(stderr, "#"); } else { - const jschar *s = pn_atom->chars(); + const jschar* s = pn_atom->chars(); size_t len = pn_atom->length(); if (len == 0) fprintf(stderr, "#"); @@ -718,7 +718,7 @@ NameNode::dump(int indent) } JS_ASSERT(!isUsed()); - const char *name = parseNodeNames[getKind()]; + const char* name = parseNodeNames[getKind()]; if (isUsed()) fprintf(stderr, "(%s)", name); else { @@ -730,7 +730,7 @@ NameNode::dump(int indent) } #endif -ObjectBox::ObjectBox(JSObject *object, ObjectBox* traceLink) +ObjectBox::ObjectBox(JSObject* object, ObjectBox* traceLink) : object(object), traceLink(traceLink), emitLink(nullptr) @@ -738,7 +738,7 @@ ObjectBox::ObjectBox(JSObject *object, ObjectBox* traceLink) JS_ASSERT(!object->is()); } -ObjectBox::ObjectBox(JSFunction *function, ObjectBox* traceLink) +ObjectBox::ObjectBox(JSFunction* function, ObjectBox* traceLink) : object(function), traceLink(traceLink), emitLink(nullptr) @@ -747,17 +747,17 @@ ObjectBox::ObjectBox(JSFunction *function, ObjectBox* traceLink) JS_ASSERT(asFunctionBox()->function() == function); } -FunctionBox * +FunctionBox* ObjectBox::asFunctionBox() { JS_ASSERT(isFunctionBox()); - return static_cast(this); + return static_cast(this); } void -ObjectBox::trace(JSTracer *trc) +ObjectBox::trace(JSTracer* trc) { - ObjectBox *box = this; + ObjectBox* box = this; while (box) { MarkObjectRoot(trc, &box->object, "parser.object"); if (box->isFunctionBox()) diff --git a/js/src/frontend/ParseNode.h b/js/src/frontend/ParseNode.h index ae5f53f90c..cd65002808 100644 --- a/js/src/frontend/ParseNode.h +++ b/js/src/frontend/ParseNode.h @@ -48,7 +48,7 @@ class UpvarCookie uint32_t slot() const { JS_ASSERT(!isFree()); return slot_; } // This fails and issues an error message if newLevel or newSlot are too large. - bool set(TokenStream &ts, unsigned newLevel, uint32_t newSlot) { + bool set(TokenStream& ts, unsigned newLevel, uint32_t newSlot) { if (newLevel >= FREE_LEVEL) return ts.reportError(JSMSG_TOO_DEEP, js_function_str); @@ -444,8 +444,8 @@ class ParseNode pn_used : 1, /* name node is on a use-chain */ pn_defn : 1; /* this node is a Definition */ - ParseNode(const ParseNode &other) MOZ_DELETE; - void operator=(const ParseNode &other) MOZ_DELETE; + ParseNode(const ParseNode& other) MOZ_DELETE; + void operator=(const ParseNode& other) MOZ_DELETE; public: ParseNode(ParseNodeKind kind, JSOp op, ParseNodeArity arity) @@ -456,7 +456,7 @@ class ParseNode memset(&pn_u, 0, sizeof pn_u); } - ParseNode(ParseNodeKind kind, JSOp op, ParseNodeArity arity, const TokenPos &pos) + ParseNode(ParseNodeKind kind, JSOp op, ParseNodeArity arity, const TokenPos& pos) : pn_type(kind), pn_op(op), pn_arity(arity), pn_parens(0), pn_used(0), pn_defn(0), pn_pos(pos), pn_offset(0), pn_next(nullptr), pn_link(nullptr) { @@ -505,46 +505,46 @@ class ParseNode TokenPos pn_pos; /* two 16-bit pairs here, for 64 bits */ int32_t pn_offset; /* first generated bytecode offset */ - ParseNode *pn_next; /* intrinsic link in parent PN_LIST */ - ParseNode *pn_link; /* def/use link (alignment freebie) */ + ParseNode* pn_next; /* intrinsic link in parent PN_LIST */ + ParseNode* pn_link; /* def/use link (alignment freebie) */ union { struct { /* list of next-linked nodes */ - ParseNode *head; /* first node in list */ - ParseNode **tail; /* ptr to ptr to last node in list */ + ParseNode* head; /* first node in list */ + ParseNode** tail; /* ptr to ptr to last node in list */ uint32_t count; /* number of nodes in list */ uint32_t xflags:NumListFlagBits, /* see PNX_* below */ blockid:NumBlockIdBits; /* see name variant below */ } list; struct { /* ternary: if, for(;;), ?: */ - ParseNode *kid1; /* condition, discriminant, etc. */ - ParseNode *kid2; /* then-part, case list, etc. */ - ParseNode *kid3; /* else-part, default case, etc. */ + ParseNode* kid1; /* condition, discriminant, etc. */ + ParseNode* kid2; /* then-part, case list, etc. */ + ParseNode* kid3; /* else-part, default case, etc. */ } ternary; struct { /* two kids if binary */ - ParseNode *left; - ParseNode *right; + ParseNode* left; + ParseNode* right; union { unsigned iflags; /* JSITER_* flags for PNK_FOR node */ - ObjectBox *objbox; /* Only for PN_BINARY_OBJ */ + ObjectBox* objbox; /* Only for PN_BINARY_OBJ */ }; } binary; struct { /* one kid if unary */ - ParseNode *kid; + ParseNode* kid; bool prologue; /* directive prologue member (as pn_prologue) */ } unary; struct { /* name, labeled statement, etc. */ union { - JSAtom *atom; /* lexical name or label atom */ - ObjectBox *objbox; /* block or regexp object */ - FunctionBox *funbox; /* function object */ + JSAtom* atom; /* lexical name or label atom */ + ObjectBox* objbox; /* block or regexp object */ + FunctionBox* funbox; /* function object */ }; union { - ParseNode *expr; /* module or function body, var + ParseNode* expr; /* module or function body, var initializer, argument default, or base object of PNK_DOT */ - Definition *lexdef; /* lexical definition for this use */ + Definition* lexdef; /* lexical definition for this use */ }; UpvarCookie cookie; /* upvar cookie with absolute frame level (not relative skip), possibly @@ -559,7 +559,7 @@ class ParseNode } number; class { friend class LoopControlStatement; - PropertyName *label; /* target of break/continue statement */ + PropertyName* label; /* target of break/continue statement */ } loopControl; } pn_u; @@ -601,28 +601,28 @@ class ParseNode pn_next = pn_link = nullptr; } - static ParseNode *create(ParseNodeKind kind, ParseNodeArity arity, FullParseHandler *handler); + static ParseNode* create(ParseNodeKind kind, ParseNodeArity arity, FullParseHandler* handler); public: /* * Append right to left, forming a list node. |left| must have the given * kind and op, and op must be left-associative. */ - static ParseNode * - append(ParseNodeKind tt, JSOp op, ParseNode *left, ParseNode *right, FullParseHandler *handler); + static ParseNode* + append(ParseNodeKind tt, JSOp op, ParseNode* left, ParseNode* right, FullParseHandler* handler); /* * Either append right to left, if left meets the conditions necessary to * append (see append), or form a binary node whose children are right and * left. */ - static ParseNode * - newBinaryOrAppend(ParseNodeKind kind, JSOp op, ParseNode *left, ParseNode *right, - FullParseHandler *handler, ParseContext *pc, + static ParseNode* + newBinaryOrAppend(ParseNodeKind kind, JSOp op, ParseNode* left, ParseNode* right, + FullParseHandler* handler, ParseContext* pc, bool foldConstants); - inline PropertyName *name() const; - inline JSAtom *atom() const; + inline PropertyName* name() const; + inline JSAtom* atom() const; /* * The pn_expr and lexdef members are arms of an unsafe union. Unless you @@ -630,22 +630,22 @@ class ParseNode * them. For less overhead and assertions for protection, use pn->expr() * and pn->lexdef(). Otherwise, use pn->maybeExpr() and pn->maybeLexDef(). */ - ParseNode *expr() const { + ParseNode* expr() const { JS_ASSERT(!pn_used); JS_ASSERT(pn_arity == PN_NAME || pn_arity == PN_CODE); return pn_expr; } - Definition *lexdef() const { + Definition* lexdef() const { JS_ASSERT(pn_used || isDeoptimized()); JS_ASSERT(pn_arity == PN_NAME); return pn_lexdef; } - ParseNode *maybeExpr() { return pn_used ? nullptr : expr(); } - Definition *maybeLexDef() { return pn_used ? lexdef() : nullptr; } + ParseNode* maybeExpr() { return pn_used ? nullptr : expr(); } + Definition* maybeLexDef() { return pn_used ? lexdef() : nullptr; } - Definition *resolve(); + Definition* resolve(); /* PN_CODE and PN_NAME pn_dflags bits. */ #define PND_LET 0x01 /* let (block-scoped) binding */ @@ -722,10 +722,10 @@ class ParseNode * or escaped newlines, say). This member function returns true for such * nodes; we use it to determine the extent of the prologue. */ - JSAtom *isStringExprStatement() const { + JSAtom* isStringExprStatement() const { if (getKind() == PNK_SEMI) { JS_ASSERT(pn_arity == PN_UNARY); - ParseNode *kid = pn_kid; + ParseNode* kid = pn_kid; if (kid && kid->getKind() == PNK_STRING && !kid->pn_parens) return kid->pn_atom; } @@ -756,10 +756,10 @@ class ParseNode bool isDirectivePrologueMember() const { return pn_prologue; } #ifdef JS_HAS_GENERATOR_EXPRS - ParseNode *generatorExpr() const { + ParseNode* generatorExpr() const { JS_ASSERT(isKind(PNK_GENEXP)); - ParseNode *callee = this->pn_head; - ParseNode *body = callee->pn_body; + ParseNode* callee = this->pn_head; + ParseNode* body = callee->pn_body; JS_ASSERT(body->isKind(PNK_LEXICALSCOPE)); return body->pn_expr; } @@ -771,10 +771,10 @@ class ParseNode * Compute a pointer to the last element in a singly-linked list. NB: list * must be non-empty for correct PN_LAST usage -- this is asserted! */ - ParseNode *last() const { + ParseNode* last() const { JS_ASSERT(pn_arity == PN_LIST); JS_ASSERT(pn_count != 0); - return (ParseNode *)(uintptr_t(pn_tail) - offsetof(ParseNode, pn_next)); + return (ParseNode*)(uintptr_t(pn_tail) - offsetof(ParseNode, pn_next)); } void initNumber(double value, DecimalPoint decimalPoint) { @@ -793,7 +793,7 @@ class ParseNode pn_blockid = 0; } - void initList(ParseNode *pn) { + void initList(ParseNode* pn) { JS_ASSERT(pn_arity == PN_LIST); if (pn->pn_pos.begin < pn_pos.begin) pn_pos.begin = pn->pn_pos.begin; @@ -805,7 +805,7 @@ class ParseNode pn_blockid = 0; } - void append(ParseNode *pn) { + void append(ParseNode* pn) { JS_ASSERT(pn_arity == PN_LIST); JS_ASSERT(pn->pn_pos.begin >= pn_pos.begin); pn_pos.end = pn->pn_pos.end; @@ -820,7 +820,7 @@ class ParseNode #endif ; - bool getConstantValue(ExclusiveContext *cx, bool strictChecks, MutableHandleValue vp); + bool getConstantValue(ExclusiveContext* cx, bool strictChecks, MutableHandleValue vp); inline bool isConstant(); template @@ -830,15 +830,15 @@ class ParseNode /* Casting operations. */ template - inline NodeType &as() { + inline NodeType& as() { JS_ASSERT(NodeType::test(*this)); - return *static_cast(this); + return *static_cast(this); } template - inline const NodeType &as() const { + inline const NodeType& as() const { JS_ASSERT(NodeType::test(*this)); - return *static_cast(this); + return *static_cast(this); } #ifdef DEBUG @@ -849,21 +849,21 @@ class ParseNode struct NullaryNode : public ParseNode { - NullaryNode(ParseNodeKind kind, const TokenPos &pos) + NullaryNode(ParseNodeKind kind, const TokenPos& pos) : ParseNode(kind, JSOP_NOP, PN_NULLARY, pos) {} - NullaryNode(ParseNodeKind kind, JSOp op, const TokenPos &pos) + NullaryNode(ParseNodeKind kind, JSOp op, const TokenPos& pos) : ParseNode(kind, op, PN_NULLARY, pos) {} // This constructor is for a few mad uses in the emitter. It populates // the pn_atom field even though that field belongs to a branch in pn_u // that nullary nodes shouldn't use -- bogus. - NullaryNode(ParseNodeKind kind, JSOp op, const TokenPos &pos, JSAtom *atom) + NullaryNode(ParseNodeKind kind, JSOp op, const TokenPos& pos, JSAtom* atom) : ParseNode(kind, op, PN_NULLARY, pos) { pn_atom = atom; } - static bool test(const ParseNode &node) { + static bool test(const ParseNode& node) { return node.isArity(PN_NULLARY); } @@ -874,17 +874,17 @@ struct NullaryNode : public ParseNode struct UnaryNode : public ParseNode { - UnaryNode(ParseNodeKind kind, JSOp op, const TokenPos &pos, ParseNode *kid) + UnaryNode(ParseNodeKind kind, JSOp op, const TokenPos& pos, ParseNode* kid) : ParseNode(kind, op, PN_UNARY, pos) { pn_kid = kid; } - static inline UnaryNode *create(ParseNodeKind kind, FullParseHandler *handler) { - return (UnaryNode *) ParseNode::create(kind, PN_UNARY, handler); + static inline UnaryNode* create(ParseNodeKind kind, FullParseHandler* handler) { + return (UnaryNode*) ParseNode::create(kind, PN_UNARY, handler); } - static bool test(const ParseNode &node) { + static bool test(const ParseNode& node) { return node.isArity(PN_UNARY); } @@ -895,25 +895,25 @@ struct UnaryNode : public ParseNode struct BinaryNode : public ParseNode { - BinaryNode(ParseNodeKind kind, JSOp op, const TokenPos &pos, ParseNode *left, ParseNode *right) + BinaryNode(ParseNodeKind kind, JSOp op, const TokenPos& pos, ParseNode* left, ParseNode* right) : ParseNode(kind, op, PN_BINARY, pos) { pn_left = left; pn_right = right; } - BinaryNode(ParseNodeKind kind, JSOp op, ParseNode *left, ParseNode *right) + BinaryNode(ParseNodeKind kind, JSOp op, ParseNode* left, ParseNode* right) : ParseNode(kind, op, PN_BINARY, TokenPos::box(left->pn_pos, right->pn_pos)) { pn_left = left; pn_right = right; } - static inline BinaryNode *create(ParseNodeKind kind, FullParseHandler *handler) { - return (BinaryNode *) ParseNode::create(kind, PN_BINARY, handler); + static inline BinaryNode* create(ParseNodeKind kind, FullParseHandler* handler) { + return (BinaryNode*) ParseNode::create(kind, PN_BINARY, handler); } - static bool test(const ParseNode &node) { + static bool test(const ParseNode& node) { return node.isArity(PN_BINARY); } @@ -924,8 +924,8 @@ struct BinaryNode : public ParseNode struct BinaryObjNode : public ParseNode { - BinaryObjNode(ParseNodeKind kind, JSOp op, const TokenPos &pos, ParseNode *left, ParseNode *right, - ObjectBox *objbox) + BinaryObjNode(ParseNodeKind kind, JSOp op, const TokenPos& pos, ParseNode* left, ParseNode* right, + ObjectBox* objbox) : ParseNode(kind, op, PN_BINARY_OBJ, pos) { pn_left = left; @@ -933,11 +933,11 @@ struct BinaryObjNode : public ParseNode pn_binary_obj = objbox; } - static inline BinaryObjNode *create(ParseNodeKind kind, FullParseHandler *handler) { - return (BinaryObjNode *) ParseNode::create(kind, PN_BINARY_OBJ, handler); + static inline BinaryObjNode* create(ParseNodeKind kind, FullParseHandler* handler) { + return (BinaryObjNode*) ParseNode::create(kind, PN_BINARY_OBJ, handler); } - static bool test(const ParseNode &node) { + static bool test(const ParseNode& node) { return node.isArity(PN_BINARY_OBJ); } @@ -948,7 +948,7 @@ struct BinaryObjNode : public ParseNode struct TernaryNode : public ParseNode { - TernaryNode(ParseNodeKind kind, JSOp op, ParseNode *kid1, ParseNode *kid2, ParseNode *kid3) + TernaryNode(ParseNodeKind kind, JSOp op, ParseNode* kid1, ParseNode* kid2, ParseNode* kid3) : ParseNode(kind, op, PN_TERNARY, TokenPos((kid1 ? kid1 : kid2 ? kid2 : kid3)->pn_pos.begin, (kid3 ? kid3 : kid2 ? kid2 : kid1)->pn_pos.end)) @@ -958,8 +958,8 @@ struct TernaryNode : public ParseNode pn_kid3 = kid3; } - TernaryNode(ParseNodeKind kind, JSOp op, ParseNode *kid1, ParseNode *kid2, ParseNode *kid3, - const TokenPos &pos) + TernaryNode(ParseNodeKind kind, JSOp op, ParseNode* kid1, ParseNode* kid2, ParseNode* kid3, + const TokenPos& pos) : ParseNode(kind, op, PN_TERNARY, pos) { pn_kid1 = kid1; @@ -967,11 +967,11 @@ struct TernaryNode : public ParseNode pn_kid3 = kid3; } - static inline TernaryNode *create(ParseNodeKind kind, FullParseHandler *handler) { - return (TernaryNode *) ParseNode::create(kind, PN_TERNARY, handler); + static inline TernaryNode* create(ParseNodeKind kind, FullParseHandler* handler) { + return (TernaryNode*) ParseNode::create(kind, PN_TERNARY, handler); } - static bool test(const ParseNode &node) { + static bool test(const ParseNode& node) { return node.isArity(PN_TERNARY); } @@ -982,23 +982,23 @@ struct TernaryNode : public ParseNode struct ListNode : public ParseNode { - ListNode(ParseNodeKind kind, const TokenPos &pos) + ListNode(ParseNodeKind kind, const TokenPos& pos) : ParseNode(kind, JSOP_NOP, PN_LIST, pos) { makeEmpty(); } - ListNode(ParseNodeKind kind, JSOp op, ParseNode *kid) + ListNode(ParseNodeKind kind, JSOp op, ParseNode* kid) : ParseNode(kind, op, PN_LIST, kid->pn_pos) { initList(kid); } - static inline ListNode *create(ParseNodeKind kind, FullParseHandler *handler) { - return (ListNode *) ParseNode::create(kind, PN_LIST, handler); + static inline ListNode* create(ParseNodeKind kind, FullParseHandler* handler) { + return (ListNode*) ParseNode::create(kind, PN_LIST, handler); } - static bool test(const ParseNode &node) { + static bool test(const ParseNode& node) { return node.isArity(PN_LIST); } @@ -1009,11 +1009,11 @@ struct ListNode : public ParseNode struct CodeNode : public ParseNode { - static inline CodeNode *create(ParseNodeKind kind, FullParseHandler *handler) { - return (CodeNode *) ParseNode::create(kind, PN_CODE, handler); + static inline CodeNode* create(ParseNodeKind kind, FullParseHandler* handler) { + return (CodeNode*) ParseNode::create(kind, PN_CODE, handler); } - static bool test(const ParseNode &node) { + static bool test(const ParseNode& node) { return node.isArity(PN_CODE); } @@ -1024,8 +1024,8 @@ struct CodeNode : public ParseNode struct NameNode : public ParseNode { - NameNode(ParseNodeKind kind, JSOp op, JSAtom *atom, uint32_t blockid, - const TokenPos &pos) + NameNode(ParseNodeKind kind, JSOp op, JSAtom* atom, uint32_t blockid, + const TokenPos& pos) : ParseNode(kind, op, PN_NAME, pos) { pn_atom = atom; @@ -1036,7 +1036,7 @@ struct NameNode : public ParseNode JS_ASSERT(pn_blockid == blockid); // check for bitfield overflow } - static bool test(const ParseNode &node) { + static bool test(const ParseNode& node) { return node.isArity(PN_NAME); } @@ -1047,30 +1047,30 @@ struct NameNode : public ParseNode struct LexicalScopeNode : public ParseNode { - static inline LexicalScopeNode *create(ParseNodeKind kind, FullParseHandler *handler) { - return (LexicalScopeNode *) ParseNode::create(kind, PN_NAME, handler); + static inline LexicalScopeNode* create(ParseNodeKind kind, FullParseHandler* handler) { + return (LexicalScopeNode*) ParseNode::create(kind, PN_NAME, handler); } }; class LabeledStatement : public ParseNode { public: - LabeledStatement(PropertyName *label, ParseNode *stmt, uint32_t begin) + LabeledStatement(PropertyName* label, ParseNode* stmt, uint32_t begin) : ParseNode(PNK_LABEL, JSOP_NOP, PN_NAME, TokenPos(begin, stmt->pn_pos.end)) { pn_atom = label; pn_expr = stmt; } - PropertyName *label() const { + PropertyName* label() const { return pn_atom->asPropertyName(); } - ParseNode *statement() const { + ParseNode* statement() const { return pn_expr; } - static bool test(const ParseNode &node) { + static bool test(const ParseNode& node) { bool match = node.isKind(PNK_LABEL); JS_ASSERT_IF(match, node.isArity(PN_NAME)); JS_ASSERT_IF(match, node.isOp(JSOP_NOP)); @@ -1081,7 +1081,7 @@ class LabeledStatement : public ParseNode class LoopControlStatement : public ParseNode { protected: - LoopControlStatement(ParseNodeKind kind, PropertyName *label, const TokenPos &pos) + LoopControlStatement(ParseNodeKind kind, PropertyName* label, const TokenPos& pos) : ParseNode(kind, JSOP_NOP, PN_NULLARY, pos) { JS_ASSERT(kind == PNK_BREAK || kind == PNK_CONTINUE); @@ -1090,11 +1090,11 @@ class LoopControlStatement : public ParseNode public: /* Label associated with this break/continue statement, if any. */ - PropertyName *label() const { + PropertyName* label() const { return pn_u.loopControl.label; } - static bool test(const ParseNode &node) { + static bool test(const ParseNode& node) { bool match = node.isKind(PNK_BREAK) || node.isKind(PNK_CONTINUE); JS_ASSERT_IF(match, node.isArity(PN_NULLARY)); JS_ASSERT_IF(match, node.isOp(JSOP_NOP)); @@ -1105,11 +1105,11 @@ class LoopControlStatement : public ParseNode class BreakStatement : public LoopControlStatement { public: - BreakStatement(PropertyName *label, const TokenPos &pos) + BreakStatement(PropertyName* label, const TokenPos& pos) : LoopControlStatement(PNK_BREAK, label, pos) { } - static bool test(const ParseNode &node) { + static bool test(const ParseNode& node) { bool match = node.isKind(PNK_BREAK); JS_ASSERT_IF(match, node.isArity(PN_NULLARY)); JS_ASSERT_IF(match, node.isOp(JSOP_NOP)); @@ -1120,11 +1120,11 @@ class BreakStatement : public LoopControlStatement class ContinueStatement : public LoopControlStatement { public: - ContinueStatement(PropertyName *label, const TokenPos &pos) + ContinueStatement(PropertyName* label, const TokenPos& pos) : LoopControlStatement(PNK_CONTINUE, label, pos) { } - static bool test(const ParseNode &node) { + static bool test(const ParseNode& node) { bool match = node.isKind(PNK_CONTINUE); JS_ASSERT_IF(match, node.isArity(PN_NULLARY)); JS_ASSERT_IF(match, node.isOp(JSOP_NOP)); @@ -1135,7 +1135,7 @@ class ContinueStatement : public LoopControlStatement class DebuggerStatement : public ParseNode { public: - DebuggerStatement(const TokenPos &pos) + DebuggerStatement(const TokenPos& pos) : ParseNode(PNK_DEBUGGER, JSOP_NOP, PN_NULLARY, pos) { } }; @@ -1143,7 +1143,7 @@ class DebuggerStatement : public ParseNode class ConditionalExpression : public ParseNode { public: - ConditionalExpression(ParseNode *condition, ParseNode *thenExpr, ParseNode *elseExpr) + ConditionalExpression(ParseNode* condition, ParseNode* thenExpr, ParseNode* elseExpr) : ParseNode(PNK_CONDITIONAL, JSOP_NOP, PN_TERNARY, TokenPos(condition->pn_pos.begin, elseExpr->pn_pos.end)) { @@ -1155,19 +1155,19 @@ class ConditionalExpression : public ParseNode pn_u.ternary.kid3 = elseExpr; } - ParseNode &condition() const { + ParseNode& condition() const { return *pn_u.ternary.kid1; } - ParseNode &thenExpression() const { + ParseNode& thenExpression() const { return *pn_u.ternary.kid2; } - ParseNode &elseExpression() const { + ParseNode& elseExpression() const { return *pn_u.ternary.kid3; } - static bool test(const ParseNode &node) { + static bool test(const ParseNode& node) { bool match = node.isKind(PNK_CONDITIONAL); JS_ASSERT_IF(match, node.isArity(PN_TERNARY)); JS_ASSERT_IF(match, node.isOp(JSOP_NOP)); @@ -1178,19 +1178,19 @@ class ConditionalExpression : public ParseNode class ThisLiteral : public ParseNode { public: - ThisLiteral(const TokenPos &pos) : ParseNode(PNK_THIS, JSOP_THIS, PN_NULLARY, pos) { } + ThisLiteral(const TokenPos& pos) : ParseNode(PNK_THIS, JSOP_THIS, PN_NULLARY, pos) { } }; class NullLiteral : public ParseNode { public: - NullLiteral(const TokenPos &pos) : ParseNode(PNK_NULL, JSOP_NULL, PN_NULLARY, pos) { } + NullLiteral(const TokenPos& pos) : ParseNode(PNK_NULL, JSOP_NULL, PN_NULLARY, pos) { } }; class BooleanLiteral : public ParseNode { public: - BooleanLiteral(bool b, const TokenPos &pos) + BooleanLiteral(bool b, const TokenPos& pos) : ParseNode(b ? PNK_TRUE : PNK_FALSE, b ? JSOP_TRUE : JSOP_FALSE, PN_NULLARY, pos) { } }; @@ -1198,15 +1198,15 @@ class BooleanLiteral : public ParseNode class RegExpLiteral : public NullaryNode { public: - RegExpLiteral(ObjectBox *reobj, const TokenPos &pos) + RegExpLiteral(ObjectBox* reobj, const TokenPos& pos) : NullaryNode(PNK_REGEXP, JSOP_REGEXP, pos) { pn_objbox = reobj; } - ObjectBox *objbox() const { return pn_objbox; } + ObjectBox* objbox() const { return pn_objbox; } - static bool test(const ParseNode &node) { + static bool test(const ParseNode& node) { bool match = node.isKind(PNK_REGEXP); JS_ASSERT_IF(match, node.isArity(PN_NULLARY)); JS_ASSERT_IF(match, node.isOp(JSOP_REGEXP)); @@ -1217,7 +1217,7 @@ class RegExpLiteral : public NullaryNode class PropertyAccess : public ParseNode { public: - PropertyAccess(ParseNode *lhs, PropertyName *name, uint32_t begin, uint32_t end) + PropertyAccess(ParseNode* lhs, PropertyName* name, uint32_t begin, uint32_t end) : ParseNode(PNK_DOT, JSOP_NOP, PN_NAME, TokenPos(begin, end)) { JS_ASSERT(lhs != nullptr); @@ -1226,17 +1226,17 @@ class PropertyAccess : public ParseNode pn_u.name.atom = name; } - static bool test(const ParseNode &node) { + static bool test(const ParseNode& node) { bool match = node.isKind(PNK_DOT); JS_ASSERT_IF(match, node.isArity(PN_NAME)); return match; } - ParseNode &expression() const { + ParseNode& expression() const { return *pn_u.name.expr; } - PropertyName &name() const { + PropertyName& name() const { return *pn_u.name.atom->asPropertyName(); } }; @@ -1244,7 +1244,7 @@ class PropertyAccess : public ParseNode class PropertyByValue : public ParseNode { public: - PropertyByValue(ParseNode *lhs, ParseNode *propExpr, uint32_t begin, uint32_t end) + PropertyByValue(ParseNode* lhs, ParseNode* propExpr, uint32_t begin, uint32_t end) : ParseNode(PNK_ELEM, JSOP_NOP, PN_BINARY, TokenPos(begin, end)) { pn_u.binary.left = lhs; @@ -1253,7 +1253,7 @@ class PropertyByValue : public ParseNode }; #ifdef DEBUG -void DumpParseTree(ParseNode *pn, int indent = 0); +void DumpParseTree(ParseNode* pn, int indent = 0); #endif /* @@ -1367,7 +1367,7 @@ struct Definition : public ParseNode bool canHaveInitializer() { return int(kind()) <= int(ARG); } - static const char *kindString(Kind kind); + static const char* kindString(Kind kind); Kind kind() { if (getKind() == PNK_FUNCTION) { @@ -1393,19 +1393,19 @@ struct Definition : public ParseNode class ParseNodeAllocator { public: - explicit ParseNodeAllocator(ExclusiveContext *cx, LifoAlloc &alloc) + explicit ParseNodeAllocator(ExclusiveContext* cx, LifoAlloc& alloc) : cx(cx), alloc(alloc), freelist(nullptr) {} - void *allocNode(); - void freeNode(ParseNode *pn); - ParseNode *freeTree(ParseNode *pn); - void prepareNodeForMutation(ParseNode *pn); + void* allocNode(); + void freeNode(ParseNode* pn); + ParseNode* freeTree(ParseNode* pn); + void prepareNodeForMutation(ParseNode* pn); private: - ExclusiveContext *cx; - LifoAlloc &alloc; - ParseNode *freelist; + ExclusiveContext* cx; + LifoAlloc& alloc; + ParseNode* freelist; }; inline bool @@ -1414,7 +1414,7 @@ ParseNode::test(unsigned flag) const JS_ASSERT(pn_defn || pn_arity == PN_CODE || pn_arity == PN_NAME); #ifdef DEBUG if ((flag & PND_ASSIGNED) && pn_defn && !(pn_dflags & flag)) { - for (ParseNode *pn = ((Definition *) this)->dn_uses; pn; pn = pn->pn_link) { + for (ParseNode* pn = ((Definition*) this)->dn_uses; pn; pn = pn->pn_link) { JS_ASSERT(!pn->pn_defn); JS_ASSERT(!(pn->pn_dflags & flag)); } @@ -1432,13 +1432,13 @@ ParseNode::markAsAssigned() pn_dflags |= PND_ASSIGNED; } -inline Definition * +inline Definition* ParseNode::resolve() { if (isDefn()) - return (Definition *)this; + return (Definition*)this; JS_ASSERT(lexdef()->isDefn()); - return (Definition *)lexdef(); + return (Definition*)lexdef(); } inline bool @@ -1463,20 +1463,20 @@ ParseNode::isConstant() class ObjectBox { public: - JSObject *object; + JSObject* object; - ObjectBox(JSObject *object, ObjectBox *traceLink); + ObjectBox(JSObject* object, ObjectBox* traceLink); bool isFunctionBox() { return object->is(); } - FunctionBox *asFunctionBox(); - void trace(JSTracer *trc); + FunctionBox* asFunctionBox(); + void trace(JSTracer* trc); protected: friend struct CGObjectList; - ObjectBox *traceLink; - ObjectBox *emitLink; + ObjectBox* traceLink; + ObjectBox* emitLink; - ObjectBox(JSFunction *function, ObjectBox *traceLink); + ObjectBox(JSFunction* function, ObjectBox* traceLink); }; enum ParseReportKind @@ -1489,11 +1489,11 @@ enum ParseReportKind enum FunctionSyntaxKind { Expression, Statement, Arrow }; -static inline ParseNode * -FunctionArgsList(ParseNode *fn, unsigned *numFormals) +static inline ParseNode* +FunctionArgsList(ParseNode* fn, unsigned* numFormals) { JS_ASSERT(fn->isKind(PNK_FUNCTION)); - ParseNode *argsBody = fn->pn_body; + ParseNode* argsBody = fn->pn_body; JS_ASSERT(argsBody->isKind(PNK_ARGSBODY)); *numFormals = argsBody->pn_count; if (*numFormals > 0 && argsBody->last()->isKind(PNK_STATEMENTLIST)) diff --git a/js/src/frontend/Parser-inl.h b/js/src/frontend/Parser-inl.h index 840bb46f3e..8aa2e6d5f7 100644 --- a/js/src/frontend/Parser-inl.h +++ b/js/src/frontend/Parser-inl.h @@ -16,7 +16,7 @@ namespace frontend { template bool -ParseContext::init(TokenStream &ts) +ParseContext::init(TokenStream& ts) { if (!frontend::GenerateBlockId(ts, this, this->bodyid)) return false; diff --git a/js/src/frontend/Parser.cpp b/js/src/frontend/Parser.cpp index 538ebb3049..d22c11cf2f 100644 --- a/js/src/frontend/Parser.cpp +++ b/js/src/frontend/Parser.cpp @@ -69,7 +69,7 @@ static const unsigned BlockIdLimit = 1 << ParseNode::NumBlockIdBits; template bool -GenerateBlockId(TokenStream &ts, ParseContext *pc, uint32_t &blockid) +GenerateBlockId(TokenStream& ts, ParseContext* pc, uint32_t& blockid) { if (pc->blockidGen == BlockIdLimit) { ts.reportError(JSMSG_NEED_DIET, "program"); @@ -81,14 +81,14 @@ GenerateBlockId(TokenStream &ts, ParseContext *pc, uint32_t &block } template bool -GenerateBlockId(TokenStream &ts, ParseContext *pc, uint32_t &blockid); +GenerateBlockId(TokenStream& ts, ParseContext* pc, uint32_t& blockid); template bool -GenerateBlockId(TokenStream &ts, ParseContext *pc, uint32_t &blockid); +GenerateBlockId(TokenStream& ts, ParseContext* pc, uint32_t& blockid); template static void -PushStatementPC(ParseContext *pc, StmtInfoPC *stmt, StmtType type) +PushStatementPC(ParseContext* pc, StmtInfoPC* stmt, StmtType type) { stmt->blockid = pc->blockid(); PushStatement(pc, stmt, type); @@ -97,13 +97,13 @@ PushStatementPC(ParseContext *pc, StmtInfoPC *stmt, StmtType type) // See comment on member function declaration. template <> bool -ParseContext::define(TokenStream &ts, - HandlePropertyName name, ParseNode *pn, Definition::Kind kind) +ParseContext::define(TokenStream& ts, + HandlePropertyName name, ParseNode* pn, Definition::Kind kind) { JS_ASSERT(!pn->isUsed()); JS_ASSERT_IF(pn->isDefn(), pn->isPlaceholder()); - Definition *prevDef = nullptr; + Definition* prevDef = nullptr; if (kind == Definition::LET) prevDef = decls_.lookupFirst(name); else @@ -113,14 +113,14 @@ ParseContext::define(TokenStream &ts, prevDef = lexdeps.lookupDefn(name); if (prevDef) { - ParseNode **pnup = &prevDef->dn_uses; - ParseNode *pnu; + ParseNode** pnup = &prevDef->dn_uses; + ParseNode* pnu; unsigned start = (kind == Definition::LET) ? pn->pn_blockid : bodyid; while ((pnu = *pnup) != nullptr && pnu->pn_blockid >= start) { JS_ASSERT(pnu->pn_blockid >= bodyid); JS_ASSERT(pnu->isUsed()); - pnu->pn_lexdef = (Definition *) pn; + pnu->pn_lexdef = (Definition*) pn; pn->pn_dflags |= pnu->pn_dflags & PND_USE2DEF_FLAGS; pnup = &pnu->pn_link; } @@ -143,7 +143,7 @@ ParseContext::define(TokenStream &ts, if (kind == Definition::CONST) pn->pn_dflags |= PND_CONST; - Definition *dn = (Definition *)pn; + Definition* dn = (Definition*)pn; switch (kind) { case Definition::ARG: JS_ASSERT(sc->isFunctionBox()); @@ -198,7 +198,7 @@ ParseContext::define(TokenStream &ts, template <> bool -ParseContext::define(TokenStream &ts, HandlePropertyName name, Node pn, +ParseContext::define(TokenStream& ts, HandlePropertyName name, Node pn, Definition::Kind kind) { JS_ASSERT(!decls_.lookupFirst(name)); @@ -208,7 +208,7 @@ ParseContext::define(TokenStream &ts, HandlePropertyName nam // Keep track of the number of arguments in args_, for fun->nargs. if (kind == Definition::ARG) { - if (!args_.append((Definition *) nullptr)) + if (!args_.append((Definition*) nullptr)) return false; if (args_.length() >= ARGNO_LIMIT) { ts.reportError(JSMSG_TOO_MANY_FUN_ARGS); @@ -229,12 +229,12 @@ ParseContext::prepareToAddDuplicateArg(HandlePropertyName name, De template void -ParseContext::updateDecl(JSAtom *atom, Node pn) +ParseContext::updateDecl(JSAtom* atom, Node pn) { - Definition *oldDecl = decls_.lookupFirst(atom); + Definition* oldDecl = decls_.lookupFirst(atom); pn->setDefn(true); - Definition *newDecl = (Definition *)pn; + Definition* newDecl = (Definition*)pn; decls_.updateFirst(atom, newDecl); if (!sc->isFunctionBox()) { @@ -260,7 +260,7 @@ ParseContext::updateDecl(JSAtom *atom, Node pn) template void -ParseContext::popLetDecl(JSAtom *atom) +ParseContext::popLetDecl(JSAtom* atom) { JS_ASSERT(ParseHandler::getDefinitionKind(decls_.lookupFirst(atom)) == Definition::LET); decls_.remove(atom); @@ -268,11 +268,11 @@ ParseContext::popLetDecl(JSAtom *atom) template static void -AppendPackedBindings(const ParseContext *pc, const DeclVector &vec, Binding *dst) +AppendPackedBindings(const ParseContext* pc, const DeclVector& vec, Binding* dst) { for (size_t i = 0; i < vec.length(); ++i, ++dst) { - Definition *dn = vec[i]; - PropertyName *name = dn->name(); + Definition* dn = vec[i]; + PropertyName* name = dn->name(); Binding::Kind kind; switch (dn->kind()) { @@ -305,8 +305,8 @@ AppendPackedBindings(const ParseContext *pc, const DeclVector &vec template bool -ParseContext::generateFunctionBindings(ExclusiveContext *cx, TokenStream &ts, - LifoAlloc &alloc, +ParseContext::generateFunctionBindings(ExclusiveContext* cx, TokenStream& ts, + LifoAlloc& alloc, InternalHandle bindings) const { JS_ASSERT(sc->isFunctionBox()); @@ -321,7 +321,7 @@ ParseContext::generateFunctionBindings(ExclusiveContext *cx, Token return ts.reportError(JSMSG_TOO_MANY_LOCALS); uint32_t count = args_.length() + vars_.length(); - Binding *packedBindings = alloc.newArrayUninitialized(count); + Binding* packedBindings = alloc.newArrayUninitialized(count); if (!packedBindings) { js_ReportOutOfMemory(cx); return false; @@ -411,11 +411,11 @@ Parser::abortIfSyntaxParser() } template -Parser::Parser(ExclusiveContext *cx, LifoAlloc *alloc, - const ReadOnlyCompileOptions &options, - const jschar *chars, size_t length, bool foldConstants, - Parser *syntaxParser, - LazyScript *lazyOuterFunction) +Parser::Parser(ExclusiveContext* cx, LifoAlloc* alloc, + const ReadOnlyCompileOptions& options, + const jschar* chars, size_t length, bool foldConstants, + Parser* syntaxParser, + LazyScript* lazyOuterFunction) : AutoGCRooter(cx, PARSER), context(cx), alloc(*alloc), @@ -463,8 +463,8 @@ Parser::~Parser() } template -ObjectBox * -Parser::newObjectBox(JSObject *obj) +ObjectBox* +Parser::newObjectBox(JSObject* obj) { JS_ASSERT(obj && !IsPoisonedPtr(obj)); @@ -476,7 +476,7 @@ Parser::newObjectBox(JSObject *obj) * function. */ - ObjectBox *objbox = alloc.new_(obj, traceListHead); + ObjectBox* objbox = alloc.new_(obj, traceListHead); if (!objbox) { js_ReportOutOfMemory(context); return nullptr; @@ -488,8 +488,8 @@ Parser::newObjectBox(JSObject *obj) } template -FunctionBox::FunctionBox(ExclusiveContext *cx, ObjectBox* traceListHead, JSFunction *fun, - ParseContext *outerpc, Directives directives, +FunctionBox::FunctionBox(ExclusiveContext* cx, ObjectBox* traceListHead, JSFunction* fun, + ParseContext* outerpc, Directives directives, bool extraWarnings, GeneratorKind generatorKind) : ObjectBox(fun, traceListHead), SharedContext(cx, directives, extraWarnings), @@ -535,7 +535,7 @@ FunctionBox::FunctionBox(ExclusiveContext *cx, ObjectBox* traceListHead, JSFunct // ParseContext chain, and |parent| is nullptr (again because of the // eval(), so we have to look at |outerpc|'s scopeChain. // - JSObject *scope = outerpc->sc->asGlobalSharedContext()->scopeChain(); + JSObject* scope = outerpc->sc->asGlobalSharedContext()->scopeChain(); while (scope) { if (scope->is()) inWith = true; @@ -549,15 +549,15 @@ FunctionBox::FunctionBox(ExclusiveContext *cx, ObjectBox* traceListHead, JSFunct // // In this case, the inner anonymous function needs to inherit the // setting of |inWith| from the outer one. - FunctionBox *parent = outerpc->sc->asFunctionBox(); + FunctionBox* parent = outerpc->sc->asFunctionBox(); if (parent && parent->inWith) inWith = true; } } template -FunctionBox * -Parser::newFunctionBox(Node fn, JSFunction *fun, ParseContext *outerpc, +FunctionBox* +Parser::newFunctionBox(Node fn, JSFunction* fun, ParseContext* outerpc, Directives inheritedDirectives, GeneratorKind generatorKind) { JS_ASSERT(fun && !IsPoisonedPtr(fun)); @@ -569,7 +569,7 @@ Parser::newFunctionBox(Node fn, JSFunction *fun, ParseContext(context, traceListHead, fun, outerpc, inheritedDirectives, options().extraWarningsOption, generatorKind); @@ -587,15 +587,15 @@ Parser::newFunctionBox(Node fn, JSFunction *fun, ParseContext void -Parser::trace(JSTracer *trc) +Parser::trace(JSTracer* trc) { traceListHead->trace(trc); } void -MarkParser(JSTracer *trc, AutoGCRooter *parser) +MarkParser(JSTracer* trc, AutoGCRooter* parser) { - static_cast *>(parser)->trace(trc); + static_cast*>(parser)->trace(trc); } /* @@ -603,7 +603,7 @@ MarkParser(JSTracer *trc, AutoGCRooter *parser) */ template typename ParseHandler::Node -Parser::parse(JSObject *chain) +Parser::parse(JSObject* chain) { /* * Protect atoms from being collected by a GC activation, which might @@ -649,9 +649,9 @@ enum { }; static int -HasFinalReturn(ParseNode *pn) +HasFinalReturn(ParseNode* pn) { - ParseNode *pn2, *pn3; + ParseNode* pn2, *pn3; unsigned rv, rv2, hasDefault; switch (pn->getKind()) { @@ -775,7 +775,7 @@ Parser::reportBadReturn(Node pn, ParseReportKind kind, unsigned errnum, unsigned anonerrnum) { JSAutoByteString name; - JSAtom *atom = pc->sc->asFunctionBox()->function()->atom(); + JSAtom* atom = pc->sc->asFunctionBox()->function()->atom(); if (atom) { if (!AtomToPrintableString(context, atom, &name)) return false; @@ -806,7 +806,7 @@ Parser::checkStrictAssignment(Node lhs, AssignmentFlavor flavor) if (!pc->sc->needStrictChecks() && flavor != KeyedDestructuringAssignment) return true; - JSAtom *atom = handler.isName(lhs); + JSAtom* atom = handler.isName(lhs); if (!atom) return true; @@ -838,7 +838,7 @@ Parser::checkStrictAssignment(Node lhs, AssignmentFlavor flavor) */ template bool -Parser::checkStrictBinding(PropertyName *name, Node pn) +Parser::checkStrictBinding(PropertyName* name, Node pn) { if (!pc->sc->needStrictChecks()) return true; @@ -855,24 +855,24 @@ Parser::checkStrictBinding(PropertyName *name, Node pn) } template <> -ParseNode * -Parser::standaloneFunctionBody(HandleFunction fun, const AutoNameVector &formals, +ParseNode* +Parser::standaloneFunctionBody(HandleFunction fun, const AutoNameVector& formals, GeneratorKind generatorKind, Directives inheritedDirectives, - Directives *newDirectives) + Directives* newDirectives) { Node fn = handler.newFunctionDefinition(); if (!fn) return null(); - ParseNode *argsbody = ListNode::create(PNK_ARGSBODY, &handler); + ParseNode* argsbody = ListNode::create(PNK_ARGSBODY, &handler); if (!argsbody) return null(); argsbody->setOp(JSOP_NOP); argsbody->makeEmpty(); fn->pn_body = argsbody; - FunctionBox *funbox = newFunctionBox(fn, fun, /* outerpc = */ nullptr, inheritedDirectives, + FunctionBox* funbox = newFunctionBox(fn, fun, /* outerpc = */ nullptr, inheritedDirectives, generatorKind); if (!funbox) return null(); @@ -890,7 +890,7 @@ Parser::standaloneFunctionBody(HandleFunction fun, const AutoN return null(); } - ParseNode *pn = functionBody(Statement, StatementListBody); + ParseNode* pn = functionBody(Statement, StatementListBody); if (!pn) return null(); @@ -921,10 +921,10 @@ Parser::checkFunctionArguments() * Non-top-level functions use JSOP_DEFFUN which is a dynamic scope * operation which means it aliases any bindings with the same name. */ - if (FuncStmtSet *set = pc->funcStmts) { + if (FuncStmtSet* set = pc->funcStmts) { for (FuncStmtSet::Range r = set->all(); !r.empty(); r.popFront()) { - PropertyName *name = r.front()->asPropertyName(); - if (Definition *dn = pc->decls().lookupFirst(name)) + PropertyName* name = r.front()->asPropertyName(); + if (Definition* dn = pc->decls().lookupFirst(name)) dn->pn_dflags |= PND_CLOSED; } } @@ -939,7 +939,7 @@ Parser::checkFunctionArguments() */ for (AtomDefnRange r = pc->lexdeps->all(); !r.empty(); r.popFront()) { if (r.front().key() == arguments) { - Definition *dn = r.front().value().get(); + Definition* dn = r.front().value().get(); pc->lexdeps->remove(arguments); dn->pn_dflags |= PND_IMPLICITARGUMENTS; if (!pc->define(tokenStream, arguments, dn, Definition::VAR)) @@ -953,7 +953,7 @@ Parser::checkFunctionArguments() * Report error if both rest parameters and 'arguments' are used. Do this * check before adding artificial 'arguments' below. */ - Definition *maybeArgDef = pc->decls().lookupFirst(arguments); + Definition* maybeArgDef = pc->decls().lookupFirst(arguments); bool argumentsHasBinding = !!maybeArgDef; bool argumentsHasLocalBinding = maybeArgDef && maybeArgDef->kind() != Definition::ARG; bool hasRest = pc->sc->asFunctionBox()->function()->hasRest(); @@ -968,7 +968,7 @@ Parser::checkFunctionArguments() * parameters are free from 'arguments'. */ if (!argumentsHasBinding && pc->sc->bindingsAccessedDynamically() && !hasRest) { - ParseNode *pn = newName(arguments); + ParseNode* pn = newName(arguments); if (!pn) return false; if (!pc->define(tokenStream, arguments, pn, Definition::VAR)) @@ -983,7 +983,7 @@ Parser::checkFunctionArguments() * arguments object. (Also see the flags' comments in ContextFlags.) */ if (argumentsHasLocalBinding) { - FunctionBox *funbox = pc->sc->asFunctionBox(); + FunctionBox* funbox = pc->sc->asFunctionBox(); funbox->setArgumentsHasLocalBinding(); /* @@ -1014,9 +1014,9 @@ Parser::checkFunctionArguments() */ if (pc->sc->needStrictChecks()) { for (AtomDefnListMap::Range r = pc->decls().all(); !r.empty(); r.popFront()) { - DefinitionList &dlist = r.front().value(); + DefinitionList& dlist = r.front().value(); for (DefinitionList::Range dr = dlist.all(); !dr.empty(); dr.popFront()) { - Definition *dn = dr.front(); + Definition* dn = dr.front(); if (dn->kind() == Definition::ARG && dn->isAssigned()) funbox->setDefinitelyNeedsArgsObj(); } @@ -1123,16 +1123,16 @@ Parser::functionBody(FunctionSyntaxKind kind, FunctionBodyType typ /* See comment for use in Parser::functionDef. */ template <> bool -Parser::makeDefIntoUse(Definition *dn, ParseNode *pn, JSAtom *atom) +Parser::makeDefIntoUse(Definition* dn, ParseNode* pn, JSAtom* atom) { /* Turn pn into a definition. */ pc->updateDecl(atom, pn); /* Change all uses of dn to be uses of pn. */ - for (ParseNode *pnu = dn->dn_uses; pnu; pnu = pnu->pn_link) { + for (ParseNode* pnu = dn->dn_uses; pnu; pnu = pnu->pn_link) { JS_ASSERT(pnu->isUsed()); JS_ASSERT(!pnu->isDefn()); - pnu->pn_lexdef = (Definition *) pn; + pnu->pn_lexdef = (Definition*) pn; pn->pn_dflags |= pnu->pn_dflags & PND_USE2DEF_FLAGS; } pn->pn_dflags |= dn->pn_dflags & PND_USE2DEF_FLAGS; @@ -1168,13 +1168,13 @@ Parser::makeDefIntoUse(Definition *dn, ParseNode *pn, JSAtom * * left-hand side becomes a use of pn. */ if (dn->canHaveInitializer()) { - if (ParseNode *rhs = dn->expr()) { - ParseNode *lhs = handler.makeAssignment(dn, rhs); + if (ParseNode* rhs = dn->expr()) { + ParseNode* lhs = handler.makeAssignment(dn, rhs); if (!lhs) return false; pn->dn_uses = lhs; dn->pn_link = nullptr; - dn = (Definition *) lhs; + dn = (Definition*) lhs; } } @@ -1185,7 +1185,7 @@ Parser::makeDefIntoUse(Definition *dn, ParseNode *pn, JSAtom * dn->setOp((js_CodeSpec[dn->getOp()].format & JOF_SET) ? JSOP_SETNAME : JSOP_NAME); dn->setDefn(false); dn->setUsed(true); - dn->pn_lexdef = (Definition *) pn; + dn->pn_lexdef = (Definition*) pn; dn->pn_cookie.makeFree(); dn->pn_dflags &= ~PND_BOUND; return true; @@ -1202,10 +1202,10 @@ Parser::makeDefIntoUse(Definition *dn, ParseNode *pn, JSAtom * template struct BindData { - BindData(ExclusiveContext *cx) : let(cx) {} + BindData(ExclusiveContext* cx) : let(cx) {} typedef bool - (*Binder)(BindData *data, HandlePropertyName name, Parser *parser); + (*Binder)(BindData* data, HandlePropertyName name, Parser* parser); /* name node for definition processing and error source coordinates */ typename ParseHandler::Node pn; @@ -1214,13 +1214,13 @@ struct BindData Binder binder; /* binder, discriminates u */ struct LetData { - LetData(ExclusiveContext *cx) : blockObj(cx) {} + LetData(ExclusiveContext* cx) : blockObj(cx) {} VarContext varContext; RootedStaticBlockObject blockObj; unsigned overflow; } let; - void initLet(VarContext varContext, StaticBlockObject &blockObj, unsigned overflow) { + void initLet(VarContext varContext, StaticBlockObject& blockObj, unsigned overflow) { this->pn = ParseHandler::null(); this->op = JSOP_NOP; this->binder = Parser::bindLet; @@ -1236,9 +1236,9 @@ struct BindData }; template -JSFunction * -Parser::newFunction(GenericParseContext *pc, HandleAtom atom, - FunctionSyntaxKind kind, JSObject *proto) +JSFunction* +Parser::newFunction(GenericParseContext* pc, HandleAtom atom, + FunctionSyntaxKind kind, JSObject* proto) { JS_ASSERT_IF(kind == Statement, atom != nullptr); @@ -1270,7 +1270,7 @@ Parser::newFunction(GenericParseContext *pc, HandleAtom atom, } static bool -MatchOrInsertSemicolon(TokenStream &ts) +MatchOrInsertSemicolon(TokenStream& ts) { TokenKind tt = ts.peekTokenSameLine(TokenStream::Operand); if (tt == TOK_ERROR) @@ -1287,7 +1287,7 @@ MatchOrInsertSemicolon(TokenStream &ts) template typename ParseHandler::DefinitionNode -Parser::getOrCreateLexicalDependency(ParseContext *pc, JSAtom *atom) +Parser::getOrCreateLexicalDependency(ParseContext* pc, JSAtom* atom) { AtomDefnAddPtr p = pc->lexdeps->lookupForAdd(atom); if (p) @@ -1303,8 +1303,8 @@ Parser::getOrCreateLexicalDependency(ParseContext *p } static bool -ConvertDefinitionToNamedLambdaUse(TokenStream &ts, ParseContext *pc, - FunctionBox *funbox, Definition *dn) +ConvertDefinitionToNamedLambdaUse(TokenStream& ts, ParseContext* pc, + FunctionBox* funbox, Definition* dn) { dn->setOp(JSOP_CALLEE); if (!dn->pn_cookie.set(ts, pc->staticLevel, 0)) @@ -1336,19 +1336,19 @@ ConvertDefinitionToNamedLambdaUse(TokenStream &ts, ParseContext bool -Parser::leaveFunction(ParseNode *fn, ParseContext *outerpc, +Parser::leaveFunction(ParseNode* fn, ParseContext* outerpc, FunctionSyntaxKind kind) { outerpc->blockidGen = pc->blockidGen; - FunctionBox *funbox = fn->pn_funbox; + FunctionBox* funbox = fn->pn_funbox; JS_ASSERT(funbox == pc->sc->asFunctionBox()); /* Propagate unresolved lexical names up to outerpc->lexdeps. */ if (pc->lexdeps->count()) { for (AtomDefnRange r = pc->lexdeps->all(); !r.empty(); r.popFront()) { - JSAtom *atom = r.front().key(); - Definition *dn = r.front().value().get(); + JSAtom* atom = r.front().key(); + Definition* dn = r.front().value().get(); JS_ASSERT(dn->isPlaceholder()); if (atom == funbox->function()->name() && kind == Expression) { @@ -1357,7 +1357,7 @@ Parser::leaveFunction(ParseNode *fn, ParseContextdecls().lookupFirst(atom); + Definition* outer_dn = outerpc->decls().lookupFirst(atom); /* * Make sure to deoptimize lexical dependencies that are polluted @@ -1408,7 +1408,7 @@ Parser::leaveFunction(ParseNode *fn, ParseContextdn_uses) { + if (ParseNode* pnu = dn->dn_uses) { while (true) { pnu->pn_lexdef = outer_dn; if (!pnu->pn_link) @@ -1435,12 +1435,12 @@ Parser::leaveFunction(ParseNode *fn, ParseContext bool -Parser::leaveFunction(Node fn, ParseContext *outerpc, +Parser::leaveFunction(Node fn, ParseContext* outerpc, FunctionSyntaxKind kind) { outerpc->blockidGen = pc->blockidGen; - FunctionBox *funbox = pc->sc->asFunctionBox(); + FunctionBox* funbox = pc->sc->asFunctionBox(); return addFreeVariablesFromLazyFunction(funbox->function(), outerpc); } @@ -1461,9 +1461,9 @@ Parser::leaveFunction(Node fn, ParseContext bool Parser::defineArg(Node funcpn, HandlePropertyName name, - bool disallowDuplicateArgs, Node *duplicatedArg) + bool disallowDuplicateArgs, Node* duplicatedArg) { - SharedContext *sc = pc->sc; + SharedContext* sc = pc->sc; /* Handle duplicate argument names. */ if (DefinitionNode prevDecl = pc->decls().lookupFirst(name)) { @@ -1512,10 +1512,10 @@ Parser::defineArg(Node funcpn, HandlePropertyName name, template /* static */ bool -Parser::bindDestructuringArg(BindData *data, - HandlePropertyName name, Parser *parser) +Parser::bindDestructuringArg(BindData* data, + HandlePropertyName name, Parser* parser) { - ParseContext *pc = parser->pc; + ParseContext* pc = parser->pc; JS_ASSERT(pc->sc->isFunctionBox()); if (pc->decls().lookupFirst(name)) { @@ -1531,10 +1531,10 @@ Parser::bindDestructuringArg(BindData *data, template bool -Parser::functionArguments(FunctionSyntaxKind kind, Node *listp, Node funcpn, - bool *hasRest) +Parser::functionArguments(FunctionSyntaxKind kind, Node* listp, Node funcpn, + bool* hasRest) { - FunctionBox *funbox = pc->sc->asFunctionBox(); + FunctionBox* funbox = pc->sc->asFunctionBox(); *hasRest = false; @@ -1711,10 +1711,10 @@ Parser::functionArguments(FunctionSyntaxKind kind, Node *listp, No template <> bool Parser::checkFunctionDefinition(HandlePropertyName funName, - ParseNode **pn_, FunctionSyntaxKind kind, - bool *pbodyProcessed) + ParseNode** pn_, FunctionSyntaxKind kind, + bool* pbodyProcessed) { - ParseNode *&pn = *pn_; + ParseNode*& pn = *pn_; *pbodyProcessed = false; /* Function statements add a binding to the enclosing scope. */ @@ -1725,7 +1725,7 @@ Parser::checkFunctionDefinition(HandlePropertyName funName, * Handle redeclaration and optimize cases where we can statically bind the * function (thereby avoiding JSOP_DEFFUN and dynamic name lookup). */ - if (Definition *dn = pc->decls().lookupFirst(funName)) { + if (Definition* dn = pc->decls().lookupFirst(funName)) { JS_ASSERT(!dn->isUsed()); JS_ASSERT(dn->isDefn()); @@ -1758,7 +1758,7 @@ Parser::checkFunctionDefinition(HandlePropertyName funName, * pre-created definition node for this function that primaryExpr * put in pc->lexdeps on first forward reference, and recycle pn. */ - if (Definition *fn = pc->lexdeps.lookupDefn(funName)) { + if (Definition* fn = pc->lexdeps.lookupDefn(funName)) { JS_ASSERT(fn->isDefn()); fn->setKind(PNK_FUNCTION); fn->setArity(PN_CODE); @@ -1790,7 +1790,7 @@ Parser::checkFunctionDefinition(HandlePropertyName funName, JS_ASSERT(!pc->sc->strict); JS_ASSERT(pn->pn_cookie.isFree()); if (pc->sc->isFunctionBox()) { - FunctionBox *funbox = pc->sc->asFunctionBox(); + FunctionBox* funbox = pc->sc->asFunctionBox(); funbox->setMightAliasLocals(); funbox->setHasExtensibleScope(); } @@ -1831,10 +1831,10 @@ Parser::checkFunctionDefinition(HandlePropertyName funName, // that function, not any of its nested children. The initial syntax-only // parse recorded the free variables of nested functions and their extents, // so we can skip over them after accounting for their free variables. - if (LazyScript *lazyOuter = handler.lazyOuterFunction()) { - JSFunction *fun = handler.nextLazyInnerFunction(); + if (LazyScript* lazyOuter = handler.lazyOuterFunction()) { + JSFunction* fun = handler.nextLazyInnerFunction(); JS_ASSERT(!fun->isLegacyGenerator()); - FunctionBox *funbox = newFunctionBox(pn, fun, pc, Directives(/* strict = */ false), + FunctionBox* funbox = newFunctionBox(pn, fun, pc, Directives(/* strict = */ false), fun->generatorKind()); if (!funbox) return false; @@ -1859,7 +1859,7 @@ Parser::checkFunctionDefinition(HandlePropertyName funName, template static inline void -PropagateTransitiveParseFlags(const T *inner, U *outer) +PropagateTransitiveParseFlags(const T* inner, U* outer) { if (inner->bindingsAccessedDynamically()) outer->setBindingsAccessedDynamically(); @@ -1869,16 +1869,16 @@ PropagateTransitiveParseFlags(const T *inner, U *outer) template bool -Parser::addFreeVariablesFromLazyFunction(JSFunction *fun, - ParseContext *pc) +Parser::addFreeVariablesFromLazyFunction(JSFunction* fun, + ParseContext* pc) { // Update any definition nodes in this context according to free variables // in a lazily parsed inner function. - LazyScript *lazy = fun->lazyScript(); - HeapPtrAtom *freeVariables = lazy->freeVariables(); + LazyScript* lazy = fun->lazyScript(); + HeapPtrAtom* freeVariables = lazy->freeVariables(); for (size_t i = 0; i < lazy->numFreeVariables(); i++) { - JSAtom *atom = freeVariables[i]; + JSAtom* atom = freeVariables[i]; // 'arguments' will be implicitly bound within the inner function. if (atom == context->names().arguments) @@ -1903,8 +1903,8 @@ Parser::addFreeVariablesFromLazyFunction(JSFunction *fun, template <> bool Parser::checkFunctionDefinition(HandlePropertyName funName, - Node *pn, FunctionSyntaxKind kind, - bool *pbodyProcessed) + Node* pn, FunctionSyntaxKind kind, + bool* pbodyProcessed) { *pbodyProcessed = false; @@ -1948,7 +1948,7 @@ Parser::checkFunctionDefinition(HandlePropertyName funName, template typename ParseHandler::Node -Parser::functionDef(HandlePropertyName funName, const TokenStream::Position &start, +Parser::functionDef(HandlePropertyName funName, const TokenStream::Position& start, FunctionType type, FunctionSyntaxKind kind, GeneratorKind generatorKind) { @@ -1971,7 +1971,7 @@ Parser::functionDef(HandlePropertyName funName, const TokenStream: // If we are off the main thread, the generator meta-objects have // already been created by js::StartOffThreadParseScript, so cx will not // be necessary. - JSContext *cx = context->maybeJSContext(); + JSContext* cx = context->maybeJSContext(); proto = GlobalObject::getOrCreateStarGeneratorFunctionPrototype(cx, context->global()); if (!proto) return null(); @@ -2011,8 +2011,8 @@ Parser::functionDef(HandlePropertyName funName, const TokenStream: template <> bool -Parser::finishFunctionDefinition(ParseNode *pn, FunctionBox *funbox, - ParseNode *prelude, ParseNode *body) +Parser::finishFunctionDefinition(ParseNode* pn, FunctionBox* funbox, + ParseNode* prelude, ParseNode* body) { pn->pn_pos.end = pos().end; @@ -2024,7 +2024,7 @@ Parser::finishFunctionDefinition(ParseNode *pn, FunctionBox *f */ if (prelude) { if (!body->isArity(PN_LIST)) { - ParseNode *block; + ParseNode* block; block = ListNode::create(PNK_SEQ, &handler); if (!block) @@ -2035,7 +2035,7 @@ Parser::finishFunctionDefinition(ParseNode *pn, FunctionBox *f body = block; } - ParseNode *item = UnaryNode::create(PNK_SEMI, &handler); + ParseNode* item = UnaryNode::create(PNK_SEMI, &handler); if (!item) return false; @@ -2059,7 +2059,7 @@ Parser::finishFunctionDefinition(ParseNode *pn, FunctionBox *f template <> bool -Parser::finishFunctionDefinition(Node pn, FunctionBox *funbox, +Parser::finishFunctionDefinition(Node pn, FunctionBox* funbox, Node prelude, Node body) { // The LazyScript for a lazily parsed function needs to be constructed @@ -2073,19 +2073,19 @@ Parser::finishFunctionDefinition(Node pn, FunctionBox *funbo size_t numInnerFunctions = pc->innerFunctions.length(); RootedFunction fun(context, funbox->function()); - LazyScript *lazy = LazyScript::CreateRaw(context, fun, numFreeVariables, numInnerFunctions, + LazyScript* lazy = LazyScript::CreateRaw(context, fun, numFreeVariables, numInnerFunctions, versionNumber(), funbox->bufStart, funbox->bufEnd, funbox->startLine, funbox->startColumn); if (!lazy) return false; - HeapPtrAtom *freeVariables = lazy->freeVariables(); + HeapPtrAtom* freeVariables = lazy->freeVariables(); size_t i = 0; for (AtomDefnRange r = pc->lexdeps->all(); !r.empty(); r.popFront()) freeVariables[i++].init(r.front().key()); JS_ASSERT(i == numFreeVariables); - HeapPtrFunction *innerFunctions = lazy->innerFunctions(); + HeapPtrFunction* innerFunctions = lazy->innerFunctions(); for (size_t i = 0; i < numInnerFunctions; i++) innerFunctions[i].init(pc->innerFunctions[i]); @@ -2102,22 +2102,22 @@ Parser::finishFunctionDefinition(Node pn, FunctionBox *funbo template <> bool -Parser::functionArgsAndBody(ParseNode *pn, HandleFunction fun, +Parser::functionArgsAndBody(ParseNode* pn, HandleFunction fun, FunctionType type, FunctionSyntaxKind kind, GeneratorKind generatorKind, Directives inheritedDirectives, - Directives *newDirectives) + Directives* newDirectives) { - ParseContext *outerpc = pc; + ParseContext* outerpc = pc; // Create box for fun->object early to protect against last-ditch GC. - FunctionBox *funbox = newFunctionBox(pn, fun, pc, inheritedDirectives, generatorKind); + FunctionBox* funbox = newFunctionBox(pn, fun, pc, inheritedDirectives, generatorKind); if (!funbox) return false; // Try a syntax parse for this inner function. do { - Parser *parser = handler.syntaxParser; + Parser* parser = handler.syntaxParser; if (!parser) break; @@ -2196,12 +2196,12 @@ Parser::functionArgsAndBody(Node pn, HandleFunction fun, FunctionType type, FunctionSyntaxKind kind, GeneratorKind generatorKind, Directives inheritedDirectives, - Directives *newDirectives) + Directives* newDirectives) { - ParseContext *outerpc = pc; + ParseContext* outerpc = pc; // Create box for fun->object early to protect against last-ditch GC. - FunctionBox *funbox = newFunctionBox(pn, fun, pc, inheritedDirectives, generatorKind); + FunctionBox* funbox = newFunctionBox(pn, fun, pc, inheritedDirectives, generatorKind); if (!funbox) return false; @@ -2226,7 +2226,7 @@ Parser::functionArgsAndBody(Node pn, HandleFunction fun, } template <> -ParseNode * +ParseNode* Parser::standaloneLazyFunction(HandleFunction fun, unsigned staticLevel, bool strict, GeneratorKind generatorKind) { @@ -2235,7 +2235,7 @@ Parser::standaloneLazyFunction(HandleFunction fun, unsigned st return null(); Directives directives(/* strict = */ strict); - FunctionBox *funbox = newFunctionBox(pn, fun, /* outerpc = */ nullptr, directives, + FunctionBox* funbox = newFunctionBox(pn, fun, /* outerpc = */ nullptr, directives, generatorKind); if (!funbox) return null(); @@ -2255,7 +2255,7 @@ Parser::standaloneLazyFunction(HandleFunction fun, unsigned st if (fun->isNamedLambda()) { if (AtomDefnPtr p = pc->lexdeps->lookup(fun->name())) { - Definition *dn = p.value().get(); + Definition* dn = p.value().get(); if (!ConvertDefinitionToNamedLambdaUse(tokenStream, pc, funbox, dn)) return nullptr; } @@ -2276,7 +2276,7 @@ template bool Parser::functionArgsAndBodyGeneric(Node pn, HandleFunction fun, FunctionType type, FunctionSyntaxKind kind, - Directives *newDirectives) + Directives* newDirectives) { // Given a properly initialized parse context, try to parse an actual // function without concern for conversion to strict mode, use of lazy @@ -2287,7 +2287,7 @@ Parser::functionArgsAndBodyGeneric(Node pn, HandleFunction fun, Fu if (!functionArguments(kind, &prelude, pn, &hasRest)) return false; - FunctionBox *funbox = pc->sc->asFunctionBox(); + FunctionBox* funbox = pc->sc->asFunctionBox(); fun->setArgCount(pc->numArgs()); if (hasRest) @@ -2439,7 +2439,7 @@ Parser::functionExpr() * a directive. */ static inline bool -IsEscapeFreeStringLiteral(const TokenPos &pos, JSAtom *str) +IsEscapeFreeStringLiteral(const TokenPos& pos, JSAtom* str) { /* * If the string's length in the source code is its length as a value, @@ -2519,10 +2519,10 @@ Parser::asmJS(Node list) */ template bool -Parser::maybeParseDirective(Node list, Node pn, bool *cont) +Parser::maybeParseDirective(Node list, Node pn, bool* cont) { TokenPos directivePos; - JSAtom *directive = handler.isStringExprStatement(pn, &directivePos); + JSAtom* directive = handler.isStringExprStatement(pn, &directivePos); *cont = !!directive; if (!*cont) @@ -2667,7 +2667,7 @@ Parser::matchLabel(MutableHandle label) template bool -Parser::reportRedeclaration(Node pn, bool isConst, JSAtom *atom) +Parser::reportRedeclaration(Node pn, bool isConst, JSAtom* atom) { JSAutoByteString name; if (AtomToPrintableString(context, atom, &name)) @@ -2686,17 +2686,17 @@ Parser::reportRedeclaration(Node pn, bool isConst, JSAtom *atom) */ template <> /* static */ bool -Parser::bindLet(BindData *data, - HandlePropertyName name, Parser *parser) +Parser::bindLet(BindData* data, + HandlePropertyName name, Parser* parser) { - ParseContext *pc = parser->pc; - ParseNode *pn = data->pn; + ParseContext* pc = parser->pc; + ParseNode* pn = data->pn; if (!parser->checkStrictBinding(name, pn)) return false; - ExclusiveContext *cx = parser->context; + ExclusiveContext* cx = parser->context; - Rooted blockObj(cx, data->let.blockObj); + Rooted blockObj(cx, data->let.blockObj); unsigned index = blockObj->numVariables(); if (index >= StaticBlockObject::LOCAL_INDEX_LIMIT) { parser->report(ParseError, false, pn, data->let.overflow); @@ -2719,7 +2719,7 @@ Parser::bindLet(BindData *data, */ if (data->let.varContext == HoistVars) { JS_ASSERT(!pc->atBodyLevel()); - Definition *dn = pc->decls().lookupFirst(name); + Definition* dn = pc->decls().lookupFirst(name); if (dn && dn->pn_blockid == pc->blockid()) return parser->reportRedeclaration(pn, dn->isConst(), name); if (!pc->define(parser->tokenStream, name, pn, Definition::LET)) @@ -2736,14 +2736,14 @@ Parser::bindLet(BindData *data, } /* Store pn in the static block object. */ - blockObj->setDefinitionParseNode(index, reinterpret_cast(pn)); + blockObj->setDefinitionParseNode(index, reinterpret_cast(pn)); return true; } template <> /* static */ bool -Parser::bindLet(BindData *data, - HandlePropertyName name, Parser *parser) +Parser::bindLet(BindData* data, + HandlePropertyName name, Parser* parser) { if (!parser->checkStrictBinding(name, data->pn)) return false; @@ -2753,11 +2753,11 @@ Parser::bindLet(BindData *data, template static inline bool -ForEachLetDef(TokenStream &ts, ParseContext *pc, +ForEachLetDef(TokenStream& ts, ParseContext* pc, HandleStaticBlockObject blockObj, Op op) { for (Shape::Range r(ts.context(), blockObj->lastProperty()); !r.empty(); r.popFront()) { - Shape &shape = r.front(); + Shape& shape = r.front(); /* Beware the destructuring dummy slots. */ if (JSID_IS_INT(shape.propid())) @@ -2771,8 +2771,8 @@ ForEachLetDef(TokenStream &ts, ParseContext *pc, template struct PopLetDecl { - bool operator()(TokenStream &, ParseContext *pc, HandleStaticBlockObject, - const Shape &, JSAtom *atom) + bool operator()(TokenStream&, ParseContext* pc, HandleStaticBlockObject, + const Shape&, JSAtom* atom) { pc->popLetDecl(atom); return true; @@ -2789,10 +2789,10 @@ struct PopLetDecl { // template static void -AccumulateBlockScopeDepth(ParseContext *pc) +AccumulateBlockScopeDepth(ParseContext* pc) { uint32_t innerDepth = pc->topStmt->innerBlockScopeDepth; - StmtInfoPC *outer = pc->topStmt->down; + StmtInfoPC* outer = pc->topStmt->down; if (pc->topStmt->isBlockScope) innerDepth += pc->topStmt->staticScope->template as().numVariables(); @@ -2808,7 +2808,7 @@ AccumulateBlockScopeDepth(ParseContext *pc) template static void -PopStatementPC(TokenStream &ts, ParseContext *pc) +PopStatementPC(TokenStream& ts, ParseContext* pc) { RootedNestedScopeObject scopeObj(ts.context(), pc->topStmt->staticScope); JS_ASSERT(!!scopeObj == pc->topStmt->isNestedScope); @@ -2835,8 +2835,8 @@ PopStatementPC(TokenStream &ts, ParseContext *pc) * the given name, or nullptr. */ template -typename ContextT::StmtInfo * -LexicalLookup(ContextT *ct, HandleAtom atom, int *slotp, typename ContextT::StmtInfo *stmt) +typename ContextT::StmtInfo* +LexicalLookup(ContextT* ct, HandleAtom atom, int* slotp, typename ContextT::StmtInfo* stmt) { RootedId id(ct->sc->context, AtomToId(atom)); @@ -2855,8 +2855,8 @@ LexicalLookup(ContextT *ct, HandleAtom atom, int *slotp, typename ContextT::Stmt if (!stmt->isBlockScope) continue; - StaticBlockObject &blockObj = stmt->staticBlock(); - Shape *shape = blockObj.nativeLookup(ct->sc->context, id); + StaticBlockObject& blockObj = stmt->staticBlock(); + Shape* shape = blockObj.nativeLookup(ct->sc->context, id); if (shape) { if (slotp) *slotp = blockObj.shapeToIndex(*shape); @@ -2871,7 +2871,7 @@ LexicalLookup(ContextT *ct, HandleAtom atom, int *slotp, typename ContextT::Stmt template static inline bool -OuterLet(ParseContext *pc, StmtInfoPC *stmt, HandleAtom atom) +OuterLet(ParseContext* pc, StmtInfoPC* stmt, HandleAtom atom) { while (stmt->downScope) { stmt = LexicalLookup(pc, atom, nullptr, stmt->downScope); @@ -2885,11 +2885,11 @@ OuterLet(ParseContext *pc, StmtInfoPC *stmt, HandleAtom atom) template /* static */ bool -Parser::bindVarOrConst(BindData *data, - HandlePropertyName name, Parser *parser) +Parser::bindVarOrConst(BindData* data, + HandlePropertyName name, Parser* parser) { - ExclusiveContext *cx = parser->context; - ParseContext *pc = parser->pc; + ExclusiveContext* cx = parser->context; + ParseContext* pc = parser->pc; Node pn = data->pn; bool isConstDecl = data->op == JSOP_DEFCONST; @@ -2899,12 +2899,12 @@ Parser::bindVarOrConst(BindData *data, if (!parser->checkStrictBinding(name, pn)) return false; - StmtInfoPC *stmt = LexicalLookup(pc, name, nullptr, (StmtInfoPC *)nullptr); + StmtInfoPC* stmt = LexicalLookup(pc, name, nullptr, (StmtInfoPC*)nullptr); if (stmt && stmt->type == STMT_WITH) { parser->handler.setFlag(pn, PND_DEOPTIMIZED); if (pc->sc->isFunctionBox()) { - FunctionBox *funbox = pc->sc->asFunctionBox(); + FunctionBox* funbox = pc->sc->asFunctionBox(); funbox->setMightAliasLocals(); } @@ -2976,7 +2976,7 @@ Parser::bindVarOrConst(BindData *data, template <> bool -Parser::makeSetCall(ParseNode *pn, unsigned msg) +Parser::makeSetCall(ParseNode* pn, unsigned msg) { JS_ASSERT(pn->isKind(PNK_CALL)); JS_ASSERT(pn->isArity(PN_LIST)); @@ -2994,7 +2994,7 @@ template bool Parser::noteNameUse(HandlePropertyName name, Node pn) { - StmtInfoPC *stmt = LexicalLookup(pc, name, nullptr, (StmtInfoPC *)nullptr); + StmtInfoPC* stmt = LexicalLookup(pc, name, nullptr, (StmtInfoPC*)nullptr); DefinitionList::Range defs = pc->decls().lookupMulti(name); @@ -3025,7 +3025,7 @@ Parser::noteNameUse(HandlePropertyName name, Node pn) template <> bool -Parser::bindDestructuringVar(BindData *data, ParseNode *pn) +Parser::bindDestructuringVar(BindData* data, ParseNode* pn) { JS_ASSERT(pn->isKind(PNK_NAME)); @@ -3094,8 +3094,8 @@ Parser::bindDestructuringVar(BindData *data, */ template <> bool -Parser::checkDestructuring(BindData *data, - ParseNode *left, bool toplevel) +Parser::checkDestructuring(BindData* data, + ParseNode* left, bool toplevel) { bool ok; @@ -3104,11 +3104,11 @@ Parser::checkDestructuring(BindData *data, return false; } - Rooted blockObj(context); + Rooted blockObj(context); blockObj = data && data->binder == bindLet ? data->let.blockObj.get() : nullptr; if (left->isKind(PNK_ARRAY)) { - for (ParseNode *pn = left->pn_head; pn; pn = pn->pn_next) { + for (ParseNode* pn = left->pn_head; pn; pn = pn->pn_next) { if (!pn->isKind(PNK_ELISION)) { if (pn->isKind(PNK_ARRAY) || pn->isKind(PNK_OBJECT)) { ok = checkDestructuring(data, pn, false); @@ -3129,9 +3129,9 @@ Parser::checkDestructuring(BindData *data, } } else { JS_ASSERT(left->isKind(PNK_OBJECT)); - for (ParseNode *member = left->pn_head; member; member = member->pn_next) { + for (ParseNode* member = left->pn_head; member; member = member->pn_next) { MOZ_ASSERT(member->isKind(PNK_COLON)); - ParseNode *expr = member->pn_right; + ParseNode* expr = member->pn_right; if (expr->isKind(PNK_ARRAY) || expr->isKind(PNK_OBJECT)) { ok = checkDestructuring(data, expr, false); @@ -3165,7 +3165,7 @@ Parser::checkDestructuring(BindData *data, template <> bool -Parser::checkDestructuring(BindData *data, +Parser::checkDestructuring(BindData* data, Node left, bool toplevel) { return abortIfSyntaxParser(); @@ -3173,7 +3173,7 @@ Parser::checkDestructuring(BindData *dat template typename ParseHandler::Node -Parser::destructuringExpr(BindData *data, TokenKind tt) +Parser::destructuringExpr(BindData* data, TokenKind tt) { JS_ASSERT(tokenStream.isCurrentTokenType(tt)); @@ -3189,11 +3189,11 @@ Parser::destructuringExpr(BindData *data, TokenKind template typename ParseHandler::Node -Parser::pushLexicalScope(HandleStaticBlockObject blockObj, StmtInfoPC *stmt) +Parser::pushLexicalScope(HandleStaticBlockObject blockObj, StmtInfoPC* stmt) { JS_ASSERT(blockObj); - ObjectBox *blockbox = newObjectBox(blockObj); + ObjectBox* blockbox = newObjectBox(blockObj); if (!blockbox) return null(); @@ -3214,7 +3214,7 @@ Parser::pushLexicalScope(HandleStaticBlockObject blockObj, StmtInf template typename ParseHandler::Node -Parser::pushLexicalScope(StmtInfoPC *stmt) +Parser::pushLexicalScope(StmtInfoPC* stmt) { RootedStaticBlockObject blockObj(context, StaticBlockObject::create(context)); if (!blockObj) @@ -3229,10 +3229,10 @@ struct AddLetDecl AddLetDecl(uint32_t blockid) : blockid(blockid) {} - bool operator()(TokenStream &ts, ParseContext *pc, - HandleStaticBlockObject blockObj, const Shape &shape, JSAtom *) + bool operator()(TokenStream& ts, ParseContext* pc, + HandleStaticBlockObject blockObj, const Shape& shape, JSAtom*) { - ParseNode *def = (ParseNode *) blockObj->getSlot(shape.slot()).toPrivate(); + ParseNode* def = (ParseNode*) blockObj->getSlot(shape.slot()).toPrivate(); def->pn_blockid = blockid; RootedPropertyName name(ts.context(), def->name()); return pc->define(ts, name, def, Definition::LET); @@ -3240,11 +3240,11 @@ struct AddLetDecl }; template <> -ParseNode * -Parser::pushLetScope(HandleStaticBlockObject blockObj, StmtInfoPC *stmt) +ParseNode* +Parser::pushLetScope(HandleStaticBlockObject blockObj, StmtInfoPC* stmt) { JS_ASSERT(blockObj); - ParseNode *pn = pushLexicalScope(blockObj, stmt); + ParseNode* pn = pushLexicalScope(blockObj, stmt); if (!pn) return null(); @@ -3259,7 +3259,7 @@ Parser::pushLetScope(HandleStaticBlockObject blockObj, StmtInf template <> SyntaxParseHandler::Node -Parser::pushLetScope(HandleStaticBlockObject blockObj, StmtInfoPC *stmt) +Parser::pushLetScope(HandleStaticBlockObject blockObj, StmtInfoPC* stmt) { JS_ALWAYS_FALSE(abortIfSyntaxParser()); return SyntaxParseHandler::NodeFailure; @@ -3352,8 +3352,8 @@ Parser::letBlock(LetContext letContext) template static bool -PushBlocklikeStatement(TokenStream &ts, StmtInfoPC *stmt, StmtType type, - ParseContext *pc) +PushBlocklikeStatement(TokenStream& ts, StmtInfoPC* stmt, StmtType type, + ParseContext* pc) { PushStatementPC(pc, stmt, type); return GenerateBlockId(ts, pc, stmt->blockid); @@ -3380,7 +3380,7 @@ Parser::blockStatement() template typename ParseHandler::Node -Parser::newBindingNode(PropertyName *name, bool functionScope, VarContext varContext) +Parser::newBindingNode(PropertyName* name, bool functionScope, VarContext varContext) { /* * If this name is being injected into an existing block/function, see if @@ -3415,8 +3415,8 @@ Parser::newBindingNode(PropertyName *name, bool functionScope, Var */ template typename ParseHandler::Node -Parser::variables(ParseNodeKind kind, bool *psimple, - StaticBlockObject *blockObj, VarContext varContext) +Parser::variables(ParseNodeKind kind, bool* psimple, + StaticBlockObject* blockObj, VarContext varContext) { /* * The four options here are: @@ -3529,12 +3529,12 @@ Parser::variables(ParseNodeKind kind, bool *psimple, } template <> -ParseNode * +ParseNode* Parser::letDeclaration() { handler.disableSyntaxParser(); - ParseNode *pn; + ParseNode* pn; do { /* @@ -3548,7 +3548,7 @@ Parser::letDeclaration() * enclosing maybe-scope StmtInfoPC isn't yet a scope statement) then * we also need to set pc->blockNode to be our PNK_LEXICALSCOPE. */ - StmtInfoPC *stmt = pc->topStmt; + StmtInfoPC* stmt = pc->topStmt; if (stmt && (!stmt->maybeScope() || stmt->isForLetBlock)) { report(ParseError, false, null(), JSMSG_LET_DECL_NOT_IN_BLOCK); return null(); @@ -3583,11 +3583,11 @@ Parser::letDeclaration() JS_ASSERT(!stmt->downScope); /* Convert the block statement into a scope statement. */ - StaticBlockObject *blockObj = StaticBlockObject::create(context); + StaticBlockObject* blockObj = StaticBlockObject::create(context); if (!blockObj) return null(); - ObjectBox *blockbox = newObjectBox(blockObj); + ObjectBox* blockbox = newObjectBox(blockObj); if (!blockbox) return null(); @@ -3606,12 +3606,12 @@ Parser::letDeclaration() stmt->staticScope = blockObj; #ifdef DEBUG - ParseNode *tmp = pc->blockNode; + ParseNode* tmp = pc->blockNode; JS_ASSERT(!tmp || !tmp->isKind(PNK_LEXICALSCOPE)); #endif /* Create a new lexical scope node for these statements. */ - ParseNode *pn1 = LexicalScopeNode::create(PNK_LEXICALSCOPE, &handler); + ParseNode* pn1 = LexicalScopeNode::create(PNK_LEXICALSCOPE, &handler); if (!pn1) return null(); @@ -3640,13 +3640,13 @@ Parser::letDeclaration() } template <> -ParseNode * +ParseNode* Parser::letStatement() { handler.disableSyntaxParser(); /* Check for a let statement or let expression. */ - ParseNode *pn; + ParseNode* pn; if (tokenStream.peekToken() == TOK_LP) { pn = letBlock(LetStatement); JS_ASSERT_IF(pn, pn->isKind(PNK_LET) || pn->isKind(PNK_SEMI)); @@ -4030,7 +4030,7 @@ Parser::whileStatement() template bool -Parser::matchInOrOf(bool *isForOfp) +Parser::matchInOrOf(bool* isForOfp) { if (tokenStream.matchToken(TOK_IN)) { *isForOfp = false; @@ -4045,7 +4045,7 @@ Parser::matchInOrOf(bool *isForOfp) template <> bool -Parser::isValidForStatementLHS(ParseNode *pn1, JSVersion version, +Parser::isValidForStatementLHS(ParseNode* pn1, JSVersion version, bool isForDecl, bool isForEach, ParseNodeKind headKind) { @@ -4058,7 +4058,7 @@ Parser::isValidForStatementLHS(ParseNode *pn1, JSVersion versi // In JS 1.7 only, for (var [K, V] in EXPR) has a special meaning. // Hence all other destructuring decls are banned there. if (version == JSVERSION_1_7 && !isForEach && headKind == PNK_FORIN) { - ParseNode *lhs = pn1->pn_head; + ParseNode* lhs = pn1->pn_head; if (lhs->isKind(PNK_ASSIGN)) lhs = lhs->pn_left; @@ -4091,7 +4091,7 @@ Parser::isValidForStatementLHS(ParseNode *pn1, JSVersion versi } template <> -ParseNode * +ParseNode* Parser::forStatement() { JS_ASSERT(tokenStream.isCurrentTokenType(TOK_FOR)); @@ -4120,7 +4120,7 @@ Parser::forStatement() RootedStaticBlockObject blockObj(context); /* Set to 'x' in 'for (x ;... ;...)' or 'for (x in ...)'. */ - ParseNode *pn1; + ParseNode* pn1; { TokenKind tt = tokenStream.peekToken(TokenStream::Operand); @@ -4177,12 +4177,12 @@ Parser::forStatement() // - forLetImpliedBlock is the node for the implicit block scope. // - forLetDecl is the node for the decl 'let '. // Otherwise both are null. - ParseNode *forLetImpliedBlock = nullptr; - ParseNode *forLetDecl = nullptr; + ParseNode* forLetImpliedBlock = nullptr; + ParseNode* forLetDecl = nullptr; // If non-null, the node for the decl 'var v = expr1' in the weirdo form // 'for (var v = expr1 in expr2) stmt'. - ParseNode *hoistedVar = nullptr; + ParseNode* hoistedVar = nullptr; /* * We can be sure that it's a for/in loop if there's still an 'in' @@ -4191,7 +4191,7 @@ Parser::forStatement() * pc->parsingForInit. */ StmtInfoPC letStmt(context); /* used if blockObj != nullptr. */ - ParseNode *pn2, *pn3; /* forHead->pn_kid2 and pn_kid3. */ + ParseNode* pn2, *pn3; /* forHead->pn_kid2 and pn_kid3. */ ParseNodeKind headKind = PNK_FORHEAD; if (pn1) { bool isForOf; @@ -4290,7 +4290,7 @@ Parser::forStatement() * created by PushLetScope around the for's initializer. This also * serves to indicate the let-decl to the emitter. */ - ParseNode *block = pushLetScope(blockObj, &letStmt); + ParseNode* block = pushLetScope(blockObj, &letStmt); if (!block) return null(); letStmt.isForLetBlock = true; @@ -4378,12 +4378,12 @@ Parser::forStatement() MUST_MATCH_TOKEN(TOK_RP, JSMSG_PAREN_AFTER_FOR_CTRL); TokenPos headPos(begin, pos().end); - ParseNode *forHead = handler.newForHead(headKind, pn1, pn2, pn3, headPos); + ParseNode* forHead = handler.newForHead(headKind, pn1, pn2, pn3, headPos); if (!forHead) return null(); /* Parse the loop body. */ - ParseNode *body = statement(); + ParseNode* body = statement(); if (!body) return null(); @@ -4391,12 +4391,12 @@ Parser::forStatement() PopStatementPC(tokenStream, pc); PopStatementPC(tokenStream, pc); - ParseNode *forLoop = handler.newForStatement(begin, forHead, body, iflags); + ParseNode* forLoop = handler.newForStatement(begin, forHead, body, iflags); if (!forLoop) return null(); if (hoistedVar) { - ParseNode *pnseq = handler.newList(PNK_SEQ, hoistedVar); + ParseNode* pnseq = handler.newList(PNK_SEQ, hoistedVar); if (!pnseq) return null(); pnseq->pn_pos = forLoop->pn_pos; @@ -4406,7 +4406,7 @@ Parser::forStatement() if (forLetImpliedBlock) { forLetImpliedBlock->pn_expr = forLoop; forLetImpliedBlock->pn_pos = forLoop->pn_pos; - ParseNode *let = handler.newBinary(PNK_LET, forLetDecl, forLetImpliedBlock); + ParseNode* let = handler.newBinary(PNK_LET, forLetDecl, forLetImpliedBlock); if (!let) return null(); let->pn_pos = forLoop->pn_pos; @@ -4641,9 +4641,9 @@ Parser::continueStatement() if (!matchLabel(&label)) return null(); - StmtInfoPC *stmt = pc->topStmt; + StmtInfoPC* stmt = pc->topStmt; if (label) { - for (StmtInfoPC *stmt2 = nullptr; ; stmt = stmt->down) { + for (StmtInfoPC* stmt2 = nullptr; ; stmt = stmt->down) { if (!stmt) { report(ParseError, false, null(), JSMSG_LABEL_NOT_FOUND); return null(); @@ -4687,7 +4687,7 @@ Parser::breakStatement() RootedPropertyName label(context); if (!matchLabel(&label)) return null(); - StmtInfoPC *stmt = pc->topStmt; + StmtInfoPC* stmt = pc->topStmt; if (label) { for (; ; stmt = stmt->down) { if (!stmt) { @@ -4863,7 +4863,7 @@ Parser::yieldExpression() } template <> -ParseNode * +ParseNode* Parser::withStatement() { // test262/ch12/12.10/12.10-0-1.js fails if we try to parse with-statements @@ -4897,7 +4897,7 @@ Parser::withStatement() StmtInfoPC stmtInfo(context); PushStatementPC(pc, &stmtInfo, STMT_WITH); - Rooted staticWith(context, StaticWithObject::create(context)); + Rooted staticWith(context, StaticWithObject::create(context)); if (!staticWith) return null(); staticWith->initEnclosingNestedScopeFromParser(pc->staticScope); @@ -4922,7 +4922,7 @@ Parser::withStatement() handler.deoptimizeUsesWithin(lexdep, TokenPos(begin, pos().begin)); } - ObjectBox *staticWithBox = newObjectBox(staticWith); + ObjectBox* staticWithBox = newObjectBox(staticWith); if (!staticWithBox) return null(); return handler.newWithStatement(begin, objectExpr, innerBlock, staticWithBox); @@ -4942,7 +4942,7 @@ Parser::labeledStatement() { uint32_t begin = pos().begin; RootedPropertyName label(context, tokenStream.currentName()); - for (StmtInfoPC *stmt = pc->topStmt; stmt; stmt = stmt->down) { + for (StmtInfoPC* stmt = pc->topStmt; stmt; stmt = stmt->down) { if (stmt->type == STMT_LABEL && stmt->label == label) { report(ParseError, false, null(), JSMSG_DUPLICATE_LABEL); return null(); @@ -5486,7 +5486,7 @@ Parser::condExpr1() template <> bool -Parser::checkAndMarkAsAssignmentLhs(ParseNode *pn, AssignmentFlavor flavor) +Parser::checkAndMarkAsAssignmentLhs(ParseNode* pn, AssignmentFlavor flavor) { switch (pn->getKind()) { case PNK_NAME: @@ -5637,7 +5637,7 @@ static const char incop_name_str[][10] = {"increment", "decrement"}; template <> bool -Parser::checkAndMarkAsIncOperand(ParseNode *kid, TokenKind tt, bool preorder) +Parser::checkAndMarkAsIncOperand(ParseNode* kid, TokenKind tt, bool preorder) { // Check. if (!kid->isKind(PNK_NAME) && @@ -5789,16 +5789,16 @@ Parser::unaryExpr() */ class LegacyCompExprTransplanter { - ParseNode *root; - Parser *parser; - ParseContext *outerpc; + ParseNode* root; + Parser* parser; + ParseContext* outerpc; GeneratorKind comprehensionKind; unsigned adjust; - HashSet visitedImplicitArguments; + HashSet visitedImplicitArguments; public: - LegacyCompExprTransplanter(ParseNode *pn, Parser *parser, - ParseContext *outerpc, + LegacyCompExprTransplanter(ParseNode* pn, Parser* parser, + ParseContext* outerpc, GeneratorKind kind, unsigned adj) : root(pn), parser(parser), outerpc(outerpc), comprehensionKind(kind), adjust(adj), visitedImplicitArguments(parser->context) @@ -5808,7 +5808,7 @@ class LegacyCompExprTransplanter return visitedImplicitArguments.init(); } - bool transplant(ParseNode *pn); + bool transplant(ParseNode* pn); }; /* @@ -5818,7 +5818,7 @@ class LegacyCompExprTransplanter */ template static bool -BumpStaticLevel(TokenStream &ts, ParseNode *pn, ParseContext *pc) +BumpStaticLevel(TokenStream& ts, ParseNode* pn, ParseContext* pc) { if (pn->pn_cookie.isFree()) return true; @@ -5830,7 +5830,7 @@ BumpStaticLevel(TokenStream &ts, ParseNode *pn, ParseContext *pc) template static bool -AdjustBlockId(TokenStream &ts, ParseNode *pn, unsigned adjust, ParseContext *pc) +AdjustBlockId(TokenStream& ts, ParseNode* pn, unsigned adjust, ParseContext* pc) { JS_ASSERT(pn->isArity(PN_LIST) || pn->isArity(PN_CODE) || pn->isArity(PN_NAME)); if (BlockIdLimit - pn->pn_blockid <= adjust + 1) { @@ -5844,9 +5844,9 @@ AdjustBlockId(TokenStream &ts, ParseNode *pn, unsigned adjust, ParseContext *pc = parser->pc; + ParseContext* pc = parser->pc; bool isGenexp = comprehensionKind != NotGenerator; @@ -5855,7 +5855,7 @@ LegacyCompExprTransplanter::transplant(ParseNode *pn) switch (pn->getArity()) { case PN_LIST: - for (ParseNode *pn2 = pn->pn_head; pn2; pn2 = pn2->pn_next) { + for (ParseNode* pn2 = pn->pn_head; pn2; pn2 = pn2->pn_next) { if (!transplant(pn2)) return false; } @@ -5900,7 +5900,7 @@ LegacyCompExprTransplanter::transplant(ParseNode *pn) } else if (pn->isUsed()) { JS_ASSERT(pn->pn_cookie.isFree()); - Definition *dn = pn->pn_lexdef; + Definition* dn = pn->pn_lexdef; JS_ASSERT(dn->isDefn()); /* @@ -5921,7 +5921,7 @@ LegacyCompExprTransplanter::transplant(ParseNode *pn) RootedAtom atom(parser->context, pn->pn_atom); #ifdef DEBUG - StmtInfoPC *stmt = LexicalLookup(pc, atom, nullptr, (StmtInfoPC *)nullptr); + StmtInfoPC* stmt = LexicalLookup(pc, atom, nullptr, (StmtInfoPC*)nullptr); JS_ASSERT(!stmt || stmt != pc->topStmt); #endif if (isGenexp && !dn->isOp(JSOP_CALLEE)) { @@ -5936,7 +5936,7 @@ LegacyCompExprTransplanter::transplant(ParseNode *pn) * the generator) a use of a new placeholder in the * generator's lexdeps. */ - Definition *dn2 = parser->handler.newPlaceholder(atom, parser->pc->blockid(), + Definition* dn2 = parser->handler.newPlaceholder(atom, parser->pc->blockid(), parser->pos()); if (!dn2) return false; @@ -5946,8 +5946,8 @@ LegacyCompExprTransplanter::transplant(ParseNode *pn) * Change all uses of |dn| that lie within the generator's * |yield| expression into uses of dn2. */ - ParseNode **pnup = &dn->dn_uses; - ParseNode *pnu; + ParseNode** pnup = &dn->dn_uses; + ParseNode* pnu; while ((pnu = *pnup) != nullptr && pnu->pn_pos >= root->pn_pos) { pnu->pn_lexdef = dn2; dn2->pn_dflags |= pnu->pn_dflags & PND_USE2DEF_FLAGS; @@ -6024,7 +6024,7 @@ LegacyCompExprTransplanter::transplant(ParseNode *pn) // template static unsigned -LegacyComprehensionHeadBlockScopeDepth(ParseContext *pc) +LegacyComprehensionHeadBlockScopeDepth(ParseContext* pc) { return pc->topStmt ? pc->topStmt->innerBlockScopeDepth : pc->blockScopeDepth; } @@ -6039,10 +6039,10 @@ LegacyComprehensionHeadBlockScopeDepth(ParseContext *pc) * (possibly nested) for-loop, initialized by |kind, op, kid|. */ template <> -ParseNode * -Parser::legacyComprehensionTail(ParseNode *bodyStmt, unsigned blockid, +ParseNode* +Parser::legacyComprehensionTail(ParseNode* bodyStmt, unsigned blockid, GeneratorKind comprehensionKind, - ParseContext *outerpc, + ParseContext* outerpc, unsigned innerBlockScopeDepth) { /* @@ -6058,7 +6058,7 @@ Parser::legacyComprehensionTail(ParseNode *bodyStmt, unsigned } unsigned adjust; - ParseNode *pn, *pn2, *pn3, **pnp; + ParseNode* pn, *pn2, *pn3, **pnp; StmtInfoPC stmtInfo(context); BindData data(context); TokenKind tt; @@ -6186,7 +6186,7 @@ Parser::legacyComprehensionTail(ParseNode *bodyStmt, unsigned headKind = PNK_FOROF; } - ParseNode *pn4 = expr(); + ParseNode* pn4 = expr(); if (!pn4) return null(); MUST_MATCH_TOKEN(TOK_RP, JSMSG_PAREN_AFTER_FOR_CTRL); @@ -6233,7 +6233,7 @@ Parser::legacyComprehensionTail(ParseNode *bodyStmt, unsigned * Synthesize a declaration. Every definition must appear in the parse * tree in order for ComprehensionTranslator to work. */ - ParseNode *vars = ListNode::create(PNK_VAR, &handler); + ParseNode* vars = ListNode::create(PNK_VAR, &handler); if (!vars) return null(); vars->setOp(JSOP_NOP); @@ -6279,7 +6279,7 @@ SyntaxParseHandler::Node Parser::legacyComprehensionTail(SyntaxParseHandler::Node bodyStmt, unsigned blockid, GeneratorKind comprehensionKind, - ParseContext *outerpc, + ParseContext* outerpc, unsigned innerBlockScopeDepth) { abortIfSyntaxParser(); @@ -6288,24 +6288,24 @@ Parser::legacyComprehensionTail(SyntaxParseHandler::Node bod template <> ParseNode* -Parser::legacyArrayComprehension(ParseNode *array) +Parser::legacyArrayComprehension(ParseNode* array) { array->setKind(PNK_ARRAYCOMP); // Remove the single element from array's linked list, leaving us with an // empty array literal and a comprehension expression. JS_ASSERT(array->pn_count == 1); - ParseNode *bodyExpr = array->last(); + ParseNode* bodyExpr = array->last(); array->pn_count = 0; array->pn_tail = &array->pn_head; *array->pn_tail = nullptr; - ParseNode *arrayPush = handler.newUnary(PNK_ARRAYPUSH, JSOP_ARRAYPUSH, + ParseNode* arrayPush = handler.newUnary(PNK_ARRAYPUSH, JSOP_ARRAYPUSH, bodyExpr->pn_pos.begin, bodyExpr); if (!arrayPush) return null(); - ParseNode *comp = legacyComprehensionTail(arrayPush, array->pn_blockid, NotGenerator, + ParseNode* comp = legacyComprehensionTail(arrayPush, array->pn_blockid, NotGenerator, nullptr, LegacyComprehensionHeadBlockScopeDepth(pc)); if (!comp) return null(); @@ -6338,14 +6338,14 @@ Parser::generatorComprehensionLambda(GeneratorKind comprehensionKi return null(); handler.setOp(genfn, JSOP_LAMBDA); - ParseContext *outerpc = pc; + ParseContext* outerpc = pc; // If we are off the main thread, the generator meta-objects have // already been created by js::StartOffThreadParseScript, so cx will not // be necessary. RootedObject proto(context); if (comprehensionKind == StarGenerator) { - JSContext *cx = context->maybeJSContext(); + JSContext* cx = context->maybeJSContext(); proto = GlobalObject::getOrCreateStarGeneratorFunctionPrototype(cx, context->global()); if (!proto) return null(); @@ -6357,7 +6357,7 @@ Parser::generatorComprehensionLambda(GeneratorKind comprehensionKi // Create box for fun->object early to root it. Directives directives(/* strict = */ outerpc->sc->strict); - FunctionBox *genFunbox = newFunctionBox(genfn, fun, outerpc, directives, comprehensionKind); + FunctionBox* genFunbox = newFunctionBox(genfn, fun, outerpc, directives, comprehensionKind); if (!genFunbox) return null(); @@ -6436,24 +6436,24 @@ Parser::generatorComprehensionLambda(GeneratorKind comprehensionKi * is merely sugar for a generator function expression and its application. */ template <> -ParseNode * -Parser::legacyGeneratorExpr(ParseNode *expr) +ParseNode* +Parser::legacyGeneratorExpr(ParseNode* expr) { JS_ASSERT(tokenStream.isCurrentTokenType(TOK_FOR)); /* Create a |yield| node for |kid|. */ - ParseNode *yieldExpr = handler.newUnary(PNK_YIELD, JSOP_NOP, expr->pn_pos.begin, expr); + ParseNode* yieldExpr = handler.newUnary(PNK_YIELD, JSOP_NOP, expr->pn_pos.begin, expr); if (!yieldExpr) return null(); yieldExpr->setInParens(true); // A statement to wrap the yield expression. - ParseNode *yieldStmt = handler.newExprStatement(yieldExpr, expr->pn_pos.end); + ParseNode* yieldStmt = handler.newExprStatement(yieldExpr, expr->pn_pos.end); if (!yieldStmt) return null(); /* Make a new node for the desugared generator function. */ - ParseNode *genfn = generatorComprehensionLambda(LegacyGenerator, expr->pn_pos.begin, yieldStmt); + ParseNode* genfn = generatorComprehensionLambda(LegacyGenerator, expr->pn_pos.begin, yieldStmt); if (!genfn) return null(); @@ -6461,7 +6461,7 @@ Parser::legacyGeneratorExpr(ParseNode *expr) * Our result is a call expression that invokes the anonymous generator * function object. */ - ParseNode *result = ListNode::create(PNK_GENEXP, &handler); + ParseNode* result = ListNode::create(PNK_GENEXP, &handler); if (!result) return null(); result->setOp(JSOP_CALL); @@ -6696,7 +6696,7 @@ Parser::assignExprWithoutYield(unsigned msg) template bool -Parser::argumentList(Node listNode, bool *isSpread) +Parser::argumentList(Node listNode, bool* isSpread) { if (tokenStream.matchToken(TOK_RP, TokenStream::Operand)) { handler.setEndPosition(listNode, pos().end); @@ -6801,7 +6801,7 @@ Parser::memberExpr(TokenKind tt, bool allowCallSyntax) if (tt == TOK_ERROR) return null(); if (tt == TOK_NAME) { - PropertyName *field = tokenStream.currentName(); + PropertyName* field = tokenStream.currentName(); nextMember = handler.newPropertyAccess(lhs, field, pos().end); if (!nextMember) return null(); @@ -6825,7 +6825,7 @@ Parser::memberExpr(TokenKind tt, bool allowCallSyntax) if (!nextMember) return null(); - if (JSAtom *atom = handler.isName(lhs)) { + if (JSAtom* atom = handler.isName(lhs)) { if (atom == context->names().eval) { /* Select JSOP_EVAL and flag pc as heavyweight. */ op = JSOP_EVAL; @@ -6838,7 +6838,7 @@ Parser::memberExpr(TokenKind tt, bool allowCallSyntax) if (pc->sc->isFunctionBox() && !pc->sc->strict) pc->sc->asFunctionBox()->setHasExtensibleScope(); } - } else if (JSAtom *atom = handler.isGetProp(lhs)) { + } else if (JSAtom* atom = handler.isGetProp(lhs)) { /* Select JSOP_FUNAPPLY given foo.apply(...). */ if (atom == context->names().apply) { op = JSOP_FUNAPPLY; @@ -6872,7 +6872,7 @@ Parser::memberExpr(TokenKind tt, bool allowCallSyntax) template typename ParseHandler::Node -Parser::newName(PropertyName *name) +Parser::newName(PropertyName* name) { return handler.newName(name, pc->blockid(), pos()); } @@ -6896,7 +6896,7 @@ template typename ParseHandler::Node Parser::stringLiteral() { - JSAtom *atom = tokenStream.currentToken().atom(); + JSAtom* atom = tokenStream.currentToken().atom(); // Large strings are fast to parse but slow to compress. Stop compression on // them, so we don't wait for a long time for compression to finish at the @@ -6913,12 +6913,12 @@ typename ParseHandler::Node Parser::newRegExp() { // Create the regexp even when doing a syntax parse, to check the regexp's syntax. - const jschar *chars = tokenStream.getTokenbuf().begin(); + const jschar* chars = tokenStream.getTokenbuf().begin(); size_t length = tokenStream.getTokenbuf().length(); RegExpFlag flags = tokenStream.currentToken().regExpFlags(); Rooted reobj(context); - if (RegExpStatics *res = context->global()->getRegExpStatics()) + if (RegExpStatics* res = context->global()->getRegExpStatics()) reobj = RegExpObject::create(context, res, chars, length, flags, &tokenStream); else reobj = RegExpObject::createNoStatics(context, chars, length, flags, &tokenStream); @@ -7050,7 +7050,7 @@ Parser::arrayInitializer() } static JSAtom* -DoubleToAtom(ExclusiveContext *cx, double value) +DoubleToAtom(ExclusiveContext* cx, double value) { // This is safe because doubles can not be moved. Value tmp = DoubleValue(value); @@ -7205,7 +7205,7 @@ Parser::objectLiteral() tokenStream.ungetToken(); if (!tokenStream.checkForKeyword(atom->charsZ(), atom->length(), nullptr)) return null(); - PropertyName *name = handler.isName(propname); + PropertyName* name = handler.isName(propname); JS_ASSERT(atom); propname = newName(name); if (!propname) diff --git a/js/src/frontend/Parser.h b/js/src/frontend/Parser.h index d0986ed2da..a1767c392a 100644 --- a/js/src/frontend/Parser.h +++ b/js/src/frontend/Parser.h @@ -24,27 +24,27 @@ namespace js { namespace frontend { struct StmtInfoPC : public StmtInfoBase { - StmtInfoPC *down; /* info for enclosing statement */ - StmtInfoPC *downScope; /* next enclosing lexical scope */ + StmtInfoPC* down; /* info for enclosing statement */ + StmtInfoPC* downScope; /* next enclosing lexical scope */ uint32_t blockid; /* for simplified dominance computation */ uint32_t innerBlockScopeDepth; /* maximum depth of nested block scopes, in slots */ - StmtInfoPC(ExclusiveContext *cx) : StmtInfoBase(cx), innerBlockScopeDepth(0) {} + StmtInfoPC(ExclusiveContext* cx) : StmtInfoBase(cx), innerBlockScopeDepth(0) {} }; -typedef HashSet FuncStmtSet; +typedef HashSet FuncStmtSet; class SharedContext; -typedef Vector DeclVector; +typedef Vector DeclVector; struct GenericParseContext { // Enclosing function or global context. - GenericParseContext *parent; + GenericParseContext* parent; // Context shared between parsing and bytecode generation. - SharedContext *sc; + SharedContext* sc; // The following flags are set when a particular code feature is detected // in a function. @@ -65,7 +65,7 @@ struct GenericParseContext // chain (which stops at the top-level or an eval() bool parsingWith:1; - GenericParseContext(GenericParseContext *parent, SharedContext *sc) + GenericParseContext(GenericParseContext* parent, SharedContext* sc) : parent(parent), sc(sc), funHasReturnExpr(false), @@ -77,7 +77,7 @@ struct GenericParseContext template bool -GenerateBlockId(TokenStream &ts, ParseContext *pc, uint32_t &blockid); +GenerateBlockId(TokenStream& ts, ParseContext* pc, uint32_t& blockid); /* * The struct ParseContext stores information about the current parsing context, @@ -97,9 +97,9 @@ struct ParseContext : public GenericParseContext uint32_t bodyid; /* block number of program/function body */ uint32_t blockidGen; /* preincremented block number generator */ - StmtInfoPC *topStmt; /* top of statement info stack */ - StmtInfoPC *topScopeStmt; /* top lexical scope statement */ - Rooted staticScope; /* compile time scope chain */ + StmtInfoPC* topStmt; /* top of statement info stack */ + StmtInfoPC* topScopeStmt; /* top lexical scope statement */ + Rooted staticScope; /* compile time scope chain */ Node maybeFunction; /* sc->isFunctionBox, the pn where pn->pn_funbox == sc */ const unsigned staticLevel; /* static compilation unit nesting level */ @@ -132,7 +132,7 @@ struct ParseContext : public GenericParseContext DeclVector vars_; /* var/const definitions */ public: - const AtomDecls &decls() const { + const AtomDecls& decls() const { return decls_; } @@ -167,7 +167,7 @@ struct ParseContext : public GenericParseContext * 'pn' if they are in the scope of 'pn'. * + Pre-existing placeholders in the scope of 'pn' have been removed. */ - bool define(TokenStream &ts, HandlePropertyName name, Node pn, Definition::Kind); + bool define(TokenStream& ts, HandlePropertyName name, Node pn, Definition::Kind); /* * Let definitions may shadow same-named definitions in enclosing scopes. @@ -177,13 +177,13 @@ struct ParseContext : public GenericParseContext * top of the stack, and leaving a block scope calls popLetDecl for each * name in the block's scope. */ - void popLetDecl(JSAtom *atom); + void popLetDecl(JSAtom* atom); /* See the sad story in defineArg. */ void prepareToAddDuplicateArg(HandlePropertyName name, DefinitionNode prevDecl); /* See the sad story in MakeDefIntoUse. */ - void updateDecl(JSAtom *atom, Node newDecl); + void updateDecl(JSAtom* atom, Node newDecl); /* * After a function body has been parsed, the parser generates the @@ -199,24 +199,24 @@ struct ParseContext : public GenericParseContext * - Sometimes a script's bindings are accessed at runtime to retrieve the * contents of the lexical scope (e.g., from the debugger). */ - bool generateFunctionBindings(ExclusiveContext *cx, TokenStream &ts, - LifoAlloc &alloc, + bool generateFunctionBindings(ExclusiveContext* cx, TokenStream& ts, + LifoAlloc& alloc, InternalHandle bindings) const; private: - ParseContext **parserPC; /* this points to the Parser's active pc + ParseContext** parserPC; /* this points to the Parser's active pc and holds either |this| or one of |this|'s descendents */ // Value for parserPC to restore at the end. Use 'parent' instead for // information about the parse chain, this may be nullptr if // parent != nullptr. - ParseContext *oldpc; + ParseContext* oldpc; public: OwnedAtomDefnMapPtr lexdeps; /* unresolved lexical name dependencies */ - FuncStmtSet *funcStmts; /* Set of (non-top-level) function statements + FuncStmtSet* funcStmts; /* Set of (non-top-level) function statements that will alias any top-level bindings with the same name. */ @@ -228,7 +228,7 @@ struct ParseContext : public GenericParseContext // require reparsing the function. In global/module/generator-tail contexts, // we don't need to reparse when encountering a DirectivePrologue so this // pointer may be nullptr. - Directives *newDirectives; + Directives* newDirectives; // Set when parsing a declaration-like destructuring pattern. This flag // causes PrimaryExpr to create PN_NAME parse nodes for variable references @@ -241,9 +241,9 @@ struct ParseContext : public GenericParseContext // they need to be treated differently. bool inDeclDestructuring:1; - ParseContext(Parser *prs, GenericParseContext *parent, - Node maybeFunction, SharedContext *sc, - Directives *newDirectives, + ParseContext(Parser* prs, GenericParseContext* parent, + Node maybeFunction, SharedContext* sc, + Directives* newDirectives, unsigned staticLevel, uint32_t bodyid, uint32_t blockScopeDepth) : GenericParseContext(parent, sc), bodyid(0), // initialized in init() @@ -272,7 +272,7 @@ struct ParseContext : public GenericParseContext ~ParseContext(); - bool init(TokenStream &ts); + bool init(TokenStream& ts); unsigned blockid() { return topStmt ? topStmt->blockid : bodyid; } @@ -298,7 +298,7 @@ struct ParseContext : public GenericParseContext template inline -Directives::Directives(ParseContext *parent) +Directives::Directives(ParseContext* parent) : strict_(parent->sc->strict), asmJS_(parent->useAsmOrInsideUseAsm()) {} @@ -316,22 +316,22 @@ template class Parser : private AutoGCRooter, public StrictModeGetter { public: - ExclusiveContext *const context; - LifoAlloc &alloc; + ExclusiveContext* const context; + LifoAlloc& alloc; TokenStream tokenStream; LifoAlloc::Mark tempPoolMark; /* list of parsed objects for GC tracing */ - ObjectBox *traceListHead; + ObjectBox* traceListHead; /* innermost parse context (stack-allocated) */ - ParseContext *pc; + ParseContext* pc; /* Compression token for aborting. */ - SourceCompressionTask *sct; + SourceCompressionTask* sct; - ScriptSource *ss; + ScriptSource* ss; /* Root atoms and objects allocated for the parsed tree. */ AutoKeepAtoms keepAtoms; @@ -366,10 +366,10 @@ class Parser : private AutoGCRooter, public StrictModeGetter bool reportWithOffset(ParseReportKind kind, bool strict, uint32_t offset, unsigned errorNumber, ...); - Parser(ExclusiveContext *cx, LifoAlloc *alloc, const ReadOnlyCompileOptions &options, - const jschar *chars, size_t length, bool foldConstants, - Parser *syntaxParser, - LazyScript *lazyOuterFunction); + Parser(ExclusiveContext* cx, LifoAlloc* alloc, const ReadOnlyCompileOptions& options, + const jschar* chars, size_t length, bool foldConstants, + Parser* syntaxParser, + LazyScript* lazyOuterFunction); ~Parser(); // A Parser::Mark is the extension of the LifoAlloc::Mark to the entire @@ -379,7 +379,7 @@ class Parser : private AutoGCRooter, public StrictModeGetter { friend class Parser; LifoAlloc::Mark mark; - ObjectBox *traceListHead; + ObjectBox* traceListHead; }; Mark mark() const { Mark m; @@ -392,32 +392,32 @@ class Parser : private AutoGCRooter, public StrictModeGetter traceListHead = m.traceListHead; } - friend void js::frontend::MarkParser(JSTracer *trc, AutoGCRooter *parser); + friend void js::frontend::MarkParser(JSTracer* trc, AutoGCRooter* parser); - const char *getFilename() const { return tokenStream.getFilename(); } + const char* getFilename() const { return tokenStream.getFilename(); } JSVersion versionNumber() const { return tokenStream.versionNumber(); } /* * Parse a top-level JS script. */ - Node parse(JSObject *chain); + Node parse(JSObject* chain); /* * Allocate a new parsed object or function container from * cx->tempLifoAlloc. */ - ObjectBox *newObjectBox(JSObject *obj); - FunctionBox *newFunctionBox(Node fn, JSFunction *fun, ParseContext *pc, + ObjectBox* newObjectBox(JSObject* obj); + FunctionBox* newFunctionBox(Node fn, JSFunction* fun, ParseContext* pc, Directives directives, GeneratorKind generatorKind); /* * Create a new function object given parse context (pc) and a name (which * is optional if this is a function expression). */ - JSFunction *newFunction(GenericParseContext *pc, HandleAtom atom, FunctionSyntaxKind kind, - JSObject *proto = nullptr); + JSFunction* newFunction(GenericParseContext* pc, HandleAtom atom, FunctionSyntaxKind kind, + JSObject* proto = nullptr); - void trace(JSTracer *trc); + void trace(JSTracer* trc); bool hadAbortedSyntaxParse() { return abortedSyntaxParse; @@ -429,10 +429,10 @@ class Parser : private AutoGCRooter, public StrictModeGetter bool isUnexpectedEOF() const { return isUnexpectedEOF_; } private: - Parser *thisForCtor() { return this; } + Parser* thisForCtor() { return this; } Node stringLiteral(); - inline Node newName(PropertyName *name); + inline Node newName(PropertyName* name); inline bool abortIfSyntaxParser(); @@ -440,13 +440,13 @@ class Parser : private AutoGCRooter, public StrictModeGetter /* Public entry points for parsing. */ Node statement(bool canHaveDirectives = false); - bool maybeParseDirective(Node list, Node pn, bool *cont); + bool maybeParseDirective(Node list, Node pn, bool* cont); // Parse a function, given only its body. Used for the Function and // Generator constructors. - Node standaloneFunctionBody(HandleFunction fun, const AutoNameVector &formals, + Node standaloneFunctionBody(HandleFunction fun, const AutoNameVector& formals, GeneratorKind generatorKind, - Directives inheritedDirectives, Directives *newDirectives); + Directives inheritedDirectives, Directives* newDirectives); // Parse a function, given only its arguments and body. Used for lazily // parsed functions. @@ -461,7 +461,7 @@ class Parser : private AutoGCRooter, public StrictModeGetter Node functionBody(FunctionSyntaxKind kind, FunctionBodyType type); bool functionArgsAndBodyGeneric(Node pn, HandleFunction fun, FunctionType type, - FunctionSyntaxKind kind, Directives *newDirectives); + FunctionSyntaxKind kind, Directives* newDirectives); // Determine whether |yield| is a valid name in the current context, or // whether it's prohibited due to strictness, JS version, or occurrence @@ -470,7 +470,7 @@ class Parser : private AutoGCRooter, public StrictModeGetter virtual bool strictMode() { return pc->sc->strict; } - const ReadOnlyCompileOptions &options() const { + const ReadOnlyCompileOptions& options() const { return tokenStream.options(); } @@ -515,8 +515,8 @@ class Parser : private AutoGCRooter, public StrictModeGetter Node importDeclaration(); Node exportDeclaration(); Node expressionStatement(); - Node variables(ParseNodeKind kind, bool *psimple = nullptr, - StaticBlockObject *blockObj = nullptr, + Node variables(ParseNodeKind kind, bool* psimple = nullptr, + StaticBlockObject* blockObj = nullptr, VarContext varContext = HoistVars); Node expr(); Node assignExpr(); @@ -533,14 +533,14 @@ class Parser : private AutoGCRooter, public StrictModeGetter /* * Additional JS parsers. */ - bool functionArguments(FunctionSyntaxKind kind, Node *list, Node funcpn, bool *hasRest); + bool functionArguments(FunctionSyntaxKind kind, Node* list, Node funcpn, bool* hasRest); - Node functionDef(HandlePropertyName name, const TokenStream::Position &start, + Node functionDef(HandlePropertyName name, const TokenStream::Position& start, FunctionType type, FunctionSyntaxKind kind, GeneratorKind generatorKind); bool functionArgsAndBody(Node pn, HandleFunction fun, FunctionType type, FunctionSyntaxKind kind, GeneratorKind generatorKind, - Directives inheritedDirectives, Directives *newDirectives); + Directives inheritedDirectives, Directives* newDirectives); Node unaryOpExpr(ParseNodeKind kind, JSOp op, uint32_t begin); @@ -550,7 +550,7 @@ class Parser : private AutoGCRooter, public StrictModeGetter Node innerStmt); Node legacyComprehensionTail(Node kid, unsigned blockid, GeneratorKind comprehensionKind, - ParseContext *outerpc, + ParseContext* outerpc, unsigned innerBlockScopeDepth); Node legacyArrayComprehension(Node array); Node legacyGeneratorExpr(Node kid); @@ -562,9 +562,9 @@ class Parser : private AutoGCRooter, public StrictModeGetter Node arrayComprehension(uint32_t begin); Node generatorComprehension(uint32_t begin); - bool argumentList(Node listNode, bool *isSpread); + bool argumentList(Node listNode, bool* isSpread); Node letBlock(LetContext letContext); - Node destructuringExpr(BindData *data, TokenKind tt); + Node destructuringExpr(BindData* data, TokenKind tt); Node identifierName(); @@ -586,62 +586,62 @@ class Parser : private AutoGCRooter, public StrictModeGetter }; bool checkAndMarkAsAssignmentLhs(Node pn, AssignmentFlavor flavor); - bool matchInOrOf(bool *isForOfp); + bool matchInOrOf(bool* isForOfp); bool checkFunctionArguments(); - bool makeDefIntoUse(Definition *dn, Node pn, JSAtom *atom); - bool checkFunctionDefinition(HandlePropertyName funName, Node *pn, FunctionSyntaxKind kind, - bool *pbodyProcessed); - bool finishFunctionDefinition(Node pn, FunctionBox *funbox, Node prelude, Node body); - bool addFreeVariablesFromLazyFunction(JSFunction *fun, ParseContext *pc); + bool makeDefIntoUse(Definition* dn, Node pn, JSAtom* atom); + bool checkFunctionDefinition(HandlePropertyName funName, Node* pn, FunctionSyntaxKind kind, + bool* pbodyProcessed); + bool finishFunctionDefinition(Node pn, FunctionBox* funbox, Node prelude, Node body); + bool addFreeVariablesFromLazyFunction(JSFunction* fun, ParseContext* pc); bool isValidForStatementLHS(Node pn1, JSVersion version, bool forDecl, bool forEach, ParseNodeKind headKind); bool checkAndMarkAsIncOperand(Node kid, TokenKind tt, bool preorder); bool checkStrictAssignment(Node lhs, AssignmentFlavor flavor); - bool checkStrictBinding(PropertyName *name, Node pn); + bool checkStrictBinding(PropertyName* name, Node pn); bool defineArg(Node funcpn, HandlePropertyName name, - bool disallowDuplicateArgs = false, Node *duplicatedArg = nullptr); - Node pushLexicalScope(StmtInfoPC *stmt); - Node pushLexicalScope(Handle blockObj, StmtInfoPC *stmt); - Node pushLetScope(Handle blockObj, StmtInfoPC *stmt); + bool disallowDuplicateArgs = false, Node* duplicatedArg = nullptr); + Node pushLexicalScope(StmtInfoPC* stmt); + Node pushLexicalScope(Handle blockObj, StmtInfoPC* stmt); + Node pushLetScope(Handle blockObj, StmtInfoPC* stmt); bool noteNameUse(HandlePropertyName name, Node pn); Node objectLiteral(); Node arrayInitializer(); Node newRegExp(); - Node newBindingNode(PropertyName *name, bool functionScope, VarContext varContext = HoistVars); - bool checkDestructuring(BindData *data, Node left, bool toplevel = true); - bool bindDestructuringVar(BindData *data, Node pn); + Node newBindingNode(PropertyName* name, bool functionScope, VarContext varContext = HoistVars); + bool checkDestructuring(BindData* data, Node left, bool toplevel = true); + bool bindDestructuringVar(BindData* data, Node pn); bool bindDestructuringLHS(Node pn); bool makeSetCall(Node pn, unsigned msg); Node cloneLeftHandSide(Node opn); Node cloneParseTree(Node opn); - Node newNumber(const Token &tok) { + Node newNumber(const Token& tok) { return handler.newNumber(tok.number(), tok.decimalPoint(), tok.pos); } static bool - bindDestructuringArg(BindData *data, - HandlePropertyName name, Parser *parser); + bindDestructuringArg(BindData* data, + HandlePropertyName name, Parser* parser); static bool - bindLet(BindData *data, - HandlePropertyName name, Parser *parser); + bindLet(BindData* data, + HandlePropertyName name, Parser* parser); static bool - bindVarOrConst(BindData *data, - HandlePropertyName name, Parser *parser); + bindVarOrConst(BindData* data, + HandlePropertyName name, Parser* parser); static Node null() { return ParseHandler::null(); } - bool reportRedeclaration(Node pn, bool isConst, JSAtom *atom); + bool reportRedeclaration(Node pn, bool isConst, JSAtom* atom); bool reportBadReturn(Node pn, ParseReportKind kind, unsigned errnum, unsigned anonerrnum); bool checkFinalReturn(Node pn); - DefinitionNode getOrCreateLexicalDependency(ParseContext *pc, JSAtom *atom); + DefinitionNode getOrCreateLexicalDependency(ParseContext* pc, JSAtom* atom); - bool leaveFunction(Node fn, ParseContext *outerpc, + bool leaveFunction(Node fn, ParseContext* outerpc, FunctionSyntaxKind kind = Expression); TokenPos pos() const { return tokenStream.currentToken().pos; } @@ -656,7 +656,7 @@ class Parser : private AutoGCRooter, public StrictModeGetter template <> bool -Parser::checkAndMarkAsAssignmentLhs(ParseNode *pn, AssignmentFlavor flavor); +Parser::checkAndMarkAsAssignmentLhs(ParseNode* pn, AssignmentFlavor flavor); template <> bool diff --git a/js/src/frontend/SharedContext.h b/js/src/frontend/SharedContext.h index d0d1fe2ffb..52be1b5cf7 100644 --- a/js/src/frontend/SharedContext.h +++ b/js/src/frontend/SharedContext.h @@ -142,7 +142,7 @@ class Directives public: explicit Directives(bool strict) : strict_(strict), asmJS_(false) {} - template explicit Directives(ParseContext *parent); + template explicit Directives(ParseContext* parent); void setStrict() { strict_ = true; } bool strict() const { return strict_; } @@ -150,15 +150,15 @@ class Directives void setAsmJS() { asmJS_ = true; } bool asmJS() const { return asmJS_; } - Directives &operator=(Directives rhs) { + Directives& operator=(Directives rhs) { strict_ = rhs.strict_; asmJS_ = rhs.asmJS_; return *this; } - bool operator==(const Directives &rhs) const { + bool operator==(const Directives& rhs) const { return strict_ == rhs.strict_ && asmJS_ == rhs.asmJS_; } - bool operator!=(const Directives &rhs) const { + bool operator!=(const Directives& rhs) const { return !(*this == rhs); } }; @@ -172,25 +172,25 @@ class Directives class SharedContext { public: - ExclusiveContext *const context; + ExclusiveContext* const context; AnyContextFlags anyCxFlags; bool strict; bool extraWarnings; // If it's function code, funbox must be non-nullptr and scopeChain must be // nullptr. If it's global code, funbox must be nullptr. - SharedContext(ExclusiveContext *cx, Directives directives, bool extraWarnings) + SharedContext(ExclusiveContext* cx, Directives directives, bool extraWarnings) : context(cx), anyCxFlags(), strict(directives.strict()), extraWarnings(extraWarnings) {} - virtual ObjectBox *toObjectBox() = 0; + virtual ObjectBox* toObjectBox() = 0; inline bool isGlobalSharedContext() { return toObjectBox() == nullptr; } inline bool isFunctionBox() { return toObjectBox() && toObjectBox()->isFunctionBox(); } - inline GlobalSharedContext *asGlobalSharedContext(); - inline FunctionBox *asFunctionBox(); + inline GlobalSharedContext* asGlobalSharedContext(); + inline FunctionBox* asFunctionBox(); bool hasExplicitUseStrict() const { return anyCxFlags.hasExplicitUseStrict; } bool bindingsAccessedDynamically() const { return anyCxFlags.bindingsAccessedDynamically; } @@ -214,17 +214,17 @@ class GlobalSharedContext : public SharedContext const RootedObject scopeChain_; /* scope chain object for the script */ public: - GlobalSharedContext(ExclusiveContext *cx, JSObject *scopeChain, + GlobalSharedContext(ExclusiveContext* cx, JSObject* scopeChain, Directives directives, bool extraWarnings) : SharedContext(cx, directives, extraWarnings), scopeChain_(cx, scopeChain) {} - ObjectBox *toObjectBox() { return nullptr; } - JSObject *scopeChain() const { return scopeChain_; } + ObjectBox* toObjectBox() { return nullptr; } + JSObject* scopeChain() const { return scopeChain_; } }; -inline GlobalSharedContext * +inline GlobalSharedContext* SharedContext::asGlobalSharedContext() { JS_ASSERT(isGlobalSharedContext()); @@ -255,12 +255,12 @@ class FunctionBox : public ObjectBox, public SharedContext FunctionContextFlags funCxFlags; template - FunctionBox(ExclusiveContext *cx, ObjectBox* traceListHead, JSFunction *fun, - ParseContext *pc, Directives directives, + FunctionBox(ExclusiveContext* cx, ObjectBox* traceListHead, JSFunction* fun, + ParseContext* pc, Directives directives, bool extraWarnings, GeneratorKind generatorKind); - ObjectBox *toObjectBox() { return this; } - JSFunction *function() const { return &object->as(); } + ObjectBox* toObjectBox() { return this; } + JSFunction* function() const { return &object->as(); } GeneratorKind generatorKind() const { return GeneratorKindFromBits(generatorKindBits_); } bool isGenerator() const { return generatorKind() != NotGenerator; } @@ -298,7 +298,7 @@ class FunctionBox : public ObjectBox, public SharedContext return useAsm || insideUseAsm; } - void setStart(const TokenStream &tokenStream) { + void setStart(const TokenStream& tokenStream) { bufStart = tokenStream.currentToken().pos.begin; startLine = tokenStream.getLineno(); startColumn = tokenStream.getColumn(); @@ -314,7 +314,7 @@ class FunctionBox : public ObjectBox, public SharedContext } }; -inline FunctionBox * +inline FunctionBox* SharedContext::asFunctionBox() { JS_ASSERT(isFunctionBox()); @@ -408,9 +408,9 @@ struct StmtInfoBase { // Compile-time scope chain node for this scope. Only set if // isNestedScope. - Rooted staticScope; + Rooted staticScope; - StmtInfoBase(ExclusiveContext *cx) + StmtInfoBase(ExclusiveContext* cx) : isBlockScope(false), isNestedScope(false), isForLetBlock(false), label(cx), staticScope(cx) {} @@ -441,7 +441,7 @@ struct StmtInfoBase { // Push the C-stack-allocated struct at stmt onto the StmtInfoPC stack. template void -PushStatement(ContextT *ct, typename ContextT::StmtInfo *stmt, StmtType type) +PushStatement(ContextT* ct, typename ContextT::StmtInfo* stmt, StmtType type) { stmt->type = type; stmt->isBlockScope = false; @@ -461,7 +461,7 @@ PushStatement(ContextT *ct, typename ContextT::StmtInfo *stmt, StmtType type) template void -FinishPushNestedScope(ContextT *ct, typename ContextT::StmtInfo *stmt, NestedScopeObject &staticScope) +FinishPushNestedScope(ContextT* ct, typename ContextT::StmtInfo* stmt, NestedScopeObject& staticScope) { stmt->isNestedScope = true; stmt->downScope = ct->topScopeStmt; @@ -475,9 +475,9 @@ FinishPushNestedScope(ContextT *ct, typename ContextT::StmtInfo *stmt, NestedSco // template matching work. template void -FinishPopStatement(ContextT *ct) +FinishPopStatement(ContextT* ct) { - typename ContextT::StmtInfo *stmt = ct->topStmt; + typename ContextT::StmtInfo* stmt = ct->topStmt; ct->topStmt = stmt->down; if (stmt->linksScope()) { ct->topScopeStmt = stmt->downScope; @@ -503,8 +503,8 @@ FinishPopStatement(ContextT *ct) * found. Otherwise return null. */ template -typename ContextT::StmtInfo * -LexicalLookup(ContextT *ct, HandleAtom atom, int *slotp, typename ContextT::StmtInfo *stmt); +typename ContextT::StmtInfo* +LexicalLookup(ContextT* ct, HandleAtom atom, int* slotp, typename ContextT::StmtInfo* stmt); } // namespace frontend diff --git a/js/src/frontend/SourceNotes.h b/js/src/frontend/SourceNotes.h index 1d3c614046..ead026832b 100644 --- a/js/src/frontend/SourceNotes.h +++ b/js/src/frontend/SourceNotes.h @@ -84,13 +84,13 @@ static_assert(SRC_XDELTA == 24, "SRC_XDELTA should be 24"); /* A source note array is terminated by an all-zero element. */ inline void -SN_MAKE_TERMINATOR(jssrcnote *sn) +SN_MAKE_TERMINATOR(jssrcnote* sn) { *sn = SRC_NULL; } inline bool -SN_IS_TERMINATOR(jssrcnote *sn) +SN_IS_TERMINATOR(jssrcnote* sn) { return *sn == SRC_NULL; } @@ -156,17 +156,17 @@ SN_IS_TERMINATOR(jssrcnote *sn) #define SN_NEXT(sn) ((sn) + SN_LENGTH(sn)) struct JSSrcNoteSpec { - const char *name; /* name for disassembly/debugging output */ + const char* name; /* name for disassembly/debugging output */ int8_t arity; /* number of offset operands */ }; extern JS_FRIEND_DATA(const JSSrcNoteSpec) js_SrcNoteSpec[]; -extern JS_FRIEND_API(unsigned) js_SrcNoteLength(jssrcnote *sn); +extern JS_FRIEND_API(unsigned) js_SrcNoteLength(jssrcnote* sn); /* * Get and set the offset operand identified by which (0 for the first, etc.). */ extern JS_FRIEND_API(ptrdiff_t) -js_GetSrcNoteOffset(jssrcnote *sn, unsigned which); +js_GetSrcNoteOffset(jssrcnote* sn, unsigned which); #endif /* frontend_SourceNotes_h */ diff --git a/js/src/frontend/SyntaxParseHandler.h b/js/src/frontend/SyntaxParseHandler.h index 1fea556af9..2be9e168a9 100644 --- a/js/src/frontend/SyntaxParseHandler.h +++ b/js/src/frontend/SyntaxParseHandler.h @@ -29,9 +29,9 @@ class Parser; class SyntaxParseHandler { // Remember the last encountered name or string literal during syntax parses. - JSAtom *lastAtom; + JSAtom* lastAtom; TokenPos lastStringPos; - TokenStream &tokenStream; + TokenStream& tokenStream; public: enum Node { @@ -45,41 +45,41 @@ class SyntaxParseHandler }; typedef Definition::Kind DefinitionNode; - SyntaxParseHandler(ExclusiveContext *cx, LifoAlloc &alloc, - TokenStream &tokenStream, bool foldConstants, - Parser *syntaxParser, LazyScript *lazyOuterFunction) + SyntaxParseHandler(ExclusiveContext* cx, LifoAlloc& alloc, + TokenStream& tokenStream, bool foldConstants, + Parser* syntaxParser, LazyScript* lazyOuterFunction) : lastAtom(nullptr), tokenStream(tokenStream) {} static Node null() { return NodeFailure; } - void trace(JSTracer *trc) {} + void trace(JSTracer* trc) {} - Node newName(PropertyName *name, uint32_t blockid, const TokenPos &pos) { + Node newName(PropertyName* name, uint32_t blockid, const TokenPos& pos) { lastAtom = name; return NodeName; } - DefinitionNode newPlaceholder(JSAtom *atom, uint32_t blockid, const TokenPos &pos) { + DefinitionNode newPlaceholder(JSAtom* atom, uint32_t blockid, const TokenPos& pos) { return Definition::PLACEHOLDER; } - Node newIdentifier(JSAtom *atom, const TokenPos &pos) { return NodeString; } - Node newNumber(double value, DecimalPoint decimalPoint, const TokenPos &pos) { return NodeGeneric; } - Node newBooleanLiteral(bool cond, const TokenPos &pos) { return NodeGeneric; } + Node newIdentifier(JSAtom* atom, const TokenPos& pos) { return NodeString; } + Node newNumber(double value, DecimalPoint decimalPoint, const TokenPos& pos) { return NodeGeneric; } + Node newBooleanLiteral(bool cond, const TokenPos& pos) { return NodeGeneric; } - Node newStringLiteral(JSAtom *atom, const TokenPos &pos) { + Node newStringLiteral(JSAtom* atom, const TokenPos& pos) { lastAtom = atom; lastStringPos = pos; return NodeString; } - Node newThisLiteral(const TokenPos &pos) { return NodeGeneric; } - Node newNullLiteral(const TokenPos &pos) { return NodeGeneric; } + Node newThisLiteral(const TokenPos& pos) { return NodeGeneric; } + Node newNullLiteral(const TokenPos& pos) { return NodeGeneric; } template - Node newRegExp(JSObject *reobj, const TokenPos &pos, Boxer &boxer) { return NodeGeneric; } + Node newRegExp(JSObject* reobj, const TokenPos& pos, Boxer& boxer) { return NodeGeneric; } Node newConditional(Node cond, Node thenExpr, Node elseExpr) { return NodeGeneric; } @@ -97,7 +97,7 @@ class SyntaxParseHandler return NodeGeneric; } Node newBinaryOrAppend(ParseNodeKind kind, Node left, Node right, - ParseContext *pc, JSOp op = JSOP_NOP) { + ParseContext* pc, JSOp op = JSOP_NOP) { return NodeGeneric; } @@ -107,11 +107,11 @@ class SyntaxParseHandler // Expressions - Node newArrayComprehension(Node body, unsigned blockid, const TokenPos &pos) { + Node newArrayComprehension(Node body, unsigned blockid, const TokenPos& pos) { return NodeGeneric; } Node newArrayLiteral(uint32_t begin, unsigned blockid) { return NodeGeneric; } - bool addElision(Node literal, const TokenPos &pos) { return true; } + bool addElision(Node literal, const TokenPos& pos) { return true; } bool addSpreadElement(Node literal, uint32_t begin, Node inner) { return true; } bool addArrayElement(Node literal, Node element) { return true; } @@ -123,34 +123,34 @@ class SyntaxParseHandler // Statements - Node newStatementList(unsigned blockid, const TokenPos &pos) { return NodeGeneric; } - void addStatementToList(Node list, Node stmt, ParseContext *pc) {} - Node newEmptyStatement(const TokenPos &pos) { return NodeGeneric; } + Node newStatementList(unsigned blockid, const TokenPos& pos) { return NodeGeneric; } + void addStatementToList(Node list, Node stmt, ParseContext* pc) {} + Node newEmptyStatement(const TokenPos& pos) { return NodeGeneric; } Node newExprStatement(Node expr, uint32_t end) { return expr == NodeString ? NodeStringExprStatement : NodeGeneric; } Node newIfStatement(uint32_t begin, Node cond, Node then, Node else_) { return NodeGeneric; } - Node newDoWhileStatement(Node body, Node cond, const TokenPos &pos) { return NodeGeneric; } + Node newDoWhileStatement(Node body, Node cond, const TokenPos& pos) { return NodeGeneric; } Node newWhileStatement(uint32_t begin, Node cond, Node body) { return NodeGeneric; } Node newSwitchStatement(uint32_t begin, Node discriminant, Node caseList) { return NodeGeneric; } Node newCaseOrDefault(uint32_t begin, Node expr, Node body) { return NodeGeneric; } - Node newContinueStatement(PropertyName *label, const TokenPos &pos) { return NodeGeneric; } - Node newBreakStatement(PropertyName *label, const TokenPos &pos) { return NodeGeneric; } - Node newReturnStatement(Node expr, const TokenPos &pos) { return NodeGeneric; } + Node newContinueStatement(PropertyName* label, const TokenPos& pos) { return NodeGeneric; } + Node newBreakStatement(PropertyName* label, const TokenPos& pos) { return NodeGeneric; } + Node newReturnStatement(Node expr, const TokenPos& pos) { return NodeGeneric; } - Node newLabeledStatement(PropertyName *label, Node stmt, uint32_t begin) { + Node newLabeledStatement(PropertyName* label, Node stmt, uint32_t begin) { return NodeGeneric; } - Node newThrowStatement(Node expr, const TokenPos &pos) { return NodeGeneric; } + Node newThrowStatement(Node expr, const TokenPos& pos) { return NodeGeneric; } Node newTryStatement(uint32_t begin, Node body, Node catchList, Node finallyBlock) { return NodeGeneric; } - Node newDebuggerStatement(const TokenPos &pos) { return NodeGeneric; } + Node newDebuggerStatement(const TokenPos& pos) { return NodeGeneric; } - Node newPropertyAccess(Node pn, PropertyName *name, uint32_t end) { + Node newPropertyAccess(Node pn, PropertyName* name, uint32_t end) { lastAtom = name; return NodeGetProp; } @@ -163,18 +163,18 @@ class SyntaxParseHandler void setLastFunctionArgumentDefault(Node funcpn, Node pn) {} Node newFunctionDefinition() { return NodeGeneric; } void setFunctionBody(Node pn, Node kid) {} - void setFunctionBox(Node pn, FunctionBox *funbox) {} + void setFunctionBox(Node pn, FunctionBox* funbox) {} void addFunctionArgument(Node pn, Node argpn) {} Node newForStatement(uint32_t begin, Node forHead, Node body, unsigned iflags) { return NodeGeneric; } - Node newForHead(ParseNodeKind kind, Node decls, Node lhs, Node rhs, const TokenPos &pos) { + Node newForHead(ParseNodeKind kind, Node decls, Node lhs, Node rhs, const TokenPos& pos) { return NodeGeneric; } - Node newLexicalScope(ObjectBox *blockbox) { return NodeGeneric; } + Node newLexicalScope(ObjectBox* blockbox) { return NodeGeneric; } void setLexicalScopeBody(Node block, Node body) {} bool isOperationWithoutParens(Node pn, ParseNodeKind kind) { @@ -193,7 +193,7 @@ class SyntaxParseHandler void setEndPosition(Node pn, uint32_t end) {} - void setPosition(Node pn, const TokenPos &pos) {} + void setPosition(Node pn, const TokenPos& pos) {} TokenPos getPosition(Node pn) { return tokenStream.currentToken().pos; } @@ -216,13 +216,13 @@ class SyntaxParseHandler void setPrologue(Node pn) {} bool isConstant(Node pn) { return false; } - PropertyName *isName(Node pn) { + PropertyName* isName(Node pn) { return (pn == NodeName) ? lastAtom->asPropertyName() : nullptr; } - PropertyName *isGetProp(Node pn) { + PropertyName* isGetProp(Node pn) { return (pn == NodeGetProp) ? lastAtom->asPropertyName() : nullptr; } - JSAtom *isStringExprStatement(Node pn, TokenPos *pos) { + JSAtom* isStringExprStatement(Node pn, TokenPos* pos) { if (pn == NodeStringExprStatement) { *pos = lastStringPos; return lastAtom; @@ -236,7 +236,7 @@ class SyntaxParseHandler static Definition::Kind getDefinitionKind(DefinitionNode dn) { return dn; } void linkUseToDef(Node pn, DefinitionNode dn) {} DefinitionNode resolve(DefinitionNode dn) { return dn; } - void deoptimizeUsesWithin(DefinitionNode dn, const TokenPos &pos) {} + void deoptimizeUsesWithin(DefinitionNode dn, const TokenPos& pos) {} bool dependencyCovered(Node pn, unsigned blockid, bool functionScope) { // Only resolve lexical dependencies in cases where a definition covers // the entire function. Not enough information is kept to compare the diff --git a/js/src/frontend/TokenStream.cpp b/js/src/frontend/TokenStream.cpp index 106fb86782..97f233f732 100644 --- a/js/src/frontend/TokenStream.cpp +++ b/js/src/frontend/TokenStream.cpp @@ -36,7 +36,7 @@ using mozilla::PodCopy; using mozilla::PodZero; struct KeywordInfo { - const char *chars; // C string with keyword text + const char* chars; // C string with keyword text TokenKind tokentype; JSVersion version; }; @@ -50,14 +50,14 @@ static const KeywordInfo keywords[] = { // Returns a KeywordInfo for the specified characters, or nullptr if the string // is not a keyword. -static const KeywordInfo * -FindKeyword(const jschar *s, size_t length) +static const KeywordInfo* +FindKeyword(const jschar* s, size_t length) { JS_ASSERT(length != 0); size_t i; - const KeywordInfo *kw; - const char *chars; + const KeywordInfo* kw; + const char* chars; #define JSKW_LENGTH() length #define JSKW_AT(column) s[column] @@ -88,9 +88,9 @@ FindKeyword(const jschar *s, size_t length) } bool -frontend::IsIdentifier(JSLinearString *str) +frontend::IsIdentifier(JSLinearString* str) { - const jschar *chars = str->chars(); + const jschar* chars = str->chars(); size_t length = str->length(); if (length == 0) @@ -98,7 +98,7 @@ frontend::IsIdentifier(JSLinearString *str) jschar c = *chars; if (!IsIdentifierStart(c)) return false; - const jschar *end = chars + length; + const jschar* end = chars + length; while (++chars != end) { c = *chars; if (!IsIdentifierPart(c)) @@ -108,12 +108,12 @@ frontend::IsIdentifier(JSLinearString *str) } bool -frontend::IsKeyword(JSLinearString *str) +frontend::IsKeyword(JSLinearString* str) { return FindKeyword(str->chars(), str->length()) != nullptr; } -TokenStream::SourceCoords::SourceCoords(ExclusiveContext *cx, uint32_t ln) +TokenStream::SourceCoords::SourceCoords(ExclusiveContext* cx, uint32_t ln) : lineStartOffsets_(cx), initialLineNum_(ln), lastLineIndex_(0) { // This is actually necessary! Removing it causes compile errors on @@ -161,7 +161,7 @@ TokenStream::SourceCoords::add(uint32_t lineNum, uint32_t lineStartOffset) } MOZ_ALWAYS_INLINE bool -TokenStream::SourceCoords::fill(const TokenStream::SourceCoords &other) +TokenStream::SourceCoords::fill(const TokenStream::SourceCoords& other) { JS_ASSERT(lineStartOffsets_.back() == MAX_PTR); JS_ASSERT(other.lineStartOffsets_.back() == MAX_PTR); @@ -247,8 +247,8 @@ TokenStream::SourceCoords::columnIndex(uint32_t offset) const } void -TokenStream::SourceCoords::lineNumAndColumnIndex(uint32_t offset, uint32_t *lineNum, - uint32_t *columnIndex) const +TokenStream::SourceCoords::lineNumAndColumnIndex(uint32_t offset, uint32_t* lineNum, + uint32_t* columnIndex) const { uint32_t lineIndex = lineIndexOf(offset); *lineNum = lineIndexToNum(lineIndex); @@ -263,8 +263,8 @@ TokenStream::SourceCoords::lineNumAndColumnIndex(uint32_t offset, uint32_t *line #endif // Initialize members that aren't initialized in |init|. -TokenStream::TokenStream(ExclusiveContext *cx, const ReadOnlyCompileOptions &options, - const jschar *base, size_t length, StrictModeGetter *smg) +TokenStream::TokenStream(ExclusiveContext* cx, const ReadOnlyCompileOptions& options, + const jschar* base, size_t length, StrictModeGetter* smg) : srcCoords(cx, options.lineno), options_(options), tokens(), @@ -460,7 +460,7 @@ TokenStream::ungetCharIgnoreEOL(int32_t c) // are not consumed: use skipChars(n) to do so after checking that the consumed // characters had appropriate values. bool -TokenStream::peekChars(int n, jschar *cp) +TokenStream::peekChars(int n, jschar* cp) { int i, j; int32_t c; @@ -480,8 +480,8 @@ TokenStream::peekChars(int n, jschar *cp) return i == n; } -const jschar * -TokenStream::TokenBuf::findEOLMax(const jschar *p, size_t max) +const jschar* +TokenStream::TokenBuf::findEOLMax(const jschar* p, size_t max) { JS_ASSERT(base_ <= p && p <= limit_); @@ -501,18 +501,18 @@ TokenStream::TokenBuf::findEOLMax(const jschar *p, size_t max) void TokenStream::advance(size_t position) { - const jschar *end = userbuf.base() + position; + const jschar* end = userbuf.base() + position; while (userbuf.addressOfNextRawChar() < end) getChar(); - Token *cur = &tokens[cursor]; + Token* cur = &tokens[cursor]; cur->pos.begin = userbuf.addressOfNextRawChar() - userbuf.base(); cur->type = TOK_ERROR; lookahead = 0; } void -TokenStream::tell(Position *pos) +TokenStream::tell(Position* pos) { pos->buf = userbuf.addressOfNextRawChar(/* allowPoisoned = */ true); pos->flags = flags; @@ -526,7 +526,7 @@ TokenStream::tell(Position *pos) } void -TokenStream::seek(const Position &pos) +TokenStream::seek(const Position& pos) { userbuf.setAddressOfNextRawChar(pos.buf, /* allowPoisoned = */ true); flags = pos.flags; @@ -541,7 +541,7 @@ TokenStream::seek(const Position &pos) } bool -TokenStream::seek(const Position &pos, const TokenStream &other) +TokenStream::seek(const Position& pos, const TokenStream& other) { if (!srcCoords.fill(other.srcCoords)) return false; @@ -566,7 +566,7 @@ TokenStream::reportStrictModeErrorNumberVA(uint32_t offset, bool strictMode, uns } void -CompileError::throwError(JSContext *cx) +CompileError::throwError(JSContext* cx) { // If there's a runtime exception type associated with this error // number, set that as the pending exception. For errors occuring at @@ -617,7 +617,7 @@ TokenStream::reportCompileErrorNumberVA(uint32_t offset, unsigned flags, unsigne // On the main thread, report the error immediately. When compiling off // thread, save the error so that the main thread can report it later. CompileError tempErr; - CompileError &err = cx->isJSContext() ? tempErr : cx->addPendingCompileError(); + CompileError& err = cx->isJSContext() ? tempErr : cx->addPendingCompileError(); err.report.flags = flags; err.report.errorNumber = errorNumber; @@ -648,7 +648,7 @@ TokenStream::reportCompileErrorNumberVA(uint32_t offset, unsigned flags, unsigne // means that any error involving a multi-line token (e.g. an unterminated // multi-line string literal) won't have a context printed. if (offset != NoOffset && err.report.lineno == lineno) { - const jschar *tokenStart = userbuf.base() + offset; + const jschar* tokenStart = userbuf.base() + offset; // We show only a portion (a "window") of the line around the erroneous // token -- the first char in the token, plus |windowRadius| chars @@ -658,13 +658,13 @@ TokenStream::reportCompileErrorNumberVA(uint32_t offset, unsigned flags, unsigne static const size_t windowRadius = 60; // Truncate at the front if necessary. - const jschar *windowBase = (linebase + windowRadius < tokenStart) + const jschar* windowBase = (linebase + windowRadius < tokenStart) ? tokenStart - windowRadius : linebase; uint32_t windowOffset = tokenStart - windowBase; // Find EOL, or truncate at the back if necessary. - const jschar *windowLimit = userbuf.findEOLMax(tokenStart, windowRadius); + const jschar* windowLimit = userbuf.findEOLMax(tokenStart, windowRadius); size_t windowLength = windowLimit - windowBase; JS_ASSERT(windowLength <= windowRadius * 2); @@ -749,7 +749,7 @@ TokenStream::reportAsmJSError(uint32_t offset, unsigned errorNumber, ...) // Unicode escape sequence. Otherwise, return 'false'. In both cases, do not // advance along the buffer. bool -TokenStream::peekUnicodeEscape(int *result) +TokenStream::peekUnicodeEscape(int* result) { jschar cp[5]; @@ -767,7 +767,7 @@ TokenStream::peekUnicodeEscape(int *result) } bool -TokenStream::matchUnicodeEscapeIdStart(int32_t *cp) +TokenStream::matchUnicodeEscapeIdStart(int32_t* cp) { if (peekUnicodeEscape(cp) && IsIdentifierStart(*cp)) { skipChars(5); @@ -777,7 +777,7 @@ TokenStream::matchUnicodeEscapeIdStart(int32_t *cp) } bool -TokenStream::matchUnicodeEscapeIdent(int32_t *cp) +TokenStream::matchUnicodeEscapeIdent(int32_t* cp) { if (peekUnicodeEscape(cp) && IsIdentifierPart(*cp)) { skipChars(5); @@ -789,7 +789,7 @@ TokenStream::matchUnicodeEscapeIdent(int32_t *cp) // Helper function which returns true if the first length(q) characters in p are // the same as the characters in q. static bool -CharsMatch(const jschar *p, const char *q) { +CharsMatch(const jschar* p, const char* q) { while (*q) { if (*p++ != *q++) return false; @@ -818,8 +818,8 @@ TokenStream::getDirectives(bool isMultiline, bool shouldWarnDeprecated) bool TokenStream::getDirective(bool isMultiline, bool shouldWarnDeprecated, - const char *directive, int directiveLength, - const char *errorMsgPragma, jschar **destination) { + const char* directive, int directiveLength, + const char* errorMsgPragma, jschar** destination) { JS_ASSERT(directiveLength <= 18); jschar peeked[18]; int32_t c; @@ -888,11 +888,11 @@ TokenStream::getSourceMappingURL(bool isMultiline, bool shouldWarnDeprecated) "sourceMappingURL", &sourceMapURL_); } -MOZ_ALWAYS_INLINE Token * +MOZ_ALWAYS_INLINE Token* TokenStream::newToken(ptrdiff_t adjust) { cursor = (cursor + 1) & ntokensMask; - Token *tp = &tokens[cursor]; + Token* tp = &tokens[cursor]; tp->pos.begin = userbuf.addressOfNextRawChar() + adjust - userbuf.base(); // NOTE: tp->pos.end is not set until the very end of getTokenInternal(). @@ -901,15 +901,15 @@ TokenStream::newToken(ptrdiff_t adjust) return tp; } -MOZ_ALWAYS_INLINE JSAtom * -TokenStream::atomize(ExclusiveContext *cx, CharBuffer &cb) +MOZ_ALWAYS_INLINE JSAtom* +TokenStream::atomize(ExclusiveContext* cx, CharBuffer& cb) { return AtomizeChars(cx, cb.begin(), cb.length()); } #ifdef DEBUG static bool -IsTokenSane(Token *tp) +IsTokenSane(Token* tp) { // Nb: TOK_EOL should never be used in an actual Token; it should only be // returned as a TokenKind from peekTokenSameLine(). @@ -924,10 +924,10 @@ IsTokenSane(Token *tp) #endif bool -TokenStream::putIdentInTokenbuf(const jschar *identStart) +TokenStream::putIdentInTokenbuf(const jschar* identStart) { int32_t c, qc; - const jschar *tmp = userbuf.addressOfNextRawChar(); + const jschar* tmp = userbuf.addressOfNextRawChar(); userbuf.setAddressOfNextRawChar(identStart); tokenbuf.clear(); @@ -948,9 +948,9 @@ TokenStream::putIdentInTokenbuf(const jschar *identStart) } bool -TokenStream::checkForKeyword(const jschar *s, size_t length, TokenKind *ttp) +TokenStream::checkForKeyword(const jschar* s, size_t length, TokenKind* ttp) { - const KeywordInfo *kw = FindKeyword(s, length); + const KeywordInfo* kw = FindKeyword(s, length); if (!kw) return true; @@ -1049,12 +1049,12 @@ TokenKind TokenStream::getTokenInternal(Modifier modifier) { int c, qc; - Token *tp; + Token* tp; FirstCharKind c1kind; - const jschar *numStart; + const jschar* numStart; bool hasExp; DecimalPoint decimalPoint; - const jschar *identStart; + const jschar* identStart; bool hadUnicodeEscape; retry: @@ -1151,7 +1151,7 @@ TokenStream::getTokenInternal(Modifier modifier) // Identifiers containing no Unicode escapes can be processed directly // from userbuf. The rest must use the escapes converted via tokenbuf // before atomizing. - const jschar *chars; + const jschar* chars; size_t length; if (hadUnicodeEscape) { if (!putIdentInTokenbuf(identStart)) @@ -1173,7 +1173,7 @@ TokenStream::getTokenInternal(Modifier modifier) goto out; } - JSAtom *atom = AtomizeChars(cx, chars, length); + JSAtom* atom = AtomizeChars(cx, chars, length); if (!atom) goto error; tp->type = TOK_NAME; @@ -1229,7 +1229,7 @@ TokenStream::getTokenInternal(Modifier modifier) if (!GetDecimalInteger(cx, numStart, userbuf.addressOfNextRawChar(), &dval)) goto error; } else { - const jschar *dummy; + const jschar* dummy; if (!js_strtod(cx, numStart, userbuf.addressOfNextRawChar(), &dummy, &dval)) goto error; } @@ -1329,7 +1329,7 @@ TokenStream::getTokenInternal(Modifier modifier) if (!tokenbuf.append(c)) goto error; } - JSAtom *atom = atomize(cx, tokenbuf); + JSAtom* atom = atomize(cx, tokenbuf); if (!atom) goto error; tp->type = TOK_STRING; @@ -1420,7 +1420,7 @@ TokenStream::getTokenInternal(Modifier modifier) } double dval; - const jschar *dummy; + const jschar* dummy; if (!GetPrefixInteger(cx, numStart, userbuf.addressOfNextRawChar(), radix, &dummy, &dval)) goto error; tp->type = TOK_NUMBER; @@ -1688,7 +1688,7 @@ TokenStream::onError() } JS_FRIEND_API(int) -js_fgets(char *buf, int size, FILE *file) +js_fgets(char* buf, int size, FILE* file) { int n, i, c; bool crflag; @@ -1716,7 +1716,7 @@ js_fgets(char *buf, int size, FILE *file) } #ifdef DEBUG -const char * +const char* TokenKindToString(TokenKind tt) { switch (tt) { diff --git a/js/src/frontend/TokenStream.h b/js/src/frontend/TokenStream.h index ba1e079898..66bda48b30 100644 --- a/js/src/frontend/TokenStream.h +++ b/js/src/frontend/TokenStream.h @@ -193,7 +193,7 @@ struct TokenPos { TokenPos(uint32_t begin, uint32_t end) : begin(begin), end(end) {} // Return a TokenPos that covers left, right, and anything in between. - static TokenPos box(const TokenPos &left, const TokenPos &right) { + static TokenPos box(const TokenPos& left, const TokenPos& right) { JS_ASSERT(left.begin <= left.end); JS_ASSERT(left.end <= right.begin); JS_ASSERT(right.begin <= right.end); @@ -238,8 +238,8 @@ struct Token union { private: friend struct Token; - PropertyName *name; // non-numeric atom - JSAtom *atom; // potentially-numeric atom + PropertyName* name; // non-numeric atom + JSAtom* atom; // potentially-numeric atom struct { double value; // floating point number DecimalPoint decimalPoint; // literal contains '.' @@ -268,13 +268,13 @@ struct Token // Mutators - void setName(PropertyName *name) { + void setName(PropertyName* name) { JS_ASSERT(type == TOK_NAME); JS_ASSERT(!IsPoisonedPtr(name)); u.name = name; } - void setAtom(JSAtom *atom) { + void setAtom(JSAtom* atom) { JS_ASSERT(type == TOK_STRING); JS_ASSERT(!IsPoisonedPtr(atom)); u.atom = atom; @@ -294,12 +294,12 @@ struct Token // Type-safe accessors - PropertyName *name() const { + PropertyName* name() const { JS_ASSERT(type == TOK_NAME); return u.name->asPropertyName(); // poor-man's type verification } - JSAtom *atom() const { + JSAtom* atom() const { JS_ASSERT(type == TOK_STRING); return u.atom; } @@ -323,7 +323,7 @@ struct Token struct CompileError { JSErrorReport report; - char *message; + char* message; ErrorArgumentsType argumentsType; CompileError() : message(nullptr), argumentsType(ArgumentsAreUnicode) @@ -331,13 +331,13 @@ struct CompileError { mozilla::PodZero(&report); } ~CompileError(); - void throwError(JSContext *cx); + void throwError(JSContext* cx); private: // CompileError owns raw allocated memory, so disable assignment and copying // for safety. - void operator=(const CompileError &) MOZ_DELETE; - CompileError(const CompileError &) MOZ_DELETE; + void operator=(const CompileError&) MOZ_DELETE; + CompileError(const CompileError&) MOZ_DELETE; }; // Ideally, tokenizing would be entirely independent of context. But the @@ -408,25 +408,25 @@ class MOZ_STACK_CLASS TokenStream public: typedef Vector CharBuffer; - TokenStream(ExclusiveContext *cx, const ReadOnlyCompileOptions &options, - const jschar *base, size_t length, StrictModeGetter *smg); + TokenStream(ExclusiveContext* cx, const ReadOnlyCompileOptions& options, + const jschar* base, size_t length, StrictModeGetter* smg); ~TokenStream(); // Accessors. - const Token ¤tToken() const { return tokens[cursor]; } + const Token& currentToken() const { return tokens[cursor]; } bool isCurrentTokenType(TokenKind type) const { return currentToken().type == type; } - const CharBuffer &getTokenbuf() const { return tokenbuf; } - const char *getFilename() const { return filename; } + const CharBuffer& getTokenbuf() const { return tokenbuf; } + const char* getFilename() const { return filename; } unsigned getLineno() const { return lineno; } unsigned getColumn() const { return userbuf.addressOfNextRawChar() - linebase - 1; } - JSPrincipals *getOriginPrincipals() const { return originPrincipals; } + JSPrincipals* getOriginPrincipals() const { return originPrincipals; } JSVersion versionNumber() const { return VersionNumber(options().version); } JSVersion versionWithFlags() const { return options().version; } - PropertyName *currentName() const { + PropertyName* currentName() const { if (isCurrentTokenType(TOK_YIELD)) return cx->names().yield; JS_ASSERT(isCurrentTokenType(TOK_NAME)); @@ -468,8 +468,8 @@ class MOZ_STACK_CLASS TokenStream bool strictMode() const { return strictModeGetter && strictModeGetter->strictMode(); } void onError(); - static JSAtom *atomize(ExclusiveContext *cx, CharBuffer &cb); - bool putIdentInTokenbuf(const jschar *identStart); + static JSAtom* atomize(ExclusiveContext* cx, CharBuffer& cb); + bool putIdentInTokenbuf(const jschar* identStart); struct Flags { @@ -540,7 +540,7 @@ class MOZ_STACK_CLASS TokenStream // created, just a TOK_EOL TokenKind is returned, and currentToken() // shouldn't be consulted. (This is the only place TOK_EOL is produced.) MOZ_ALWAYS_INLINE TokenKind peekTokenSameLine(Modifier modifier = None) { - const Token &curr = currentToken(); + const Token& curr = currentToken(); // If lookahead != 0, we have scanned ahead at least one token, and // |lineno| is the line that the furthest-scanned token ends on. If @@ -558,7 +558,7 @@ class MOZ_STACK_CLASS TokenStream // The following test is somewhat expensive but gets these cases (and // all others) right. (void)getToken(modifier); - const Token &next = currentToken(); + const Token& next = currentToken(); ungetToken(); return srcCoords.lineNum(curr.pos.end) == srcCoords.lineNum(next.pos.begin) ? next.type @@ -601,30 +601,30 @@ class MOZ_STACK_CLASS TokenStream private: Position(const Position&) MOZ_DELETE; friend class TokenStream; - const jschar *buf; + const jschar* buf; Flags flags; unsigned lineno; - const jschar *linebase; - const jschar *prevLinebase; + const jschar* linebase; + const jschar* prevLinebase; Token currentToken; unsigned lookahead; Token lookaheadTokens[maxLookahead]; }; void advance(size_t position); - void tell(Position *); - void seek(const Position &pos); - bool seek(const Position &pos, const TokenStream &other); + void tell(Position*); + void seek(const Position& pos); + bool seek(const Position& pos, const TokenStream& other); - size_t positionToOffset(const Position &pos) const { + size_t positionToOffset(const Position& pos) const { return pos.buf - userbuf.base(); } - const jschar *rawBase() const { + const jschar* rawBase() const { return userbuf.base(); } - const jschar *rawLimit() const { + const jschar* rawLimit() const { return userbuf.limit(); } @@ -632,7 +632,7 @@ class MOZ_STACK_CLASS TokenStream return displayURL_ != nullptr; } - jschar *displayURL() { + jschar* displayURL() { return displayURL_; } @@ -640,7 +640,7 @@ class MOZ_STACK_CLASS TokenStream return sourceMapURL_ != nullptr; } - jschar *sourceMapURL() { + jschar* sourceMapURL() { return sourceMapURL_; } @@ -654,7 +654,7 @@ class MOZ_STACK_CLASS TokenStream // null, report a SyntaxError ("if is a reserved identifier") and return // false. If ttp is non-null, return true with the keyword's TokenKind in // *ttp. - bool checkForKeyword(const jschar *s, size_t length, TokenKind *ttp); + bool checkForKeyword(const jschar* s, size_t length, TokenKind* ttp); // This class maps a userbuf offset (which is 0-indexed) to a line number // (which is 1-indexed) and a column index (which is 0-indexed). @@ -707,10 +707,10 @@ class MOZ_STACK_CLASS TokenStream uint32_t lineNumToIndex(uint32_t lineNum) const { return lineNum - initialLineNum_; } public: - SourceCoords(ExclusiveContext *cx, uint32_t ln); + SourceCoords(ExclusiveContext* cx, uint32_t ln); void add(uint32_t lineNum, uint32_t lineStartOffset); - bool fill(const SourceCoords &other); + bool fill(const SourceCoords& other); bool isOnThisLine(uint32_t offset, uint32_t lineNum) const { uint32_t lineIndex = lineNumToIndex(lineNum); @@ -721,20 +721,20 @@ class MOZ_STACK_CLASS TokenStream uint32_t lineNum(uint32_t offset) const; uint32_t columnIndex(uint32_t offset) const; - void lineNumAndColumnIndex(uint32_t offset, uint32_t *lineNum, uint32_t *columnIndex) const; + void lineNumAndColumnIndex(uint32_t offset, uint32_t* lineNum, uint32_t* columnIndex) const; }; SourceCoords srcCoords; - JSAtomState &names() const { + JSAtomState& names() const { return cx->names(); } - ExclusiveContext *context() const { + ExclusiveContext* context() const { return cx; } - const ReadOnlyCompileOptions &options() const { + const ReadOnlyCompileOptions& options() const { return options_; } @@ -746,7 +746,7 @@ class MOZ_STACK_CLASS TokenStream // chars" refers to the lack of EOL sequence normalization.) class TokenBuf { public: - TokenBuf(ExclusiveContext *cx, const jschar *buf, size_t length) + TokenBuf(ExclusiveContext* cx, const jschar* buf, size_t length) : base_(buf), limit_(buf + length), ptr(buf) { } @@ -758,11 +758,11 @@ class MOZ_STACK_CLASS TokenStream return ptr == base_; } - const jschar *base() const { + const jschar* base() const { return base_; } - const jschar *limit() const { + const jschar* limit() const { return limit_; } @@ -796,13 +796,13 @@ class MOZ_STACK_CLASS TokenStream ptr--; } - const jschar *addressOfNextRawChar(bool allowPoisoned = false) const { + const jschar* addressOfNextRawChar(bool allowPoisoned = false) const { JS_ASSERT_IF(!allowPoisoned, ptr); // make sure it hasn't been poisoned return ptr; } // Use this with caution! - void setAddressOfNextRawChar(const jschar *a, bool allowPoisoned = false) { + void setAddressOfNextRawChar(const jschar* a, bool allowPoisoned = false) { JS_ASSERT_IF(!allowPoisoned, a); ptr = a; } @@ -820,12 +820,12 @@ class MOZ_STACK_CLASS TokenStream // Finds the next EOL, but stops once 'max' jschars have been scanned // (*including* the starting jschar). - const jschar *findEOLMax(const jschar *p, size_t max); + const jschar* findEOLMax(const jschar* p, size_t max); private: - const jschar *base_; // base of buffer - const jschar *limit_; // limit for quick bounds check - const jschar *ptr; // next char to get + const jschar* base_; // base of buffer + const jschar* limit_; // limit for quick bounds check + const jschar* ptr; // next char to get }; TokenKind getTokenInternal(Modifier modifier); @@ -834,16 +834,16 @@ class MOZ_STACK_CLASS TokenStream int32_t getCharIgnoreEOL(); void ungetChar(int32_t c); void ungetCharIgnoreEOL(int32_t c); - Token *newToken(ptrdiff_t adjust); - bool peekUnicodeEscape(int32_t *c); - bool matchUnicodeEscapeIdStart(int32_t *c); - bool matchUnicodeEscapeIdent(int32_t *c); - bool peekChars(int n, jschar *cp); + Token* newToken(ptrdiff_t adjust); + bool peekUnicodeEscape(int32_t* c); + bool matchUnicodeEscapeIdStart(int32_t* c); + bool matchUnicodeEscapeIdent(int32_t* c); + bool peekChars(int n, jschar* cp); bool getDirectives(bool isMultiline, bool shouldWarnDeprecated); bool getDirective(bool isMultiline, bool shouldWarnDeprecated, - const char *directive, int directiveLength, - const char *errorMsgPragma, jschar **destination); + const char* directive, int directiveLength, + const char* errorMsgPragma, jschar** destination); bool getDisplayURL(bool isMultiline, bool shouldWarnDeprecated); bool getSourceMappingURL(bool isMultiline, bool shouldWarnDeprecated); @@ -874,26 +874,26 @@ class MOZ_STACK_CLASS TokenStream void updateFlagsForEOL(); // Options used for parsing/tokenizing. - const ReadOnlyCompileOptions &options_; + const ReadOnlyCompileOptions& options_; Token tokens[ntokens]; // circular token buffer unsigned cursor; // index of last parsed token unsigned lookahead; // count of lookahead tokens unsigned lineno; // current line number Flags flags; // flags -- see above - const jschar *linebase; // start of current line; points into userbuf - const jschar *prevLinebase; // start of previous line; nullptr if on the first line + const jschar* linebase; // start of current line; points into userbuf + const jschar* prevLinebase; // start of previous line; nullptr if on the first line TokenBuf userbuf; // user input buffer - const char *filename; // input filename or null - jschar *displayURL_; // the user's requested source URL or null - jschar *sourceMapURL_; // source map's filename or null + const char* filename; // input filename or null + jschar* displayURL_; // the user's requested source URL or null + jschar* sourceMapURL_; // source map's filename or null CharBuffer tokenbuf; // current token string buffer bool maybeEOL[256]; // probabilistic EOL lookup table bool maybeStrSpecial[256]; // speeds up string scanning uint8_t isExprEnding[TOK_LIMIT];// which tokens definitely terminate exprs? - ExclusiveContext *const cx; - JSPrincipals *const originPrincipals; - StrictModeGetter *strictModeGetter; // used to test for strict mode + ExclusiveContext* const cx; + JSPrincipals* const originPrincipals; + StrictModeGetter* strictModeGetter; // used to test for strict mode }; // Steal one JSREPORT_* bit (see jsapi.h) to tell that arguments to the error @@ -904,10 +904,10 @@ class MOZ_STACK_CLASS TokenStream } // namespace js extern JS_FRIEND_API(int) -js_fgets(char *buf, int size, FILE *file); +js_fgets(char* buf, int size, FILE* file); #ifdef DEBUG -extern const char * +extern const char* TokenKindToString(js::frontend::TokenKind tt); #endif diff --git a/js/src/gc/Barrier-inl.h b/js/src/gc/Barrier-inl.h index 3b221e2811..1698db4343 100644 --- a/js/src/gc/Barrier-inl.h +++ b/js/src/gc/Barrier-inl.h @@ -11,7 +11,7 @@ namespace js { -inline const Value & +inline const Value& ReadBarrieredValue::get() const { if (value.isObject()) @@ -25,12 +25,12 @@ ReadBarrieredValue::get() const } inline -ReadBarrieredValue::operator const Value &() const +ReadBarrieredValue::operator const Value&() const { return get(); } -inline JSObject & +inline JSObject& ReadBarrieredValue::toObject() const { return get().toObject(); diff --git a/js/src/gc/Barrier.cpp b/js/src/gc/Barrier.cpp index e86543386b..18b6763376 100644 --- a/js/src/gc/Barrier.cpp +++ b/js/src/gc/Barrier.cpp @@ -16,7 +16,7 @@ namespace js { #ifdef DEBUG bool -HeapValue::preconditionForSet(Zone *zone) +HeapValue::preconditionForSet(Zone* zone) { if (!value.isMarkable()) return true; @@ -26,39 +26,39 @@ HeapValue::preconditionForSet(Zone *zone) } bool -HeapSlot::preconditionForSet(JSObject *owner, Kind kind, uint32_t slot) +HeapSlot::preconditionForSet(JSObject* owner, Kind kind, uint32_t slot) { return kind == Slot ? &owner->getSlotRef(slot) == this - : &owner->getDenseElement(slot) == (const Value *)this; + : &owner->getDenseElement(slot) == (const Value*)this; } bool -HeapSlot::preconditionForSet(Zone *zone, JSObject *owner, Kind kind, uint32_t slot) +HeapSlot::preconditionForSet(Zone* zone, JSObject* owner, Kind kind, uint32_t slot) { bool ok = kind == Slot ? &owner->getSlotRef(slot) == this - : &owner->getDenseElement(slot) == (const Value *)this; + : &owner->getDenseElement(slot) == (const Value*)this; return ok && owner->zone() == zone; } void -HeapSlot::preconditionForWriteBarrierPost(JSObject *obj, Kind kind, uint32_t slot, Value target) +HeapSlot::preconditionForWriteBarrierPost(JSObject* obj, Kind kind, uint32_t slot, Value target) { JS_ASSERT_IF(kind == Slot, obj->getSlotAddressUnchecked(slot)->get() == target); JS_ASSERT_IF(kind == Element, - static_cast(obj->getDenseElements() + slot)->get() == target); + static_cast(obj->getDenseElements() + slot)->get() == target); } bool -RuntimeFromMainThreadIsHeapMajorCollecting(JS::shadow::Zone *shadowZone) +RuntimeFromMainThreadIsHeapMajorCollecting(JS::shadow::Zone* shadowZone) { return shadowZone->runtimeFromMainThread()->isHeapMajorCollecting(); } #endif // DEBUG bool -StringIsPermanentAtom(JSString *str) +StringIsPermanentAtom(JSString* str) { return str->isPermanentAtom(); } diff --git a/js/src/gc/Barrier.h b/js/src/gc/Barrier.h index ea3fdba6ee..9fc6bd0f6c 100644 --- a/js/src/gc/Barrier.h +++ b/js/src/gc/Barrier.h @@ -122,7 +122,7 @@ * call, this file contains a bunch of C++ classes and templates that use * operator overloading to take care of barriers automatically. In many cases, * all that's necessary to make some field be barriered is to replace - * Type *field; + * Type* field; * with * HeapPtr field; * There are also special classes HeapValue and HeapId, which barrier js::Value @@ -156,25 +156,25 @@ class PropertyName; #ifdef DEBUG bool -RuntimeFromMainThreadIsHeapMajorCollecting(JS::shadow::Zone *shadowZone); +RuntimeFromMainThreadIsHeapMajorCollecting(JS::shadow::Zone* shadowZone); #endif namespace gc { template void -MarkUnbarriered(JSTracer *trc, T **thingp, const char *name); +MarkUnbarriered(JSTracer* trc, T** thingp, const char* name); // Direct value access used by the write barriers and the jits. void -MarkValueUnbarriered(JSTracer *trc, Value *v, const char *name); +MarkValueUnbarriered(JSTracer* trc, Value* v, const char* name); // These two declarations are also present in gc/Marking.h, via the DeclMarker // macro. Not great, but hard to avoid. void -MarkObjectUnbarriered(JSTracer *trc, JSObject **obj, const char *name); +MarkObjectUnbarriered(JSTracer* trc, JSObject** obj, const char* name); void -MarkStringUnbarriered(JSTracer *trc, JSString **str, const char *name); +MarkStringUnbarriered(JSTracer* trc, JSString** str, const char* name); // Note that some subclasses (e.g. ObjectImpl) specialize some of these // methods. @@ -182,26 +182,26 @@ template class BarrieredCell : public gc::Cell { public: - MOZ_ALWAYS_INLINE JS::Zone *zone() const { return tenuredZone(); } - MOZ_ALWAYS_INLINE JS::shadow::Zone *shadowZone() const { return JS::shadow::Zone::asShadowZone(zone()); } - MOZ_ALWAYS_INLINE JS::Zone *zoneFromAnyThread() const { return tenuredZoneFromAnyThread(); } - MOZ_ALWAYS_INLINE JS::shadow::Zone *shadowZoneFromAnyThread() const { + MOZ_ALWAYS_INLINE JS::Zone* zone() const { return tenuredZone(); } + MOZ_ALWAYS_INLINE JS::shadow::Zone* shadowZone() const { return JS::shadow::Zone::asShadowZone(zone()); } + MOZ_ALWAYS_INLINE JS::Zone* zoneFromAnyThread() const { return tenuredZoneFromAnyThread(); } + MOZ_ALWAYS_INLINE JS::shadow::Zone* shadowZoneFromAnyThread() const { return JS::shadow::Zone::asShadowZone(zoneFromAnyThread()); } - static MOZ_ALWAYS_INLINE void readBarrier(T *thing) { + static MOZ_ALWAYS_INLINE void readBarrier(T* thing) { #ifdef JSGC_INCREMENTAL - JS::shadow::Zone *shadowZone = thing->shadowZoneFromAnyThread(); + JS::shadow::Zone* shadowZone = thing->shadowZoneFromAnyThread(); if (shadowZone->needsBarrier()) { MOZ_ASSERT(!RuntimeFromMainThreadIsHeapMajorCollecting(shadowZone)); - T *tmp = thing; + T* tmp = thing; js::gc::MarkUnbarriered(shadowZone->barrierTracer(), &tmp, "read barrier"); JS_ASSERT(tmp == thing); } #endif } - static MOZ_ALWAYS_INLINE bool needWriteBarrierPre(JS::Zone *zone) { + static MOZ_ALWAYS_INLINE bool needWriteBarrierPre(JS::Zone* zone) { #ifdef JSGC_INCREMENTAL return JS::shadow::Zone::asShadowZone(zone)->needsBarrier(); #else @@ -209,26 +209,26 @@ class BarrieredCell : public gc::Cell #endif } - static MOZ_ALWAYS_INLINE bool isNullLike(T *thing) { return !thing; } + static MOZ_ALWAYS_INLINE bool isNullLike(T* thing) { return !thing; } - static MOZ_ALWAYS_INLINE void writeBarrierPre(T *thing) { + static MOZ_ALWAYS_INLINE void writeBarrierPre(T* thing) { #ifdef JSGC_INCREMENTAL if (isNullLike(thing) || !thing->shadowRuntimeFromAnyThread()->needsBarrier()) return; - JS::shadow::Zone *shadowZone = thing->shadowZoneFromAnyThread(); + JS::shadow::Zone* shadowZone = thing->shadowZoneFromAnyThread(); if (shadowZone->needsBarrier()) { MOZ_ASSERT(!RuntimeFromMainThreadIsHeapMajorCollecting(shadowZone)); - T *tmp = thing; + T* tmp = thing; js::gc::MarkUnbarriered(shadowZone->barrierTracer(), &tmp, "write barrier"); JS_ASSERT(tmp == thing); } #endif } - static void writeBarrierPost(T *thing, void *addr) {} - static void writeBarrierPostRelocate(T *thing, void *addr) {} - static void writeBarrierPostRemove(T *thing, void *addr) {} + static void writeBarrierPost(T* thing, void* addr) {} + static void writeBarrierPostRelocate(T* thing, void* addr) {} + static void writeBarrierPostRemove(T* thing, void* addr) {} }; } // namespace gc @@ -236,53 +236,53 @@ class BarrieredCell : public gc::Cell // Note: the following Zone-getting functions must be equivalent to the zone() // and shadowZone() functions implemented by the subclasses of BarrieredCell. -JS::Zone * -ZoneOfObject(const JSObject &obj); +JS::Zone* +ZoneOfObject(const JSObject& obj); -static inline JS::shadow::Zone * -ShadowZoneOfObject(JSObject *obj) +static inline JS::shadow::Zone* +ShadowZoneOfObject(JSObject* obj) { return JS::shadow::Zone::asShadowZone(ZoneOfObject(*obj)); } -static inline JS::shadow::Zone * -ShadowZoneOfString(JSString *str) +static inline JS::shadow::Zone* +ShadowZoneOfString(JSString* str) { - return JS::shadow::Zone::asShadowZone(reinterpret_cast(str)->tenuredZone()); + return JS::shadow::Zone::asShadowZone(reinterpret_cast(str)->tenuredZone()); } -MOZ_ALWAYS_INLINE JS::Zone * -ZoneOfValue(const JS::Value &value) +MOZ_ALWAYS_INLINE JS::Zone* +ZoneOfValue(const JS::Value& value) { JS_ASSERT(value.isMarkable()); if (value.isObject()) return ZoneOfObject(value.toObject()); - return static_cast(value.toGCThing())->tenuredZone(); + return static_cast(value.toGCThing())->tenuredZone(); } -JS::Zone * -ZoneOfObjectFromAnyThread(const JSObject &obj); +JS::Zone* +ZoneOfObjectFromAnyThread(const JSObject& obj); -static inline JS::shadow::Zone * -ShadowZoneOfObjectFromAnyThread(JSObject *obj) +static inline JS::shadow::Zone* +ShadowZoneOfObjectFromAnyThread(JSObject* obj) { return JS::shadow::Zone::asShadowZone(ZoneOfObjectFromAnyThread(*obj)); } -static inline JS::shadow::Zone * -ShadowZoneOfStringFromAnyThread(JSString *str) +static inline JS::shadow::Zone* +ShadowZoneOfStringFromAnyThread(JSString* str) { return JS::shadow::Zone::asShadowZone( - reinterpret_cast(str)->tenuredZoneFromAnyThread()); + reinterpret_cast(str)->tenuredZoneFromAnyThread()); } -MOZ_ALWAYS_INLINE JS::Zone * -ZoneOfValueFromAnyThread(const JS::Value &value) +MOZ_ALWAYS_INLINE JS::Zone* +ZoneOfValueFromAnyThread(const JS::Value& value) { JS_ASSERT(value.isMarkable()); if (value.isObject()) return ZoneOfObjectFromAnyThread(value.toObject()); - return static_cast(value.toGCThing())->tenuredZoneFromAnyThread(); + return static_cast(value.toGCThing())->tenuredZoneFromAnyThread(); } /* @@ -293,33 +293,33 @@ class BarrieredPtr { protected: union { - T *value; + T* value; Unioned other; }; - BarrieredPtr(T *v) : value(v) {} + BarrieredPtr(T* v) : value(v) {} ~BarrieredPtr() { pre(); } public: - void init(T *v) { + void init(T* v) { JS_ASSERT(!IsPoisonedPtr(v)); this->value = v; } /* Use this if the automatic coercion to T* isn't working. */ - T *get() const { return value; } + T* get() const { return value; } /* * Use these if you want to change the value without invoking the barrier. * Obviously this is dangerous unless you know the barrier is not needed. */ - T **unsafeGet() { return &value; } - void unsafeSet(T *v) { value = v; } + T** unsafeGet() { return &value; } + void unsafeSet(T* v) { value = v; } - Unioned *unsafeGetUnioned() { return &other; } + Unioned* unsafeGetUnioned() { return &other; } - T &operator*() const { return *value; } - T *operator->() const { return value; } + T& operator*() const { return *value; } + T* operator->() const { return value; } operator T*() const { return value; } @@ -338,8 +338,8 @@ class EncapsulatedPtr : public BarrieredPtr { public: EncapsulatedPtr() : BarrieredPtr(nullptr) {} - EncapsulatedPtr(T *v) : BarrieredPtr(v) {} - explicit EncapsulatedPtr(const EncapsulatedPtr &v) + EncapsulatedPtr(T* v) : BarrieredPtr(v) {} + explicit EncapsulatedPtr(const EncapsulatedPtr& v) : BarrieredPtr(v.value) {} /* Use to set the pointer to nullptr. */ @@ -348,14 +348,14 @@ class EncapsulatedPtr : public BarrieredPtr this->value = nullptr; } - EncapsulatedPtr &operator=(T *v) { + EncapsulatedPtr& operator=(T* v) { this->pre(); JS_ASSERT(!IsPoisonedPtr(v)); this->value = v; return *this; } - EncapsulatedPtr &operator=(const EncapsulatedPtr &v) { + EncapsulatedPtr& operator=(const EncapsulatedPtr& v) { this->pre(); JS_ASSERT(!IsPoisonedPtr(v.value)); this->value = v.value; @@ -380,16 +380,16 @@ class HeapPtr : public BarrieredPtr { public: HeapPtr() : BarrieredPtr(nullptr) {} - explicit HeapPtr(T *v) : BarrieredPtr(v) { post(); } - explicit HeapPtr(const HeapPtr &v) : BarrieredPtr(v) { post(); } + explicit HeapPtr(T* v) : BarrieredPtr(v) { post(); } + explicit HeapPtr(const HeapPtr& v) : BarrieredPtr(v) { post(); } - void init(T *v) { + void init(T* v) { JS_ASSERT(!IsPoisonedPtr(v)); this->value = v; post(); } - HeapPtr &operator=(T *v) { + HeapPtr& operator=(T* v) { this->pre(); JS_ASSERT(!IsPoisonedPtr(v)); this->value = v; @@ -397,7 +397,7 @@ class HeapPtr : public BarrieredPtr return *this; } - HeapPtr &operator=(const HeapPtr &v) { + HeapPtr& operator=(const HeapPtr& v) { this->pre(); JS_ASSERT(!IsPoisonedPtr(v.value)); this->value = v.value; @@ -406,14 +406,14 @@ class HeapPtr : public BarrieredPtr } protected: - void post() { T::writeBarrierPost(this->value, (void *)&this->value); } + void post() { T::writeBarrierPost(this->value, (void*)&this->value); } /* Make this friend so it can access pre() and post(). */ template friend inline void - BarrieredSetPair(Zone *zone, - HeapPtr &v1, T1 *val1, - HeapPtr &v2, T2 *val2); + BarrieredSetPair(Zone* zone, + HeapPtr& v1, T1* val1, + HeapPtr& v2, T2* val2); private: /* @@ -423,8 +423,8 @@ class HeapPtr : public BarrieredPtr * and are deleted here. Please note that not all containers support move * semantics, so this does not completely prevent invalid uses. */ - HeapPtr(HeapPtr &&) MOZ_DELETE; - HeapPtr &operator=(HeapPtr &&) MOZ_DELETE; + HeapPtr(HeapPtr&&) MOZ_DELETE; + HeapPtr& operator=(HeapPtr&&) MOZ_DELETE; }; /* @@ -442,7 +442,7 @@ class HeapPtr : public BarrieredPtr template class FixedHeapPtr { - T *value; + T* value; public: operator T*() const { return value; } @@ -452,7 +452,7 @@ class FixedHeapPtr return Handle::fromMarkedLocation(&value); } - void init(T *ptr) { + void init(T* ptr) { value = ptr; } }; @@ -469,7 +469,7 @@ class RelocatablePtr : public BarrieredPtr { public: RelocatablePtr() : BarrieredPtr(nullptr) {} - explicit RelocatablePtr(T *v) : BarrieredPtr(v) { + explicit RelocatablePtr(T* v) : BarrieredPtr(v) { if (v) post(); } @@ -480,7 +480,7 @@ class RelocatablePtr : public BarrieredPtr * function that will be used for both lvalue and rvalue copies, so we can * simply omit the rvalue variant. */ - RelocatablePtr(const RelocatablePtr &v) : BarrieredPtr(v) { + RelocatablePtr(const RelocatablePtr& v) : BarrieredPtr(v) { if (this->value) post(); } @@ -490,7 +490,7 @@ class RelocatablePtr : public BarrieredPtr relocate(); } - RelocatablePtr &operator=(T *v) { + RelocatablePtr& operator=(T* v) { this->pre(); JS_ASSERT(!IsPoisonedPtr(v)); if (v) { @@ -503,7 +503,7 @@ class RelocatablePtr : public BarrieredPtr return *this; } - RelocatablePtr &operator=(const RelocatablePtr &v) { + RelocatablePtr& operator=(const RelocatablePtr& v) { this->pre(); JS_ASSERT(!IsPoisonedPtr(v.value)); if (v.value) { @@ -538,9 +538,9 @@ class RelocatablePtr : public BarrieredPtr */ template static inline void -BarrieredSetPair(Zone *zone, - HeapPtr &v1, T1 *val1, - HeapPtr &v2, T2 *val2) +BarrieredSetPair(Zone* zone, + HeapPtr& v1, T1* val1, + HeapPtr& v2, T2* val2) { if (T1::needWriteBarrierPre(zone)) { v1.pre(); @@ -580,11 +580,11 @@ template struct HeapPtrHasher { typedef HeapPtr Key; - typedef T *Lookup; + typedef T* Lookup; - static HashNumber hash(Lookup obj) { return DefaultHasher::hash(obj); } - static bool match(const Key &k, Lookup l) { return k.get() == l; } - static void rekey(Key &k, const Key& newKey) { k.unsafeSet(newKey); } + static HashNumber hash(Lookup obj) { return DefaultHasher::hash(obj); } + static bool match(const Key& k, Lookup l) { return k.get() == l; } + static void rekey(Key& k, const Key& newKey) { k.unsafeSet(newKey); } }; /* Specialized hashing policy for HeapPtrs. */ @@ -595,18 +595,18 @@ template struct EncapsulatedPtrHasher { typedef EncapsulatedPtr Key; - typedef T *Lookup; + typedef T* Lookup; - static HashNumber hash(Lookup obj) { return DefaultHasher::hash(obj); } - static bool match(const Key &k, Lookup l) { return k.get() == l; } - static void rekey(Key &k, const Key& newKey) { k.unsafeSet(newKey); } + static HashNumber hash(Lookup obj) { return DefaultHasher::hash(obj); } + static bool match(const Key& k, Lookup l) { return k.get() == l; } + static void rekey(Key& k, const Key& newKey) { k.unsafeSet(newKey); } }; template struct DefaultHasher< EncapsulatedPtr > : EncapsulatedPtrHasher { }; bool -StringIsPermanentAtom(JSString *str); +StringIsPermanentAtom(JSString* str); /* * Base class for barriered value types. @@ -622,7 +622,7 @@ class BarrieredValue : public ValueOperations */ BarrieredValue() MOZ_DELETE; - BarrieredValue(const Value &v) : value(v) { + BarrieredValue(const Value& v) : value(v) { JS_ASSERT(!IsPoisonedValue(v)); } @@ -631,38 +631,38 @@ class BarrieredValue : public ValueOperations } public: - void init(const Value &v) { + void init(const Value& v) { JS_ASSERT(!IsPoisonedValue(v)); value = v; } - void init(JSRuntime *rt, const Value &v) { + void init(JSRuntime* rt, const Value& v) { JS_ASSERT(!IsPoisonedValue(v)); value = v; } - bool operator==(const BarrieredValue &v) const { return value == v.value; } - bool operator!=(const BarrieredValue &v) const { return value != v.value; } + bool operator==(const BarrieredValue& v) const { return value == v.value; } + bool operator!=(const BarrieredValue& v) const { return value != v.value; } - const Value &get() const { return value; } - Value *unsafeGet() { return &value; } - operator const Value &() const { return value; } + const Value& get() const { return value; } + Value* unsafeGet() { return &value; } + operator const Value&() const { return value; } JSGCTraceKind gcKind() const { return value.gcKind(); } uint64_t asRawBits() const { return value.asRawBits(); } - static void writeBarrierPre(const Value &v) { + static void writeBarrierPre(const Value& v) { #ifdef JSGC_INCREMENTAL if (v.isMarkable() && shadowRuntimeFromAnyThread(v)->needsBarrier()) writeBarrierPre(ZoneOfValueFromAnyThread(v), v); #endif } - static void writeBarrierPre(Zone *zone, const Value &v) { + static void writeBarrierPre(Zone* zone, const Value& v) { #ifdef JSGC_INCREMENTAL if (v.isString() && StringIsPermanentAtom(v.toString())) return; - JS::shadow::Zone *shadowZone = JS::shadow::Zone::asShadowZone(zone); + JS::shadow::Zone* shadowZone = JS::shadow::Zone::asShadowZone(zone); if (shadowZone->needsBarrier()) { JS_ASSERT_IF(v.isMarkable(), shadowRuntimeFromMainThread(v)->needsBarrier()); Value tmp(v); @@ -674,20 +674,20 @@ class BarrieredValue : public ValueOperations protected: void pre() { writeBarrierPre(value); } - void pre(Zone *zone) { writeBarrierPre(zone, value); } + void pre(Zone* zone) { writeBarrierPre(zone, value); } - static JSRuntime *runtimeFromMainThread(const Value &v) { + static JSRuntime* runtimeFromMainThread(const Value& v) { JS_ASSERT(v.isMarkable()); - return static_cast(v.toGCThing())->runtimeFromMainThread(); + return static_cast(v.toGCThing())->runtimeFromMainThread(); } - static JSRuntime *runtimeFromAnyThread(const Value &v) { + static JSRuntime* runtimeFromAnyThread(const Value& v) { JS_ASSERT(v.isMarkable()); - return static_cast(v.toGCThing())->runtimeFromAnyThread(); + return static_cast(v.toGCThing())->runtimeFromAnyThread(); } - static JS::shadow::Runtime *shadowRuntimeFromMainThread(const Value &v) { + static JS::shadow::Runtime* shadowRuntimeFromMainThread(const Value& v) { return reinterpret_cast(runtimeFromMainThread(v)); } - static JS::shadow::Runtime *shadowRuntimeFromAnyThread(const Value &v) { + static JS::shadow::Runtime* shadowRuntimeFromAnyThread(const Value& v) { return reinterpret_cast(runtimeFromAnyThread(v)); } @@ -701,17 +701,17 @@ class BarrieredValue : public ValueOperations class EncapsulatedValue : public BarrieredValue { public: - EncapsulatedValue(const Value &v) : BarrieredValue(v) {} - EncapsulatedValue(const EncapsulatedValue &v) : BarrieredValue(v) {} + EncapsulatedValue(const Value& v) : BarrieredValue(v) {} + EncapsulatedValue(const EncapsulatedValue& v) : BarrieredValue(v) {} - EncapsulatedValue &operator=(const Value &v) { + EncapsulatedValue& operator=(const Value& v) { pre(); JS_ASSERT(!IsPoisonedValue(v)); value = v; return *this; } - EncapsulatedValue &operator=(const EncapsulatedValue &v) { + EncapsulatedValue& operator=(const EncapsulatedValue& v) { pre(); JS_ASSERT(!IsPoisonedValue(v)); value = v.get(); @@ -730,14 +730,14 @@ class HeapValue : public BarrieredValue post(); } - explicit HeapValue(const Value &v) + explicit HeapValue(const Value& v) : BarrieredValue(v) { JS_ASSERT(!IsPoisonedValue(v)); post(); } - explicit HeapValue(const HeapValue &v) + explicit HeapValue(const HeapValue& v) : BarrieredValue(v.value) { JS_ASSERT(!IsPoisonedValue(v.value)); @@ -748,19 +748,19 @@ class HeapValue : public BarrieredValue pre(); } - void init(const Value &v) { + void init(const Value& v) { JS_ASSERT(!IsPoisonedValue(v)); value = v; post(); } - void init(JSRuntime *rt, const Value &v) { + void init(JSRuntime* rt, const Value& v) { JS_ASSERT(!IsPoisonedValue(v)); value = v; post(rt); } - HeapValue &operator=(const Value &v) { + HeapValue& operator=(const Value& v) { pre(); JS_ASSERT(!IsPoisonedValue(v)); value = v; @@ -768,7 +768,7 @@ class HeapValue : public BarrieredValue return *this; } - HeapValue &operator=(const HeapValue &v) { + HeapValue& operator=(const HeapValue& v) { pre(); JS_ASSERT(!IsPoisonedValue(v.value)); value = v.value; @@ -777,7 +777,7 @@ class HeapValue : public BarrieredValue } #ifdef DEBUG - bool preconditionForSet(Zone *zone); + bool preconditionForSet(Zone* zone); #endif /* @@ -786,8 +786,8 @@ class HeapValue : public BarrieredValue * the barrier. If you already know the compartment, it's faster to pass it * in. */ - void set(Zone *zone, const Value &v) { - JS::shadow::Zone *shadowZone = JS::shadow::Zone::asShadowZone(zone); + void set(Zone* zone, const Value& v) { + JS::shadow::Zone* shadowZone = JS::shadow::Zone::asShadowZone(zone); JS_ASSERT(preconditionForSet(zone)); pre(zone); JS_ASSERT(!IsPoisonedValue(v)); @@ -795,17 +795,17 @@ class HeapValue : public BarrieredValue post(shadowZone->runtimeFromAnyThread()); } - static void writeBarrierPost(const Value &value, Value *addr) { + static void writeBarrierPost(const Value& value, Value* addr) { #ifdef JSGC_GENERATIONAL if (value.isMarkable()) shadowRuntimeFromAnyThread(value)->gcStoreBufferPtr()->putValue(addr); #endif } - static void writeBarrierPost(JSRuntime *rt, const Value &value, Value *addr) { + static void writeBarrierPost(JSRuntime* rt, const Value& value, Value* addr) { #ifdef JSGC_GENERATIONAL if (value.isMarkable()) { - JS::shadow::Runtime *shadowRuntime = JS::shadow::Runtime::asShadowRuntime(rt); + JS::shadow::Runtime* shadowRuntime = JS::shadow::Runtime::asShadowRuntime(rt); shadowRuntime->gcStoreBufferPtr()->putValue(addr); } #endif @@ -816,12 +816,12 @@ class HeapValue : public BarrieredValue writeBarrierPost(value, &value); } - void post(JSRuntime *rt) { + void post(JSRuntime* rt) { writeBarrierPost(rt, value, &value); } - HeapValue(HeapValue &&) MOZ_DELETE; - HeapValue &operator=(HeapValue &&) MOZ_DELETE; + HeapValue(HeapValue&&) MOZ_DELETE; + HeapValue& operator=(HeapValue&&) MOZ_DELETE; }; // Like RelocatablePtr, but specialized for Value. @@ -831,14 +831,14 @@ class RelocatableValue : public BarrieredValue public: explicit RelocatableValue() : BarrieredValue(UndefinedValue()) {} - explicit RelocatableValue(const Value &v) + explicit RelocatableValue(const Value& v) : BarrieredValue(v) { if (v.isMarkable()) post(); } - RelocatableValue(const RelocatableValue &v) + RelocatableValue(const RelocatableValue& v) : BarrieredValue(v.value) { JS_ASSERT(!IsPoisonedValue(v.value)); @@ -852,14 +852,14 @@ class RelocatableValue : public BarrieredValue relocate(runtimeFromAnyThread(value)); } - RelocatableValue &operator=(const Value &v) { + RelocatableValue& operator=(const Value& v) { pre(); JS_ASSERT(!IsPoisonedValue(v)); if (v.isMarkable()) { value = v; post(); } else if (value.isMarkable()) { - JSRuntime *rt = runtimeFromAnyThread(value); + JSRuntime* rt = runtimeFromAnyThread(value); relocate(rt); value = v; } else { @@ -868,14 +868,14 @@ class RelocatableValue : public BarrieredValue return *this; } - RelocatableValue &operator=(const RelocatableValue &v) { + RelocatableValue& operator=(const RelocatableValue& v) { pre(); JS_ASSERT(!IsPoisonedValue(v.value)); if (v.value.isMarkable()) { value = v.value; post(); } else if (value.isMarkable()) { - JSRuntime *rt = runtimeFromAnyThread(value); + JSRuntime* rt = runtimeFromAnyThread(value); relocate(rt); value = v.value; } else { @@ -892,9 +892,9 @@ class RelocatableValue : public BarrieredValue #endif } - void relocate(JSRuntime *rt) { + void relocate(JSRuntime* rt) { #ifdef JSGC_GENERATIONAL - JS::shadow::Runtime *shadowRuntime = JS::shadow::Runtime::asShadowRuntime(rt); + JS::shadow::Runtime* shadowRuntime = JS::shadow::Runtime::asShadowRuntime(rt); shadowRuntime->gcStoreBufferPtr()->removeRelocatableValue(&value); #endif } @@ -913,14 +913,14 @@ class HeapSlot : public BarrieredValue explicit HeapSlot() MOZ_DELETE; - explicit HeapSlot(JSObject *obj, Kind kind, uint32_t slot, const Value &v) + explicit HeapSlot(JSObject* obj, Kind kind, uint32_t slot, const Value& v) : BarrieredValue(v) { JS_ASSERT(!IsPoisonedValue(v)); post(obj, kind, slot, v); } - explicit HeapSlot(JSObject *obj, Kind kind, uint32_t slot, const HeapSlot &s) + explicit HeapSlot(JSObject* obj, Kind kind, uint32_t slot, const HeapSlot& s) : BarrieredValue(s.value) { JS_ASSERT(!IsPoisonedValue(s.value)); @@ -931,24 +931,24 @@ class HeapSlot : public BarrieredValue pre(); } - void init(JSObject *owner, Kind kind, uint32_t slot, const Value &v) { + void init(JSObject* owner, Kind kind, uint32_t slot, const Value& v) { value = v; post(owner, kind, slot, v); } - void init(JSRuntime *rt, JSObject *owner, Kind kind, uint32_t slot, const Value &v) { + void init(JSRuntime* rt, JSObject* owner, Kind kind, uint32_t slot, const Value& v) { value = v; post(rt, owner, kind, slot, v); } #ifdef DEBUG - bool preconditionForSet(JSObject *owner, Kind kind, uint32_t slot); - bool preconditionForSet(Zone *zone, JSObject *owner, Kind kind, uint32_t slot); - static void preconditionForWriteBarrierPost(JSObject *obj, Kind kind, uint32_t slot, + bool preconditionForSet(JSObject* owner, Kind kind, uint32_t slot); + bool preconditionForSet(Zone* zone, JSObject* owner, Kind kind, uint32_t slot); + static void preconditionForWriteBarrierPost(JSObject* obj, Kind kind, uint32_t slot, Value target); #endif - void set(JSObject *owner, Kind kind, uint32_t slot, const Value &v) { + void set(JSObject* owner, Kind kind, uint32_t slot, const Value& v) { JS_ASSERT(preconditionForSet(owner, kind, slot)); pre(); JS_ASSERT(!IsPoisonedValue(v)); @@ -956,24 +956,24 @@ class HeapSlot : public BarrieredValue post(owner, kind, slot, v); } - void set(Zone *zone, JSObject *owner, Kind kind, uint32_t slot, const Value &v) { + void set(Zone* zone, JSObject* owner, Kind kind, uint32_t slot, const Value& v) { JS_ASSERT(preconditionForSet(zone, owner, kind, slot)); - JS::shadow::Zone *shadowZone = JS::shadow::Zone::asShadowZone(zone); + JS::shadow::Zone* shadowZone = JS::shadow::Zone::asShadowZone(zone); pre(zone); JS_ASSERT(!IsPoisonedValue(v)); value = v; post(shadowZone->runtimeFromAnyThread(), owner, kind, slot, v); } - static void writeBarrierPost(JSObject *obj, Kind kind, uint32_t slot, Value target) + static void writeBarrierPost(JSObject* obj, Kind kind, uint32_t slot, Value target) { #ifdef JSGC_GENERATIONAL - js::gc::Cell *cell = reinterpret_cast(obj); + js::gc::Cell* cell = reinterpret_cast(obj); writeBarrierPost(cell->runtimeFromAnyThread(), obj, kind, slot, target); #endif } - static void writeBarrierPost(JSRuntime *rt, JSObject *obj, Kind kind, uint32_t slot, + static void writeBarrierPost(JSRuntime* rt, JSObject* obj, Kind kind, uint32_t slot, Value target) { #ifdef DEBUG @@ -981,47 +981,47 @@ class HeapSlot : public BarrieredValue #endif #ifdef JSGC_GENERATIONAL if (target.isObject()) { - JS::shadow::Runtime *shadowRuntime = JS::shadow::Runtime::asShadowRuntime(rt); + JS::shadow::Runtime* shadowRuntime = JS::shadow::Runtime::asShadowRuntime(rt); shadowRuntime->gcStoreBufferPtr()->putSlot(obj, kind, slot, 1); } #endif } private: - void post(JSObject *owner, Kind kind, uint32_t slot, Value target) { + void post(JSObject* owner, Kind kind, uint32_t slot, Value target) { HeapSlot::writeBarrierPost(owner, kind, slot, target); } - void post(JSRuntime *rt, JSObject *owner, Kind kind, uint32_t slot, Value target) { + void post(JSRuntime* rt, JSObject* owner, Kind kind, uint32_t slot, Value target) { HeapSlot::writeBarrierPost(rt, owner, kind, slot, target); } }; -static inline const Value * -Valueify(const BarrieredValue *array) +static inline const Value* +Valueify(const BarrieredValue* array) { JS_STATIC_ASSERT(sizeof(HeapValue) == sizeof(Value)); JS_STATIC_ASSERT(sizeof(HeapSlot) == sizeof(Value)); - return (const Value *)array; + return (const Value*)array; } -static inline HeapValue * -HeapValueify(Value *v) +static inline HeapValue* +HeapValueify(Value* v) { JS_STATIC_ASSERT(sizeof(HeapValue) == sizeof(Value)); JS_STATIC_ASSERT(sizeof(HeapSlot) == sizeof(Value)); - return (HeapValue *)v; + return (HeapValue*)v; } class HeapSlotArray { - HeapSlot *array; + HeapSlot* array; public: - HeapSlotArray(HeapSlot *array) : array(array) {} + HeapSlotArray(HeapSlot* array) : array(array) {} - operator const Value *() const { return Valueify(array); } - operator HeapSlot *() const { return array; } + operator const Value*() const { return Valueify(array); } + operator HeapSlot*() const { return array; } HeapSlotArray operator +(int offset) const { return HeapSlotArray(array + offset); } HeapSlotArray operator +(uint32_t offset) const { return HeapSlotArray(array + offset); } @@ -1036,7 +1036,7 @@ class BarrieredId jsid value; private: - BarrieredId(const BarrieredId &v) MOZ_DELETE; + BarrieredId(const BarrieredId& v) MOZ_DELETE; protected: explicit BarrieredId(jsid id) : value(id) {} @@ -1047,7 +1047,7 @@ class BarrieredId bool operator!=(jsid id) const { return value != id; } jsid get() const { return value; } - jsid *unsafeGet() { return &value; } + jsid* unsafeGet() { return &value; } void unsafeSet(jsid newId) { value = newId; } operator jsid() const { return value; } @@ -1055,15 +1055,17 @@ class BarrieredId void pre() { #ifdef JSGC_INCREMENTAL if (JSID_IS_OBJECT(value)) { - JSObject *obj = JSID_TO_OBJECT(value); - JS::shadow::Zone *shadowZone = ShadowZoneOfObjectFromAnyThread(obj); + JSObject* obj = JSID_TO_OBJECT(value); + JS::shadow::Zone* shadowZone = ShadowZoneOfObjectFromAnyThread(obj); if (shadowZone->needsBarrier()) { js::gc::MarkObjectUnbarriered(shadowZone->barrierTracer(), &obj, "write barrier"); JS_ASSERT(obj == JSID_TO_OBJECT(value)); } } else if (JSID_IS_STRING(value)) { - JSString *str = JSID_TO_STRING(value); - JS::shadow::Zone *shadowZone = ShadowZoneOfStringFromAnyThread(str); + if (StringIsPermanentAtom(JSID_TO_STRING(value))) + return; + JSString* str = JSID_TO_STRING(value); + JS::shadow::Zone* shadowZone = ShadowZoneOfStringFromAnyThread(str); if (shadowZone->needsBarrier()) { js::gc::MarkStringUnbarriered(shadowZone->barrierTracer(), &str, "write barrier"); JS_ASSERT(str == JSID_TO_STRING(value)); @@ -1081,7 +1083,7 @@ class EncapsulatedId : public BarrieredId explicit EncapsulatedId(jsid id) : BarrieredId(id) {} explicit EncapsulatedId() : BarrieredId(JSID_VOID) {} - EncapsulatedId &operator=(const EncapsulatedId &v) { + EncapsulatedId& operator=(const EncapsulatedId& v) { if (v.value != value) pre(); JS_ASSERT(!IsPoisonedId(v.value)); @@ -1105,9 +1107,9 @@ class RelocatableId : public BarrieredId jsid get() const { return value; } operator jsid() const { return value; } - jsid *unsafeGet() { return &value; } + jsid* unsafeGet() { return &value; } - RelocatableId &operator=(jsid id) { + RelocatableId& operator=(jsid id) { if (id != value) pre(); JS_ASSERT(!IsPoisonedId(id)); @@ -1115,7 +1117,7 @@ class RelocatableId : public BarrieredId return *this; } - RelocatableId &operator=(const RelocatableId &v) { + RelocatableId& operator=(const RelocatableId& v) { if (v.value != value) pre(); JS_ASSERT(!IsPoisonedId(v.value)); @@ -1146,7 +1148,7 @@ class HeapId : public BarrieredId post(); } - HeapId &operator=(jsid id) { + HeapId& operator=(jsid id) { if (id != value) pre(); JS_ASSERT(!IsPoisonedId(id)); @@ -1155,7 +1157,7 @@ class HeapId : public BarrieredId return *this; } - HeapId &operator=(const HeapId &v) { + HeapId& operator=(const HeapId& v) { if (v.value != value) pre(); JS_ASSERT(!IsPoisonedId(v.value)); @@ -1167,10 +1169,10 @@ class HeapId : public BarrieredId private: void post() {}; - HeapId(const HeapId &v) MOZ_DELETE; + HeapId(const HeapId& v) MOZ_DELETE; - HeapId(HeapId &&) MOZ_DELETE; - HeapId &operator=(HeapId &&) MOZ_DELETE; + HeapId(HeapId&&) MOZ_DELETE; + HeapId& operator=(HeapId&&) MOZ_DELETE; }; /* @@ -1186,14 +1188,14 @@ class HeapId : public BarrieredId template class ReadBarriered { - T *value; + T* value; public: ReadBarriered() : value(nullptr) {} - ReadBarriered(T *value) : value(value) {} - ReadBarriered(const Rooted &rooted) : value(rooted) {} + ReadBarriered(T* value) : value(value) {} + ReadBarriered(const Rooted& rooted) : value(rooted) {} - T *get() const { + T* get() const { if (!value) return nullptr; T::readBarrier(value); @@ -1202,13 +1204,13 @@ class ReadBarriered operator T*() const { return get(); } - T &operator*() const { return *get(); } - T *operator->() const { return get(); } + T& operator*() const { return *get(); } + T* operator->() const { return get(); } - T **unsafeGet() { return &value; } + T** unsafeGet() { return &value; } T * const * unsafeGet() const { return &value; } - void set(T *v) { value = v; } + void set(T* v) { value = v; } operator bool() { return !!value; } }; @@ -1219,13 +1221,13 @@ class ReadBarrieredValue public: ReadBarrieredValue() : value(UndefinedValue()) {} - ReadBarrieredValue(const Value &value) : value(value) {} + ReadBarrieredValue(const Value& value) : value(value) {} - inline const Value &get() const; - Value *unsafeGet() { return &value; } - inline operator const Value &() const; + inline const Value& get() const; + Value* unsafeGet() { return &value; } + inline operator const Value&() const; - inline JSObject &toObject() const; + inline JSObject& toObject() const; }; /* @@ -1234,12 +1236,12 @@ class ReadBarrieredValue * is templatized. */ template struct Unbarriered {}; -template struct Unbarriered< EncapsulatedPtr > { typedef S *type; }; -template struct Unbarriered< RelocatablePtr > { typedef S *type; }; +template struct Unbarriered< EncapsulatedPtr > { typedef S* type; }; +template struct Unbarriered< RelocatablePtr > { typedef S* type; }; template <> struct Unbarriered { typedef Value type; }; template <> struct Unbarriered { typedef Value type; }; template struct Unbarriered< DefaultHasher< EncapsulatedPtr > > { - typedef DefaultHasher type; + typedef DefaultHasher type; }; } /* namespace js */ diff --git a/js/src/gc/FindSCCs.h b/js/src/gc/FindSCCs.h index e7a7e9d8ee..b40999db69 100644 --- a/js/src/gc/FindSCCs.h +++ b/js/src/gc/FindSCCs.h @@ -16,8 +16,8 @@ namespace gc { template struct GraphNodeBase { - Node *gcNextGraphNode; - Node *gcNextGraphComponent; + Node* gcNextGraphNode; + Node* gcNextGraphComponent; unsigned gcDiscoveryTime; unsigned gcLowLink; @@ -29,13 +29,13 @@ struct GraphNodeBase ~GraphNodeBase() {} - Node *nextNodeInGroup() const { + Node* nextNodeInGroup() const { if (gcNextGraphNode && gcNextGraphNode->gcNextGraphComponent == gcNextGraphComponent) return gcNextGraphNode; return nullptr; } - Node *nextGroup() const { + Node* nextGroup() const { return gcNextGraphComponent; } }; @@ -49,7 +49,7 @@ struct GraphNodeBase * * struct MyGraphNode : public GraphNodeBase * { - * void findOutgoingEdges(ComponentFinder &finder) + * void findOutgoingEdges(ComponentFinder& finder) * { * for edge in my_outgoing_edges: * if is_relevant(edge): @@ -81,21 +81,21 @@ class ComponentFinder /* Forces all nodes to be added to a single component. */ void useOneComponent() { stackFull = true; } - void addNode(Node *v) { + void addNode(Node* v) { if (v->gcDiscoveryTime == Undefined) { JS_ASSERT(v->gcLowLink == Undefined); processNode(v); } } - Node *getResultsList() { + Node* getResultsList() { if (stackFull) { /* * All nodes after the stack overflow are in |stack|. Put them all in * one big component of their own. */ - Node *firstGoodComponent = firstComponent; - for (Node *v = stack; v; v = stack) { + Node* firstGoodComponent = firstComponent; + for (Node* v = stack; v; v = stack) { stack = v->gcNextGraphNode; v->gcNextGraphComponent = firstGoodComponent; v->gcNextGraphNode = firstComponent; @@ -106,10 +106,10 @@ class ComponentFinder JS_ASSERT(!stack); - Node *result = firstComponent; + Node* result = firstComponent; firstComponent = nullptr; - for (Node *v = result; v; v = v->gcNextGraphNode) { + for (Node* v = result; v; v = v->gcNextGraphNode) { v->gcDiscoveryTime = Undefined; v->gcLowLink = Undefined; } @@ -117,14 +117,14 @@ class ComponentFinder return result; } - static void mergeGroups(Node *first) { - for (Node *v = first; v; v = v->gcNextGraphNode) + static void mergeGroups(Node* first) { + for (Node* v = first; v; v = v->gcNextGraphNode) v->gcNextGraphComponent = nullptr; } public: /* Call from implementation of GraphNodeBase::findOutgoingEdges(). */ - void addEdgeTo(Node *w) { + void addEdgeTo(Node* w) { if (w->gcDiscoveryTime == Undefined) { processNode(w); cur->gcLowLink = Min(cur->gcLowLink, w->gcLowLink); @@ -140,7 +140,7 @@ class ComponentFinder /* Constant used to indicate an processed vertex that is no longer on the stack. */ static const unsigned Finished = (unsigned)-1; - void processNode(Node *v) { + void processNode(Node* v) { v->gcDiscoveryTime = clock; v->gcLowLink = clock; ++clock; @@ -154,7 +154,7 @@ class ComponentFinder return; } - Node *old = cur; + Node* old = cur; cur = v; cur->findOutgoingEdges(*this); cur = old; @@ -163,8 +163,8 @@ class ComponentFinder return; if (v->gcLowLink == v->gcDiscoveryTime) { - Node *nextComponent = firstComponent; - Node *w; + Node* nextComponent = firstComponent; + Node* w; do { JS_ASSERT(stack); w = stack; @@ -191,9 +191,9 @@ class ComponentFinder private: unsigned clock; - Node *stack; - Node *firstComponent; - Node *cur; + Node* stack; + Node* firstComponent; + Node* cur; uintptr_t stackLimit; bool stackFull; }; diff --git a/js/src/gc/GCInternals.h b/js/src/gc/GCInternals.h index 2ee1793f50..273e3c0cae 100644 --- a/js/src/gc/GCInternals.h +++ b/js/src/gc/GCInternals.h @@ -17,27 +17,27 @@ namespace js { namespace gc { void -MarkPersistentRootedChains(JSTracer *trc); +MarkPersistentRootedChains(JSTracer* trc); void -MarkRuntime(JSTracer *trc, bool useSavedRoots = false); +MarkRuntime(JSTracer* trc, bool useSavedRoots = false); void -BufferGrayRoots(GCMarker *gcmarker); +BufferGrayRoots(GCMarker* gcmarker); class AutoCopyFreeListToArenas { - JSRuntime *runtime; + JSRuntime* runtime; ZoneSelector selector; public: - AutoCopyFreeListToArenas(JSRuntime *rt, ZoneSelector selector); + AutoCopyFreeListToArenas(JSRuntime* rt, ZoneSelector selector); ~AutoCopyFreeListToArenas(); }; struct AutoFinishGC { - AutoFinishGC(JSRuntime *rt); + AutoFinishGC(JSRuntime* rt); }; /* @@ -47,12 +47,12 @@ struct AutoFinishGC class AutoTraceSession { public: - AutoTraceSession(JSRuntime *rt, HeapState state = Tracing); + AutoTraceSession(JSRuntime* rt, HeapState state = Tracing); ~AutoTraceSession(); protected: AutoLockForExclusiveAccess lock; - JSRuntime *runtime; + JSRuntime* runtime; private: AutoTraceSession(const AutoTraceSession&) MOZ_DELETE; @@ -67,18 +67,18 @@ struct AutoPrepareForTracing AutoTraceSession session; AutoCopyFreeListToArenas copy; - AutoPrepareForTracing(JSRuntime *rt, ZoneSelector selector); + AutoPrepareForTracing(JSRuntime* rt, ZoneSelector selector); }; class IncrementalSafety { - const char *reason_; + const char* reason_; - IncrementalSafety(const char *reason) : reason_(reason) {} + IncrementalSafety(const char* reason) : reason_(reason) {} public: static IncrementalSafety Safe() { return IncrementalSafety(nullptr); } - static IncrementalSafety Unsafe(const char *reason) { return IncrementalSafety(reason); } + static IncrementalSafety Unsafe(const char* reason) { return IncrementalSafety(reason); } typedef void (IncrementalSafety::* ConvertibleToBool)(); void nonNull() {} @@ -87,40 +87,40 @@ class IncrementalSafety return reason_ == nullptr ? &IncrementalSafety::nonNull : 0; } - const char *reason() { + const char* reason() { JS_ASSERT(reason_); return reason_; } }; IncrementalSafety -IsIncrementalGCSafe(JSRuntime *rt); +IsIncrementalGCSafe(JSRuntime* rt); #ifdef JS_GC_ZEAL void -StartVerifyPreBarriers(JSRuntime *rt); +StartVerifyPreBarriers(JSRuntime* rt); void -EndVerifyPreBarriers(JSRuntime *rt); +EndVerifyPreBarriers(JSRuntime* rt); void -StartVerifyPostBarriers(JSRuntime *rt); +StartVerifyPostBarriers(JSRuntime* rt); void -EndVerifyPostBarriers(JSRuntime *rt); +EndVerifyPostBarriers(JSRuntime* rt); void -FinishVerifier(JSRuntime *rt); +FinishVerifier(JSRuntime* rt); class AutoStopVerifyingBarriers { - JSRuntime *runtime; + JSRuntime* runtime; bool restartPreVerifier; bool restartPostVerifier; MOZ_DECL_USE_GUARD_OBJECT_NOTIFIER public: - AutoStopVerifyingBarriers(JSRuntime *rt, bool isShutdown + AutoStopVerifyingBarriers(JSRuntime* rt, bool isShutdown MOZ_GUARD_OBJECT_NOTIFIER_PARAM) : runtime(rt) { @@ -143,7 +143,7 @@ class AutoStopVerifyingBarriers #else struct AutoStopVerifyingBarriers { - AutoStopVerifyingBarriers(JSRuntime *, bool) {} + AutoStopVerifyingBarriers(JSRuntime*, bool) {} }; #endif /* JS_GC_ZEAL */ diff --git a/js/src/gc/Heap.h b/js/src/gc/Heap.h index d6d2664fd6..b58352759b 100644 --- a/js/src/gc/Heap.h +++ b/js/src/gc/Heap.h @@ -94,22 +94,22 @@ static const size_t MAX_BACKGROUND_FINALIZE_KINDS = FINALIZE_LIMIT - FINALIZE_OB struct Cell { public: - inline ArenaHeader *arenaHeader() const; + inline ArenaHeader* arenaHeader() const; inline AllocKind tenuredGetAllocKind() const; MOZ_ALWAYS_INLINE bool isMarked(uint32_t color = BLACK) const; MOZ_ALWAYS_INLINE bool markIfUnmarked(uint32_t color = BLACK) const; MOZ_ALWAYS_INLINE void unmark(uint32_t color) const; - inline JSRuntime *runtimeFromMainThread() const; - inline JS::shadow::Runtime *shadowRuntimeFromMainThread() const; - inline JS::Zone *tenuredZone() const; - inline JS::Zone *tenuredZoneFromAnyThread() const; - inline bool tenuredIsInsideZone(JS::Zone *zone) const; + inline JSRuntime* runtimeFromMainThread() const; + inline JS::shadow::Runtime* shadowRuntimeFromMainThread() const; + inline JS::Zone* tenuredZone() const; + inline JS::Zone* tenuredZoneFromAnyThread() const; + inline bool tenuredIsInsideZone(JS::Zone* zone) const; // Note: Unrestricted access to the runtime of a GC thing from an arbitrary // thread can easily lead to races. Use this method very carefully. - inline JSRuntime *runtimeFromAnyThread() const; - inline JS::shadow::Runtime *shadowRuntimeFromAnyThread() const; + inline JSRuntime* runtimeFromAnyThread() const; + inline JS::shadow::Runtime* shadowRuntimeFromAnyThread() const; #ifdef DEBUG inline bool isAligned() const; @@ -118,7 +118,7 @@ struct Cell protected: inline uintptr_t address() const; - inline Chunk *chunk() const; + inline Chunk* chunk() const; }; /* @@ -221,18 +221,18 @@ struct FreeSpan return !(last & uintptr_t(1)); } - const FreeSpan *nextSpan() const { + const FreeSpan* nextSpan() const { JS_ASSERT(hasNext()); - return reinterpret_cast(last); + return reinterpret_cast(last); } - FreeSpan *nextSpanUnchecked(size_t thingSize) const { + FreeSpan* nextSpanUnchecked(size_t thingSize) const { #ifdef DEBUG uintptr_t lastOffset = last & ArenaMask; JS_ASSERT(!(lastOffset & 1)); JS_ASSERT((ArenaSize - lastOffset) % thingSize == 0); #endif - return reinterpret_cast(last); + return reinterpret_cast(last); } uintptr_t arenaAddressUnchecked() const { @@ -244,11 +244,11 @@ struct FreeSpan return arenaAddressUnchecked(); } - ArenaHeader *arenaHeader() const { - return reinterpret_cast(arenaAddress()); + ArenaHeader* arenaHeader() const { + return reinterpret_cast(arenaAddress()); } - bool isSameNonEmptySpan(const FreeSpan *another) const { + bool isSameNonEmptySpan(const FreeSpan* another) const { JS_ASSERT(!isEmpty()); JS_ASSERT(!another->isEmpty()); return first == another->first && last == another->last; @@ -271,7 +271,7 @@ struct FreeSpan } /* See comments before FreeSpan for details. */ - MOZ_ALWAYS_INLINE void *allocate(size_t thingSize) { + MOZ_ALWAYS_INLINE void* allocate(size_t thingSize) { JS_ASSERT(thingSize % CellSize == 0); checkSpan(); uintptr_t thing = first; @@ -283,17 +283,17 @@ struct FreeSpan * Move to the next span. We use MOZ_LIKELY as without PGO * compilers mis-predict == here as unlikely to succeed. */ - *this = *reinterpret_cast(thing); + *this = *reinterpret_cast(thing); } else { return nullptr; } checkSpan(); - JS_EXTRA_POISON(reinterpret_cast(thing), JS_ALLOCATED_TENURED_PATTERN, thingSize); - return reinterpret_cast(thing); + JS_EXTRA_POISON(reinterpret_cast(thing), JS_ALLOCATED_TENURED_PATTERN, thingSize); + return reinterpret_cast(thing); } /* A version of allocate when we know that the span is not empty. */ - MOZ_ALWAYS_INLINE void *infallibleAllocate(size_t thingSize) { + MOZ_ALWAYS_INLINE void* infallibleAllocate(size_t thingSize) { JS_ASSERT(thingSize % CellSize == 0); checkSpan(); uintptr_t thing = first; @@ -301,11 +301,11 @@ struct FreeSpan first = thing + thingSize; } else { JS_ASSERT(thing == last); - *this = *reinterpret_cast(thing); + *this = *reinterpret_cast(thing); } checkSpan(); - JS_EXTRA_POISON(reinterpret_cast(thing), JS_ALLOCATED_TENURED_PATTERN, thingSize); - return reinterpret_cast(thing); + JS_EXTRA_POISON(reinterpret_cast(thing), JS_ALLOCATED_TENURED_PATTERN, thingSize); + return reinterpret_cast(thing); } /* @@ -314,15 +314,15 @@ struct FreeSpan * initialization so to allocate we simply return the first thing in the * arena and set the free list to point to the second. */ - MOZ_ALWAYS_INLINE void *allocateFromNewArena(uintptr_t arenaAddr, size_t firstThingOffset, + MOZ_ALWAYS_INLINE void* allocateFromNewArena(uintptr_t arenaAddr, size_t firstThingOffset, size_t thingSize) { JS_ASSERT(!(arenaAddr & ArenaMask)); uintptr_t thing = arenaAddr | firstThingOffset; first = thing + thingSize; last = arenaAddr | ArenaMask; checkSpan(); - JS_EXTRA_POISON(reinterpret_cast(thing), JS_ALLOCATED_TENURED_PATTERN, thingSize); - return reinterpret_cast(thing); + JS_EXTRA_POISON(reinterpret_cast(thing), JS_ALLOCATED_TENURED_PATTERN, thingSize); + return reinterpret_cast(thing); } void checkSpan() const { @@ -366,7 +366,7 @@ struct FreeSpan size_t beforeTail = ArenaSize - (last & ArenaMask); JS_ASSERT(beforeTail >= sizeof(FreeSpan) + CellSize); - FreeSpan *next = reinterpret_cast(last); + FreeSpan* next = reinterpret_cast(last); /* * The GC things on the list of free spans come from one arena @@ -399,7 +399,7 @@ struct ArenaHeader : public JS::shadow::ArenaHeader * next available Arena's header. When allocated, it points to the next * arena of the same size class and compartment. */ - ArenaHeader *next; + ArenaHeader* next; private: /* @@ -454,14 +454,14 @@ struct ArenaHeader : public JS::shadow::ArenaHeader "cover allocKind and hasDelayedMarking."); inline uintptr_t address() const; - inline Chunk *chunk() const; + inline Chunk* chunk() const; bool allocated() const { JS_ASSERT(allocKind <= size_t(FINALIZE_LIMIT)); return allocKind < size_t(FINALIZE_LIMIT); } - void init(JS::Zone *zoneArg, AllocKind kind) { + void init(JS::Zone* zoneArg, AllocKind kind) { JS_ASSERT(!allocated()); JS_ASSERT(!markOverflow); JS_ASSERT(!allocatedDuringIncremental); @@ -484,7 +484,7 @@ struct ArenaHeader : public JS::shadow::ArenaHeader } inline uintptr_t arenaAddress() const; - inline Arena *getArena(); + inline Arena* getArena(); AllocKind getAllocKind() const { JS_ASSERT(allocated()); @@ -504,18 +504,18 @@ struct ArenaHeader : public JS::shadow::ArenaHeader } inline FreeSpan getFirstFreeSpan() const; - inline void setFirstFreeSpan(const FreeSpan *span); + inline void setFirstFreeSpan(const FreeSpan* span); #ifdef DEBUG void checkSynchronizedWithFreeList() const; #endif - inline ArenaHeader *getNextDelayedMarking() const; - inline void setNextDelayedMarking(ArenaHeader *aheader); + inline ArenaHeader* getNextDelayedMarking() const; + inline void setNextDelayedMarking(ArenaHeader* aheader); inline void unsetDelayedMarking(); - inline ArenaHeader *getNextAllocDuringSweep() const; - inline void setNextAllocDuringSweep(ArenaHeader *aheader); + inline ArenaHeader* getNextAllocDuringSweep() const; + inline void setNextAllocDuringSweep(ArenaHeader* aheader); inline void unsetAllocDuringSweep(); }; @@ -587,7 +587,7 @@ struct Arena void setAsFullyUnused(AllocKind thingKind); template - bool finalize(FreeOp *fop, AllocKind thingKind, size_t thingSize); + bool finalize(FreeOp* fop, AllocKind thingKind, size_t thingSize); }; static_assert(sizeof(Arena) == ArenaSize, "The hardcoded arena size must match the struct size."); @@ -613,7 +613,7 @@ struct ChunkTrailer uint32_t padding; #endif - JSRuntime *runtime; + JSRuntime* runtime; }; static_assert(sizeof(ChunkTrailer) == 2 * sizeof(uintptr_t), "ChunkTrailer size is incorrect."); @@ -621,11 +621,11 @@ static_assert(sizeof(ChunkTrailer) == 2 * sizeof(uintptr_t), "ChunkTrailer size /* The chunk header (located at the end of the chunk to preserve arena alignment). */ struct ChunkInfo { - Chunk *next; - Chunk **prevp; + Chunk* next; + Chunk** prevp; /* Free arenas are linked together with aheader.next. */ - ArenaHeader *freeArenasHead; + ArenaHeader* freeArenasHead; #if JS_BITS_PER_WORD == 32 /* @@ -698,20 +698,20 @@ struct ChunkBitmap public: ChunkBitmap() { } - MOZ_ALWAYS_INLINE void getMarkWordAndMask(const Cell *cell, uint32_t color, - uintptr_t **wordp, uintptr_t *maskp) + MOZ_ALWAYS_INLINE void getMarkWordAndMask(const Cell* cell, uint32_t color, + uintptr_t** wordp, uintptr_t* maskp) { GetGCThingMarkWordAndMask(cell, color, wordp, maskp); } - MOZ_ALWAYS_INLINE MOZ_TSAN_BLACKLIST bool isMarked(const Cell *cell, uint32_t color) { - uintptr_t *word, mask; + MOZ_ALWAYS_INLINE MOZ_TSAN_BLACKLIST bool isMarked(const Cell* cell, uint32_t color) { + uintptr_t* word, mask; getMarkWordAndMask(cell, color, &word, &mask); return *word & mask; } - MOZ_ALWAYS_INLINE bool markIfUnmarked(const Cell *cell, uint32_t color) { - uintptr_t *word, mask; + MOZ_ALWAYS_INLINE bool markIfUnmarked(const Cell* cell, uint32_t color) { + uintptr_t* word, mask; getMarkWordAndMask(cell, BLACK, &word, &mask); if (*word & mask) return false; @@ -729,24 +729,24 @@ struct ChunkBitmap return true; } - MOZ_ALWAYS_INLINE void unmark(const Cell *cell, uint32_t color) { - uintptr_t *word, mask; + MOZ_ALWAYS_INLINE void unmark(const Cell* cell, uint32_t color) { + uintptr_t* word, mask; getMarkWordAndMask(cell, color, &word, &mask); *word &= ~mask; } void clear() { - memset((void *)bitmap, 0, sizeof(bitmap)); + memset((void*)bitmap, 0, sizeof(bitmap)); } - uintptr_t *arenaBits(ArenaHeader *aheader) { + uintptr_t* arenaBits(ArenaHeader* aheader) { static_assert(ArenaBitmapBits == ArenaBitmapWords * JS_BITS_PER_WORD, "We assume that the part of the bitmap corresponding to the arena " "has the exact number of words so we do not need to deal with a word " "that covers bits from two arenas."); - uintptr_t *word, unused; - getMarkWordAndMask(reinterpret_cast(aheader->address()), BLACK, &word, &unused); + uintptr_t* word, unused; + getMarkWordAndMask(reinterpret_cast(aheader->address()), BLACK, &word, &unused); return word; } }; @@ -781,9 +781,9 @@ struct Chunk PerArenaBitmap decommittedArenas; ChunkInfo info; - static Chunk *fromAddress(uintptr_t addr) { + static Chunk* fromAddress(uintptr_t addr) { addr &= ~ChunkMask; - return reinterpret_cast(addr); + return reinterpret_cast(addr); } static bool withinArenasRange(uintptr_t addr) { @@ -810,18 +810,18 @@ struct Chunk return info.numArenasFree != 0; } - inline void addToAvailableList(JS::Zone *zone); - inline void insertToAvailableList(Chunk **insertPoint); + inline void addToAvailableList(JS::Zone* zone); + inline void insertToAvailableList(Chunk** insertPoint); inline void removeFromAvailableList(); - ArenaHeader *allocateArena(JS::Zone *zone, AllocKind kind); + ArenaHeader* allocateArena(JS::Zone* zone, AllocKind kind); - void releaseArena(ArenaHeader *aheader); - void recycleArena(ArenaHeader *aheader, ArenaList &dest, AllocKind thingKind); + void releaseArena(ArenaHeader* aheader); + void recycleArena(ArenaHeader* aheader, ArenaList& dest, AllocKind thingKind); - static Chunk *allocate(JSRuntime *rt); + static Chunk* allocate(JSRuntime* rt); - void decommitAllArenas(JSRuntime *rt) { + void decommitAllArenas(JSRuntime* rt) { decommittedArenas.clear(true); MarkPagesUnused(rt, &arenas[0], ArenasPerChunk * ArenaSize); @@ -832,30 +832,30 @@ struct Chunk } /* Must be called with the GC lock taken. */ - static inline void release(JSRuntime *rt, Chunk *chunk); - static inline void releaseList(JSRuntime *rt, Chunk *chunkListHead); + static inline void release(JSRuntime* rt, Chunk* chunk); + static inline void releaseList(JSRuntime* rt, Chunk* chunkListHead); /* Must be called with the GC lock taken. */ - inline void prepareToBeFreed(JSRuntime *rt); + inline void prepareToBeFreed(JSRuntime* rt); /* * Assuming that the info.prevp points to the next field of the previous * chunk in a doubly-linked list, get that chunk. */ - Chunk *getPrevious() { + Chunk* getPrevious() { JS_ASSERT(info.prevp); return fromPointerToNext(info.prevp); } /* Get the chunk from a pointer to its info.next field. */ - static Chunk *fromPointerToNext(Chunk **nextFieldPtr) { + static Chunk* fromPointerToNext(Chunk** nextFieldPtr) { uintptr_t addr = reinterpret_cast(nextFieldPtr); JS_ASSERT((addr & ChunkMask) == offsetof(Chunk, info.next)); - return reinterpret_cast(addr - offsetof(Chunk, info.next)); + return reinterpret_cast(addr - offsetof(Chunk, info.next)); } private: - inline void init(JSRuntime *rt); + inline void init(JSRuntime* rt); /* Search for a decommitted arena to allocate. */ unsigned findDecommittedArenaOffset(); @@ -863,9 +863,9 @@ struct Chunk public: /* Unlink and return the freeArenasHead. */ - inline ArenaHeader* fetchNextFreeArena(JSRuntime *rt); + inline ArenaHeader* fetchNextFreeArena(JSRuntime* rt); - inline void addArenaToFreeList(JSRuntime *rt, ArenaHeader *aheader); + inline void addArenaToFreeList(JSRuntime* rt, ArenaHeader* aheader); }; static_assert(sizeof(Chunk) == ChunkSize, @@ -886,7 +886,7 @@ ArenaHeader::address() const return addr; } -inline Chunk * +inline Chunk* ArenaHeader::chunk() const { return Chunk::fromAddress(address()); @@ -898,10 +898,10 @@ ArenaHeader::arenaAddress() const return address(); } -inline Arena * +inline Arena* ArenaHeader::getArena() { - return reinterpret_cast(arenaAddress()); + return reinterpret_cast(arenaAddress()); } inline bool @@ -923,21 +923,21 @@ ArenaHeader::getFirstFreeSpan() const } void -ArenaHeader::setFirstFreeSpan(const FreeSpan *span) +ArenaHeader::setFirstFreeSpan(const FreeSpan* span) { JS_ASSERT(span->isWithinArena(arenaAddress())); firstFreeSpanOffsets = span->encodeAsOffsets(); } -inline ArenaHeader * +inline ArenaHeader* ArenaHeader::getNextDelayedMarking() const { JS_ASSERT(hasDelayedMarking); - return &reinterpret_cast(auxNextLink << ArenaShift)->aheader; + return &reinterpret_cast(auxNextLink << ArenaShift)->aheader; } inline void -ArenaHeader::setNextDelayedMarking(ArenaHeader *aheader) +ArenaHeader::setNextDelayedMarking(ArenaHeader* aheader) { JS_ASSERT(!(uintptr_t(aheader) & ArenaMask)); JS_ASSERT(!auxNextLink && !hasDelayedMarking); @@ -953,15 +953,15 @@ ArenaHeader::unsetDelayedMarking() auxNextLink = 0; } -inline ArenaHeader * +inline ArenaHeader* ArenaHeader::getNextAllocDuringSweep() const { JS_ASSERT(allocatedDuringIncremental); - return &reinterpret_cast(auxNextLink << ArenaShift)->aheader; + return &reinterpret_cast(auxNextLink << ArenaShift)->aheader; } inline void -ArenaHeader::setNextAllocDuringSweep(ArenaHeader *aheader) +ArenaHeader::setNextAllocDuringSweep(ArenaHeader* aheader) { JS_ASSERT(!auxNextLink && !allocatedDuringIncremental); allocatedDuringIncremental = 1; @@ -977,44 +977,44 @@ ArenaHeader::unsetAllocDuringSweep() } static void -AssertValidColor(const void *thing, uint32_t color) +AssertValidColor(const void* thing, uint32_t color) { #ifdef DEBUG - ArenaHeader *aheader = reinterpret_cast(thing)->arenaHeader(); + ArenaHeader* aheader = reinterpret_cast(thing)->arenaHeader(); JS_ASSERT(color < aheader->getThingSize() / CellSize); #endif } -inline ArenaHeader * +inline ArenaHeader* Cell::arenaHeader() const { JS_ASSERT(isTenured()); uintptr_t addr = address(); addr &= ~ArenaMask; - return reinterpret_cast(addr); + return reinterpret_cast(addr); } -inline JSRuntime * +inline JSRuntime* Cell::runtimeFromMainThread() const { - JSRuntime *rt = chunk()->info.trailer.runtime; + JSRuntime* rt = chunk()->info.trailer.runtime; JS_ASSERT(CurrentThreadCanAccessRuntime(rt)); return rt; } -inline JS::shadow::Runtime * +inline JS::shadow::Runtime* Cell::shadowRuntimeFromMainThread() const { return reinterpret_cast(runtimeFromMainThread()); } -inline JSRuntime * +inline JSRuntime* Cell::runtimeFromAnyThread() const { return chunk()->info.trailer.runtime; } -inline JS::shadow::Runtime * +inline JS::shadow::Runtime* Cell::shadowRuntimeFromAnyThread() const { return reinterpret_cast(runtimeFromAnyThread()); @@ -1046,16 +1046,16 @@ Cell::unmark(uint32_t color) const chunk()->bitmap.unmark(this, color); } -JS::Zone * +JS::Zone* Cell::tenuredZone() const { - JS::Zone *zone = arenaHeader()->zone; + JS::Zone* zone = arenaHeader()->zone; JS_ASSERT(CurrentThreadCanAccessZone(zone)); JS_ASSERT(isTenured()); return zone; } -JS::Zone * +JS::Zone* Cell::tenuredZoneFromAnyThread() const { JS_ASSERT(isTenured()); @@ -1063,7 +1063,7 @@ Cell::tenuredZoneFromAnyThread() const } bool -Cell::tenuredIsInsideZone(JS::Zone *zone) const +Cell::tenuredIsInsideZone(JS::Zone* zone) const { JS_ASSERT(isTenured()); return zone == arenaHeader()->zone; @@ -1080,7 +1080,7 @@ bool Cell::isTenured() const { #ifdef JSGC_GENERATIONAL - JS::shadow::Runtime *rt = js::gc::GetGCThingRuntime(this); + JS::shadow::Runtime* rt = js::gc::GetGCThingRuntime(this); return !IsInsideNursery(rt, this); #endif return true; @@ -1096,17 +1096,17 @@ Cell::address() const return addr; } -Chunk * +Chunk* Cell::chunk() const { uintptr_t addr = uintptr_t(this); JS_ASSERT(addr % CellSize == 0); addr &= ~(ChunkSize - 1); - return reinterpret_cast(addr); + return reinterpret_cast(addr); } inline bool -InFreeList(ArenaHeader *aheader, void *thing) +InFreeList(ArenaHeader* aheader, void* thing) { if (!aheader->hasFreeThings()) return false; @@ -1114,7 +1114,7 @@ InFreeList(ArenaHeader *aheader, void *thing) FreeSpan firstSpan(aheader->getFirstFreeSpan()); uintptr_t addr = reinterpret_cast(thing); - for (const FreeSpan *span = &firstSpan;;) { + for (const FreeSpan* span = &firstSpan;;) { /* If the thing comes before the current span, it's not free. */ if (addr < span->first) return false; diff --git a/js/src/gc/Iteration.cpp b/js/src/gc/Iteration.cpp index 3b1582d606..15b864bc59 100644 --- a/js/src/gc/Iteration.cpp +++ b/js/src/gc/Iteration.cpp @@ -18,7 +18,7 @@ using namespace js; using namespace js::gc; void -js::TraceRuntime(JSTracer *trc) +js::TraceRuntime(JSTracer* trc) { JS_ASSERT(!IS_GC_MARKING_TRACER(trc)); @@ -28,7 +28,7 @@ js::TraceRuntime(JSTracer *trc) } static void -IterateCompartmentsArenasCells(JSRuntime *rt, Zone *zone, void *data, +IterateCompartmentsArenasCells(JSRuntime* rt, Zone* zone, void* data, JSIterateCompartmentCallback compartmentCallback, IterateArenaCallback arenaCallback, IterateCellCallback cellCallback) @@ -41,7 +41,7 @@ IterateCompartmentsArenasCells(JSRuntime *rt, Zone *zone, void *data, size_t thingSize = Arena::thingSize(AllocKind(thingKind)); for (ArenaIter aiter(zone, AllocKind(thingKind)); !aiter.done(); aiter.next()) { - ArenaHeader *aheader = aiter.get(); + ArenaHeader* aheader = aiter.get(); (*arenaCallback)(rt, data, aheader->getArena(), traceKind, thingSize); for (CellIterUnderGC iter(aheader); !iter.done(); iter.next()) (*cellCallback)(rt, data, iter.getCell(), traceKind, thingSize); @@ -50,7 +50,7 @@ IterateCompartmentsArenasCells(JSRuntime *rt, Zone *zone, void *data, } void -js::IterateZonesCompartmentsArenasCells(JSRuntime *rt, void *data, +js::IterateZonesCompartmentsArenasCells(JSRuntime* rt, void* data, IterateZoneCallback zoneCallback, JSIterateCompartmentCallback compartmentCallback, IterateArenaCallback arenaCallback, @@ -66,7 +66,7 @@ js::IterateZonesCompartmentsArenasCells(JSRuntime *rt, void *data, } void -js::IterateZoneCompartmentsArenasCells(JSRuntime *rt, Zone *zone, void *data, +js::IterateZoneCompartmentsArenasCells(JSRuntime* rt, Zone* zone, void* data, IterateZoneCallback zoneCallback, JSIterateCompartmentCallback compartmentCallback, IterateArenaCallback arenaCallback, @@ -80,7 +80,7 @@ js::IterateZoneCompartmentsArenasCells(JSRuntime *rt, Zone *zone, void *data, } void -js::IterateChunks(JSRuntime *rt, void *data, IterateChunkCallback chunkCallback) +js::IterateChunks(JSRuntime* rt, void* data, IterateChunkCallback chunkCallback) { AutoPrepareForTracing prep(rt, SkipAtoms); @@ -89,15 +89,15 @@ js::IterateChunks(JSRuntime *rt, void *data, IterateChunkCallback chunkCallback) } void -js::IterateScripts(JSRuntime *rt, JSCompartment *compartment, - void *data, IterateScriptCallback scriptCallback) +js::IterateScripts(JSRuntime* rt, JSCompartment* compartment, + void* data, IterateScriptCallback scriptCallback) { MinorGC(rt, JS::gcreason::EVICT_NURSERY); AutoPrepareForTracing prep(rt, SkipAtoms); if (compartment) { for (CellIterUnderGC i(compartment->zone(), gc::FINALIZE_SCRIPT); !i.done(); i.next()) { - JSScript *script = i.get(); + JSScript* script = i.get(); if (script->compartment() == compartment) scriptCallback(rt, data, script); } @@ -110,14 +110,14 @@ js::IterateScripts(JSRuntime *rt, JSCompartment *compartment, } void -js::IterateGrayObjects(Zone *zone, GCThingCallback cellCallback, void *data) +js::IterateGrayObjects(Zone* zone, GCThingCallback cellCallback, void* data) { MinorGC(zone->runtimeFromMainThread(), JS::gcreason::EVICT_NURSERY); AutoPrepareForTracing prep(zone->runtimeFromMainThread(), SkipAtoms); for (size_t finalizeKind = 0; finalizeKind <= FINALIZE_OBJECT_LAST; finalizeKind++) { for (CellIterUnderGC i(zone, AllocKind(finalizeKind)); !i.done(); i.next()) { - JSObject *obj = i.get(); + JSObject* obj = i.get(); if (obj->isMarked(GRAY)) cellCallback(data, obj); } @@ -125,7 +125,7 @@ js::IterateGrayObjects(Zone *zone, GCThingCallback cellCallback, void *data) } JS_PUBLIC_API(void) -JS_IterateCompartments(JSRuntime *rt, void *data, +JS_IterateCompartments(JSRuntime* rt, void* data, JSIterateCompartmentCallback compartmentCallback) { JS_ASSERT(!rt->isHeapBusy()); diff --git a/js/src/gc/Marking.cpp b/js/src/gc/Marking.cpp index 9d55832bc9..3737c182e2 100644 --- a/js/src/gc/Marking.cpp +++ b/js/src/gc/Marking.cpp @@ -64,33 +64,33 @@ JS_PUBLIC_DATA(void * const) JS::NullPtr::constNullValue = nullptr; */ static inline void -PushMarkStack(GCMarker *gcmarker, ObjectImpl *thing); +PushMarkStack(GCMarker* gcmarker, ObjectImpl* thing); static inline void -PushMarkStack(GCMarker *gcmarker, JSFunction *thing); +PushMarkStack(GCMarker* gcmarker, JSFunction* thing); static inline void -PushMarkStack(GCMarker *gcmarker, JSScript *thing); +PushMarkStack(GCMarker* gcmarker, JSScript* thing); static inline void -PushMarkStack(GCMarker *gcmarker, Shape *thing); +PushMarkStack(GCMarker* gcmarker, Shape* thing); static inline void -PushMarkStack(GCMarker *gcmarker, JSString *thing); +PushMarkStack(GCMarker* gcmarker, JSString* thing); static inline void -PushMarkStack(GCMarker *gcmarker, types::TypeObject *thing); +PushMarkStack(GCMarker* gcmarker, types::TypeObject* thing); namespace js { namespace gc { -static void MarkChildren(JSTracer *trc, JSString *str); -static void MarkChildren(JSTracer *trc, JSScript *script); -static void MarkChildren(JSTracer *trc, LazyScript *lazy); -static void MarkChildren(JSTracer *trc, Shape *shape); -static void MarkChildren(JSTracer *trc, BaseShape *base); -static void MarkChildren(JSTracer *trc, types::TypeObject *type); -static void MarkChildren(JSTracer *trc, jit::JitCode *code); +static void MarkChildren(JSTracer* trc, JSString* str); +static void MarkChildren(JSTracer* trc, JSScript* script); +static void MarkChildren(JSTracer* trc, LazyScript* lazy); +static void MarkChildren(JSTracer* trc, Shape* shape); +static void MarkChildren(JSTracer* trc, BaseShape* base); +static void MarkChildren(JSTracer* trc, types::TypeObject* type); +static void MarkChildren(JSTracer* trc, jit::JitCode* code); } /* namespace gc */ } /* namespace js */ @@ -100,7 +100,7 @@ static void MarkChildren(JSTracer *trc, jit::JitCode *code); #if defined(DEBUG) template static inline bool -IsThingPoisoned(T *thing) +IsThingPoisoned(T* thing) { static_assert(sizeof(T) >= sizeof(FreeSpan) + sizeof(uint32_t), "Ensure it is well defined to look past any free span that " @@ -116,7 +116,7 @@ IsThingPoisoned(T *thing) JS_SWEPT_FRAME_PATTERN }; const int numPoisonBytes = sizeof(poisonBytes) / sizeof(poisonBytes[0]); - uint32_t *p = reinterpret_cast(reinterpret_cast(thing) + 1); + uint32_t* p = reinterpret_cast(reinterpret_cast(thing) + 1); // Note: all free patterns are odd to make the common, not-poisoned case a single test. if ((*p & 1) == 0) return false; @@ -130,23 +130,23 @@ IsThingPoisoned(T *thing) } #endif -static GCMarker * -AsGCMarker(JSTracer *trc) +static GCMarker* +AsGCMarker(JSTracer* trc) { JS_ASSERT(IS_GC_MARKING_TRACER(trc)); - return static_cast(trc); + return static_cast(trc); } -template bool ThingIsPermanentAtom(T *thing) { return false; } -template <> bool ThingIsPermanentAtom(JSString *str) { return str->isPermanentAtom(); } -template <> bool ThingIsPermanentAtom(JSFlatString *str) { return str->isPermanentAtom(); } -template <> bool ThingIsPermanentAtom(JSLinearString *str) { return str->isPermanentAtom(); } -template <> bool ThingIsPermanentAtom(JSAtom *atom) { return atom->isPermanent(); } -template <> bool ThingIsPermanentAtom(PropertyName *name) { return name->isPermanent(); } +template bool ThingIsPermanentAtom(T* thing) { return false; } +template <> bool ThingIsPermanentAtom(JSString* str) { return str->isPermanentAtom(); } +template <> bool ThingIsPermanentAtom(JSFlatString* str) { return str->isPermanentAtom(); } +template <> bool ThingIsPermanentAtom(JSLinearString* str) { return str->isPermanentAtom(); } +template <> bool ThingIsPermanentAtom(JSAtom* atom) { return atom->isPermanent(); } +template <> bool ThingIsPermanentAtom(PropertyName* name) { return name->isPermanent(); } template static inline void -CheckMarkedThing(JSTracer *trc, T *thing) +CheckMarkedThing(JSTracer* trc, T* thing) { #ifdef DEBUG JS_ASSERT(trc); @@ -167,7 +167,7 @@ CheckMarkedThing(JSTracer *trc, T *thing) JS_ASSERT(thing->zone()->runtimeFromMainThread() == trc->runtime()); JS_ASSERT(trc->hasTracingDetails()); - DebugOnly rt = trc->runtime(); + DebugOnly rt = trc->runtime(); JS_ASSERT_IF(IS_GC_MARKING_TRACER(trc) && rt->gcManipulatingDeadZones, !thing->zone()->scheduledForDestruction); @@ -203,10 +203,10 @@ CheckMarkedThing(JSTracer *trc, T *thing) template static void -MarkInternal(JSTracer *trc, T **thingp) +MarkInternal(JSTracer* trc, T** thingp) { JS_ASSERT(thingp); - T *thing = *thingp; + T* thing = *thingp; CheckMarkedThing(trc, thing); @@ -238,7 +238,7 @@ MarkInternal(JSTracer *trc, T **thingp) PushMarkStack(AsGCMarker(trc), thing); thing->zone()->maybeAlive = true; } else { - trc->callback(trc, (void **)thingp, MapTypeToTraceKind::kind); + trc->callback(trc, (void**)thingp, MapTypeToTraceKind::kind); trc->unsetTracingLocation(); } @@ -255,7 +255,7 @@ namespace gc { template void -MarkUnbarriered(JSTracer *trc, T **thingp, const char *name) +MarkUnbarriered(JSTracer* trc, T** thingp, const char* name) { trc->setTracingName(name); MarkInternal(trc, thingp); @@ -263,14 +263,14 @@ MarkUnbarriered(JSTracer *trc, T **thingp, const char *name) template static void -Mark(JSTracer *trc, BarrieredPtr *thing, const char *name) +Mark(JSTracer* trc, BarrieredPtr* thing, const char* name) { trc->setTracingName(name); MarkInternal(trc, thing->unsafeGet()); } void -MarkPermanentAtom(JSTracer *trc, JSAtom *atom, const char *name) +MarkPermanentAtom(JSTracer* trc, JSAtom* atom, const char* name) { trc->setTracingName(name); @@ -283,7 +283,7 @@ MarkPermanentAtom(JSTracer *trc, JSAtom *atom, const char *name) // Additionally, PushMarkStack will ignore permanent atoms. atom->markIfUnmarked(); } else { - void *thing = atom; + void* thing = atom; trc->callback(trc, &thing, JSTRACE_STRING); JS_ASSERT(thing == atom); trc->unsetTracingLocation(); @@ -297,7 +297,7 @@ MarkPermanentAtom(JSTracer *trc, JSAtom *atom, const char *name) template static void -MarkRoot(JSTracer *trc, T **thingp, const char *name) +MarkRoot(JSTracer* trc, T** thingp, const char* name) { JS_ROOT_MARKING_ASSERT(trc); trc->setTracingName(name); @@ -306,7 +306,7 @@ MarkRoot(JSTracer *trc, T **thingp, const char *name) template static void -MarkRange(JSTracer *trc, size_t len, HeapPtr *vec, const char *name) +MarkRange(JSTracer* trc, size_t len, HeapPtr* vec, const char* name) { for (size_t i = 0; i < len; ++i) { if (vec[i].get()) { @@ -318,7 +318,7 @@ MarkRange(JSTracer *trc, size_t len, HeapPtr *vec, const char *name) template static void -MarkRootRange(JSTracer *trc, size_t len, T **vec, const char *name) +MarkRootRange(JSTracer* trc, size_t len, T** vec, const char* name) { JS_ROOT_MARKING_ASSERT(trc); for (size_t i = 0; i < len; ++i) { @@ -334,16 +334,16 @@ namespace gc { template static bool -IsMarked(T **thingp) +IsMarked(T** thingp) { JS_ASSERT(thingp); JS_ASSERT(*thingp); #ifdef JSGC_GENERATIONAL - Nursery &nursery = (*thingp)->runtimeFromMainThread()->gcNursery; + Nursery& nursery = (*thingp)->runtimeFromMainThread()->gcNursery; if (nursery.isInside(*thingp)) return nursery.getForwardedPointer(thingp); #endif - Zone *zone = (*thingp)->tenuredZone(); + Zone* zone = (*thingp)->tenuredZone(); if (!zone->isCollecting() || zone->isGCFinished()) return true; return (*thingp)->isMarked(); @@ -351,20 +351,20 @@ IsMarked(T **thingp) template static bool -IsAboutToBeFinalized(T **thingp) +IsAboutToBeFinalized(T** thingp) { JS_ASSERT(thingp); JS_ASSERT(*thingp); - T *thing = *thingp; - JSRuntime *rt = thing->runtimeFromAnyThread(); + T* thing = *thingp; + JSRuntime* rt = thing->runtimeFromAnyThread(); /* Permanent atoms are never finalized by non-owning runtimes. */ if (ThingIsPermanentAtom(thing) && !TlsPerThreadData.get()->associatedWith(rt)) return false; #ifdef JSGC_GENERATIONAL - Nursery &nursery = rt->gcNursery; + Nursery& nursery = rt->gcNursery; JS_ASSERT_IF(!rt->isHeapMinorCollecting(), !nursery.isInside(thing)); if (rt->isHeapMinorCollecting()) { if (nursery.isInside(thing)) @@ -389,8 +389,8 @@ IsAboutToBeFinalized(T **thingp) } template -T * -UpdateIfRelocated(JSRuntime *rt, T **thingp) +T* +UpdateIfRelocated(JSRuntime* rt, T** thingp) { JS_ASSERT(thingp); #ifdef JSGC_GENERATIONAL @@ -402,19 +402,19 @@ UpdateIfRelocated(JSRuntime *rt, T **thingp) #define DeclMarkerImpl(base, type) \ void \ -Mark##base(JSTracer *trc, BarrieredPtr *thing, const char *name) \ +Mark##base(JSTracer* trc, BarrieredPtr* thing, const char* name) \ { \ Mark(trc, thing, name); \ } \ \ void \ -Mark##base##Root(JSTracer *trc, type **thingp, const char *name) \ +Mark##base##Root(JSTracer* trc, type** thingp, const char* name) \ { \ MarkRoot(trc, thingp, name); \ } \ \ void \ -Mark##base##Unbarriered(JSTracer *trc, type **thingp, const char *name) \ +Mark##base##Unbarriered(JSTracer* trc, type** thingp, const char* name) \ { \ MarkUnbarriered(trc, thingp, name); \ } \ @@ -422,52 +422,52 @@ Mark##base##Unbarriered(JSTracer *trc, type **thingp, const char *name) /* Explicitly instantiate MarkUnbarriered. It is referenced from */ \ /* other translation units and the instantiation might otherwise get */ \ /* inlined away. */ \ -template void MarkUnbarriered(JSTracer *, type **, const char *); \ +template void MarkUnbarriered(JSTracer*, type**, const char*); \ \ void \ -Mark##base##Range(JSTracer *trc, size_t len, HeapPtr *vec, const char *name) \ +Mark##base##Range(JSTracer* trc, size_t len, HeapPtr* vec, const char* name) \ { \ MarkRange(trc, len, vec, name); \ } \ \ void \ -Mark##base##RootRange(JSTracer *trc, size_t len, type **vec, const char *name) \ +Mark##base##RootRange(JSTracer* trc, size_t len, type** vec, const char* name) \ { \ MarkRootRange(trc, len, vec, name); \ } \ \ bool \ -Is##base##Marked(type **thingp) \ +Is##base##Marked(type** thingp) \ { \ return IsMarked(thingp); \ } \ \ bool \ -Is##base##Marked(BarrieredPtr *thingp) \ +Is##base##Marked(BarrieredPtr* thingp) \ { \ return IsMarked(thingp->unsafeGet()); \ } \ \ bool \ -Is##base##AboutToBeFinalized(type **thingp) \ +Is##base##AboutToBeFinalized(type** thingp) \ { \ return IsAboutToBeFinalized(thingp); \ } \ \ bool \ -Is##base##AboutToBeFinalized(BarrieredPtr *thingp) \ +Is##base##AboutToBeFinalized(BarrieredPtr* thingp) \ { \ return IsAboutToBeFinalized(thingp->unsafeGet()); \ } \ \ type * \ -Update##base##IfRelocated(JSRuntime *rt, BarrieredPtr *thingp) \ +Update##base##IfRelocated(JSRuntime* rt, BarrieredPtr* thingp) \ { \ return UpdateIfRelocated(rt, thingp->unsafeGet()); \ } \ \ type * \ -Update##base##IfRelocated(JSRuntime *rt, type **thingp) \ +Update##base##IfRelocated(JSRuntime* rt, type** thingp) \ { \ return UpdateIfRelocated(rt, thingp); \ } @@ -502,42 +502,42 @@ DeclMarkerImpl(TypeObject, js::types::TypeObject) /*** Externally Typed Marking ***/ void -gc::MarkKind(JSTracer *trc, void **thingp, JSGCTraceKind kind) +gc::MarkKind(JSTracer* trc, void** thingp, JSGCTraceKind kind) { JS_ASSERT(thingp); JS_ASSERT(*thingp); - DebugOnly cell = static_cast(*thingp); + DebugOnly cell = static_cast(*thingp); JS_ASSERT_IF(cell->isTenured(), kind == MapAllocToTraceKind(cell->tenuredGetAllocKind())); switch (kind) { case JSTRACE_OBJECT: - MarkInternal(trc, reinterpret_cast(thingp)); + MarkInternal(trc, reinterpret_cast(thingp)); break; case JSTRACE_STRING: - MarkInternal(trc, reinterpret_cast(thingp)); + MarkInternal(trc, reinterpret_cast(thingp)); break; case JSTRACE_SCRIPT: - MarkInternal(trc, reinterpret_cast(thingp)); + MarkInternal(trc, reinterpret_cast(thingp)); break; case JSTRACE_LAZY_SCRIPT: - MarkInternal(trc, reinterpret_cast(thingp)); + MarkInternal(trc, reinterpret_cast(thingp)); break; case JSTRACE_SHAPE: - MarkInternal(trc, reinterpret_cast(thingp)); + MarkInternal(trc, reinterpret_cast(thingp)); break; case JSTRACE_BASE_SHAPE: - MarkInternal(trc, reinterpret_cast(thingp)); + MarkInternal(trc, reinterpret_cast(thingp)); break; case JSTRACE_TYPE_OBJECT: - MarkInternal(trc, reinterpret_cast(thingp)); + MarkInternal(trc, reinterpret_cast(thingp)); break; case JSTRACE_JITCODE: - MarkInternal(trc, reinterpret_cast(thingp)); + MarkInternal(trc, reinterpret_cast(thingp)); break; } } static void -MarkGCThingInternal(JSTracer *trc, void **thingp, const char *name) +MarkGCThingInternal(JSTracer* trc, void** thingp, const char* name) { trc->setTracingName(name); JS_ASSERT(thingp); @@ -547,14 +547,14 @@ MarkGCThingInternal(JSTracer *trc, void **thingp, const char *name) } void -gc::MarkGCThingRoot(JSTracer *trc, void **thingp, const char *name) +gc::MarkGCThingRoot(JSTracer* trc, void** thingp, const char* name) { JS_ROOT_MARKING_ASSERT(trc); MarkGCThingInternal(trc, thingp, name); } void -gc::MarkGCThingUnbarriered(JSTracer *trc, void **thingp, const char *name) +gc::MarkGCThingUnbarriered(JSTracer* trc, void** thingp, const char* name) { MarkGCThingInternal(trc, thingp, name); } @@ -562,16 +562,16 @@ gc::MarkGCThingUnbarriered(JSTracer *trc, void **thingp, const char *name) /*** ID Marking ***/ static inline void -MarkIdInternal(JSTracer *trc, jsid *id) +MarkIdInternal(JSTracer* trc, jsid* id) { if (JSID_IS_STRING(*id)) { - JSString *str = JSID_TO_STRING(*id); - trc->setTracingLocation((void *)id); + JSString* str = JSID_TO_STRING(*id); + trc->setTracingLocation((void*)id); MarkInternal(trc, &str); - *id = NON_INTEGER_ATOM_TO_JSID(reinterpret_cast(str)); + *id = NON_INTEGER_ATOM_TO_JSID(reinterpret_cast(str)); } else if (MOZ_UNLIKELY(JSID_IS_OBJECT(*id))) { - JSObject *obj = JSID_TO_OBJECT(*id); - trc->setTracingLocation((void *)id); + JSObject* obj = JSID_TO_OBJECT(*id); + trc->setTracingLocation((void*)id); MarkInternal(trc, &obj); *id = OBJECT_TO_JSID(obj); } else { @@ -581,14 +581,14 @@ MarkIdInternal(JSTracer *trc, jsid *id) } void -gc::MarkId(JSTracer *trc, BarrieredId *id, const char *name) +gc::MarkId(JSTracer* trc, BarrieredId* id, const char* name) { trc->setTracingName(name); MarkIdInternal(trc, id->unsafeGet()); } void -gc::MarkIdRoot(JSTracer *trc, jsid *id, const char *name) +gc::MarkIdRoot(JSTracer* trc, jsid* id, const char* name) { JS_ROOT_MARKING_ASSERT(trc); trc->setTracingName(name); @@ -596,14 +596,14 @@ gc::MarkIdRoot(JSTracer *trc, jsid *id, const char *name) } void -gc::MarkIdUnbarriered(JSTracer *trc, jsid *id, const char *name) +gc::MarkIdUnbarriered(JSTracer* trc, jsid* id, const char* name) { trc->setTracingName(name); MarkIdInternal(trc, id); } void -gc::MarkIdRange(JSTracer *trc, size_t len, HeapId *vec, const char *name) +gc::MarkIdRange(JSTracer* trc, size_t len, HeapId* vec, const char* name) { for (size_t i = 0; i < len; ++i) { trc->setTracingIndex(name, i); @@ -612,7 +612,7 @@ gc::MarkIdRange(JSTracer *trc, size_t len, HeapId *vec, const char *name) } void -gc::MarkIdRootRange(JSTracer *trc, size_t len, jsid *vec, const char *name) +gc::MarkIdRootRange(JSTracer* trc, size_t len, jsid* vec, const char* name) { JS_ROOT_MARKING_ASSERT(trc); for (size_t i = 0; i < len; ++i) { @@ -624,17 +624,17 @@ gc::MarkIdRootRange(JSTracer *trc, size_t len, jsid *vec, const char *name) /*** Value Marking ***/ static inline void -MarkValueInternal(JSTracer *trc, Value *v) +MarkValueInternal(JSTracer* trc, Value* v) { if (v->isMarkable()) { JS_ASSERT(v->toGCThing()); - void *thing = v->toGCThing(); - trc->setTracingLocation((void *)v); + void* thing = v->toGCThing(); + trc->setTracingLocation((void*)v); MarkKind(trc, &thing, v->gcKind()); if (v->isString()) - v->setString((JSString *)thing); + v->setString((JSString*)thing); else - v->setObjectOrNull((JSObject *)thing); + v->setObjectOrNull((JSObject*)thing); } else { /* Unset realLocation manually if we do not call MarkInternal. */ trc->unsetTracingLocation(); @@ -642,14 +642,14 @@ MarkValueInternal(JSTracer *trc, Value *v) } void -gc::MarkValue(JSTracer *trc, BarrieredValue *v, const char *name) +gc::MarkValue(JSTracer* trc, BarrieredValue* v, const char* name) { trc->setTracingName(name); MarkValueInternal(trc, v->unsafeGet()); } void -gc::MarkValueRoot(JSTracer *trc, Value *v, const char *name) +gc::MarkValueRoot(JSTracer* trc, Value* v, const char* name) { JS_ROOT_MARKING_ASSERT(trc); trc->setTracingName(name); @@ -657,23 +657,23 @@ gc::MarkValueRoot(JSTracer *trc, Value *v, const char *name) } void -gc::MarkTypeRoot(JSTracer *trc, types::Type *v, const char *name) +gc::MarkTypeRoot(JSTracer* trc, types::Type* v, const char* name) { JS_ROOT_MARKING_ASSERT(trc); trc->setTracingName(name); if (v->isSingleObject()) { - JSObject *obj = v->singleObject(); + JSObject* obj = v->singleObject(); MarkInternal(trc, &obj); *v = types::Type::ObjectType(obj); } else if (v->isTypeObject()) { - types::TypeObject *typeObj = v->typeObject(); + types::TypeObject* typeObj = v->typeObject(); MarkInternal(trc, &typeObj); *v = types::Type::ObjectType(typeObj); } } void -gc::MarkValueRange(JSTracer *trc, size_t len, BarrieredValue *vec, const char *name) +gc::MarkValueRange(JSTracer* trc, size_t len, BarrieredValue* vec, const char* name) { for (size_t i = 0; i < len; ++i) { trc->setTracingIndex(name, i); @@ -682,7 +682,7 @@ gc::MarkValueRange(JSTracer *trc, size_t len, BarrieredValue *vec, const char *n } void -gc::MarkValueRootRange(JSTracer *trc, size_t len, Value *vec, const char *name) +gc::MarkValueRootRange(JSTracer* trc, size_t len, Value* vec, const char* name) { JS_ROOT_MARKING_ASSERT(trc); for (size_t i = 0; i < len; ++i) { @@ -692,16 +692,16 @@ gc::MarkValueRootRange(JSTracer *trc, size_t len, Value *vec, const char *name) } bool -gc::IsValueMarked(Value *v) +gc::IsValueMarked(Value* v) { JS_ASSERT(v->isMarkable()); bool rv; if (v->isString()) { - JSString *str = (JSString *)v->toGCThing(); + JSString* str = (JSString*)v->toGCThing(); rv = IsMarked(&str); v->setString(str); } else { - JSObject *obj = (JSObject *)v->toGCThing(); + JSObject* obj = (JSObject*)v->toGCThing(); rv = IsMarked(&obj); v->setObject(*obj); } @@ -709,16 +709,16 @@ gc::IsValueMarked(Value *v) } bool -gc::IsValueAboutToBeFinalized(Value *v) +gc::IsValueAboutToBeFinalized(Value* v) { JS_ASSERT(v->isMarkable()); bool rv; if (v->isString()) { - JSString *str = (JSString *)v->toGCThing(); + JSString* str = (JSString*)v->toGCThing(); rv = IsAboutToBeFinalized(&str); v->setString(str); } else { - JSObject *obj = (JSObject *)v->toGCThing(); + JSObject* obj = (JSObject*)v->toGCThing(); rv = IsAboutToBeFinalized(&obj); v->setObject(*obj); } @@ -728,20 +728,20 @@ gc::IsValueAboutToBeFinalized(Value *v) /*** Slot Marking ***/ bool -gc::IsSlotMarked(HeapSlot *s) +gc::IsSlotMarked(HeapSlot* s) { return IsMarked(s); } void -gc::MarkSlot(JSTracer *trc, HeapSlot *s, const char *name) +gc::MarkSlot(JSTracer* trc, HeapSlot* s, const char* name) { trc->setTracingName(name); MarkValueInternal(trc, s->unsafeGet()); } void -gc::MarkArraySlots(JSTracer *trc, size_t len, HeapSlot *vec, const char *name) +gc::MarkArraySlots(JSTracer* trc, size_t len, HeapSlot* vec, const char* name) { for (size_t i = 0; i < len; ++i) { trc->setTracingIndex(name, i); @@ -750,7 +750,7 @@ gc::MarkArraySlots(JSTracer *trc, size_t len, HeapSlot *vec, const char *name) } void -gc::MarkObjectSlots(JSTracer *trc, JSObject *obj, uint32_t start, uint32_t nslots) +gc::MarkObjectSlots(JSTracer* trc, JSObject* obj, uint32_t start, uint32_t nslots) { JS_ASSERT(obj->isNative()); for (uint32_t i = start; i < (start + nslots); ++i) { @@ -760,7 +760,7 @@ gc::MarkObjectSlots(JSTracer *trc, JSObject *obj, uint32_t start, uint32_t nslot } static bool -ShouldMarkCrossCompartment(JSTracer *trc, JSObject *src, Cell *cell) +ShouldMarkCrossCompartment(JSTracer* trc, JSObject* src, Cell* cell) { if (!IS_GC_MARKING_TRACER(trc)) return true; @@ -773,7 +773,7 @@ ShouldMarkCrossCompartment(JSTracer *trc, JSObject *src, Cell *cell) return false; } - JS::Zone *zone = cell->tenuredZone(); + JS::Zone* zone = cell->tenuredZone(); if (color == BLACK) { /* * Having black->gray edges violates our promise to the cycle @@ -803,51 +803,51 @@ ShouldMarkCrossCompartment(JSTracer *trc, JSObject *src, Cell *cell) } void -gc::MarkCrossCompartmentObjectUnbarriered(JSTracer *trc, JSObject *src, JSObject **dst, const char *name) +gc::MarkCrossCompartmentObjectUnbarriered(JSTracer* trc, JSObject* src, JSObject** dst, const char* name) { if (ShouldMarkCrossCompartment(trc, src, *dst)) MarkObjectUnbarriered(trc, dst, name); } void -gc::MarkCrossCompartmentScriptUnbarriered(JSTracer *trc, JSObject *src, JSScript **dst, - const char *name) +gc::MarkCrossCompartmentScriptUnbarriered(JSTracer* trc, JSObject* src, JSScript** dst, + const char* name) { if (ShouldMarkCrossCompartment(trc, src, *dst)) MarkScriptUnbarriered(trc, dst, name); } void -gc::MarkCrossCompartmentSlot(JSTracer *trc, JSObject *src, HeapSlot *dst, const char *name) +gc::MarkCrossCompartmentSlot(JSTracer* trc, JSObject* src, HeapSlot* dst, const char* name) { - if (dst->isMarkable() && ShouldMarkCrossCompartment(trc, src, (Cell *)dst->toGCThing())) + if (dst->isMarkable() && ShouldMarkCrossCompartment(trc, src, (Cell*)dst->toGCThing())) MarkSlot(trc, dst, name); } /*** Special Marking ***/ void -gc::MarkObject(JSTracer *trc, HeapPtr *thingp, const char *name) +gc::MarkObject(JSTracer* trc, HeapPtr* thingp, const char* name) { trc->setTracingName(name); MarkInternal(trc, thingp->unsafeGet()); } void -gc::MarkValueUnbarriered(JSTracer *trc, Value *v, const char *name) +gc::MarkValueUnbarriered(JSTracer* trc, Value* v, const char* name) { trc->setTracingName(name); MarkValueInternal(trc, v); } bool -gc::IsCellMarked(Cell **thingp) +gc::IsCellMarked(Cell** thingp) { return IsMarked(thingp); } bool -gc::IsCellAboutToBeFinalized(Cell **thingp) +gc::IsCellAboutToBeFinalized(Cell** thingp) { return IsAboutToBeFinalized(thingp); } @@ -862,7 +862,7 @@ gc::IsCellAboutToBeFinalized(Cell **thingp) (rt)->isAtomsZone((thing)->zone())); static void -PushMarkStack(GCMarker *gcmarker, ObjectImpl *thing) +PushMarkStack(GCMarker* gcmarker, ObjectImpl* thing) { JS_COMPARTMENT_ASSERT(gcmarker->runtime(), thing); JS_ASSERT(!IsInsideNursery(gcmarker->runtime(), thing)); @@ -879,9 +879,9 @@ PushMarkStack(GCMarker *gcmarker, ObjectImpl *thing) * post-barrier during the minor GC at the start of each incremental slice. */ static void -MaybePushMarkStackBetweenSlices(GCMarker *gcmarker, JSObject *thing) +MaybePushMarkStackBetweenSlices(GCMarker* gcmarker, JSObject* thing) { - JSRuntime *rt = gcmarker->runtime(); + JSRuntime* rt = gcmarker->runtime(); JS_COMPARTMENT_ASSERT(rt, thing); JS_ASSERT_IF(rt->isHeapBusy(), !IsInsideNursery(rt, thing)); @@ -890,7 +890,7 @@ MaybePushMarkStackBetweenSlices(GCMarker *gcmarker, JSObject *thing) } static void -PushMarkStack(GCMarker *gcmarker, JSFunction *thing) +PushMarkStack(GCMarker* gcmarker, JSFunction* thing) { JS_COMPARTMENT_ASSERT(gcmarker->runtime(), thing); JS_ASSERT(!IsInsideNursery(gcmarker->runtime(), thing)); @@ -900,7 +900,7 @@ PushMarkStack(GCMarker *gcmarker, JSFunction *thing) } static void -PushMarkStack(GCMarker *gcmarker, types::TypeObject *thing) +PushMarkStack(GCMarker* gcmarker, types::TypeObject* thing) { JS_COMPARTMENT_ASSERT(gcmarker->runtime(), thing); JS_ASSERT(!IsInsideNursery(gcmarker->runtime(), thing)); @@ -910,7 +910,7 @@ PushMarkStack(GCMarker *gcmarker, types::TypeObject *thing) } static void -PushMarkStack(GCMarker *gcmarker, JSScript *thing) +PushMarkStack(GCMarker* gcmarker, JSScript* thing) { JS_COMPARTMENT_ASSERT(gcmarker->runtime(), thing); JS_ASSERT(!IsInsideNursery(gcmarker->runtime(), thing)); @@ -925,7 +925,7 @@ PushMarkStack(GCMarker *gcmarker, JSScript *thing) } static void -PushMarkStack(GCMarker *gcmarker, LazyScript *thing) +PushMarkStack(GCMarker* gcmarker, LazyScript* thing) { JS_COMPARTMENT_ASSERT(gcmarker->runtime(), thing); JS_ASSERT(!IsInsideNursery(gcmarker->runtime(), thing)); @@ -939,10 +939,10 @@ PushMarkStack(GCMarker *gcmarker, LazyScript *thing) } static void -ScanShape(GCMarker *gcmarker, Shape *shape); +ScanShape(GCMarker* gcmarker, Shape* shape); static void -PushMarkStack(GCMarker *gcmarker, Shape *thing) +PushMarkStack(GCMarker* gcmarker, Shape* thing) { JS_COMPARTMENT_ASSERT(gcmarker->runtime(), thing); JS_ASSERT(!IsInsideNursery(gcmarker->runtime(), thing)); @@ -953,7 +953,7 @@ PushMarkStack(GCMarker *gcmarker, Shape *thing) } static void -PushMarkStack(GCMarker *gcmarker, jit::JitCode *thing) +PushMarkStack(GCMarker* gcmarker, jit::JitCode* thing) { JS_COMPARTMENT_ASSERT(gcmarker->runtime(), thing); JS_ASSERT(!IsInsideNursery(gcmarker->runtime(), thing)); @@ -963,10 +963,10 @@ PushMarkStack(GCMarker *gcmarker, jit::JitCode *thing) } static inline void -ScanBaseShape(GCMarker *gcmarker, BaseShape *base); +ScanBaseShape(GCMarker* gcmarker, BaseShape* base); static void -PushMarkStack(GCMarker *gcmarker, BaseShape *thing) +PushMarkStack(GCMarker* gcmarker, BaseShape* thing) { JS_COMPARTMENT_ASSERT(gcmarker->runtime(), thing); JS_ASSERT(!IsInsideNursery(gcmarker->runtime(), thing)); @@ -977,12 +977,12 @@ PushMarkStack(GCMarker *gcmarker, BaseShape *thing) } static void -ScanShape(GCMarker *gcmarker, Shape *shape) +ScanShape(GCMarker* gcmarker, Shape* shape) { restart: PushMarkStack(gcmarker, shape->base()); - const BarrieredId &id = shape->propidRef(); + const BarrieredId& id = shape->propidRef(); if (JSID_IS_STRING(id)) PushMarkStack(gcmarker, JSID_TO_STRING(id)); else if (MOZ_UNLIKELY(JSID_IS_OBJECT(id))) @@ -994,7 +994,7 @@ ScanShape(GCMarker *gcmarker, Shape *shape) } static inline void -ScanBaseShape(GCMarker *gcmarker, BaseShape *base) +ScanBaseShape(GCMarker* gcmarker, BaseShape* base) { base->assertConsistency(); @@ -1006,13 +1006,13 @@ ScanBaseShape(GCMarker *gcmarker, BaseShape *base) if (base->hasSetterObject()) MaybePushMarkStackBetweenSlices(gcmarker, base->setterObject()); - if (JSObject *parent = base->getObjectParent()) { + if (JSObject* parent = base->getObjectParent()) { MaybePushMarkStackBetweenSlices(gcmarker, parent); - } else if (GlobalObject *global = base->compartment()->maybeGlobal()) { + } else if (GlobalObject* global = base->compartment()->maybeGlobal()) { PushMarkStack(gcmarker, global); } - if (JSObject *metadata = base->getObjectMetadata()) + if (JSObject* metadata = base->getObjectMetadata()) MaybePushMarkStackBetweenSlices(gcmarker, metadata); /* @@ -1021,14 +1021,14 @@ ScanBaseShape(GCMarker *gcmarker, BaseShape *base) * unowned base shape. */ if (base->isOwned()) { - UnownedBaseShape *unowned = base->baseUnowned(); + UnownedBaseShape* unowned = base->baseUnowned(); JS_ASSERT(base->compartment() == unowned->compartment()); unowned->markIfUnmarked(gcmarker->getMarkColor()); } } static inline void -ScanLinearString(GCMarker *gcmarker, JSLinearString *str) +ScanLinearString(GCMarker* gcmarker, JSLinearString* str) { JS_COMPARTMENT_ASSERT_STR(gcmarker->runtime(), str); JS_ASSERT(str->isMarked()); @@ -1059,7 +1059,7 @@ ScanLinearString(GCMarker *gcmarker, JSLinearString *str) * linear strings, it cannot refer to GC things of other types. */ static void -ScanRope(GCMarker *gcmarker, JSRope *rope) +ScanRope(GCMarker* gcmarker, JSRope* rope) { ptrdiff_t savedPos = gcmarker->stack.position(); JS_DIAGNOSTICS_ASSERT(GetGCThingTraceKind(rope) == JSTRACE_STRING); @@ -1068,9 +1068,9 @@ ScanRope(GCMarker *gcmarker, JSRope *rope) JS_DIAGNOSTICS_ASSERT(rope->JSString::isRope()); JS_COMPARTMENT_ASSERT_STR(gcmarker->runtime(), rope); JS_ASSERT(rope->isMarked()); - JSRope *next = nullptr; + JSRope* next = nullptr; - JSString *right = rope->rightChild(); + JSString* right = rope->rightChild(); if (!right->isPermanentAtom() && right->markIfUnmarked()) { if (right->isLinear()) ScanLinearString(gcmarker, &right->asLinear()); @@ -1078,7 +1078,7 @@ ScanRope(GCMarker *gcmarker, JSRope *rope) next = &right->asRope(); } - JSString *left = rope->leftChild(); + JSString* left = rope->leftChild(); if (!left->isPermanentAtom() && left->markIfUnmarked()) { if (left->isLinear()) { ScanLinearString(gcmarker, &left->asLinear()); @@ -1096,7 +1096,7 @@ ScanRope(GCMarker *gcmarker, JSRope *rope) rope = next; } else if (savedPos != gcmarker->stack.position()) { JS_ASSERT(savedPos < gcmarker->stack.position()); - rope = reinterpret_cast(gcmarker->stack.pop()); + rope = reinterpret_cast(gcmarker->stack.pop()); } else { break; } @@ -1105,7 +1105,7 @@ ScanRope(GCMarker *gcmarker, JSRope *rope) } static inline void -ScanString(GCMarker *gcmarker, JSString *str) +ScanString(GCMarker* gcmarker, JSString* str) { if (str->isLinear()) ScanLinearString(gcmarker, &str->asLinear()); @@ -1114,7 +1114,7 @@ ScanString(GCMarker *gcmarker, JSString *str) } static inline void -PushMarkStack(GCMarker *gcmarker, JSString *str) +PushMarkStack(GCMarker* gcmarker, JSString* str) { // Permanent atoms might not be associated with this runtime. if (str->isPermanentAtom()) @@ -1132,13 +1132,13 @@ PushMarkStack(GCMarker *gcmarker, JSString *str) } void -gc::MarkChildren(JSTracer *trc, JSObject *obj) +gc::MarkChildren(JSTracer* trc, JSObject* obj) { obj->markChildren(trc); } static void -gc::MarkChildren(JSTracer *trc, JSString *str) +gc::MarkChildren(JSTracer* trc, JSString* str) { if (str->hasBase()) str->markBase(trc); @@ -1147,25 +1147,25 @@ gc::MarkChildren(JSTracer *trc, JSString *str) } static void -gc::MarkChildren(JSTracer *trc, JSScript *script) +gc::MarkChildren(JSTracer* trc, JSScript* script) { script->markChildren(trc); } static void -gc::MarkChildren(JSTracer *trc, LazyScript *lazy) +gc::MarkChildren(JSTracer* trc, LazyScript* lazy) { lazy->markChildren(trc); } static void -gc::MarkChildren(JSTracer *trc, Shape *shape) +gc::MarkChildren(JSTracer* trc, Shape* shape) { shape->markChildren(trc); } static void -gc::MarkChildren(JSTracer *trc, BaseShape *base) +gc::MarkChildren(JSTracer* trc, BaseShape* base) { base->markChildren(trc); } @@ -1179,7 +1179,7 @@ gc::MarkChildren(JSTracer *trc, BaseShape *base) * updated to the current shape's parent. */ static inline void -MarkCycleCollectorChildren(JSTracer *trc, BaseShape *base, JSObject **prevParent) +MarkCycleCollectorChildren(JSTracer* trc, BaseShape* base, JSObject** prevParent) { JS_ASSERT(base); @@ -1191,18 +1191,18 @@ MarkCycleCollectorChildren(JSTracer *trc, BaseShape *base, JSObject **prevParent base->assertConsistency(); if (base->hasGetterObject()) { - JSObject *tmp = base->getterObject(); + JSObject* tmp = base->getterObject(); MarkObjectUnbarriered(trc, &tmp, "getter"); JS_ASSERT(tmp == base->getterObject()); } if (base->hasSetterObject()) { - JSObject *tmp = base->setterObject(); + JSObject* tmp = base->setterObject(); MarkObjectUnbarriered(trc, &tmp, "setter"); JS_ASSERT(tmp == base->setterObject()); } - JSObject *parent = base->getObjectParent(); + JSObject* parent = base->getObjectParent(); if (parent && parent != *prevParent) { MarkObjectUnbarriered(trc, &parent, "parent"); JS_ASSERT(parent == base->getObjectParent()); @@ -1219,9 +1219,9 @@ MarkCycleCollectorChildren(JSTracer *trc, BaseShape *base, JSObject **prevParent * parent pointer will only be marked once. */ void -gc::MarkCycleCollectorChildren(JSTracer *trc, Shape *shape) +gc::MarkCycleCollectorChildren(JSTracer* trc, Shape* shape) { - JSObject *prevParent = nullptr; + JSObject* prevParent = nullptr; do { MarkCycleCollectorChildren(trc, shape->base(), &prevParent); MarkId(trc, &shape->propidRef(), "propid"); @@ -1230,11 +1230,11 @@ gc::MarkCycleCollectorChildren(JSTracer *trc, Shape *shape) } static void -ScanTypeObject(GCMarker *gcmarker, types::TypeObject *type) +ScanTypeObject(GCMarker* gcmarker, types::TypeObject* type) { unsigned count = type->getPropertyCount(); for (unsigned i = 0; i < count; i++) { - types::Property *prop = type->getProperty(i); + types::Property* prop = type->getProperty(i); if (prop && JSID_IS_STRING(prop->id)) PushMarkStack(gcmarker, JSID_TO_STRING(prop->id)); } @@ -1257,11 +1257,11 @@ ScanTypeObject(GCMarker *gcmarker, types::TypeObject *type) } static void -gc::MarkChildren(JSTracer *trc, types::TypeObject *type) +gc::MarkChildren(JSTracer* trc, types::TypeObject* type) { unsigned count = type->getPropertyCount(); for (unsigned i = 0; i < count; i++) { - types::Property *prop = type->getProperty(i); + types::Property* prop = type->getProperty(i); if (prop) MarkId(trc, &prop->id, "type_prop"); } @@ -1284,7 +1284,7 @@ gc::MarkChildren(JSTracer *trc, types::TypeObject *type) } static void -gc::MarkChildren(JSTracer *trc, jit::JitCode *code) +gc::MarkChildren(JSTracer* trc, jit::JitCode* code) { #ifdef JS_ION code->trace(trc); @@ -1293,14 +1293,14 @@ gc::MarkChildren(JSTracer *trc, jit::JitCode *code) template static void -PushArenaTyped(GCMarker *gcmarker, ArenaHeader *aheader) +PushArenaTyped(GCMarker* gcmarker, ArenaHeader* aheader) { for (CellIterUnderGC i(aheader); !i.done(); i.next()) PushMarkStack(gcmarker, i.get()); } void -gc::PushArena(GCMarker *gcmarker, ArenaHeader *aheader) +gc::PushArena(GCMarker* gcmarker, ArenaHeader* aheader) { switch (MapAllocToTraceKind(aheader->getAllocKind())) { case JSTRACE_OBJECT: @@ -1340,14 +1340,14 @@ gc::PushArena(GCMarker *gcmarker, ArenaHeader *aheader) struct SlotArrayLayout { union { - HeapSlot *end; + HeapSlot* end; uintptr_t kind; }; union { - HeapSlot *start; + HeapSlot* start; uintptr_t index; }; - JSObject *obj; + JSObject* obj; static void staticAsserts() { /* This should have the same layout as three mark stack items. */ @@ -1366,22 +1366,22 @@ struct SlotArrayLayout void GCMarker::saveValueRanges() { - for (uintptr_t *p = stack.tos_; p > stack.stack_; ) { + for (uintptr_t* p = stack.tos_; p > stack.stack_; ) { uintptr_t tag = *--p & StackTagMask; if (tag == ValueArrayTag) { *p &= ~StackTagMask; p -= 2; - SlotArrayLayout *arr = reinterpret_cast(p); - JSObject *obj = arr->obj; + SlotArrayLayout* arr = reinterpret_cast(p); + JSObject* obj = arr->obj; JS_ASSERT(obj->isNative()); - HeapSlot *vp = obj->getDenseElements(); + HeapSlot* vp = obj->getDenseElements(); if (arr->end == vp + obj->getDenseInitializedLength()) { JS_ASSERT(arr->start >= vp); arr->index = arr->start - vp; arr->kind = HeapSlot::Element; } else { - HeapSlot *vp = obj->fixedSlots(); + HeapSlot* vp = obj->fixedSlots(); unsigned nfixed = obj->numFixedSlots(); if (arr->start == arr->end) { arr->index = obj->slotSpan(); @@ -1403,7 +1403,7 @@ GCMarker::saveValueRanges() } bool -GCMarker::restoreValueArray(JSObject *obj, void **vpp, void **endp) +GCMarker::restoreValueArray(JSObject* obj, void** vpp, void** endp) { uintptr_t start = stack.pop(); HeapSlot::Kind kind = (HeapSlot::Kind) stack.pop(); @@ -1413,7 +1413,7 @@ GCMarker::restoreValueArray(JSObject *obj, void **vpp, void **endp) return false; uint32_t initlen = obj->getDenseInitializedLength(); - HeapSlot *vp = obj->getDenseElements(); + HeapSlot* vp = obj->getDenseElements(); if (start < initlen) { *vpp = vp + start; *endp = vp + initlen; @@ -1423,7 +1423,7 @@ GCMarker::restoreValueArray(JSObject *obj, void **vpp, void **endp) } } else { JS_ASSERT(kind == HeapSlot::Slot); - HeapSlot *vp = obj->fixedSlots(); + HeapSlot* vp = obj->fixedSlots(); unsigned nfixed = obj->numFixedSlots(); unsigned nslots = obj->slotSpan(); if (start < nslots) { @@ -1448,30 +1448,30 @@ void GCMarker::processMarkStackOther(uintptr_t tag, uintptr_t addr) { if (tag == TypeTag) { - ScanTypeObject(this, reinterpret_cast(addr)); + ScanTypeObject(this, reinterpret_cast(addr)); } else if (tag == SavedValueArrayTag) { JS_ASSERT(!(addr & CellMask)); - JSObject *obj = reinterpret_cast(addr); - HeapValue *vp, *end; - if (restoreValueArray(obj, (void **)&vp, (void **)&end)) + JSObject* obj = reinterpret_cast(addr); + HeapValue* vp, *end; + if (restoreValueArray(obj, (void**)&vp, (void**)&end)) pushValueArray(obj, vp, end); else pushObject(obj); } else if (tag == JitCodeTag) { - MarkChildren(this, reinterpret_cast(addr)); + MarkChildren(this, reinterpret_cast(addr)); } } inline void -GCMarker::processMarkStackTop(SliceBudget &budget) +GCMarker::processMarkStackTop(SliceBudget& budget) { /* * The function uses explicit goto and implements the scanning of the * object directly. It allows to eliminate the tail recursion and * significantly improve the marking performance, see bug 641025. */ - HeapSlot *vp, *end; - JSObject *obj; + HeapSlot* vp, *end; + JSObject* obj; uintptr_t addr = stack.pop(); uintptr_t tag = addr & StackTagMask; @@ -1480,18 +1480,18 @@ GCMarker::processMarkStackTop(SliceBudget &budget) if (tag == ValueArrayTag) { JS_STATIC_ASSERT(ValueArrayTag == 0); JS_ASSERT(!(addr & CellMask)); - obj = reinterpret_cast(addr); + obj = reinterpret_cast(addr); uintptr_t addr2 = stack.pop(); uintptr_t addr3 = stack.pop(); JS_ASSERT(addr2 <= addr3); JS_ASSERT((addr3 - addr2) % sizeof(Value) == 0); - vp = reinterpret_cast(addr2); - end = reinterpret_cast(addr3); + vp = reinterpret_cast(addr2); + end = reinterpret_cast(addr3); goto scan_value_array; } if (tag == ObjectTag) { - obj = reinterpret_cast(addr); + obj = reinterpret_cast(addr); JS_COMPARTMENT_ASSERT(runtime(), obj); goto scan_obj; } @@ -1502,9 +1502,9 @@ GCMarker::processMarkStackTop(SliceBudget &budget) scan_value_array: JS_ASSERT(vp <= end); while (vp != end) { - const Value &v = *vp++; + const Value& v = *vp++; if (v.isString()) { - JSString *str = v.toString(); + JSString* str = v.toString(); if (!str->isPermanentAtom()) { JS_COMPARTMENT_ASSERT_STR(runtime(), str); JS_ASSERT(runtime()->isAtomsZone(str->zone()) || str->zone() == obj->zone()); @@ -1512,7 +1512,7 @@ GCMarker::processMarkStackTop(SliceBudget &budget) ScanString(this, str); } } else if (v.isObject()) { - JSObject *obj2 = &v.toObject(); + JSObject* obj2 = &v.toObject(); JS_COMPARTMENT_ASSERT(runtime(), obj2); JS_ASSERT(obj->compartment() == obj2->compartment()); if (obj2->markIfUnmarked(getMarkColor())) { @@ -1534,14 +1534,14 @@ GCMarker::processMarkStackTop(SliceBudget &budget) return; } - types::TypeObject *type = obj->typeFromGC(); + types::TypeObject* type = obj->typeFromGC(); PushMarkStack(this, type); - Shape *shape = obj->lastProperty(); + Shape* shape = obj->lastProperty(); PushMarkStack(this, shape); /* Call the trace hook if necessary. */ - const Class *clasp = type->clasp(); + const Class* clasp = type->clasp(); if (clasp->trace) { // Global objects all have the same trace hook. That hook is safe without barriers // if the gloal has no custom trace hook of it's own, or has been moved to a different @@ -1585,14 +1585,14 @@ GCMarker::processMarkStackTop(SliceBudget &budget) } bool -GCMarker::drainMarkStack(SliceBudget &budget) +GCMarker::drainMarkStack(SliceBudget& budget) { #ifdef DEBUG - JSRuntime *rt = runtime(); + JSRuntime* rt = runtime(); struct AutoCheckCompartment { - JSRuntime *runtime; - AutoCheckCompartment(JSRuntime *rt) : runtime(rt) { + JSRuntime* runtime; + AutoCheckCompartment(JSRuntime* rt) : runtime(rt) { JS_ASSERT(!rt->gcStrictCompartmentChecking); runtime->gcStrictCompartmentChecking = true; } @@ -1630,51 +1630,51 @@ GCMarker::drainMarkStack(SliceBudget &budget) } void -js::TraceChildren(JSTracer *trc, void *thing, JSGCTraceKind kind) +js::TraceChildren(JSTracer* trc, void* thing, JSGCTraceKind kind) { switch (kind) { case JSTRACE_OBJECT: - MarkChildren(trc, static_cast(thing)); + MarkChildren(trc, static_cast(thing)); break; case JSTRACE_STRING: - MarkChildren(trc, static_cast(thing)); + MarkChildren(trc, static_cast(thing)); break; case JSTRACE_SCRIPT: - MarkChildren(trc, static_cast(thing)); + MarkChildren(trc, static_cast(thing)); break; case JSTRACE_LAZY_SCRIPT: - MarkChildren(trc, static_cast(thing)); + MarkChildren(trc, static_cast(thing)); break; case JSTRACE_SHAPE: - MarkChildren(trc, static_cast(thing)); + MarkChildren(trc, static_cast(thing)); break; case JSTRACE_JITCODE: - MarkChildren(trc, (js::jit::JitCode *)thing); + MarkChildren(trc, (js::jit::JitCode*)thing); break; case JSTRACE_BASE_SHAPE: - MarkChildren(trc, static_cast(thing)); + MarkChildren(trc, static_cast(thing)); break; case JSTRACE_TYPE_OBJECT: - MarkChildren(trc, (types::TypeObject *)thing); + MarkChildren(trc, (types::TypeObject*)thing); break; } } static void -UnmarkGrayGCThing(void *thing) +UnmarkGrayGCThing(void* thing) { - static_cast(thing)->unmark(js::gc::GRAY); + static_cast(thing)->unmark(js::gc::GRAY); } static void -UnmarkGrayChildren(JSTracer *trc, void **thingp, JSGCTraceKind kind); +UnmarkGrayChildren(JSTracer* trc, void** thingp, JSGCTraceKind kind); struct UnmarkGrayTracer : public JSTracer { @@ -1682,14 +1682,14 @@ struct UnmarkGrayTracer : public JSTracer * We set eagerlyTraceWeakMaps to false because the cycle collector will fix * up any color mismatches involving weakmaps when it runs. */ - UnmarkGrayTracer(JSRuntime *rt) + UnmarkGrayTracer(JSRuntime* rt) : JSTracer(rt, UnmarkGrayChildren, DoNotTraceWeakMaps), tracingShape(false), previousShape(nullptr), unmarkedAny(false) {} - UnmarkGrayTracer(JSTracer *trc, bool tracingShape) + UnmarkGrayTracer(JSTracer* trc, bool tracingShape) : JSTracer(trc->runtime(), UnmarkGrayChildren, DoNotTraceWeakMaps), tracingShape(tracingShape), previousShape(nullptr), @@ -1700,7 +1700,7 @@ struct UnmarkGrayTracer : public JSTracer bool tracingShape; /* If tracingShape, shape child or nullptr. Otherwise, nullptr. */ - void *previousShape; + void* previousShape; /* Whether we unmarked anything. */ bool unmarkedAny; @@ -1737,9 +1737,9 @@ struct UnmarkGrayTracer : public JSTracer * containers. */ static void -UnmarkGrayChildren(JSTracer *trc, void **thingp, JSGCTraceKind kind) +UnmarkGrayChildren(JSTracer* trc, void** thingp, JSGCTraceKind kind) { - void *thing = *thingp; + void* thing = *thingp; int stackDummy; if (!JS_CHECK_STACK_SIZE(trc->runtime()->mainThread.nativeStackLimit[StackForSystemCode], &stackDummy)) { /* @@ -1750,7 +1750,7 @@ UnmarkGrayChildren(JSTracer *trc, void **thingp, JSGCTraceKind kind) return; } - UnmarkGrayTracer *tracer = static_cast(trc); + UnmarkGrayTracer* tracer = static_cast(trc); if (!IsInsideNursery(trc->runtime(), thing)) { if (!JS::GCThingIsMarkedGray(thing)) return; @@ -1791,11 +1791,11 @@ UnmarkGrayChildren(JSTracer *trc, void **thingp, JSGCTraceKind kind) } JS_FRIEND_API(bool) -JS::UnmarkGrayGCThingRecursively(void *thing, JSGCTraceKind kind) +JS::UnmarkGrayGCThingRecursively(void* thing, JSGCTraceKind kind) { JS_ASSERT(kind != JSTRACE_SHAPE); - JSRuntime *rt = static_cast(thing)->runtimeFromMainThread(); + JSRuntime* rt = static_cast(thing)->runtimeFromMainThread(); bool unmarkedArg = false; if (!IsInsideNursery(rt, thing)) { diff --git a/js/src/gc/Marking.h b/js/src/gc/Marking.h index 16404fe4ab..7ff35cd1c2 100644 --- a/js/src/gc/Marking.h +++ b/js/src/gc/Marking.h @@ -49,16 +49,16 @@ namespace gc { * these are the variants generated for JSObject. They are listed from most to * least desirable for use: * - * MarkObject(JSTracer *trc, const HeapPtr &thing, const char *name); + * MarkObject(JSTracer* trc, const HeapPtr& thing, const char* name); * This function should be used for marking JSObjects, in preference to all * others below. Use it when you have HeapPtr, which * automatically implements write barriers. * - * MarkObjectRoot(JSTracer *trc, JSObject *thing, const char *name); + * MarkObjectRoot(JSTracer* trc, JSObject* thing, const char* name); * This function is only valid during the root marking phase of GC (i.e., * when MarkRuntime is on the stack). * - * MarkObjectUnbarriered(JSTracer *trc, JSObject *thing, const char *name); + * MarkObjectUnbarriered(JSTracer* trc, JSObject* thing, const char* name); * Like MarkObject, this function can be called at any time. It is more * forgiving, since it doesn't demand a HeapPtr as an argument. Its use * should always be accompanied by a comment explaining how write barriers @@ -70,35 +70,35 @@ namespace gc { * The following functions are provided to test whether a GC thing is marked * under different circumstances: * - * IsObjectAboutToBeFinalized(JSObject **thing); + * IsObjectAboutToBeFinalized(JSObject** thing); * This function is indended to be used in code used to sweep GC things. It * indicates whether the object will will be finialized in the current group * of compartments being swept. Note that this will return false for any * object not in the group of compartments currently being swept, as even if * it is unmarked it may still become marked before it is swept. * - * IsObjectMarked(JSObject **thing); + * IsObjectMarked(JSObject** thing); * This function is indended to be used in rare cases in code used to mark * GC things. It indicates whether the object is currently marked. * - * UpdateObjectIfRelocated(JSObject **thingp); + * UpdateObjectIfRelocated(JSObject** thingp); * In some circumstances -- e.g. optional weak marking -- it is necessary * to look at the pointer before marking it strongly or weakly. In these * cases, the following must be called to update the pointer before use. */ #define DeclMarker(base, type) \ -void Mark##base(JSTracer *trc, BarrieredPtr *thing, const char *name); \ -void Mark##base##Root(JSTracer *trc, type **thingp, const char *name); \ -void Mark##base##Unbarriered(JSTracer *trc, type **thingp, const char *name); \ -void Mark##base##Range(JSTracer *trc, size_t len, HeapPtr *thing, const char *name); \ -void Mark##base##RootRange(JSTracer *trc, size_t len, type **thing, const char *name); \ -bool Is##base##Marked(type **thingp); \ -bool Is##base##Marked(BarrieredPtr *thingp); \ -bool Is##base##AboutToBeFinalized(type **thingp); \ -bool Is##base##AboutToBeFinalized(BarrieredPtr *thingp); \ -type *Update##base##IfRelocated(JSRuntime *rt, BarrieredPtr *thingp); \ -type *Update##base##IfRelocated(JSRuntime *rt, type **thingp); +void Mark##base(JSTracer* trc, BarrieredPtr* thing, const char* name); \ +void Mark##base##Root(JSTracer* trc, type** thingp, const char* name); \ +void Mark##base##Unbarriered(JSTracer* trc, type** thingp, const char* name); \ +void Mark##base##Range(JSTracer* trc, size_t len, HeapPtr* thing, const char* name); \ +void Mark##base##RootRange(JSTracer* trc, size_t len, type** thing, const char* name); \ +bool Is##base##Marked(type** thingp); \ +bool Is##base##Marked(BarrieredPtr* thingp); \ +bool Is##base##AboutToBeFinalized(type** thingp); \ +bool Is##base##AboutToBeFinalized(BarrieredPtr* thingp); \ +type* Update##base##IfRelocated(JSRuntime* rt, BarrieredPtr* thingp); \ +type* Update##base##IfRelocated(JSRuntime* rt, type** thingp); DeclMarker(BaseShape, BaseShape) DeclMarker(BaseShape, UnownedBaseShape) @@ -125,13 +125,13 @@ DeclMarker(TypeObject, types::TypeObject) #undef DeclMarker void -MarkPermanentAtom(JSTracer *trc, JSAtom *atom, const char *name); +MarkPermanentAtom(JSTracer* trc, JSAtom* atom, const char* name); /* Return true if the pointer is nullptr, or if it is a tagged pointer to * nullptr. */ MOZ_ALWAYS_INLINE bool -IsNullTaggedPointer(void *p) +IsNullTaggedPointer(void* p) { return uintptr_t(p) < 32; } @@ -144,97 +144,97 @@ IsNullTaggedPointer(void *p) * after we transition to exact rooting. */ void -MarkKind(JSTracer *trc, void **thingp, JSGCTraceKind kind); +MarkKind(JSTracer* trc, void** thingp, JSGCTraceKind kind); void -MarkGCThingRoot(JSTracer *trc, void **thingp, const char *name); +MarkGCThingRoot(JSTracer* trc, void** thingp, const char* name); void -MarkGCThingUnbarriered(JSTracer *trc, void **thingp, const char *name); +MarkGCThingUnbarriered(JSTracer* trc, void** thingp, const char* name); /*** ID Marking ***/ void -MarkId(JSTracer *trc, BarrieredId *id, const char *name); +MarkId(JSTracer* trc, BarrieredId* id, const char* name); void -MarkIdRoot(JSTracer *trc, jsid *id, const char *name); +MarkIdRoot(JSTracer* trc, jsid* id, const char* name); void -MarkIdUnbarriered(JSTracer *trc, jsid *id, const char *name); +MarkIdUnbarriered(JSTracer* trc, jsid* id, const char* name); void -MarkIdRange(JSTracer *trc, size_t len, HeapId *vec, const char *name); +MarkIdRange(JSTracer* trc, size_t len, HeapId* vec, const char* name); void -MarkIdRootRange(JSTracer *trc, size_t len, jsid *vec, const char *name); +MarkIdRootRange(JSTracer* trc, size_t len, jsid* vec, const char* name); /*** Value Marking ***/ void -MarkValue(JSTracer *trc, BarrieredValue *v, const char *name); +MarkValue(JSTracer* trc, BarrieredValue* v, const char* name); void -MarkValueRange(JSTracer *trc, size_t len, BarrieredValue *vec, const char *name); +MarkValueRange(JSTracer* trc, size_t len, BarrieredValue* vec, const char* name); inline void -MarkValueRange(JSTracer *trc, HeapValue *begin, HeapValue *end, const char *name) +MarkValueRange(JSTracer* trc, HeapValue* begin, HeapValue* end, const char* name) { return MarkValueRange(trc, end - begin, begin, name); } void -MarkValueRoot(JSTracer *trc, Value *v, const char *name); +MarkValueRoot(JSTracer* trc, Value* v, const char* name); void -MarkThingOrValueUnbarriered(JSTracer *trc, uintptr_t *word, const char *name); +MarkThingOrValueUnbarriered(JSTracer* trc, uintptr_t* word, const char* name); void -MarkValueRootRange(JSTracer *trc, size_t len, Value *vec, const char *name); +MarkValueRootRange(JSTracer* trc, size_t len, Value* vec, const char* name); inline void -MarkValueRootRange(JSTracer *trc, Value *begin, Value *end, const char *name) +MarkValueRootRange(JSTracer* trc, Value* begin, Value* end, const char* name) { MarkValueRootRange(trc, end - begin, begin, name); } void -MarkTypeRoot(JSTracer *trc, types::Type *v, const char *name); +MarkTypeRoot(JSTracer* trc, types::Type* v, const char* name); bool -IsValueMarked(Value *v); +IsValueMarked(Value* v); bool -IsValueAboutToBeFinalized(Value *v); +IsValueAboutToBeFinalized(Value* v); /*** Slot Marking ***/ bool -IsSlotMarked(HeapSlot *s); +IsSlotMarked(HeapSlot* s); void -MarkSlot(JSTracer *trc, HeapSlot *s, const char *name); +MarkSlot(JSTracer* trc, HeapSlot* s, const char* name); void -MarkArraySlots(JSTracer *trc, size_t len, HeapSlot *vec, const char *name); +MarkArraySlots(JSTracer* trc, size_t len, HeapSlot* vec, const char* name); void -MarkObjectSlots(JSTracer *trc, JSObject *obj, uint32_t start, uint32_t nslots); +MarkObjectSlots(JSTracer* trc, JSObject* obj, uint32_t start, uint32_t nslots); void -MarkCrossCompartmentObjectUnbarriered(JSTracer *trc, JSObject *src, JSObject **dst_obj, - const char *name); +MarkCrossCompartmentObjectUnbarriered(JSTracer* trc, JSObject* src, JSObject** dst_obj, + const char* name); void -MarkCrossCompartmentScriptUnbarriered(JSTracer *trc, JSObject *src, JSScript **dst_script, - const char *name); +MarkCrossCompartmentScriptUnbarriered(JSTracer* trc, JSObject* src, JSScript** dst_script, + const char* name); /* * Mark a value that may be in a different compartment from the compartment * being GC'd. (Although it won't be marked if it's in the wrong compartment.) */ void -MarkCrossCompartmentSlot(JSTracer *trc, JSObject *src, HeapSlot *dst_slot, const char *name); +MarkCrossCompartmentSlot(JSTracer* trc, JSObject* src, HeapSlot* dst_slot, const char* name); /*** Special Cases ***/ @@ -244,14 +244,14 @@ MarkCrossCompartmentSlot(JSTracer *trc, JSObject *src, HeapSlot *dst_slot, const * typecheck correctly. */ void -MarkObject(JSTracer *trc, HeapPtr *thingp, const char *name); +MarkObject(JSTracer* trc, HeapPtr* thingp, const char* name); /* * MarkChildren is exposed solely for preWriteBarrier on * JSObject::TradeGuts. It should not be considered external interface. */ void -MarkChildren(JSTracer *trc, JSObject *obj); +MarkChildren(JSTracer* trc, JSObject* obj); /* * Trace through the shape and any shapes it contains to mark @@ -259,10 +259,10 @@ MarkChildren(JSTracer *trc, JSObject *obj); * JS_TraceShapeCycleCollectorChildren. */ void -MarkCycleCollectorChildren(JSTracer *trc, Shape *shape); +MarkCycleCollectorChildren(JSTracer* trc, Shape* shape); void -PushArena(GCMarker *gcmarker, ArenaHeader *aheader); +PushArena(GCMarker* gcmarker, ArenaHeader* aheader); /*** Generic ***/ @@ -272,51 +272,51 @@ PushArena(GCMarker *gcmarker, ArenaHeader *aheader); */ inline void -Mark(JSTracer *trc, BarrieredValue *v, const char *name) +Mark(JSTracer* trc, BarrieredValue* v, const char* name) { MarkValue(trc, v, name); } inline void -Mark(JSTracer *trc, BarrieredPtrObject *o, const char *name) +Mark(JSTracer* trc, BarrieredPtrObject* o, const char* name) { MarkObject(trc, o, name); } inline void -Mark(JSTracer *trc, BarrieredPtrScript *o, const char *name) +Mark(JSTracer* trc, BarrieredPtrScript* o, const char* name) { MarkScript(trc, o, name); } inline void -Mark(JSTracer *trc, HeapPtr *code, const char *name) +Mark(JSTracer* trc, HeapPtr* code, const char* name) { MarkJitCode(trc, code, name); } /* For use by WeakMap's HashKeyRef instantiation. */ inline void -Mark(JSTracer *trc, JSObject **objp, const char *name) +Mark(JSTracer* trc, JSObject** objp, const char* name) { MarkObjectUnbarriered(trc, objp, name); } /* For use by Debugger::WeakMap's proxiedScopes HashKeyRef instantiation. */ inline void -Mark(JSTracer *trc, ScopeObject **obj, const char *name) +Mark(JSTracer* trc, ScopeObject** obj, const char* name) { MarkObjectUnbarriered(trc, obj, name); } bool -IsCellMarked(Cell **thingp); +IsCellMarked(Cell** thingp); bool -IsCellAboutToBeFinalized(Cell **thing); +IsCellAboutToBeFinalized(Cell** thing); inline bool -IsMarked(BarrieredValue *v) +IsMarked(BarrieredValue* v) { if (!v->isMarkable()) return true; @@ -324,19 +324,19 @@ IsMarked(BarrieredValue *v) } inline bool -IsMarked(BarrieredPtrObject *objp) +IsMarked(BarrieredPtrObject* objp) { return IsObjectMarked(objp); } inline bool -IsMarked(BarrieredPtrScript *scriptp) +IsMarked(BarrieredPtrScript* scriptp) { return IsScriptMarked(scriptp); } inline bool -IsAboutToBeFinalized(BarrieredValue *v) +IsAboutToBeFinalized(BarrieredValue* v) { if (!v->isMarkable()) return false; @@ -344,13 +344,13 @@ IsAboutToBeFinalized(BarrieredValue *v) } inline bool -IsAboutToBeFinalized(BarrieredPtrObject *objp) +IsAboutToBeFinalized(BarrieredPtrObject* objp) { return IsObjectAboutToBeFinalized(objp); } inline bool -IsAboutToBeFinalized(BarrieredPtrScript *scriptp) +IsAboutToBeFinalized(BarrieredPtrScript* scriptp) { return IsScriptAboutToBeFinalized(scriptp); } @@ -359,7 +359,7 @@ IsAboutToBeFinalized(BarrieredPtrScript *scriptp) /* Nonsense to get WeakCache to work with new Marking semantics. */ inline bool -IsAboutToBeFinalized(const js::jit::VMFunction **vmfunc) +IsAboutToBeFinalized(const js::jit::VMFunction** vmfunc) { /* * Preserves entries in the WeakCache @@ -375,22 +375,22 @@ IsAboutToBeFinalized(ReadBarriered code) } #endif -inline Cell * -ToMarkable(const Value &v) +inline Cell* +ToMarkable(const Value& v) { if (v.isMarkable()) - return (Cell *)v.toGCThing(); + return (Cell*)v.toGCThing(); return nullptr; } -inline Cell * -ToMarkable(Cell *cell) +inline Cell* +ToMarkable(Cell* cell) { return cell; } inline JSGCTraceKind -TraceKind(const Value &v) +TraceKind(const Value& v) { JS_ASSERT(v.isMarkable()); if (v.isObject()) @@ -399,19 +399,19 @@ TraceKind(const Value &v) } inline JSGCTraceKind -TraceKind(JSObject *obj) +TraceKind(JSObject* obj) { return JSTRACE_OBJECT; } inline JSGCTraceKind -TraceKind(JSScript *script) +TraceKind(JSScript* script) { return JSTRACE_SCRIPT; } inline JSGCTraceKind -TraceKind(LazyScript *lazy) +TraceKind(LazyScript* lazy) { return JSTRACE_LAZY_SCRIPT; } @@ -419,7 +419,7 @@ TraceKind(LazyScript *lazy) } /* namespace gc */ void -TraceChildren(JSTracer *trc, void *thing, JSGCTraceKind kind); +TraceChildren(JSTracer* trc, void* thing, JSGCTraceKind kind); } /* namespace js */ diff --git a/js/src/gc/Memory.cpp b/js/src/gc/Memory.cpp index cc772d73f3..80f315b557 100644 --- a/js/src/gc/Memory.cpp +++ b/js/src/gc/Memory.cpp @@ -13,7 +13,7 @@ using namespace js; using namespace js::gc; static bool -DecommitEnabled(JSRuntime *rt) +DecommitEnabled(JSRuntime* rt) { return rt->gcSystemPageSize == ArenaSize; } @@ -23,7 +23,7 @@ DecommitEnabled(JSRuntime *rt) #include void -gc::InitMemorySubsystem(JSRuntime *rt) +gc::InitMemorySubsystem(JSRuntime* rt) { SYSTEM_INFO sysinfo; GetSystemInfo(&sysinfo); @@ -31,8 +31,8 @@ gc::InitMemorySubsystem(JSRuntime *rt) rt->gcSystemAllocGranularity = sysinfo.dwAllocationGranularity; } -void * -gc::MapAlignedPages(JSRuntime *rt, size_t size, size_t alignment) +void* +gc::MapAlignedPages(JSRuntime* rt, size_t size, size_t alignment) { JS_ASSERT(size >= alignment); JS_ASSERT(size % alignment == 0); @@ -50,7 +50,7 @@ gc::MapAlignedPages(JSRuntime *rt, size_t size, size_t alignment) * final result via one mapping operation. This means unmapping any * preliminary result that is not correctly aligned. */ - void *p = nullptr; + void* p = nullptr; while (!p) { /* * Over-allocate in order to map a memory region that is definitely @@ -64,7 +64,7 @@ gc::MapAlignedPages(JSRuntime *rt, size_t size, size_t alignment) p = VirtualAlloc(nullptr, reserveSize, MEM_RESERVE, PAGE_READWRITE); if (!p) return nullptr; - void *chunkStart = (void *)AlignBytes(uintptr_t(p), alignment); + void* chunkStart = (void*)AlignBytes(uintptr_t(p), alignment); UnmapPages(rt, p, reserveSize); p = VirtualAlloc(chunkStart, size, MEM_COMMIT | MEM_RESERVE, PAGE_READWRITE); @@ -76,13 +76,13 @@ gc::MapAlignedPages(JSRuntime *rt, size_t size, size_t alignment) } void -gc::UnmapPages(JSRuntime *rt, void *p, size_t size) +gc::UnmapPages(JSRuntime* rt, void* p, size_t size) { JS_ALWAYS_TRUE(VirtualFree(p, 0, MEM_RELEASE)); } bool -gc::MarkPagesUnused(JSRuntime *rt, void *p, size_t size) +gc::MarkPagesUnused(JSRuntime* rt, void* p, size_t size) { if (!DecommitEnabled(rt)) return true; @@ -93,7 +93,7 @@ gc::MarkPagesUnused(JSRuntime *rt, void *p, size_t size) } bool -gc::MarkPagesInUse(JSRuntime *rt, void *p, size_t size) +gc::MarkPagesInUse(JSRuntime* rt, void* p, size_t size) { JS_ASSERT(uintptr_t(p) % rt->gcSystemPageSize == 0); return true; @@ -108,7 +108,7 @@ gc::GetPageFaultCount() return pmc.PageFaultCount; } -void * +void* gc::AllocateMappedContent(int fd, size_t offset, size_t length, size_t alignment) { // TODO: Bug 988813 - Support memory mapped array buffer for Windows platform. @@ -117,7 +117,7 @@ gc::AllocateMappedContent(int fd, size_t offset, size_t length, size_t alignment // Deallocate mapped memory for object. void -gc::DeallocateMappedContent(void *p, size_t length) +gc::DeallocateMappedContent(void* p, size_t length) { // TODO: Bug 988813 - Support memory mapped array buffer for Windows platform. } @@ -132,13 +132,13 @@ gc::DeallocateMappedContent(void *p, size_t length) #endif void -gc::InitMemorySubsystem(JSRuntime *rt) +gc::InitMemorySubsystem(JSRuntime* rt) { rt->gcSystemPageSize = rt->gcSystemAllocGranularity = size_t(sysconf(_SC_PAGESIZE)); } -void * -gc::MapAlignedPages(JSRuntime *rt, size_t size, size_t alignment) +void* +gc::MapAlignedPages(JSRuntime* rt, size_t size, size_t alignment) { JS_ASSERT(size >= alignment); JS_ASSERT(size % alignment == 0); @@ -148,27 +148,27 @@ gc::MapAlignedPages(JSRuntime *rt, size_t size, size_t alignment) int prot = PROT_READ | PROT_WRITE; int flags = MAP_PRIVATE | MAP_ANON | MAP_ALIGN | MAP_NOSYNC; - void *p = mmap((caddr_t)alignment, size, prot, flags, -1, 0); + void* p = mmap((caddr_t)alignment, size, prot, flags, -1, 0); if (p == MAP_FAILED) return nullptr; return p; } void -gc::UnmapPages(JSRuntime *rt, void *p, size_t size) +gc::UnmapPages(JSRuntime* rt, void* p, size_t size) { JS_ALWAYS_TRUE(0 == munmap((caddr_t)p, size)); } bool -gc::MarkPagesUnused(JSRuntime *rt, void *p, size_t size) +gc::MarkPagesUnused(JSRuntime* rt, void* p, size_t size) { JS_ASSERT(uintptr_t(p) % rt->gcSystemPageSize == 0); return true; } bool -gc::MarkPagesInUse(JSRuntime *rt, void *p, size_t size) +gc::MarkPagesInUse(JSRuntime* rt, void* p, size_t size) { JS_ASSERT(uintptr_t(p) % rt->gcSystemPageSize == 0); return true; @@ -180,7 +180,7 @@ gc::GetPageFaultCount() return 0; } -void * +void* gc::AllocateMappedContent(int fd, size_t offset, size_t length, size_t alignment) { // Not implemented. @@ -189,7 +189,7 @@ gc::AllocateMappedContent(int fd, size_t offset, size_t length, size_t alignment // Deallocate mapped memory for object. void -gc::DeallocateMappedContent(void *p, size_t length) +gc::DeallocateMappedContent(void* p, size_t length) { // Not implemented. } @@ -204,12 +204,12 @@ gc::DeallocateMappedContent(void *p, size_t length) #include void -gc::InitMemorySubsystem(JSRuntime *rt) +gc::InitMemorySubsystem(JSRuntime* rt) { rt->gcSystemPageSize = rt->gcSystemAllocGranularity = size_t(sysconf(_SC_PAGESIZE)); } -static inline void * +static inline void* MapMemory(size_t length, int prot, int flags, int fd, off_t offset) { #if defined(__ia64__) @@ -226,7 +226,7 @@ MapMemory(size_t length, int prot, int flags, int fd, off_t offset) * * See Bug 589735 for more information. */ - void *region = mmap((void*)0x0000070000000000, length, prot, flags, fd, offset); + void* region = mmap((void*)0x0000070000000000, length, prot, flags, fd, offset); if (region == MAP_FAILED) return MAP_FAILED; /* @@ -243,8 +243,8 @@ MapMemory(size_t length, int prot, int flags, int fd, off_t offset) #endif } -void * -gc::MapAlignedPages(JSRuntime *rt, size_t size, size_t alignment) +void* +gc::MapAlignedPages(JSRuntime* rt, size_t size, size_t alignment) { JS_ASSERT(size >= alignment); JS_ASSERT(size % alignment == 0); @@ -256,7 +256,7 @@ gc::MapAlignedPages(JSRuntime *rt, size_t size, size_t alignment) /* Special case: If we want page alignment, no further work is needed. */ if (alignment == rt->gcSystemAllocGranularity) { - void *region = MapMemory(size, prot, flags, -1, 0); + void* region = MapMemory(size, prot, flags, -1, 0); if (region == MAP_FAILED) return nullptr; return region; @@ -264,7 +264,7 @@ gc::MapAlignedPages(JSRuntime *rt, size_t size, size_t alignment) /* Overallocate and unmap the region's edges. */ size_t reqSize = Min(size + 2 * alignment, 2 * size); - void *region = MapMemory(reqSize, prot, flags, -1, 0); + void* region = MapMemory(reqSize, prot, flags, -1, 0); if (region == MAP_FAILED) return nullptr; @@ -272,8 +272,8 @@ gc::MapAlignedPages(JSRuntime *rt, size_t size, size_t alignment) uintptr_t offset = uintptr_t(region) % alignment; JS_ASSERT(offset < reqSize - size); - void *front = (void *)AlignBytes(uintptr_t(region), alignment); - void *end = (void *)(uintptr_t(front) + size); + void* front = (void*)AlignBytes(uintptr_t(region), alignment); + void* end = (void*)(uintptr_t(front) + size); if (front != region) JS_ALWAYS_TRUE(0 == munmap(region, alignment - offset)); if (uintptr_t(end) != regionEnd) @@ -284,13 +284,13 @@ gc::MapAlignedPages(JSRuntime *rt, size_t size, size_t alignment) } void -gc::UnmapPages(JSRuntime *rt, void *p, size_t size) +gc::UnmapPages(JSRuntime* rt, void* p, size_t size) { JS_ALWAYS_TRUE(0 == munmap(p, size)); } bool -gc::MarkPagesUnused(JSRuntime *rt, void *p, size_t size) +gc::MarkPagesUnused(JSRuntime* rt, void* p, size_t size) { if (!DecommitEnabled(rt)) return false; @@ -301,7 +301,7 @@ gc::MarkPagesUnused(JSRuntime *rt, void *p, size_t size) } bool -gc::MarkPagesInUse(JSRuntime *rt, void *p, size_t size) +gc::MarkPagesInUse(JSRuntime* rt, void* p, size_t size) { JS_ASSERT(uintptr_t(p) % rt->gcSystemPageSize == 0); return true; @@ -317,7 +317,7 @@ gc::GetPageFaultCount() return usage.ru_majflt; } -void * +void* gc::AllocateMappedContent(int fd, size_t offset, size_t length, size_t alignment) { #define NEED_PAGE_ALIGNED 0 @@ -326,7 +326,7 @@ gc::AllocateMappedContent(int fd, size_t offset, size_t length, size_t alignment size_t pa_size; // Total page aligned size size_t page_size = sysconf(_SC_PAGESIZE); // Page size struct stat st; - uint8_t *buf; + uint8_t* buf; // Make sure file exists and do sanity check for offset and size. if (fstat(fd, &st) < 0 || offset >= (size_t) st.st_size || @@ -348,11 +348,11 @@ gc::AllocateMappedContent(int fd, size_t offset, size_t length, size_t alignment pa_size = pa_end - pa_start; // Ask for a continuous memory location. - buf = (uint8_t *) MapMemory(pa_size, PROT_READ | PROT_WRITE, MAP_PRIVATE | MAP_ANON, -1, 0); + buf = (uint8_t*) MapMemory(pa_size, PROT_READ | PROT_WRITE, MAP_PRIVATE | MAP_ANON, -1, 0); if (buf == MAP_FAILED) return nullptr; - buf = (uint8_t *) mmap(buf, pa_size, PROT_READ | PROT_WRITE, + buf = (uint8_t*) mmap(buf, pa_size, PROT_READ | PROT_WRITE, MAP_PRIVATE | MAP_FIXED, fd, pa_start); if (buf == MAP_FAILED) return nullptr; @@ -367,13 +367,13 @@ gc::AllocateMappedContent(int fd, size_t offset, size_t length, size_t alignment } void -gc::DeallocateMappedContent(void *p, size_t length) +gc::DeallocateMappedContent(void* p, size_t length) { - void *pa_start; // Page aligned starting + void* pa_start; // Page aligned starting size_t page_size = sysconf(_SC_PAGESIZE); // Page size size_t total_size; // Total allocated size - pa_start = (void *)(uintptr_t(p) & ~(page_size - 1)); + pa_start = (void*)(uintptr_t(p) & ~(page_size - 1)); total_size = ((uintptr_t(p) + length) & ~(page_size - 1)) + page_size - uintptr_t(pa_start); munmap(pa_start, total_size); } diff --git a/js/src/gc/Memory.h b/js/src/gc/Memory.h index dbbbcb9128..4c963e6921 100644 --- a/js/src/gc/Memory.h +++ b/js/src/gc/Memory.h @@ -17,25 +17,25 @@ namespace gc { // Sanity check that our compiled configuration matches the currently running // instance and initialize any runtime data needed for allocation. void -InitMemorySubsystem(JSRuntime *rt); +InitMemorySubsystem(JSRuntime* rt); // Allocate or deallocate pages from the system with the given alignment. -void * -MapAlignedPages(JSRuntime *rt, size_t size, size_t alignment); +void* +MapAlignedPages(JSRuntime* rt, size_t size, size_t alignment); void -UnmapPages(JSRuntime *rt, void *p, size_t size); +UnmapPages(JSRuntime* rt, void* p, size_t size); // Tell the OS that the given pages are not in use, so they should not // be written to a paging file. This may be a no-op on some platforms. bool -MarkPagesUnused(JSRuntime *rt, void *p, size_t size); +MarkPagesUnused(JSRuntime* rt, void* p, size_t size); // Undo |MarkPagesUnused|: tell the OS that the given pages are of interest // and should be paged in and out normally. This may be a no-op on some // platforms. bool -MarkPagesInUse(JSRuntime *rt, void *p, size_t size); +MarkPagesInUse(JSRuntime* rt, void* p, size_t size); // Returns #(hard faults) + #(soft faults) size_t @@ -43,12 +43,12 @@ GetPageFaultCount(); // Allocate memory mapped content. // The offset must be aligned according to alignment requirement. -void * +void* AllocateMappedContent(int fd, size_t offset, size_t length, size_t alignment); // Deallocate memory mapped content. void -DeallocateMappedContent(void *p, size_t length); +DeallocateMappedContent(void* p, size_t length); } // namespace gc } // namespace js diff --git a/js/src/gc/Nursery-inl.h b/js/src/gc/Nursery-inl.h index 3175eafbaa..349c4bc2a7 100644 --- a/js/src/gc/Nursery-inl.h +++ b/js/src/gc/Nursery-inl.h @@ -32,34 +32,34 @@ class RelocationOverlay uintptr_t magic_; /* The location |this| was moved to. */ - Cell *newLocation_; + Cell* newLocation_; /* A list entry to track all relocated things. */ - RelocationOverlay *next_; + RelocationOverlay* next_; public: - static RelocationOverlay *fromCell(Cell *cell) { + static RelocationOverlay* fromCell(Cell* cell) { JS_ASSERT(!cell->isTenured()); - return reinterpret_cast(cell); + return reinterpret_cast(cell); } bool isForwarded() const { return magic_ == Relocated; } - Cell *forwardingAddress() const { + Cell* forwardingAddress() const { JS_ASSERT(isForwarded()); return newLocation_; } - void forwardTo(Cell *cell) { + void forwardTo(Cell* cell) { JS_ASSERT(!isForwarded()); magic_ = Relocated; newLocation_ = cell; next_ = nullptr; } - RelocationOverlay *next() const { + RelocationOverlay* next() const { return next_; } }; @@ -69,15 +69,15 @@ class RelocationOverlay template MOZ_ALWAYS_INLINE bool -js::Nursery::getForwardedPointer(T **ref) +js::Nursery::getForwardedPointer(T** ref) { JS_ASSERT(ref); JS_ASSERT(isInside(*ref)); - const gc::RelocationOverlay *overlay = reinterpret_cast(*ref); + const gc::RelocationOverlay* overlay = reinterpret_cast(*ref); if (!overlay->isForwarded()) return false; /* This static cast from Cell* restricts T to valid (GC thing) types. */ - *ref = static_cast(overlay->forwardingAddress()); + *ref = static_cast(overlay->forwardingAddress()); return true; } diff --git a/js/src/gc/Nursery.cpp b/js/src/gc/Nursery.cpp index 3eeb0ce232..7abef50ed4 100644 --- a/js/src/gc/Nursery.cpp +++ b/js/src/gc/Nursery.cpp @@ -53,11 +53,11 @@ js::Nursery::init() if (!hugeSlots.init()) return false; - void *heap = MapAlignedPages(runtime(), NurserySize, Alignment); + void* heap = MapAlignedPages(runtime(), NurserySize, Alignment); if (!heap) return false; - JSRuntime *rt = runtime(); + JSRuntime* rt = runtime(); rt->gcNurseryStart_ = uintptr_t(heap); currentStart_ = start(); rt->gcNurseryEnd_ = chunk(LastNurseryChunk).end(); @@ -67,7 +67,7 @@ js::Nursery::init() updateDecommittedRegion(); #ifdef PROFILE_NURSERY - char *env = getenv("JS_MINORGC_TIME"); + char* env = getenv("JS_MINORGC_TIME"); if (env) GCReportThreshold = atoi(env); #endif @@ -79,7 +79,7 @@ js::Nursery::init() js::Nursery::~Nursery() { if (start()) - UnmapPages(runtime(), (void *)start(), NurserySize); + UnmapPages(runtime(), (void*)start(), NurserySize); } void @@ -118,8 +118,8 @@ js::Nursery::isEmpty() const return position() == currentStart_; } -JSObject * -js::Nursery::allocateObject(JSContext *cx, size_t size, size_t numDynamic) +JSObject* +js::Nursery::allocateObject(JSContext* cx, size_t size, size_t numDynamic) { /* Ensure there's enough space to replace the contents with a RelocationOverlay. */ JS_ASSERT(size >= sizeof(RelocationOverlay)); @@ -127,22 +127,22 @@ js::Nursery::allocateObject(JSContext *cx, size_t size, size_t numDynamic) /* Attempt to allocate slots contiguously after object, if possible. */ if (numDynamic && numDynamic <= MaxNurserySlots) { size_t totalSize = size + sizeof(HeapSlot) * numDynamic; - JSObject *obj = static_cast(allocate(totalSize)); + JSObject* obj = static_cast(allocate(totalSize)); if (obj) { - obj->setInitialSlots(reinterpret_cast(size_t(obj) + size)); + obj->setInitialSlots(reinterpret_cast(size_t(obj) + size)); return obj; } /* If we failed to allocate as a block, retry with out-of-line slots. */ } - HeapSlot *slots = nullptr; + HeapSlot* slots = nullptr; if (numDynamic) { slots = allocateHugeSlots(cx, numDynamic); if (MOZ_UNLIKELY(!slots)) return nullptr; } - JSObject *obj = static_cast(allocate(size)); + JSObject* obj = static_cast(allocate(size)); if (obj) obj->setInitialSlots(slots); @@ -152,7 +152,7 @@ js::Nursery::allocateObject(JSContext *cx, size_t size, size_t numDynamic) return obj; } -void * +void* js::Nursery::allocate(size_t size) { JS_ASSERT(isEnabled()); @@ -165,7 +165,7 @@ js::Nursery::allocate(size_t size) setCurrentChunk(currentChunk_ + 1); } - void *thing = (void *)position(); + void* thing = (void*)position(); position_ = position() + size; JS_EXTRA_POISON(thing, JS_ALLOCATED_NURSERY_PATTERN, size); @@ -173,8 +173,8 @@ js::Nursery::allocate(size_t size) } /* Internally, this function is used to allocate elements as well as slots. */ -HeapSlot * -js::Nursery::allocateSlots(JSContext *cx, JSObject *obj, uint32_t nslots) +HeapSlot* +js::Nursery::allocateSlots(JSContext* cx, JSObject* obj, uint32_t nslots) { JS_ASSERT(obj); JS_ASSERT(nslots > 0); @@ -186,32 +186,32 @@ js::Nursery::allocateSlots(JSContext *cx, JSObject *obj, uint32_t nslots) return allocateHugeSlots(cx, nslots); size_t size = sizeof(HeapSlot) * nslots; - HeapSlot *slots = static_cast(allocate(size)); + HeapSlot* slots = static_cast(allocate(size)); if (slots) return slots; return allocateHugeSlots(cx, nslots); } -ObjectElements * -js::Nursery::allocateElements(JSContext *cx, JSObject *obj, uint32_t nelems) +ObjectElements* +js::Nursery::allocateElements(JSContext* cx, JSObject* obj, uint32_t nelems) { JS_ASSERT(nelems >= ObjectElements::VALUES_PER_HEADER); - return reinterpret_cast(allocateSlots(cx, obj, nelems)); + return reinterpret_cast(allocateSlots(cx, obj, nelems)); } -HeapSlot * -js::Nursery::reallocateSlots(JSContext *cx, JSObject *obj, HeapSlot *oldSlots, +HeapSlot* +js::Nursery::reallocateSlots(JSContext* cx, JSObject* obj, HeapSlot* oldSlots, uint32_t oldCount, uint32_t newCount) { size_t oldSize = oldCount * sizeof(HeapSlot); size_t newSize = newCount * sizeof(HeapSlot); if (!isInside(obj)) - return static_cast(cx->realloc_(oldSlots, oldSize, newSize)); + return static_cast(cx->realloc_(oldSlots, oldSize, newSize)); if (!isInside(oldSlots)) { - HeapSlot *newSlots = static_cast(cx->realloc_(oldSlots, oldSize, newSize)); + HeapSlot* newSlots = static_cast(cx->realloc_(oldSlots, oldSize, newSize)); if (oldSlots != newSlots) { hugeSlots.remove(oldSlots); /* If this put fails, we will only leak the slots. */ @@ -224,22 +224,22 @@ js::Nursery::reallocateSlots(JSContext *cx, JSObject *obj, HeapSlot *oldSlots, if (newCount < oldCount) return oldSlots; - HeapSlot *newSlots = allocateSlots(cx, obj, newCount); + HeapSlot* newSlots = allocateSlots(cx, obj, newCount); PodCopy(newSlots, oldSlots, oldCount); return newSlots; } -ObjectElements * -js::Nursery::reallocateElements(JSContext *cx, JSObject *obj, ObjectElements *oldHeader, +ObjectElements* +js::Nursery::reallocateElements(JSContext* cx, JSObject* obj, ObjectElements* oldHeader, uint32_t oldCount, uint32_t newCount) { - HeapSlot *slots = reallocateSlots(cx, obj, reinterpret_cast(oldHeader), + HeapSlot* slots = reallocateSlots(cx, obj, reinterpret_cast(oldHeader), oldCount, newCount); - return reinterpret_cast(slots); + return reinterpret_cast(slots); } void -js::Nursery::freeSlots(JSContext *cx, HeapSlot *slots) +js::Nursery::freeSlots(JSContext* cx, HeapSlot* slots) { if (!isInside(slots)) { hugeSlots.remove(slots); @@ -247,17 +247,17 @@ js::Nursery::freeSlots(JSContext *cx, HeapSlot *slots) } } -HeapSlot * -js::Nursery::allocateHugeSlots(JSContext *cx, size_t nslots) +HeapSlot* +js::Nursery::allocateHugeSlots(JSContext* cx, size_t nslots) { - HeapSlot *slots = cx->pod_malloc(nslots); + HeapSlot* slots = cx->pod_malloc(nslots); /* If this put fails, we will only leak the slots. */ (void)hugeSlots.put(slots); return slots; } void -js::Nursery::notifyInitialSlots(Cell *cell, HeapSlot *slots) +js::Nursery::notifyInitialSlots(Cell* cell, HeapSlot* slots) { if (isInside(cell) && !isInside(slots)) { /* If this put fails, we will only leak the slots. */ @@ -271,7 +271,7 @@ namespace gc { class MinorCollectionTracer : public JSTracer { public: - Nursery *nursery; + Nursery* nursery; AutoTraceSession session; /* Amount of data moved to the tenured generation during collection. */ @@ -282,8 +282,8 @@ class MinorCollectionTracer : public JSTracer * moved things. The list is used to fix up the moved things and to find * things held live by intra-Nursery pointers. */ - RelocationOverlay *head; - RelocationOverlay **tail; + RelocationOverlay* head; + RelocationOverlay** tail; /* Save and restore all of the runtime state we use during MinorGC. */ bool savedRuntimeNeedBarrier; @@ -292,13 +292,13 @@ class MinorCollectionTracer : public JSTracer ArrayBufferVector liveArrayBuffers; /* Insert the given relocation entry into the list of things to visit. */ - MOZ_ALWAYS_INLINE void insertIntoFixupList(RelocationOverlay *entry) { + MOZ_ALWAYS_INLINE void insertIntoFixupList(RelocationOverlay* entry) { *tail = entry; tail = &entry->next_; *tail = nullptr; } - MinorCollectionTracer(JSRuntime *rt, Nursery *nursery) + MinorCollectionTracer(JSRuntime* rt, Nursery* nursery) : JSTracer(rt, Nursery::MinorGCCallback, TraceWeakMapKeysValues), nursery(nursery), session(rt, MinorCollecting), @@ -345,13 +345,13 @@ class MinorCollectionTracer : public JSTracer } /* namespace js */ static AllocKind -GetObjectAllocKindForCopy(JSRuntime *rt, JSObject *obj) +GetObjectAllocKindForCopy(JSRuntime* rt, JSObject* obj) { if (obj->is()) { JS_ASSERT(obj->numFixedSlots() == 0); /* Use minimal size object if we are just going to copy the pointer. */ - if (!IsInsideNursery(rt, (void *)obj->getElementsHeader())) + if (!IsInsideNursery(rt, (void*)obj->getElementsHeader())) return FINALIZE_OBJECT0_BACKGROUND; size_t nelements = obj->getDenseCapacity(); @@ -376,10 +376,10 @@ GetObjectAllocKindForCopy(JSRuntime *rt, JSObject *obj) return GetBackgroundAllocKind(kind); } -void * -js::Nursery::allocateFromTenured(Zone *zone, AllocKind thingKind) +void* +js::Nursery::allocateFromTenured(Zone* zone, AllocKind thingKind) { - void *t = zone->allocator.arenas.allocateFromFreeList(thingKind, Arena::thingSize(thingKind)); + void* t = zone->allocator.arenas.allocateFromFreeList(thingKind, Arena::thingSize(thingKind)); if (t) return t; zone->allocator.arenas.checkEmptyFreeList(thingKind); @@ -387,16 +387,16 @@ js::Nursery::allocateFromTenured(Zone *zone, AllocKind thingKind) } void -js::Nursery::setSlotsForwardingPointer(HeapSlot *oldSlots, HeapSlot *newSlots, uint32_t nslots) +js::Nursery::setSlotsForwardingPointer(HeapSlot* oldSlots, HeapSlot* newSlots, uint32_t nslots) { JS_ASSERT(nslots > 0); JS_ASSERT(isInside(oldSlots)); JS_ASSERT(!isInside(newSlots)); - *reinterpret_cast(oldSlots) = newSlots; + *reinterpret_cast(oldSlots) = newSlots; } void -js::Nursery::setElementsForwardingPointer(ObjectElements *oldHeader, ObjectElements *newHeader, +js::Nursery::setElementsForwardingPointer(ObjectElements* oldHeader, ObjectElements* newHeader, uint32_t nelems) { /* @@ -407,22 +407,22 @@ js::Nursery::setElementsForwardingPointer(ObjectElements *oldHeader, ObjectEleme return; JS_ASSERT(isInside(oldHeader)); JS_ASSERT(!isInside(newHeader)); - *reinterpret_cast(oldHeader->elements()) = newHeader->elements(); + *reinterpret_cast(oldHeader->elements()) = newHeader->elements(); } #ifdef DEBUG -static bool IsWriteableAddress(void *ptr) +static bool IsWriteableAddress(void* ptr) { - volatile uint64_t *vPtr = reinterpret_cast(ptr); + volatile uint64_t* vPtr = reinterpret_cast(ptr); *vPtr = *vPtr; return true; } #endif void -js::Nursery::forwardBufferPointer(HeapSlot **pSlotsElems) +js::Nursery::forwardBufferPointer(HeapSlot** pSlotsElems) { - HeapSlot *old = *pSlotsElems; + HeapSlot* old = *pSlotsElems; if (!isInside(old)) return; @@ -435,7 +435,7 @@ js::Nursery::forwardBufferPointer(HeapSlot **pSlotsElems) * end of the allocable area. Thus, it is always safe to read the first * word of |old| here. */ - *pSlotsElems = *reinterpret_cast(old); + *pSlotsElems = *reinterpret_cast(old); JS_ASSERT(!isInside(*pSlotsElems)); JS_ASSERT(IsWriteableAddress(*pSlotsElems)); } @@ -444,7 +444,7 @@ js::Nursery::forwardBufferPointer(HeapSlot **pSlotsElems) // tenured during a minor collection. struct TenureCount { - types::TypeObject *type; + types::TypeObject* type; int count; }; @@ -457,19 +457,19 @@ struct Nursery::TenureCountCache TenureCountCache() { PodZero(this); } - TenureCount &findEntry(types::TypeObject *type) { - return entries[PointerHasher::hash(type) % ArrayLength(entries)]; + TenureCount& findEntry(types::TypeObject* type) { + return entries[PointerHasher::hash(type) % ArrayLength(entries)]; } }; void -js::Nursery::collectToFixedPoint(MinorCollectionTracer *trc, TenureCountCache &tenureCounts) +js::Nursery::collectToFixedPoint(MinorCollectionTracer* trc, TenureCountCache& tenureCounts) { - for (RelocationOverlay *p = trc->head; p; p = p->next()) { - JSObject *obj = static_cast(p->forwardingAddress()); + for (RelocationOverlay* p = trc->head; p; p = p->next()) { + JSObject* obj = static_cast(p->forwardingAddress()); traceObject(trc, obj); - TenureCount &entry = tenureCounts.findEntry(obj->type()); + TenureCount& entry = tenureCounts.findEntry(obj->type()); if (entry.type == obj->type()) { entry.count++; } else if (!entry.type) { @@ -480,9 +480,9 @@ js::Nursery::collectToFixedPoint(MinorCollectionTracer *trc, TenureCountCache &t } MOZ_ALWAYS_INLINE void -js::Nursery::traceObject(MinorCollectionTracer *trc, JSObject *obj) +js::Nursery::traceObject(MinorCollectionTracer* trc, JSObject* obj) { - const Class *clasp = obj->getClass(); + const Class* clasp = obj->getClass(); if (clasp->trace) clasp->trace(trc, obj); @@ -492,32 +492,32 @@ js::Nursery::traceObject(MinorCollectionTracer *trc, JSObject *obj) if (!obj->hasEmptyElements()) markSlots(trc, obj->getDenseElements(), obj->getDenseInitializedLength()); - HeapSlot *fixedStart, *fixedEnd, *dynStart, *dynEnd; + HeapSlot* fixedStart, *fixedEnd, *dynStart, *dynEnd; obj->getSlotRange(0, obj->slotSpan(), &fixedStart, &fixedEnd, &dynStart, &dynEnd); markSlots(trc, fixedStart, fixedEnd); markSlots(trc, dynStart, dynEnd); } MOZ_ALWAYS_INLINE void -js::Nursery::markSlots(MinorCollectionTracer *trc, HeapSlot *vp, uint32_t nslots) +js::Nursery::markSlots(MinorCollectionTracer* trc, HeapSlot* vp, uint32_t nslots) { markSlots(trc, vp, vp + nslots); } MOZ_ALWAYS_INLINE void -js::Nursery::markSlots(MinorCollectionTracer *trc, HeapSlot *vp, HeapSlot *end) +js::Nursery::markSlots(MinorCollectionTracer* trc, HeapSlot* vp, HeapSlot* end) { for (; vp != end; ++vp) markSlot(trc, vp); } MOZ_ALWAYS_INLINE void -js::Nursery::markSlot(MinorCollectionTracer *trc, HeapSlot *slotp) +js::Nursery::markSlot(MinorCollectionTracer* trc, HeapSlot* slotp) { if (!slotp->isObject()) return; - JSObject *obj = &slotp->toObject(); + JSObject* obj = &slotp->toObject(); if (!isInside(obj)) return; @@ -526,30 +526,30 @@ js::Nursery::markSlot(MinorCollectionTracer *trc, HeapSlot *slotp) return; } - JSObject *tenured = static_cast(moveToTenured(trc, obj)); + JSObject* tenured = static_cast(moveToTenured(trc, obj)); slotp->unsafeGet()->setObject(*tenured); } -void * -js::Nursery::moveToTenured(MinorCollectionTracer *trc, JSObject *src) +void* +js::Nursery::moveToTenured(MinorCollectionTracer* trc, JSObject* src) { - Zone *zone = src->zone(); + Zone* zone = src->zone(); AllocKind dstKind = GetObjectAllocKindForCopy(trc->runtime(), src); - JSObject *dst = static_cast(allocateFromTenured(zone, dstKind)); + JSObject* dst = static_cast(allocateFromTenured(zone, dstKind)); if (!dst) CrashAtUnhandlableOOM("Failed to allocate object while tenuring."); trc->tenuredSize += moveObjectToTenured(dst, src, dstKind); - RelocationOverlay *overlay = reinterpret_cast(src); + RelocationOverlay* overlay = reinterpret_cast(src); overlay->forwardTo(dst); trc->insertIntoFixupList(overlay); - return static_cast(dst); + return static_cast(dst); } size_t -js::Nursery::moveObjectToTenured(JSObject *dst, JSObject *src, AllocKind dstKind) +js::Nursery::moveObjectToTenured(JSObject* dst, JSObject* src, AllocKind dstKind) { size_t srcSize = Arena::thingSize(dstKind); size_t tenuredSize = srcSize; @@ -577,20 +577,20 @@ js::Nursery::moveObjectToTenured(JSObject *dst, JSObject *src, AllocKind dstKind } void -js::Nursery::forwardTypedArrayPointers(JSObject *dst, JSObject *src) +js::Nursery::forwardTypedArrayPointers(JSObject* dst, JSObject* src) { /* * Typed array data may be stored inline inside the object's fixed slots. If * so, we need update the private pointer and leave a forwarding pointer at * the start of the data. */ - TypedArrayObject &typedArray = src->as(); + TypedArrayObject& typedArray = src->as(); JS_ASSERT_IF(typedArray.buffer(), !isInside(src->getPrivate())); if (typedArray.buffer()) return; - void *srcData = src->fixedData(TypedArrayObject::FIXED_DATA_START); - void *dstData = dst->fixedData(TypedArrayObject::FIXED_DATA_START); + void* srcData = src->fixedData(TypedArrayObject::FIXED_DATA_START); + void* dstData = dst->fixedData(TypedArrayObject::FIXED_DATA_START); JS_ASSERT(src->getPrivate() == srcData); dst->setPrivate(dstData); @@ -606,7 +606,7 @@ js::Nursery::forwardTypedArrayPointers(JSObject *dst, JSObject *src) } size_t -js::Nursery::moveSlotsToTenured(JSObject *dst, JSObject *src, AllocKind dstKind) +js::Nursery::moveSlotsToTenured(JSObject* dst, JSObject* src, AllocKind dstKind) { /* Fixed slots have already been copied over. */ if (!src->hasDynamicSlots()) @@ -617,7 +617,7 @@ js::Nursery::moveSlotsToTenured(JSObject *dst, JSObject *src, AllocKind dstKind) return 0; } - Zone *zone = src->zone(); + Zone* zone = src->zone(); size_t count = src->numDynamicSlots(); dst->slots = zone->pod_malloc(count); if (!dst->slots) @@ -628,14 +628,14 @@ js::Nursery::moveSlotsToTenured(JSObject *dst, JSObject *src, AllocKind dstKind) } size_t -js::Nursery::moveElementsToTenured(JSObject *dst, JSObject *src, AllocKind dstKind) +js::Nursery::moveElementsToTenured(JSObject* dst, JSObject* src, AllocKind dstKind) { if (src->hasEmptyElements()) return 0; - Zone *zone = src->zone(); - ObjectElements *srcHeader = src->getElementsHeader(); - ObjectElements *dstHeader; + Zone* zone = src->zone(); + ObjectElements* srcHeader = src->getElementsHeader(); + ObjectElements* dstHeader; /* TODO Bug 874151: Prefer to put element data inline if we have space. */ if (!isInside(srcHeader)) { @@ -657,7 +657,7 @@ js::Nursery::moveElementsToTenured(JSObject *dst, JSObject *src, AllocKind dstKi JS_ASSERT(nslots >= 2); size_t nbytes = nslots * sizeof(HeapValue); - dstHeader = static_cast(zone->malloc_(nbytes)); + dstHeader = static_cast(zone->malloc_(nbytes)); if (!dstHeader) CrashAtUnhandlableOOM("Failed to allocate elements while tenuring."); js_memcpy(dstHeader, srcHeader, nslots * sizeof(HeapSlot)); @@ -667,24 +667,24 @@ js::Nursery::moveElementsToTenured(JSObject *dst, JSObject *src, AllocKind dstKi } static bool -ShouldMoveToTenured(MinorCollectionTracer *trc, void **thingp) +ShouldMoveToTenured(MinorCollectionTracer* trc, void** thingp) { - Cell *cell = static_cast(*thingp); - Nursery &nursery = *trc->nursery; + Cell* cell = static_cast(*thingp); + Nursery& nursery = *trc->nursery; return !nursery.isInside(thingp) && nursery.isInside(cell) && !nursery.getForwardedPointer(thingp); } /* static */ void -js::Nursery::MinorGCCallback(JSTracer *jstrc, void **thingp, JSGCTraceKind kind) +js::Nursery::MinorGCCallback(JSTracer* jstrc, void** thingp, JSGCTraceKind kind) { - MinorCollectionTracer *trc = static_cast(jstrc); + MinorCollectionTracer* trc = static_cast(jstrc); if (ShouldMoveToTenured(trc, thingp)) - *thingp = trc->nursery->moveToTenured(trc, static_cast(*thingp)); + *thingp = trc->nursery->moveToTenured(trc, static_cast(*thingp)); } static void -CheckHashTablesAfterMovingGC(JSRuntime *rt) +CheckHashTablesAfterMovingGC(JSRuntime* rt) { #ifdef JS_GC_ZEAL if (rt->gcZeal() == ZealCheckHashTablesOnMinorGC) { @@ -711,7 +711,7 @@ CheckHashTablesAfterMovingGC(JSRuntime *rt) #endif void -js::Nursery::collect(JSRuntime *rt, JS::gcreason::Reason reason, TypeObjectList *pretenureTypes) +js::Nursery::collect(JSRuntime* rt, JS::gcreason::Reason reason, TypeObjectList* pretenureTypes) { JS_AbortIfWrongThread(rt); @@ -734,7 +734,7 @@ js::Nursery::collect(JSRuntime *rt, JS::gcreason::Reason reason, TypeObjectList MinorCollectionTracer trc(rt, this); // Mark the store buffer. This must happen first. - StoreBuffer &sb = rt->gcStoreBuffer; + StoreBuffer& sb = rt->gcStoreBuffer; TIME_START(markValues); sb.markValues(&trc); TIME_END(markValues); @@ -819,7 +819,7 @@ js::Nursery::collect(JSRuntime *rt, JS::gcreason::Reason reason, TypeObjectList TIME_START(pretenure); if (pretenureTypes && (promotionRate > 0.8 || reason == JS::gcreason::FULL_STORE_BUFFER)) { for (size_t i = 0; i < ArrayLength(tenureCounts.entries); i++) { - const TenureCount &entry = tenureCounts.entries[i]; + const TenureCount& entry = tenureCounts.entries[i]; if (entry.count >= 3000) pretenureTypes->append(entry.type); // ignore alloc failure } @@ -890,7 +890,7 @@ js::Nursery::collect(JSRuntime *rt, JS::gcreason::Reason reason, TypeObjectList } void -js::Nursery::freeHugeSlots(JSRuntime *rt) +js::Nursery::freeHugeSlots(JSRuntime* rt) { for (HugeSlotsSet::Range r = hugeSlots.all(); !r.empty(); r.popFront()) rt->defaultFreeOp()->free_(r.front()); @@ -898,11 +898,11 @@ js::Nursery::freeHugeSlots(JSRuntime *rt) } void -js::Nursery::sweep(JSRuntime *rt) +js::Nursery::sweep(JSRuntime* rt) { #ifdef JS_GC_ZEAL /* Poison the nursery contents so touching a freed object will crash. */ - JS_POISON((void *)start(), JS_SWEPT_NURSERY_PATTERN, NurserySize); + JS_POISON((void*)start(), JS_SWEPT_NURSERY_PATTERN, NurserySize); for (int i = 0; i < NumNurseryChunks; ++i) initChunk(i); @@ -916,7 +916,7 @@ js::Nursery::sweep(JSRuntime *rt) #endif { #ifdef JS_CRASH_DIAGNOSTICS - JS_POISON((void *)start(), JS_SWEPT_NURSERY_PATTERN, allocationEnd() - start()); + JS_POISON((void*)start(), JS_SWEPT_NURSERY_PATTERN, allocationEnd() - start()); for (int i = 0; i < numActiveChunks_; ++i) chunk(i).trailer.runtime = runtime(); #endif diff --git a/js/src/gc/Nursery.h b/js/src/gc/Nursery.h index 0631e867f7..57db5bbbcc 100644 --- a/js/src/gc/Nursery.h +++ b/js/src/gc/Nursery.h @@ -30,7 +30,7 @@ namespace js { class ObjectElements; class HeapSlot; -void SetGCZeal(JSRuntime *, uint8_t, uint32_t); +void SetGCZeal(JSRuntime*, uint8_t, uint32_t); namespace gc { class Cell; @@ -57,7 +57,7 @@ class Nursery static const size_t ChunkShift = gc::ChunkShift; static const size_t NurserySize = gc::ChunkSize * NumNurseryChunks; - explicit Nursery(JSRuntime *rt) + explicit Nursery(JSRuntime* rt) : runtime_(rt), position_(0), currentStart_(0), @@ -77,43 +77,43 @@ class Nursery bool isEmpty() const; template - MOZ_ALWAYS_INLINE bool isInside(const T *p) const { - return gc::IsInsideNursery((JS::shadow::Runtime *)runtime_, p); + MOZ_ALWAYS_INLINE bool isInside(const T* p) const { + return gc::IsInsideNursery((JS::shadow::Runtime*)runtime_, p); } /* * Allocate and return a pointer to a new GC object with its |slots| * pointer pre-filled. Returns nullptr if the Nursery is full. */ - JSObject *allocateObject(JSContext *cx, size_t size, size_t numDynamic); + JSObject* allocateObject(JSContext* cx, size_t size, size_t numDynamic); /* Allocate a slots array for the given object. */ - HeapSlot *allocateSlots(JSContext *cx, JSObject *obj, uint32_t nslots); + HeapSlot* allocateSlots(JSContext* cx, JSObject* obj, uint32_t nslots); /* Allocate an elements vector for the given object. */ - ObjectElements *allocateElements(JSContext *cx, JSObject *obj, uint32_t nelems); + ObjectElements* allocateElements(JSContext* cx, JSObject* obj, uint32_t nelems); /* Resize an existing slots array. */ - HeapSlot *reallocateSlots(JSContext *cx, JSObject *obj, HeapSlot *oldSlots, + HeapSlot* reallocateSlots(JSContext* cx, JSObject* obj, HeapSlot* oldSlots, uint32_t oldCount, uint32_t newCount); /* Resize an existing elements vector. */ - ObjectElements *reallocateElements(JSContext *cx, JSObject *obj, ObjectElements *oldHeader, + ObjectElements* reallocateElements(JSContext* cx, JSObject* obj, ObjectElements* oldHeader, uint32_t oldCount, uint32_t newCount); /* Free a slots array. */ - void freeSlots(JSContext *cx, HeapSlot *slots); + void freeSlots(JSContext* cx, HeapSlot* slots); /* Add a slots to our tracking list if it is out-of-line. */ - void notifyInitialSlots(gc::Cell *cell, HeapSlot *slots); + void notifyInitialSlots(gc::Cell* cell, HeapSlot* slots); - typedef Vector TypeObjectList; + typedef Vector TypeObjectList; /* * Do a minor collection, optionally specifying a list to store types which * should be pretenured afterwards. */ - void collect(JSRuntime *rt, JS::gcreason::Reason reason, TypeObjectList *pretenureTypes); + void collect(JSRuntime* rt, JS::gcreason::Reason reason, TypeObjectList* pretenureTypes); /* * Check if the thing at |*ref| in the Nursery has been forwarded. If so, @@ -121,10 +121,10 @@ class Nursery * returns false and leaves |*ref| unset. */ template - MOZ_ALWAYS_INLINE bool getForwardedPointer(T **ref); + MOZ_ALWAYS_INLINE bool getForwardedPointer(T** ref); /* Forward a slots/elements pointer stored in an Ion frame. */ - void forwardBufferPointer(HeapSlot **pSlotsElems); + void forwardBufferPointer(HeapSlot** pSlotsElems); size_t sizeOfHeapCommitted() const { return numActiveChunks_ * gc::ChunkSize; @@ -142,12 +142,12 @@ class Nursery MOZ_ALWAYS_INLINE uintptr_t start() const { JS_ASSERT(runtime_); - return ((JS::shadow::Runtime *)runtime_)->gcNurseryStart_; + return ((JS::shadow::Runtime*)runtime_)->gcNurseryStart_; } MOZ_ALWAYS_INLINE uintptr_t heapEnd() const { JS_ASSERT(runtime_); - return ((JS::shadow::Runtime *)runtime_)->gcNurseryEnd_; + return ((JS::shadow::Runtime*)runtime_)->gcNurseryEnd_; } private: @@ -156,7 +156,7 @@ class Nursery * inline the isInsideNursery check into embedder code. Use the start() * and heapEnd() functions to access these values. */ - JSRuntime *runtime_; + JSRuntime* runtime_; /* Pointer to the first unallocated byte in the nursery. */ uintptr_t position_; @@ -178,7 +178,7 @@ class Nursery * stored in the nursery. Any external slots that do not belong to a * tenured thing at the end of a minor GC must be freed. */ - typedef HashSet, SystemAllocPolicy> HugeSlotsSet; + typedef HashSet, SystemAllocPolicy> HugeSlotsSet; HugeSlotsSet hugeSlots; /* The maximum number of slots allowed to reside inline in the nursery. */ @@ -195,14 +195,14 @@ class Nursery }; static_assert(sizeof(NurseryChunkLayout) == gc::ChunkSize, "Nursery chunk size must match gc::Chunk size."); - NurseryChunkLayout &chunk(int index) const { + NurseryChunkLayout& chunk(int index) const { JS_ASSERT(index < NumNurseryChunks); JS_ASSERT(start()); - return reinterpret_cast(start())[index]; + return reinterpret_cast(start())[index]; } MOZ_ALWAYS_INLINE void initChunk(int chunkno) { - NurseryChunkLayout &c = chunk(chunkno); + NurseryChunkLayout& c = chunk(chunkno); c.trailer.location = gc::ChunkLocationNursery; c.trailer.runtime = runtime(); } @@ -224,7 +224,7 @@ class Nursery # ifndef XP_MACOSX uintptr_t decommitStart = chunk(numActiveChunks_).start(); JS_ASSERT(decommitStart == AlignBytes(decommitStart, 1 << 20)); - gc::MarkPagesUnused(runtime(), (void *)decommitStart, heapEnd() - decommitStart); + gc::MarkPagesUnused(runtime(), (void*)decommitStart, heapEnd() - decommitStart); # endif } #endif @@ -244,61 +244,61 @@ class Nursery JS_ASSERT(currentEnd_ == chunk(currentChunk_).end()); return currentEnd_; } - void *addressOfCurrentEnd() const { + void* addressOfCurrentEnd() const { JS_ASSERT(runtime_); - return (void *)¤tEnd_; + return (void*)¤tEnd_; } uintptr_t position() const { return position_; } - void *addressOfPosition() const { return (void*)&position_; } + void* addressOfPosition() const { return (void*)&position_; } - JSRuntime *runtime() const { return runtime_; } + JSRuntime* runtime() const { return runtime_; } /* Allocates and registers external slots with the nursery. */ - HeapSlot *allocateHugeSlots(JSContext *cx, size_t nslots); + HeapSlot* allocateHugeSlots(JSContext* cx, size_t nslots); /* Allocates a new GC thing from the tenured generation during minor GC. */ - void *allocateFromTenured(JS::Zone *zone, gc::AllocKind thingKind); + void* allocateFromTenured(JS::Zone* zone, gc::AllocKind thingKind); struct TenureCountCache; /* Common internal allocator function. */ - void *allocate(size_t size); + void* allocate(size_t size); /* * Move the object at |src| in the Nursery to an already-allocated cell * |dst| in Tenured. */ - void collectToFixedPoint(gc::MinorCollectionTracer *trc, TenureCountCache &tenureCounts); - MOZ_ALWAYS_INLINE void traceObject(gc::MinorCollectionTracer *trc, JSObject *src); - MOZ_ALWAYS_INLINE void markSlots(gc::MinorCollectionTracer *trc, HeapSlot *vp, uint32_t nslots); - MOZ_ALWAYS_INLINE void markSlots(gc::MinorCollectionTracer *trc, HeapSlot *vp, HeapSlot *end); - MOZ_ALWAYS_INLINE void markSlot(gc::MinorCollectionTracer *trc, HeapSlot *slotp); - void *moveToTenured(gc::MinorCollectionTracer *trc, JSObject *src); - size_t moveObjectToTenured(JSObject *dst, JSObject *src, gc::AllocKind dstKind); - size_t moveElementsToTenured(JSObject *dst, JSObject *src, gc::AllocKind dstKind); - size_t moveSlotsToTenured(JSObject *dst, JSObject *src, gc::AllocKind dstKind); - void forwardTypedArrayPointers(JSObject *dst, JSObject *src); + void collectToFixedPoint(gc::MinorCollectionTracer* trc, TenureCountCache& tenureCounts); + MOZ_ALWAYS_INLINE void traceObject(gc::MinorCollectionTracer* trc, JSObject* src); + MOZ_ALWAYS_INLINE void markSlots(gc::MinorCollectionTracer* trc, HeapSlot* vp, uint32_t nslots); + MOZ_ALWAYS_INLINE void markSlots(gc::MinorCollectionTracer* trc, HeapSlot* vp, HeapSlot* end); + MOZ_ALWAYS_INLINE void markSlot(gc::MinorCollectionTracer* trc, HeapSlot* slotp); + void* moveToTenured(gc::MinorCollectionTracer* trc, JSObject* src); + size_t moveObjectToTenured(JSObject* dst, JSObject* src, gc::AllocKind dstKind); + size_t moveElementsToTenured(JSObject* dst, JSObject* src, gc::AllocKind dstKind); + size_t moveSlotsToTenured(JSObject* dst, JSObject* src, gc::AllocKind dstKind); + void forwardTypedArrayPointers(JSObject* dst, JSObject* src); /* Handle relocation of slots/elements pointers stored in Ion frames. */ - void setSlotsForwardingPointer(HeapSlot *oldSlots, HeapSlot *newSlots, uint32_t nslots); - void setElementsForwardingPointer(ObjectElements *oldHeader, ObjectElements *newHeader, + void setSlotsForwardingPointer(HeapSlot* oldSlots, HeapSlot* newSlots, uint32_t nslots); + void setElementsForwardingPointer(ObjectElements* oldHeader, ObjectElements* newHeader, uint32_t nelems); /* Free malloced pointers owned by freed things in the nursery. */ - void freeHugeSlots(JSRuntime *rt); + void freeHugeSlots(JSRuntime* rt); /* * Frees all non-live nursery-allocated things at the end of a minor * collection. */ - void sweep(JSRuntime *rt); + void sweep(JSRuntime* rt); /* Change the allocable space provided by the nursery. */ void growAllocableSpace(); void shrinkAllocableSpace(); - static void MinorGCCallback(JSTracer *trc, void **thingp, JSGCTraceKind kind); + static void MinorGCCallback(JSTracer* trc, void** thingp, JSGCTraceKind kind); #ifdef JS_GC_ZEAL /* @@ -323,7 +323,7 @@ class Nursery friend class gc::MinorCollectionTracer; friend class jit::MacroAssembler; - friend void SetGCZeal(JSRuntime *, uint8_t, uint32_t); + friend void SetGCZeal(JSRuntime*, uint8_t, uint32_t); }; } /* namespace js */ diff --git a/js/src/gc/RootMarking.cpp b/js/src/gc/RootMarking.cpp index 155ebafa0b..264e1ac5a5 100644 --- a/js/src/gc/RootMarking.cpp +++ b/js/src/gc/RootMarking.cpp @@ -41,9 +41,9 @@ typedef RootedValueMap::Enum RootEnum; #ifdef JSGC_USE_EXACT_ROOTING static inline void -MarkExactStackRoot(JSTracer *trc, Rooted *rooter, ThingRootKind kind) +MarkExactStackRoot(JSTracer* trc, Rooted* rooter, ThingRootKind kind) { - void **addr = (void **)rooter->address(); + void** addr = (void**)rooter->address(); if (IsNullTaggedPointer(*addr)) return; @@ -51,19 +51,19 @@ MarkExactStackRoot(JSTracer *trc, Rooted *rooter, ThingRootKind kind) return; switch (kind) { - case THING_ROOT_OBJECT: MarkObjectRoot(trc, (JSObject **)addr, "exact-object"); break; - case THING_ROOT_STRING: MarkStringRoot(trc, (JSString **)addr, "exact-string"); break; - case THING_ROOT_SCRIPT: MarkScriptRoot(trc, (JSScript **)addr, "exact-script"); break; - case THING_ROOT_LAZY_SCRIPT: MarkLazyScriptRoot(trc, (LazyScript **)addr, "exact-lazy-script"); break; - case THING_ROOT_SHAPE: MarkShapeRoot(trc, (Shape **)addr, "exact-shape"); break; - case THING_ROOT_BASE_SHAPE: MarkBaseShapeRoot(trc, (BaseShape **)addr, "exact-baseshape"); break; - case THING_ROOT_TYPE: MarkTypeRoot(trc, (types::Type *)addr, "exact-type"); break; - case THING_ROOT_TYPE_OBJECT: MarkTypeObjectRoot(trc, (types::TypeObject **)addr, "exact-typeobject"); break; - case THING_ROOT_JIT_CODE: MarkJitCodeRoot(trc, (jit::JitCode **)addr, "exact-jitcode"); break; - case THING_ROOT_VALUE: MarkValueRoot(trc, (Value *)addr, "exact-value"); break; - case THING_ROOT_ID: MarkIdRoot(trc, (jsid *)addr, "exact-id"); break; - case THING_ROOT_BINDINGS: ((Bindings *)addr)->trace(trc); break; - case THING_ROOT_PROPERTY_DESCRIPTOR: ((JSPropertyDescriptor *)addr)->trace(trc); break; + case THING_ROOT_OBJECT: MarkObjectRoot(trc, (JSObject**)addr, "exact-object"); break; + case THING_ROOT_STRING: MarkStringRoot(trc, (JSString**)addr, "exact-string"); break; + case THING_ROOT_SCRIPT: MarkScriptRoot(trc, (JSScript**)addr, "exact-script"); break; + case THING_ROOT_LAZY_SCRIPT: MarkLazyScriptRoot(trc, (LazyScript**)addr, "exact-lazy-script"); break; + case THING_ROOT_SHAPE: MarkShapeRoot(trc, (Shape**)addr, "exact-shape"); break; + case THING_ROOT_BASE_SHAPE: MarkBaseShapeRoot(trc, (BaseShape**)addr, "exact-baseshape"); break; + case THING_ROOT_TYPE: MarkTypeRoot(trc, (types::Type*)addr, "exact-type"); break; + case THING_ROOT_TYPE_OBJECT: MarkTypeObjectRoot(trc, (types::TypeObject**)addr, "exact-typeobject"); break; + case THING_ROOT_JIT_CODE: MarkJitCodeRoot(trc, (jit::JitCode**)addr, "exact-jitcode"); break; + case THING_ROOT_VALUE: MarkValueRoot(trc, (Value*)addr, "exact-value"); break; + case THING_ROOT_ID: MarkIdRoot(trc, (jsid*)addr, "exact-id"); break; + case THING_ROOT_BINDINGS: ((Bindings*)addr)->trace(trc); break; + case THING_ROOT_PROPERTY_DESCRIPTOR: ((JSPropertyDescriptor*)addr)->trace(trc); break; case THING_ROOT_CUSTOM: { // 'rooter' is a member within a class containing a vtable. Back up // to the vtable and call trace() through it. @@ -76,7 +76,7 @@ MarkExactStackRoot(JSTracer *trc, Rooted *rooter, ThingRootKind kind) } static inline void -MarkExactStackRootList(JSTracer *trc, Rooted *rooter, ThingRootKind kind) +MarkExactStackRootList(JSTracer* trc, Rooted* rooter, ThingRootKind kind) { while (rooter) { MarkExactStackRoot(trc, rooter, kind); @@ -85,7 +85,7 @@ MarkExactStackRootList(JSTracer *trc, Rooted *rooter, ThingRootKind kind) } static void -MarkExactStackRoots(JSTracer *trc) +MarkExactStackRoots(JSTracer* trc) { for (unsigned i = 0; i < THING_ROOT_LIMIT; i++) { for (ContextIter cx(trc->runtime()); !cx.done(); cx.next()) @@ -113,11 +113,11 @@ enum ConservativeGCTest * details about the thing if so. On failure, returns the reason for rejection. */ static inline ConservativeGCTest -IsAddressableGCThing(JSRuntime *rt, uintptr_t w, +IsAddressableGCThing(JSRuntime* rt, uintptr_t w, bool skipUncollectedCompartments, - gc::AllocKind *thingKindPtr, - ArenaHeader **arenaHeader, - void **thing) + gc::AllocKind* thingKindPtr, + ArenaHeader** arenaHeader, + void** thing) { /* * We assume that the compiler never uses sub-word alignment to store @@ -141,7 +141,7 @@ IsAddressableGCThing(JSRuntime *rt, uintptr_t w, uintptr_t addr = w & JSID_PAYLOAD_MASK & JSVAL_PAYLOAD_MASK; #endif - Chunk *chunk = Chunk::fromAddress(addr); + Chunk* chunk = Chunk::fromAddress(addr); if (!rt->gcChunkSet.has(chunk)) return CGCT_NOTCHUNK; @@ -159,7 +159,7 @@ IsAddressableGCThing(JSRuntime *rt, uintptr_t w, if (chunk->decommittedArenas.get(arenaOffset)) return CGCT_FREEARENA; - ArenaHeader *aheader = &chunk->arenas[arenaOffset].aheader; + ArenaHeader* aheader = &chunk->arenas[arenaOffset].aheader; if (!aheader->allocated()) return CGCT_FREEARENA; @@ -178,7 +178,7 @@ IsAddressableGCThing(JSRuntime *rt, uintptr_t w, addr -= shift; if (thing) - *thing = reinterpret_cast(addr); + *thing = reinterpret_cast(addr); if (arenaHeader) *arenaHeader = aheader; if (thingKindPtr) @@ -191,10 +191,10 @@ IsAddressableGCThing(JSRuntime *rt, uintptr_t w, * thingKind accordingly. Otherwise returns the reason for rejection. */ static inline ConservativeGCTest -MarkIfGCThingWord(JSTracer *trc, uintptr_t w) +MarkIfGCThingWord(JSTracer* trc, uintptr_t w) { - void *thing; - ArenaHeader *aheader; + void* thing; + ArenaHeader* aheader; AllocKind thingKind; ConservativeGCTest status = IsAddressableGCThing(trc->runtime(), w, IS_GC_MARKING_TRACER(trc), @@ -217,8 +217,8 @@ MarkIfGCThingWord(JSTracer *trc, uintptr_t w) JS_snprintf(nameBuf, sizeof(nameBuf), pattern, thing); trc->setTracingName(nameBuf); #endif - trc->setTracingLocation((void *)w); - void *tmp = thing; + trc->setTracingLocation((void*)w); + void* tmp = thing; MarkKind(trc, &tmp, traceKind); JS_ASSERT(tmp == thing); @@ -233,7 +233,7 @@ MarkIfGCThingWord(JSTracer *trc, uintptr_t w) #ifndef JSGC_USE_EXACT_ROOTING static void -MarkWordConservatively(JSTracer *trc, uintptr_t w) +MarkWordConservatively(JSTracer* trc, uintptr_t w) { /* * The conservative scanner may access words that valgrind considers as @@ -250,17 +250,17 @@ MarkWordConservatively(JSTracer *trc, uintptr_t w) MOZ_ASAN_BLACKLIST static void -MarkRangeConservatively(JSTracer *trc, const uintptr_t *begin, const uintptr_t *end) +MarkRangeConservatively(JSTracer* trc, const uintptr_t* begin, const uintptr_t* end) { JS_ASSERT(begin <= end); - for (const uintptr_t *i = begin; i < end; ++i) + for (const uintptr_t* i = begin; i < end; ++i) MarkWordConservatively(trc, *i); } static void -MarkRangeConservativelyAndSkipIon(JSTracer *trc, JSRuntime *rt, const uintptr_t *begin, const uintptr_t *end) +MarkRangeConservativelyAndSkipIon(JSTracer* trc, JSRuntime* rt, const uintptr_t* begin, const uintptr_t* end) { - const uintptr_t *i = begin; + const uintptr_t* i = begin; #if JS_STACK_GROWTH_DIRECTION < 0 && defined(JS_ION) && !defined(JS_ARM_SIMULATOR) // Walk only regions in between JIT activations. Note that non-volatile @@ -271,7 +271,7 @@ MarkRangeConservativelyAndSkipIon(JSTracer *trc, JSRuntime *rt, const uintptr_t // stack but on the simulator stack, so we don't have to skip JIT regions // in this case. for (jit::JitActivationIterator iter(rt); !iter.done(); ++iter) { - uintptr_t *jitMin, *jitEnd; + uintptr_t* jitMin, *jitEnd; iter.jitStackRange(jitMin, jitEnd); MarkRangeConservatively(trc, i, jitMin); @@ -284,13 +284,13 @@ MarkRangeConservativelyAndSkipIon(JSTracer *trc, JSRuntime *rt, const uintptr_t } static MOZ_NEVER_INLINE void -MarkConservativeStackRoots(JSTracer *trc, bool useSavedRoots) +MarkConservativeStackRoots(JSTracer* trc, bool useSavedRoots) { - JSRuntime *rt = trc->runtime(); + JSRuntime* rt = trc->runtime(); #ifdef DEBUG if (useSavedRoots) { - for (PerThreadData::SavedGCRoot *root = rt->mainThread.gcSavedRoots.begin(); + for (PerThreadData::SavedGCRoot* root = rt->mainThread.gcSavedRoots.begin(); root != rt->mainThread.gcSavedRoots.end(); root++) { @@ -304,7 +304,7 @@ MarkConservativeStackRoots(JSTracer *trc, bool useSavedRoots) rt->mainThread.gcSavedRoots.clearAndFree(); #endif - ConservativeGCData *cgcd = &rt->conservativeGC; + ConservativeGCData* cgcd = &rt->conservativeGC; if (!cgcd->hasStackToScan()) { #ifdef JS_THREADSAFE JS_ASSERT(!rt->requestDepth); @@ -312,13 +312,13 @@ MarkConservativeStackRoots(JSTracer *trc, bool useSavedRoots) return; } - uintptr_t *stackMin, *stackEnd; + uintptr_t* stackMin, *stackEnd; #if JS_STACK_GROWTH_DIRECTION > 0 - stackMin = reinterpret_cast(rt->nativeStackBase); + stackMin = reinterpret_cast(rt->nativeStackBase); stackEnd = cgcd->nativeStackTop; #else stackMin = cgcd->nativeStackTop + 1; - stackEnd = reinterpret_cast(rt->nativeStackBase); + stackEnd = reinterpret_cast(rt->nativeStackBase); #endif JS_ASSERT(stackMin <= stackEnd); @@ -328,17 +328,17 @@ MarkConservativeStackRoots(JSTracer *trc, bool useSavedRoots) } void -js::MarkStackRangeConservatively(JSTracer *trc, Value *beginv, Value *endv) +js::MarkStackRangeConservatively(JSTracer* trc, Value* beginv, Value* endv) { - const uintptr_t *begin = beginv->payloadUIntPtr(); - const uintptr_t *end = endv->payloadUIntPtr(); + const uintptr_t* begin = beginv->payloadUIntPtr(); + const uintptr_t* end = endv->payloadUIntPtr(); #ifdef JS_NUNBOX32 /* * With 64-bit jsvals on 32-bit systems, we can optimize a bit by * scanning only the payloads. */ JS_ASSERT(begin <= end); - for (const uintptr_t *i = begin; i < end; i += sizeof(Value) / sizeof(uintptr_t)) + for (const uintptr_t* i = begin; i < end; i += sizeof(Value) / sizeof(uintptr_t)) MarkWordConservatively(trc, *i); #else MarkRangeConservatively(trc, begin, end); @@ -369,14 +369,14 @@ ConservativeGCData::recordStackTop() } void -JS::AutoIdArray::trace(JSTracer *trc) +JS::AutoIdArray::trace(JSTracer* trc) { JS_ASSERT(tag_ == IDARRAY); gc::MarkIdRange(trc, idArray->length, idArray->vector, "JSAutoIdArray.idArray"); } inline void -AutoGCRooter::trace(JSTracer *trc) +AutoGCRooter::trace(JSTracer* trc) { switch (tag_) { case PARSER: @@ -384,16 +384,16 @@ AutoGCRooter::trace(JSTracer *trc) return; case IDARRAY: { - JSIdArray *ida = static_cast(this)->idArray; + JSIdArray* ida = static_cast(this)->idArray; MarkIdRange(trc, ida->length, ida->vector, "JS::AutoIdArray.idArray"); return; } case DESCRIPTORS: { - PropDescArray &descriptors = - static_cast(this)->descriptors; + PropDescArray& descriptors = + static_cast(this)->descriptors; for (size_t i = 0, len = descriptors.length(); i < len; i++) { - PropDesc &desc = descriptors[i]; + PropDesc& desc = descriptors[i]; MarkValueRoot(trc, &desc.pd_, "PropDesc::pd_"); MarkValueRoot(trc, &desc.value_, "PropDesc::value_"); MarkValueRoot(trc, &desc.get_, "PropDesc::get_"); @@ -403,48 +403,48 @@ AutoGCRooter::trace(JSTracer *trc) } case ID: - MarkIdRoot(trc, &static_cast(this)->id_, "JS::AutoIdRooter.id_"); + MarkIdRoot(trc, &static_cast(this)->id_, "JS::AutoIdRooter.id_"); return; case VALVECTOR: { - AutoValueVector::VectorImpl &vector = static_cast(this)->vector; + AutoValueVector::VectorImpl& vector = static_cast(this)->vector; MarkValueRootRange(trc, vector.length(), vector.begin(), "js::AutoValueVector.vector"); return; } case IDVECTOR: { - AutoIdVector::VectorImpl &vector = static_cast(this)->vector; + AutoIdVector::VectorImpl& vector = static_cast(this)->vector; MarkIdRootRange(trc, vector.length(), vector.begin(), "js::AutoIdVector.vector"); return; } case SHAPEVECTOR: { - AutoShapeVector::VectorImpl &vector = static_cast(this)->vector; - MarkShapeRootRange(trc, vector.length(), const_cast(vector.begin()), + AutoShapeVector::VectorImpl& vector = static_cast(this)->vector; + MarkShapeRootRange(trc, vector.length(), const_cast(vector.begin()), "js::AutoShapeVector.vector"); return; } case OBJVECTOR: { - AutoObjectVector::VectorImpl &vector = static_cast(this)->vector; + AutoObjectVector::VectorImpl& vector = static_cast(this)->vector; MarkObjectRootRange(trc, vector.length(), vector.begin(), "js::AutoObjectVector.vector"); return; } case FUNVECTOR: { - AutoFunctionVector::VectorImpl &vector = static_cast(this)->vector; + AutoFunctionVector::VectorImpl& vector = static_cast(this)->vector; MarkObjectRootRange(trc, vector.length(), vector.begin(), "js::AutoFunctionVector.vector"); return; } case STRINGVECTOR: { - AutoStringVector::VectorImpl &vector = static_cast(this)->vector; + AutoStringVector::VectorImpl& vector = static_cast(this)->vector; MarkStringRootRange(trc, vector.length(), vector.begin(), "js::AutoStringVector.vector"); return; } case NAMEVECTOR: { - AutoNameVector::VectorImpl &vector = static_cast(this)->vector; + AutoNameVector::VectorImpl& vector = static_cast(this)->vector; MarkStringRootRange(trc, vector.length(), vector.begin(), "js::AutoNameVector.vector"); return; } @@ -454,23 +454,23 @@ AutoGCRooter::trace(JSTracer *trc) * We don't know the template size parameter, but we can safely treat it * as an AutoValueArray<1> because the length is stored separately. */ - AutoValueArray<1> *array = static_cast *>(this); + AutoValueArray<1>* array = static_cast*>(this); MarkValueRootRange(trc, array->length(), array->begin(), "js::AutoValueArray"); return; } case SCRIPTVECTOR: { - AutoScriptVector::VectorImpl &vector = static_cast(this)->vector; + AutoScriptVector::VectorImpl& vector = static_cast(this)->vector; MarkScriptRootRange(trc, vector.length(), vector.begin(), "js::AutoScriptVector.vector"); return; } case OBJOBJHASHMAP: { - AutoObjectObjectHashMap::HashMapImpl &map = static_cast(this)->map; + AutoObjectObjectHashMap::HashMapImpl& map = static_cast(this)->map; for (AutoObjectObjectHashMap::Enum e(map); !e.empty(); e.popFront()) { MarkObjectRoot(trc, &e.front().value(), "AutoObjectObjectHashMap value"); - trc->setTracingLocation((void *)&e.front().key()); - JSObject *key = e.front().key(); + trc->setTracingLocation((void*)&e.front().key()); + JSObject* key = e.front().key(); MarkObjectRoot(trc, &key, "AutoObjectObjectHashMap key"); if (key != e.front().key()) e.rekeyFront(key); @@ -479,10 +479,10 @@ AutoGCRooter::trace(JSTracer *trc) } case OBJU32HASHMAP: { - AutoObjectUnsigned32HashMap *self = static_cast(this); - AutoObjectUnsigned32HashMap::HashMapImpl &map = self->map; + AutoObjectUnsigned32HashMap* self = static_cast(this); + AutoObjectUnsigned32HashMap::HashMapImpl& map = self->map; for (AutoObjectUnsigned32HashMap::Enum e(map); !e.empty(); e.popFront()) { - JSObject *key = e.front().key(); + JSObject* key = e.front().key(); MarkObjectRoot(trc, &key, "AutoObjectUnsignedHashMap key"); if (key != e.front().key()) e.rekeyFront(key); @@ -491,10 +491,10 @@ AutoGCRooter::trace(JSTracer *trc) } case OBJHASHSET: { - AutoObjectHashSet *self = static_cast(this); - AutoObjectHashSet::HashSetImpl &set = self->set; + AutoObjectHashSet* self = static_cast(this); + AutoObjectHashSet::HashSetImpl& set = self->set; for (AutoObjectHashSet::Enum e(set); !e.empty(); e.popFront()) { - JSObject *obj = e.front(); + JSObject* obj = e.front(); MarkObjectRoot(trc, &obj, "AutoObjectHashSet value"); if (obj != e.front()) e.rekeyFront(obj); @@ -503,21 +503,21 @@ AutoGCRooter::trace(JSTracer *trc) } case HASHABLEVALUE: { - AutoHashableValueRooter *rooter = static_cast(this); + AutoHashableValueRooter* rooter = static_cast(this); rooter->trace(trc); return; } case IONMASM: { #ifdef JS_ION - static_cast(this)->masm()->trace(trc); + static_cast(this)->masm()->trace(trc); #endif return; } case IONALLOC: { #ifdef JS_ION - static_cast(this)->trace(trc); + static_cast(this)->trace(trc); #endif return; } @@ -528,51 +528,51 @@ AutoGCRooter::trace(JSTracer *trc) * roots in every slice. This is because of some rule-breaking in * RemapAllWrappersForObject; see comment there. */ - MarkValueUnbarriered(trc, &static_cast(this)->value.get(), + MarkValueUnbarriered(trc, &static_cast(this)->value.get(), "JS::AutoWrapperRooter.value"); return; } case WRAPVECTOR: { - AutoWrapperVector::VectorImpl &vector = static_cast(this)->vector; + AutoWrapperVector::VectorImpl& vector = static_cast(this)->vector; /* * We need to use MarkValueUnbarriered here because we mark wrapper * roots in every slice. This is because of some rule-breaking in * RemapAllWrappersForObject; see comment there. */ - for (WrapperValue *p = vector.begin(); p < vector.end(); p++) + for (WrapperValue* p = vector.begin(); p < vector.end(); p++) MarkValueUnbarriered(trc, &p->get(), "js::AutoWrapperVector.vector"); return; } case JSONPARSER: - static_cast(this)->trace(trc); + static_cast(this)->trace(trc); return; case CUSTOM: - static_cast(this)->trace(trc); + static_cast(this)->trace(trc); return; } JS_ASSERT(tag_ >= 0); - if (Value *vp = static_cast(this)->array) + if (Value* vp = static_cast(this)->array) MarkValueRootRange(trc, tag_, vp, "JS::AutoArrayRooter.array"); } /* static */ void -AutoGCRooter::traceAll(JSTracer *trc) +AutoGCRooter::traceAll(JSTracer* trc) { for (ContextIter cx(trc->runtime()); !cx.done(); cx.next()) { - for (js::AutoGCRooter *gcr = cx->autoGCRooters; gcr; gcr = gcr->down) + for (js::AutoGCRooter* gcr = cx->autoGCRooters; gcr; gcr = gcr->down) gcr->trace(trc); } } /* static */ void -AutoGCRooter::traceAllWrappers(JSTracer *trc) +AutoGCRooter::traceAllWrappers(JSTracer* trc) { for (ContextIter cx(trc->runtime()); !cx.done(); cx.next()) { - for (js::AutoGCRooter *gcr = cx->autoGCRooters; gcr; gcr = gcr->down) { + for (js::AutoGCRooter* gcr = cx->autoGCRooters; gcr; gcr = gcr->down) { if (gcr->tag_ == WRAPVECTOR || gcr->tag_ == WRAPPER) gcr->trace(trc); } @@ -580,13 +580,13 @@ AutoGCRooter::traceAllWrappers(JSTracer *trc) } void -AutoHashableValueRooter::trace(JSTracer *trc) +AutoHashableValueRooter::trace(JSTracer* trc) { MarkValueRoot(trc, reinterpret_cast(&value), "AutoHashableValueRooter"); } void -StackShape::trace(JSTracer *trc) +StackShape::trace(JSTracer* trc) { if (base) MarkBaseShapeRoot(trc, (BaseShape**) &base, "StackShape base"); @@ -594,18 +594,18 @@ StackShape::trace(JSTracer *trc) } void -JSPropertyDescriptor::trace(JSTracer *trc) +JSPropertyDescriptor::trace(JSTracer* trc) { if (obj) MarkObjectRoot(trc, &obj, "Descriptor::obj"); MarkValueRoot(trc, &value, "Descriptor::value"); if ((attrs & JSPROP_GETTER) && getter) { - JSObject *tmp = JS_FUNC_TO_DATA_PTR(JSObject *, getter); + JSObject* tmp = JS_FUNC_TO_DATA_PTR(JSObject*, getter); MarkObjectRoot(trc, &tmp, "Descriptor::get"); getter = JS_DATA_TO_FUNC_PTR(JSPropertyOp, tmp); } if ((attrs & JSPROP_SETTER) && setter) { - JSObject *tmp = JS_FUNC_TO_DATA_PTR(JSObject *, setter); + JSObject* tmp = JS_FUNC_TO_DATA_PTR(JSObject*, setter); MarkObjectRoot(trc, &tmp, "Descriptor::set"); setter = JS_DATA_TO_FUNC_PTR(JSStrictPropertyOp, tmp); } @@ -619,13 +619,13 @@ struct PersistentRootedMarker { typedef PersistentRooted Element; typedef mozilla::LinkedList List; - typedef void (*MarkFunc)(JSTracer *trc, T *ref, const char *name); + typedef void (*MarkFunc)(JSTracer* trc, T* ref, const char* name); template static void - markChainIfNotNull(JSTracer *trc, List &list, const char *name) + markChainIfNotNull(JSTracer* trc, List& list, const char* name) { - for (Element *r = list.getFirst(); r; r = r->getNext()) { + for (Element* r = list.getFirst(); r; r = r->getNext()) { if (r->get()) Mark(trc, r->address(), name); } @@ -633,9 +633,9 @@ struct PersistentRootedMarker template static void - markChain(JSTracer *trc, List &list, const char *name) + markChain(JSTracer* trc, List& list, const char* name) { - for (Element *r = list.getFirst(); r; r = r->getNext()) + for (Element* r = list.getFirst(); r; r = r->getNext()) Mark(trc, r->address(), name); } }; @@ -643,19 +643,19 @@ struct PersistentRootedMarker } void -js::gc::MarkPersistentRootedChains(JSTracer *trc) +js::gc::MarkPersistentRootedChains(JSTracer* trc) { - JSRuntime *rt = trc->runtime(); + JSRuntime* rt = trc->runtime(); // Mark the PersistentRooted chains of types that may be null. PersistentRootedMarker::markChainIfNotNull( - trc, rt->functionPersistentRooteds, "PersistentRooted"); + trc, rt->functionPersistentRooteds, "PersistentRooted"); PersistentRootedMarker::markChainIfNotNull( - trc, rt->objectPersistentRooteds, "PersistentRooted"); + trc, rt->objectPersistentRooteds, "PersistentRooted"); PersistentRootedMarker::markChainIfNotNull( - trc, rt->scriptPersistentRooteds, "PersistentRooted"); + trc, rt->scriptPersistentRooteds, "PersistentRooted"); PersistentRootedMarker::markChainIfNotNull( - trc, rt->stringPersistentRooteds, "PersistentRooted"); + trc, rt->stringPersistentRooteds, "PersistentRooted"); // Mark the PersistentRooted chains of types that are never null. PersistentRootedMarker::markChain(trc, rt->idPersistentRooteds, @@ -665,9 +665,9 @@ js::gc::MarkPersistentRootedChains(JSTracer *trc) } void -js::gc::MarkRuntime(JSTracer *trc, bool useSavedRoots) +js::gc::MarkRuntime(JSTracer* trc, bool useSavedRoots) { - JSRuntime *rt = trc->runtime(); + JSRuntime* rt = trc->runtime(); JS_ASSERT(trc->callback != GCMarker::GrayCallback); JS_ASSERT(!rt->mainThread.suppressGC); @@ -692,19 +692,19 @@ js::gc::MarkRuntime(JSTracer *trc, bool useSavedRoots) } for (RootRange r = rt->gcRootsHash.all(); !r.empty(); r.popFront()) { - const RootEntry &entry = r.front(); - const char *name = entry.value().name ? entry.value().name : "root"; + const RootEntry& entry = r.front(); + const char* name = entry.value().name ? entry.value().name : "root"; JSGCRootType type = entry.value().type; - void *key = entry.key(); + void* key = entry.key(); if (type == JS_GC_ROOT_VALUE_PTR) { - MarkValueRoot(trc, reinterpret_cast(key), name); - } else if (*reinterpret_cast(key)){ + MarkValueRoot(trc, reinterpret_cast(key), name); + } else if (*reinterpret_cast(key)){ if (type == JS_GC_ROOT_STRING_PTR) - MarkStringRoot(trc, reinterpret_cast(key), name); + MarkStringRoot(trc, reinterpret_cast(key), name); else if (type == JS_GC_ROOT_OBJECT_PTR) - MarkObjectRoot(trc, reinterpret_cast(key), name); + MarkObjectRoot(trc, reinterpret_cast(key), name); else if (type == JS_GC_ROOT_SCRIPT_PTR) - MarkScriptRoot(trc, reinterpret_cast(key), name); + MarkScriptRoot(trc, reinterpret_cast(key), name); else MOZ_ASSUME_UNREACHABLE("unexpected js::RootInfo::type value"); } @@ -713,7 +713,7 @@ js::gc::MarkRuntime(JSTracer *trc, bool useSavedRoots) MarkPersistentRootedChains(trc); if (rt->scriptAndCountsVector) { - ScriptAndCountsVector &vec = *rt->scriptAndCountsVector; + ScriptAndCountsVector& vec = *rt->scriptAndCountsVector; for (size_t i = 0; i < vec.length(); i++) MarkScriptRoot(trc, &vec[i].script, "scriptAndCountsVector"); } @@ -738,7 +738,7 @@ js::gc::MarkRuntime(JSTracer *trc, bool useSavedRoots) /* Do not discard scripts with counts while profiling. */ if (rt->profilingScripts && !rt->isHeapMinorCollecting()) { for (CellIterUnderGC i(zone, FINALIZE_SCRIPT); !i.done(); i.next()) { - JSScript *script = i.get(); + JSScript* script = i.get(); if (script->hasScriptCounts()) { MarkScriptRoot(trc, &script, "profilingScripts"); JS_ASSERT(script == i.get()); @@ -789,7 +789,7 @@ js::gc::MarkRuntime(JSTracer *trc, bool useSavedRoots) * time taken to trace all these roots. */ for (size_t i = 0; i < rt->gcBlackRootTracers.length(); i++) { - const JSRuntime::ExtraTracer &e = rt->gcBlackRootTracers[i]; + const JSRuntime::ExtraTracer& e = rt->gcBlackRootTracers[i]; (*e.op)(trc, e.data); } @@ -802,9 +802,9 @@ js::gc::MarkRuntime(JSTracer *trc, bool useSavedRoots) } void -js::gc::BufferGrayRoots(GCMarker *gcmarker) +js::gc::BufferGrayRoots(GCMarker* gcmarker) { - JSRuntime *rt = gcmarker->runtime(); + JSRuntime* rt = gcmarker->runtime(); gcmarker->startBufferingGrayRoots(); if (JSTraceDataOp op = rt->gcGrayRootTracer.op) (*op)(gcmarker, rt->gcGrayRootTracer.data); diff --git a/js/src/gc/Statistics.cpp b/js/src/gc/Statistics.cpp index 12e5b42836..971f0b538f 100644 --- a/js/src/gc/Statistics.cpp +++ b/js/src/gc/Statistics.cpp @@ -59,25 +59,25 @@ class gcstats::StatisticsSerializer } } - void extra(const char *str) { + void extra(const char* str) { if (!asJSON_) { needComma_ = false; p(str); } } - void appendString(const char *name, const char *value) { + void appendString(const char* name, const char* value) { put(name, value, "", true); } - void appendNumber(const char *name, const char *vfmt, const char *units, ...) { + void appendNumber(const char* name, const char* vfmt, const char* units, ...) { va_list va; va_start(va, units); append(name, vfmt, va, units); va_end(va); } - void appendDecimal(const char *name, const char *units, double d) { + void appendDecimal(const char* name, const char* units, double d) { if (d < 0) d = 0; if (asJSON_) @@ -86,12 +86,12 @@ class gcstats::StatisticsSerializer appendNumber(name, "%.1f", units, d); } - void appendIfNonzeroMS(const char *name, double v) { + void appendIfNonzeroMS(const char* name, double v) { if (asJSON_ || v >= 0.1) appendDecimal(name, "ms", v); } - void beginObject(const char *name) { + void beginObject(const char* name) { if (needComma_) pJSON(", "); if (asJSON_ && name) { @@ -108,7 +108,7 @@ class gcstats::StatisticsSerializer needComma_ = true; } - void beginArray(const char *name) { + void beginArray(const char* name) { if (needComma_) pJSON(", "); if (asJSON_) @@ -123,13 +123,13 @@ class gcstats::StatisticsSerializer needComma_ = true; } - jschar *finishJSString() { - char *buf = finishCString(); + jschar* finishJSString() { + char* buf = finishCString(); if (!buf) return nullptr; size_t nchars = strlen(buf); - jschar *out = js_pod_malloc(nchars + 1); + jschar* out = js_pod_malloc(nchars + 1); if (!out) { oom_ = true; js_free(buf); @@ -143,13 +143,13 @@ class gcstats::StatisticsSerializer return out; } - char *finishCString() { + char* finishCString() { if (oom_) return nullptr; buf_.append('\0'); - char *buf = buf_.extractRawBuffer(); + char* buf = buf_.extractRawBuffer(); if (!buf) oom_ = true; @@ -157,15 +157,15 @@ class gcstats::StatisticsSerializer } private: - void append(const char *name, const char *vfmt, - va_list va, const char *units) + void append(const char* name, const char* vfmt, + va_list va, const char* units) { char val[MaxFieldValueLength]; JS_vsnprintf(val, MaxFieldValueLength, vfmt, va); put(name, val, units, false); } - void p(const char *cstr) { + void p(const char* cstr) { if (oom_) return; @@ -181,12 +181,12 @@ class gcstats::StatisticsSerializer oom_ = true; } - void pJSON(const char *str) { + void pJSON(const char* str) { if (asJSON_) p(str); } - void put(const char *name, const char *val, const char *units, bool valueIsQuoted) { + void put(const char* name, const char* val, const char* units, bool valueIsQuoted) { if (needComma_) p(", "); needComma_ = true; @@ -201,20 +201,20 @@ class gcstats::StatisticsSerializer p(units); } - void putQuoted(const char *str) { + void putQuoted(const char* str) { pJSON("\""); p(str); pJSON("\""); } - void putKey(const char *str) { + void putKey(const char* str) { if (!asJSON_) { p(str); return; } p("\""); - const char *c = str; + const char* c = str; while (*c) { if (*c == ' ' || *c == '\t') p('_'); @@ -239,7 +239,7 @@ class gcstats::StatisticsSerializer */ JS_STATIC_ASSERT(JS::gcreason::NUM_TELEMETRY_REASONS >= JS::gcreason::NUM_REASONS); -const char * +const char* js::gcstats::ExplainReason(JS::gcreason::Reason reason) { switch (reason) { @@ -263,7 +263,7 @@ t(int64_t t) struct PhaseInfo { Phase index; - const char *name; + const char* name; Phase parent; }; @@ -312,7 +312,7 @@ static const PhaseInfo phases[] = { }; static void -FormatPhaseTimes(StatisticsSerializer &ss, const char *name, int64_t *times) +FormatPhaseTimes(StatisticsSerializer& ss, const char* name, int64_t* times) { ss.beginObject(name); for (unsigned i = 0; phases[i].name; i++) @@ -321,10 +321,10 @@ FormatPhaseTimes(StatisticsSerializer &ss, const char *name, int64_t *times) } void -Statistics::gcDuration(int64_t *total, int64_t *maxPause) +Statistics::gcDuration(int64_t* total, int64_t* maxPause) { *total = *maxPause = 0; - for (SliceData *slice = slices.begin(); slice != slices.end(); slice++) { + for (SliceData* slice = slices.begin(); slice != slices.end(); slice++) { *total += slice->duration(); if (slice->duration() > *maxPause) *maxPause = slice->duration(); @@ -332,7 +332,7 @@ Statistics::gcDuration(int64_t *total, int64_t *maxPause) } void -Statistics::sccDurations(int64_t *total, int64_t *maxPause) +Statistics::sccDurations(int64_t* total, int64_t* maxPause) { *total = *maxPause = 0; for (size_t i = 0; i < sccTimes.length(); i++) { @@ -342,7 +342,7 @@ Statistics::sccDurations(int64_t *total, int64_t *maxPause) } bool -Statistics::formatData(StatisticsSerializer &ss, uint64_t timestamp) +Statistics::formatData(StatisticsSerializer& ss, uint64_t timestamp) { int64_t total, longest; gcDuration(&total, &longest); @@ -418,7 +418,7 @@ Statistics::formatData(StatisticsSerializer &ss, uint64_t timestamp) return !ss.isOOM(); } -jschar * +jschar* Statistics::formatMessage() { StatisticsSerializer ss(StatisticsSerializer::AsText); @@ -426,7 +426,7 @@ Statistics::formatMessage() return ss.finishJSString(); } -jschar * +jschar* Statistics::formatJSON(uint64_t timestamp) { StatisticsSerializer ss(StatisticsSerializer::AsJSON); @@ -434,7 +434,7 @@ Statistics::formatJSON(uint64_t timestamp) return ss.finishJSString(); } -Statistics::Statistics(JSRuntime *rt) +Statistics::Statistics(JSRuntime* rt) : runtime(rt), startupTime(PRMJ_Now()), fp(nullptr), @@ -450,7 +450,7 @@ Statistics::Statistics(JSRuntime *rt) PodArrayZero(phaseTotals); PodArrayZero(counts); - char *env = getenv("MOZ_GCTIMER"); + char* env = getenv("MOZ_GCTIMER"); if (!env || strcmp(env, "none") == 0) { fp = nullptr; return; @@ -476,7 +476,7 @@ Statistics::~Statistics() if (fullFormat) { StatisticsSerializer ss(StatisticsSerializer::AsText); FormatPhaseTimes(ss, "", phaseTotals); - char *msg = ss.finishCString(); + char* msg = ss.finishCString(); if (msg) { fprintf(fp, "TOTALS\n%s\n\n-------\n", msg); js_free(msg); @@ -494,7 +494,7 @@ Statistics::printStats() if (fullFormat) { StatisticsSerializer ss(StatisticsSerializer::AsText); formatData(ss, 0); - char *msg = ss.finishCString(); + char* msg = ss.finishCString(); if (msg) { fprintf(fp, "GC(T+%.3fs) %s\n", t(slices[0].start - startupTime) / 1000.0, msg); js_free(msg); diff --git a/js/src/gc/Statistics.h b/js/src/gc/Statistics.h index 6f3194c3f0..d438ef8ed0 100644 --- a/js/src/gc/Statistics.h +++ b/js/src/gc/Statistics.h @@ -75,7 +75,7 @@ enum Stat { class StatisticsSerializer; struct Statistics { - Statistics(JSRuntime *rt); + Statistics(JSRuntime* rt); ~Statistics(); void beginPhase(Phase phase); @@ -84,8 +84,8 @@ struct Statistics { void beginSlice(int collectedCount, int zoneCount, int compartmentCount, JS::gcreason::Reason reason); void endSlice(); - void reset(const char *reason) { slices.back().resetReason = reason; } - void nonincremental(const char *reason) { nonincrementalReason = reason; } + void reset(const char* reason) { slices.back().resetReason = reason; } + void nonincremental(const char* reason) { nonincrementalReason = reason; } void count(Stat s) { JS_ASSERT(s < STAT_LIMIT); @@ -95,15 +95,15 @@ struct Statistics { int64_t beginSCC(); void endSCC(unsigned scc, int64_t start); - jschar *formatMessage(); - jschar *formatJSON(uint64_t timestamp); + jschar* formatMessage(); + jschar* formatJSON(uint64_t timestamp); private: - JSRuntime *runtime; + JSRuntime* runtime; int64_t startupTime; - FILE *fp; + FILE* fp; bool fullFormat; /* @@ -115,7 +115,7 @@ struct Statistics { int collectedCount; int zoneCount; int compartmentCount; - const char *nonincrementalReason; + const char* nonincrementalReason; struct SliceData { SliceData(JS::gcreason::Reason reason, int64_t start, size_t startFaults) @@ -125,7 +125,7 @@ struct Statistics { } JS::gcreason::Reason reason; - const char *resetReason; + const char* resetReason; int64_t start, end; size_t startFaults, endFaults; int64_t phaseTimes[PHASE_LIMIT]; @@ -163,17 +163,17 @@ struct Statistics { void beginGC(); void endGC(); - void gcDuration(int64_t *total, int64_t *maxPause); - void sccDurations(int64_t *total, int64_t *maxPause); + void gcDuration(int64_t* total, int64_t* maxPause); + void sccDurations(int64_t* total, int64_t* maxPause); void printStats(); - bool formatData(StatisticsSerializer &ss, uint64_t timestamp); + bool formatData(StatisticsSerializer& ss, uint64_t timestamp); double computeMMU(int64_t resolution); }; struct AutoGCSlice { - AutoGCSlice(Statistics &stats, int collectedCount, int zoneCount, int compartmentCount, + AutoGCSlice(Statistics& stats, int collectedCount, int zoneCount, int compartmentCount, JS::gcreason::Reason reason MOZ_GUARD_OBJECT_NOTIFIER_PARAM) : stats(stats) @@ -183,13 +183,13 @@ struct AutoGCSlice } ~AutoGCSlice() { stats.endSlice(); } - Statistics &stats; + Statistics& stats; MOZ_DECL_USE_GUARD_OBJECT_NOTIFIER }; struct AutoPhase { - AutoPhase(Statistics &stats, Phase phase + AutoPhase(Statistics& stats, Phase phase MOZ_GUARD_OBJECT_NOTIFIER_PARAM) : stats(stats), phase(phase) { @@ -200,7 +200,7 @@ struct AutoPhase stats.endPhase(phase); } - Statistics &stats; + Statistics& stats; Phase phase; MOZ_DECL_USE_GUARD_OBJECT_NOTIFIER }; @@ -212,7 +212,7 @@ struct MaybeAutoPhase { MOZ_GUARD_OBJECT_NOTIFIER_INIT; } - void construct(Statistics &statsArg, Phase phaseArg) + void construct(Statistics& statsArg, Phase phaseArg) { JS_ASSERT(!stats); stats = &statsArg; @@ -224,14 +224,14 @@ struct MaybeAutoPhase stats->endPhase(phase); } - Statistics *stats; + Statistics* stats; Phase phase; MOZ_DECL_USE_GUARD_OBJECT_NOTIFIER }; struct AutoSCC { - AutoSCC(Statistics &stats, unsigned scc + AutoSCC(Statistics& stats, unsigned scc MOZ_GUARD_OBJECT_NOTIFIER_PARAM) : stats(stats), scc(scc) { @@ -242,13 +242,13 @@ struct AutoSCC stats.endSCC(scc, start); } - Statistics &stats; + Statistics& stats; unsigned scc; int64_t start; MOZ_DECL_USE_GUARD_OBJECT_NOTIFIER }; -const char *ExplainReason(JS::gcreason::Reason reason); +const char* ExplainReason(JS::gcreason::Reason reason); } /* namespace gcstats */ } /* namespace js */ diff --git a/js/src/gc/StoreBuffer.cpp b/js/src/gc/StoreBuffer.cpp index b3a8f996de..eb7def3c51 100644 --- a/js/src/gc/StoreBuffer.cpp +++ b/js/src/gc/StoreBuffer.cpp @@ -22,15 +22,15 @@ using mozilla::ReentrancyGuard; /*** Edges ***/ void -StoreBuffer::SlotsEdge::mark(JSTracer *trc) +StoreBuffer::SlotsEdge::mark(JSTracer* trc) { - JSObject *obj = object(); + JSObject* obj = object(); if (trc->runtime()->gcNursery.isInside(obj)) return; if (!obj->isNative()) { - const Class *clasp = obj->getClass(); + const Class* clasp = obj->getClass(); if (clasp) clasp->trace(trc, obj); return; @@ -51,12 +51,12 @@ StoreBuffer::SlotsEdge::mark(JSTracer *trc) } void -StoreBuffer::WholeCellEdges::mark(JSTracer *trc) +StoreBuffer::WholeCellEdges::mark(JSTracer* trc) { JS_ASSERT(edge->isTenured()); JSGCTraceKind kind = GetGCThingTraceKind(edge); if (kind <= JSTRACE_OBJECT) { - JSObject *object = static_cast(edge); + JSObject* object = static_cast(edge); if (object->is()) ArgumentsObject::trace(trc, object); MarkChildren(trc, object); @@ -64,14 +64,14 @@ StoreBuffer::WholeCellEdges::mark(JSTracer *trc) } #ifdef JS_ION JS_ASSERT(kind == JSTRACE_JITCODE); - static_cast(edge)->trace(trc); + static_cast(edge)->trace(trc); #else MOZ_ASSUME_UNREACHABLE("Only objects can be in the wholeCellBuffer if IonMonkey is disabled."); #endif } void -StoreBuffer::CellPtrEdge::mark(JSTracer *trc) +StoreBuffer::CellPtrEdge::mark(JSTracer* trc) { if (!*edge) return; @@ -81,7 +81,7 @@ StoreBuffer::CellPtrEdge::mark(JSTracer *trc) } void -StoreBuffer::ValueEdge::mark(JSTracer *trc) +StoreBuffer::ValueEdge::mark(JSTracer* trc) { if (!deref()) return; @@ -93,7 +93,7 @@ StoreBuffer::ValueEdge::mark(JSTracer *trc) template void -StoreBuffer::MonoTypeBuffer::handleOverflow(StoreBuffer *owner) +StoreBuffer::MonoTypeBuffer::handleOverflow(StoreBuffer* owner) { if (!owner->isAboutToOverflow()) { /* @@ -115,7 +115,7 @@ StoreBuffer::MonoTypeBuffer::handleOverflow(StoreBuffer *owner) template void -StoreBuffer::MonoTypeBuffer::compactRemoveDuplicates(StoreBuffer *owner) +StoreBuffer::MonoTypeBuffer::compactRemoveDuplicates(StoreBuffer* owner) { typedef HashSet DedupSet; @@ -125,7 +125,7 @@ StoreBuffer::MonoTypeBuffer::compactRemoveDuplicates(StoreBuffer *owner) LifoAlloc::Enum insert(*storage_); for (LifoAlloc::Enum e(*storage_); !e.empty(); e.popFront()) { - T *edge = e.get(); + T* edge = e.get(); if (!duplicates.has(*edge)) { insert.updateFront(*edge); insert.popFront(); @@ -141,7 +141,7 @@ StoreBuffer::MonoTypeBuffer::compactRemoveDuplicates(StoreBuffer *owner) template void -StoreBuffer::MonoTypeBuffer::compact(StoreBuffer *owner) +StoreBuffer::MonoTypeBuffer::compact(StoreBuffer* owner) { JS_ASSERT(storage_); compactRemoveDuplicates(owner); @@ -150,7 +150,7 @@ StoreBuffer::MonoTypeBuffer::compact(StoreBuffer *owner) template void -StoreBuffer::MonoTypeBuffer::maybeCompact(StoreBuffer *owner) +StoreBuffer::MonoTypeBuffer::maybeCompact(StoreBuffer* owner) { JS_ASSERT(storage_); if (storage_->used() != usedAtLastCompact_) @@ -159,7 +159,7 @@ StoreBuffer::MonoTypeBuffer::maybeCompact(StoreBuffer *owner) template void -StoreBuffer::MonoTypeBuffer::mark(StoreBuffer *owner, JSTracer *trc) +StoreBuffer::MonoTypeBuffer::mark(StoreBuffer* owner, JSTracer* trc) { JS_ASSERT(owner->isEnabled()); ReentrancyGuard g(*owner); @@ -168,7 +168,7 @@ StoreBuffer::MonoTypeBuffer::mark(StoreBuffer *owner, JSTracer *trc) maybeCompact(owner); for (LifoAlloc::Enum e(*storage_); !e.empty(); e.popFront()) { - T *edge = e.get(); + T* edge = e.get(); edge->mark(trc); } } @@ -177,16 +177,16 @@ StoreBuffer::MonoTypeBuffer::mark(StoreBuffer *owner, JSTracer *trc) template void -StoreBuffer::RelocatableMonoTypeBuffer::compactMoved(StoreBuffer *owner) +StoreBuffer::RelocatableMonoTypeBuffer::compactMoved(StoreBuffer* owner) { - LifoAlloc &storage = *this->storage_; + LifoAlloc& storage = *this->storage_; EdgeSet invalidated; if (!invalidated.init()) CrashAtUnhandlableOOM("RelocatableMonoTypeBuffer::compactMoved: Failed to init table."); /* Collect the set of entries which are currently invalid. */ for (LifoAlloc::Enum e(storage); !e.empty(); e.popFront()) { - T *edge = e.get(); + T* edge = e.get(); if (edge->isTagged()) { if (!invalidated.put(edge->untagged().edge)) CrashAtUnhandlableOOM("RelocatableMonoTypeBuffer::compactMoved: Failed to put removal."); @@ -198,7 +198,7 @@ StoreBuffer::RelocatableMonoTypeBuffer::compactMoved(StoreBuffer *owner) /* Remove all entries which are in the invalidated set. */ LifoAlloc::Enum insert(storage); for (LifoAlloc::Enum e(storage); !e.empty(); e.popFront()) { - T *edge = e.get(); + T* edge = e.get(); if (!edge->isTagged() && !invalidated.has(edge->untagged().edge)) { insert.updateFront(*edge); insert.popFront(); @@ -216,7 +216,7 @@ StoreBuffer::RelocatableMonoTypeBuffer::compactMoved(StoreBuffer *owner) template void -StoreBuffer::RelocatableMonoTypeBuffer::compact(StoreBuffer *owner) +StoreBuffer::RelocatableMonoTypeBuffer::compact(StoreBuffer* owner) { compactMoved(owner); StoreBuffer::MonoTypeBuffer::compact(owner); @@ -225,7 +225,7 @@ StoreBuffer::RelocatableMonoTypeBuffer::compact(StoreBuffer *owner) /*** GenericBuffer ***/ void -StoreBuffer::GenericBuffer::mark(StoreBuffer *owner, JSTracer *trc) +StoreBuffer::GenericBuffer::mark(StoreBuffer* owner, JSTracer* trc) { JS_ASSERT(owner->isEnabled()); ReentrancyGuard g(*owner); @@ -235,7 +235,7 @@ StoreBuffer::GenericBuffer::mark(StoreBuffer *owner, JSTracer *trc) for (LifoAlloc::Enum e(*storage_); !e.empty();) { unsigned size = *e.get(); e.popFront(); - BufferableRef *edge = e.get(size); + BufferableRef* edge = e.get(size); edge->mark(trc); e.popFront(size); } @@ -295,7 +295,7 @@ StoreBuffer::clear() } void -StoreBuffer::markAll(JSTracer *trc) +StoreBuffer::markAll(JSTracer* trc) { bufferVal.mark(this, trc); bufferCell.mark(this, trc); @@ -333,40 +333,40 @@ StoreBuffer::addSizeOfExcludingThis(mozilla::MallocSizeOf mallocSizeOf, JS::GCSi } JS_PUBLIC_API(void) -JS::HeapCellPostBarrier(js::gc::Cell **cellp) +JS::HeapCellPostBarrier(js::gc::Cell** cellp) { JS_ASSERT(*cellp); - JSRuntime *runtime = (*cellp)->runtimeFromMainThread(); + JSRuntime* runtime = (*cellp)->runtimeFromMainThread(); runtime->gcStoreBuffer.putRelocatableCell(cellp); } JS_PUBLIC_API(void) -JS::HeapCellRelocate(js::gc::Cell **cellp) +JS::HeapCellRelocate(js::gc::Cell** cellp) { /* Called with old contents of *pp before overwriting. */ JS_ASSERT(*cellp); - JSRuntime *runtime = (*cellp)->runtimeFromMainThread(); + JSRuntime* runtime = (*cellp)->runtimeFromMainThread(); runtime->gcStoreBuffer.removeRelocatableCell(cellp); } JS_PUBLIC_API(void) -JS::HeapValuePostBarrier(JS::Value *valuep) +JS::HeapValuePostBarrier(JS::Value* valuep) { JS_ASSERT(valuep->isMarkable()); if (valuep->isString() && StringIsPermanentAtom(valuep->toString())) return; - JSRuntime *runtime = static_cast(valuep->toGCThing())->runtimeFromMainThread(); + JSRuntime* runtime = static_cast(valuep->toGCThing())->runtimeFromMainThread(); runtime->gcStoreBuffer.putRelocatableValue(valuep); } JS_PUBLIC_API(void) -JS::HeapValueRelocate(JS::Value *valuep) +JS::HeapValueRelocate(JS::Value* valuep) { /* Called with old contents of *valuep before overwriting. */ JS_ASSERT(valuep->isMarkable()); if (valuep->isString() && StringIsPermanentAtom(valuep->toString())) return; - JSRuntime *runtime = static_cast(valuep->toGCThing())->runtimeFromMainThread(); + JSRuntime* runtime = static_cast(valuep->toGCThing())->runtimeFromMainThread(); runtime->gcStoreBuffer.removeRelocatableValue(valuep); } diff --git a/js/src/gc/StoreBuffer.h b/js/src/gc/StoreBuffer.h index bb5cc18808..c156928017 100644 --- a/js/src/gc/StoreBuffer.h +++ b/js/src/gc/StoreBuffer.h @@ -26,7 +26,7 @@ namespace js { void -CrashAtUnhandlableOOM(const char *reason); +CrashAtUnhandlableOOM(const char* reason); namespace gc { @@ -39,8 +39,8 @@ namespace gc { class BufferableRef { public: - virtual void mark(JSTracer *trc) = 0; - bool maybeInRememberedSet(const Nursery &) const { return true; } + virtual void mark(JSTracer* trc) = 0; + bool maybeInRememberedSet(const Nursery&) const { return true; } }; /* @@ -50,13 +50,13 @@ class BufferableRef template class HashKeyRef : public BufferableRef { - Map *map; + Map* map; Key key; public: - HashKeyRef(Map *m, const Key &k) : map(m), key(k) {} + HashKeyRef(Map* m, const Key& k) : map(m), key(k) {} - void mark(JSTracer *trc) { + void mark(JSTracer* trc) { Key prior = key; typename Map::Ptr p = map->lookup(key); if (!p) @@ -67,7 +67,7 @@ class HashKeyRef : public BufferableRef } }; -typedef HashSet, SystemAllocPolicy> EdgeSet; +typedef HashSet, SystemAllocPolicy> EdgeSet; /* The size of a single block of store buffer storage space. */ static const size_t LifoAllocBlockSize = 1 << 16; /* 64KiB */ @@ -91,7 +91,7 @@ class StoreBuffer template struct MonoTypeBuffer { - LifoAlloc *storage_; + LifoAlloc* storage_; size_t usedAtLastCompact_; explicit MonoTypeBuffer() : storage_(nullptr), usedAtLastCompact_(0) {} @@ -116,25 +116,25 @@ class StoreBuffer return !storage_->isEmpty() && storage_->availableInCurrentChunk() < MinAvailableSize; } - void handleOverflow(StoreBuffer *owner); + void handleOverflow(StoreBuffer* owner); /* Compaction algorithms. */ - void compactRemoveDuplicates(StoreBuffer *owner); + void compactRemoveDuplicates(StoreBuffer* owner); /* * Attempts to reduce the usage of the buffer by removing unnecessary * entries. */ - virtual void compact(StoreBuffer *owner); + virtual void compact(StoreBuffer* owner); /* Compacts if any entries have been added since the last compaction. */ - void maybeCompact(StoreBuffer *owner); + void maybeCompact(StoreBuffer* owner); /* Add one item to the buffer. */ - void put(StoreBuffer *owner, const T &t) { + void put(StoreBuffer* owner, const T& t) { JS_ASSERT(storage_); - T *tp = storage_->new_(t); + T* tp = storage_->new_(t); if (!tp) CrashAtUnhandlableOOM("Failed to allocate for MonoTypeBuffer::put."); @@ -143,14 +143,14 @@ class StoreBuffer } /* Mark the source of all edges in the store buffer. */ - void mark(StoreBuffer *owner, JSTracer *trc); + void mark(StoreBuffer* owner, JSTracer* trc); size_t sizeOfExcludingThis(mozilla::MallocSizeOf mallocSizeOf) { return storage_ ? storage_->sizeOfIncludingThis(mallocSizeOf) : 0; } private: - MonoTypeBuffer &operator=(const MonoTypeBuffer& other) MOZ_DELETE; + MonoTypeBuffer& operator=(const MonoTypeBuffer& other) MOZ_DELETE; }; /* @@ -161,18 +161,18 @@ class StoreBuffer struct RelocatableMonoTypeBuffer : public MonoTypeBuffer { /* Override compaction to filter out removed items. */ - void compactMoved(StoreBuffer *owner); - virtual void compact(StoreBuffer *owner) MOZ_OVERRIDE; + void compactMoved(StoreBuffer* owner); + virtual void compact(StoreBuffer* owner) MOZ_OVERRIDE; /* Record a removal from the buffer. */ - void unput(StoreBuffer *owner, const T &v) { + void unput(StoreBuffer* owner, const T& v) { MonoTypeBuffer::put(owner, v.tagged()); } }; struct GenericBuffer { - LifoAlloc *storage_; + LifoAlloc* storage_; explicit GenericBuffer() : storage_(nullptr) {} ~GenericBuffer() { js_delete(storage_); } @@ -196,22 +196,22 @@ class StoreBuffer } /* Mark all generic edges. */ - void mark(StoreBuffer *owner, JSTracer *trc); + void mark(StoreBuffer* owner, JSTracer* trc); template - void put(StoreBuffer *owner, const T &t) { + void put(StoreBuffer* owner, const T& t) { JS_ASSERT(storage_); /* Ensure T is derived from BufferableRef. */ (void)static_cast(&t); unsigned size = sizeof(T); - unsigned *sizep = storage_->newPod(); + unsigned* sizep = storage_->newPod(); if (!sizep) CrashAtUnhandlableOOM("Failed to allocate for GenericBuffer::put."); *sizep = size; - T *tp = storage_->new_(t); + T* tp = storage_->new_(t); if (!tp) CrashAtUnhandlableOOM("Failed to allocate for GenericBuffer::put."); @@ -224,33 +224,33 @@ class StoreBuffer } private: - GenericBuffer &operator=(const GenericBuffer& other) MOZ_DELETE; + GenericBuffer& operator=(const GenericBuffer& other) MOZ_DELETE; }; template struct PointerEdgeHasher { typedef Edge Lookup; - static HashNumber hash(const Lookup &l) { return uintptr_t(l.edge) >> 3; } - static bool match(const Edge &k, const Lookup &l) { return k == l; } + static HashNumber hash(const Lookup& l) { return uintptr_t(l.edge) >> 3; } + static bool match(const Edge& k, const Lookup& l) { return k == l; } }; struct CellPtrEdge { - Cell **edge; + Cell** edge; - explicit CellPtrEdge(Cell **v) : edge(v) {} - bool operator==(const CellPtrEdge &other) const { return edge == other.edge; } - bool operator!=(const CellPtrEdge &other) const { return edge != other.edge; } + explicit CellPtrEdge(Cell** v) : edge(v) {} + bool operator==(const CellPtrEdge& other) const { return edge == other.edge; } + bool operator!=(const CellPtrEdge& other) const { return edge != other.edge; } - bool maybeInRememberedSet(const Nursery &nursery) const { + bool maybeInRememberedSet(const Nursery& nursery) const { return !nursery.isInside(edge) && nursery.isInside(*edge); } - void mark(JSTracer *trc); + void mark(JSTracer* trc); - CellPtrEdge tagged() const { return CellPtrEdge((Cell **)(uintptr_t(edge) | 1)); } - CellPtrEdge untagged() const { return CellPtrEdge((Cell **)(uintptr_t(edge) & ~1)); } + CellPtrEdge tagged() const { return CellPtrEdge((Cell**)(uintptr_t(edge) | 1)); } + CellPtrEdge untagged() const { return CellPtrEdge((Cell**)(uintptr_t(edge) & ~1)); } bool isTagged() const { return bool(uintptr_t(edge) & 1); } typedef PointerEdgeHasher Hasher; @@ -258,22 +258,22 @@ class StoreBuffer struct ValueEdge { - JS::Value *edge; + JS::Value* edge; - explicit ValueEdge(JS::Value *v) : edge(v) {} - bool operator==(const ValueEdge &other) const { return edge == other.edge; } - bool operator!=(const ValueEdge &other) const { return edge != other.edge; } + explicit ValueEdge(JS::Value* v) : edge(v) {} + bool operator==(const ValueEdge& other) const { return edge == other.edge; } + bool operator!=(const ValueEdge& other) const { return edge != other.edge; } - void *deref() const { return edge->isGCThing() ? edge->toGCThing() : nullptr; } + void* deref() const { return edge->isGCThing() ? edge->toGCThing() : nullptr; } - bool maybeInRememberedSet(const Nursery &nursery) const { + bool maybeInRememberedSet(const Nursery& nursery) const { return !nursery.isInside(edge) && nursery.isInside(deref()); } - void mark(JSTracer *trc); + void mark(JSTracer* trc); - ValueEdge tagged() const { return ValueEdge((JS::Value *)(uintptr_t(edge) | 1)); } - ValueEdge untagged() const { return ValueEdge((JS::Value *)(uintptr_t(edge) & ~1)); } + ValueEdge tagged() const { return ValueEdge((JS::Value*)(uintptr_t(edge) | 1)); } + ValueEdge untagged() const { return ValueEdge((JS::Value*)(uintptr_t(edge) & ~1)); } bool isTagged() const { return bool(uintptr_t(edge) & 1); } typedef PointerEdgeHasher Hasher; @@ -289,7 +289,7 @@ class StoreBuffer int32_t start_; int32_t count_; - SlotsEdge(JSObject *object, int kind, int32_t start, int32_t count) + SlotsEdge(JSObject* object, int kind, int32_t start, int32_t count) : objectAndKind_(uintptr_t(object) | kind), start_(start), count_(count) { JS_ASSERT((uintptr_t(object) & 1) == 0); @@ -298,49 +298,49 @@ class StoreBuffer JS_ASSERT(count > 0); } - JSObject *object() const { return reinterpret_cast(objectAndKind_ & ~1); } + JSObject* object() const { return reinterpret_cast(objectAndKind_ & ~1); } int kind() const { return (int)(objectAndKind_ & 1); } - bool operator==(const SlotsEdge &other) const { + bool operator==(const SlotsEdge& other) const { return objectAndKind_ == other.objectAndKind_ && start_ == other.start_ && count_ == other.count_; } - bool operator!=(const SlotsEdge &other) const { + bool operator!=(const SlotsEdge& other) const { return !(*this == other); } - bool maybeInRememberedSet(const Nursery &nursery) const { + bool maybeInRememberedSet(const Nursery& nursery) const { return !nursery.isInside(object()); } - void mark(JSTracer *trc); + void mark(JSTracer* trc); typedef struct { typedef SlotsEdge Lookup; - static HashNumber hash(const Lookup &l) { return l.objectAndKind_ ^ l.start_ ^ l.count_; } - static bool match(const SlotsEdge &k, const Lookup &l) { return k == l; } + static HashNumber hash(const Lookup& l) { return l.objectAndKind_ ^ l.start_ ^ l.count_; } + static bool match(const SlotsEdge& k, const Lookup& l) { return k == l; } } Hasher; }; struct WholeCellEdges { - Cell *edge; + Cell* edge; - explicit WholeCellEdges(Cell *cell) : edge(cell) { + explicit WholeCellEdges(Cell* cell) : edge(cell) { JS_ASSERT(edge->isTenured()); } - bool operator==(const WholeCellEdges &other) const { return edge == other.edge; } - bool operator!=(const WholeCellEdges &other) const { return edge != other.edge; } + bool operator==(const WholeCellEdges& other) const { return edge == other.edge; } + bool operator!=(const WholeCellEdges& other) const { return edge != other.edge; } - bool maybeInRememberedSet(const Nursery &nursery) const { return true; } + bool maybeInRememberedSet(const Nursery& nursery) const { return true; } static bool supportsDeduplication() { return true; } - void *deduplicationKey() const { return (void *)edge; } + void* deduplicationKey() const { return (void*)edge; } - void mark(JSTracer *trc); + void mark(JSTracer* trc); typedef PointerEdgeHasher Hasher; }; @@ -348,22 +348,22 @@ class StoreBuffer template struct CallbackRef : public BufferableRef { - typedef void (*MarkCallback)(JSTracer *trc, Key *key, void *data); + typedef void (*MarkCallback)(JSTracer* trc, Key* key, void* data); - CallbackRef(MarkCallback cb, Key *k, void *d) : callback(cb), key(k), data(d) {} + CallbackRef(MarkCallback cb, Key* k, void* d) : callback(cb), key(k), data(d) {} - virtual void mark(JSTracer *trc) { + virtual void mark(JSTracer* trc) { callback(trc, key, data); } private: MarkCallback callback; - Key *key; - void *data; + Key* key; + void* data; }; template - bool isOkayToUseBuffer(const Edge &edge) const { + bool isOkayToUseBuffer(const Edge& edge) const { /* * Disabled store buffers may not have a valid state; e.g. when stored * inline in the ChunkTrailer. @@ -382,7 +382,7 @@ class StoreBuffer } template - void put(Buffer &buffer, const Edge &edge) { + void put(Buffer& buffer, const Edge& edge) { if (!isOkayToUseBuffer(edge)) return; mozilla::ReentrancyGuard g(*this); @@ -391,7 +391,7 @@ class StoreBuffer } template - void unput(Buffer &buffer, const Edge &edge) { + void unput(Buffer& buffer, const Edge& edge) { if (!isOkayToUseBuffer(edge)) return; mozilla::ReentrancyGuard g(*this); @@ -406,15 +406,15 @@ class StoreBuffer RelocatableMonoTypeBuffer bufferRelocCell; GenericBuffer bufferGeneric; - JSRuntime *runtime_; - const Nursery &nursery_; + JSRuntime* runtime_; + const Nursery& nursery_; bool aboutToOverflow_; bool enabled_; mozilla::DebugOnly entered; /* For ReentrancyGuard. */ public: - explicit StoreBuffer(JSRuntime *rt, const Nursery &nursery) + explicit StoreBuffer(JSRuntime* rt, const Nursery& nursery) : bufferVal(), bufferCell(), bufferSlot(), bufferWholeCell(), bufferRelocVal(), bufferRelocCell(), bufferGeneric(), runtime_(rt), nursery_(nursery), aboutToOverflow_(false), enabled_(false), @@ -432,41 +432,41 @@ class StoreBuffer bool isAboutToOverflow() const { return aboutToOverflow_; } /* Insert a single edge into the buffer/remembered set. */ - void putValue(JS::Value *valuep) { put(bufferVal, ValueEdge(valuep)); } - void putCell(Cell **cellp) { put(bufferCell, CellPtrEdge(cellp)); } - void putSlot(JSObject *obj, int kind, int32_t start, int32_t count) { + void putValue(JS::Value* valuep) { put(bufferVal, ValueEdge(valuep)); } + void putCell(Cell** cellp) { put(bufferCell, CellPtrEdge(cellp)); } + void putSlot(JSObject* obj, int kind, int32_t start, int32_t count) { put(bufferSlot, SlotsEdge(obj, kind, start, count)); } - void putWholeCell(Cell *cell) { + void putWholeCell(Cell* cell) { JS_ASSERT(cell->isTenured()); put(bufferWholeCell, WholeCellEdges(cell)); } /* Insert or update a single edge in the Relocatable buffer. */ - void putRelocatableValue(JS::Value *valuep) { put(bufferRelocVal, ValueEdge(valuep)); } - void putRelocatableCell(Cell **cellp) { put(bufferRelocCell, CellPtrEdge(cellp)); } - void removeRelocatableValue(JS::Value *valuep) { unput(bufferRelocVal, ValueEdge(valuep)); } - void removeRelocatableCell(Cell **cellp) { unput(bufferRelocCell, CellPtrEdge(cellp)); } + void putRelocatableValue(JS::Value* valuep) { put(bufferRelocVal, ValueEdge(valuep)); } + void putRelocatableCell(Cell** cellp) { put(bufferRelocCell, CellPtrEdge(cellp)); } + void removeRelocatableValue(JS::Value* valuep) { unput(bufferRelocVal, ValueEdge(valuep)); } + void removeRelocatableCell(Cell** cellp) { unput(bufferRelocCell, CellPtrEdge(cellp)); } /* Insert an entry into the generic buffer. */ template - void putGeneric(const T &t) { put(bufferGeneric, t);} + void putGeneric(const T& t) { put(bufferGeneric, t);} /* Insert or update a callback entry. */ template - void putCallback(void (*callback)(JSTracer *trc, Key *key, void *data), Key *key, void *data) { + void putCallback(void (*callback)(JSTracer* trc, Key* key, void* data), Key* key, void* data) { put(bufferGeneric, CallbackRef(callback, key, data)); } /* Methods to mark the source of all edges in the store buffer. */ - void markAll(JSTracer *trc); - void markValues(JSTracer *trc) { bufferVal.mark(this, trc); } - void markCells(JSTracer *trc) { bufferCell.mark(this, trc); } - void markSlots(JSTracer *trc) { bufferSlot.mark(this, trc); } - void markWholeCells(JSTracer *trc) { bufferWholeCell.mark(this, trc); } - void markRelocatableValues(JSTracer *trc) { bufferRelocVal.mark(this, trc); } - void markRelocatableCells(JSTracer *trc) { bufferRelocCell.mark(this, trc); } - void markGenericEntries(JSTracer *trc) { bufferGeneric.mark(this, trc); } + void markAll(JSTracer* trc); + void markValues(JSTracer* trc) { bufferVal.mark(this, trc); } + void markCells(JSTracer* trc) { bufferCell.mark(this, trc); } + void markSlots(JSTracer* trc) { bufferSlot.mark(this, trc); } + void markWholeCells(JSTracer* trc) { bufferWholeCell.mark(this, trc); } + void markRelocatableValues(JSTracer* trc) { bufferRelocVal.mark(this, trc); } + void markRelocatableCells(JSTracer* trc) { bufferRelocCell.mark(this, trc); } + void markGenericEntries(JSTracer* trc) { bufferGeneric.mark(this, trc); } /* We cannot call InParallelSection directly because of a circular dependency. */ bool inParallelSection() const; @@ -474,7 +474,7 @@ class StoreBuffer /* For use by our owned buffers and for testing. */ void setAboutToOverflow(); - void addSizeOfExcludingThis(mozilla::MallocSizeOf mallocSizeOf, JS::GCSizes *sizes); + void addSizeOfExcludingThis(mozilla::MallocSizeOf mallocSizeOf, JS::GCSizes* sizes); }; } /* namespace gc */ diff --git a/js/src/gc/Tracer.cpp b/js/src/gc/Tracer.cpp index edabb86043..8b1478a942 100644 --- a/js/src/gc/Tracer.cpp +++ b/js/src/gc/Tracer.cpp @@ -26,75 +26,75 @@ using namespace js::gc; using mozilla::DebugOnly; JS_PUBLIC_API(void) -JS_CallValueTracer(JSTracer *trc, Value *valuep, const char *name) +JS_CallValueTracer(JSTracer* trc, Value* valuep, const char* name) { MarkValueUnbarriered(trc, valuep, name); } JS_PUBLIC_API(void) -JS_CallIdTracer(JSTracer *trc, jsid *idp, const char *name) +JS_CallIdTracer(JSTracer* trc, jsid* idp, const char* name) { MarkIdUnbarriered(trc, idp, name); } JS_PUBLIC_API(void) -JS_CallObjectTracer(JSTracer *trc, JSObject **objp, const char *name) +JS_CallObjectTracer(JSTracer* trc, JSObject** objp, const char* name) { MarkObjectUnbarriered(trc, objp, name); } JS_PUBLIC_API(void) -JS_CallStringTracer(JSTracer *trc, JSString **strp, const char *name) +JS_CallStringTracer(JSTracer* trc, JSString** strp, const char* name) { MarkStringUnbarriered(trc, strp, name); } JS_PUBLIC_API(void) -JS_CallScriptTracer(JSTracer *trc, JSScript **scriptp, const char *name) +JS_CallScriptTracer(JSTracer* trc, JSScript** scriptp, const char* name) { MarkScriptUnbarriered(trc, scriptp, name); } JS_PUBLIC_API(void) -JS_CallHeapValueTracer(JSTracer *trc, JS::Heap *valuep, const char *name) +JS_CallHeapValueTracer(JSTracer* trc, JS::Heap* valuep, const char* name) { MarkValueUnbarriered(trc, valuep->unsafeGet(), name); } JS_PUBLIC_API(void) -JS_CallHeapIdTracer(JSTracer *trc, JS::Heap *idp, const char *name) +JS_CallHeapIdTracer(JSTracer* trc, JS::Heap* idp, const char* name) { MarkIdUnbarriered(trc, idp->unsafeGet(), name); } JS_PUBLIC_API(void) -JS_CallHeapObjectTracer(JSTracer *trc, JS::Heap *objp, const char *name) +JS_CallHeapObjectTracer(JSTracer* trc, JS::Heap* objp, const char* name) { MarkObjectUnbarriered(trc, objp->unsafeGet(), name); } JS_PUBLIC_API(void) -JS_CallHeapStringTracer(JSTracer *trc, JS::Heap *strp, const char *name) +JS_CallHeapStringTracer(JSTracer* trc, JS::Heap* strp, const char* name) { MarkStringUnbarriered(trc, strp->unsafeGet(), name); } JS_PUBLIC_API(void) -JS_CallHeapScriptTracer(JSTracer *trc, JS::Heap *scriptp, const char *name) +JS_CallHeapScriptTracer(JSTracer* trc, JS::Heap* scriptp, const char* name) { MarkScriptUnbarriered(trc, scriptp->unsafeGet(), name); } JS_PUBLIC_API(void) -JS_CallHeapFunctionTracer(JSTracer *trc, JS::Heap *funp, const char *name) +JS_CallHeapFunctionTracer(JSTracer* trc, JS::Heap* funp, const char* name) { MarkObjectUnbarriered(trc, funp->unsafeGet(), name); } JS_PUBLIC_API(void) -JS_CallTenuredObjectTracer(JSTracer *trc, JS::TenuredHeap *objp, const char *name) +JS_CallTenuredObjectTracer(JSTracer* trc, JS::TenuredHeap* objp, const char* name) { - JSObject *obj = objp->getPtr(); + JSObject* obj = objp->getPtr(); if (!obj) return; @@ -105,13 +105,13 @@ JS_CallTenuredObjectTracer(JSTracer *trc, JS::TenuredHeap *objp, con } JS_PUBLIC_API(void) -JS_TraceChildren(JSTracer *trc, void *thing, JSGCTraceKind kind) +JS_TraceChildren(JSTracer* trc, void* thing, JSGCTraceKind kind) { js::TraceChildren(trc, thing, kind); } JS_PUBLIC_API(void) -JS_TraceRuntime(JSTracer *trc) +JS_TraceRuntime(JSTracer* trc) { AssertHeapIsIdle(trc->runtime()); TraceRuntime(trc); @@ -130,10 +130,10 @@ CountDecimalDigits(size_t num) } JS_PUBLIC_API(void) -JS_GetTraceThingInfo(char *buf, size_t bufsize, JSTracer *trc, void *thing, +JS_GetTraceThingInfo(char* buf, size_t bufsize, JSTracer* trc, void* thing, JSGCTraceKind kind, bool details) { - const char *name = nullptr; /* silence uninitialized warning */ + const char* name = nullptr; /* silence uninitialized warning */ size_t n; if (bufsize == 0) @@ -142,12 +142,12 @@ JS_GetTraceThingInfo(char *buf, size_t bufsize, JSTracer *trc, void *thing, switch (kind) { case JSTRACE_OBJECT: { - name = static_cast(thing)->getClass()->name; + name = static_cast(thing)->getClass()->name; break; } case JSTRACE_STRING: - name = ((JSString *)thing)->isDependent() + name = ((JSString*)thing)->isDependent() ? "substring" : "string"; break; @@ -189,9 +189,9 @@ JS_GetTraceThingInfo(char *buf, size_t bufsize, JSTracer *trc, void *thing, switch (kind) { case JSTRACE_OBJECT: { - JSObject *obj = (JSObject *)thing; + JSObject* obj = (JSObject*)thing; if (obj->is()) { - JSFunction *fun = &obj->as(); + JSFunction* fun = &obj->as(); if (fun->displayAtom()) { *buf++ = ' '; bufsize--; @@ -209,7 +209,7 @@ JS_GetTraceThingInfo(char *buf, size_t bufsize, JSTracer *trc, void *thing, { *buf++ = ' '; bufsize--; - JSString *str = (JSString *)thing; + JSString* str = (JSString*)thing; if (str->isLinear()) { bool willFit = str->length() + strlen(" ") + @@ -230,7 +230,7 @@ JS_GetTraceThingInfo(char *buf, size_t bufsize, JSTracer *trc, void *thing, case JSTRACE_SCRIPT: { - JSScript *script = static_cast(thing); + JSScript* script = static_cast(thing); JS_snprintf(buf, bufsize, " %s:%u", script->filename(), unsigned(script->lineno())); break; } @@ -246,7 +246,7 @@ JS_GetTraceThingInfo(char *buf, size_t bufsize, JSTracer *trc, void *thing, buf[bufsize - 1] = '\0'; } -JSTracer::JSTracer(JSRuntime *rt, JSTraceCallback traceCallback, +JSTracer::JSTracer(JSRuntime* rt, JSTraceCallback traceCallback, WeakMapTraceKind weakTraceKind /* = TraceWeakMapValues */) : callback(traceCallback) , runtime_(rt) @@ -266,15 +266,15 @@ JSTracer::hasTracingDetails() const return debugPrinter_ || debugPrintArg_; } -const char * -JSTracer::tracingName(const char *fallback) const +const char* +JSTracer::tracingName(const char* fallback) const { JS_ASSERT(hasTracingDetails()); - return debugPrinter_ ? fallback : (const char *)debugPrintArg_; + return debugPrinter_ ? fallback : (const char*)debugPrintArg_; } -const char * -JSTracer::getTracingEdgeName(char *buffer, size_t bufferSize) +const char* +JSTracer::getTracingEdgeName(char* buffer, size_t bufferSize) { if (debugPrinter_) { debugPrinter_(this, buffer, bufferSize); @@ -282,7 +282,7 @@ JSTracer::getTracingEdgeName(char *buffer, size_t bufferSize) } if (debugPrintIndex_ != size_t(-1)) { JS_snprintf(buffer, bufferSize, "%s[%lu]", - (const char *)debugPrintArg_, + (const char*)debugPrintArg_, debugPrintIndex_); return buffer; } @@ -295,7 +295,7 @@ JSTracer::debugPrinter() const return debugPrinter_; } -const void * +const void* JSTracer::debugPrintArg() const { return debugPrintArg_; @@ -315,7 +315,7 @@ JSTracer::setTraceCallback(JSTraceCallback traceCallback) #ifdef JS_GC_ZEAL void -JSTracer::setTracingLocation(void *location) +JSTracer::setTracingLocation(void* location) { if (!realLocation_ || !location) realLocation_ = location; @@ -327,10 +327,10 @@ JSTracer::unsetTracingLocation() realLocation_ = nullptr; } -void ** -JSTracer::tracingLocation(void **thingp) +void** +JSTracer::tracingLocation(void** thingp) { - return realLocation_ ? (void **)realLocation_ : thingp; + return realLocation_ ? (void**)realLocation_ : thingp; } #endif @@ -340,7 +340,7 @@ MarkStack::init(JSGCMode gcMode) setBaseCapacity(gcMode); JS_ASSERT(!stack_); - uintptr_t *newStack = js_pod_malloc(baseCapacity_); + uintptr_t* newStack = js_pod_malloc(baseCapacity_); if (!newStack) return false; @@ -387,7 +387,7 @@ MarkStack::reset() return; } - uintptr_t *newStack = (uintptr_t *)js_realloc(stack_, sizeof(uintptr_t) * baseCapacity_); + uintptr_t* newStack = (uintptr_t*)js_realloc(stack_, sizeof(uintptr_t) * baseCapacity_); if (!newStack) { // If the realloc fails, just keep using the existing stack; it's // not ideal but better than failing. @@ -406,7 +406,7 @@ MarkStack::enlarge(unsigned count) size_t tosIndex = position(); - uintptr_t *newStack = (uintptr_t *)js_realloc(stack_, sizeof(uintptr_t) * newCapacity); + uintptr_t* newStack = (uintptr_t*)js_realloc(stack_, sizeof(uintptr_t) * newCapacity); if (!newStack) return false; @@ -432,7 +432,7 @@ MarkStack::sizeOfExcludingThis(mozilla::MallocSizeOf mallocSizeOf) const * DoNotTraceWeakMaps: the GC is recomputing the liveness of WeakMap entries, * so we delay visting entries. */ -GCMarker::GCMarker(JSRuntime *rt) +GCMarker::GCMarker(JSRuntime* rt) : JSTracer(rt, nullptr, DoNotTraceWeakMaps), stack(size_t(-1)), color(BLACK), @@ -488,7 +488,7 @@ GCMarker::reset() JS_ASSERT(isMarkStackEmpty()); while (unmarkedArenaStackTop) { - ArenaHeader *aheader = unmarkedArenaStackTop; + ArenaHeader* aheader = unmarkedArenaStackTop; JS_ASSERT(aheader->hasDelayedMarking); JS_ASSERT(markLaterArenas); unmarkedArenaStackTop = aheader->getNextDelayedMarking(); @@ -502,14 +502,14 @@ GCMarker::reset() } void -GCMarker::markDelayedChildren(ArenaHeader *aheader) +GCMarker::markDelayedChildren(ArenaHeader* aheader) { if (aheader->markOverflow) { bool always = aheader->allocatedDuringIncremental; aheader->markOverflow = 0; for (CellIterUnderGC i(aheader); !i.done(); i.next()) { - Cell *t = i.getCell(); + Cell* t = i.getCell(); if (always || t->isMarked()) { t->markIfUnmarked(); JS_TraceChildren(this, t, MapAllocToTraceKind(aheader->getAllocKind())); @@ -528,7 +528,7 @@ GCMarker::markDelayedChildren(ArenaHeader *aheader) } bool -GCMarker::markDelayedChildren(SliceBudget &budget) +GCMarker::markDelayedChildren(SliceBudget& budget) { gcstats::MaybeAutoPhase ap; if (runtime()->gcIncrementalState == MARK) @@ -541,7 +541,7 @@ GCMarker::markDelayedChildren(SliceBudget &budget) * marking of its things. For that we pop arena from the stack and * clear its hasDelayedMarking flag before we begin the marking. */ - ArenaHeader *aheader = unmarkedArenaStackTop; + ArenaHeader* aheader = unmarkedArenaStackTop; JS_ASSERT(aheader->hasDelayedMarking); JS_ASSERT(markLaterArenas); unmarkedArenaStackTop = aheader->getNextDelayedMarking(); @@ -560,10 +560,10 @@ GCMarker::markDelayedChildren(SliceBudget &budget) #ifdef DEBUG void -GCMarker::checkZone(void *p) +GCMarker::checkZone(void* p) { JS_ASSERT(started); - DebugOnly cell = static_cast(p); + DebugOnly cell = static_cast(p); JS_ASSERT_IF(cell->isTenured(), cell->tenuredZone()->isCollecting()); } #endif @@ -605,24 +605,24 @@ GCMarker::resetBufferedGrayRoots() } void -GCMarker::markBufferedGrayRoots(JS::Zone *zone) +GCMarker::markBufferedGrayRoots(JS::Zone* zone) { JS_ASSERT(grayBufferState == GRAY_BUFFER_OK); JS_ASSERT(zone->isGCMarkingGray()); - for (GrayRoot *elem = zone->gcGrayRoots.begin(); elem != zone->gcGrayRoots.end(); elem++) { + for (GrayRoot* elem = zone->gcGrayRoots.begin(); elem != zone->gcGrayRoots.end(); elem++) { #ifdef DEBUG setTracingDetails(elem->debugPrinter, elem->debugPrintArg, elem->debugPrintIndex); #endif - void *tmp = elem->thing; - setTracingLocation((void *)&elem->thing); + void* tmp = elem->thing; + setTracingLocation((void*)&elem->thing); MarkKind(this, &tmp, elem->kind); JS_ASSERT(tmp == elem->thing); } } void -GCMarker::appendGrayRoot(void *thing, JSGCTraceKind kind) +GCMarker::appendGrayRoot(void* thing, JSGCTraceKind kind) { JS_ASSERT(started); @@ -636,7 +636,7 @@ GCMarker::appendGrayRoot(void *thing, JSGCTraceKind kind) root.debugPrintIndex = debugPrintIndex(); #endif - Zone *zone = static_cast(thing)->tenuredZone(); + Zone* zone = static_cast(thing)->tenuredZone(); if (zone->isCollecting()) { zone->maybeAlive = true; if (!zone->gcGrayRoots.append(root)) { @@ -647,11 +647,11 @@ GCMarker::appendGrayRoot(void *thing, JSGCTraceKind kind) } void -GCMarker::GrayCallback(JSTracer *trc, void **thingp, JSGCTraceKind kind) +GCMarker::GrayCallback(JSTracer* trc, void** thingp, JSGCTraceKind kind) { JS_ASSERT(thingp); JS_ASSERT(*thingp); - GCMarker *gcmarker = static_cast(trc); + GCMarker* gcmarker = static_cast(trc); gcmarker->appendGrayRoot(*thingp, kind); } @@ -665,7 +665,7 @@ GCMarker::sizeOfExcludingThis(mozilla::MallocSizeOf mallocSizeOf) const } void -js::SetMarkStackLimit(JSRuntime *rt, size_t limit) +js::SetMarkStackLimit(JSRuntime* rt, size_t limit) { JS_ASSERT(!rt->isHeapBusy()); AutoStopVerifyingBarriers pauseVerification(rt, false); diff --git a/js/src/gc/Tracer.h b/js/src/gc/Tracer.h index 35b1fef908..0cd169942b 100644 --- a/js/src/gc/Tracer.h +++ b/js/src/gc/Tracer.h @@ -45,9 +45,9 @@ class MarkStack { friend class GCMarker; - uintptr_t *stack_; - uintptr_t *tos_; - uintptr_t *end_; + uintptr_t* stack_; + uintptr_t* tos_; + uintptr_t* end_; // The capacity we start with and reset() to. size_t baseCapacity_; @@ -70,7 +70,7 @@ class MarkStack ptrdiff_t position() const { return tos_ - stack_; } - void setStack(uintptr_t *stack, size_t tosIndex, size_t capacity) { + void setStack(uintptr_t* stack, size_t tosIndex, size_t capacity) { stack_ = stack; tos_ = stack + tosIndex; end_ = stack + capacity; @@ -93,7 +93,7 @@ class MarkStack } bool push(uintptr_t item1, uintptr_t item2, uintptr_t item3) { - uintptr_t *nextTos = tos_ + 3; + uintptr_t* nextTos = tos_ + 3; if (nextTos > end_) { if (!enlarge(3)) return false; @@ -129,7 +129,7 @@ class MarkStack class GCMarker : public JSTracer { public: - explicit GCMarker(JSRuntime *rt); + explicit GCMarker(JSRuntime* rt); bool init(JSGCMode gcMode); void setMaxCapacity(size_t maxCap) { stack.setMaxCapacity(maxCap); } @@ -139,15 +139,15 @@ class GCMarker : public JSTracer void stop(); void reset(); - void pushObject(ObjectImpl *obj) { + void pushObject(ObjectImpl* obj) { pushTaggedPtr(ObjectTag, obj); } - void pushType(types::TypeObject *type) { + void pushType(types::TypeObject* type) { pushTaggedPtr(TypeTag, type); } - void pushJitCode(jit::JitCode *code) { + void pushJitCode(jit::JitCode* code) { pushTaggedPtr(JitCodeTag, code); } @@ -174,10 +174,10 @@ class GCMarker : public JSTracer color = gc::BLACK; } - inline void delayMarkingArena(gc::ArenaHeader *aheader); - void delayMarkingChildren(const void *thing); - void markDelayedChildren(gc::ArenaHeader *aheader); - bool markDelayedChildren(SliceBudget &budget); + inline void delayMarkingArena(gc::ArenaHeader* aheader); + void delayMarkingChildren(const void* thing); + void markDelayedChildren(gc::ArenaHeader* aheader); + bool markDelayedChildren(SliceBudget& budget); bool hasDelayedChildren() const { return !!unmarkedArenaStackTop; } @@ -186,7 +186,7 @@ class GCMarker : public JSTracer return isMarkStackEmpty() && !unmarkedArenaStackTop; } - bool drainMarkStack(SliceBudget &budget); + bool drainMarkStack(SliceBudget& budget); /* * Gray marking must be done after all black marking is complete. However, @@ -201,9 +201,9 @@ class GCMarker : public JSTracer void startBufferingGrayRoots(); void endBufferingGrayRoots(); void resetBufferedGrayRoots(); - void markBufferedGrayRoots(JS::Zone *zone); + void markBufferedGrayRoots(JS::Zone* zone); - static void GrayCallback(JSTracer *trc, void **thing, JSGCTraceKind kind); + static void GrayCallback(JSTracer* trc, void** thing, JSGCTraceKind kind); void setGCMode(JSGCMode mode) { stack.setGCMode(mode); } @@ -214,9 +214,9 @@ class GCMarker : public JSTracer private: #ifdef DEBUG - void checkZone(void *p); + void checkZone(void* p); #else - void checkZone(void *p) {} + void checkZone(void* p) {} #endif /* @@ -238,7 +238,7 @@ class GCMarker : public JSTracer static_assert(StackTagMask >= uintptr_t(LastTag), "The tag mask must subsume the tags."); static_assert(StackTagMask <= gc::CellMask, "The tag mask must be embeddable in a Cell*."); - void pushTaggedPtr(StackTag tag, void *ptr) { + void pushTaggedPtr(StackTag tag, void* ptr) { checkZone(ptr); uintptr_t addr = reinterpret_cast(ptr); JS_ASSERT(!(addr & StackTagMask)); @@ -246,7 +246,7 @@ class GCMarker : public JSTracer delayMarkingChildren(ptr); } - void pushValueArray(JSObject *obj, void *start, void *end) { + void pushValueArray(JSObject* obj, void* start, void* end) { checkZone(obj); JS_ASSERT(start <= end); @@ -266,18 +266,18 @@ class GCMarker : public JSTracer return stack.isEmpty(); } - bool restoreValueArray(JSObject *obj, void **vpp, void **endp); + bool restoreValueArray(JSObject* obj, void** vpp, void** endp); void saveValueRanges(); - inline void processMarkStackTop(SliceBudget &budget); + inline void processMarkStackTop(SliceBudget& budget); void processMarkStackOther(uintptr_t tag, uintptr_t addr); - void appendGrayRoot(void *thing, JSGCTraceKind kind); + void appendGrayRoot(void* thing, JSGCTraceKind kind); /* The color is only applied to objects and functions. */ uint32_t color; /* Pointer to the top of the stack of arenas we are delaying marking on. */ - js::gc::ArenaHeader *unmarkedArenaStackTop; + js::gc::ArenaHeader* unmarkedArenaStackTop; /* Count of arenas that are currently in the stack. */ mozilla::DebugOnly markLaterArenas; @@ -294,7 +294,7 @@ class GCMarker : public JSTracer }; void -SetMarkStackLimit(JSRuntime *rt, size_t limit); +SetMarkStackLimit(JSRuntime* rt, size_t limit); } /* namespace js */ diff --git a/js/src/gc/Verifier.cpp b/js/src/gc/Verifier.cpp index e7292b4de5..364f3b591a 100644 --- a/js/src/gc/Verifier.cpp +++ b/js/src/gc/Verifier.cpp @@ -57,20 +57,20 @@ using namespace mozilla; struct EdgeValue { - void *thing; + void* thing; JSGCTraceKind kind; - const char *label; + const char* label; }; struct VerifyNode { - void *thing; + void* thing; JSGCTraceKind kind; uint32_t count; EdgeValue edges[1]; }; -typedef HashMap, SystemAllocPolicy> NodeMap; +typedef HashMap, SystemAllocPolicy> NodeMap; /* * The verifier data structures are simple. The entire graph is stored in a @@ -96,13 +96,13 @@ struct VerifyPreTracer : JSTracer int count; /* This graph represents the initial GC "snapshot". */ - VerifyNode *curnode; - VerifyNode *root; - char *edgeptr; - char *term; + VerifyNode* curnode; + VerifyNode* root; + char* edgeptr; + char* term; NodeMap nodemap; - VerifyPreTracer(JSRuntime *rt, JSTraceCallback callback) + VerifyPreTracer(JSRuntime* rt, JSTraceCallback callback) : JSTracer(rt, callback), noggc(rt), number(rt->gcNumber), count(0), root(nullptr) {} @@ -116,11 +116,11 @@ struct VerifyPreTracer : JSTracer * node. */ static void -AccumulateEdge(JSTracer *jstrc, void **thingp, JSGCTraceKind kind) +AccumulateEdge(JSTracer* jstrc, void** thingp, JSGCTraceKind kind) { - VerifyPreTracer *trc = (VerifyPreTracer *)jstrc; + VerifyPreTracer* trc = (VerifyPreTracer*)jstrc; - JS_ASSERT(!IsInsideNursery(trc->runtime(), *(uintptr_t **)thingp)); + JS_ASSERT(!IsInsideNursery(trc->runtime(), *(uintptr_t**)thingp)); trc->edgeptr += sizeof(EdgeValue); if (trc->edgeptr >= trc->term) { @@ -128,7 +128,7 @@ AccumulateEdge(JSTracer *jstrc, void **thingp, JSGCTraceKind kind) return; } - VerifyNode *node = trc->curnode; + VerifyNode* node = trc->curnode; uint32_t i = node->count; node->edges[i].thing = *thingp; @@ -137,12 +137,12 @@ AccumulateEdge(JSTracer *jstrc, void **thingp, JSGCTraceKind kind) node->count++; } -static VerifyNode * -MakeNode(VerifyPreTracer *trc, void *thing, JSGCTraceKind kind) +static VerifyNode* +MakeNode(VerifyPreTracer* trc, void* thing, JSGCTraceKind kind) { NodeMap::AddPtr p = trc->nodemap.lookupForAdd(thing); if (!p) { - VerifyNode *node = (VerifyNode *)trc->edgeptr; + VerifyNode* node = (VerifyNode*)trc->edgeptr; trc->edgeptr += sizeof(VerifyNode) - sizeof(EdgeValue); if (trc->edgeptr >= trc->term) { trc->edgeptr = trc->term; @@ -158,18 +158,18 @@ MakeNode(VerifyPreTracer *trc, void *thing, JSGCTraceKind kind) return nullptr; } -static VerifyNode * -NextNode(VerifyNode *node) +static VerifyNode* +NextNode(VerifyNode* node) { if (node->count == 0) - return (VerifyNode *)((char *)node + sizeof(VerifyNode) - sizeof(EdgeValue)); + return (VerifyNode*)((char*)node + sizeof(VerifyNode) - sizeof(EdgeValue)); else - return (VerifyNode *)((char *)node + sizeof(VerifyNode) + + return (VerifyNode*)((char*)node + sizeof(VerifyNode) + sizeof(EdgeValue)*(node->count - 1)); } void -gc::StartVerifyPreBarriers(JSRuntime *rt) +gc::StartVerifyPreBarriers(JSRuntime* rt) { if (rt->gcVerifyPreData || rt->gcIncrementalState != NO_INCREMENTAL) return; @@ -195,7 +195,7 @@ gc::StartVerifyPreBarriers(JSRuntime *rt) rt->gcNumber++; - VerifyPreTracer *trc = js_new(rt, JSTraceCallback(nullptr)); + VerifyPreTracer* trc = js_new(rt, JSTraceCallback(nullptr)); if (!trc) return; @@ -206,10 +206,10 @@ gc::StartVerifyPreBarriers(JSRuntime *rt) trc->setTraceCallback(AccumulateEdge); const size_t size = 64 * 1024 * 1024; - trc->root = (VerifyNode *)js_malloc(size); + trc->root = (VerifyNode*)js_malloc(size); if (!trc->root) goto oom; - trc->edgeptr = (char *)trc->root; + trc->edgeptr = (char*)trc->root; trc->term = trc->edgeptr + size; if (!trc->nodemap.init()) @@ -224,16 +224,16 @@ gc::StartVerifyPreBarriers(JSRuntime *rt) /* Make all the roots be edges emanating from the root node. */ MarkRuntime(trc); - VerifyNode *node; + VerifyNode* node; node = trc->curnode; if (trc->edgeptr == trc->term) goto oom; /* For each edge, make a node for it if one doesn't already exist. */ - while ((char *)node < trc->edgeptr) { + while ((char*)node < trc->edgeptr) { for (uint32_t i = 0; i < node->count; i++) { - EdgeValue &e = node->edges[i]; - VerifyNode *child = MakeNode(trc, e.thing, e.kind); + EdgeValue& e = node->edges[i]; + VerifyNode* child = MakeNode(trc, e.thing, e.kind); if (child) { trc->curnode = child; JS_TraceChildren(trc, e.thing, e.kind); @@ -265,7 +265,7 @@ gc::StartVerifyPreBarriers(JSRuntime *rt) } static bool -IsMarkedOrAllocated(Cell *cell) +IsMarkedOrAllocated(Cell* cell) { return cell->isMarked() || cell->arenaHeader()->allocatedDuringIncremental; } @@ -280,10 +280,10 @@ static const uint32_t MAX_VERIFIER_EDGES = 1000; * been modified) must point to marked objects. */ static void -CheckEdge(JSTracer *jstrc, void **thingp, JSGCTraceKind kind) +CheckEdge(JSTracer* jstrc, void** thingp, JSGCTraceKind kind) { - VerifyPreTracer *trc = (VerifyPreTracer *)jstrc; - VerifyNode *node = trc->curnode; + VerifyPreTracer* trc = (VerifyPreTracer*)jstrc; + VerifyNode* node = trc->curnode; /* Avoid n^2 behavior. */ if (node->count > MAX_VERIFIER_EDGES) @@ -299,17 +299,17 @@ CheckEdge(JSTracer *jstrc, void **thingp, JSGCTraceKind kind) } static void -AssertMarkedOrAllocated(const EdgeValue &edge) +AssertMarkedOrAllocated(const EdgeValue& edge) { - if (!edge.thing || IsMarkedOrAllocated(static_cast(edge.thing))) + if (!edge.thing || IsMarkedOrAllocated(static_cast(edge.thing))) return; // Permanent atoms aren't marked during graph traversal. - if (edge.kind == JSTRACE_STRING && static_cast(edge.thing)->isPermanentAtom()) + if (edge.kind == JSTRACE_STRING && static_cast(edge.thing)->isPermanentAtom()) return; char msgbuf[1024]; - const char *label = edge.label; + const char* label = edge.label; JS_snprintf(msgbuf, sizeof(msgbuf), "[barrier verifier] Unmarked edge: %s", label); MOZ_ReportAssertionFailure(msgbuf, __FILE__, __LINE__); @@ -317,13 +317,13 @@ AssertMarkedOrAllocated(const EdgeValue &edge) } void -gc::EndVerifyPreBarriers(JSRuntime *rt) +gc::EndVerifyPreBarriers(JSRuntime* rt) { JS_ASSERT(!JS::IsGenerationalGCEnabled(rt)); AutoPrepareForTracing prep(rt, SkipAtoms); - VerifyPreTracer *trc = (VerifyPreTracer *)rt->gcVerifyPreData; + VerifyPreTracer* trc = (VerifyPreTracer*)rt->gcVerifyPreData; if (!trc) return; @@ -354,8 +354,8 @@ gc::EndVerifyPreBarriers(JSRuntime *rt) trc->setTraceCallback(CheckEdge); /* Start after the roots. */ - VerifyNode *node = NextNode(trc->root); - while ((char *)node < trc->edgeptr) { + VerifyNode* node = NextNode(trc->root); + while ((char*)node < trc->edgeptr) { trc->curnode = node; JS_TraceChildren(trc, node->thing, node->kind); @@ -385,10 +385,10 @@ struct VerifyPostTracer : JSTracer int count; /* The set of edges in the StoreBuffer at the end of verification. */ - typedef HashSet, SystemAllocPolicy> EdgeSet; - EdgeSet *edges; + typedef HashSet, SystemAllocPolicy> EdgeSet; + EdgeSet* edges; - VerifyPostTracer(JSRuntime *rt, JSTraceCallback callback) + VerifyPostTracer(JSRuntime* rt, JSTraceCallback callback) : JSTracer(rt, callback), number(rt->gcNumber), count(0) {} }; @@ -399,7 +399,7 @@ struct VerifyPostTracer : JSTracer * important edges were inserted into the storebuffer. */ void -gc::StartVerifyPostBarriers(JSRuntime *rt) +gc::StartVerifyPostBarriers(JSRuntime* rt) { #ifdef JSGC_GENERATIONAL if (rt->gcVerifyPostData || @@ -412,7 +412,7 @@ gc::StartVerifyPostBarriers(JSRuntime *rt) rt->gcNumber++; - VerifyPostTracer *trc = js_new(rt, JSTraceCallback(nullptr)); + VerifyPostTracer* trc = js_new(rt, JSTraceCallback(nullptr)); if (!trc) return; @@ -422,16 +422,16 @@ gc::StartVerifyPostBarriers(JSRuntime *rt) #ifdef JSGC_GENERATIONAL void -PostVerifierCollectStoreBufferEdges(JSTracer *jstrc, void **thingp, JSGCTraceKind kind) +PostVerifierCollectStoreBufferEdges(JSTracer* jstrc, void** thingp, JSGCTraceKind kind) { - VerifyPostTracer *trc = (VerifyPostTracer *)jstrc; + VerifyPostTracer* trc = (VerifyPostTracer*)jstrc; /* The nursery only stores objects. */ if (kind != JSTRACE_OBJECT) return; /* The store buffer may store extra, non-cross-generational edges. */ - JSObject *dst = *reinterpret_cast(thingp); + JSObject* dst = *reinterpret_cast(thingp); if (trc->runtime()->gcNursery.isInside(thingp) || !trc->runtime()->gcNursery.isInside(dst)) return; @@ -440,28 +440,28 @@ PostVerifierCollectStoreBufferEdges(JSTracer *jstrc, void **thingp, JSGCTraceKin * only things that enter this callback are marked by the store buffer. The * store buffer ensures that the real tracing location is set correctly. */ - void **loc = trc->tracingLocation(thingp); + void** loc = trc->tracingLocation(thingp); trc->edges->put(loc); } static void -AssertStoreBufferContainsEdge(VerifyPostTracer::EdgeSet *edges, void **loc, JSObject *dst) +AssertStoreBufferContainsEdge(VerifyPostTracer::EdgeSet* edges, void** loc, JSObject* dst) { if (edges->has(loc)) return; char msgbuf[1024]; JS_snprintf(msgbuf, sizeof(msgbuf), "[post-barrier verifier] Missing edge @ %p to %p", - (void *)loc, (void *)dst); + (void*)loc, (void*)dst); MOZ_ReportAssertionFailure(msgbuf, __FILE__, __LINE__); MOZ_CRASH(); } void -PostVerifierVisitEdge(JSTracer *jstrc, void **thingp, JSGCTraceKind kind) +PostVerifierVisitEdge(JSTracer* jstrc, void** thingp, JSGCTraceKind kind) { - VerifyPostTracer *trc = (VerifyPostTracer *)jstrc; + VerifyPostTracer* trc = (VerifyPostTracer*)jstrc; /* The nursery only stores objects. */ if (kind != JSTRACE_OBJECT) @@ -469,7 +469,7 @@ PostVerifierVisitEdge(JSTracer *jstrc, void **thingp, JSGCTraceKind kind) /* Filter out non cross-generational edges. */ JS_ASSERT(!trc->runtime()->gcNursery.isInside(thingp)); - JSObject *dst = *reinterpret_cast(thingp); + JSObject* dst = *reinterpret_cast(thingp); if (!trc->runtime()->gcNursery.isInside(dst)) return; @@ -479,20 +479,20 @@ PostVerifierVisitEdge(JSTracer *jstrc, void **thingp, JSGCTraceKind kind) * below. Since ObjectImpl::markChildren handles this, the real trace * location will be set correctly in these cases. */ - void **loc = trc->tracingLocation(thingp); + void** loc = trc->tracingLocation(thingp); AssertStoreBufferContainsEdge(trc->edges, loc, dst); } #endif void -js::gc::EndVerifyPostBarriers(JSRuntime *rt) +js::gc::EndVerifyPostBarriers(JSRuntime* rt) { #ifdef JSGC_GENERATIONAL VerifyPostTracer::EdgeSet edges; AutoPrepareForTracing prep(rt, SkipAtoms); - VerifyPostTracer *trc = (VerifyPostTracer *)rt->gcVerifyPostData; + VerifyPostTracer* trc = (VerifyPostTracer*)rt->gcVerifyPostData; /* Visit every entry in the store buffer and put the edges in a hash set. */ trc->setTraceCallback(PostVerifierCollectStoreBufferEdges); @@ -506,7 +506,7 @@ js::gc::EndVerifyPostBarriers(JSRuntime *rt) for (GCZoneGroupIter zone(rt); !zone.done(); zone.next()) { for (size_t kind = 0; kind < FINALIZE_LIMIT; ++kind) { for (CellIterUnderGC cells(zone, AllocKind(kind)); !cells.done(); cells.next()) { - Cell *src = cells.getCell(); + Cell* src = cells.getCell(); JS_TraceChildren(trc, src, MapAllocToTraceKind(AllocKind(kind))); } } @@ -521,7 +521,7 @@ js::gc::EndVerifyPostBarriers(JSRuntime *rt) /*** Barrier Verifier Scheduling ***/ static void -VerifyPreBarriers(JSRuntime *rt) +VerifyPreBarriers(JSRuntime* rt) { if (rt->gcVerifyPreData) EndVerifyPreBarriers(rt); @@ -530,7 +530,7 @@ VerifyPreBarriers(JSRuntime *rt) } static void -VerifyPostBarriers(JSRuntime *rt) +VerifyPostBarriers(JSRuntime* rt) { if (rt->gcVerifyPostData) EndVerifyPostBarriers(rt); @@ -539,7 +539,7 @@ VerifyPostBarriers(JSRuntime *rt) } void -gc::VerifyBarriers(JSRuntime *rt, VerifierType type) +gc::VerifyBarriers(JSRuntime* rt, VerifierType type) { if (type == PreBarrierVerifier) VerifyPreBarriers(rt); @@ -548,7 +548,7 @@ gc::VerifyBarriers(JSRuntime *rt, VerifierType type) } static void -MaybeVerifyPreBarriers(JSRuntime *rt, bool always) +MaybeVerifyPreBarriers(JSRuntime* rt, bool always) { if (rt->gcZeal() != ZealVerifierPreValue) return; @@ -556,7 +556,7 @@ MaybeVerifyPreBarriers(JSRuntime *rt, bool always) if (rt->mainThread.suppressGC) return; - if (VerifyPreTracer *trc = (VerifyPreTracer *)rt->gcVerifyPreData) { + if (VerifyPreTracer* trc = (VerifyPreTracer*)rt->gcVerifyPreData) { if (++trc->count < rt->gcZealFrequency && !always) return; @@ -567,7 +567,7 @@ MaybeVerifyPreBarriers(JSRuntime *rt, bool always) } static void -MaybeVerifyPostBarriers(JSRuntime *rt, bool always) +MaybeVerifyPostBarriers(JSRuntime* rt, bool always) { #ifdef JSGC_GENERATIONAL if (rt->gcZeal() != ZealVerifierPostValue) @@ -576,7 +576,7 @@ MaybeVerifyPostBarriers(JSRuntime *rt, bool always) if (rt->mainThread.suppressGC || !rt->gcStoreBuffer.isEnabled()) return; - if (VerifyPostTracer *trc = (VerifyPostTracer *)rt->gcVerifyPostData) { + if (VerifyPostTracer* trc = (VerifyPostTracer*)rt->gcVerifyPostData) { if (++trc->count < rt->gcZealFrequency && !always) return; @@ -587,21 +587,21 @@ MaybeVerifyPostBarriers(JSRuntime *rt, bool always) } void -js::gc::MaybeVerifyBarriers(JSContext *cx, bool always) +js::gc::MaybeVerifyBarriers(JSContext* cx, bool always) { MaybeVerifyPreBarriers(cx->runtime(), always); MaybeVerifyPostBarriers(cx->runtime(), always); } void -js::gc::FinishVerifier(JSRuntime *rt) +js::gc::FinishVerifier(JSRuntime* rt) { - if (VerifyPreTracer *trc = (VerifyPreTracer *)rt->gcVerifyPreData) { + if (VerifyPreTracer* trc = (VerifyPreTracer*)rt->gcVerifyPreData) { js_delete(trc); rt->gcVerifyPreData = nullptr; } #ifdef JSGC_GENERATIONAL - if (VerifyPostTracer *trc = (VerifyPostTracer *)rt->gcVerifyPostData) { + if (VerifyPostTracer* trc = (VerifyPostTracer*)rt->gcVerifyPostData) { js_delete(trc); rt->gcVerifyPostData = nullptr; } diff --git a/js/src/gc/Zone.cpp b/js/src/gc/Zone.cpp index d40981e155..9ac62edd83 100644 --- a/js/src/gc/Zone.cpp +++ b/js/src/gc/Zone.cpp @@ -21,7 +21,7 @@ using namespace js; using namespace js::gc; -JS::Zone::Zone(JSRuntime *rt) +JS::Zone::Zone(JSRuntime* rt) : JS::shadow::Zone(rt, &rt->gcMarker), allocator(this), ionUsingBarriers_(false), @@ -46,8 +46,8 @@ JS::Zone::Zone(JSRuntime *rt) #endif { /* Ensure that there are no vtables to mess us up here. */ - JS_ASSERT(reinterpret_cast(this) == - static_cast(this)); + JS_ASSERT(reinterpret_cast(this) == + static_cast(this)); setGCMaxMallocBytes(rt->gcMaxMallocBytes * 0.9); } @@ -105,7 +105,7 @@ Zone::onTooMuchMalloc() } void -Zone::sweep(FreeOp *fop, bool releaseTypes, bool *oom) +Zone::sweep(FreeOp* fop, bool releaseTypes, bool* oom) { /* * Periodically release observed types for all scripts. This is safe to @@ -126,7 +126,7 @@ Zone::sweep(FreeOp *fop, bool releaseTypes, bool *oom) } void -Zone::sweepBreakpoints(FreeOp *fop) +Zone::sweepBreakpoints(FreeOp* fop) { /* * Sweep all compartments in a zone at the same time, since there is no way @@ -138,7 +138,7 @@ Zone::sweepBreakpoints(FreeOp *fop) JS_ASSERT(isGCSweeping()); for (CellIterUnderGC i(this, FINALIZE_SCRIPT); !i.done(); i.next()) { - JSScript *script = i.get(); + JSScript* script = i.get(); JS_ASSERT(script->zone()->isGCSweeping()); if (!script->hasAnyBreakpointsOrStepMode()) continue; @@ -146,12 +146,12 @@ Zone::sweepBreakpoints(FreeOp *fop) bool scriptGone = IsScriptAboutToBeFinalized(&script); JS_ASSERT(script == i.get()); for (unsigned i = 0; i < script->length(); i++) { - BreakpointSite *site = script->getBreakpointSite(script->offsetToPC(i)); + BreakpointSite* site = script->getBreakpointSite(script->offsetToPC(i)); if (!site) continue; - Breakpoint *nextbp; - for (Breakpoint *bp = site->firstBreakpoint(); bp; bp = nextbp) { + Breakpoint* nextbp; + for (Breakpoint* bp = site->firstBreakpoint(); bp; bp = nextbp) { nextbp = bp->nextInSite(); HeapPtrObject& dbgobj = bp->debugger->toJSObjectRef(); JS_ASSERT(dbgobj->zone()->isGCSweeping()); @@ -165,7 +165,7 @@ Zone::sweepBreakpoints(FreeOp *fop) } void -Zone::discardJitCode(FreeOp *fop) +Zone::discardJitCode(FreeOp* fop) { #ifdef JS_ION if (!jitZone()) @@ -178,7 +178,7 @@ Zone::discardJitCode(FreeOp *fop) # ifdef DEBUG /* Assert no baseline scripts are marked as active. */ for (CellIterUnderGC i(this, FINALIZE_SCRIPT); !i.done(); i.next()) { - JSScript *script = i.get(); + JSScript* script = i.get(); JS_ASSERT_IF(script->hasBaselineScript(), !script->baselineScript()->active()); } # endif @@ -190,7 +190,7 @@ Zone::discardJitCode(FreeOp *fop) jit::InvalidateAll(fop, this); for (CellIterUnderGC i(this, FINALIZE_SCRIPT); !i.done(); i.next()) { - JSScript *script = i.get(); + JSScript* script = i.get(); jit::FinishInvalidation(fop, script); // Preserve JIT code that have been recently used in @@ -233,8 +233,8 @@ Zone::gcNumber() } #ifdef JS_ION -js::jit::JitZone * -Zone::createJitZone(JSContext *cx) +js::jit::JitZone* +Zone::createJitZone(JSContext* cx) { MOZ_ASSERT(!jitZone_); @@ -246,14 +246,14 @@ Zone::createJitZone(JSContext *cx) } #endif -JS::Zone * -js::ZoneOfObject(const JSObject &obj) +JS::Zone* +js::ZoneOfObject(const JSObject& obj) { return obj.zone(); } -JS::Zone * -js::ZoneOfObjectFromAnyThread(const JSObject &obj) +JS::Zone* +js::ZoneOfObjectFromAnyThread(const JSObject& obj) { return obj.zoneFromAnyThread(); } diff --git a/js/src/gc/Zone.h b/js/src/gc/Zone.h index 612defe9c0..dd058f0e9a 100644 --- a/js/src/gc/Zone.h +++ b/js/src/gc/Zone.h @@ -36,15 +36,15 @@ class Allocator */ friend class gc::ArenaLists; - JS::Zone *zone_; + JS::Zone* zone_; public: - explicit Allocator(JS::Zone *zone); + explicit Allocator(JS::Zone* zone); js::gc::ArenaLists arenas; }; -typedef Vector CompartmentVector; +typedef Vector CompartmentVector; } /* namespace js */ @@ -101,7 +101,7 @@ struct Zone : public JS::shadow::Zone, public js::MallocProvider { private: - friend bool js::CurrentThreadCanAccessZone(Zone *zone); + friend bool js::CurrentThreadCanAccessZone(Zone* zone); public: js::Allocator allocator; @@ -129,7 +129,7 @@ struct Zone : public JS::shadow::Zone, void setNeedsBarrier(bool needs, ShouldUpdateIon updateIon); - const bool *addressOfNeedsBarrier() const { + const bool* addressOfNeedsBarrier() const { return &needsBarrier_; } @@ -194,7 +194,7 @@ struct Zone : public JS::shadow::Zone, // Zones cannot be collected while in use by other threads. if (usedByExclusiveThread) return false; - JSRuntime *rt = runtimeFromAnyThread(); + JSRuntime* rt = runtimeFromAnyThread(); if (rt->isAtomsZone(this) && rt->exclusiveThreadsPresent()) return false; return true; @@ -272,18 +272,18 @@ struct Zone : public JS::shadow::Zone, js::Vector gcGrayRoots; /* Per-zone data for use by an embedder. */ - void *data; + void* data; - Zone(JSRuntime *rt); + Zone(JSRuntime* rt); ~Zone(); - void findOutgoingEdges(js::gc::ComponentFinder &finder); + void findOutgoingEdges(js::gc::ComponentFinder& finder); - void discardJitCode(js::FreeOp *fop); + void discardJitCode(js::FreeOp* fop); void addSizeOfIncludingThis(mozilla::MallocSizeOf mallocSizeOf, - size_t *typePool, - size_t *baselineStubsOptimized); + size_t* typePool, + size_t* baselineStubsOptimized); void setGCLastBytes(size_t lastBytes, js::JSGCInvocationKind gckind); void reduceGCTriggerBytes(size_t amount); @@ -306,7 +306,7 @@ struct Zone : public JS::shadow::Zone, void onTooMuchMalloc(); - void *onOutOfMemory(void *p, size_t nbytes) { + void* onOutOfMemory(void* p, size_t nbytes) { return runtimeFromMainThread()->onOutOfMemory(p, nbytes); } void reportAllocationOverflow() { @@ -315,22 +315,22 @@ struct Zone : public JS::shadow::Zone, js::types::TypeZone types; - void sweep(js::FreeOp *fop, bool releaseTypes, bool *oom); + void sweep(js::FreeOp* fop, bool releaseTypes, bool* oom); bool hasMarkedCompartments(); private: - void sweepBreakpoints(js::FreeOp *fop); + void sweepBreakpoints(js::FreeOp* fop); #ifdef JS_ION - js::jit::JitZone *jitZone_; - js::jit::JitZone *createJitZone(JSContext *cx); + js::jit::JitZone* jitZone_; + js::jit::JitZone* createJitZone(JSContext* cx); public: - js::jit::JitZone *getJitZone(JSContext *cx) { + js::jit::JitZone* getJitZone(JSContext* cx) { return jitZone_ ? jitZone_ : createJitZone(cx); } - js::jit::JitZone *jitZone() { + js::jit::JitZone* jitZone() { return jitZone_; } #endif @@ -353,10 +353,11 @@ enum ZoneSelector { class ZonesIter { private: - JS::Zone **it, **end; + gc::AutoEnterIteration iterMarker; + JS::Zone** it, **end; public: - ZonesIter(JSRuntime *rt, ZoneSelector selector) { + ZonesIter(JSRuntime* rt, ZoneSelector selector) : iterMarker(rt) { it = rt->zones.begin(); end = rt->zones.end(); @@ -375,13 +376,13 @@ class ZonesIter { } while (!done() && (*it)->usedByExclusiveThread); } - JS::Zone *get() const { + JS::Zone* get() const { JS_ASSERT(!done()); return *it; } - operator JS::Zone *() const { return get(); } - JS::Zone *operator->() const { return get(); } + operator JS::Zone*() const { return get(); } + JS::Zone* operator->() const { return get(); } }; struct CompartmentsInZoneIter @@ -389,15 +390,15 @@ struct CompartmentsInZoneIter // This is for the benefit of CompartmentsIterT::comp. friend class mozilla::Maybe; private: - JS::Zone *zone; - JSCompartment **it; + JS::Zone* zone; + JSCompartment** it; CompartmentsInZoneIter() : zone(nullptr), it(nullptr) {} public: - explicit CompartmentsInZoneIter(JS::Zone *zone) : zone(zone) { + explicit CompartmentsInZoneIter(JS::Zone* zone) : zone(zone) { it = zone->compartments.begin(); } @@ -411,13 +412,13 @@ struct CompartmentsInZoneIter it++; } - JSCompartment *get() const { + JSCompartment* get() const { JS_ASSERT(it); return *it; } - operator JSCompartment *() const { return get(); } - JSCompartment *operator->() const { return get(); } + operator JSCompartment*() const { return get(); } + JSCompartment* operator->() const { return get(); } }; /* @@ -427,13 +428,13 @@ struct CompartmentsInZoneIter template class CompartmentsIterT { - private: + gc::AutoEnterIteration iterMarker; ZonesIterT zone; mozilla::Maybe comp; public: - explicit CompartmentsIterT(JSRuntime *rt) - : zone(rt) + explicit CompartmentsIterT(JSRuntime* rt) + : iterMarker(rt), zone(rt) { if (zone.done()) comp.construct(); @@ -441,8 +442,8 @@ class CompartmentsIterT comp.construct(zone); } - CompartmentsIterT(JSRuntime *rt, ZoneSelector selector) - : zone(rt, selector) + CompartmentsIterT(JSRuntime* rt, ZoneSelector selector) + : iterMarker(rt), zone(rt, selector) { if (zone.done()) comp.construct(); @@ -464,13 +465,13 @@ class CompartmentsIterT } } - JSCompartment *get() const { + JSCompartment* get() const { JS_ASSERT(!done()); return comp.ref(); } - operator JSCompartment *() const { return get(); } - JSCompartment *operator->() const { return get(); } + operator JSCompartment*() const { return get(); } + JSCompartment* operator->() const { return get(); } }; typedef CompartmentsIterT CompartmentsIter; diff --git a/js/src/gdb/gdb-tests.cpp b/js/src/gdb/gdb-tests.cpp index 53816d6b24..74cfb83f36 100644 --- a/js/src/gdb/gdb-tests.cpp +++ b/js/src/gdb/gdb-tests.cpp @@ -22,8 +22,8 @@ const JSClass global_class = { }; template -static inline T * -checkPtr(T *ptr) +static inline T* +checkPtr(T* ptr) { if (! ptr) abort(); @@ -38,7 +38,7 @@ checkBool(bool success) } /* The error reporter callback. */ -void reportError(JSContext *cx, const char *message, JSErrorReport *report) +void reportError(JSContext* cx, const char* message, JSErrorReport* report) { fprintf(stderr, "%s:%u: %s\n", report->filename ? report->filename : "", @@ -56,17 +56,17 @@ void breakpoint() { fprintf(stderr, "Called " __FILE__ ":breakpoint\n"); } -GDBFragment *GDBFragment::allFragments = nullptr; +GDBFragment* GDBFragment::allFragments = nullptr; int -main (int argc, const char **argv) +main (int argc, const char** argv) { if (!JS_Init()) return 1; - JSRuntime *runtime = checkPtr(JS_NewRuntime(1024 * 1024, JS_USE_HELPER_THREADS)); + JSRuntime* runtime = checkPtr(JS_NewRuntime(1024 * 1024, JS_USE_HELPER_THREADS)); JS_SetGCParameter(runtime, JSGC_MAX_BYTES, 0xffffffff); JS_SetNativeStackQuota(runtime, 5000000); - JSContext *cx = checkPtr(JS_NewContext(runtime, 8192)); + JSContext* cx = checkPtr(JS_NewContext(runtime, 8192)); JS_SetErrorReporter(cx, reportError); JSAutoRequest ar(cx); @@ -86,8 +86,8 @@ main (int argc, const char **argv) argv++; while (*argv) { - const char *name = *argv++; - GDBFragment *fragment; + const char* name = *argv++; + GDBFragment* fragment; for (fragment = GDBFragment::allFragments; fragment; fragment = fragment->next) { if (strcmp(fragment->name(), name) == 0) { fragment->run(cx, argv); diff --git a/js/src/gdb/gdb-tests.h b/js/src/gdb/gdb-tests.h index 01aa644a18..ad9cd093b0 100644 --- a/js/src/gdb/gdb-tests.h +++ b/js/src/gdb/gdb-tests.h @@ -32,21 +32,21 @@ struct GDBFragment { // The name of this fragment. gdb-tests.cpp runs the fragments whose names // are passed to it on the command line. - virtual const char *name() = 0; + virtual const char* name() = 0; // Run the fragment code. |argv| is a reference to the pointer into the // command-line argument vector, referring to the argument immediately // following this fragment's name. The fragment can consume arguments and // advance argv if it wishes. - virtual void run(JSContext *cx, const char **&argv) = 0; + virtual void run(JSContext* cx, const char**& argv) = 0; // We declare one instance of this type for each fragment to run. The // constructor adds each instance to a linked list, of which this is // the head. - static GDBFragment *allFragments; + static GDBFragment* allFragments; // The link in the list of all instances. - GDBFragment *next; + GDBFragment* next; }; // Macro for declaring a C++ fragment for some Python unit test to call. Usage: @@ -57,16 +57,16 @@ struct GDBFragment { // takes a series of fragment names as command-line arguments and runs them in // turn; each fragment is named . on the command line. // -// The body runs in a scope where 'cx' is a usable JSContext *. +// The body runs in a scope where 'cx' is a usable JSContext*. #define FRAGMENT(category, subname) \ class FRAGMENT_CLASS_NAME(category, subname): public GDBFragment { \ - void run(JSContext *cx, const char **&argv); \ - const char *name() { return FRAGMENT_STRING_NAME(category, subname); } \ + void run(JSContext* cx, const char**& argv); \ + const char* name() { return FRAGMENT_STRING_NAME(category, subname); } \ static FRAGMENT_CLASS_NAME(category, subname) singleton; \ }; \ FRAGMENT_CLASS_NAME(category, subname) FRAGMENT_CLASS_NAME(category, subname)::singleton; \ -void FRAGMENT_CLASS_NAME(category, subname)::run(JSContext *cx, const char **&argv) +void FRAGMENT_CLASS_NAME(category, subname)::run(JSContext* cx, const char**& argv) #define FRAGMENT_STRING_NAME(category, subname) (#category "." #subname) #define FRAGMENT_CLASS_NAME(category, subname) Fragment_ ## category ## _ ## subname diff --git a/js/src/gdb/tests/test-JSObject.cpp b/js/src/gdb/tests/test-JSObject.cpp index 8b48a8291f..9423306f23 100644 --- a/js/src/gdb/tests/test-JSObject.cpp +++ b/js/src/gdb/tests/test-JSObject.cpp @@ -2,19 +2,19 @@ #include "jsapi.h" FRAGMENT(JSObject, simple) { - JS::Rooted glob(cx, JS::CurrentGlobalOrNull(cx)); - JS::Rooted plain(cx, JS_NewObject(cx, nullptr, JS::NullPtr(), JS::NullPtr())); - JS::Rooted global(cx, JS::CurrentGlobalOrNull(cx)); - JS::Rooted func(cx, (JSObject *) JS_NewFunction(cx, (JSNative) 1, 0, 0, + JS::Rooted glob(cx, JS::CurrentGlobalOrNull(cx)); + JS::Rooted plain(cx, JS_NewObject(cx, nullptr, JS::NullPtr(), JS::NullPtr())); + JS::Rooted global(cx, JS::CurrentGlobalOrNull(cx)); + JS::Rooted func(cx, (JSObject*) JS_NewFunction(cx, (JSNative) 1, 0, 0, global, "dys")); - JS::Rooted anon(cx, (JSObject *) JS_NewFunction(cx, (JSNative) 1, 0, 0, global, 0)); - JS::Rooted funcPtr(cx, JS_NewFunction(cx, (JSNative) 1, 0, 0, + JS::Rooted anon(cx, (JSObject*) JS_NewFunction(cx, (JSNative) 1, 0, 0, global, 0)); + JS::Rooted funcPtr(cx, JS_NewFunction(cx, (JSNative) 1, 0, 0, global, "formFollows")); - JSObject &plainRef = *plain; - JSFunction &funcRef = *funcPtr; - JSObject *plainRaw = plain; - JSObject *funcRaw = func; + JSObject& plainRef = *plain; + JSFunction& funcRef = *funcPtr; + JSObject* plainRaw = plain; + JSObject* funcRaw = func; breakpoint(); @@ -30,8 +30,8 @@ FRAGMENT(JSObject, simple) { } FRAGMENT(JSObject, null) { - JS::Rooted null(cx, nullptr); - JSObject *nullRaw = null; + JS::Rooted null(cx, nullptr); + JSObject* nullRaw = null; breakpoint(); diff --git a/js/src/gdb/tests/test-JSString.cpp b/js/src/gdb/tests/test-JSString.cpp index cb04afc862..679640bc77 100644 --- a/js/src/gdb/tests/test-JSString.cpp +++ b/js/src/gdb/tests/test-JSString.cpp @@ -7,25 +7,25 @@ #include "vm/String.h" FRAGMENT(JSString, simple) { - JS::Rooted empty(cx, JS_NewStringCopyN(cx, nullptr, 0)); - JS::Rooted x(cx, JS_NewStringCopyN(cx, "x", 1)); - JS::Rooted z(cx, JS_NewStringCopyZ(cx, "z")); + JS::Rooted empty(cx, JS_NewStringCopyN(cx, nullptr, 0)); + JS::Rooted x(cx, JS_NewStringCopyN(cx, "x", 1)); + JS::Rooted z(cx, JS_NewStringCopyZ(cx, "z")); // I expect this will be a non-inlined string. - JS::Rooted stars(cx, JS_NewStringCopyZ(cx, + JS::Rooted stars(cx, JS_NewStringCopyZ(cx, "*************************" "*************************" "*************************" "*************************")); // This may well be an inlined string. - JS::Rooted xz(cx, JS_ConcatStrings(cx, x, z)); + JS::Rooted xz(cx, JS_ConcatStrings(cx, x, z)); // This will probably be a rope. - JS::Rooted doubleStars(cx, JS_ConcatStrings(cx, stars, stars)); + JS::Rooted doubleStars(cx, JS_ConcatStrings(cx, stars, stars)); // Ensure we're not confused by typedefs for pointer types. - JSString *xRaw = x; + JSString* xRaw = x; breakpoint(); @@ -39,8 +39,8 @@ FRAGMENT(JSString, simple) { } FRAGMENT(JSString, null) { - JS::Rooted null(cx, nullptr); - JSString *nullRaw = null; + JS::Rooted null(cx, nullptr); + JSString* nullRaw = null; breakpoint(); @@ -49,7 +49,7 @@ FRAGMENT(JSString, null) { } FRAGMENT(JSString, subclasses) { - JS::Rooted flat(cx, JS_FlattenString(cx, JS_NewStringCopyZ(cx, "Hi!"))); + JS::Rooted flat(cx, JS_FlattenString(cx, JS_NewStringCopyZ(cx, "Hi!"))); breakpoint(); @@ -57,7 +57,7 @@ FRAGMENT(JSString, subclasses) { } FRAGMENT(JSString, atom) { - JSAtom *molybdenum = js::Atomize(cx, "molybdenum", 10); + JSAtom* molybdenum = js::Atomize(cx, "molybdenum", 10); breakpoint(); (void) molybdenum; diff --git a/js/src/gdb/tests/test-Root.cpp b/js/src/gdb/tests/test-Root.cpp index 86f33cc527..7cadd9e0c3 100644 --- a/js/src/gdb/tests/test-Root.cpp +++ b/js/src/gdb/tests/test-Root.cpp @@ -2,14 +2,14 @@ #include "jsapi.h" FRAGMENT(Root, null) { - JS::Rooted null(cx, nullptr); + JS::Rooted null(cx, nullptr); breakpoint(); (void) null; } -void callee(JS::Handle obj, JS::MutableHandle mutableObj) +void callee(JS::Handle obj, JS::MutableHandle mutableObj) { // Prevent the linker from unifying this function with others that are // equivalent in machine code but not type. @@ -18,14 +18,14 @@ void callee(JS::Handle obj, JS::MutableHandle mutableObj } FRAGMENT(Root, handle) { - JS::Rooted global(cx, JS::CurrentGlobalOrNull(cx)); + JS::Rooted global(cx, JS::CurrentGlobalOrNull(cx)); callee(global, &global); (void) global; } FRAGMENT(Root, HeapSlot) { JS::Rooted plinth(cx, STRING_TO_JSVAL(JS_NewStringCopyZ(cx, "plinth"))); - JS::Rooted array(cx, JS_NewArrayObject(cx, plinth)); + JS::Rooted array(cx, JS_NewArrayObject(cx, plinth)); breakpoint(); diff --git a/js/src/gdb/tests/test-jsid.cpp b/js/src/gdb/tests/test-jsid.cpp index dcab84ef37..69df149054 100644 --- a/js/src/gdb/tests/test-jsid.cpp +++ b/js/src/gdb/tests/test-jsid.cpp @@ -2,8 +2,8 @@ #include "jsapi.h" FRAGMENT(jsid, simple) { - JS::Rooted string(cx, JS_NewStringCopyZ(cx, "moon")); - JS::Rooted interned(cx, JS_InternJSString(cx, string)); + JS::Rooted string(cx, JS_NewStringCopyZ(cx, "moon")); + JS::Rooted interned(cx, JS_InternJSString(cx, string)); JS::Rooted string_id(cx, INTERNED_STRING_TO_JSID(cx, interned)); jsid int_id = INT_TO_JSID(1729); jsid void_id = JSID_VOID; @@ -30,8 +30,8 @@ jsid_handles(JS::Handle jsid_handle, } FRAGMENT(jsid, handles) { - JS::Rooted string(cx, JS_NewStringCopyZ(cx, "shovel")); - JS::Rooted interned(cx, JS_InternJSString(cx, string)); + JS::Rooted string(cx, JS_NewStringCopyZ(cx, "shovel")); + JS::Rooted interned(cx, JS_InternJSString(cx, string)); JS::Rooted string_id(cx, INTERNED_STRING_TO_JSID(cx, interned)); jsid_handles(string_id, &string_id); } diff --git a/js/src/jit/AliasAnalysis.cpp b/js/src/jit/AliasAnalysis.cpp index 518c5ce81d..3a1e50c56f 100644 --- a/js/src/jit/AliasAnalysis.cpp +++ b/js/src/jit/AliasAnalysis.cpp @@ -25,28 +25,28 @@ namespace jit { class LoopAliasInfo : public TempObject { private: - LoopAliasInfo *outer_; - MBasicBlock *loopHeader_; + LoopAliasInfo* outer_; + MBasicBlock* loopHeader_; MDefinitionVector invariantLoads_; public: - LoopAliasInfo(TempAllocator &alloc, LoopAliasInfo *outer, MBasicBlock *loopHeader) + LoopAliasInfo(TempAllocator& alloc, LoopAliasInfo* outer, MBasicBlock* loopHeader) : outer_(outer), loopHeader_(loopHeader), invariantLoads_(alloc) { } - MBasicBlock *loopHeader() const { + MBasicBlock* loopHeader() const { return loopHeader_; } - LoopAliasInfo *outer() const { + LoopAliasInfo* outer() const { return outer_; } - bool addInvariantLoad(MDefinition *ins) { + bool addInvariantLoad(MDefinition* ins) { return invariantLoads_.append(ins); } const MDefinitionVector& invariantLoads() const { return invariantLoads_; } - MDefinition *firstInstruction() const { + MDefinition* firstInstruction() const { return *loopHeader_->begin(); } }; @@ -82,7 +82,7 @@ class AliasSetIterator operator bool() const { return !!flags; } - unsigned operator *() const { + unsigned operator*() const { JS_ASSERT(pos < AliasSet::NumCategories); return pos; } @@ -90,7 +90,7 @@ class AliasSetIterator } /* anonymous namespace */ -AliasAnalysis::AliasAnalysis(MIRGenerator *mir, MIRGraph &graph) +AliasAnalysis::AliasAnalysis(MIRGenerator* mir, MIRGraph& graph) : mir(mir), graph_(graph), loop_(nullptr) @@ -100,7 +100,7 @@ AliasAnalysis::AliasAnalysis(MIRGenerator *mir, MIRGraph &graph) // Whether there might be a path from src to dest, excluding loop backedges. This is // approximate and really ought to depend on precomputed reachability information. static inline bool -BlockMightReach(MBasicBlock *src, MBasicBlock *dest) +BlockMightReach(MBasicBlock* src, MBasicBlock* dest) { while (src->id() <= dest->id()) { if (src == dest) @@ -109,7 +109,7 @@ BlockMightReach(MBasicBlock *src, MBasicBlock *dest) case 0: return false; case 1: { - MBasicBlock *successor = src->getSuccessor(0); + MBasicBlock* successor = src->getSuccessor(0); if (successor->id() <= src->id()) return true; // Don't iloop. src = successor; @@ -123,7 +123,7 @@ BlockMightReach(MBasicBlock *src, MBasicBlock *dest) } static void -IonSpewDependency(MDefinition *load, MDefinition *store, const char *verb, const char *reason) +IonSpewDependency(MDefinition* load, MDefinition* store, const char* verb, const char* reason) { if (!IonSpewEnabled(IonSpew_Alias)) return; @@ -136,7 +136,7 @@ IonSpewDependency(MDefinition *load, MDefinition *store, const char *verb, const } static void -IonSpewAliasInfo(const char *pre, MDefinition *ins, const char *post) +IonSpewAliasInfo(const char* pre, MDefinition* ins, const char* post) { if (!IonSpewEnabled(IonSpew_Alias)) return; @@ -166,7 +166,7 @@ AliasAnalysis::analyze() Vector stores(alloc()); // Initialize to the first instruction. - MDefinition *firstIns = *graph_.begin()->begin(); + MDefinition* firstIns = *graph_.begin()->begin(); for (unsigned i = 0; i < AliasSet::NumCategories; i++) { MDefinitionVector defs(alloc()); if (!defs.append(firstIns)) @@ -209,12 +209,12 @@ AliasAnalysis::analyze() } } else { // Find the most recent store on which this instruction depends. - MDefinition *lastStore = firstIns; + MDefinition* lastStore = firstIns; for (AliasSetIterator iter(set); iter; iter++) { - MDefinitionVector &aliasedStores = stores[*iter]; + MDefinitionVector& aliasedStores = stores[*iter]; for (int i = aliasedStores.length() - 1; i >= 0; i--) { - MDefinition *store = aliasedStores[i]; + MDefinition* store = aliasedStores[i]; if (def->mightAlias(store) && BlockMightReach(store->block(), *block)) { if (lastStore->id() < store->id()) lastStore = store; @@ -243,21 +243,21 @@ AliasAnalysis::analyze() JS_ASSERT(loop_->loopHeader() == block->loopHeaderOfBackedge()); IonSpew(IonSpew_Alias, "Processing loop backedge %d (header %d)", block->id(), loop_->loopHeader()->id()); - LoopAliasInfo *outerLoop = loop_->outer(); - MInstruction *firstLoopIns = *loop_->loopHeader()->begin(); + LoopAliasInfo* outerLoop = loop_->outer(); + MInstruction* firstLoopIns = *loop_->loopHeader()->begin(); - const MDefinitionVector &invariant = loop_->invariantLoads(); + const MDefinitionVector& invariant = loop_->invariantLoads(); for (unsigned i = 0; i < invariant.length(); i++) { - MDefinition *ins = invariant[i]; + MDefinition* ins = invariant[i]; AliasSet set = ins->getAliasSet(); JS_ASSERT(set.isLoad()); bool hasAlias = false; for (AliasSetIterator iter(set); iter; iter++) { - MDefinitionVector &aliasedStores = stores[*iter]; + MDefinitionVector& aliasedStores = stores[*iter]; for (int i = aliasedStores.length() - 1;; i--) { - MDefinition *store = aliasedStores[i]; + MDefinition* store = aliasedStores[i]; if (store->id() < firstLoopIns->id()) break; if (ins->mightAlias(store)) { @@ -274,7 +274,7 @@ AliasAnalysis::analyze() // This instruction depends on stores inside the loop body. Mark it as having a // dependency on the last instruction of the loop header. The last instruction is a // control instruction and these are never hoisted. - MControlInstruction *controlIns = loop_->loopHeader()->lastIns(); + MControlInstruction* controlIns = loop_->loopHeader()->lastIns(); IonSpewDependency(ins, controlIns, "depends", "due to stores in loop body"); ins->setDependency(controlIns); } else { diff --git a/js/src/jit/AliasAnalysis.h b/js/src/jit/AliasAnalysis.h index 539ead836f..dc2500697e 100644 --- a/js/src/jit/AliasAnalysis.h +++ b/js/src/jit/AliasAnalysis.h @@ -18,16 +18,16 @@ class MIRGraph; class AliasAnalysis { - MIRGenerator *mir; - MIRGraph &graph_; - LoopAliasInfo *loop_; + MIRGenerator* mir; + MIRGraph& graph_; + LoopAliasInfo* loop_; - TempAllocator &alloc() const { + TempAllocator& alloc() const { return graph_.alloc(); } public: - AliasAnalysis(MIRGenerator *mir, MIRGraph &graph); + AliasAnalysis(MIRGenerator* mir, MIRGraph& graph); bool analyze(); }; diff --git a/js/src/jit/AsmJS.cpp b/js/src/jit/AsmJS.cpp index 1b8eed6263..e1bf652711 100644 --- a/js/src/jit/AsmJS.cpp +++ b/js/src/jit/AsmJS.cpp @@ -59,222 +59,222 @@ static const size_t LIFO_ALLOC_PRIMARY_CHUNK_SIZE = 1 << 12; /*****************************************************************************/ // ParseNode utilities -static inline ParseNode * -NextNode(ParseNode *pn) +static inline ParseNode* +NextNode(ParseNode* pn) { return pn->pn_next; } -static inline ParseNode * -UnaryKid(ParseNode *pn) +static inline ParseNode* +UnaryKid(ParseNode* pn) { JS_ASSERT(pn->isArity(PN_UNARY)); return pn->pn_kid; } -static inline ParseNode * -ReturnExpr(ParseNode *pn) +static inline ParseNode* +ReturnExpr(ParseNode* pn) { JS_ASSERT(pn->isKind(PNK_RETURN)); return UnaryKid(pn); } -static inline ParseNode * -BinaryRight(ParseNode *pn) +static inline ParseNode* +BinaryRight(ParseNode* pn) { JS_ASSERT(pn->isArity(PN_BINARY)); return pn->pn_right; } -static inline ParseNode * -BinaryLeft(ParseNode *pn) +static inline ParseNode* +BinaryLeft(ParseNode* pn) { JS_ASSERT(pn->isArity(PN_BINARY)); return pn->pn_left; } -static inline ParseNode * -TernaryKid1(ParseNode *pn) +static inline ParseNode* +TernaryKid1(ParseNode* pn) { JS_ASSERT(pn->isArity(PN_TERNARY)); return pn->pn_kid1; } -static inline ParseNode * -TernaryKid2(ParseNode *pn) +static inline ParseNode* +TernaryKid2(ParseNode* pn) { JS_ASSERT(pn->isArity(PN_TERNARY)); return pn->pn_kid2; } -static inline ParseNode * -TernaryKid3(ParseNode *pn) +static inline ParseNode* +TernaryKid3(ParseNode* pn) { JS_ASSERT(pn->isArity(PN_TERNARY)); return pn->pn_kid3; } -static inline ParseNode * -ListHead(ParseNode *pn) +static inline ParseNode* +ListHead(ParseNode* pn) { JS_ASSERT(pn->isArity(PN_LIST)); return pn->pn_head; } static inline unsigned -ListLength(ParseNode *pn) +ListLength(ParseNode* pn) { JS_ASSERT(pn->isArity(PN_LIST)); return pn->pn_count; } -static inline ParseNode * -CallCallee(ParseNode *pn) +static inline ParseNode* +CallCallee(ParseNode* pn) { JS_ASSERT(pn->isKind(PNK_CALL)); return ListHead(pn); } static inline unsigned -CallArgListLength(ParseNode *pn) +CallArgListLength(ParseNode* pn) { JS_ASSERT(pn->isKind(PNK_CALL)); JS_ASSERT(ListLength(pn) >= 1); return ListLength(pn) - 1; } -static inline ParseNode * -CallArgList(ParseNode *pn) +static inline ParseNode* +CallArgList(ParseNode* pn) { JS_ASSERT(pn->isKind(PNK_CALL)); return NextNode(ListHead(pn)); } -static inline ParseNode * -VarListHead(ParseNode *pn) +static inline ParseNode* +VarListHead(ParseNode* pn) { JS_ASSERT(pn->isKind(PNK_VAR) || pn->isKind(PNK_CONST)); return ListHead(pn); } -static inline ParseNode * -CaseExpr(ParseNode *pn) +static inline ParseNode* +CaseExpr(ParseNode* pn) { JS_ASSERT(pn->isKind(PNK_CASE) || pn->isKind(PNK_DEFAULT)); return BinaryLeft(pn); } -static inline ParseNode * -CaseBody(ParseNode *pn) +static inline ParseNode* +CaseBody(ParseNode* pn) { JS_ASSERT(pn->isKind(PNK_CASE) || pn->isKind(PNK_DEFAULT)); return BinaryRight(pn); } static inline bool -IsExpressionStatement(ParseNode *pn) +IsExpressionStatement(ParseNode* pn) { return pn->isKind(PNK_SEMI); } -static inline ParseNode * -ExpressionStatementExpr(ParseNode *pn) +static inline ParseNode* +ExpressionStatementExpr(ParseNode* pn) { JS_ASSERT(pn->isKind(PNK_SEMI)); return UnaryKid(pn); } -static inline PropertyName * -LoopControlMaybeLabel(ParseNode *pn) +static inline PropertyName* +LoopControlMaybeLabel(ParseNode* pn) { JS_ASSERT(pn->isKind(PNK_BREAK) || pn->isKind(PNK_CONTINUE)); JS_ASSERT(pn->isArity(PN_NULLARY)); return pn->as().label(); } -static inline PropertyName * -LabeledStatementLabel(ParseNode *pn) +static inline PropertyName* +LabeledStatementLabel(ParseNode* pn) { return pn->as().label(); } -static inline ParseNode * -LabeledStatementStatement(ParseNode *pn) +static inline ParseNode* +LabeledStatementStatement(ParseNode* pn) { return pn->as().statement(); } static double -NumberNodeValue(ParseNode *pn) +NumberNodeValue(ParseNode* pn) { JS_ASSERT(pn->isKind(PNK_NUMBER)); return pn->pn_dval; } static bool -NumberNodeHasFrac(ParseNode *pn) +NumberNodeHasFrac(ParseNode* pn) { JS_ASSERT(pn->isKind(PNK_NUMBER)); return pn->pn_u.number.decimalPoint == HasDecimal; } -static ParseNode * -DotBase(ParseNode *pn) +static ParseNode* +DotBase(ParseNode* pn) { JS_ASSERT(pn->isKind(PNK_DOT)); JS_ASSERT(pn->isArity(PN_NAME)); return pn->expr(); } -static PropertyName * -DotMember(ParseNode *pn) +static PropertyName* +DotMember(ParseNode* pn) { JS_ASSERT(pn->isKind(PNK_DOT)); JS_ASSERT(pn->isArity(PN_NAME)); return pn->pn_atom->asPropertyName(); } -static ParseNode * -ElemBase(ParseNode *pn) +static ParseNode* +ElemBase(ParseNode* pn) { JS_ASSERT(pn->isKind(PNK_ELEM)); return BinaryLeft(pn); } -static ParseNode * -ElemIndex(ParseNode *pn) +static ParseNode* +ElemIndex(ParseNode* pn) { JS_ASSERT(pn->isKind(PNK_ELEM)); return BinaryRight(pn); } -static inline JSFunction * -FunctionObject(ParseNode *fn) +static inline JSFunction* +FunctionObject(ParseNode* fn) { JS_ASSERT(fn->isKind(PNK_FUNCTION)); JS_ASSERT(fn->isArity(PN_CODE)); return fn->pn_funbox->function(); } -static inline PropertyName * -FunctionName(ParseNode *fn) +static inline PropertyName* +FunctionName(ParseNode* fn) { - if (JSAtom *atom = FunctionObject(fn)->atom()) + if (JSAtom* atom = FunctionObject(fn)->atom()) return atom->asPropertyName(); return nullptr; } -static inline ParseNode * -FunctionStatementList(ParseNode *fn) +static inline ParseNode* +FunctionStatementList(ParseNode* fn) { JS_ASSERT(fn->pn_body->isKind(PNK_ARGSBODY)); - ParseNode *last = fn->pn_body->last(); + ParseNode* last = fn->pn_body->last(); JS_ASSERT(last->isKind(PNK_STATEMENTLIST)); return last; } static inline bool -IsNormalObjectField(ExclusiveContext *cx, ParseNode *pn) +IsNormalObjectField(ExclusiveContext* cx, ParseNode* pn) { JS_ASSERT(pn->isKind(PNK_COLON)); return pn->getOp() == JSOP_INITPROP && @@ -282,70 +282,70 @@ IsNormalObjectField(ExclusiveContext *cx, ParseNode *pn) BinaryLeft(pn)->name() != cx->names().proto; } -static inline PropertyName * -ObjectNormalFieldName(ExclusiveContext *cx, ParseNode *pn) +static inline PropertyName* +ObjectNormalFieldName(ExclusiveContext* cx, ParseNode* pn) { JS_ASSERT(IsNormalObjectField(cx, pn)); return BinaryLeft(pn)->name(); } -static inline ParseNode * -ObjectFieldInitializer(ParseNode *pn) +static inline ParseNode* +ObjectFieldInitializer(ParseNode* pn) { JS_ASSERT(pn->isKind(PNK_COLON)); return BinaryRight(pn); } static inline bool -IsDefinition(ParseNode *pn) +IsDefinition(ParseNode* pn) { return pn->isKind(PNK_NAME) && pn->isDefn(); } -static inline ParseNode * -MaybeDefinitionInitializer(ParseNode *pn) +static inline ParseNode* +MaybeDefinitionInitializer(ParseNode* pn) { JS_ASSERT(IsDefinition(pn)); return pn->expr(); } static inline bool -IsUseOfName(ParseNode *pn, PropertyName *name) +IsUseOfName(ParseNode* pn, PropertyName* name) { return pn->isKind(PNK_NAME) && pn->name() == name; } static inline bool -IsEmptyStatement(ParseNode *pn) +IsEmptyStatement(ParseNode* pn) { return pn->isKind(PNK_SEMI) && !UnaryKid(pn); } -static inline ParseNode * -SkipEmptyStatements(ParseNode *pn) +static inline ParseNode* +SkipEmptyStatements(ParseNode* pn) { while (pn && IsEmptyStatement(pn)) pn = pn->pn_next; return pn; } -static inline ParseNode * -NextNonEmptyStatement(ParseNode *pn) +static inline ParseNode* +NextNonEmptyStatement(ParseNode* pn) { return SkipEmptyStatements(pn->pn_next); } static TokenKind -PeekToken(AsmJSParser &parser) +PeekToken(AsmJSParser& parser) { - TokenStream &ts = parser.tokenStream; + TokenStream& ts = parser.tokenStream; while (ts.peekToken(TokenStream::Operand) == TOK_SEMI) ts.consumeKnownToken(TOK_SEMI); return ts.peekToken(TokenStream::Operand); } static bool -ParseVarOrConstStatement(AsmJSParser &parser, ParseNode **var) +ParseVarOrConstStatement(AsmJSParser& parser, ParseNode** var) { TokenKind tk = PeekToken(parser); if (tk != TOK_VAR && tk != TOK_CONST) { @@ -462,7 +462,7 @@ class Type MOZ_ASSUME_UNREACHABLE("Invalid Type"); } - const char *toChars() const { + const char* toChars() const { switch (which_) { case Double: return "double"; case MaybeDouble: return "double?"; @@ -642,18 +642,18 @@ template class ABIArgIter { ABIArgGenerator gen_; - const VecT &types_; + const VecT& types_; unsigned i_; void settle() { if (!done()) gen_.next(ToMIRType(types_[i_])); } public: - ABIArgIter(const VecT &types) : types_(types), i_(0) { settle(); } + ABIArgIter(const VecT& types) : types_(types), i_(0) { settle(); } void operator++(int) { JS_ASSERT(!done()); i_++; settle(); } bool done() const { return i_ == types_.length(); } - ABIArg *operator->() { JS_ASSERT(!done()); return &gen_.current(); } - ABIArg &operator*() { JS_ASSERT(!done()); return gen_.current(); } + ABIArg* operator->() { JS_ASSERT(!done()); return &gen_.current(); } + ABIArg& operator*() { JS_ASSERT(!done()); return gen_.current(); } unsigned index() const { JS_ASSERT(!done()); return i_; } MIRType mirType() const { JS_ASSERT(!done()); return ToMIRType(types_[i_]); } @@ -672,16 +672,16 @@ class Signature RetType retType_; public: - Signature(LifoAlloc &alloc) + Signature(LifoAlloc& alloc) : argTypes_(alloc) {} - Signature(LifoAlloc &alloc, RetType retType) + Signature(LifoAlloc& alloc, RetType retType) : argTypes_(alloc), retType_(retType) {} - Signature(VarTypeVector &&argTypes, RetType retType) + Signature(VarTypeVector&& argTypes, RetType retType) : argTypes_(Move(argTypes)), retType_(Move(retType)) {} - Signature(Signature &&rhs) + Signature(Signature&& rhs) : argTypes_(Move(rhs.argTypes_)), retType_(Move(rhs.retType_)) {} - bool copy(const Signature &rhs) { + bool copy(const Signature& rhs) { if (!argTypes_.resize(rhs.argTypes_.length())) return false; for (unsigned i = 0; i < argTypes_.length(); i++) @@ -692,8 +692,8 @@ class Signature bool appendArg(VarType type) { return argTypes_.append(type); } VarType arg(unsigned i) const { return argTypes_[i]; } - const VarTypeVector &args() const { return argTypes_; } - VarTypeVector &&extractArgs() { return Move(argTypes_); } + const VarTypeVector& args() const { return argTypes_; } + VarTypeVector&& extractArgs() { return Move(argTypes_); } RetType retType() const { return retType_; } }; @@ -701,7 +701,7 @@ class Signature } /* namespace anonymous */ static -bool operator==(const Signature &lhs, const Signature &rhs) +bool operator==(const Signature& lhs, const Signature& rhs) { if (lhs.retType() != rhs.retType()) return false; @@ -715,7 +715,7 @@ bool operator==(const Signature &lhs, const Signature &rhs) } static inline -bool operator!=(const Signature &lhs, const Signature &rhs) +bool operator!=(const Signature& lhs, const Signature& rhs) { return !(lhs == rhs); } @@ -817,21 +817,21 @@ class MOZ_STACK_CLASS ModuleCompiler public: class Func { - PropertyName *name_; + PropertyName* name_; bool defined_; uint32_t srcOffset_; uint32_t endOffset_; Signature sig_; - Label *code_; + Label* code_; unsigned compileTime_; public: - Func(PropertyName *name, Signature &&sig, Label *code) + Func(PropertyName* name, Signature&& sig, Label* code) : name_(name), defined_(false), srcOffset_(0), endOffset_(0), sig_(Move(sig)), code_(code), compileTime_(0) {} - PropertyName *name() const { return name_; } + PropertyName* name() const { return name_; } bool defined() const { return defined_; } void finish(uint32_t start, uint32_t end) { @@ -843,9 +843,9 @@ class MOZ_STACK_CLASS ModuleCompiler uint32_t srcOffset() const { JS_ASSERT(defined_); return srcOffset_; } uint32_t endOffset() const { JS_ASSERT(defined_); return endOffset_; } - Signature &sig() { return sig_; } - const Signature &sig() const { return sig_; } - Label *code() const { return code_; } + Signature& sig() { return sig_; } + const Signature& sig() const { return sig_; } + Label* code() const { return code_; } unsigned compileTime() const { return compileTime_; } void accumulateCompileTime(unsigned ms) { compileTime_ += ms; } }; @@ -935,53 +935,53 @@ class MOZ_STACK_CLASS ModuleCompiler FuncPtrVector elems_; public: - FuncPtrTable(ExclusiveContext *cx, Signature &&sig, uint32_t mask, uint32_t gdo) + FuncPtrTable(ExclusiveContext* cx, Signature&& sig, uint32_t mask, uint32_t gdo) : sig_(Move(sig)), mask_(mask), globalDataOffset_(gdo), elems_(cx) {} - FuncPtrTable(FuncPtrTable &&rhs) + FuncPtrTable(FuncPtrTable&& rhs) : sig_(Move(rhs.sig_)), mask_(rhs.mask_), globalDataOffset_(rhs.globalDataOffset_), elems_(Move(rhs.elems_)) {} - Signature &sig() { return sig_; } - const Signature &sig() const { return sig_; } + Signature& sig() { return sig_; } + const Signature& sig() const { return sig_; } unsigned mask() const { return mask_; } unsigned globalDataOffset() const { return globalDataOffset_; } bool initialized() const { return !elems_.empty(); } - void initElems(FuncPtrVector &&elems) { elems_ = Move(elems); JS_ASSERT(initialized()); } + void initElems(FuncPtrVector&& elems) { elems_ = Move(elems); JS_ASSERT(initialized()); } unsigned numElems() const { JS_ASSERT(initialized()); return elems_.length(); } - const Func &elem(unsigned i) const { return *elems_[i]; } + const Func& elem(unsigned i) const { return *elems_[i]; } }; typedef js::Vector FuncPtrTableVector; class ExitDescriptor { - PropertyName *name_; + PropertyName* name_; Signature sig_; public: - ExitDescriptor(PropertyName *name, Signature &&sig) + ExitDescriptor(PropertyName* name, Signature&& sig) : name_(name), sig_(Move(sig)) {} - ExitDescriptor(ExitDescriptor &&rhs) + ExitDescriptor(ExitDescriptor&& rhs) : name_(rhs.name_), sig_(Move(rhs.sig_)) {} - const Signature &sig() const { + const Signature& sig() const { return sig_; } // ExitDescriptor is a HashPolicy: typedef ExitDescriptor Lookup; - static HashNumber hash(const ExitDescriptor &d) { + static HashNumber hash(const ExitDescriptor& d) { HashNumber hn = HashGeneric(d.name_, d.sig_.retType().which()); - const VarTypeVector &args = d.sig_.args(); + const VarTypeVector& args = d.sig_.args(); for (unsigned i = 0; i < args.length(); i++) hn = AddToHash(hn, args[i].which()); return hn; } - static bool match(const ExitDescriptor &lhs, const ExitDescriptor &rhs) { + static bool match(const ExitDescriptor& lhs, const ExitDescriptor& rhs) { return lhs.name_ == rhs.name_ && lhs.sig_ == rhs.sig_; } }; @@ -1010,7 +1010,7 @@ class MOZ_STACK_CLASS ModuleCompiler private: struct SlowFunction { - PropertyName *name; + PropertyName* name; unsigned ms; unsigned line; unsigned column; @@ -1049,15 +1049,15 @@ class MOZ_STACK_CLASS ModuleCompiler DebugOnly finishedFunctionBodies_; - bool addStandardLibraryMathName(const char *name, AsmJSMathBuiltinFunction func) { - JSAtom *atom = Atomize(cx_, name, strlen(name)); + bool addStandardLibraryMathName(const char* name, AsmJSMathBuiltinFunction func) { + JSAtom* atom = Atomize(cx_, name, strlen(name)); if (!atom) return false; MathBuiltin builtin(func); return standardLibraryMathNames_.putNew(atom->asPropertyName(), builtin); } - bool addStandardLibraryMathName(const char *name, double cst) { - JSAtom *atom = Atomize(cx_, name, strlen(name)); + bool addStandardLibraryMathName(const char* name, double cst) { + JSAtom* atom = Atomize(cx_, name, strlen(name)); if (!atom) return false; MathBuiltin builtin(cst); @@ -1065,7 +1065,7 @@ class MOZ_STACK_CLASS ModuleCompiler } public: - ModuleCompiler(ExclusiveContext *cx, AsmJSParser &parser) + ModuleCompiler(ExclusiveContext* cx, AsmJSParser& parser) : cx_(cx), parser_(parser), masm_(MacroAssembler::AsmJSToken()), @@ -1155,7 +1155,7 @@ class MOZ_STACK_CLASS ModuleCompiler return true; } - bool failOffset(uint32_t offset, const char *str) { + bool failOffset(uint32_t offset, const char* str) { JS_ASSERT(!errorString_); JS_ASSERT(errorOffset_ == UINT32_MAX); JS_ASSERT(str); @@ -1164,7 +1164,7 @@ class MOZ_STACK_CLASS ModuleCompiler return false; } - bool fail(ParseNode *pn, const char *str) { + bool fail(ParseNode* pn, const char* str) { if (pn) return failOffset(pn->pn_pos.begin, str); @@ -1176,7 +1176,7 @@ class MOZ_STACK_CLASS ModuleCompiler return failOffset(tokenStream().peekTokenPos().begin, str); } - bool failfVA(ParseNode *pn, const char *fmt, va_list ap) { + bool failfVA(ParseNode* pn, const char* fmt, va_list ap) { JS_ASSERT(!errorString_); JS_ASSERT(errorOffset_ == UINT32_MAX); JS_ASSERT(fmt); @@ -1185,7 +1185,7 @@ class MOZ_STACK_CLASS ModuleCompiler return false; } - bool failf(ParseNode *pn, const char *fmt, ...) { + bool failf(ParseNode* pn, const char* fmt, ...) { va_list ap; va_start(ap, fmt); failfVA(pn, fmt, ap); @@ -1193,7 +1193,7 @@ class MOZ_STACK_CLASS ModuleCompiler return false; } - bool failName(ParseNode *pn, const char *fmt, PropertyName *name) { + bool failName(ParseNode* pn, const char* fmt, PropertyName* name) { // This function is invoked without the caller properly rooting its locals. gc::AutoSuppressGC suppress(cx_); JSAutoByteString bytes; @@ -1209,7 +1209,7 @@ class MOZ_STACK_CLASS ModuleCompiler static const unsigned SLOW_FUNCTION_THRESHOLD_MS = 250; - bool maybeReportCompileTime(const Func &func) { + bool maybeReportCompileTime(const Func& func) { if (func.compileTime() < SLOW_FUNCTION_THRESHOLD_MS) return true; SlowFunction sf; @@ -1221,27 +1221,27 @@ class MOZ_STACK_CLASS ModuleCompiler /*************************************************** Read-only interface */ - ExclusiveContext *cx() const { return cx_; } - AsmJSParser &parser() const { return parser_; } - TokenStream &tokenStream() const { return parser_.tokenStream; } - MacroAssembler &masm() { return masm_; } - Label &stackOverflowLabel() { return stackOverflowLabel_; } - Label &interruptLabel() { return interruptLabel_; } + ExclusiveContext* cx() const { return cx_; } + AsmJSParser& parser() const { return parser_; } + TokenStream& tokenStream() const { return parser_.tokenStream; } + MacroAssembler& masm() { return masm_; } + Label& stackOverflowLabel() { return stackOverflowLabel_; } + Label& interruptLabel() { return interruptLabel_; } bool hasError() const { return errorString_ != nullptr; } - const AsmJSModule &module() const { return *module_.get(); } + const AsmJSModule& module() const { return *module_.get(); } uint32_t moduleStart() const { return module_->funcStart(); } - ParseNode *moduleFunctionNode() const { return moduleFunctionNode_; } - PropertyName *moduleFunctionName() const { return moduleFunctionName_; } + ParseNode* moduleFunctionNode() const { return moduleFunctionNode_; } + PropertyName* moduleFunctionName() const { return moduleFunctionName_; } - const Global *lookupGlobal(PropertyName *name) const { + const Global* lookupGlobal(PropertyName* name) const { if (GlobalMap::Ptr p = globals_.lookup(name)) return p->value(); return nullptr; } - Func *lookupFunction(PropertyName *name) { + Func* lookupFunction(PropertyName* name) { if (GlobalMap::Ptr p = globals_.lookup(name)) { - Global *value = p->value(); + Global* value = p->value(); if (value->which() == Global::Function) return functions_[value->funcIndex()]; } @@ -1250,16 +1250,16 @@ class MOZ_STACK_CLASS ModuleCompiler unsigned numFunctions() const { return functions_.length(); } - Func &function(unsigned i) { + Func& function(unsigned i) { return *functions_[i]; } unsigned numFuncPtrTables() const { return funcPtrTables_.length(); } - FuncPtrTable &funcPtrTable(unsigned i) { + FuncPtrTable& funcPtrTable(unsigned i) { return funcPtrTables_[i]; } - bool lookupStandardLibraryMathName(PropertyName *name, MathBuiltin *mathBuiltin) const { + bool lookupStandardLibraryMathName(PropertyName* name, MathBuiltin* mathBuiltin) const { if (MathNameMap::Ptr p = standardLibraryMathNames_.lookup(name)) { *mathBuiltin = p->value(); return true; @@ -1272,19 +1272,19 @@ class MOZ_STACK_CLASS ModuleCompiler /***************************************************** Mutable interface */ - void initModuleFunctionName(PropertyName *name) { moduleFunctionName_ = name; } + void initModuleFunctionName(PropertyName* name) { moduleFunctionName_ = name; } - void initGlobalArgumentName(PropertyName *n) { module_->initGlobalArgumentName(n); } - void initImportArgumentName(PropertyName *n) { module_->initImportArgumentName(n); } - void initBufferArgumentName(PropertyName *n) { module_->initBufferArgumentName(n); } + void initGlobalArgumentName(PropertyName* n) { module_->initGlobalArgumentName(n); } + void initImportArgumentName(PropertyName* n) { module_->initImportArgumentName(n); } + void initBufferArgumentName(PropertyName* n) { module_->initBufferArgumentName(n); } - bool addGlobalVarInit(PropertyName *varName, VarType type, const Value &v, bool isConst) { + bool addGlobalVarInit(PropertyName* varName, VarType type, const Value& v, bool isConst) { uint32_t index; if (!module_->addGlobalVarInit(v, type.toCoercion(), &index)) return false; Global::Which which = isConst ? Global::ConstantLiteral : Global::Variable; - Global *global = moduleLifo_.new_(which); + Global* global = moduleLifo_.new_(which); if (!global) return false; global->u.varOrConst.index_ = index; @@ -1294,14 +1294,14 @@ class MOZ_STACK_CLASS ModuleCompiler return globals_.putNew(varName, global); } - bool addGlobalVarImport(PropertyName *varName, PropertyName *fieldName, AsmJSCoercion coercion, + bool addGlobalVarImport(PropertyName* varName, PropertyName* fieldName, AsmJSCoercion coercion, bool isConst) { uint32_t index; if (!module_->addGlobalVarImport(fieldName, coercion, &index)) return false; Global::Which which = isConst ? Global::ConstantImport : Global::Variable; - Global *global = moduleLifo_.new_(which); + Global* global = moduleLifo_.new_(which); if (!global) return false; global->u.varOrConst.index_ = index; @@ -1309,15 +1309,15 @@ class MOZ_STACK_CLASS ModuleCompiler return globals_.putNew(varName, global); } - bool addFunction(PropertyName *name, Signature &&sig, Func **func) { + bool addFunction(PropertyName* name, Signature&& sig, Func** func) { JS_ASSERT(!finishedFunctionBodies_); - Global *global = moduleLifo_.new_(Global::Function); + Global* global = moduleLifo_.new_(Global::Function); if (!global) return false; global->u.funcIndex_ = functions_.length(); if (!globals_.putNew(name, global)) return false; - Label *code = moduleLifo_.new_