Changeset 252032 in webkit
- Timestamp:
- Nov 4, 2019 6:52:02 PM (4 years ago)
- Location:
- trunk
- Files:
-
- 1 added
- 1 deleted
- 34 edited
- 1 moved
Legend:
- Unmodified
- Added
- Removed
-
trunk/LayoutTests/ChangeLog
r252027 r252032 1 2019-11-04 Yusuke Suzuki <ysuzuki@apple.com> 2 3 [JSC] Introduce LinkTimeConstant mechanism 4 https://bugs.webkit.org/show_bug.cgi?id=153792 5 6 Reviewed by Saam Barati. 7 8 * inspector/debugger/tail-deleted-frames/tail-deleted-frames-this-value-expected.txt: 9 1 10 2019-11-04 Yury Semikhatsky <yurys@chromium.org> 2 11 -
trunk/LayoutTests/inspector/debugger/tail-deleted-frames/tail-deleted-frames-this-value-expected.txt
r249586 r252032 15 15 this: undefined 16 16 4: [P] Global Code 17 this: test-17 this: c - 18 18 RESUMED 19 19 -
trunk/Source/JavaScriptCore/CMakeLists.txt
r252024 r252032 523 523 bytecode/LLIntPrototypeLoadAdaptiveStructureWatchpoint.h 524 524 bytecode/LazyOperandValueProfile.h 525 bytecode/LinkTimeConstant.h 525 526 bytecode/MetadataTable.h 526 527 bytecode/ObjectAllocationProfile.h … … 530 531 bytecode/PropertyCondition.h 531 532 bytecode/PutByIdFlags.h 532 bytecode/SpecialPointer.h533 533 bytecode/SpeculatedType.h 534 534 bytecode/StructureSet.h -
trunk/Source/JavaScriptCore/ChangeLog
r252030 r252032 1 2019-11-04 Yusuke Suzuki <ysuzuki@apple.com> 2 3 [JSC] Introduce LinkTimeConstant mechanism 4 https://bugs.webkit.org/show_bug.cgi?id=153792 5 6 Reviewed by Saam Barati. 7 8 We are using private-name-variables of JSGlobalObject as a way to access to constants that are materialized per JSGlobalObject. 9 And we also have special-pointers and old link-time-constants to access to per JSGlobalObject constants. 10 We have bytecode intrinsic constants, but it is only available for per VM values. 11 12 However, these ones have multiple problems. 13 14 1. private-name-variables is too costly. We need to have an entry in JSGlobalObject's variable, this makes SymbolTable of JSGlobalObject large. 15 It also requires WatchpointSet to make it constant-fold in DFG. And accessing these variables from builtin JS takes op_resolve_scope and op_get_from_scope, 16 enlarging bytecode and slow in interpreter and baseline compared to just getting them as a constant register. 17 2. special-pointers are tailored to op_jne_ptr opcode, and not usable in the other bytecode since this is completely separate from VirtualRegister. 18 3. Old link-time-constants implementation is putting array of all link-time-constants on each UnlinkedCodeBlock, even if it is not used. If you increase # of 19 link-time-constant, it increases sizeof(UnlinkedCodeBlock). 20 21 In this patch, we introduce a new link-time-constant mechanism and remove the above old ones mostly. (private-name-variables still exists for WebCore and @assert). 22 We manage link-time-constants in BytecodeIntrinsicRegistry, and emit Int32:LinkTimeConstantID constant when generating an UnlinkedCodeBlock. Later, this constant 23 is alternated to an actual value when we link UnlinkedCodeBlock to CodeBlock with specific JSGlobalObject. private-name-variables accesses are now converted to 24 constant register so that it is very efficiently accessed and it reduces memory used for SymbolTable and WatchpointSet. op_jne_ptr takes link-time-constant 25 VirtualRegisters instead of special-pointers, so that we can remove special-pointers mechanism. We also replace old link-time-constants with new one, which reduces 26 sizeof(UnlinkedCodeBlock). 27 28 Furthermore, new link-time-constant supports lazy initialization by using LazyProperty in JSGlobalObject. This allows us to lazily generate many internal functions 29 that are previously initialized eagerly. This reduces # of allocated JSFunction significantly when initializing JSGlobalObject. 30 31 This patch also manually adds 256 to MarkedSpace's size-class. We empirically know that adding 256 here makes sequence of size-class better for memory consumption. 32 But this was achieved by adding `sizeof(UnlinkedFunctionCodeBlock)`. Now sizeof(UnlinkedFunctionCodeBlock) is changed by this patch, and this patch unintentionally 33 breaks that sequence. We should explicitly add 256 instead of adding sizeof(UnlinkedFunctionCodeBlock) adhocly. 34 35 * CMakeLists.txt: 36 * JavaScriptCore.xcodeproj/project.pbxproj: 37 * Scripts/wkbuiltins/builtins_generate_combined_header.py: 38 (generate_section_for_global_private_code_name_macro): 39 * Sources.txt: 40 * builtins/BuiltinNames.h: 41 * builtins/PromiseConstructor.js: 42 (nakedConstructor.Promise): 43 (nakedConstructor.InternalPromise): 44 (nakedConstructor.Promise.reject): Deleted. 45 (nakedConstructor.InternalPromise.reject): Deleted. 46 * bytecode/BytecodeDumper.cpp: 47 (JSC::CodeBlockBytecodeDumper<Block>::dumpConstants): 48 * bytecode/BytecodeIntrinsicRegistry.cpp: 49 (JSC::BytecodeIntrinsicRegistry::BytecodeIntrinsicRegistry): 50 (JSC::BytecodeIntrinsicRegistry::lookup const): 51 * bytecode/BytecodeIntrinsicRegistry.h: 52 (JSC::BytecodeIntrinsicRegistry::Entry::Entry): 53 (JSC::BytecodeIntrinsicRegistry::Entry::type const): 54 (JSC::BytecodeIntrinsicRegistry::Entry::linkTimeConstant const): 55 (JSC::BytecodeIntrinsicRegistry::Entry::emitter const): 56 * bytecode/BytecodeList.rb: 57 * bytecode/CodeBlock.cpp: 58 (JSC::CodeBlock::finishCreation): 59 (JSC::CodeBlock::setConstantRegisters): 60 * bytecode/Fits.h: 61 * bytecode/LinkTimeConstant.cpp: Renamed from Source/JavaScriptCore/bytecode/SpecialPointer.h. 62 (WTF::printInternal): 63 * bytecode/LinkTimeConstant.h: Added. 64 * bytecode/SpecialPointer.cpp: Removed. 65 * bytecode/UnlinkedCodeBlock.cpp: 66 (JSC::UnlinkedCodeBlock::UnlinkedCodeBlock): 67 * bytecode/UnlinkedCodeBlock.h: 68 (JSC::UnlinkedCodeBlock::addConstant): 69 (JSC::UnlinkedCodeBlock::registerIndexForLinkTimeConstant): Deleted. 70 * bytecompiler/BytecodeGenerator.cpp: 71 (JSC::BytecodeGenerator::BytecodeGenerator): 72 (JSC::BytecodeGenerator::emitJumpIfNotFunctionCall): 73 (JSC::BytecodeGenerator::emitJumpIfNotFunctionApply): 74 (JSC::BytecodeGenerator::emitExpectedFunctionSnippet): 75 (JSC::BytecodeGenerator::emitCallDefineProperty): 76 (JSC::BytecodeGenerator::emitGetAsyncIterator): 77 * bytecompiler/BytecodeGenerator.h: 78 * bytecompiler/NodesCodegen.cpp: 79 (JSC::ImportNode::emitBytecode): 80 (JSC::BytecodeIntrinsicNode::emitBytecode): 81 (JSC::promiseInternalFieldIndex): 82 (JSC::generatorInternalFieldIndex): 83 (JSC::asyncGeneratorInternalFieldIndex): 84 (JSC::FunctionNode::emitBytecode): 85 (JSC::ObjectPatternNode::bindValue const): 86 (JSC::ObjectSpreadExpressionNode::emitBytecode): 87 * dfg/DFGByteCodeParser.cpp: 88 (JSC::DFG::ByteCodeParser::parseBlock): 89 * heap/MarkedSpace.cpp: 90 * jit/JITOpcodes.cpp: 91 (JSC::JIT::emit_op_jneq_ptr): 92 * jit/JITOpcodes32_64.cpp: 93 (JSC::JIT::emit_op_jneq_ptr): 94 * llint/LowLevelInterpreter32_64.asm: 95 * llint/LowLevelInterpreter64.asm: 96 * parser/ASTBuilder.h: 97 (JSC::ASTBuilder::createResolve): 98 (JSC::ASTBuilder::makeFunctionCallNode): 99 * parser/NodeConstructors.h: 100 (JSC::BytecodeIntrinsicNode::BytecodeIntrinsicNode): 101 * parser/Nodes.h: 102 * runtime/CachedTypes.cpp: 103 (JSC::CachedCodeBlock<CodeBlockType>::decode const): 104 (JSC::CachedCodeBlock<CodeBlockType>::encode): 105 * runtime/JSCJSValue.h: 106 * runtime/JSGlobalObject.cpp: 107 (JSC::JSGlobalObject::JSGlobalObject): 108 (JSC::JSGlobalObject::init): 109 (JSC::JSGlobalObject::visitChildren): 110 * runtime/JSGlobalObject.h: 111 (JSC::JSGlobalObject::linkTimeConstant const): 112 (JSC::JSGlobalObject::callFunction const): Deleted. 113 (JSC::JSGlobalObject::applyFunction const): Deleted. 114 (JSC::JSGlobalObject::throwTypeErrorFunction const): Deleted. 115 (JSC::JSGlobalObject::newPromiseCapabilityFunction const): Deleted. 116 (JSC::JSGlobalObject::resolvePromiseFunction const): Deleted. 117 (JSC::JSGlobalObject::rejectPromiseFunction const): Deleted. 118 (JSC::JSGlobalObject::promiseProtoThenFunction const): Deleted. 119 (JSC::JSGlobalObject::regExpProtoExecFunction const): Deleted. 120 (JSC::JSGlobalObject::regExpProtoGlobalGetter const): Deleted. 121 (JSC::JSGlobalObject::regExpProtoUnicodeGetter const): Deleted. 122 (JSC::JSGlobalObject::actualPointerFor): Deleted. 123 (JSC::JSGlobalObject::jsCellForLinkTimeConstant): Deleted. 124 * runtime/JSGlobalObjectInlines.h: 125 (JSC::JSGlobalObject::throwTypeErrorFunction const): 126 (JSC::JSGlobalObject::newPromiseCapabilityFunction const): 127 (JSC::JSGlobalObject::resolvePromiseFunction const): 128 (JSC::JSGlobalObject::rejectPromiseFunction const): 129 (JSC::JSGlobalObject::promiseProtoThenFunction const): 130 (JSC::JSGlobalObject::regExpProtoExecFunction const): 131 (JSC::JSGlobalObject::regExpProtoGlobalGetter const): 132 (JSC::JSGlobalObject::regExpProtoUnicodeGetter const): 133 1 134 2019-11-04 Ross Kirsling <ross.kirsling@sony.com> 2 135 -
trunk/Source/JavaScriptCore/JavaScriptCore.xcodeproj/project.pbxproj
r252024 r252032 363 363 0F50AF3C193E8B3900674EE8 /* DFGStructureClobberState.h in Headers */ = {isa = PBXBuildFile; fileRef = 0F50AF3B193E8B3900674EE8 /* DFGStructureClobberState.h */; }; 364 364 0F5513A61D5A682C00C32BD8 /* FreeList.h in Headers */ = {isa = PBXBuildFile; fileRef = 0F5513A51D5A682A00C32BD8 /* FreeList.h */; settings = {ATTRIBUTES = (Private, ); }; }; 365 0F5541B21613C1FB00CE3E25 /* SpecialPointer.h in Headers */ = {isa = PBXBuildFile; fileRef = 0F5541B01613C1FB00CE3E25 /* SpecialPointer.h */; settings = {ATTRIBUTES = (Private, ); }; };366 365 0F55989817C86C5800A1E543 /* ToNativeFromValue.h in Headers */ = {isa = PBXBuildFile; fileRef = 0F55989717C86C5600A1E543 /* ToNativeFromValue.h */; settings = {ATTRIBUTES = (Private, ); }; }; 367 366 0F55F0F514D1063C00AC7649 /* AbstractPC.h in Headers */ = {isa = PBXBuildFile; fileRef = 0F55F0F214D1063600AC7649 /* AbstractPC.h */; settings = {ATTRIBUTES = (Private, ); }; }; … … 1814 1813 E35CA1561DBC3A5F00F83516 /* DOMJITAbstractHeap.h in Headers */ = {isa = PBXBuildFile; fileRef = E35CA1501DBC3A5600F83516 /* DOMJITAbstractHeap.h */; settings = {ATTRIBUTES = (Private, ); }; }; 1815 1814 E35E03601B7AB43E0073AD2A /* InspectorInstrumentationObject.h in Headers */ = {isa = PBXBuildFile; fileRef = E35E035E1B7AB43E0073AD2A /* InspectorInstrumentationObject.h */; settings = {ATTRIBUTES = (Private, ); }; }; 1815 E3637EE9236E56B00096BD0A /* LinkTimeConstant.h in Headers */ = {isa = PBXBuildFile; fileRef = E3637EE7236E56B00096BD0A /* LinkTimeConstant.h */; settings = {ATTRIBUTES = (Private, ); }; }; 1816 1816 E36B767022F8D61900D09818 /* WasmOMGForOSREntryPlan.h in Headers */ = {isa = PBXBuildFile; fileRef = E36B766F22F8D61100D09818 /* WasmOMGForOSREntryPlan.h */; }; 1817 1817 E36CC9472086314F0051FFD6 /* WasmCreationMode.h in Headers */ = {isa = PBXBuildFile; fileRef = E36CC9462086314F0051FFD6 /* WasmCreationMode.h */; settings = {ATTRIBUTES = (Private, ); }; }; … … 2587 2587 0F5513A51D5A682A00C32BD8 /* FreeList.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; path = FreeList.h; sourceTree = "<group>"; }; 2588 2588 0F5513A71D5A68CB00C32BD8 /* FreeList.cpp */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.cpp.cpp; path = FreeList.cpp; sourceTree = "<group>"; }; 2589 0F5541AF1613C1FB00CE3E25 /* SpecialPointer.cpp */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.cpp.cpp; path = SpecialPointer.cpp; sourceTree = "<group>"; };2590 0F5541B01613C1FB00CE3E25 /* SpecialPointer.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; path = SpecialPointer.h; sourceTree = "<group>"; };2591 2589 0F55989717C86C5600A1E543 /* ToNativeFromValue.h */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.c.h; path = ToNativeFromValue.h; sourceTree = "<group>"; }; 2592 2590 0F55C19317276E4600CEABFD /* DFGAbstractValue.cpp */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.cpp.cpp; name = DFGAbstractValue.cpp; path = dfg/DFGAbstractValue.cpp; sourceTree = "<group>"; }; … … 4938 4936 E35E035E1B7AB43E0073AD2A /* InspectorInstrumentationObject.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; path = InspectorInstrumentationObject.h; sourceTree = "<group>"; }; 4939 4937 E35E03611B7AB4850073AD2A /* InspectorInstrumentationObject.js */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.javascript; path = InspectorInstrumentationObject.js; sourceTree = "<group>"; }; 4938 E3637EE7236E56B00096BD0A /* LinkTimeConstant.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; path = LinkTimeConstant.h; sourceTree = "<group>"; }; 4939 E3637EE8236E56B00096BD0A /* LinkTimeConstant.cpp */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.cpp.cpp; path = LinkTimeConstant.cpp; sourceTree = "<group>"; }; 4940 4940 E36B766E22F8D61100D09818 /* WasmOMGForOSREntryPlan.cpp */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.cpp.cpp; path = WasmOMGForOSREntryPlan.cpp; sourceTree = "<group>"; }; 4941 4941 E36B766F22F8D61100D09818 /* WasmOMGForOSREntryPlan.h */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.c.h; path = WasmOMGForOSREntryPlan.h; sourceTree = "<group>"; }; … … 8241 8241 0FB5467814F5C468002C2989 /* LazyOperandValueProfile.cpp */, 8242 8242 0FB5467614F59AD1002C2989 /* LazyOperandValueProfile.h */, 8243 E3637EE8236E56B00096BD0A /* LinkTimeConstant.cpp */, 8244 E3637EE7236E56B00096BD0A /* LinkTimeConstant.h */, 8243 8245 0F0FC45814BD15F100B81154 /* LLIntCallLinkInfo.h */, 8244 8246 53FA2AE21CF380390022711D /* LLIntPrototypeLoadAdaptiveStructureWatchpoint.cpp */, … … 8288 8290 0FF60ABF16740F8100029779 /* ReduceWhitespace.cpp */, 8289 8291 0FF60AC016740F8100029779 /* ReduceWhitespace.h */, 8290 0F5541AF1613C1FB00CE3E25 /* SpecialPointer.cpp */,8291 0F5541B01613C1FB00CE3E25 /* SpecialPointer.h */,8292 8292 0FD82E84141F3FDA00179C94 /* SpeculatedType.cpp */, 8293 8293 0FD82E4F141DAEA100179C94 /* SpeculatedType.h */, … … 9848 9848 BC18C52E0E16FCE100B34460 /* Lexer.lut.h in Headers */, 9849 9849 86D3B3C310159D7F002865E7 /* LinkBuffer.h in Headers */, 9850 E3637EE9236E56B00096BD0A /* LinkTimeConstant.h in Headers */, 9850 9851 A7E2EA6B0FB460CF00601F06 /* LiteralParser.h in Headers */, 9851 9852 70DE9A091BE7D69E005D89D9 /* LLIntAssembly.h in Headers */, … … 10101 10102 0FB7F39E15ED8E4600F167B2 /* SparseArrayValueMap.h in Headers */, 10102 10103 A7386554118697B400540279 /* SpecializedThunkJIT.h in Headers */, 10103 0F5541B21613C1FB00CE3E25 /* SpecialPointer.h in Headers */,10104 10104 0FD82E54141DAEEE00179C94 /* SpeculatedType.h in Headers */, 10105 10105 A785F6BC18C553FE00F10626 /* SpillRegistersMode.h in Headers */, -
trunk/Source/JavaScriptCore/Scripts/wkbuiltins/builtins_generate_combined_header.py
r249509 r252032 173 173 for function in functions: 174 174 function_args = { 175 'varName': get_var_name(function),176 175 'funcName': function.function_name, 177 176 'codeName': BuiltinsGenerator.mangledNameForFunction(function), 178 177 } 179 178 180 lines.append(" macro(%( varName)s, %(funcName)s, %(codeName)s) \\" % function_args)179 lines.append(" macro(%(funcName)s, %(codeName)s) \\" % function_args) 181 180 182 181 return '\n'.join(lines) -
trunk/Source/JavaScriptCore/Sources.txt
r251886 r252032 245 245 bytecode/LLIntPrototypeLoadAdaptiveStructureWatchpoint.cpp 246 246 bytecode/LazyOperandValueProfile.cpp 247 bytecode/LinkTimeConstant.cpp 247 248 bytecode/MetadataTable.cpp 248 249 bytecode/MethodOfGettingAValueProfile.cpp … … 264 265 bytecode/RecordedStatuses.cpp 265 266 bytecode/ReduceWhitespace.cpp 266 bytecode/SpecialPointer.cpp267 267 bytecode/SpeculatedType.cpp 268 268 bytecode/StructureSet.cpp -
trunk/Source/JavaScriptCore/builtins/BuiltinNames.h
r251483 r252032 46 46 JSC_COMMON_BYTECODE_INTRINSIC_CONSTANTS_EACH_NAME(macro) \ 47 47 macro(add) \ 48 macro(applyFunction) \ 48 49 macro(arrayIteratorNextIndex) \ 49 50 macro(arrayIterationKind) \ … … 53 54 macro(arraySpeciesCreate) \ 54 55 macro(assert) \ 56 macro(callFunction) \ 55 57 macro(charCodeAt) \ 56 58 macro(executor) \ … … 74 76 macro(ownKeys) \ 75 77 macro(Set) \ 78 macro(throwTypeErrorFunction) \ 76 79 macro(typedArrayLength) \ 77 80 macro(typedArraySort) \ -
trunk/Source/JavaScriptCore/builtins/PromiseConstructor.js
r251671 r252032 238 238 var capturedPromise = promise; 239 239 240 // FIXME: We should allow using function-declaration here.241 // https://bugs.webkit.org/show_bug.cgi?id=203502242 var @reject = function @reject(reason) {243 return @rejectPromiseWithFirstResolvingFunctionCallCheck(capturedPromise, reason);244 };245 246 240 try { 247 241 executor( 248 242 function @resolve(resolution) { 249 243 return @resolvePromiseWithFirstResolvingFunctionCallCheck(capturedPromise, resolution); 250 }, @reject); 251 } catch (error) { 252 @reject(error); 244 }, 245 function @reject(reason) { 246 return @rejectPromiseWithFirstResolvingFunctionCallCheck(capturedPromise, reason); 247 }); 248 } catch (error) { 249 @rejectPromiseWithFirstResolvingFunctionCallCheck(promise, error); 253 250 } 254 251 … … 266 263 var promise = @createPromise(this, /* isInternalPromise */ true); 267 264 var capturedPromise = promise; 268 269 // FIXME: We should allow using function-declaration here.270 // https://bugs.webkit.org/show_bug.cgi?id=203502271 var @reject = function @reject(reason) {272 return @rejectPromiseWithFirstResolvingFunctionCallCheck(capturedPromise, reason);273 };274 265 275 266 try { … … 277 268 function @resolve(resolution) { 278 269 return @resolvePromiseWithFirstResolvingFunctionCallCheck(capturedPromise, resolution); 279 }, @reject); 280 } catch (error) { 281 @reject(error); 270 }, 271 function @reject(reason) { 272 return @rejectPromiseWithFirstResolvingFunctionCallCheck(capturedPromise, reason); 273 }); 274 } catch (error) { 275 @rejectPromiseWithFirstResolvingFunctionCallCheck(promise, error); 282 276 } 283 277 -
trunk/Source/JavaScriptCore/bytecode/BytecodeDumper.cpp
r251886 r252032 137 137 sourceCodeRepresentationDescription = ""; 138 138 break; 139 case SourceCodeRepresentation::LinkTimeConstant: 140 sourceCodeRepresentationDescription = ": in source as linke-time-constant"; 141 break; 139 142 } 140 143 this->m_out.printf(" k%u = %s%s\n", static_cast<unsigned>(i), toCString(constant.get()).data(), sourceCodeRepresentationDescription); -
trunk/Source/JavaScriptCore/bytecode/BytecodeIntrinsicRegistry.cpp
r250630 r252032 43 43 namespace JSC { 44 44 45 #define INITIALIZE_BYTECODE_INTRINSIC_NAMES_TO_SET(name) m_bytecodeIntrinsicMap.add(vm.propertyNames->builtinNames().name##PrivateName().impl(), &BytecodeIntrinsicNode::emit_intrinsic_##name); 45 #define INITIALIZE_BYTECODE_INTRINSIC_NAMES_TO_SET(name) m_bytecodeIntrinsicMap.add(vm.propertyNames->builtinNames().name##PrivateName().impl(), Entry(&BytecodeIntrinsicNode::emit_intrinsic_##name)); 46 #define INITIALIZE_BYTECODE_INTRINSIC_NAMES_TO_SET_FOR_LINK_TIME_CONSTANT(name, code) m_bytecodeIntrinsicMap.add(vm.propertyNames->builtinNames().name##PrivateName().impl(), JSC::LinkTimeConstant::name); 46 47 47 48 BytecodeIntrinsicRegistry::BytecodeIntrinsicRegistry(VM& vm) … … 51 52 JSC_COMMON_BYTECODE_INTRINSIC_FUNCTIONS_EACH_NAME(INITIALIZE_BYTECODE_INTRINSIC_NAMES_TO_SET) 52 53 JSC_COMMON_BYTECODE_INTRINSIC_CONSTANTS_EACH_NAME(INITIALIZE_BYTECODE_INTRINSIC_NAMES_TO_SET) 54 JSC_FOREACH_LINK_TIME_CONSTANTS(INITIALIZE_BYTECODE_INTRINSIC_NAMES_TO_SET_FOR_LINK_TIME_CONSTANT) 53 55 54 56 m_undefined.set(m_vm, jsUndefined()); … … 99 101 } 100 102 101 BytecodeIntrinsicNode::EmitterTypeBytecodeIntrinsicRegistry::lookup(const Identifier& ident) const103 Optional<BytecodeIntrinsicRegistry::Entry> BytecodeIntrinsicRegistry::lookup(const Identifier& ident) const 102 104 { 103 105 if (!ident.isPrivateName()) 104 return nullptr;106 return WTF::nullopt; 105 107 auto iterator = m_bytecodeIntrinsicMap.find(ident.impl()); 106 108 if (iterator == m_bytecodeIntrinsicMap.end()) 107 return nullptr;109 return WTF::nullopt; 108 110 return iterator->value; 109 111 } -
trunk/Source/JavaScriptCore/bytecode/BytecodeIntrinsicRegistry.h
r250630 r252032 36 36 class BytecodeIntrinsicNode; 37 37 class RegisterID; 38 enum class LinkTimeConstant : int32_t; 38 39 39 40 #define JSC_COMMON_BYTECODE_INTRINSIC_FUNCTIONS_EACH_NAME(macro) \ … … 138 139 typedef RegisterID* (BytecodeIntrinsicNode::* EmitterType)(BytecodeGenerator&, RegisterID*); 139 140 140 EmitterType lookup(const Identifier&) const; 141 enum class Type : uint8_t { 142 Emitter = 0, 143 LinkTimeConstant = 1, 144 }; 145 146 class Entry { 147 public: 148 Entry() 149 : m_type(Type::Emitter) 150 { 151 m_emitter = nullptr; 152 } 153 154 Entry(EmitterType emitter) 155 : m_type(Type::Emitter) 156 { 157 m_emitter = emitter; 158 } 159 160 Entry(LinkTimeConstant linkTimeConstant) 161 : m_type(Type::LinkTimeConstant) 162 { 163 m_linkTimeConstant = linkTimeConstant; 164 } 165 166 Type type() const { return m_type; } 167 LinkTimeConstant linkTimeConstant() const { return m_linkTimeConstant; } 168 EmitterType emitter() const { return m_emitter; } 169 170 private: 171 union { 172 EmitterType m_emitter; 173 LinkTimeConstant m_linkTimeConstant; 174 }; 175 Type m_type; 176 }; 177 178 Optional<Entry> lookup(const Identifier&) const; 141 179 142 180 #define JSC_DECLARE_BYTECODE_INTRINSIC_CONSTANT_GENERATORS(name) JSValue name##Value(BytecodeGenerator&); … … 146 184 private: 147 185 VM& m_vm; 148 HashMap<RefPtr<UniquedStringImpl>, E mitterType, IdentifierRepHash> m_bytecodeIntrinsicMap;186 HashMap<RefPtr<UniquedStringImpl>, Entry, IdentifierRepHash> m_bytecodeIntrinsicMap; 149 187 150 188 #define JSC_DECLARE_BYTECODE_INTRINSIC_CONSTANT_GENERATORS(name) Strong<Unknown> m_##name; -
trunk/Source/JavaScriptCore/bytecode/BytecodeList.rb
r252021 r252032 65 65 ] 66 66 67 namespace :Special do68 types [ :Pointer ]69 end70 71 67 templates [ 72 68 :WriteBarrier, … … 676 672 args: { 677 673 value: VirtualRegister, 678 specialPointer: Special::Pointer,674 specialPointer: VirtualRegister, 679 675 targetLabel: BoundLabel, 680 676 }, -
trunk/Source/JavaScriptCore/bytecode/CodeBlock.cpp
r252021 r252032 400 400 RETURN_IF_EXCEPTION(throwScope, false); 401 401 402 for (unsigned i = 0; i < LinkTimeConstantCount; i++) {403 LinkTimeConstant type = static_cast<LinkTimeConstant>(i);404 if (unsigned registerIndex = unlinkedCodeBlock->registerIndexForLinkTimeConstant(type))405 m_constantRegisters[registerIndex].set(vm, this, m_globalObject->jsCellForLinkTimeConstant(type));406 }407 408 402 // We already have the cloned symbol table for the module environment since we need to instantiate 409 403 // the module environments before linking the code block. We replace the stored symbol table with the already cloned one. … … 906 900 for (size_t i = 0; i < count; i++) { 907 901 JSValue constant = constants[i].get(); 908 909 if (!constant.isEmpty()) { 910 if (constant.isCell()) { 911 JSCell* cell = constant.asCell(); 912 if (SymbolTable* symbolTable = jsDynamicCast<SymbolTable*>(vm, cell)) { 913 if (m_unlinkedCode->wasCompiledWithTypeProfilerOpcodes()) { 914 ConcurrentJSLocker locker(symbolTable->m_lock); 915 symbolTable->prepareForTypeProfiling(locker); 902 switch (constantsSourceCodeRepresentation[i]) { 903 case SourceCodeRepresentation::LinkTimeConstant: 904 constant = globalObject->linkTimeConstant(static_cast<LinkTimeConstant>(constant.asInt32AsAnyInt())); 905 break; 906 case SourceCodeRepresentation::Other: 907 case SourceCodeRepresentation::Integer: 908 case SourceCodeRepresentation::Double: 909 if (!constant.isEmpty()) { 910 if (constant.isCell()) { 911 JSCell* cell = constant.asCell(); 912 if (SymbolTable* symbolTable = jsDynamicCast<SymbolTable*>(vm, cell)) { 913 if (m_unlinkedCode->wasCompiledWithTypeProfilerOpcodes()) { 914 ConcurrentJSLocker locker(symbolTable->m_lock); 915 symbolTable->prepareForTypeProfiling(locker); 916 } 917 918 SymbolTable* clone = symbolTable->cloneScopePart(vm); 919 if (wasCompiledWithDebuggingOpcodes()) 920 clone->setRareDataCodeBlock(this); 921 922 constant = clone; 923 } else if (auto* descriptor = jsDynamicCast<JSTemplateObjectDescriptor*>(vm, cell)) { 924 auto* templateObject = topLevelExecutable->createTemplateObject(globalObject, descriptor); 925 RETURN_IF_EXCEPTION(scope, void()); 926 constant = templateObject; 916 927 } 917 918 SymbolTable* clone = symbolTable->cloneScopePart(vm);919 if (wasCompiledWithDebuggingOpcodes())920 clone->setRareDataCodeBlock(this);921 922 constant = clone;923 } else if (auto* descriptor = jsDynamicCast<JSTemplateObjectDescriptor*>(vm, cell)) {924 auto* templateObject = topLevelExecutable->createTemplateObject(globalObject, descriptor);925 RETURN_IF_EXCEPTION(scope, void());926 constant = templateObject;927 928 } 928 929 } 929 }930 930 break; 931 } 931 932 m_constantRegisters[i].set(vm, this, constant); 932 933 } -
trunk/Source/JavaScriptCore/bytecode/Fits.h
r252021 r252032 33 33 #include "PutByIdFlags.h" 34 34 #include "ResultType.h" 35 #include "SpecialPointer.h"36 35 #include "SymbolTableOrScopeDepth.h" 37 36 #include "VirtualRegister.h" -
trunk/Source/JavaScriptCore/bytecode/LinkTimeConstant.cpp
r252031 r252032 1 1 /* 2 * Copyright (C) 201 2-2019 Apple Inc. All rights reserved.2 * Copyright (C) 2019 Apple Inc. All rights reserved. 3 3 * 4 4 * Redistribution and use in source and binary forms, with or without … … 21 21 * OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT 22 22 * (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE 23 * OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. 23 * OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. 24 24 */ 25 25 26 #pragma once 26 #include "config.h" 27 #include "LinkTimeConstant.h" 28 29 #include <wtf/PrintStream.h> 27 30 28 31 namespace JSC { 29 30 class CodeBlock;31 class JSGlobalObject;32 33 namespace Special {34 enum Pointer : unsigned {35 CallFunction,36 ApplyFunction,37 ObjectConstructor,38 ArrayConstructor,39 TableSize // Not a real special pointer. Use this to determine the number of pointers.40 };41 } // namespace Special42 43 enum class LinkTimeConstant {44 ThrowTypeErrorFunction,45 };46 const unsigned LinkTimeConstantCount = 1;47 48 inline bool pointerIsFunction(Special::Pointer pointer)49 {50 ASSERT_UNUSED(pointer, pointer < Special::TableSize);51 return true;52 }53 54 inline bool pointerIsCell(Special::Pointer pointer)55 {56 ASSERT_UNUSED(pointer, pointer < Special::TableSize);57 return true;58 }59 60 void* actualPointerFor(JSGlobalObject*, Special::Pointer);61 void* actualPointerFor(CodeBlock*, Special::Pointer);62 32 63 33 } // namespace JSC … … 65 35 namespace WTF { 66 36 67 class PrintStream; 37 #define PRINT_LINK_TIME_CONSTANT(name, code) \ 38 case JSC::LinkTimeConstant::name: \ 39 out.print(#name); \ 40 return; 68 41 69 void printInternal(PrintStream&, JSC::Special::Pointer); 42 void printInternal(PrintStream& out, JSC::LinkTimeConstant constant) 43 { 44 switch (constant) { 45 JSC_FOREACH_LINK_TIME_CONSTANTS(PRINT_LINK_TIME_CONSTANT) 46 } 47 } 48 49 #undef PRINT_LINK_TIME_CONSTANT 70 50 71 51 } // namespace WTF -
trunk/Source/JavaScriptCore/bytecode/UnlinkedCodeBlock.cpp
r251468 r252032 77 77 , m_metadata(UnlinkedMetadataTable::create()) 78 78 { 79 for (auto& constantRegisterIndex : m_linkTimeConstants)80 constantRegisterIndex = 0;81 79 ASSERT(m_constructorKind == static_cast<unsigned>(info.constructorKind())); 82 80 ASSERT(m_codeType == static_cast<unsigned>(codeType)); -
trunk/Source/JavaScriptCore/bytecode/UnlinkedCodeBlock.h
r251886 r252032 38 38 #include "ParserModes.h" 39 39 #include "RegExp.h" 40 #include "SpecialPointer.h"41 40 #include "UnlinkedFunctionExecutable.h" 42 41 #include "UnlinkedMetadataTable.h" … … 64 63 class UnlinkedFunctionExecutable; 65 64 struct ExecutableInfo; 65 enum class LinkTimeConstant : int32_t; 66 66 67 67 template<typename CodeBlockType> … … 181 181 return result; 182 182 } 183 unsigned addConstant(LinkTimeConstant type)183 unsigned addConstant(LinkTimeConstant linkTimeConstant) 184 184 { 185 185 VM& vm = this->vm(); 186 186 auto locker = lockDuringMarking(vm.heap, cellLock()); 187 187 unsigned result = m_constantRegisters.size(); 188 ASSERT(result);189 unsigned index = static_cast<unsigned>(type);190 ASSERT(index < LinkTimeConstantCount);191 m_linkTimeConstants[index] = result;192 188 m_constantRegisters.append(WriteBarrier<Unknown>()); 193 m_constantsSourceCodeRepresentation.append(SourceCodeRepresentation::Other); 189 m_constantRegisters.last().set(vm, this, jsNumber(static_cast<int32_t>(linkTimeConstant))); 190 m_constantsSourceCodeRepresentation.append(SourceCodeRepresentation::LinkTimeConstant); 194 191 return result; 195 }196 197 unsigned registerIndexForLinkTimeConstant(LinkTimeConstant type)198 {199 unsigned index = static_cast<unsigned>(type);200 ASSERT(index < LinkTimeConstantCount);201 return m_linkTimeConstants[index];202 192 } 203 193 … … 406 396 VirtualRegister m_thisRegister; 407 397 VirtualRegister m_scopeRegister; 408 409 std::array<unsigned, LinkTimeConstantCount> m_linkTimeConstants;410 398 411 399 unsigned m_usesEval : 1; -
trunk/Source/JavaScriptCore/bytecompiler/BytecodeGenerator.cpp
r252021 r252032 51 51 #include "JSLexicalEnvironment.h" 52 52 #include "JSTemplateObjectDescriptor.h" 53 #include "LinkTimeConstant.h" 53 54 #include "LowLevelInterpreter.h" 54 55 #include "Options.h" … … 309 310 ASSERT_UNUSED(parentScopeTDZVariables, !parentScopeTDZVariables->size()); 310 311 311 for (auto& constantRegister : m_linkTimeConstantRegisters)312 constantRegister = nullptr;313 314 312 m_codeBlock->setNumParameters(1); // Allocate space for "this" 315 313 … … 361 359 , m_derivedContextType(codeBlock->derivedContextType()) 362 360 { 363 for (auto& constantRegister : m_linkTimeConstantRegisters)364 constantRegister = nullptr;365 366 361 SymbolTable* functionSymbolTable = SymbolTable::create(m_vm); 367 362 functionSymbolTable->setUsesNonStrictEval(m_usesNonStrictEval); … … 789 784 // @rejectPromiseWithFirstResolvingFunctionCallCheck(@promise, thrownValue); 790 785 // return @promise; 791 auto varRejectPromise = variable(propertyNames().builtinNames().rejectPromiseWithFirstResolvingFunctionCallCheckPrivateName()); 792 RefPtr<RegisterID> scope = newTemporary(); 793 move(scope.get(), emitResolveScope(scope.get(), varRejectPromise)); 794 RefPtr<RegisterID> rejectPromise = emitGetFromScope(newTemporary(), scope.get(), varRejectPromise, ThrowIfNotFound); 795 786 RefPtr<RegisterID> rejectPromise = moveLinkTimeConstant(nullptr, LinkTimeConstant::rejectPromiseWithFirstResolvingFunctionCallCheck); 796 787 CallArguments args(*this, nullptr, 2); 797 788 emitLoad(args.thisRegister(), jsUndefined()); … … 849 840 , m_derivedContextType(codeBlock->derivedContextType()) 850 841 { 851 for (auto& constantRegister : m_linkTimeConstantRegisters)852 constantRegister = nullptr;853 854 842 m_codeBlock->setNumParameters(1); 855 843 … … 910 898 { 911 899 ASSERT_UNUSED(parentScopeTDZVariables, !parentScopeTDZVariables->size()); 912 913 for (auto& constantRegister : m_linkTimeConstantRegisters)914 constantRegister = nullptr;915 900 916 901 SymbolTable* moduleEnvironmentSymbolTable = SymbolTable::create(m_vm); … … 1443 1428 void BytecodeGenerator::emitJumpIfNotFunctionCall(RegisterID* cond, Label& target) 1444 1429 { 1445 OpJneqPtr::emit(this, cond, Special::CallFunction, target.bind(this));1430 OpJneqPtr::emit(this, cond, moveLinkTimeConstant(nullptr, LinkTimeConstant::callFunction), target.bind(this)); 1446 1431 } 1447 1432 1448 1433 void BytecodeGenerator::emitJumpIfNotFunctionApply(RegisterID* cond, Label& target) 1449 1434 { 1450 OpJneqPtr::emit(this, cond, Special::ApplyFunction, target.bind(this));1435 OpJneqPtr::emit(this, cond, moveLinkTimeConstant(nullptr, LinkTimeConstant::applyFunction), target.bind(this)); 1451 1436 } 1452 1437 … … 1500 1485 RegisterID* BytecodeGenerator::moveLinkTimeConstant(RegisterID* dst, LinkTimeConstant type) 1501 1486 { 1502 unsigned constantIndex = static_cast<unsigned>(type); 1503 if (!m_linkTimeConstantRegisters[constantIndex]) { 1487 RegisterID* constant = m_linkTimeConstantRegisters.ensure(type, [&] { 1504 1488 int index = addConstantIndex(); 1505 1489 m_codeBlock->addConstant(type); 1506 m_linkTimeConstantRegisters[constantIndex] = &m_constantPoolRegisters[index]; 1507 } 1508 1490 return &m_constantPoolRegisters[index]; 1491 }).iterator->value; 1509 1492 if (!dst) 1510 return m_linkTimeConstantRegisters[constantIndex];1511 1512 OpMov::emit(this, dst, m_linkTimeConstantRegisters[constantIndex]);1493 return constant; 1494 1495 OpMov::emit(this, dst, constant); 1513 1496 1514 1497 return dst; … … 3102 3085 return NoExpectedFunction; 3103 3086 3104 OpJneqPtr::emit(this, func, Special::ObjectConstructor, realCall->bind(this));3087 OpJneqPtr::emit(this, func, moveLinkTimeConstant(nullptr, LinkTimeConstant::Object), realCall->bind(this)); 3105 3088 3106 3089 if (dst != ignoredResult()) … … 3118 3101 return NoExpectedFunction; 3119 3102 3120 OpJneqPtr::emit(this, func, Special::ArrayConstructor, realCall->bind(this));3103 OpJneqPtr::emit(this, func, moveLinkTimeConstant(nullptr, LinkTimeConstant::Array), realCall->bind(this)); 3121 3104 3122 3105 if (dst != ignoredResult()) { … … 3286 3269 RefPtr<RegisterID> throwTypeErrorFunction; 3287 3270 if (!attributes.hasGet() || !attributes.hasSet()) 3288 throwTypeErrorFunction = moveLinkTimeConstant(nullptr, LinkTimeConstant:: ThrowTypeErrorFunction);3271 throwTypeErrorFunction = moveLinkTimeConstant(nullptr, LinkTimeConstant::throwTypeErrorFunction); 3289 3272 3290 3273 RefPtr<RegisterID> getter; … … 4475 4458 RefPtr<RegisterID> nextMethod = emitGetById(newTemporary(), iterator.get(), propertyNames().next); 4476 4459 4477 auto varCreateAsyncFromSyncIterator = variable(propertyNames().builtinNames().createAsyncFromSyncIteratorPrivateName()); 4478 RefPtr<RegisterID> scope = newTemporary(); 4479 move(scope.get(), emitResolveScope(scope.get(), varCreateAsyncFromSyncIterator)); 4480 RefPtr<RegisterID> createAsyncFromSyncIterator = emitGetFromScope(newTemporary(), scope.get(), varCreateAsyncFromSyncIterator, ThrowIfNotFound); 4460 RefPtr<RegisterID> createAsyncFromSyncIterator = moveLinkTimeConstant(nullptr, LinkTimeConstant::createAsyncFromSyncIterator); 4481 4461 4482 4462 CallArguments args(*this, nullptr, 2); -
trunk/Source/JavaScriptCore/bytecompiler/BytecodeGenerator.h
r252021 r252032 74 74 enum class DebuggableCall { Yes, No }; 75 75 enum class ThisResolutionType { Local, Scoped }; 76 enum class LinkTimeConstant : int32_t; 76 77 77 78 class CallArguments { … … 1217 1218 RegisterID* m_newTargetRegister { nullptr }; 1218 1219 RegisterID* m_isDerivedConstuctor { nullptr }; 1219 RegisterID* m_linkTimeConstantRegisters[LinkTimeConstantCount];1220 HashMap<LinkTimeConstant, RegisterID*, WTF::IntHash<LinkTimeConstant>, WTF::StrongEnumHashTraits<LinkTimeConstant>> m_linkTimeConstantRegisters; 1220 1221 RegisterID* m_arrowFunctionContextLexicalEnvironmentRegister { nullptr }; 1221 1222 RegisterID* m_promiseRegister { nullptr }; -
trunk/Source/JavaScriptCore/bytecompiler/NodesCodegen.cpp
r252021 r252032 212 212 RegisterID* ImportNode::emitBytecode(BytecodeGenerator& generator, RegisterID* dst) 213 213 { 214 RefPtr<RegisterID> importModule = generator. emitGetGlobalPrivate(generator.newTemporary(), generator.propertyNames().builtinNames().importModulePrivateName());214 RefPtr<RegisterID> importModule = generator.moveLinkTimeConstant(nullptr, LinkTimeConstant::importModule); 215 215 CallArguments arguments(generator, nullptr, 1); 216 216 generator.emitLoad(arguments.thisRegister(), jsUndefined()); … … 986 986 RegisterID* BytecodeIntrinsicNode::emitBytecode(BytecodeGenerator& generator, RegisterID* dst) 987 987 { 988 return (this->*m_emitter)(generator, dst); 988 if (m_entry.type() == BytecodeIntrinsicRegistry::Type::Emitter) 989 return (this->*m_entry.emitter())(generator, dst); 990 if (dst == generator.ignoredResult()) 991 return nullptr; 992 return generator.moveLinkTimeConstant(dst, m_entry.linkTimeConstant()); 989 993 } 990 994 … … 1014 1018 static JSPromise::Field promiseInternalFieldIndex(BytecodeIntrinsicNode* node) 1015 1019 { 1016 if (node->emitter() == &BytecodeIntrinsicNode::emit_intrinsic_promiseFieldFlags) 1020 ASSERT(node->entry().type() == BytecodeIntrinsicRegistry::Type::Emitter); 1021 if (node->entry().emitter() == &BytecodeIntrinsicNode::emit_intrinsic_promiseFieldFlags) 1017 1022 return JSPromise::Field::Flags; 1018 if (node->e mitter() == &BytecodeIntrinsicNode::emit_intrinsic_promiseFieldReactionsOrResult)1023 if (node->entry().emitter() == &BytecodeIntrinsicNode::emit_intrinsic_promiseFieldReactionsOrResult) 1019 1024 return JSPromise::Field::ReactionsOrResult; 1020 1025 RELEASE_ASSERT_NOT_REACHED(); … … 1024 1029 static JSGenerator::Field generatorInternalFieldIndex(BytecodeIntrinsicNode* node) 1025 1030 { 1026 if (node->emitter() == &BytecodeIntrinsicNode::emit_intrinsic_generatorFieldState) 1031 ASSERT(node->entry().type() == BytecodeIntrinsicRegistry::Type::Emitter); 1032 if (node->entry().emitter() == &BytecodeIntrinsicNode::emit_intrinsic_generatorFieldState) 1027 1033 return JSGenerator::Field::State; 1028 if (node->e mitter() == &BytecodeIntrinsicNode::emit_intrinsic_generatorFieldNext)1034 if (node->entry().emitter() == &BytecodeIntrinsicNode::emit_intrinsic_generatorFieldNext) 1029 1035 return JSGenerator::Field::Next; 1030 if (node->e mitter() == &BytecodeIntrinsicNode::emit_intrinsic_generatorFieldThis)1036 if (node->entry().emitter() == &BytecodeIntrinsicNode::emit_intrinsic_generatorFieldThis) 1031 1037 return JSGenerator::Field::This; 1032 if (node->e mitter() == &BytecodeIntrinsicNode::emit_intrinsic_generatorFieldFrame)1038 if (node->entry().emitter() == &BytecodeIntrinsicNode::emit_intrinsic_generatorFieldFrame) 1033 1039 return JSGenerator::Field::Frame; 1034 1040 RELEASE_ASSERT_NOT_REACHED(); … … 1038 1044 static JSAsyncGenerator::Field asyncGeneratorInternalFieldIndex(BytecodeIntrinsicNode* node) 1039 1045 { 1040 if (node->emitter() == &BytecodeIntrinsicNode::emit_intrinsic_generatorFieldState) 1046 ASSERT(node->entry().type() == BytecodeIntrinsicRegistry::Type::Emitter); 1047 if (node->entry().emitter() == &BytecodeIntrinsicNode::emit_intrinsic_generatorFieldState) 1041 1048 return JSAsyncGenerator::Field::State; 1042 if (node->e mitter() == &BytecodeIntrinsicNode::emit_intrinsic_generatorFieldNext)1049 if (node->entry().emitter() == &BytecodeIntrinsicNode::emit_intrinsic_generatorFieldNext) 1043 1050 return JSAsyncGenerator::Field::Next; 1044 if (node->e mitter() == &BytecodeIntrinsicNode::emit_intrinsic_generatorFieldThis)1051 if (node->entry().emitter() == &BytecodeIntrinsicNode::emit_intrinsic_generatorFieldThis) 1045 1052 return JSAsyncGenerator::Field::This; 1046 if (node->e mitter() == &BytecodeIntrinsicNode::emit_intrinsic_generatorFieldFrame)1053 if (node->entry().emitter() == &BytecodeIntrinsicNode::emit_intrinsic_generatorFieldFrame) 1047 1054 return JSAsyncGenerator::Field::Frame; 1048 if (node->e mitter() == &BytecodeIntrinsicNode::emit_intrinsic_asyncGeneratorFieldSuspendReason)1055 if (node->entry().emitter() == &BytecodeIntrinsicNode::emit_intrinsic_asyncGeneratorFieldSuspendReason) 1049 1056 return JSAsyncGenerator::Field::SuspendReason; 1050 if (node->e mitter() == &BytecodeIntrinsicNode::emit_intrinsic_asyncGeneratorFieldQueueFirst)1057 if (node->entry().emitter() == &BytecodeIntrinsicNode::emit_intrinsic_asyncGeneratorFieldQueueFirst) 1051 1058 return JSAsyncGenerator::Field::QueueFirst; 1052 if (node->e mitter() == &BytecodeIntrinsicNode::emit_intrinsic_asyncGeneratorFieldQueueLast)1059 if (node->entry().emitter() == &BytecodeIntrinsicNode::emit_intrinsic_asyncGeneratorFieldQueueLast) 1053 1060 return JSAsyncGenerator::Field::QueueLast; 1054 1061 RELEASE_ASSERT_NOT_REACHED(); … … 4097 4104 4098 4105 // load and call @asyncFunctionResume 4099 auto var = generator.variable(generator.propertyNames().builtinNames().asyncFunctionResumePrivateName()); 4100 RefPtr<RegisterID> scope = generator.newTemporary(); 4101 generator.move(scope.get(), generator.emitResolveScope(scope.get(), var)); 4102 RefPtr<RegisterID> asyncFunctionResume = generator.emitGetFromScope(generator.newTemporary(), scope.get(), var, ThrowIfNotFound); 4106 RefPtr<RegisterID> asyncFunctionResume = generator.moveLinkTimeConstant(nullptr, LinkTimeConstant::asyncFunctionResume); 4103 4107 4104 4108 CallArguments args(generator, nullptr, 4); … … 4579 4583 RefPtr<RegisterID> addMethod; 4580 4584 if (m_containsRestElement && m_containsComputedProperty) { 4581 auto var = generator.variable(generator.propertyNames().builtinNames().SetPrivateName()); 4582 4583 RefPtr<RegisterID> scope = generator.newTemporary(); 4584 generator.move(scope.get(), generator.emitResolveScope(scope.get(), var)); 4585 RefPtr<RegisterID> setConstructor = generator.emitGetFromScope(generator.newTemporary(), scope.get(), var, ThrowIfNotFound); 4585 RefPtr<RegisterID> setConstructor = generator.moveLinkTimeConstant(nullptr, LinkTimeConstant::Set); 4586 4586 4587 4587 CallArguments args(generator, nullptr, 0); … … 4634 4634 4635 4635 // load and call @copyDataProperties 4636 auto var = generator.variable(generator.propertyNames().builtinNames().copyDataPropertiesPrivateName()); 4637 4638 RefPtr<RegisterID> scope = generator.newTemporary(); 4639 generator.move(scope.get(), generator.emitResolveScope(scope.get(), var)); 4640 RefPtr<RegisterID> copyDataProperties = generator.emitGetFromScope(generator.newTemporary(), scope.get(), var, ThrowIfNotFound); 4636 RefPtr<RegisterID> copyDataProperties = generator.moveLinkTimeConstant(nullptr, LinkTimeConstant::copyDataProperties); 4641 4637 4642 4638 CallArguments args(generator, nullptr, 3); … … 4811 4807 4812 4808 // load and call @copyDataPropertiesNoExclusions 4813 auto var = generator.variable(generator.propertyNames().builtinNames().copyDataPropertiesNoExclusionsPrivateName()); 4814 4815 RefPtr<RegisterID> scope = generator.newTemporary(); 4816 generator.move(scope.get(), generator.emitResolveScope(scope.get(), var)); 4817 RefPtr<RegisterID> copyDataProperties = generator.emitGetFromScope(generator.newTemporary(), scope.get(), var, ThrowIfNotFound); 4809 RefPtr<RegisterID> copyDataProperties = generator.moveLinkTimeConstant(nullptr, LinkTimeConstant::copyDataPropertiesNoExclusions); 4818 4810 4819 4811 CallArguments args(generator, nullptr, 2); -
trunk/Source/JavaScriptCore/dfg/DFGByteCodeParser.cpp
r252021 r252032 6343 6343 case op_jneq_ptr: { 6344 6344 auto bytecode = currentInstruction->as<OpJneqPtr>(); 6345 Special::Pointer specialPointer = bytecode.m_specialPointer; 6346 ASSERT(pointerIsCell(specialPointer)); 6347 JSCell* actualPointer = static_cast<JSCell*>( 6348 actualPointerFor(m_inlineStackTop->m_codeBlock, specialPointer)); 6349 FrozenValue* frozenPointer = m_graph.freeze(actualPointer); 6345 FrozenValue* frozenPointer = m_graph.freezeStrong(m_inlineStackTop->m_codeBlock->getConstant(bytecode.m_specialPointer.offset())); 6350 6346 unsigned relativeOffset = jumpTarget(bytecode.m_targetLabel); 6351 6347 Node* child = get(bytecode.m_value); -
trunk/Source/JavaScriptCore/heap/MarkedSpace.cpp
r245258 r252032 140 140 // FIXME: All of these things should have IsoSubspaces. 141 141 // https://bugs.webkit.org/show_bug.cgi?id=179876 142 add(sizeof(UnlinkedFunctionCodeBlock)); 143 add(sizeof(JSString)); 142 add(256); 144 143 145 144 { -
trunk/Source/JavaScriptCore/jit/JITOpcodes.cpp
r251886 r252032 472 472 auto& metadata = bytecode.metadata(m_codeBlock); 473 473 int src = bytecode.m_value.offset(); 474 Special::Pointer ptr = bytecode.m_specialPointer; 474 JSValue specialPointer = getConstantOperand(bytecode.m_specialPointer.offset()); 475 ASSERT(specialPointer.isCell()); 475 476 unsigned target = jumpTarget(currentInstruction, bytecode.m_targetLabel); 476 477 477 478 emitGetVirtualRegister(src, regT0); 478 CCallHelpers::Jump equal = branchPtr(Equal, regT0, TrustedImmPtr( actualPointerFor(m_codeBlock, ptr)));479 CCallHelpers::Jump equal = branchPtr(Equal, regT0, TrustedImmPtr(specialPointer.asCell())); 479 480 store8(TrustedImm32(1), &metadata.m_hasJumped); 480 481 addJump(jump(), target); -
trunk/Source/JavaScriptCore/jit/JITOpcodes32_64.cpp
r251534 r252032 479 479 auto& metadata = bytecode.metadata(m_codeBlock); 480 480 int src = bytecode.m_value.offset(); 481 Special::Pointer ptr = bytecode.m_specialPointer; 481 JSValue specialPointer = getConstantOperand(bytecode.m_specialPointer.offset()); 482 ASSERT(specialPointer.isCell()); 482 483 unsigned target = jumpTarget(currentInstruction, bytecode.m_targetLabel); 483 484 484 485 emitLoad(src, regT1, regT0); 485 486 Jump notCell = branchIfNotCell(regT1); 486 Jump equal = branchPtr(Equal, regT0, TrustedImmPtr( actualPointerFor(m_codeBlock, ptr)));487 Jump equal = branchPtr(Equal, regT0, TrustedImmPtr(specialPointer.asCell())); 487 488 notCell.link(this); 488 489 store8(TrustedImm32(1), &metadata.m_hasJumped); -
trunk/Source/JavaScriptCore/llint/LowLevelInterpreter32_64.asm
r252021 r252032 465 465 # Index, tag, and payload must be different registers. Index is not 466 466 # changed. 467 macro loadConstant(size, index, tag, payload) 468 size(FirstConstantRegisterIndexNarrow, FirstConstantRegisterIndexWide16, FirstConstantRegisterIndexWide32, macro (FirstConstantRegisterIndex) 469 loadp CodeBlock[cfr], payload 470 loadp CodeBlock::m_constantRegisters + VectorBufferOffset[payload], payload 471 subp FirstConstantRegisterIndex, index 472 loadp TagOffset[payload, index, 8], tag 473 loadp PayloadOffset[payload, index, 8], payload 474 end) 475 end 476 477 # Index, tag, and payload must be different registers. Index is not 478 # changed. 467 479 macro loadConstantOrVariable(size, index, tag, payload) 468 480 size(FirstConstantRegisterIndexNarrow, FirstConstantRegisterIndexWide16, FirstConstantRegisterIndexWide32, macro (FirstConstantRegisterIndex) … … 472 484 jmp .done 473 485 .constant: 474 loadp CodeBlock[cfr], payload 475 loadp CodeBlock::m_constantRegisters + VectorBufferOffset[payload], payload 476 subp FirstConstantRegisterIndex, index 477 loadp TagOffset[payload, index, 8], tag 478 loadp PayloadOffset[payload, index, 8], payload 486 loadConstant(size, index, tag, payload) 479 487 .done: 480 488 end) … … 1711 1719 llintOpWithMetadata(op_jneq_ptr, OpJneqPtr, macro (size, get, dispatch, metadata, return) 1712 1720 get(m_value, t0) 1713 getu(size, OpJneqPtr, m_specialPointer, t1) 1714 loadp CodeBlock[cfr], t2 1715 loadp CodeBlock::m_globalObject[t2], t2 1721 get(m_specialPointer, t1) 1722 loadConstant(size, t1, t3, t2) 1716 1723 bineq TagOffset[cfr, t0, 8], CellTag, .opJneqPtrBranch 1717 loadp JSGlobalObject::m_specialPointers[t2, t1, 4], t1 1718 bpeq PayloadOffset[cfr, t0, 8], t1, .opJneqPtrFallThrough 1724 bpeq PayloadOffset[cfr, t0, 8], t2, .opJneqPtrFallThrough 1719 1725 .opJneqPtrBranch: 1720 1726 metadata(t5, t2) -
trunk/Source/JavaScriptCore/llint/LowLevelInterpreter64.asm
r252021 r252032 467 467 468 468 # Index and value must be different registers. Index may be clobbered. 469 macro loadConstant(size, index, value) 470 macro loadNarrow() 471 loadp CodeBlock[cfr], value 472 loadp CodeBlock::m_constantRegisters + VectorBufferOffset[value], value 473 loadq -(FirstConstantRegisterIndexNarrow * 8)[value, index, 8], value 474 end 475 476 macro loadWide16() 477 loadp CodeBlock[cfr], value 478 loadp CodeBlock::m_constantRegisters + VectorBufferOffset[value], value 479 loadq -(FirstConstantRegisterIndexWide16 * 8)[value, index, 8], value 480 end 481 482 macro loadWide32() 483 loadp CodeBlock[cfr], value 484 loadp CodeBlock::m_constantRegisters + VectorBufferOffset[value], value 485 subp FirstConstantRegisterIndexWide32, index 486 loadq [value, index, 8], value 487 end 488 489 size(loadNarrow, loadWide16, loadWide32, macro (load) load() end) 490 end 491 492 # Index and value must be different registers. Index may be clobbered. 469 493 macro loadConstantOrVariable(size, index, value) 470 494 macro loadNarrow() … … 473 497 jmp .done 474 498 .constant: 475 loadp CodeBlock[cfr], value 476 loadp CodeBlock::m_constantRegisters + VectorBufferOffset[value], value 477 loadq -(FirstConstantRegisterIndexNarrow * 8)[value, index, 8], value 499 loadConstant(size, index, value) 478 500 .done: 479 501 end … … 484 506 jmp .done 485 507 .constant: 486 loadp CodeBlock[cfr], value 487 loadp CodeBlock::m_constantRegisters + VectorBufferOffset[value], value 488 loadq -(FirstConstantRegisterIndexWide16 * 8)[value, index, 8], value 508 loadConstant(size, index, value) 489 509 .done: 490 510 end … … 495 515 jmp .done 496 516 .constant: 497 loadp CodeBlock[cfr], value 498 loadp CodeBlock::m_constantRegisters + VectorBufferOffset[value], value 499 subp FirstConstantRegisterIndexWide32, index 500 loadq [value, index, 8], value 517 loadConstant(size, index, value) 501 518 .done: 502 519 end … … 1817 1834 llintOpWithMetadata(op_jneq_ptr, OpJneqPtr, macro (size, get, dispatch, metadata, return) 1818 1835 get(m_value, t0) 1819 getu(size, OpJneqPtr, m_specialPointer, t1) 1820 loadp CodeBlock[cfr], t2 1821 loadp CodeBlock::m_globalObject[t2], t2 1822 loadp JSGlobalObject::m_specialPointers[t2, t1, PtrSize], t1 1823 bpneq t1, [cfr, t0, 8], .opJneqPtrTarget 1836 get(m_specialPointer, t1) 1837 loadConstant(size, t1, t2) 1838 bpneq t2, [cfr, t0, 8], .opJneqPtrTarget 1824 1839 dispatch() 1825 1840 -
trunk/Source/JavaScriptCore/parser/ASTBuilder.h
r251684 r252032 201 201 202 202 if (ident.isSymbol()) { 203 if (BytecodeIntrinsicNode::EmitterType emitter = m_vm.bytecodeIntrinsicRegistry().lookup(ident)) 204 return new (m_parserArena) BytecodeIntrinsicNode(BytecodeIntrinsicNode::Type::Constant, location, emitter, ident, nullptr, start, start, end); 203 auto entry = m_vm.bytecodeIntrinsicRegistry().lookup(ident); 204 if (entry) 205 return new (m_parserArena) BytecodeIntrinsicNode(BytecodeIntrinsicNode::Type::Constant, location, entry.value(), ident, nullptr, start, start, end); 205 206 } 206 207 … … 1385 1386 ASSERT(!isOptionalCall); 1386 1387 BytecodeIntrinsicNode* intrinsic = static_cast<BytecodeIntrinsicNode*>(func); 1387 if (intrinsic->type() == BytecodeIntrinsicNode::Type::Constant )1388 return new (m_parserArena) BytecodeIntrinsicNode(BytecodeIntrinsicNode::Type::Function, location, intrinsic->e mitter(), intrinsic->identifier(), args, divot, divotStart, divotEnd);1388 if (intrinsic->type() == BytecodeIntrinsicNode::Type::Constant && intrinsic->entry().type() == BytecodeIntrinsicRegistry::Type::Emitter) 1389 return new (m_parserArena) BytecodeIntrinsicNode(BytecodeIntrinsicNode::Type::Function, location, intrinsic->entry(), intrinsic->identifier(), args, divot, divotStart, divotEnd); 1389 1390 } 1390 1391 -
trunk/Source/JavaScriptCore/parser/NodeConstructors.h
r249117 r252032 414 414 } 415 415 416 inline BytecodeIntrinsicNode::BytecodeIntrinsicNode(Type type, const JSTokenLocation& location, EmitterType emitter, const Identifier& ident, ArgumentsNode* args, const JSTextPosition& divot, const JSTextPosition& divotStart, const JSTextPosition& divotEnd)416 inline BytecodeIntrinsicNode::BytecodeIntrinsicNode(Type type, const JSTokenLocation& location, BytecodeIntrinsicRegistry::Entry entry, const Identifier& ident, ArgumentsNode* args, const JSTextPosition& divot, const JSTextPosition& divotStart, const JSTextPosition& divotEnd) 417 417 : ExpressionNode(location) 418 418 , ThrowableExpressionData(divot, divotStart, divotEnd) 419 , m_e mitter(emitter)419 , m_entry(entry) 420 420 , m_ident(ident) 421 421 , m_args(args) -
trunk/Source/JavaScriptCore/parser/Nodes.h
r251886 r252032 945 945 }; 946 946 947 typedef RegisterID* (BytecodeIntrinsicNode::* EmitterType)(BytecodeGenerator&, RegisterID*); 948 949 BytecodeIntrinsicNode(Type, const JSTokenLocation&, EmitterType, const Identifier&, ArgumentsNode*, const JSTextPosition& divot, const JSTextPosition& divotStart, const JSTextPosition& divotEnd); 947 BytecodeIntrinsicNode(Type, const JSTokenLocation&, BytecodeIntrinsicRegistry::Entry, const Identifier&, ArgumentsNode*, const JSTextPosition& divot, const JSTextPosition& divotStart, const JSTextPosition& divotEnd); 950 948 951 949 bool isBytecodeIntrinsicNode() const override { return true; } 952 950 953 951 Type type() const { return m_type; } 954 EmitterType emitter() const { return m_emitter; }952 BytecodeIntrinsicRegistry::Entry entry() const { return m_entry; } 955 953 const Identifier& identifier() const { return m_ident; } 956 954 … … 965 963 bool isFunctionCall() const override { return m_type == Type::Function; } 966 964 967 EmitterType m_emitter;965 BytecodeIntrinsicRegistry::Entry m_entry; 968 966 const Identifier& m_ident; 969 967 ArgumentsNode* m_args; -
trunk/Source/JavaScriptCore/runtime/CachedTypes.cpp
r249668 r252032 1802 1802 VirtualRegister m_thisRegister; 1803 1803 VirtualRegister m_scopeRegister; 1804 std::array<unsigned, LinkTimeConstantCount> m_linkTimeConstants;1805 1804 1806 1805 unsigned m_usesEval : 1; … … 2040 2039 ALWAYS_INLINE void CachedCodeBlock<CodeBlockType>::decode(Decoder& decoder, UnlinkedCodeBlock& codeBlock) const 2041 2040 { 2042 for (unsigned i = LinkTimeConstantCount; i--;)2043 codeBlock.m_linkTimeConstants[i] = m_linkTimeConstants[i];2044 2045 2041 m_constantRegisters.decode(decoder, codeBlock.m_constantRegisters, &codeBlock); 2046 2042 m_constantsSourceCodeRepresentation.decode(decoder, codeBlock.m_constantsSourceCodeRepresentation); … … 2208 2204 m_codeType = codeBlock.m_codeType; 2209 2205 2210 for (unsigned i = LinkTimeConstantCount; i--;)2211 m_linkTimeConstants[i] = codeBlock.m_linkTimeConstants[i];2212 2213 2206 m_metadata.encode(encoder, codeBlock.m_metadata.get()); 2214 2207 m_rareData.encode(encoder, codeBlock.m_rareData.get()); -
trunk/Source/JavaScriptCore/runtime/JSCJSValue.h
r251425 r252032 130 130 Other, 131 131 Integer, 132 Double 132 Double, 133 LinkTimeConstant, 133 134 }; 134 135 -
trunk/Source/JavaScriptCore/runtime/JSGlobalObject.cpp
r251882 r252032 136 136 #include "LazyClassStructureInlines.h" 137 137 #include "LazyPropertyInlines.h" 138 #include "LinkTimeConstant.h" 138 139 #include "Lookup.h" 139 140 #include "MapConstructor.h" … … 412 413 : Base(vm, structure, 0) 413 414 , m_vm(&vm) 415 , m_linkTimeConstants(numberOfLinkTimeConstants) 414 416 , m_masqueradesAsUndefinedWatchpoint(adoptRef(new WatchpointSet(IsWatched))) 415 417 , m_havingABadTimeWatchpoint(adoptRef(new WatchpointSet(IsWatched))) … … 523 525 JSFunction* hasInstanceSymbolFunction = nullptr; 524 526 m_functionPrototype->addFunctionProperties(vm, this, &callFunction, &applyFunction, &hasInstanceSymbolFunction); 525 m_callFunction.set(vm, this, callFunction);526 m_applyFunction.set(vm, this, applyFunction);527 527 m_arrayProtoToStringFunction.initLater( 528 528 [] (const Initializer<JSFunction>& init) { … … 724 724 m_asyncGeneratorPrototype.set(vm, this, AsyncGeneratorPrototype::create(vm, this, AsyncGeneratorPrototype::createStructure(vm, this, m_asyncIteratorPrototype.get()))); 725 725 726 m_promiseProtoThenFunction.set(vm, this, JSFunction::create(vm, promisePrototypeThenCodeGenerator(vm), this)); 726 JSFunction* defaultPromiseThen = JSFunction::create(vm, promisePrototypeThenCodeGenerator(vm), this); 727 m_linkTimeConstants[static_cast<unsigned>(LinkTimeConstant::defaultPromiseThen)].set(vm, this, defaultPromiseThen); 727 728 728 729 #define CREATE_PROTOTYPE_FOR_SIMPLE_TYPE(capitalName, lowerName, properName, instanceType, jsName, prototypeBase, featureFlag) if (featureFlag) { \ … … 751 752 ObjectConstructor* objectConstructor = ObjectConstructor::create(vm, this, ObjectConstructor::createStructure(vm, this, m_functionPrototype.get()), m_objectPrototype.get()); 752 753 m_objectConstructor.set(vm, this, objectConstructor); 754 m_linkTimeConstants[static_cast<unsigned>(LinkTimeConstant::Object)].set(vm, this, objectConstructor); 753 755 754 756 JSFunction* throwTypeErrorFunction = JSFunction::create(vm, this, 0, String(), globalFuncThrowTypeError); 755 m_ throwTypeErrorFunction.set(vm, this, throwTypeErrorFunction);757 m_linkTimeConstants[static_cast<unsigned>(LinkTimeConstant::throwTypeErrorFunction)].set(vm, this, throwTypeErrorFunction); 756 758 757 759 FunctionConstructor* functionConstructor = FunctionConstructor::create(vm, FunctionConstructor::createStructure(vm, this, m_functionPrototype.get()), m_functionPrototype.get()); … … 760 762 ArrayConstructor* arrayConstructor = ArrayConstructor::create(vm, this, ArrayConstructor::createStructure(vm, this, m_functionPrototype.get()), m_arrayPrototype.get(), m_speciesGetterSetter.get()); 761 763 m_arrayConstructor.set(vm, this, arrayConstructor); 764 m_linkTimeConstants[static_cast<unsigned>(LinkTimeConstant::Array)].set(vm, this, arrayConstructor); 762 765 763 766 RegExpConstructor* regExpConstructor = RegExpConstructor::create(vm, RegExpConstructor::createStructure(vm, this, m_functionPrototype.get()), m_regExpPrototype.get(), m_speciesGetterSetter.get()); 764 767 m_regExpConstructor.set(vm, this, regExpConstructor); 768 m_linkTimeConstants[static_cast<unsigned>(LinkTimeConstant::RegExp)].set(vm, this, regExpConstructor); 765 769 m_regExpGlobalData.cachedResult().record(vm, this, nullptr, jsEmptyString(vm), MatchResult(0, 0)); 766 770 … … 784 788 m_promiseConstructor.set(vm, this, promiseConstructor); 785 789 m_internalPromiseConstructor.set(vm, this, internalPromiseConstructor); 790 m_linkTimeConstants[static_cast<unsigned>(LinkTimeConstant::Promise)].set(vm, this, promiseConstructor); 791 m_linkTimeConstants[static_cast<unsigned>(LinkTimeConstant::InternalPromise)].set(vm, this, internalPromiseConstructor); 786 792 787 793 m_evalErrorStructure.initLater( … … 842 848 putDirectWithoutTransition(vm, vm.propertyNames->Array, arrayConstructor, static_cast<unsigned>(PropertyAttribute::DontEnum)); 843 849 putDirectWithoutTransition(vm, vm.propertyNames->RegExp, regExpConstructor, static_cast<unsigned>(PropertyAttribute::DontEnum)); 844 845 putDirectWithoutTransition(vm, vm.propertyNames->builtinNames().ObjectPrivateName(), objectConstructor, PropertyAttribute::DontEnum | PropertyAttribute::DontDelete | PropertyAttribute::ReadOnly);846 putDirectWithoutTransition(vm, vm.propertyNames->builtinNames().ArrayPrivateName(), arrayConstructor, PropertyAttribute::DontEnum | PropertyAttribute::DontDelete | PropertyAttribute::ReadOnly);847 850 848 851 #if ENABLE(SHARED_ARRAY_BUFFER) … … 918 921 putDirectWithoutTransition(vm, vm.propertyNames->Loader, moduleLoader(), static_cast<unsigned>(PropertyAttribute::DontEnum)); 919 922 920 JSFunction* builtinLog = JSFunction::create(vm, this, 1, vm.propertyNames->emptyIdentifier.string(), globalFuncBuiltinLog);921 JSFunction* builtinDescribe = JSFunction::create(vm, this, 1, vm.propertyNames->emptyIdentifier.string(), globalFuncBuiltinDescribe);922 923 JSFunction* privateFuncTrunc = JSFunction::create(vm, this, 0, String(), mathProtoFuncTrunc, TruncIntrinsic);924 925 JSFunction* privateFuncPropertyIsEnumerable = JSFunction::create(vm, this, 0, String(), globalFuncPropertyIsEnumerable);926 JSFunction* privateFuncOwnKeys = JSFunction::create(vm, this, 0, String(), globalFuncOwnKeys);927 JSFunction* privateFuncImportModule = JSFunction::create(vm, this, 0, String(), globalFuncImportModule);928 JSFunction* privateFuncMakeTypeError = JSFunction::create(vm, this, 0, String(), globalFuncMakeTypeError);929 JSFunction* privateFuncTypedArrayLength = JSFunction::create(vm, this, 0, String(), typedArrayViewPrivateFuncLength);930 JSFunction* privateFuncTypedArrayGetOriginalConstructor = JSFunction::create(vm, this, 0, String(), typedArrayViewPrivateFuncGetOriginalConstructor);931 JSFunction* privateFuncTypedArraySort = JSFunction::create(vm, this, 0, String(), typedArrayViewPrivateFuncSort);932 JSFunction* privateFuncIsTypedArrayView = JSFunction::create(vm, this, 0, String(), typedArrayViewPrivateFuncIsTypedArrayView, IsTypedArrayViewIntrinsic);933 JSFunction* privateFuncTypedArraySubarrayCreate = JSFunction::create(vm, this, 0, String(), typedArrayViewPrivateFuncSubarrayCreate);934 JSFunction* privateFuncIsBoundFunction = JSFunction::create(vm, this, 0, String(), isBoundFunction);935 JSFunction* privateFuncHasInstanceBoundFunction = JSFunction::create(vm, this, 0, String(), hasInstanceBoundFunction);936 JSFunction* privateFuncInstanceOf = JSFunction::create(vm, this, 0, String(), objectPrivateFuncInstanceOf);937 JSFunction* privateFuncThisTimeValue = JSFunction::create(vm, this, 0, String(), dateProtoFuncGetTime);938 #if ENABLE(INTL)939 JSFunction* privateFuncDateTimeFormat = JSFunction::create(vm, this, 0, String(), globalFuncDateTimeFormat);940 #endif941 JSFunction* privateFuncIsArraySlow = JSFunction::create(vm, this, 0, String(), arrayConstructorPrivateFuncIsArraySlow);942 JSFunction* privateFuncConcatMemcpy = JSFunction::create(vm, this, 0, String(), arrayProtoPrivateFuncConcatMemcpy);943 JSFunction* privateFuncAppendMemcpy = JSFunction::create(vm, this, 0, String(), arrayProtoPrivateFuncAppendMemcpy);944 JSFunction* privateFuncMapBucketHead = JSFunction::create(vm, this, 0, String(), mapPrivateFuncMapBucketHead, JSMapBucketHeadIntrinsic);945 JSFunction* privateFuncMapBucketNext = JSFunction::create(vm, this, 0, String(), mapPrivateFuncMapBucketNext, JSMapBucketNextIntrinsic);946 JSFunction* privateFuncMapBucketKey = JSFunction::create(vm, this, 0, String(), mapPrivateFuncMapBucketKey, JSMapBucketKeyIntrinsic);947 JSFunction* privateFuncMapBucketValue = JSFunction::create(vm, this, 0, String(), mapPrivateFuncMapBucketValue, JSMapBucketValueIntrinsic);948 JSFunction* privateFuncSetBucketHead = JSFunction::create(vm, this, 0, String(), setPrivateFuncSetBucketHead, JSSetBucketHeadIntrinsic);949 JSFunction* privateFuncSetBucketNext = JSFunction::create(vm, this, 0, String(), setPrivateFuncSetBucketNext, JSSetBucketNextIntrinsic);950 JSFunction* privateFuncSetBucketKey = JSFunction::create(vm, this, 0, String(), setPrivateFuncSetBucketKey, JSSetBucketKeyIntrinsic);951 952 923 GetterSetter* regExpProtoFlagsGetter = getGetterById(this, m_regExpPrototype.get(), vm.propertyNames->flags); 953 924 catchScope.assertNoException(); 925 m_linkTimeConstants[static_cast<unsigned>(LinkTimeConstant::regExpProtoFlagsGetter)].set(vm, this, regExpProtoFlagsGetter); 954 926 GetterSetter* regExpProtoGlobalGetter = getGetterById(this, m_regExpPrototype.get(), vm.propertyNames->global); 955 927 catchScope.assertNoException(); 956 m_ regExpProtoGlobalGetter.set(vm, this, regExpProtoGlobalGetter);928 m_linkTimeConstants[static_cast<unsigned>(LinkTimeConstant::regExpProtoGlobalGetter)].set(vm, this, regExpProtoGlobalGetter); 957 929 GetterSetter* regExpProtoIgnoreCaseGetter = getGetterById(this, m_regExpPrototype.get(), vm.propertyNames->ignoreCase); 958 930 catchScope.assertNoException(); 931 m_linkTimeConstants[static_cast<unsigned>(LinkTimeConstant::regExpProtoIgnoreCaseGetter)].set(vm, this, regExpProtoIgnoreCaseGetter); 959 932 GetterSetter* regExpProtoMultilineGetter = getGetterById(this, m_regExpPrototype.get(), vm.propertyNames->multiline); 960 933 catchScope.assertNoException(); 934 m_linkTimeConstants[static_cast<unsigned>(LinkTimeConstant::regExpProtoMultilineGetter)].set(vm, this, regExpProtoMultilineGetter); 961 935 GetterSetter* regExpProtoSourceGetter = getGetterById(this, m_regExpPrototype.get(), vm.propertyNames->source); 962 936 catchScope.assertNoException(); 937 m_linkTimeConstants[static_cast<unsigned>(LinkTimeConstant::regExpProtoSourceGetter)].set(vm, this, regExpProtoSourceGetter); 963 938 GetterSetter* regExpProtoStickyGetter = getGetterById(this, m_regExpPrototype.get(), vm.propertyNames->sticky); 964 939 catchScope.assertNoException(); 940 m_linkTimeConstants[static_cast<unsigned>(LinkTimeConstant::regExpProtoStickyGetter)].set(vm, this, regExpProtoStickyGetter); 965 941 GetterSetter* regExpProtoUnicodeGetter = getGetterById(this, m_regExpPrototype.get(), vm.propertyNames->unicode); 966 942 catchScope.assertNoException(); 967 m_regExpProtoUnicodeGetter.set(vm, this, regExpProtoUnicodeGetter); 968 JSObject* builtinRegExpExec = asObject(m_regExpPrototype->getDirect(vm, vm.propertyNames->exec).asCell()); 969 m_regExpProtoExec.set(vm, this, builtinRegExpExec); 970 JSObject* regExpSymbolReplace = asObject(m_regExpPrototype->getDirect(vm, vm.propertyNames->replaceSymbol).asCell()); 943 m_linkTimeConstants[static_cast<unsigned>(LinkTimeConstant::regExpProtoUnicodeGetter)].set(vm, this, regExpProtoUnicodeGetter); 944 JSFunction* regExpSymbolReplace = jsCast<JSFunction*>(m_regExpPrototype->getDirect(vm, vm.propertyNames->replaceSymbol)); 971 945 m_regExpProtoSymbolReplace.set(vm, this, regExpSymbolReplace); 972 973 #define CREATE_PRIVATE_GLOBAL_FUNCTION(varName, funcName, code) JSFunction* varName ## PrivateFunction = JSFunction::create(vm, code ## CodeGenerator(vm), this); 974 JSC_FOREACH_BUILTIN_FUNCTION_PRIVATE_GLOBAL_NAME(CREATE_PRIVATE_GLOBAL_FUNCTION) 975 #undef CREATE_PRIVATE_GLOBAL_FUNCTION 976 946 m_linkTimeConstants[static_cast<unsigned>(LinkTimeConstant::regExpBuiltinExec)].set(vm, this, jsCast<JSFunction*>(m_regExpPrototype->getDirect(vm, vm.propertyNames->exec))); 947 m_linkTimeConstants[static_cast<unsigned>(LinkTimeConstant::regExpPrototypeSymbolReplace)].set(vm, this, m_regExpPrototype->getDirect(vm, vm.propertyNames->replaceSymbol).asCell()); 948 949 m_linkTimeConstants[static_cast<unsigned>(LinkTimeConstant::Set)].set(vm, this, setConstructor); 950 m_linkTimeConstants[static_cast<unsigned>(LinkTimeConstant::isArray)].set(vm, this, arrayConstructor->getDirect(vm, vm.propertyNames->isArray).asCell()); 951 m_linkTimeConstants[static_cast<unsigned>(LinkTimeConstant::callFunction)].set(vm, this, callFunction); 952 m_linkTimeConstants[static_cast<unsigned>(LinkTimeConstant::applyFunction)].set(vm, this, applyFunction); 953 954 #define INIT_PRIVATE_GLOBAL(funcName, code) \ 955 m_linkTimeConstants[static_cast<unsigned>(LinkTimeConstant::funcName)].initLater([] (const Initializer<JSCell>& init) { \ 956 JSGlobalObject* globalObject = jsCast<JSGlobalObject*>(init.owner); \ 957 init.set(JSFunction::create(init.vm, code ## CodeGenerator(init.vm), globalObject)); \ 958 }); 959 JSC_FOREACH_BUILTIN_FUNCTION_PRIVATE_GLOBAL_NAME(INIT_PRIVATE_GLOBAL) 960 #undef INIT_PRIVATE_GLOBAL 961 962 // FIXME: Initializing them lazily. 963 // https://bugs.webkit.org/show_bug.cgi?id=203795 977 964 JSObject* arrayIteratorPrototype = ArrayIteratorPrototype::create(vm, this, ArrayIteratorPrototype::createStructure(vm, this, m_iteratorPrototype.get())); 978 arrayIteratorConstructorPrivateFunction->putDirect(vm, vm.propertyNames->prototype, arrayIteratorPrototype);965 jsCast<JSObject*>(linkTimeConstant(LinkTimeConstant::ArrayIterator))->putDirect(vm, vm.propertyNames->prototype, arrayIteratorPrototype); 979 966 980 967 JSObject* asyncFromSyncIteratorPrototype = AsyncFromSyncIteratorPrototype::create(vm, this, AsyncFromSyncIteratorPrototype::createStructure(vm, this, m_iteratorPrototype.get())); 981 asyncFromSyncIteratorConstructorPrivateFunction->putDirect(vm, vm.propertyNames->prototype, asyncFromSyncIteratorPrototype);968 jsCast<JSObject*>(linkTimeConstant(LinkTimeConstant::AsyncFromSyncIterator))->putDirect(vm, vm.propertyNames->prototype, asyncFromSyncIteratorPrototype); 982 969 983 970 JSObject* mapIteratorPrototype = MapIteratorPrototype::create(vm, this, MapIteratorPrototype::createStructure(vm, this, m_iteratorPrototype.get())); 984 mapIteratorConstructorPrivateFunction->putDirect(vm, vm.propertyNames->prototype, mapIteratorPrototype);971 jsCast<JSObject*>(linkTimeConstant(LinkTimeConstant::MapIterator))->putDirect(vm, vm.propertyNames->prototype, mapIteratorPrototype); 985 972 986 973 JSObject* regExpStringIteratorPrototype = RegExpStringIteratorPrototype::create(vm, this, RegExpStringIteratorPrototype::createStructure(vm, this, m_iteratorPrototype.get())); 987 regExpStringIteratorConstructorPrivateFunction->putDirect(vm, vm.propertyNames->prototype, regExpStringIteratorPrototype);974 jsCast<JSObject*>(linkTimeConstant(LinkTimeConstant::RegExpStringIterator))->putDirect(vm, vm.propertyNames->prototype, regExpStringIteratorPrototype); 988 975 989 976 JSObject* setIteratorPrototype = SetIteratorPrototype::create(vm, this, SetIteratorPrototype::createStructure(vm, this, m_iteratorPrototype.get())); 990 setIteratorConstructorPrivateFunction->putDirect(vm, vm.propertyNames->prototype, setIteratorPrototype); 991 992 m_newPromiseCapabilityFunction.set(vm, this, newPromiseCapabilityPrivateFunction); 993 m_resolvePromiseFunction.set(vm, this, resolvePromisePrivateFunction); 994 m_rejectPromiseFunction.set(vm, this, rejectPromisePrivateFunction); 977 jsCast<JSObject*>(linkTimeConstant(LinkTimeConstant::SetIterator))->putDirect(vm, vm.propertyNames->prototype, setIteratorPrototype); 978 979 // Map and Set helpers. 980 m_linkTimeConstants[static_cast<unsigned>(LinkTimeConstant::mapBucketHead)].initLater([] (const Initializer<JSCell>& init) { 981 init.set(JSFunction::create(init.vm, jsCast<JSGlobalObject*>(init.owner), 0, String(), mapPrivateFuncMapBucketHead, JSMapBucketHeadIntrinsic)); 982 }); 983 m_linkTimeConstants[static_cast<unsigned>(LinkTimeConstant::mapBucketNext)].initLater([] (const Initializer<JSCell>& init) { 984 init.set(JSFunction::create(init.vm, jsCast<JSGlobalObject*>(init.owner), 0, String(), mapPrivateFuncMapBucketNext, JSMapBucketNextIntrinsic)); 985 }); 986 m_linkTimeConstants[static_cast<unsigned>(LinkTimeConstant::mapBucketKey)].initLater([] (const Initializer<JSCell>& init) { 987 init.set(JSFunction::create(init.vm, jsCast<JSGlobalObject*>(init.owner), 0, String(), mapPrivateFuncMapBucketKey, JSMapBucketKeyIntrinsic)); 988 }); 989 m_linkTimeConstants[static_cast<unsigned>(LinkTimeConstant::mapBucketValue)].initLater([] (const Initializer<JSCell>& init) { 990 init.set(JSFunction::create(init.vm, jsCast<JSGlobalObject*>(init.owner), 0, String(), mapPrivateFuncMapBucketValue, JSMapBucketValueIntrinsic)); 991 }); 992 m_linkTimeConstants[static_cast<unsigned>(LinkTimeConstant::setBucketHead)].initLater([] (const Initializer<JSCell>& init) { 993 init.set(JSFunction::create(init.vm, jsCast<JSGlobalObject*>(init.owner), 0, String(), setPrivateFuncSetBucketHead, JSSetBucketHeadIntrinsic)); 994 }); 995 m_linkTimeConstants[static_cast<unsigned>(LinkTimeConstant::setBucketNext)].initLater([] (const Initializer<JSCell>& init) { 996 init.set(JSFunction::create(init.vm, jsCast<JSGlobalObject*>(init.owner), 0, String(), setPrivateFuncSetBucketNext, JSSetBucketNextIntrinsic)); 997 }); 998 m_linkTimeConstants[static_cast<unsigned>(LinkTimeConstant::setBucketKey)].initLater([] (const Initializer<JSCell>& init) { 999 init.set(JSFunction::create(init.vm, jsCast<JSGlobalObject*>(init.owner), 0, String(), setPrivateFuncSetBucketKey, JSSetBucketKeyIntrinsic)); 1000 }); 1001 1002 m_linkTimeConstants[static_cast<unsigned>(LinkTimeConstant::importModule)].initLater([] (const Initializer<JSCell>& init) { 1003 init.set(JSFunction::create(init.vm, jsCast<JSGlobalObject*>(init.owner), 0, String(), globalFuncImportModule)); 1004 }); 1005 m_linkTimeConstants[static_cast<unsigned>(LinkTimeConstant::propertyIsEnumerable)].initLater([] (const Initializer<JSCell>& init) { 1006 init.set(JSFunction::create(init.vm, jsCast<JSGlobalObject*>(init.owner), 0, String(), globalFuncPropertyIsEnumerable)); 1007 }); 1008 m_linkTimeConstants[static_cast<unsigned>(LinkTimeConstant::ownKeys)].initLater([] (const Initializer<JSCell>& init) { 1009 init.set(JSFunction::create(init.vm, jsCast<JSGlobalObject*>(init.owner), 0, String(), globalFuncOwnKeys)); 1010 }); 1011 m_linkTimeConstants[static_cast<unsigned>(LinkTimeConstant::enqueueJob)].initLater([] (const Initializer<JSCell>& init) { 1012 init.set(JSFunction::create(init.vm, jsCast<JSGlobalObject*>(init.owner), 0, "enqueueJob"_s, enqueueJob)); 1013 }); 1014 m_linkTimeConstants[static_cast<unsigned>(LinkTimeConstant::makeTypeError)].initLater([] (const Initializer<JSCell>& init) { 1015 init.set(JSFunction::create(init.vm, jsCast<JSGlobalObject*>(init.owner), 0, String(), globalFuncMakeTypeError)); 1016 }); 1017 m_linkTimeConstants[static_cast<unsigned>(LinkTimeConstant::typedArrayLength)].initLater([] (const Initializer<JSCell>& init) { 1018 init.set(JSFunction::create(init.vm, jsCast<JSGlobalObject*>(init.owner), 0, String(), typedArrayViewPrivateFuncLength)); 1019 }); 1020 m_linkTimeConstants[static_cast<unsigned>(LinkTimeConstant::typedArrayGetOriginalConstructor)].initLater([] (const Initializer<JSCell>& init) { 1021 init.set(JSFunction::create(init.vm, jsCast<JSGlobalObject*>(init.owner), 0, String(), typedArrayViewPrivateFuncGetOriginalConstructor)); 1022 }); 1023 m_linkTimeConstants[static_cast<unsigned>(LinkTimeConstant::typedArraySort)].initLater([] (const Initializer<JSCell>& init) { 1024 init.set(JSFunction::create(init.vm, jsCast<JSGlobalObject*>(init.owner), 0, String(), typedArrayViewPrivateFuncSort)); 1025 }); 1026 m_linkTimeConstants[static_cast<unsigned>(LinkTimeConstant::isTypedArrayView)].initLater([] (const Initializer<JSCell>& init) { 1027 init.set(JSFunction::create(init.vm, jsCast<JSGlobalObject*>(init.owner), 0, String(), typedArrayViewPrivateFuncIsTypedArrayView, IsTypedArrayViewIntrinsic)); 1028 }); 1029 m_linkTimeConstants[static_cast<unsigned>(LinkTimeConstant::typedArraySubarrayCreate)].initLater([] (const Initializer<JSCell>& init) { 1030 init.set(JSFunction::create(init.vm, jsCast<JSGlobalObject*>(init.owner), 0, String(), typedArrayViewPrivateFuncSubarrayCreate)); 1031 }); 1032 m_linkTimeConstants[static_cast<unsigned>(LinkTimeConstant::isBoundFunction)].initLater([] (const Initializer<JSCell>& init) { 1033 init.set(JSFunction::create(init.vm, jsCast<JSGlobalObject*>(init.owner), 0, String(), isBoundFunction)); 1034 }); 1035 m_linkTimeConstants[static_cast<unsigned>(LinkTimeConstant::hasInstanceBoundFunction)].initLater([] (const Initializer<JSCell>& init) { 1036 init.set(JSFunction::create(init.vm, jsCast<JSGlobalObject*>(init.owner), 0, String(), hasInstanceBoundFunction)); 1037 }); 1038 m_linkTimeConstants[static_cast<unsigned>(LinkTimeConstant::instanceOf)].initLater([] (const Initializer<JSCell>& init) { 1039 init.set(JSFunction::create(init.vm, jsCast<JSGlobalObject*>(init.owner), 0, String(), objectPrivateFuncInstanceOf)); 1040 }); 1041 m_linkTimeConstants[static_cast<unsigned>(LinkTimeConstant::BuiltinLog)].initLater([] (const Initializer<JSCell>& init) { 1042 init.set(JSFunction::create(init.vm, jsCast<JSGlobalObject*>(init.owner), 1, String(), globalFuncBuiltinLog)); 1043 }); 1044 m_linkTimeConstants[static_cast<unsigned>(LinkTimeConstant::BuiltinDescribe)].initLater([] (const Initializer<JSCell>& init) { 1045 init.set(JSFunction::create(init.vm, jsCast<JSGlobalObject*>(init.owner), 1, String(), globalFuncBuiltinDescribe)); 1046 }); 1047 m_linkTimeConstants[static_cast<unsigned>(LinkTimeConstant::trunc)].initLater([] (const Initializer<JSCell>& init) { 1048 init.set(JSFunction::create(init.vm, jsCast<JSGlobalObject*>(init.owner), 0, String(), mathProtoFuncTrunc, TruncIntrinsic)); 1049 }); 1050 m_linkTimeConstants[static_cast<unsigned>(LinkTimeConstant::repeatCharacter)].initLater([] (const Initializer<JSCell>& init) { 1051 init.set(JSFunction::create(init.vm, jsCast<JSGlobalObject*>(init.owner), 2, String(), stringProtoFuncRepeatCharacter)); 1052 }); 1053 m_linkTimeConstants[static_cast<unsigned>(LinkTimeConstant::arraySpeciesCreate)].initLater([] (const Initializer<JSCell>& init) { 1054 init.set(JSFunction::create(init.vm, jsCast<JSGlobalObject*>(init.owner), 2, String(), arrayProtoFuncSpeciesCreate)); 1055 }); 1056 m_linkTimeConstants[static_cast<unsigned>(LinkTimeConstant::isArraySlow)].initLater([] (const Initializer<JSCell>& init) { 1057 init.set(JSFunction::create(init.vm, jsCast<JSGlobalObject*>(init.owner), 0, String(), arrayConstructorPrivateFuncIsArraySlow)); 1058 }); 1059 m_linkTimeConstants[static_cast<unsigned>(LinkTimeConstant::concatMemcpy)].initLater([] (const Initializer<JSCell>& init) { 1060 init.set(JSFunction::create(init.vm, jsCast<JSGlobalObject*>(init.owner), 0, String(), arrayProtoPrivateFuncConcatMemcpy)); 1061 }); 1062 m_linkTimeConstants[static_cast<unsigned>(LinkTimeConstant::appendMemcpy)].initLater([] (const Initializer<JSCell>& init) { 1063 init.set(JSFunction::create(init.vm, jsCast<JSGlobalObject*>(init.owner), 0, String(), arrayProtoPrivateFuncAppendMemcpy)); 1064 }); 1065 m_linkTimeConstants[static_cast<unsigned>(LinkTimeConstant::hostPromiseRejectionTracker)].initLater([] (const Initializer<JSCell>& init) { 1066 init.set(JSFunction::create(init.vm, jsCast<JSGlobalObject*>(init.owner), 2, String(), globalFuncHostPromiseRejectionTracker)); 1067 }); 1068 m_linkTimeConstants[static_cast<unsigned>(LinkTimeConstant::InspectorInstrumentation)].initLater([] (const Initializer<JSCell>& init) { 1069 JSGlobalObject* globalObject = jsCast<JSGlobalObject*>(init.owner); 1070 init.set(InspectorInstrumentationObject::create(init.vm, globalObject, InspectorInstrumentationObject::createStructure(init.vm, globalObject, globalObject->m_objectPrototype.get()))); 1071 }); 1072 m_linkTimeConstants[static_cast<unsigned>(LinkTimeConstant::thisTimeValue)].initLater([] (const Initializer<JSCell>& init) { 1073 init.set(JSFunction::create(init.vm, jsCast<JSGlobalObject*>(init.owner), 0, String(), dateProtoFuncGetTime, DatePrototypeGetTimeIntrinsic)); 1074 }); 1075 m_linkTimeConstants[static_cast<unsigned>(LinkTimeConstant::isConstructor)].initLater([] (const Initializer<JSCell>& init) { 1076 init.set(JSFunction::create(init.vm, jsCast<JSGlobalObject*>(init.owner), 1, String(), esSpecIsConstructor, NoIntrinsic)); 1077 }); 1078 1079 // RegExp.prototype helpers. 1080 m_linkTimeConstants[static_cast<unsigned>(LinkTimeConstant::regExpCreate)].initLater([] (const Initializer<JSCell>& init) { 1081 init.set(JSFunction::create(init.vm, jsCast<JSGlobalObject*>(init.owner), 2, String(), esSpecRegExpCreate, NoIntrinsic)); 1082 }); 1083 m_linkTimeConstants[static_cast<unsigned>(LinkTimeConstant::isRegExp)].initLater([] (const Initializer<JSCell>& init) { 1084 init.set(JSFunction::create(init.vm, jsCast<JSGlobalObject*>(init.owner), 1, String(), esSpecIsRegExp, NoIntrinsic)); 1085 }); 1086 m_linkTimeConstants[static_cast<unsigned>(LinkTimeConstant::regExpMatchFast)].initLater([] (const Initializer<JSCell>& init) { 1087 init.set(JSFunction::create(init.vm, jsCast<JSGlobalObject*>(init.owner), 1, String(), regExpProtoFuncMatchFast, RegExpMatchFastIntrinsic)); 1088 }); 1089 m_linkTimeConstants[static_cast<unsigned>(LinkTimeConstant::regExpSearchFast)].initLater([] (const Initializer<JSCell>& init) { 1090 init.set(JSFunction::create(init.vm, jsCast<JSGlobalObject*>(init.owner), 1, String(), regExpProtoFuncSearchFast)); 1091 }); 1092 m_linkTimeConstants[static_cast<unsigned>(LinkTimeConstant::regExpSplitFast)].initLater([] (const Initializer<JSCell>& init) { 1093 init.set(JSFunction::create(init.vm, jsCast<JSGlobalObject*>(init.owner), 2, String(), regExpProtoFuncSplitFast)); 1094 }); 1095 m_linkTimeConstants[static_cast<unsigned>(LinkTimeConstant::regExpTestFast)].initLater([] (const Initializer<JSCell>& init) { 1096 init.set(JSFunction::create(init.vm, jsCast<JSGlobalObject*>(init.owner), 1, String(), regExpProtoFuncTestFast, RegExpTestFastIntrinsic)); 1097 }); 1098 1099 // String.prototype helpers. 1100 m_linkTimeConstants[static_cast<unsigned>(LinkTimeConstant::stringIncludesInternal)].initLater([] (const Initializer<JSCell>& init) { 1101 init.set(JSFunction::create(init.vm, jsCast<JSGlobalObject*>(init.owner), 1, String(), builtinStringIncludesInternal)); 1102 }); 1103 m_linkTimeConstants[static_cast<unsigned>(LinkTimeConstant::stringSplitFast)].initLater([] (const Initializer<JSCell>& init) { 1104 init.set(JSFunction::create(init.vm, jsCast<JSGlobalObject*>(init.owner), 2, String(), stringProtoFuncSplitFast)); 1105 }); 1106 m_linkTimeConstants[static_cast<unsigned>(LinkTimeConstant::stringSubstrInternal)].initLater([] (const Initializer<JSCell>& init) { 1107 init.set(JSFunction::create(init.vm, jsCast<JSGlobalObject*>(init.owner), 2, String(), builtinStringSubstrInternal)); 1108 }); 1109 1110 // Function prototype helpers. 1111 m_linkTimeConstants[static_cast<unsigned>(LinkTimeConstant::makeBoundFunction)].initLater([] (const Initializer<JSCell>& init) { 1112 init.set(JSFunction::create(init.vm, jsCast<JSGlobalObject*>(init.owner), 5, String(), makeBoundFunction)); 1113 }); 1114 m_linkTimeConstants[static_cast<unsigned>(LinkTimeConstant::hasOwnLengthProperty)].initLater([] (const Initializer<JSCell>& init) { 1115 init.set(JSFunction::create(init.vm, jsCast<JSGlobalObject*>(init.owner), 1, String(), hasOwnLengthProperty)); 1116 }); 1117 1118 #if ENABLE(INTL) 1119 m_linkTimeConstants[static_cast<unsigned>(LinkTimeConstant::dateTimeFormat)].initLater([] (const Initializer<JSCell>& init) { 1120 init.set(JSFunction::create(init.vm, jsCast<JSGlobalObject*>(init.owner), 0, String(), globalFuncDateTimeFormat)); 1121 }); 1122 #endif // ENABLE(INTL) 1123 #if ENABLE(WEBASSEMBLY) && ENABLE(WEBASSEMBLY_STREAMING_API) 1124 // WebAssembly Streaming API 1125 m_linkTimeConstants[static_cast<unsigned>(LinkTimeConstant::webAssemblyCompileStreamingInternal)].initLater([] (const Initializer<JSCell>& init) { 1126 init.set(JSFunction::create(init.vm, jsCast<JSGlobalObject*>(init.owner), 1, String(), webAssemblyCompileStreamingInternal)); 1127 }); 1128 m_linkTimeConstants[static_cast<unsigned>(LinkTimeConstant::webAssemblyInstantiateStreamingInternal)].initLater([] (const Initializer<JSCell>& init) { 1129 init.set(JSFunction::create(init.vm, jsCast<JSGlobalObject*>(init.owner), 1, String(), webAssemblyInstantiateStreamingInternal)); 1130 }); 1131 #endif 995 1132 996 1133 GlobalPropertyInfo staticGlobals[] = { 997 #define INIT_PRIVATE_GLOBAL(varName, funcName, code) GlobalPropertyInfo(vm.propertyNames->builtinNames().funcName ## PrivateName(), varName ## PrivateFunction, PropertyAttribute::DontEnum | PropertyAttribute::DontDelete | PropertyAttribute::ReadOnly),998 JSC_FOREACH_BUILTIN_FUNCTION_PRIVATE_GLOBAL_NAME(INIT_PRIVATE_GLOBAL)999 #undef INIT_PRIVATE_GLOBAL1000 1134 GlobalPropertyInfo(vm.propertyNames->NaN, jsNaN(), PropertyAttribute::DontEnum | PropertyAttribute::DontDelete | PropertyAttribute::ReadOnly), 1001 1135 GlobalPropertyInfo(vm.propertyNames->Infinity, jsNumber(std::numeric_limits<double>::infinity()), PropertyAttribute::DontEnum | PropertyAttribute::DontDelete | PropertyAttribute::ReadOnly), 1002 1136 GlobalPropertyInfo(vm.propertyNames->undefinedKeyword, jsUndefined(), PropertyAttribute::DontEnum | PropertyAttribute::DontDelete | PropertyAttribute::ReadOnly), 1003 GlobalPropertyInfo(vm.propertyNames->builtinNames().propertyIsEnumerablePrivateName(), privateFuncPropertyIsEnumerable, PropertyAttribute::DontEnum | PropertyAttribute::DontDelete | PropertyAttribute::ReadOnly),1004 GlobalPropertyInfo(vm.propertyNames->builtinNames().ownKeysPrivateName(), privateFuncOwnKeys, PropertyAttribute::DontEnum | PropertyAttribute::DontDelete | PropertyAttribute::ReadOnly),1005 GlobalPropertyInfo(vm.propertyNames->builtinNames().importModulePrivateName(), privateFuncImportModule, PropertyAttribute::DontEnum | PropertyAttribute::DontDelete | PropertyAttribute::ReadOnly),1006 GlobalPropertyInfo(vm.propertyNames->builtinNames().enqueueJobPrivateName(), JSFunction::create(vm, this, 0, "enqueueJob"_s, enqueueJob), PropertyAttribute::DontEnum | PropertyAttribute::DontDelete | PropertyAttribute::ReadOnly),1007 GlobalPropertyInfo(vm.propertyNames->builtinNames().makeTypeErrorPrivateName(), privateFuncMakeTypeError, PropertyAttribute::DontEnum | PropertyAttribute::DontDelete | PropertyAttribute::ReadOnly),1008 GlobalPropertyInfo(vm.propertyNames->builtinNames().typedArrayLengthPrivateName(), privateFuncTypedArrayLength, PropertyAttribute::DontEnum | PropertyAttribute::DontDelete | PropertyAttribute::ReadOnly),1009 GlobalPropertyInfo(vm.propertyNames->builtinNames().typedArrayGetOriginalConstructorPrivateName(), privateFuncTypedArrayGetOriginalConstructor, PropertyAttribute::DontEnum | PropertyAttribute::DontDelete | PropertyAttribute::ReadOnly),1010 GlobalPropertyInfo(vm.propertyNames->builtinNames().typedArraySortPrivateName(), privateFuncTypedArraySort, PropertyAttribute::DontEnum | PropertyAttribute::DontDelete | PropertyAttribute::ReadOnly),1011 GlobalPropertyInfo(vm.propertyNames->builtinNames().isTypedArrayViewPrivateName(), privateFuncIsTypedArrayView, PropertyAttribute::DontEnum | PropertyAttribute::DontDelete | PropertyAttribute::ReadOnly),1012 GlobalPropertyInfo(vm.propertyNames->builtinNames().typedArraySubarrayCreatePrivateName(), privateFuncTypedArraySubarrayCreate, PropertyAttribute::DontEnum | PropertyAttribute::DontDelete | PropertyAttribute::ReadOnly),1013 GlobalPropertyInfo(vm.propertyNames->builtinNames().isBoundFunctionPrivateName(), privateFuncIsBoundFunction, PropertyAttribute::DontEnum | PropertyAttribute::DontDelete | PropertyAttribute::ReadOnly),1014 GlobalPropertyInfo(vm.propertyNames->builtinNames().hasInstanceBoundFunctionPrivateName(), privateFuncHasInstanceBoundFunction, PropertyAttribute::DontEnum | PropertyAttribute::DontDelete | PropertyAttribute::ReadOnly),1015 GlobalPropertyInfo(vm.propertyNames->builtinNames().instanceOfPrivateName(), privateFuncInstanceOf, PropertyAttribute::DontEnum | PropertyAttribute::DontDelete | PropertyAttribute::ReadOnly),1016 GlobalPropertyInfo(vm.propertyNames->builtinNames().BuiltinLogPrivateName(), builtinLog, PropertyAttribute::DontEnum | PropertyAttribute::DontDelete | PropertyAttribute::ReadOnly),1017 GlobalPropertyInfo(vm.propertyNames->builtinNames().BuiltinDescribePrivateName(), builtinDescribe, PropertyAttribute::DontEnum | PropertyAttribute::DontDelete | PropertyAttribute::ReadOnly),1018 GlobalPropertyInfo(vm.propertyNames->builtinNames().RegExpPrivateName(), regExpConstructor, PropertyAttribute::DontEnum | PropertyAttribute::DontDelete | PropertyAttribute::ReadOnly),1019 GlobalPropertyInfo(vm.propertyNames->builtinNames().truncPrivateName(), privateFuncTrunc, PropertyAttribute::DontEnum | PropertyAttribute::DontDelete | PropertyAttribute::ReadOnly),1020 GlobalPropertyInfo(vm.propertyNames->builtinNames().PromisePrivateName(), promiseConstructor, PropertyAttribute::DontEnum | PropertyAttribute::DontDelete | PropertyAttribute::ReadOnly),1021 GlobalPropertyInfo(vm.propertyNames->builtinNames().InternalPromisePrivateName(), internalPromiseConstructor, PropertyAttribute::DontEnum | PropertyAttribute::DontDelete | PropertyAttribute::ReadOnly),1022 GlobalPropertyInfo(vm.propertyNames->builtinNames().defaultPromiseThenPrivateName(), promiseProtoThenFunction(), PropertyAttribute::DontEnum | PropertyAttribute::DontDelete | PropertyAttribute::ReadOnly),1023 1024 GlobalPropertyInfo(vm.propertyNames->builtinNames().repeatCharacterPrivateName(), JSFunction::create(vm, this, 2, String(), stringProtoFuncRepeatCharacter), PropertyAttribute::DontEnum | PropertyAttribute::DontDelete | PropertyAttribute::ReadOnly),1025 GlobalPropertyInfo(vm.propertyNames->builtinNames().arraySpeciesCreatePrivateName(), JSFunction::create(vm, this, 2, String(), arrayProtoFuncSpeciesCreate), PropertyAttribute::DontEnum | PropertyAttribute::DontDelete | PropertyAttribute::ReadOnly),1026 GlobalPropertyInfo(vm.propertyNames->builtinNames().isArrayPrivateName(), arrayConstructor->getDirect(vm, vm.propertyNames->isArray), PropertyAttribute::DontEnum | PropertyAttribute::DontDelete | PropertyAttribute::ReadOnly),1027 GlobalPropertyInfo(vm.propertyNames->builtinNames().isArraySlowPrivateName(), privateFuncIsArraySlow, PropertyAttribute::DontEnum | PropertyAttribute::DontDelete | PropertyAttribute::ReadOnly),1028 GlobalPropertyInfo(vm.propertyNames->builtinNames().concatMemcpyPrivateName(), privateFuncConcatMemcpy, PropertyAttribute::DontEnum | PropertyAttribute::DontDelete | PropertyAttribute::ReadOnly),1029 GlobalPropertyInfo(vm.propertyNames->builtinNames().appendMemcpyPrivateName(), privateFuncAppendMemcpy, PropertyAttribute::DontEnum | PropertyAttribute::DontDelete | PropertyAttribute::ReadOnly),1030 1031 GlobalPropertyInfo(vm.propertyNames->builtinNames().hostPromiseRejectionTrackerPrivateName(), JSFunction::create(vm, this, 2, String(), globalFuncHostPromiseRejectionTracker), PropertyAttribute::DontEnum | PropertyAttribute::DontDelete | PropertyAttribute::ReadOnly),1032 GlobalPropertyInfo(vm.propertyNames->builtinNames().InspectorInstrumentationPrivateName(), InspectorInstrumentationObject::create(vm, this, InspectorInstrumentationObject::createStructure(vm, this, m_objectPrototype.get())), PropertyAttribute::DontEnum | PropertyAttribute::DontDelete | PropertyAttribute::ReadOnly),1033 GlobalPropertyInfo(vm.propertyNames->builtinNames().SetPrivateName(), setConstructor, PropertyAttribute::DontEnum | PropertyAttribute::DontDelete | PropertyAttribute::ReadOnly),1034 GlobalPropertyInfo(vm.propertyNames->builtinNames().thisTimeValuePrivateName(), privateFuncThisTimeValue, PropertyAttribute::DontEnum | PropertyAttribute::DontDelete | PropertyAttribute::ReadOnly),1035 #if ENABLE(INTL)1036 GlobalPropertyInfo(vm.propertyNames->builtinNames().dateTimeFormatPrivateName(), privateFuncDateTimeFormat, PropertyAttribute::DontEnum | PropertyAttribute::DontDelete | PropertyAttribute::ReadOnly),1037 #endif // ENABLE(INTL)1038 1039 GlobalPropertyInfo(vm.propertyNames->builtinNames().isConstructorPrivateName(), JSFunction::create(vm, this, 1, String(), esSpecIsConstructor, NoIntrinsic), PropertyAttribute::DontEnum | PropertyAttribute::DontDelete | PropertyAttribute::ReadOnly),1040 1041 GlobalPropertyInfo(vm.propertyNames->builtinNames().regExpProtoFlagsGetterPrivateName(), regExpProtoFlagsGetter, PropertyAttribute::DontEnum | PropertyAttribute::DontDelete | PropertyAttribute::ReadOnly),1042 GlobalPropertyInfo(vm.propertyNames->builtinNames().regExpProtoGlobalGetterPrivateName(), regExpProtoGlobalGetter, PropertyAttribute::DontEnum | PropertyAttribute::DontDelete | PropertyAttribute::ReadOnly),1043 GlobalPropertyInfo(vm.propertyNames->builtinNames().regExpProtoIgnoreCaseGetterPrivateName(), regExpProtoIgnoreCaseGetter, PropertyAttribute::DontEnum | PropertyAttribute::DontDelete | PropertyAttribute::ReadOnly),1044 GlobalPropertyInfo(vm.propertyNames->builtinNames().regExpProtoMultilineGetterPrivateName(), regExpProtoMultilineGetter, PropertyAttribute::DontEnum | PropertyAttribute::DontDelete | PropertyAttribute::ReadOnly),1045 GlobalPropertyInfo(vm.propertyNames->builtinNames().regExpProtoSourceGetterPrivateName(), regExpProtoSourceGetter, PropertyAttribute::DontEnum | PropertyAttribute::DontDelete | PropertyAttribute::ReadOnly),1046 GlobalPropertyInfo(vm.propertyNames->builtinNames().regExpProtoStickyGetterPrivateName(), regExpProtoStickyGetter, PropertyAttribute::DontEnum | PropertyAttribute::DontDelete | PropertyAttribute::ReadOnly),1047 GlobalPropertyInfo(vm.propertyNames->builtinNames().regExpProtoUnicodeGetterPrivateName(), regExpProtoUnicodeGetter, PropertyAttribute::DontEnum | PropertyAttribute::DontDelete | PropertyAttribute::ReadOnly),1048 1049 // RegExp.prototype helpers.1050 GlobalPropertyInfo(vm.propertyNames->builtinNames().regExpBuiltinExecPrivateName(), builtinRegExpExec, PropertyAttribute::DontEnum | PropertyAttribute::DontDelete | PropertyAttribute::ReadOnly),1051 GlobalPropertyInfo(vm.propertyNames->builtinNames().regExpCreatePrivateName(), JSFunction::create(vm, this, 2, String(), esSpecRegExpCreate, NoIntrinsic), PropertyAttribute::DontEnum | PropertyAttribute::DontDelete | PropertyAttribute::ReadOnly),1052 GlobalPropertyInfo(vm.propertyNames->builtinNames().isRegExpPrivateName(), JSFunction::create(vm, this, 1, String(), esSpecIsRegExp, NoIntrinsic), PropertyAttribute::DontEnum | PropertyAttribute::DontDelete | PropertyAttribute::ReadOnly),1053 GlobalPropertyInfo(vm.propertyNames->builtinNames().regExpMatchFastPrivateName(), JSFunction::create(vm, this, 1, String(), regExpProtoFuncMatchFast, RegExpMatchFastIntrinsic), PropertyAttribute::DontEnum | PropertyAttribute::DontDelete | PropertyAttribute::ReadOnly),1054 GlobalPropertyInfo(vm.propertyNames->builtinNames().regExpSearchFastPrivateName(), JSFunction::create(vm, this, 1, String(), regExpProtoFuncSearchFast), PropertyAttribute::DontEnum | PropertyAttribute::DontDelete | PropertyAttribute::ReadOnly),1055 GlobalPropertyInfo(vm.propertyNames->builtinNames().regExpSplitFastPrivateName(), JSFunction::create(vm, this, 2, String(), regExpProtoFuncSplitFast), PropertyAttribute::DontEnum | PropertyAttribute::DontDelete | PropertyAttribute::ReadOnly),1056 GlobalPropertyInfo(vm.propertyNames->builtinNames().regExpPrototypeSymbolReplacePrivateName(), m_regExpPrototype->getDirect(vm, vm.propertyNames->replaceSymbol), PropertyAttribute::DontEnum | PropertyAttribute::DontDelete | PropertyAttribute::ReadOnly),1057 GlobalPropertyInfo(vm.propertyNames->builtinNames().regExpTestFastPrivateName(), JSFunction::create(vm, this, 1, String(), regExpProtoFuncTestFast, RegExpTestFastIntrinsic), PropertyAttribute::DontEnum | PropertyAttribute::DontDelete | PropertyAttribute::ReadOnly),1058 1059 // String.prototype helpers.1060 GlobalPropertyInfo(vm.propertyNames->builtinNames().stringIncludesInternalPrivateName(), JSFunction::create(vm, this, 1, String(), builtinStringIncludesInternal), PropertyAttribute::DontEnum | PropertyAttribute::DontDelete | PropertyAttribute::ReadOnly),1061 GlobalPropertyInfo(vm.propertyNames->builtinNames().stringSplitFastPrivateName(), JSFunction::create(vm, this, 2, String(), stringProtoFuncSplitFast), PropertyAttribute::DontEnum | PropertyAttribute::DontDelete | PropertyAttribute::ReadOnly),1062 GlobalPropertyInfo(vm.propertyNames->builtinNames().stringSubstrInternalPrivateName(), JSFunction::create(vm, this, 2, String(), builtinStringSubstrInternal), PropertyAttribute::DontEnum | PropertyAttribute::DontDelete | PropertyAttribute::ReadOnly),1063 1064 // Function prototype helpers.1065 GlobalPropertyInfo(vm.propertyNames->builtinNames().makeBoundFunctionPrivateName(), JSFunction::create(vm, this, 5, String(), makeBoundFunction), PropertyAttribute::DontEnum | PropertyAttribute::DontDelete | PropertyAttribute::ReadOnly),1066 GlobalPropertyInfo(vm.propertyNames->builtinNames().hasOwnLengthPropertyPrivateName(), JSFunction::create(vm, this, 1, String(), hasOwnLengthProperty), PropertyAttribute::DontEnum | PropertyAttribute::DontDelete | PropertyAttribute::ReadOnly),1067 1068 // Map and Set helpers.1069 GlobalPropertyInfo(vm.propertyNames->builtinNames().mapBucketHeadPrivateName(), privateFuncMapBucketHead, PropertyAttribute::DontEnum | PropertyAttribute::DontDelete | PropertyAttribute::ReadOnly),1070 GlobalPropertyInfo(vm.propertyNames->builtinNames().mapBucketNextPrivateName(), privateFuncMapBucketNext, PropertyAttribute::DontEnum | PropertyAttribute::DontDelete | PropertyAttribute::ReadOnly),1071 GlobalPropertyInfo(vm.propertyNames->builtinNames().mapBucketKeyPrivateName(), privateFuncMapBucketKey, PropertyAttribute::DontEnum | PropertyAttribute::DontDelete | PropertyAttribute::ReadOnly),1072 GlobalPropertyInfo(vm.propertyNames->builtinNames().mapBucketValuePrivateName(), privateFuncMapBucketValue, PropertyAttribute::DontEnum | PropertyAttribute::DontDelete | PropertyAttribute::ReadOnly),1073 GlobalPropertyInfo(vm.propertyNames->builtinNames().setBucketHeadPrivateName(), privateFuncSetBucketHead, PropertyAttribute::DontEnum | PropertyAttribute::DontDelete | PropertyAttribute::ReadOnly),1074 GlobalPropertyInfo(vm.propertyNames->builtinNames().setBucketNextPrivateName(), privateFuncSetBucketNext, PropertyAttribute::DontEnum | PropertyAttribute::DontDelete | PropertyAttribute::ReadOnly),1075 GlobalPropertyInfo(vm.propertyNames->builtinNames().setBucketKeyPrivateName(), privateFuncSetBucketKey, PropertyAttribute::DontEnum | PropertyAttribute::DontDelete | PropertyAttribute::ReadOnly),1076 #if ENABLE(WEBASSEMBLY) && ENABLE(WEBASSEMBLY_STREAMING_API)1077 // WebAssembly Streaming API1078 GlobalPropertyInfo(vm.propertyNames->builtinNames().webAssemblyCompileStreamingInternalPrivateName(), JSFunction::create(vm, this, 1, String(), webAssemblyCompileStreamingInternal), PropertyAttribute::DontEnum | PropertyAttribute::DontDelete | PropertyAttribute::ReadOnly),1079 GlobalPropertyInfo(vm.propertyNames->builtinNames().webAssemblyInstantiateStreamingInternalPrivateName(), JSFunction::create(vm, this, 1, String(), webAssemblyInstantiateStreamingInternal), PropertyAttribute::DontEnum | PropertyAttribute::DontDelete | PropertyAttribute::ReadOnly),1080 #endif1081 1137 #if !ASSERT_DISABLED 1082 1138 GlobalPropertyInfo(vm.propertyNames->builtinNames().assertPrivateName(), JSFunction::create(vm, this, 1, String(), assertCall), PropertyAttribute::DontEnum | PropertyAttribute::DontDelete | PropertyAttribute::ReadOnly), … … 1085 1141 addStaticGlobals(staticGlobals, WTF_ARRAY_LENGTH(staticGlobals)); 1086 1142 1087 m_specialPointers[Special::CallFunction] = m_callFunction.get();1088 m_specialPointers[Special::ApplyFunction] = m_applyFunction.get();1089 m_specialPointers[Special::ObjectConstructor] = objectConstructor;1090 m_specialPointers[Special::ArrayConstructor] = arrayConstructor;1091 1092 m_linkTimeConstants[static_cast<unsigned>(LinkTimeConstant::ThrowTypeErrorFunction)] = m_throwTypeErrorFunction.get();1093 1094 1143 if (UNLIKELY(Options::useDollarVM())) 1095 1144 exposeDollarVM(vm); … … 1712 1761 thisObject->m_parseIntFunction.visit(visitor); 1713 1762 thisObject->m_parseFloatFunction.visit(visitor); 1714 visitor.append(thisObject->m_callFunction);1715 visitor.append(thisObject->m_applyFunction);1716 visitor.append(thisObject->m_throwTypeErrorFunction);1717 1763 thisObject->m_arrayProtoToStringFunction.visit(visitor); 1718 1764 thisObject->m_arrayProtoValuesFunction.visit(visitor); … … 1720 1766 thisObject->m_iteratorProtocolFunction.visit(visitor); 1721 1767 thisObject->m_promiseResolveFunction.visit(visitor); 1722 visitor.append(thisObject->m_newPromiseCapabilityFunction);1723 visitor.append(thisObject->m_resolvePromiseFunction);1724 visitor.append(thisObject->m_rejectPromiseFunction);1725 visitor.append(thisObject->m_promiseProtoThenFunction);1726 1768 visitor.append(thisObject->m_objectProtoValueOfFunction); 1727 1769 visitor.append(thisObject->m_numberProtoToStringFunction); 1728 1770 visitor.append(thisObject->m_functionProtoHasInstanceSymbolFunction); 1729 1771 thisObject->m_throwTypeErrorGetterSetter.visit(visitor); 1772 visitor.append(thisObject->m_regExpProtoSymbolReplace); 1730 1773 visitor.append(thisObject->m_throwTypeErrorArgumentsCalleeAndCallerGetterSetter); 1731 1774 thisObject->m_moduleLoader.visit(visitor); … … 1795 1838 thisObject->m_callableProxyObjectStructure.visit(visitor); 1796 1839 thisObject->m_proxyRevokeStructure.visit(visitor); 1840 1841 for (auto& property : thisObject->m_linkTimeConstants) 1842 property.visit(visitor); 1797 1843 1798 1844 #if ENABLE(SHARED_ARRAY_BUFFER) -
trunk/Source/JavaScriptCore/runtime/JSGlobalObject.h
r251882 r252032 43 43 #include "RegExpGlobalData.h" 44 44 #include "RuntimeFlags.h" 45 #include "SpecialPointer.h"46 45 #include "StringPrototype.h" 47 46 #include "SymbolPrototype.h" … … 120 119 struct ActivationStackNode; 121 120 struct HashTable; 121 enum class LinkTimeConstant : int32_t; 122 122 123 123 #ifdef JSC_GLIB_API_ENABLED … … 298 298 LazyProperty<JSGlobalObject, JSFunction> m_parseFloatFunction; 299 299 300 WriteBarrier<JSFunction> m_callFunction;301 WriteBarrier<JSFunction> m_applyFunction;302 WriteBarrier<JSFunction> m_throwTypeErrorFunction;303 300 LazyProperty<JSGlobalObject, JSFunction> m_arrayProtoToStringFunction; 304 301 LazyProperty<JSGlobalObject, JSFunction> m_arrayProtoValuesFunction; … … 306 303 LazyProperty<JSGlobalObject, JSFunction> m_iteratorProtocolFunction; 307 304 LazyProperty<JSGlobalObject, JSFunction> m_promiseResolveFunction; 308 WriteBarrier<JSFunction> m_newPromiseCapabilityFunction;309 WriteBarrier<JSFunction> m_resolvePromiseFunction;310 WriteBarrier<JSFunction> m_rejectPromiseFunction;311 WriteBarrier<JSFunction> m_promiseProtoThenFunction;312 305 WriteBarrier<JSFunction> m_objectProtoValueOfFunction; 313 306 WriteBarrier<JSFunction> m_numberProtoToStringFunction; 314 307 WriteBarrier<JSFunction> m_functionProtoHasInstanceSymbolFunction; 315 308 LazyProperty<JSGlobalObject, GetterSetter> m_throwTypeErrorGetterSetter; 316 WriteBarrier<JSObject> m_regExpProtoExec;317 309 WriteBarrier<JSObject> m_regExpProtoSymbolReplace; 318 WriteBarrier<GetterSetter> m_regExpProtoGlobalGetter;319 WriteBarrier<GetterSetter> m_regExpProtoUnicodeGetter;320 310 WriteBarrier<GetterSetter> m_throwTypeErrorArgumentsCalleeAndCallerGetterSetter; 321 311 … … 431 421 #undef DECLARE_TYPED_ARRAY_TYPE_STRUCTURE 432 422 433 JSCell* m_specialPointers[Special::TableSize]; // Special pointers used by the LLInt and JIT. 434 JSCell* m_linkTimeConstants[LinkTimeConstantCount]; 423 Vector<LazyProperty<JSGlobalObject, JSCell>> m_linkTimeConstants; 435 424 436 425 String m_name; … … 617 606 618 607 JSFunction* evalFunction() const { return m_evalFunction.get(this); } 619 JSFunction* callFunction() const { return m_callFunction.get(); } 620 JSFunction* applyFunction() const { return m_applyFunction.get(); } 621 JSFunction* throwTypeErrorFunction() const { return m_throwTypeErrorFunction.get(); } 608 JSFunction* throwTypeErrorFunction() const; 622 609 JSFunction* arrayProtoToStringFunction() const { return m_arrayProtoToStringFunction.get(this); } 623 610 JSFunction* arrayProtoValuesFunction() const { return m_arrayProtoValuesFunction.get(this); } 624 611 JSFunction* iteratorProtocolFunction() const { return m_iteratorProtocolFunction.get(this); } 625 JSFunction* newPromiseCapabilityFunction() const { return m_newPromiseCapabilityFunction.get(); }612 JSFunction* newPromiseCapabilityFunction() const; 626 613 JSFunction* promiseResolveFunction() const { return m_promiseResolveFunction.get(this); } 627 JSFunction* resolvePromiseFunction() const { return m_resolvePromiseFunction.get(); }628 JSFunction* rejectPromiseFunction() const { return m_rejectPromiseFunction.get(); }629 JSFunction* promiseProtoThenFunction() const { return m_promiseProtoThenFunction.get(); }614 JSFunction* resolvePromiseFunction() const; 615 JSFunction* rejectPromiseFunction() const; 616 JSFunction* promiseProtoThenFunction() const; 630 617 JSFunction* objectProtoValueOfFunction() const { return m_objectProtoValueOfFunction.get(); } 631 618 JSFunction* numberProtoToStringFunction() const { return m_numberProtoToStringFunction.get(); } 632 619 JSFunction* functionProtoHasInstanceSymbolFunction() const { return m_functionProtoHasInstanceSymbolFunction.get(); } 633 JS Object* regExpProtoExecFunction() const { return m_regExpProtoExec.get(); }620 JSFunction* regExpProtoExecFunction() const; 634 621 JSObject* regExpProtoSymbolReplaceFunction() const { return m_regExpProtoSymbolReplace.get(); } 635 GetterSetter* regExpProtoGlobalGetter() const { return m_regExpProtoGlobalGetter.get(); }636 GetterSetter* regExpProtoUnicodeGetter() const { return m_regExpProtoUnicodeGetter.get(); }622 GetterSetter* regExpProtoGlobalGetter() const; 623 GetterSetter* regExpProtoUnicodeGetter() const; 637 624 GetterSetter* throwTypeErrorArgumentsCalleeAndCallerGetterSetter() 638 625 { … … 912 899 } 913 900 914 JSCell* actualPointerFor(Special::Pointer pointer) 915 { 916 ASSERT(pointer < Special::TableSize); 917 return m_specialPointers[pointer]; 918 } 919 JSCell* jsCellForLinkTimeConstant(LinkTimeConstant type) 920 { 921 unsigned index = static_cast<unsigned>(type); 922 ASSERT(index < LinkTimeConstantCount); 923 return m_linkTimeConstants[index]; 901 JSCell* linkTimeConstant(LinkTimeConstant value) const 902 { 903 JSCell* result = m_linkTimeConstants[static_cast<unsigned>(value)].getInitializedOnMainThread(this); 904 ASSERT(result); 905 return result; 924 906 } 925 907 -
trunk/Source/JavaScriptCore/runtime/JSGlobalObjectInlines.h
r251425 r252032 30 30 #include "ArrayConstructor.h" 31 31 #include "ArrayPrototype.h" 32 #include "JSFunction.h" 33 #include "LinkTimeConstant.h" 32 34 #include "ObjectPrototype.h" 33 35 … … 103 105 } 104 106 107 inline JSFunction* JSGlobalObject::throwTypeErrorFunction() const { return jsCast<JSFunction*>(linkTimeConstant(LinkTimeConstant::throwTypeErrorFunction)); } 108 inline JSFunction* JSGlobalObject::newPromiseCapabilityFunction() const { return jsCast<JSFunction*>(linkTimeConstant(LinkTimeConstant::newPromiseCapability)); } 109 inline JSFunction* JSGlobalObject::resolvePromiseFunction() const { return jsCast<JSFunction*>(linkTimeConstant(LinkTimeConstant::resolvePromise)); } 110 inline JSFunction* JSGlobalObject::rejectPromiseFunction() const { return jsCast<JSFunction*>(linkTimeConstant(LinkTimeConstant::rejectPromise)); } 111 inline JSFunction* JSGlobalObject::promiseProtoThenFunction() const { return jsCast<JSFunction*>(linkTimeConstant(LinkTimeConstant::defaultPromiseThen)); } 112 inline JSFunction* JSGlobalObject::regExpProtoExecFunction() const { return jsCast<JSFunction*>(linkTimeConstant(LinkTimeConstant::regExpBuiltinExec)); } 113 inline GetterSetter* JSGlobalObject::regExpProtoGlobalGetter() const { return bitwise_cast<GetterSetter*>(linkTimeConstant(LinkTimeConstant::regExpProtoGlobalGetter)); } 114 inline GetterSetter* JSGlobalObject::regExpProtoUnicodeGetter() const { return bitwise_cast<GetterSetter*>(linkTimeConstant(LinkTimeConstant::regExpProtoUnicodeGetter)); } 115 105 116 ALWAYS_INLINE VM& getVM(JSGlobalObject* globalObject) 106 117 {
Note: See TracChangeset
for help on using the changeset viewer.