Changeset 199073 in webkit
- Timestamp:
- Apr 5, 2016 2:36:25 PM (8 years ago)
- Location:
- trunk/Source/JavaScriptCore
- Files:
-
- 1 added
- 40 edited
Legend:
- Unmodified
- Added
- Removed
-
trunk/Source/JavaScriptCore/ChangeLog
r199070 r199073 1 2016-04-05 Keith Miller <keith_miller@apple.com> 2 3 We should support the ability to do a non-effectful getById 4 https://bugs.webkit.org/show_bug.cgi?id=156116 5 6 Reviewed by Benjamin Poulain. 7 8 Currently, there is no way in JS to do a non-effectful getById. A non-effectful getById is 9 useful because it enables us to take different code paths based on values that we would 10 otherwise not be able to have knowledge of. This patch adds this new feature called 11 try_get_by_id that will attempt to do as much of a get_by_id as possible without performing 12 an effectful behavior. Thus, try_get_by_id will return the value if the slot is a value, the 13 GetterSetter object if the slot is a normal accessor (not a CustomGetterSetter) and 14 undefined if the slot is unset. If the slot is proxied or any other cases then the result 15 is null. In theory, if we ever wanted to check for null we could add a sentinal object to 16 the global object that indicates we could not get the result. 17 18 In order to implement this feature we add a new enum GetByIdKind that indicates what to do 19 for accessor properties in PolymorphicAccess. If the GetByIdKind is pure then we treat the 20 get_by_id the same way we would for load and return the value at the appropriate offset. 21 Additionally, in order to make sure the we can properly compare the GetterSetter object 22 with === GetterSetters are now JSObjects. This comes at the cost of eight extra bytes on the 23 GetterSetter object but it vastly simplifies the patch. Additionally, the extra bytes are 24 likely to have little to no impact on memory usage as normal accessors are generally rare. 25 26 * JavaScriptCore.xcodeproj/project.pbxproj: 27 * builtins/BuiltinExecutables.cpp: 28 (JSC::BuiltinExecutables::createDefaultConstructor): 29 (JSC::BuiltinExecutables::createBuiltinExecutable): 30 (JSC::createBuiltinExecutable): 31 (JSC::BuiltinExecutables::createExecutable): 32 (JSC::createExecutableInternal): Deleted. 33 * builtins/BuiltinExecutables.h: 34 * bytecode/BytecodeIntrinsicRegistry.h: 35 * bytecode/BytecodeList.json: 36 * bytecode/BytecodeUseDef.h: 37 (JSC::computeUsesForBytecodeOffset): 38 (JSC::computeDefsForBytecodeOffset): 39 * bytecode/CodeBlock.cpp: 40 (JSC::CodeBlock::dumpBytecode): 41 * bytecode/PolymorphicAccess.cpp: 42 (JSC::AccessCase::tryGet): 43 (JSC::AccessCase::generate): 44 (WTF::printInternal): 45 * bytecode/PolymorphicAccess.h: 46 (JSC::AccessCase::isGet): Deleted. 47 (JSC::AccessCase::isPut): Deleted. 48 (JSC::AccessCase::isIn): Deleted. 49 * bytecode/StructureStubInfo.cpp: 50 (JSC::StructureStubInfo::reset): 51 * bytecode/StructureStubInfo.h: 52 * bytecompiler/BytecodeGenerator.cpp: 53 (JSC::BytecodeGenerator::emitTryGetById): 54 * bytecompiler/BytecodeGenerator.h: 55 * bytecompiler/NodesCodegen.cpp: 56 (JSC::BytecodeIntrinsicNode::emit_intrinsic_tryGetById): 57 * dfg/DFGSpeculativeJIT32_64.cpp: 58 (JSC::DFG::SpeculativeJIT::cachedGetById): 59 * dfg/DFGSpeculativeJIT64.cpp: 60 (JSC::DFG::SpeculativeJIT::cachedGetById): 61 * ftl/FTLLowerDFGToB3.cpp: 62 (JSC::FTL::DFG::LowerDFGToB3::getById): 63 * jit/JIT.cpp: 64 (JSC::JIT::privateCompileMainPass): 65 (JSC::JIT::privateCompileSlowCases): 66 * jit/JIT.h: 67 * jit/JITInlineCacheGenerator.cpp: 68 (JSC::JITGetByIdGenerator::JITGetByIdGenerator): 69 * jit/JITInlineCacheGenerator.h: 70 * jit/JITInlines.h: 71 (JSC::JIT::callOperation): 72 * jit/JITOperations.cpp: 73 * jit/JITOperations.h: 74 * jit/JITPropertyAccess.cpp: 75 (JSC::JIT::emitGetByValWithCachedId): 76 (JSC::JIT::emit_op_try_get_by_id): 77 (JSC::JIT::emitSlow_op_try_get_by_id): 78 (JSC::JIT::emit_op_get_by_id): 79 * jit/JITPropertyAccess32_64.cpp: 80 (JSC::JIT::emitGetByValWithCachedId): 81 (JSC::JIT::emit_op_try_get_by_id): 82 (JSC::JIT::emitSlow_op_try_get_by_id): 83 (JSC::JIT::emit_op_get_by_id): 84 * jit/Repatch.cpp: 85 (JSC::repatchByIdSelfAccess): 86 (JSC::appropriateOptimizingGetByIdFunction): 87 (JSC::appropriateGenericGetByIdFunction): 88 (JSC::tryCacheGetByID): 89 (JSC::repatchGetByID): 90 (JSC::resetGetByID): 91 * jit/Repatch.h: 92 * jsc.cpp: 93 (GlobalObject::finishCreation): 94 (functionGetGetterSetter): 95 (functionCreateBuiltin): 96 * llint/LLIntData.cpp: 97 (JSC::LLInt::Data::performAssertions): 98 * llint/LLIntSlowPaths.cpp: 99 (JSC::LLInt::LLINT_SLOW_PATH_DECL): 100 * llint/LLIntSlowPaths.h: 101 * llint/LowLevelInterpreter.asm: 102 * runtime/GetterSetter.cpp: 103 * runtime/GetterSetter.h: 104 * runtime/JSType.h: 105 * runtime/PropertySlot.cpp: 106 (JSC::PropertySlot::getPureResult): 107 * runtime/PropertySlot.h: 108 * runtime/ProxyObject.cpp: 109 (JSC::ProxyObject::getOwnPropertySlotCommon): 110 * tests/stress/try-get-by-id.js: Added. 111 (tryGetByIdText): 112 (getCaller.obj.1.throw.new.Error.let.func): 113 (getCaller.obj.1.throw.new.Error): 114 (throw.new.Error.get let): 115 (throw.new.Error.): 116 (throw.new.Error.let.get createBuiltin): 117 (get let): 118 (let.get createBuiltin): 119 (let.func): 120 (get let.func): 121 (get throw): 122 1 123 2016-04-05 Saam barati <sbarati@apple.com> 2 124 -
trunk/Source/JavaScriptCore/JavaScriptCore.xcodeproj/project.pbxproj
r199035 r199073 2509 2509 0F46809D14BA7F8200BFE272 /* LLIntExceptions.cpp */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.cpp.cpp; name = LLIntExceptions.cpp; path = llint/LLIntExceptions.cpp; sourceTree = "<group>"; }; 2510 2510 0F46809E14BA7F8200BFE272 /* LLIntExceptions.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; name = LLIntExceptions.h; path = llint/LLIntExceptions.h; sourceTree = "<group>"; }; 2511 0F46809F14BA7F8200BFE272 /* LLIntSlowPaths.cpp */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.cpp.cpp; name = LLIntSlowPaths.cpp; path = llint/LLIntSlowPaths.cpp; sourceTree = "<group>"; };2512 0F4680A014BA7F8200BFE272 /* LLIntSlowPaths.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; name = LLIntSlowPaths.h; path = llint/LLIntSlowPaths.h; sourceTree = "<group>"; };2511 0F46809F14BA7F8200BFE272 /* LLIntSlowPaths.cpp */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.cpp.cpp; lineEnding = 0; name = LLIntSlowPaths.cpp; path = llint/LLIntSlowPaths.cpp; sourceTree = "<group>"; xcLanguageSpecificationIdentifier = xcode.lang.cpp; }; 2512 0F4680A014BA7F8200BFE272 /* LLIntSlowPaths.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; lineEnding = 0; name = LLIntSlowPaths.h; path = llint/LLIntSlowPaths.h; sourceTree = "<group>"; xcLanguageSpecificationIdentifier = xcode.lang.objcpp; }; 2513 2513 0F4680A114BA7F8200BFE272 /* LLIntOffsetsExtractor.cpp */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.cpp.cpp; name = LLIntOffsetsExtractor.cpp; path = llint/LLIntOffsetsExtractor.cpp; sourceTree = "<group>"; }; 2514 2514 0F4680C514BBB16900BFE272 /* LLIntCommon.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; name = LLIntCommon.h; path = llint/LLIntCommon.h; sourceTree = "<group>"; }; … … 2644 2644 0F8364B5164B0C0E0053329A /* DFGBranchDirection.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; name = DFGBranchDirection.h; path = dfg/DFGBranchDirection.h; sourceTree = "<group>"; }; 2645 2645 0F86AE1F1C5311C5006BE8EC /* B3ComputeDivisionMagic.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; name = B3ComputeDivisionMagic.h; path = b3/B3ComputeDivisionMagic.h; sourceTree = "<group>"; }; 2646 0F885E101849A3BE00F1E3FA /* BytecodeUseDef.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; path = BytecodeUseDef.h; sourceTree = "<group>"; };2646 0F885E101849A3BE00F1E3FA /* BytecodeUseDef.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; lineEnding = 0; path = BytecodeUseDef.h; sourceTree = "<group>"; xcLanguageSpecificationIdentifier = xcode.lang.objcpp; }; 2647 2647 0F893BDA1936E23C001211F4 /* DFGStructureAbstractValue.cpp */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.cpp.cpp; name = DFGStructureAbstractValue.cpp; path = dfg/DFGStructureAbstractValue.cpp; sourceTree = "<group>"; }; 2648 2648 0F898F2F1B27689F0083A33C /* DFGIntegerRangeOptimizationPhase.cpp */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.cpp.cpp; name = DFGIntegerRangeOptimizationPhase.cpp; path = dfg/DFGIntegerRangeOptimizationPhase.cpp; sourceTree = "<group>"; }; … … 3123 3123 1429D8DB0ED2205B00B89619 /* CallFrame.cpp */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.cpp.cpp; path = CallFrame.cpp; sourceTree = "<group>"; }; 3124 3124 1429D8DC0ED2205B00B89619 /* CallFrame.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; lineEnding = 0; path = CallFrame.h; sourceTree = "<group>"; xcLanguageSpecificationIdentifier = xcode.lang.objcpp; }; 3125 1429D92D0ED22D7000B89619 /* JIT.cpp */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.cpp.cpp; path = JIT.cpp; sourceTree = "<group>"; };3126 1429D92E0ED22D7000B89619 /* JIT.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; path = JIT.h; sourceTree = "<group>"; };3125 1429D92D0ED22D7000B89619 /* JIT.cpp */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.cpp.cpp; lineEnding = 0; path = JIT.cpp; sourceTree = "<group>"; xcLanguageSpecificationIdentifier = xcode.lang.cpp; }; 3126 1429D92E0ED22D7000B89619 /* JIT.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; lineEnding = 0; path = JIT.h; sourceTree = "<group>"; xcLanguageSpecificationIdentifier = xcode.lang.objcpp; }; 3127 3127 142D3938103E4560007DCB52 /* NumericStrings.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; path = NumericStrings.h; sourceTree = "<group>"; }; 3128 3128 142D6F0613539A2800B02E86 /* MarkedBlock.cpp */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.cpp.cpp; path = MarkedBlock.cpp; sourceTree = "<group>"; }; … … 3336 3336 651122E5140469BA002B101D /* testRegExp.cpp */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.cpp.cpp; path = testRegExp.cpp; sourceTree = "<group>"; }; 3337 3337 6511230514046A4C002B101D /* testRegExp */ = {isa = PBXFileReference; explicitFileType = "compiled.mach-o.executable"; includeInIndex = 0; path = testRegExp; sourceTree = BUILT_PRODUCTS_DIR; }; 3338 6514F21718B3E1670098FF8B /* Bytecodes.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; path = Bytecodes.h; sourceTree = "<group>"; };3339 6514F21818B3E1670098FF8B /* InitBytecodes.asm */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.asm.asm; path = InitBytecodes.asm; sourceTree = "<group>"; };3338 6514F21718B3E1670098FF8B /* Bytecodes.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; lineEnding = 0; path = Bytecodes.h; sourceTree = "<group>"; xcLanguageSpecificationIdentifier = xcode.lang.objcpp; }; 3339 6514F21818B3E1670098FF8B /* InitBytecodes.asm */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.asm.asm; lineEnding = 0; path = InitBytecodes.asm; sourceTree = "<group>"; xcLanguageSpecificationIdentifier = "<none>"; }; 3340 3340 6529FB3018B2D63900C61102 /* generate-bytecode-files */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = text.script.python; path = "generate-bytecode-files"; sourceTree = "<group>"; }; 3341 6529FB3118B2D99900C61102 /* BytecodeList.json */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = text; path = BytecodeList.json; sourceTree = "<group>"; };3341 6529FB3118B2D99900C61102 /* BytecodeList.json */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = text; lineEnding = 0; path = BytecodeList.json; sourceTree = "<group>"; xcLanguageSpecificationIdentifier = xcode.lang.javascript; }; 3342 3342 652A3A201651C66100A80AFE /* ARM64Disassembler.cpp */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.cpp.cpp; name = ARM64Disassembler.cpp; path = disassembler/ARM64Disassembler.cpp; sourceTree = "<group>"; }; 3343 3343 652A3A221651C69700A80AFE /* A64DOpcode.cpp */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.cpp.cpp; name = A64DOpcode.cpp; path = disassembler/ARM64/A64DOpcode.cpp; sourceTree = "<group>"; }; … … 3428 3428 70DC3E071B2DF2C700054299 /* IteratorPrototype.cpp */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.cpp.cpp; path = IteratorPrototype.cpp; sourceTree = "<group>"; }; 3429 3429 70DC3E081B2DF2C700054299 /* IteratorPrototype.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; path = IteratorPrototype.h; sourceTree = "<group>"; }; 3430 70DE9A081BE7D670005D89D9 /* LLIntAssembly.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; path = LLIntAssembly.h; sourceTree = "<group>"; };3430 70DE9A081BE7D670005D89D9 /* LLIntAssembly.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; lineEnding = 0; path = LLIntAssembly.h; sourceTree = "<group>"; xcLanguageSpecificationIdentifier = xcode.lang.objcpp; }; 3431 3431 70EC0EBC1AA0D7DA00B6AAFA /* JSStringIterator.cpp */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.cpp.cpp; path = JSStringIterator.cpp; sourceTree = "<group>"; }; 3432 3432 70EC0EBD1AA0D7DA00B6AAFA /* JSStringIterator.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; path = JSStringIterator.h; sourceTree = "<group>"; }; … … 3502 3502 8603CEF214C7546400AE59E3 /* CodeProfiling.cpp */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.cpp.cpp; path = CodeProfiling.cpp; sourceTree = "<group>"; }; 3503 3503 8603CEF314C7546400AE59E3 /* CodeProfiling.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; path = CodeProfiling.h; sourceTree = "<group>"; }; 3504 8604F4F2143A6C4400B295F5 /* ChangeLog */ = {isa = PBXFileReference; lastKnownFileType = text; lineEnding = 0; path = ChangeLog; sourceTree = "<group>"; };3504 8604F4F2143A6C4400B295F5 /* ChangeLog */ = {isa = PBXFileReference; lastKnownFileType = text; lineEnding = 0; path = ChangeLog; sourceTree = "<group>"; xcLanguageSpecificationIdentifier = "<none>"; }; 3505 3505 8606DDE918DA44AB00A383D0 /* IdentifierInlines.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; path = IdentifierInlines.h; sourceTree = "<group>"; }; 3506 3506 8612E4CB1522918400C836BE /* MatchResult.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; path = MatchResult.h; sourceTree = "<group>"; }; … … 3530 3530 868916A9155F285400CB2B9A /* PrivateName.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; path = PrivateName.h; sourceTree = "<group>"; }; 3531 3531 869EBCB60E8C6D4A008722CC /* ResultType.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; path = ResultType.h; sourceTree = "<group>"; }; 3532 86A054461556451B00445157 /* LowLevelInterpreter.asm */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.asm.asm; name = LowLevelInterpreter.asm; path = llint/LowLevelInterpreter.asm; sourceTree = "<group>"; };3532 86A054461556451B00445157 /* LowLevelInterpreter.asm */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.asm.asm; lineEnding = 0; name = LowLevelInterpreter.asm; path = llint/LowLevelInterpreter.asm; sourceTree = "<group>"; xcLanguageSpecificationIdentifier = "<none>"; }; 3533 3533 86A054471556451B00445157 /* LowLevelInterpreter32_64.asm */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.asm.asm; lineEnding = 0; name = LowLevelInterpreter32_64.asm; path = llint/LowLevelInterpreter32_64.asm; sourceTree = "<group>"; }; 3534 3534 86A054481556451B00445157 /* LowLevelInterpreter64.asm */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.asm.asm; lineEnding = 0; name = LowLevelInterpreter64.asm; path = llint/LowLevelInterpreter64.asm; sourceTree = "<group>"; }; … … 3551 3551 86CC85A00EE79A4700288682 /* JITInlines.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; path = JITInlines.h; sourceTree = "<group>"; }; 3552 3552 86CC85A20EE79B7400288682 /* JITCall.cpp */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.cpp.cpp; path = JITCall.cpp; sourceTree = "<group>"; }; 3553 86CC85C30EE7A89400288682 /* JITPropertyAccess.cpp */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.cpp.cpp; path = JITPropertyAccess.cpp; sourceTree = "<group>"; };3553 86CC85C30EE7A89400288682 /* JITPropertyAccess.cpp */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.cpp.cpp; lineEnding = 0; path = JITPropertyAccess.cpp; sourceTree = "<group>"; xcLanguageSpecificationIdentifier = xcode.lang.cpp; }; 3554 3554 86CCEFDD0F413F8900FD7F9E /* JITCode.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; path = JITCode.h; sourceTree = "<group>"; }; 3555 3555 86D22219167EF9440024C804 /* testapi.mm */ = {isa = PBXFileReference; explicitFileType = sourcecode.cpp.objcpp; fileEncoding = 4; name = testapi.mm; path = API/tests/testapi.mm; sourceTree = "<group>"; }; … … 3633 3633 9688CB130ED12B4E001D649F /* AssemblerBuffer.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; path = AssemblerBuffer.h; sourceTree = "<group>"; }; 3634 3634 9688CB140ED12B4E001D649F /* X86Assembler.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; path = X86Assembler.h; sourceTree = "<group>"; }; 3635 969A07200ED1CE3300F1F681 /* BytecodeGenerator.cpp */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.cpp.cpp; path = BytecodeGenerator.cpp; sourceTree = "<group>"; };3635 969A07200ED1CE3300F1F681 /* BytecodeGenerator.cpp */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.cpp.cpp; lineEnding = 0; path = BytecodeGenerator.cpp; sourceTree = "<group>"; xcLanguageSpecificationIdentifier = xcode.lang.cpp; }; 3636 3636 969A07210ED1CE3300F1F681 /* BytecodeGenerator.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; path = BytecodeGenerator.h; sourceTree = "<group>"; }; 3637 3637 969A07270ED1CE6900F1F681 /* Label.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; path = Label.h; sourceTree = "<group>"; }; 3638 3638 969A07280ED1CE6900F1F681 /* RegisterID.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; path = RegisterID.h; sourceTree = "<group>"; }; 3639 969A07900ED1D3AE00F1F681 /* CodeBlock.cpp */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.cpp.cpp; path = CodeBlock.cpp; sourceTree = "<group>"; };3639 969A07900ED1D3AE00F1F681 /* CodeBlock.cpp */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.cpp.cpp; lineEnding = 0; path = CodeBlock.cpp; sourceTree = "<group>"; xcLanguageSpecificationIdentifier = xcode.lang.cpp; }; 3640 3640 969A07910ED1D3AE00F1F681 /* CodeBlock.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; path = CodeBlock.h; sourceTree = "<group>"; }; 3641 3641 969A07920ED1D3AE00F1F681 /* EvalCodeCache.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; path = EvalCodeCache.h; sourceTree = "<group>"; }; … … 3981 3981 A7C0C4AA167C08CD0017011D /* JSScriptRef.cpp */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.cpp.cpp; path = JSScriptRef.cpp; sourceTree = "<group>"; }; 3982 3982 A7C0C4AB167C08CD0017011D /* JSScriptRefPrivate.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; path = JSScriptRefPrivate.h; sourceTree = "<group>"; }; 3983 A7C1E8C8112E701C00A37F98 /* JITPropertyAccess32_64.cpp */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.cpp.cpp; path = JITPropertyAccess32_64.cpp; sourceTree = "<group>"; };3983 A7C1E8C8112E701C00A37F98 /* JITPropertyAccess32_64.cpp */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.cpp.cpp; lineEnding = 0; path = JITPropertyAccess32_64.cpp; sourceTree = "<group>"; xcLanguageSpecificationIdentifier = xcode.lang.cpp; }; 3984 3984 A7C1EAEB17987AB600299DB2 /* JSStackInlines.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; path = JSStackInlines.h; sourceTree = "<group>"; }; 3985 3985 A7C1EAEC17987AB600299DB2 /* StackVisitor.cpp */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.cpp.cpp; lineEnding = 0; path = StackVisitor.cpp; sourceTree = "<group>"; }; -
trunk/Source/JavaScriptCore/builtins/BuiltinExecutables.cpp
r197308 r199073 36 36 namespace JSC { 37 37 38 static UnlinkedFunctionExecutable* createExecutableInternal(VM&, const SourceCode&, const Identifier&, ConstructorKind, ConstructAbility);39 40 38 BuiltinExecutables::BuiltinExecutables(VM& vm) 41 39 : m_vm(vm) … … 55 53 break; 56 54 case ConstructorKind::Base: 57 return createExecutable Internal(m_vm, makeSource(baseConstructorCode), name, constructorKind, ConstructAbility::CanConstruct);55 return createExecutable(m_vm, makeSource(baseConstructorCode), name, constructorKind, ConstructAbility::CanConstruct); 58 56 case ConstructorKind::Derived: 59 return createExecutable Internal(m_vm, makeSource(derivedConstructorCode), name, constructorKind, ConstructAbility::CanConstruct);57 return createExecutable(m_vm, makeSource(derivedConstructorCode), name, constructorKind, ConstructAbility::CanConstruct); 60 58 } 61 59 ASSERT_NOT_REACHED(); … … 65 63 UnlinkedFunctionExecutable* BuiltinExecutables::createBuiltinExecutable(const SourceCode& code, const Identifier& name, ConstructAbility constructAbility) 66 64 { 67 return createExecutable Internal(m_vm, code, name, ConstructorKind::None, constructAbility);65 return createExecutable(m_vm, code, name, ConstructorKind::None, constructAbility); 68 66 } 69 67 70 68 UnlinkedFunctionExecutable* createBuiltinExecutable(VM& vm, const SourceCode& code, const Identifier& name, ConstructAbility constructAbility) 71 69 { 72 return createExecutableInternal(vm, code, name, ConstructorKind::None, constructAbility);70 return BuiltinExecutables::createExecutable(vm, code, name, ConstructorKind::None, constructAbility); 73 71 } 74 72 75 UnlinkedFunctionExecutable* createExecutableInternal(VM& vm, const SourceCode& source, const Identifier& name, ConstructorKind constructorKind, ConstructAbility constructAbility)73 UnlinkedFunctionExecutable* BuiltinExecutables::createExecutable(VM& vm, const SourceCode& source, const Identifier& name, ConstructorKind constructorKind, ConstructAbility constructAbility) 76 74 { 77 75 JSTextPosition positionBeforeLastNewline; -
trunk/Source/JavaScriptCore/builtins/BuiltinExecutables.h
r191433 r199073 53 53 UnlinkedFunctionExecutable* createDefaultConstructor(ConstructorKind, const Identifier& name); 54 54 55 JS_EXPORT_PRIVATE static UnlinkedFunctionExecutable* createExecutable(VM&, const SourceCode&, const Identifier&, ConstructorKind, ConstructAbility); 55 56 private: 56 57 void finalize(Handle<Unknown>, void* context) override; -
trunk/Source/JavaScriptCore/bytecode/BytecodeIntrinsicRegistry.h
r198845 r199073 42 42 macro(assert) \ 43 43 macro(isObject) \ 44 macro(tryGetById) \ 44 45 macro(putByValDirect) \ 45 46 macro(toString) -
trunk/Source/JavaScriptCore/bytecode/BytecodeList.json
r198288 r199073 58 58 { "name" : "op_is_function", "length" : 3 }, 59 59 { "name" : "op_in", "length" : 4 }, 60 { "name" : "op_try_get_by_id", "length" : 4 }, 60 61 { "name" : "op_get_by_id", "length" : 9 }, 61 62 { "name" : "op_get_array_length", "length" : 9 }, -
trunk/Source/JavaScriptCore/bytecode/BytecodeUseDef.h
r198288 r199073 142 142 case op_get_from_scope: 143 143 case op_to_primitive: 144 case op_try_get_by_id: 144 145 case op_get_by_id: 145 146 case op_get_array_length: … … 364 365 case op_call_eval: 365 366 case op_construct: 367 case op_try_get_by_id: 366 368 case op_get_by_id: 367 369 case op_get_array_length: -
trunk/Source/JavaScriptCore/bytecode/CodeBlock.cpp
r198868 r199073 1094 1094 case op_in: { 1095 1095 printBinaryOp(out, exec, location, it, "in"); 1096 break; 1097 } 1098 case op_try_get_by_id: { 1099 int r0 = (++it)->u.operand; 1100 int r1 = (++it)->u.operand; 1101 int id0 = (++it)->u.operand; 1102 printLocationAndOp(out, exec, location, it, "try_get_by_id"); 1103 out.printf("%s, %s, %s", registerName(r0).data(), registerName(r1).data(), idName(id0, identifier(id0)).data()); 1096 1104 break; 1097 1105 } -
trunk/Source/JavaScriptCore/bytecode/PolymorphicAccess.cpp
r199069 r199073 160 160 } 161 161 162 std::unique_ptr<AccessCase> AccessCase::tryGet( 163 VM& vm, JSCell* owner, AccessType type, PropertyOffset offset, Structure* structure, 164 const ObjectPropertyConditionSet& conditionSet, bool viaProxy, WatchpointSet* additionalSet) 165 { 166 std::unique_ptr<AccessCase> result(new AccessCase()); 167 168 result->m_type = type; 169 result->m_offset = offset; 170 result->m_structure.set(vm, owner, structure); 171 result->m_conditionSet = conditionSet; 172 173 if (viaProxy || additionalSet) { 174 result->m_rareData = std::make_unique<RareData>(); 175 result->m_rareData->viaProxy = viaProxy; 176 result->m_rareData->additionalSet = additionalSet; 177 } 178 179 return result; 180 } 181 162 182 std::unique_ptr<AccessCase> AccessCase::get( 163 183 VM& vm, JSCell* owner, AccessType type, PropertyOffset offset, Structure* structure, … … 686 706 687 707 case Load: 708 case GetGetter: 688 709 case Getter: 689 710 case Setter: … … 721 742 GPRReg loadedValueGPR = InvalidGPRReg; 722 743 if (m_type != CustomValueGetter && m_type != CustomAccessorGetter && m_type != CustomValueSetter && m_type != CustomAccessorSetter) { 723 if (m_type == Load )744 if (m_type == Load || m_type == GetGetter) 724 745 loadedValueGPR = valueRegs.payloadGPR(); 725 746 else … … 740 761 CCallHelpers::Address(storageGPR, offsetRelativeToBase(m_offset)), loadedValueGPR); 741 762 #else 742 if (m_type == Load ) {763 if (m_type == Load || m_type == GetGetter) { 743 764 jit.load32( 744 765 CCallHelpers::Address(storageGPR, offsetRelativeToBase(m_offset) + TagOffset), … … 751 772 } 752 773 753 if (m_type == Load ) {774 if (m_type == Load || m_type == GetGetter) { 754 775 state.succeed(); 755 776 return; … … 1622 1643 out.print("Miss"); 1623 1644 return; 1645 case AccessCase::GetGetter: 1646 out.print("GetGetter"); 1647 return; 1624 1648 case AccessCase::Getter: 1625 1649 out.print("Getter"); -
trunk/Source/JavaScriptCore/bytecode/PolymorphicAccess.h
r199069 r199073 58 58 Replace, 59 59 Miss, 60 GetGetter, 60 61 Getter, 61 62 Setter, … … 71 72 }; 72 73 73 static bool isGet(AccessType type) 74 { 75 switch (type) { 76 case Transition: 77 case Replace: 78 case Setter: 79 case CustomValueSetter: 80 case CustomAccessorSetter: 81 case InHit: 82 case InMiss: 83 return false; 84 case Load: 85 case MegamorphicLoad: 86 case Miss: 87 case Getter: 88 case CustomValueGetter: 89 case CustomAccessorGetter: 90 case IntrinsicGetter: 91 case ArrayLength: 92 case StringLength: 93 return true; 94 } 95 } 96 97 static bool isPut(AccessType type) 98 { 99 switch (type) { 100 case Load: 101 case MegamorphicLoad: 102 case Miss: 103 case Getter: 104 case CustomValueGetter: 105 case CustomAccessorGetter: 106 case IntrinsicGetter: 107 case InHit: 108 case InMiss: 109 case ArrayLength: 110 case StringLength: 111 return false; 112 case Transition: 113 case Replace: 114 case Setter: 115 case CustomValueSetter: 116 case CustomAccessorSetter: 117 return true; 118 } 119 } 120 121 static bool isIn(AccessType type) 122 { 123 switch (type) { 124 case Load: 125 case MegamorphicLoad: 126 case Miss: 127 case Getter: 128 case CustomValueGetter: 129 case CustomAccessorGetter: 130 case IntrinsicGetter: 131 case Transition: 132 case Replace: 133 case Setter: 134 case CustomValueSetter: 135 case CustomAccessorSetter: 136 case ArrayLength: 137 case StringLength: 138 return false; 139 case InHit: 140 case InMiss: 141 return true; 142 } 143 } 74 static std::unique_ptr<AccessCase> tryGet( 75 VM&, JSCell* owner, AccessType, PropertyOffset, Structure*, 76 const ObjectPropertyConditionSet& = ObjectPropertyConditionSet(), 77 bool viaProxy = false, 78 WatchpointSet* additionalSet = nullptr); 144 79 145 80 static std::unique_ptr<AccessCase> get( -
trunk/Source/JavaScriptCore/bytecode/StructureStubInfo.cpp
r199069 r199073 149 149 150 150 switch (accessType) { 151 case AccessType::GetPure: 152 resetGetByID(codeBlock, *this, GetByIDKind::Pure); 153 break; 151 154 case AccessType::Get: 152 resetGetByID(codeBlock, *this );155 resetGetByID(codeBlock, *this, GetByIDKind::Normal); 153 156 break; 154 157 case AccessType::Put: -
trunk/Source/JavaScriptCore/bytecode/StructureStubInfo.h
r199069 r199073 48 48 enum class AccessType : int8_t { 49 49 Get, 50 GetPure, 50 51 Put, 51 52 In -
trunk/Source/JavaScriptCore/bytecompiler/BytecodeGenerator.cpp
r198989 r199073 2357 2357 instructions().append(constructor->index()); 2358 2358 instructions().append(hasInstanceValue->index()); 2359 return dst; 2360 } 2361 2362 RegisterID* BytecodeGenerator::emitTryGetById(RegisterID* dst, RegisterID* base, const Identifier& property) 2363 { 2364 ASSERT_WITH_MESSAGE(!parseIndex(property), "Indexed properties are not supported with tryGetById."); 2365 2366 emitOpcode(op_try_get_by_id); 2367 instructions().append(kill(dst)); 2368 instructions().append(base->index()); 2369 instructions().append(addConstant(property)); 2359 2370 return dst; 2360 2371 } -
trunk/Source/JavaScriptCore/bytecompiler/BytecodeGenerator.h
r198989 r199073 541 541 RegisterID* emitIn(RegisterID* dst, RegisterID* property, RegisterID* base) { return emitBinaryOp(op_in, dst, property, base, OperandTypes()); } 542 542 543 RegisterID* emitTryGetById(RegisterID* dst, RegisterID* base, const Identifier& property); 543 544 RegisterID* emitGetById(RegisterID* dst, RegisterID* base, const Identifier& property); 544 545 RegisterID* emitPutById(RegisterID* base, const Identifier& property, RegisterID* value); -
trunk/Source/JavaScriptCore/bytecompiler/NodesCodegen.cpp
r198803 r199073 841 841 842 842 return generator.moveToDestinationIfNeeded(dst, generator.emitDirectPutByVal(base.get(), index.get(), value.get())); 843 } 844 845 RegisterID* BytecodeIntrinsicNode::emit_intrinsic_tryGetById(BytecodeGenerator& generator, RegisterID* dst) 846 { 847 ArgumentListNode* node = m_args->m_listNode; 848 RefPtr<RegisterID> base = generator.emitNode(node); 849 node = node->m_next; 850 851 // Since this is a builtin we expect the creator to use a string literal as the second argument. 852 ASSERT(node->m_expr->isString()); 853 const Identifier& ident = static_cast<StringNode*>(node->m_expr)->value(); 854 ASSERT(!node->m_next); 855 856 RegisterID* finalDest = generator.finalDestination(dst); 857 return generator.emitTryGetById(finalDest, base.get(), ident); 843 858 } 844 859 -
trunk/Source/JavaScriptCore/dfg/DFGSpeculativeJIT32_64.cpp
r198981 r199073 195 195 m_jit.codeBlock(), codeOrigin, callSite, usedRegisters, 196 196 JSValueRegs(baseTagGPROrNone, basePayloadGPR), 197 JSValueRegs(resultTagGPR, resultPayloadGPR) );197 JSValueRegs(resultTagGPR, resultPayloadGPR), AccessType::Get); 198 198 199 199 gen.generateFastPath(m_jit); -
trunk/Source/JavaScriptCore/dfg/DFGSpeculativeJIT64.cpp
r198981 r199073 165 165 JITGetByIdGenerator gen( 166 166 m_jit.codeBlock(), codeOrigin, callSite, usedRegisters, JSValueRegs(baseGPR), 167 JSValueRegs(resultGPR) );167 JSValueRegs(resultGPR), AccessType::Get); 168 168 gen.generateFastPath(m_jit); 169 169 -
trunk/Source/JavaScriptCore/ftl/FTLLowerDFGToB3.cpp
r198981 r199073 7110 7110 jit.codeBlock(), node->origin.semantic, callSiteIndex, 7111 7111 params.unavailableRegisters(), JSValueRegs(params[1].gpr()), 7112 JSValueRegs(params[0].gpr()) );7112 JSValueRegs(params[0].gpr()), AccessType::Get); 7113 7113 7114 7114 generator->generateFastPath(jit); -
trunk/Source/JavaScriptCore/jit/JIT.cpp
r198975 r199073 229 229 DEFINE_OP(op_eq) 230 230 DEFINE_OP(op_eq_null) 231 DEFINE_OP(op_try_get_by_id) 231 232 case op_get_array_length: 232 233 DEFINE_OP(op_get_by_id) … … 404 405 DEFINE_SLOWCASE_OP(op_div) 405 406 DEFINE_SLOWCASE_OP(op_eq) 407 DEFINE_SLOWCASE_OP(op_try_get_by_id) 406 408 case op_get_array_length: 407 409 DEFINE_SLOWCASE_OP(op_get_by_id) -
trunk/Source/JavaScriptCore/jit/JIT.h
r198364 r199073 503 503 void emit_op_eq(Instruction*); 504 504 void emit_op_eq_null(Instruction*); 505 void emit_op_try_get_by_id(Instruction*); 505 506 void emit_op_get_by_id(Instruction*); 506 507 void emit_op_get_arguments_length(Instruction*); … … 613 614 void emitSlow_op_eq(Instruction*, Vector<SlowCaseEntry>::iterator&); 614 615 void emitSlow_op_get_callee(Instruction*, Vector<SlowCaseEntry>::iterator&); 616 void emitSlow_op_try_get_by_id(Instruction*, Vector<SlowCaseEntry>::iterator&); 615 617 void emitSlow_op_get_by_id(Instruction*, Vector<SlowCaseEntry>::iterator&); 616 618 void emitSlow_op_get_arguments_length(Instruction*, Vector<SlowCaseEntry>::iterator&); … … 737 739 MacroAssembler::Call callOperation(J_JITOperation_EJ, int, GPRReg); 738 740 #if USE(JSVALUE64) 741 MacroAssembler::Call callOperation(J_JITOperation_ESsiJI, int, StructureStubInfo*, GPRReg, UniquedStringImpl*); 739 742 MacroAssembler::Call callOperation(WithProfileTag, J_JITOperation_ESsiJI, int, StructureStubInfo*, GPRReg, UniquedStringImpl*); 740 743 #else 744 MacroAssembler::Call callOperation(J_JITOperation_ESsiJI, int, StructureStubInfo*, GPRReg, GPRReg, UniquedStringImpl*); 741 745 MacroAssembler::Call callOperation(WithProfileTag, J_JITOperation_ESsiJI, int, StructureStubInfo*, GPRReg, GPRReg, UniquedStringImpl*); 742 746 #endif -
trunk/Source/JavaScriptCore/jit/JITInlineCacheGenerator.cpp
r191594 r199073 105 105 JITGetByIdGenerator::JITGetByIdGenerator( 106 106 CodeBlock* codeBlock, CodeOrigin codeOrigin, CallSiteIndex callSite, const RegisterSet& usedRegisters, 107 JSValueRegs base, JSValueRegs value )107 JSValueRegs base, JSValueRegs value, AccessType accessType) 108 108 : JITByIdGenerator( 109 codeBlock, codeOrigin, callSite, AccessType::Get, usedRegisters, base, value)109 codeBlock, codeOrigin, callSite, accessType, usedRegisters, base, value) 110 110 { 111 111 RELEASE_ASSERT(base.payloadGPR() != value.tagGPR()); -
trunk/Source/JavaScriptCore/jit/JITInlineCacheGenerator.h
r190735 r199073 97 97 JITGetByIdGenerator( 98 98 CodeBlock*, CodeOrigin, CallSiteIndex, const RegisterSet& usedRegisters, JSValueRegs base, 99 JSValueRegs value );99 JSValueRegs value, AccessType); 100 100 101 101 void generateFastPath(MacroAssembler&); -
trunk/Source/JavaScriptCore/jit/JITInlines.h
r198288 r199073 456 456 } 457 457 458 ALWAYS_INLINE MacroAssembler::Call JIT::callOperation(J_JITOperation_ESsiJI operation, int dst, StructureStubInfo* stubInfo, GPRReg arg1, UniquedStringImpl* uid) 459 { 460 setupArgumentsWithExecState(TrustedImmPtr(stubInfo), arg1, TrustedImmPtr(uid)); 461 return appendCallWithExceptionCheckSetJSValueResult(operation, dst); 462 } 463 458 464 ALWAYS_INLINE MacroAssembler::Call JIT::callOperation(JIT::WithProfileTag, J_JITOperation_ESsiJI operation, int dst, StructureStubInfo* stubInfo, GPRReg arg1, UniquedStringImpl* uid) 459 465 { … … 636 642 { 637 643 setupArgumentsWithExecState(EABI_32BIT_DUMMY_ARG arg1Payload, arg1Tag); 644 return appendCallWithExceptionCheckSetJSValueResult(operation, dst); 645 } 646 647 ALWAYS_INLINE MacroAssembler::Call JIT::callOperation(J_JITOperation_ESsiJI operation, int dst, StructureStubInfo* stubInfo, GPRReg arg1Tag, GPRReg arg1Payload, UniquedStringImpl* uid) 648 { 649 setupArgumentsWithExecState(TrustedImmPtr(stubInfo), arg1Payload, arg1Tag, TrustedImmPtr(uid)); 638 650 return appendCallWithExceptionCheckSetJSValueResult(operation, dst); 639 651 } -
trunk/Source/JavaScriptCore/jit/JITOperations.cpp
r198831 r199073 154 154 } 155 155 156 EncodedJSValue JIT_OPERATION operationTryGetById(ExecState* exec, StructureStubInfo* stubInfo, EncodedJSValue base, UniquedStringImpl* uid) 157 { 158 VM* vm = &exec->vm(); 159 NativeCallFrameTracer tracer(vm, exec); 160 Identifier ident = Identifier::fromUid(vm, uid); 161 stubInfo->tookSlowPath = true; 162 163 JSValue baseValue = JSValue::decode(base); 164 PropertySlot slot(baseValue, PropertySlot::InternalMethodType::VMInquiry); 165 baseValue.getPropertySlot(exec, ident, slot); 166 167 return JSValue::encode(slot.getPureResult()); 168 } 169 170 EncodedJSValue JIT_OPERATION operationTryGetByIdOptimize(ExecState* exec, StructureStubInfo* stubInfo, EncodedJSValue base, UniquedStringImpl* uid) 171 { 172 VM* vm = &exec->vm(); 173 NativeCallFrameTracer tracer(vm, exec); 174 Identifier ident = Identifier::fromUid(vm, uid); 175 176 JSValue baseValue = JSValue::decode(base); 177 PropertySlot slot(baseValue, PropertySlot::InternalMethodType::VMInquiry); 178 179 baseValue.getPropertySlot(exec, ident, slot); 180 if (stubInfo->considerCaching() && !slot.isTaintedByProxy() && (slot.isCacheableValue() || slot.isCacheableGetter() || slot.isUnset())) 181 repatchGetByID(exec, baseValue, ident, slot, *stubInfo, GetByIDKind::Pure); 182 183 return JSValue::encode(slot.getPureResult()); 184 } 185 156 186 EncodedJSValue JIT_OPERATION operationGetById(ExecState* exec, StructureStubInfo* stubInfo, EncodedJSValue base, UniquedStringImpl* uid) 157 187 { … … 189 219 bool hasResult = baseValue.getPropertySlot(exec, ident, slot); 190 220 if (stubInfo->considerCaching()) 191 repatchGetByID(exec, baseValue, ident, slot, *stubInfo );221 repatchGetByID(exec, baseValue, ident, slot, *stubInfo, GetByIDKind::Normal); 192 222 193 223 return JSValue::encode(hasResult? slot.getValue(exec, ident) : jsUndefined()); -
trunk/Source/JavaScriptCore/jit/JITOperations.h
r198844 r199073 288 288 int32_t JIT_OPERATION operationCallArityCheck(ExecState*) WTF_INTERNAL; 289 289 int32_t JIT_OPERATION operationConstructArityCheck(ExecState*) WTF_INTERNAL; 290 EncodedJSValue JIT_OPERATION operationTryGetById(ExecState*, StructureStubInfo*, EncodedJSValue, UniquedStringImpl*) WTF_INTERNAL; 291 EncodedJSValue JIT_OPERATION operationTryGetByIdOptimize(ExecState*, StructureStubInfo*, EncodedJSValue, UniquedStringImpl*) WTF_INTERNAL; 290 292 EncodedJSValue JIT_OPERATION operationGetById(ExecState*, StructureStubInfo*, EncodedJSValue, UniquedStringImpl*) WTF_INTERNAL; 291 293 EncodedJSValue JIT_OPERATION operationGetByIdGeneric(ExecState*, EncodedJSValue, UniquedStringImpl*) WTF_INTERNAL; 292 EncodedJSValue JIT_OPERATION operationGetByIdBuildList(ExecState*, StructureStubInfo*, EncodedJSValue, UniquedStringImpl*) WTF_INTERNAL;293 294 EncodedJSValue JIT_OPERATION operationGetByIdOptimize(ExecState*, StructureStubInfo*, EncodedJSValue, UniquedStringImpl*) WTF_INTERNAL; 294 295 EncodedJSValue JIT_OPERATION operationInOptimize(ExecState*, StructureStubInfo*, JSCell*, UniquedStringImpl*) WTF_INTERNAL; -
trunk/Source/JavaScriptCore/jit/JITPropertyAccess.cpp
r198364 r199073 214 214 JITGetByIdGenerator gen( 215 215 m_codeBlock, CodeOrigin(m_bytecodeOffset), CallSiteIndex(m_bytecodeOffset), RegisterSet::stubUnavailableRegisters(), 216 JSValueRegs(regT0), JSValueRegs(regT0) );216 JSValueRegs(regT0), JSValueRegs(regT0), AccessType::Get); 217 217 gen.generateFastPath(*this); 218 218 … … 532 532 } 533 533 534 void JIT::emit_op_get_by_id(Instruction* currentInstruction) 534 void JIT::emit_op_try_get_by_id(Instruction* currentInstruction) 535 { 536 int resultVReg = currentInstruction[1].u.operand; 537 int baseVReg = currentInstruction[2].u.operand; 538 539 emitGetVirtualRegister(baseVReg, regT0); 540 541 emitJumpSlowCaseIfNotJSCell(regT0, baseVReg); 542 543 JITGetByIdGenerator gen( 544 m_codeBlock, CodeOrigin(m_bytecodeOffset), CallSiteIndex(m_bytecodeOffset), RegisterSet::stubUnavailableRegisters(), 545 JSValueRegs(regT0), JSValueRegs(regT0), AccessType::GetPure); 546 gen.generateFastPath(*this); 547 addSlowCase(gen.slowPathJump()); 548 m_getByIds.append(gen); 549 550 emitPutVirtualRegister(resultVReg); 551 } 552 553 void JIT::emitSlow_op_try_get_by_id(Instruction* currentInstruction, Vector<SlowCaseEntry>::iterator& iter) 535 554 { 536 555 int resultVReg = currentInstruction[1].u.operand; … … 538 557 const Identifier* ident = &(m_codeBlock->identifier(currentInstruction[3].u.operand)); 539 558 559 linkSlowCaseIfNotJSCell(iter, baseVReg); 560 linkSlowCase(iter); 561 562 JITGetByIdGenerator& gen = m_getByIds[m_getByIdIndex++]; 563 564 Label coldPathBegin = label(); 565 566 Call call = callOperation(operationTryGetByIdOptimize, resultVReg, gen.stubInfo(), regT0, ident->impl()); 567 568 gen.reportSlowPathCall(coldPathBegin, call); 569 } 570 571 void JIT::emit_op_get_by_id(Instruction* currentInstruction) 572 { 573 int resultVReg = currentInstruction[1].u.operand; 574 int baseVReg = currentInstruction[2].u.operand; 575 const Identifier* ident = &(m_codeBlock->identifier(currentInstruction[3].u.operand)); 576 540 577 emitGetVirtualRegister(baseVReg, regT0); 541 578 … … 547 584 JITGetByIdGenerator gen( 548 585 m_codeBlock, CodeOrigin(m_bytecodeOffset), CallSiteIndex(m_bytecodeOffset), RegisterSet::stubUnavailableRegisters(), 549 JSValueRegs(regT0), JSValueRegs(regT0) );586 JSValueRegs(regT0), JSValueRegs(regT0), AccessType::Get); 550 587 gen.generateFastPath(*this); 551 588 addSlowCase(gen.slowPathJump()); -
trunk/Source/JavaScriptCore/jit/JITPropertyAccess32_64.cpp
r198364 r199073 283 283 JITGetByIdGenerator gen( 284 284 m_codeBlock, CodeOrigin(m_bytecodeOffset), CallSiteIndex(currentInstruction), RegisterSet::stubUnavailableRegisters(), 285 JSValueRegs::payloadOnly(regT0), JSValueRegs(regT1, regT0) );285 JSValueRegs::payloadOnly(regT0), JSValueRegs(regT1, regT0), AccessType::Get); 286 286 gen.generateFastPath(*this); 287 287 … … 574 574 } 575 575 576 void JIT::emit_op_try_get_by_id(Instruction* currentInstruction) 577 { 578 int dst = currentInstruction[1].u.operand; 579 int base = currentInstruction[2].u.operand; 580 581 emitLoad(base, regT1, regT0); 582 emitJumpSlowCaseIfNotJSCell(base, regT1); 583 584 JITGetByIdGenerator gen( 585 m_codeBlock, CodeOrigin(m_bytecodeOffset), CallSiteIndex(currentInstruction), RegisterSet::stubUnavailableRegisters(), 586 JSValueRegs::payloadOnly(regT0), JSValueRegs(regT1, regT0), AccessType::GetPure); 587 gen.generateFastPath(*this); 588 addSlowCase(gen.slowPathJump()); 589 m_getByIds.append(gen); 590 591 emitStore(dst, regT1, regT0); 592 } 593 594 void JIT::emitSlow_op_try_get_by_id(Instruction* currentInstruction, Vector<SlowCaseEntry>::iterator& iter) 595 { 596 int resultVReg = currentInstruction[1].u.operand; 597 int baseVReg = currentInstruction[2].u.operand; 598 const Identifier* ident = &(m_codeBlock->identifier(currentInstruction[3].u.operand)); 599 600 linkSlowCaseIfNotJSCell(iter, baseVReg); 601 linkSlowCase(iter); 602 603 JITGetByIdGenerator& gen = m_getByIds[m_getByIdIndex++]; 604 605 Label coldPathBegin = label(); 606 607 Call call = callOperation(operationTryGetByIdOptimize, resultVReg, gen.stubInfo(), regT1, regT0, ident->impl()); 608 609 gen.reportSlowPathCall(coldPathBegin, call); 610 } 611 612 576 613 void JIT::emit_op_get_by_id(Instruction* currentInstruction) 577 614 { … … 588 625 JITGetByIdGenerator gen( 589 626 m_codeBlock, CodeOrigin(m_bytecodeOffset), CallSiteIndex(currentInstruction), RegisterSet::stubUnavailableRegisters(), 590 JSValueRegs::payloadOnly(regT0), JSValueRegs(regT1, regT0) );627 JSValueRegs::payloadOnly(regT0), JSValueRegs(regT1, regT0), AccessType::Get); 591 628 gen.generateFastPath(*this); 592 629 addSlowCase(gen.slowPathJump()); -
trunk/Source/JavaScriptCore/jit/Repatch.cpp
r199069 r199073 94 94 static void repatchByIdSelfAccess( 95 95 CodeBlock* codeBlock, StructureStubInfo& stubInfo, Structure* structure, 96 PropertyOffset offset, const FunctionPtr &slowPathFunction,96 PropertyOffset offset, const FunctionPtr& slowPathFunction, 97 97 bool compact) 98 98 { … … 214 214 } 215 215 216 static InlineCacheAction tryCacheGetByID(ExecState* exec, JSValue baseValue, const Identifier& propertyName, const PropertySlot& slot, StructureStubInfo& stubInfo) 216 inline J_JITOperation_ESsiJI appropriateOptimizingGetByIdFunction(GetByIDKind kind) 217 { 218 if (kind == GetByIDKind::Normal) 219 return operationGetByIdOptimize; 220 return operationTryGetByIdOptimize; 221 } 222 223 inline J_JITOperation_ESsiJI appropriateGenericGetByIdFunction(GetByIDKind kind) 224 { 225 if (kind == GetByIDKind::Normal) 226 return operationGetById; 227 return operationTryGetById; 228 } 229 230 static InlineCacheAction tryCacheGetByID(ExecState* exec, JSValue baseValue, const Identifier& propertyName, const PropertySlot& slot, StructureStubInfo& stubInfo, GetByIDKind kind) 217 231 { 218 232 if (forceICFailure(exec)) … … 263 277 && !loadTargetFromProxy) { 264 278 structure->startWatchingPropertyForReplacements(vm, slot.cachedOffset()); 265 repatchByIdSelfAccess(codeBlock, stubInfo, structure, slot.cachedOffset(), operationGetByIdOptimize, true);279 repatchByIdSelfAccess(codeBlock, stubInfo, structure, slot.cachedOffset(), appropriateOptimizingGetByIdFunction(kind), true); 266 280 stubInfo.initGetByIdSelf(codeBlock, structure, slot.cachedOffset()); 267 281 return RetryCacheLater; … … 296 310 getter = jsDynamicCast<JSFunction*>(slot.getterSetter()->getter()); 297 311 298 if (!loadTargetFromProxy && getter && AccessCase::canEmitIntrinsicGetter(getter, structure)) 312 if (kind == GetByIDKind::Pure) { 313 AccessCase::AccessType type; 314 if (slot.isCacheableValue()) 315 type = AccessCase::Load; 316 else if (slot.isUnset()) 317 type = AccessCase::Miss; 318 else if (slot.isCacheableGetter()) 319 type = AccessCase::GetGetter; 320 else 321 RELEASE_ASSERT_NOT_REACHED(); 322 323 newCase = AccessCase::tryGet(vm, codeBlock, type, offset, structure, conditionSet, loadTargetFromProxy, slot.watchpointSet()); 324 } else if (!loadTargetFromProxy && getter && AccessCase::canEmitIntrinsicGetter(getter, structure)) 299 325 newCase = AccessCase::getIntrinsic(vm, codeBlock, getter, slot.cachedOffset(), structure, conditionSet); 300 326 else { … … 331 357 } 332 358 333 void repatchGetByID(ExecState* exec, JSValue baseValue, const Identifier& propertyName, const PropertySlot& slot, StructureStubInfo& stubInfo )359 void repatchGetByID(ExecState* exec, JSValue baseValue, const Identifier& propertyName, const PropertySlot& slot, StructureStubInfo& stubInfo, GetByIDKind kind) 334 360 { 335 361 GCSafeConcurrentJITLocker locker(exec->codeBlock()->m_lock, exec->vm().heap); 336 362 337 if (tryCacheGetByID(exec, baseValue, propertyName, slot, stubInfo ) == GiveUpOnCache)338 repatchCall(exec->codeBlock(), stubInfo.callReturnLocation, operationGetById);363 if (tryCacheGetByID(exec, baseValue, propertyName, slot, stubInfo, kind) == GiveUpOnCache) 364 repatchCall(exec->codeBlock(), stubInfo.callReturnLocation, appropriateGenericGetByIdFunction(kind)); 339 365 } 340 366 … … 911 937 } 912 938 913 void resetGetByID(CodeBlock* codeBlock, StructureStubInfo& stubInfo )914 { 915 repatchCall(codeBlock, stubInfo.callReturnLocation, operationGetByIdOptimize);939 void resetGetByID(CodeBlock* codeBlock, StructureStubInfo& stubInfo, GetByIDKind kind) 940 { 941 repatchCall(codeBlock, stubInfo.callReturnLocation, appropriateOptimizingGetByIdFunction(kind)); 916 942 resetGetByIDCheckAndLoad(stubInfo); 917 943 MacroAssembler::repatchJump(stubInfo.callReturnLocation.jumpAtOffset(stubInfo.patch.deltaCallToJump), stubInfo.callReturnLocation.labelAtOffset(stubInfo.patch.deltaCallToSlowCase)); -
trunk/Source/JavaScriptCore/jit/Repatch.h
r197365 r199073 36 36 namespace JSC { 37 37 38 void repatchGetByID(ExecState*, JSValue, const Identifier&, const PropertySlot&, StructureStubInfo&); 38 enum class GetByIDKind { 39 Normal, 40 Pure 41 }; 42 43 void repatchGetByID(ExecState*, JSValue, const Identifier&, const PropertySlot&, StructureStubInfo&, GetByIDKind); 39 44 void buildGetByIDList(ExecState*, JSValue, const Identifier&, const PropertySlot&, StructureStubInfo&); 40 45 void buildGetByIDProtoList(ExecState*, JSValue, const Identifier&, const PropertySlot&, StructureStubInfo&); … … 47 52 void linkVirtualFor(ExecState*, CallLinkInfo&); 48 53 void linkPolymorphicCall(ExecState*, CallLinkInfo&, CallVariant); 49 void resetGetByID(CodeBlock*, StructureStubInfo& );54 void resetGetByID(CodeBlock*, StructureStubInfo&, GetByIDKind); 50 55 void resetPutByID(CodeBlock*, StructureStubInfo&); 51 56 void resetIn(CodeBlock*, StructureStubInfo&); -
trunk/Source/JavaScriptCore/jsc.cpp
r198945 r199073 24 24 25 25 #include "ArrayPrototype.h" 26 #include "BuiltinExecutables.h" 26 27 #include "ButterflyInlines.h" 27 28 #include "BytecodeGenerator.h" … … 33 34 #include "Exception.h" 34 35 #include "ExceptionHelpers.h" 36 #include "GetterSetter.h" 35 37 #include "HeapProfiler.h" 36 38 #include "HeapSnapshotBuilder.h" … … 552 554 static EncodedJSValue JSC_HOST_CALL functionCreateImpureGetter(ExecState*); 553 555 static EncodedJSValue JSC_HOST_CALL functionCreateCustomGetterObject(ExecState*); 556 static EncodedJSValue JSC_HOST_CALL functionCreateBuiltin(ExecState*); 554 557 static EncodedJSValue JSC_HOST_CALL functionSetImpureGetterDelegate(ExecState*); 555 558 … … 572 575 static EncodedJSValue JSC_HOST_CALL functionHeapSize(ExecState*); 573 576 static EncodedJSValue JSC_HOST_CALL functionAddressOf(ExecState*); 577 static EncodedJSValue JSC_HOST_CALL functionGetGetterSetter(ExecState*); 574 578 #ifndef NDEBUG 575 579 static EncodedJSValue JSC_HOST_CALL functionDumpCallFrame(ExecState*); … … 741 745 addFunction(vm, "gcHeapSize", functionHeapSize, 0); 742 746 addFunction(vm, "addressOf", functionAddressOf, 1); 747 addFunction(vm, "getGetterSetter", functionGetGetterSetter, 2); 743 748 #ifndef NDEBUG 744 749 addFunction(vm, "dumpCallFrame", functionDumpCallFrame, 0); … … 789 794 addFunction(vm, "createImpureGetter", functionCreateImpureGetter, 1); 790 795 addFunction(vm, "createCustomGetterObject", functionCreateCustomGetterObject, 0); 796 addFunction(vm, "createBuiltin", functionCreateBuiltin, 2); 791 797 addFunction(vm, "setImpureGetterDelegate", functionSetImpureGetterDelegate, 2); 792 798 … … 1329 1335 } 1330 1336 1337 static EncodedJSValue JSC_HOST_CALL functionGetGetterSetter(ExecState* exec) 1338 { 1339 JSValue value = exec->argument(0); 1340 if (!value.isObject()) 1341 return JSValue::encode(jsUndefined()); 1342 1343 JSValue property = exec->argument(1); 1344 if (!property.isString()) 1345 return JSValue::encode(jsUndefined()); 1346 1347 Identifier ident = Identifier::fromString(&exec->vm(), property.toString(exec)->value(exec)); 1348 1349 PropertySlot slot(value, PropertySlot::InternalMethodType::VMInquiry); 1350 value.getPropertySlot(exec, ident, slot); 1351 1352 JSValue result; 1353 if (slot.isCacheableGetter()) 1354 result = slot.getterSetter(); 1355 else 1356 result = jsNull(); 1357 1358 return JSValue::encode(result); 1359 } 1360 1331 1361 EncodedJSValue JSC_HOST_CALL functionVersion(ExecState*) 1332 1362 { … … 1711 1741 return JSValue::encode(exec->vm().throwException(exec, error)); 1712 1742 return JSValue::encode(jsUndefined()); 1743 } 1744 1745 EncodedJSValue JSC_HOST_CALL functionCreateBuiltin(ExecState* exec) 1746 { 1747 if (exec->argumentCount() < 1 || !exec->argument(0).isString()) 1748 return JSValue::encode(jsUndefined()); 1749 1750 String functionText = exec->argument(0).toString(exec)->value(exec); 1751 if (exec->hadException()) 1752 return JSValue::encode(JSValue()); 1753 1754 VM& vm = exec->vm(); 1755 const SourceCode& source = makeSource(functionText); 1756 JSFunction* func = JSFunction::createBuiltinFunction(vm, BuiltinExecutables::createExecutable(vm, source, Identifier::fromString(&vm, "foo"), ConstructorKind::None, ConstructAbility::CannotConstruct)->link(vm, source), exec->lexicalGlobalObject()); 1757 1758 return JSValue::encode(func); 1713 1759 } 1714 1760 -
trunk/Source/JavaScriptCore/llint/LLIntData.cpp
r196868 r199073 145 145 STATIC_ASSERT(StringType == 6); 146 146 STATIC_ASSERT(SymbolType == 7); 147 STATIC_ASSERT(ObjectType == 2 1);148 STATIC_ASSERT(FinalObjectType == 2 2);149 STATIC_ASSERT(JSFunctionType == 2 4);147 STATIC_ASSERT(ObjectType == 20); 148 STATIC_ASSERT(FinalObjectType == 21); 149 STATIC_ASSERT(JSFunctionType == 23); 150 150 STATIC_ASSERT(MasqueradesAsUndefined == 1); 151 151 STATIC_ASSERT(ImplementsDefaultHasInstance == 2); -
trunk/Source/JavaScriptCore/llint/LLIntSlowPaths.cpp
r198288 r199073 545 545 } 546 546 547 LLINT_SLOW_PATH_DECL(slow_path_try_get_by_id) 548 { 549 LLINT_BEGIN(); 550 CodeBlock* codeBlock = exec->codeBlock(); 551 const Identifier& ident = codeBlock->identifier(pc[3].u.operand); 552 JSValue baseValue = LLINT_OP_C(2).jsValue(); 553 PropertySlot slot(baseValue, PropertySlot::PropertySlot::InternalMethodType::VMInquiry); 554 555 baseValue.getPropertySlot(exec, ident, slot); 556 557 LLINT_RETURN(slot.getPureResult()); 558 } 559 547 560 LLINT_SLOW_PATH_DECL(slow_path_get_by_id) 548 561 { -
trunk/Source/JavaScriptCore/llint/LLIntSlowPaths.h
r198288 r199073 70 70 LLINT_SLOW_PATH_HIDDEN_DECL(slow_path_instanceof); 71 71 LLINT_SLOW_PATH_HIDDEN_DECL(slow_path_instanceof_custom); 72 LLINT_SLOW_PATH_HIDDEN_DECL(slow_path_try_get_by_id); 72 73 LLINT_SLOW_PATH_HIDDEN_DECL(slow_path_get_by_id); 73 74 LLINT_SLOW_PATH_HIDDEN_DECL(slow_path_get_arguments_length); -
trunk/Source/JavaScriptCore/llint/LowLevelInterpreter.asm
r198288 r199073 327 327 const StringType = 6 328 328 const SymbolType = 7 329 const ObjectType = 2 1330 const FinalObjectType = 2 2331 const JSFunctionType = 2 4329 const ObjectType = 20 330 const FinalObjectType = 21 331 const JSFunctionType = 23 332 332 333 333 # Type flags constants. … … 1302 1302 1303 1303 1304 _llint_op_try_get_by_id: 1305 traceExecution() 1306 callSlowPath(_llint_slow_path_try_get_by_id) 1307 dispatch(4) 1308 1309 1304 1310 _llint_op_del_by_id: 1305 1311 traceExecution() -
trunk/Source/JavaScriptCore/runtime/GetterSetter.cpp
r198023 r199073 34 34 STATIC_ASSERT_IS_TRIVIALLY_DESTRUCTIBLE(GetterSetter); 35 35 36 const ClassInfo GetterSetter::s_info = { "GetterSetter", 0, 0, CREATE_METHOD_TABLE(GetterSetter) };36 const ClassInfo GetterSetter::s_info = { "GetterSetter", &Base::s_info, 0, CREATE_METHOD_TABLE(GetterSetter) }; 37 37 38 38 void GetterSetter::visitChildren(JSCell* cell, SlotVisitor& visitor) -
trunk/Source/JavaScriptCore/runtime/GetterSetter.h
r198023 r199073 42 42 // that constant is observed to have a non-null setter (or getter) then we can 43 43 // constant fold that setter (or getter). 44 class GetterSetter final : public JS Cell{44 class GetterSetter final : public JSNonFinalObject { 45 45 friend class JIT; 46 46 typedef JSNonFinalObject Base; 47 47 private: 48 48 GetterSetter(VM& vm, JSGlobalObject* globalObject) 49 : JSCell(vm, vm.getterSetterStructure.get())49 : Base(vm, vm.getterSetterStructure.get()) 50 50 { 51 51 m_getter.set(vm, this, globalObject->nullGetterFunction()); … … 54 54 55 55 public: 56 typedef JSCell Base; 57 static const unsigned StructureFlags = Base::StructureFlags | StructureIsImmortal;56 57 static const unsigned StructureFlags = Base::StructureFlags | OverridesGetOwnPropertySlot | StructureIsImmortal; 58 58 59 59 static GetterSetter* create(VM& vm, JSGlobalObject* globalObject) … … 129 129 } 130 130 131 DECLARE_INFO; 131 DECLARE_EXPORT_INFO; 132 133 static bool getOwnPropertySlot(JSObject*, ExecState*, PropertyName, PropertySlot&) { RELEASE_ASSERT_NOT_REACHED(); return false; } 134 static bool put(JSCell*, ExecState*, PropertyName, JSValue, PutPropertySlot&) { RELEASE_ASSERT_NOT_REACHED(); return false; } 135 static bool defineOwnProperty(JSObject*, ExecState*, PropertyName, const PropertyDescriptor&, bool) { RELEASE_ASSERT_NOT_REACHED(); return false; } 136 static bool deleteProperty(JSCell*, ExecState*, PropertyName) { RELEASE_ASSERT_NOT_REACHED(); return false; } 132 137 133 138 private: -
trunk/Source/JavaScriptCore/runtime/JSType.h
r198844 r199073 36 36 SymbolType, 37 37 38 GetterSetterType,39 38 CustomGetterSetterType, 40 39 APIValueWrapperType, … … 76 75 DataViewType, 77 76 77 GetterSetterType, 78 78 GlobalObjectType, 79 79 LexicalEnvironmentType, -
trunk/Source/JavaScriptCore/runtime/PropertySlot.cpp
r196331 r199073 40 40 } 41 41 42 JSValue PropertySlot::getPureResult() const 43 { 44 JSValue result; 45 if (isTaintedByProxy()) 46 result = jsNull(); 47 else if (isCacheableValue()) 48 result = JSValue::decode(m_data.value); 49 else if (isCacheableGetter()) 50 result = getterSetter(); 51 else if (isUnset()) 52 result = jsUndefined(); 53 else 54 result = jsNull(); 55 56 return result; 57 } 58 42 59 } // namespace JSC -
trunk/Source/JavaScriptCore/runtime/PropertySlot.h
r198360 r199073 95 95 JSValue getValue(ExecState*, PropertyName) const; 96 96 JSValue getValue(ExecState*, unsigned propertyName) const; 97 JSValue getPureResult() const; 97 98 98 99 bool isCacheable() const { return m_cacheability == CachingAllowed && m_offset != invalidOffset; } -
trunk/Source/JavaScriptCore/runtime/ProxyObject.cpp
r198813 r199073 333 333 { 334 334 slot.disableCaching(); 335 if (slot.internalMethodType() != PropertySlot::InternalMethodType::VMInquiry) 336 slot.setIsTaintedByProxy(); 335 slot.setIsTaintedByProxy(); 337 336 switch (slot.internalMethodType()) { 338 337 case PropertySlot::InternalMethodType::Get:
Note: See TracChangeset
for help on using the changeset viewer.