Changeset 199073 in webkit


Ignore:
Timestamp:
Apr 5, 2016 2:36:25 PM (8 years ago)
Author:
keith_miller@apple.com
Message:

We should support the ability to do a non-effectful getById
https://bugs.webkit.org/show_bug.cgi?id=156116

Reviewed by Benjamin Poulain.

Currently, there is no way in JS to do a non-effectful getById. A non-effectful getById is
useful because it enables us to take different code paths based on values that we would
otherwise not be able to have knowledge of. This patch adds this new feature called
try_get_by_id that will attempt to do as much of a get_by_id as possible without performing
an effectful behavior. Thus, try_get_by_id will return the value if the slot is a value, the
GetterSetter object if the slot is a normal accessor (not a CustomGetterSetter) and
undefined if the slot is unset. If the slot is proxied or any other cases then the result
is null. In theory, if we ever wanted to check for null we could add a sentinal object to
the global object that indicates we could not get the result.

In order to implement this feature we add a new enum GetByIdKind that indicates what to do
for accessor properties in PolymorphicAccess. If the GetByIdKind is pure then we treat the
get_by_id the same way we would for load and return the value at the appropriate offset.
Additionally, in order to make sure the we can properly compare the GetterSetter object
with === GetterSetters are now JSObjects. This comes at the cost of eight extra bytes on the
GetterSetter object but it vastly simplifies the patch. Additionally, the extra bytes are
likely to have little to no impact on memory usage as normal accessors are generally rare.

  • JavaScriptCore.xcodeproj/project.pbxproj:
  • builtins/BuiltinExecutables.cpp:

(JSC::BuiltinExecutables::createDefaultConstructor):
(JSC::BuiltinExecutables::createBuiltinExecutable):
(JSC::createBuiltinExecutable):
(JSC::BuiltinExecutables::createExecutable):
(JSC::createExecutableInternal): Deleted.

  • builtins/BuiltinExecutables.h:
  • bytecode/BytecodeIntrinsicRegistry.h:
  • bytecode/BytecodeList.json:
  • bytecode/BytecodeUseDef.h:

(JSC::computeUsesForBytecodeOffset):
(JSC::computeDefsForBytecodeOffset):

  • bytecode/CodeBlock.cpp:

(JSC::CodeBlock::dumpBytecode):

  • bytecode/PolymorphicAccess.cpp:

(JSC::AccessCase::tryGet):
(JSC::AccessCase::generate):
(WTF::printInternal):

  • bytecode/PolymorphicAccess.h:

(JSC::AccessCase::isGet): Deleted.
(JSC::AccessCase::isPut): Deleted.
(JSC::AccessCase::isIn): Deleted.

  • bytecode/StructureStubInfo.cpp:

(JSC::StructureStubInfo::reset):

  • bytecode/StructureStubInfo.h:
  • bytecompiler/BytecodeGenerator.cpp:

(JSC::BytecodeGenerator::emitTryGetById):

  • bytecompiler/BytecodeGenerator.h:
  • bytecompiler/NodesCodegen.cpp:

(JSC::BytecodeIntrinsicNode::emit_intrinsic_tryGetById):

  • dfg/DFGSpeculativeJIT32_64.cpp:

(JSC::DFG::SpeculativeJIT::cachedGetById):

  • dfg/DFGSpeculativeJIT64.cpp:

(JSC::DFG::SpeculativeJIT::cachedGetById):

  • ftl/FTLLowerDFGToB3.cpp:

(JSC::FTL::DFG::LowerDFGToB3::getById):

  • jit/JIT.cpp:

(JSC::JIT::privateCompileMainPass):
(JSC::JIT::privateCompileSlowCases):

  • jit/JIT.h:
  • jit/JITInlineCacheGenerator.cpp:

(JSC::JITGetByIdGenerator::JITGetByIdGenerator):

  • jit/JITInlineCacheGenerator.h:
  • jit/JITInlines.h:

(JSC::JIT::callOperation):

  • jit/JITOperations.cpp:
  • jit/JITOperations.h:
  • jit/JITPropertyAccess.cpp:

(JSC::JIT::emitGetByValWithCachedId):
(JSC::JIT::emit_op_try_get_by_id):
(JSC::JIT::emitSlow_op_try_get_by_id):
(JSC::JIT::emit_op_get_by_id):

  • jit/JITPropertyAccess32_64.cpp:

(JSC::JIT::emitGetByValWithCachedId):
(JSC::JIT::emit_op_try_get_by_id):
(JSC::JIT::emitSlow_op_try_get_by_id):
(JSC::JIT::emit_op_get_by_id):

  • jit/Repatch.cpp:

(JSC::repatchByIdSelfAccess):
(JSC::appropriateOptimizingGetByIdFunction):
(JSC::appropriateGenericGetByIdFunction):
(JSC::tryCacheGetByID):
(JSC::repatchGetByID):
(JSC::resetGetByID):

  • jit/Repatch.h:
  • jsc.cpp:

(GlobalObject::finishCreation):
(functionGetGetterSetter):
(functionCreateBuiltin):

  • llint/LLIntData.cpp:

(JSC::LLInt::Data::performAssertions):

  • llint/LLIntSlowPaths.cpp:

(JSC::LLInt::LLINT_SLOW_PATH_DECL):

  • llint/LLIntSlowPaths.h:
  • llint/LowLevelInterpreter.asm:
  • runtime/GetterSetter.cpp:
  • runtime/GetterSetter.h:
  • runtime/JSType.h:
  • runtime/PropertySlot.cpp:

(JSC::PropertySlot::getPureResult):

  • runtime/PropertySlot.h:
  • runtime/ProxyObject.cpp:

(JSC::ProxyObject::getOwnPropertySlotCommon):

  • tests/stress/try-get-by-id.js: Added.

(tryGetByIdText):
(getCaller.obj.1.throw.new.Error.let.func):
(getCaller.obj.1.throw.new.Error):
(throw.new.Error.get let):
(throw.new.Error.):
(throw.new.Error.let.get createBuiltin):
(get let):
(let.get createBuiltin):
(let.func):
(get let.func):
(get throw):

Location:
trunk/Source/JavaScriptCore
Files:
1 added
40 edited

Legend:

Unmodified
Added
Removed
  • trunk/Source/JavaScriptCore/ChangeLog

    r199070 r199073  
     12016-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
    11232016-04-05  Saam barati  <sbarati@apple.com>
    2124
  • trunk/Source/JavaScriptCore/JavaScriptCore.xcodeproj/project.pbxproj

    r199035 r199073  
    25092509                0F46809D14BA7F8200BFE272 /* LLIntExceptions.cpp */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.cpp.cpp; name = LLIntExceptions.cpp; path = llint/LLIntExceptions.cpp; sourceTree = "<group>"; };
    25102510                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; };
    25132513                0F4680A114BA7F8200BFE272 /* LLIntOffsetsExtractor.cpp */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.cpp.cpp; name = LLIntOffsetsExtractor.cpp; path = llint/LLIntOffsetsExtractor.cpp; sourceTree = "<group>"; };
    25142514                0F4680C514BBB16900BFE272 /* LLIntCommon.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; name = LLIntCommon.h; path = llint/LLIntCommon.h; sourceTree = "<group>"; };
     
    26442644                0F8364B5164B0C0E0053329A /* DFGBranchDirection.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; name = DFGBranchDirection.h; path = dfg/DFGBranchDirection.h; sourceTree = "<group>"; };
    26452645                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; };
    26472647                0F893BDA1936E23C001211F4 /* DFGStructureAbstractValue.cpp */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.cpp.cpp; name = DFGStructureAbstractValue.cpp; path = dfg/DFGStructureAbstractValue.cpp; sourceTree = "<group>"; };
    26482648                0F898F2F1B27689F0083A33C /* DFGIntegerRangeOptimizationPhase.cpp */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.cpp.cpp; name = DFGIntegerRangeOptimizationPhase.cpp; path = dfg/DFGIntegerRangeOptimizationPhase.cpp; sourceTree = "<group>"; };
     
    31233123                1429D8DB0ED2205B00B89619 /* CallFrame.cpp */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.cpp.cpp; path = CallFrame.cpp; sourceTree = "<group>"; };
    31243124                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; };
    31273127                142D3938103E4560007DCB52 /* NumericStrings.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; path = NumericStrings.h; sourceTree = "<group>"; };
    31283128                142D6F0613539A2800B02E86 /* MarkedBlock.cpp */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.cpp.cpp; path = MarkedBlock.cpp; sourceTree = "<group>"; };
     
    33363336                651122E5140469BA002B101D /* testRegExp.cpp */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.cpp.cpp; path = testRegExp.cpp; sourceTree = "<group>"; };
    33373337                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>"; };
    33403340                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; };
    33423342                652A3A201651C66100A80AFE /* ARM64Disassembler.cpp */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.cpp.cpp; name = ARM64Disassembler.cpp; path = disassembler/ARM64Disassembler.cpp; sourceTree = "<group>"; };
    33433343                652A3A221651C69700A80AFE /* A64DOpcode.cpp */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.cpp.cpp; name = A64DOpcode.cpp; path = disassembler/ARM64/A64DOpcode.cpp; sourceTree = "<group>"; };
     
    34283428                70DC3E071B2DF2C700054299 /* IteratorPrototype.cpp */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.cpp.cpp; path = IteratorPrototype.cpp; sourceTree = "<group>"; };
    34293429                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; };
    34313431                70EC0EBC1AA0D7DA00B6AAFA /* JSStringIterator.cpp */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.cpp.cpp; path = JSStringIterator.cpp; sourceTree = "<group>"; };
    34323432                70EC0EBD1AA0D7DA00B6AAFA /* JSStringIterator.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; path = JSStringIterator.h; sourceTree = "<group>"; };
     
    35023502                8603CEF214C7546400AE59E3 /* CodeProfiling.cpp */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.cpp.cpp; path = CodeProfiling.cpp; sourceTree = "<group>"; };
    35033503                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>"; };
    35053505                8606DDE918DA44AB00A383D0 /* IdentifierInlines.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; path = IdentifierInlines.h; sourceTree = "<group>"; };
    35063506                8612E4CB1522918400C836BE /* MatchResult.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; path = MatchResult.h; sourceTree = "<group>"; };
     
    35303530                868916A9155F285400CB2B9A /* PrivateName.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; path = PrivateName.h; sourceTree = "<group>"; };
    35313531                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>"; };
    35333533                86A054471556451B00445157 /* LowLevelInterpreter32_64.asm */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.asm.asm; lineEnding = 0; name = LowLevelInterpreter32_64.asm; path = llint/LowLevelInterpreter32_64.asm; sourceTree = "<group>"; };
    35343534                86A054481556451B00445157 /* LowLevelInterpreter64.asm */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.asm.asm; lineEnding = 0; name = LowLevelInterpreter64.asm; path = llint/LowLevelInterpreter64.asm; sourceTree = "<group>"; };
     
    35513551                86CC85A00EE79A4700288682 /* JITInlines.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; path = JITInlines.h; sourceTree = "<group>"; };
    35523552                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; };
    35543554                86CCEFDD0F413F8900FD7F9E /* JITCode.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; path = JITCode.h; sourceTree = "<group>"; };
    35553555                86D22219167EF9440024C804 /* testapi.mm */ = {isa = PBXFileReference; explicitFileType = sourcecode.cpp.objcpp; fileEncoding = 4; name = testapi.mm; path = API/tests/testapi.mm; sourceTree = "<group>"; };
     
    36333633                9688CB130ED12B4E001D649F /* AssemblerBuffer.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; path = AssemblerBuffer.h; sourceTree = "<group>"; };
    36343634                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; };
    36363636                969A07210ED1CE3300F1F681 /* BytecodeGenerator.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; path = BytecodeGenerator.h; sourceTree = "<group>"; };
    36373637                969A07270ED1CE6900F1F681 /* Label.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; path = Label.h; sourceTree = "<group>"; };
    36383638                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; };
    36403640                969A07910ED1D3AE00F1F681 /* CodeBlock.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; path = CodeBlock.h; sourceTree = "<group>"; };
    36413641                969A07920ED1D3AE00F1F681 /* EvalCodeCache.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; path = EvalCodeCache.h; sourceTree = "<group>"; };
     
    39813981                A7C0C4AA167C08CD0017011D /* JSScriptRef.cpp */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.cpp.cpp; path = JSScriptRef.cpp; sourceTree = "<group>"; };
    39823982                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; };
    39843984                A7C1EAEB17987AB600299DB2 /* JSStackInlines.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; path = JSStackInlines.h; sourceTree = "<group>"; };
    39853985                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  
    3636namespace JSC {
    3737
    38 static UnlinkedFunctionExecutable* createExecutableInternal(VM&, const SourceCode&, const Identifier&, ConstructorKind, ConstructAbility);
    39 
    4038BuiltinExecutables::BuiltinExecutables(VM& vm)
    4139    : m_vm(vm)
     
    5553        break;
    5654    case ConstructorKind::Base:
    57         return createExecutableInternal(m_vm, makeSource(baseConstructorCode), name, constructorKind, ConstructAbility::CanConstruct);
     55        return createExecutable(m_vm, makeSource(baseConstructorCode), name, constructorKind, ConstructAbility::CanConstruct);
    5856    case ConstructorKind::Derived:
    59         return createExecutableInternal(m_vm, makeSource(derivedConstructorCode), name, constructorKind, ConstructAbility::CanConstruct);
     57        return createExecutable(m_vm, makeSource(derivedConstructorCode), name, constructorKind, ConstructAbility::CanConstruct);
    6058    }
    6159    ASSERT_NOT_REACHED();
     
    6563UnlinkedFunctionExecutable* BuiltinExecutables::createBuiltinExecutable(const SourceCode& code, const Identifier& name, ConstructAbility constructAbility)
    6664{
    67     return createExecutableInternal(m_vm, code, name, ConstructorKind::None, constructAbility);
     65    return createExecutable(m_vm, code, name, ConstructorKind::None, constructAbility);
    6866}
    6967
    7068UnlinkedFunctionExecutable* createBuiltinExecutable(VM& vm, const SourceCode& code, const Identifier& name, ConstructAbility constructAbility)
    7169{
    72     return createExecutableInternal(vm, code, name, ConstructorKind::None, constructAbility);
     70    return BuiltinExecutables::createExecutable(vm, code, name, ConstructorKind::None, constructAbility);
    7371}
    7472
    75 UnlinkedFunctionExecutable* createExecutableInternal(VM& vm, const SourceCode& source, const Identifier& name, ConstructorKind constructorKind, ConstructAbility constructAbility)
     73UnlinkedFunctionExecutable* BuiltinExecutables::createExecutable(VM& vm, const SourceCode& source, const Identifier& name, ConstructorKind constructorKind, ConstructAbility constructAbility)
    7674{
    7775    JSTextPosition positionBeforeLastNewline;
  • trunk/Source/JavaScriptCore/builtins/BuiltinExecutables.h

    r191433 r199073  
    5353    UnlinkedFunctionExecutable* createDefaultConstructor(ConstructorKind, const Identifier& name);
    5454
     55    JS_EXPORT_PRIVATE static UnlinkedFunctionExecutable* createExecutable(VM&, const SourceCode&, const Identifier&, ConstructorKind, ConstructAbility);
    5556private:
    5657    void finalize(Handle<Unknown>, void* context) override;
  • trunk/Source/JavaScriptCore/bytecode/BytecodeIntrinsicRegistry.h

    r198845 r199073  
    4242    macro(assert) \
    4343    macro(isObject) \
     44    macro(tryGetById) \
    4445    macro(putByValDirect) \
    4546    macro(toString)
  • trunk/Source/JavaScriptCore/bytecode/BytecodeList.json

    r198288 r199073  
    5858            { "name" : "op_is_function", "length" : 3 },
    5959            { "name" : "op_in", "length" : 4 },
     60            { "name" : "op_try_get_by_id", "length" : 4 },
    6061            { "name" : "op_get_by_id", "length" : 9  },
    6162            { "name" : "op_get_array_length", "length" : 9 },
  • trunk/Source/JavaScriptCore/bytecode/BytecodeUseDef.h

    r198288 r199073  
    142142    case op_get_from_scope:
    143143    case op_to_primitive:
     144    case op_try_get_by_id:
    144145    case op_get_by_id:
    145146    case op_get_array_length:
     
    364365    case op_call_eval:
    365366    case op_construct:
     367    case op_try_get_by_id:
    366368    case op_get_by_id:
    367369    case op_get_array_length:
  • trunk/Source/JavaScriptCore/bytecode/CodeBlock.cpp

    r198868 r199073  
    10941094        case op_in: {
    10951095            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());
    10961104            break;
    10971105        }
  • trunk/Source/JavaScriptCore/bytecode/PolymorphicAccess.cpp

    r199069 r199073  
    160160}
    161161
     162std::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
    162182std::unique_ptr<AccessCase> AccessCase::get(
    163183    VM& vm, JSCell* owner, AccessType type, PropertyOffset offset, Structure* structure,
     
    686706
    687707    case Load:
     708    case GetGetter:
    688709    case Getter:
    689710    case Setter:
     
    721742        GPRReg loadedValueGPR = InvalidGPRReg;
    722743        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)
    724745                loadedValueGPR = valueRegs.payloadGPR();
    725746            else
     
    740761                CCallHelpers::Address(storageGPR, offsetRelativeToBase(m_offset)), loadedValueGPR);
    741762#else
    742             if (m_type == Load) {
     763            if (m_type == Load || m_type == GetGetter) {
    743764                jit.load32(
    744765                    CCallHelpers::Address(storageGPR, offsetRelativeToBase(m_offset) + TagOffset),
     
    751772        }
    752773
    753         if (m_type == Load) {
     774        if (m_type == Load || m_type == GetGetter) {
    754775            state.succeed();
    755776            return;
     
    16221643        out.print("Miss");
    16231644        return;
     1645    case AccessCase::GetGetter:
     1646        out.print("GetGetter");
     1647        return;
    16241648    case AccessCase::Getter:
    16251649        out.print("Getter");
  • trunk/Source/JavaScriptCore/bytecode/PolymorphicAccess.h

    r199069 r199073  
    5858        Replace,
    5959        Miss,
     60        GetGetter,
    6061        Getter,
    6162        Setter,
     
    7172    };
    7273
    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);
    14479
    14580    static std::unique_ptr<AccessCase> get(
  • trunk/Source/JavaScriptCore/bytecode/StructureStubInfo.cpp

    r199069 r199073  
    149149
    150150    switch (accessType) {
     151    case AccessType::GetPure:
     152        resetGetByID(codeBlock, *this, GetByIDKind::Pure);
     153        break;
    151154    case AccessType::Get:
    152         resetGetByID(codeBlock, *this);
     155        resetGetByID(codeBlock, *this, GetByIDKind::Normal);
    153156        break;
    154157    case AccessType::Put:
  • trunk/Source/JavaScriptCore/bytecode/StructureStubInfo.h

    r199069 r199073  
    4848enum class AccessType : int8_t {
    4949    Get,
     50    GetPure,
    5051    Put,
    5152    In
  • trunk/Source/JavaScriptCore/bytecompiler/BytecodeGenerator.cpp

    r198989 r199073  
    23572357    instructions().append(constructor->index());
    23582358    instructions().append(hasInstanceValue->index());
     2359    return dst;
     2360}
     2361
     2362RegisterID* 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));
    23592370    return dst;
    23602371}
  • trunk/Source/JavaScriptCore/bytecompiler/BytecodeGenerator.h

    r198989 r199073  
    541541        RegisterID* emitIn(RegisterID* dst, RegisterID* property, RegisterID* base) { return emitBinaryOp(op_in, dst, property, base, OperandTypes()); }
    542542
     543        RegisterID* emitTryGetById(RegisterID* dst, RegisterID* base, const Identifier& property);
    543544        RegisterID* emitGetById(RegisterID* dst, RegisterID* base, const Identifier& property);
    544545        RegisterID* emitPutById(RegisterID* base, const Identifier& property, RegisterID* value);
  • trunk/Source/JavaScriptCore/bytecompiler/NodesCodegen.cpp

    r198803 r199073  
    841841
    842842    return generator.moveToDestinationIfNeeded(dst, generator.emitDirectPutByVal(base.get(), index.get(), value.get()));
     843}
     844
     845RegisterID* 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);
    843858}
    844859
  • trunk/Source/JavaScriptCore/dfg/DFGSpeculativeJIT32_64.cpp

    r198981 r199073  
    195195        m_jit.codeBlock(), codeOrigin, callSite, usedRegisters,
    196196        JSValueRegs(baseTagGPROrNone, basePayloadGPR),
    197         JSValueRegs(resultTagGPR, resultPayloadGPR));
     197        JSValueRegs(resultTagGPR, resultPayloadGPR), AccessType::Get);
    198198   
    199199    gen.generateFastPath(m_jit);
  • trunk/Source/JavaScriptCore/dfg/DFGSpeculativeJIT64.cpp

    r198981 r199073  
    165165    JITGetByIdGenerator gen(
    166166        m_jit.codeBlock(), codeOrigin, callSite, usedRegisters, JSValueRegs(baseGPR),
    167         JSValueRegs(resultGPR));
     167        JSValueRegs(resultGPR), AccessType::Get);
    168168    gen.generateFastPath(m_jit);
    169169   
  • trunk/Source/JavaScriptCore/ftl/FTLLowerDFGToB3.cpp

    r198981 r199073  
    71107110                    jit.codeBlock(), node->origin.semantic, callSiteIndex,
    71117111                    params.unavailableRegisters(), JSValueRegs(params[1].gpr()),
    7112                     JSValueRegs(params[0].gpr()));
     7112                    JSValueRegs(params[0].gpr()), AccessType::Get);
    71137113
    71147114                generator->generateFastPath(jit);
  • trunk/Source/JavaScriptCore/jit/JIT.cpp

    r198975 r199073  
    229229        DEFINE_OP(op_eq)
    230230        DEFINE_OP(op_eq_null)
     231        DEFINE_OP(op_try_get_by_id)
    231232        case op_get_array_length:
    232233        DEFINE_OP(op_get_by_id)
     
    404405        DEFINE_SLOWCASE_OP(op_div)
    405406        DEFINE_SLOWCASE_OP(op_eq)
     407        DEFINE_SLOWCASE_OP(op_try_get_by_id)
    406408        case op_get_array_length:
    407409        DEFINE_SLOWCASE_OP(op_get_by_id)
  • trunk/Source/JavaScriptCore/jit/JIT.h

    r198364 r199073  
    503503        void emit_op_eq(Instruction*);
    504504        void emit_op_eq_null(Instruction*);
     505        void emit_op_try_get_by_id(Instruction*);
    505506        void emit_op_get_by_id(Instruction*);
    506507        void emit_op_get_arguments_length(Instruction*);
     
    613614        void emitSlow_op_eq(Instruction*, Vector<SlowCaseEntry>::iterator&);
    614615        void emitSlow_op_get_callee(Instruction*, Vector<SlowCaseEntry>::iterator&);
     616        void emitSlow_op_try_get_by_id(Instruction*, Vector<SlowCaseEntry>::iterator&);
    615617        void emitSlow_op_get_by_id(Instruction*, Vector<SlowCaseEntry>::iterator&);
    616618        void emitSlow_op_get_arguments_length(Instruction*, Vector<SlowCaseEntry>::iterator&);
     
    737739        MacroAssembler::Call callOperation(J_JITOperation_EJ, int, GPRReg);
    738740#if USE(JSVALUE64)
     741        MacroAssembler::Call callOperation(J_JITOperation_ESsiJI, int, StructureStubInfo*, GPRReg, UniquedStringImpl*);
    739742        MacroAssembler::Call callOperation(WithProfileTag, J_JITOperation_ESsiJI, int, StructureStubInfo*, GPRReg, UniquedStringImpl*);
    740743#else
     744        MacroAssembler::Call callOperation(J_JITOperation_ESsiJI, int, StructureStubInfo*, GPRReg, GPRReg, UniquedStringImpl*);
    741745        MacroAssembler::Call callOperation(WithProfileTag, J_JITOperation_ESsiJI, int, StructureStubInfo*, GPRReg, GPRReg, UniquedStringImpl*);
    742746#endif
  • trunk/Source/JavaScriptCore/jit/JITInlineCacheGenerator.cpp

    r191594 r199073  
    105105JITGetByIdGenerator::JITGetByIdGenerator(
    106106    CodeBlock* codeBlock, CodeOrigin codeOrigin, CallSiteIndex callSite, const RegisterSet& usedRegisters,
    107     JSValueRegs base, JSValueRegs value)
     107    JSValueRegs base, JSValueRegs value, AccessType accessType)
    108108    : JITByIdGenerator(
    109         codeBlock, codeOrigin, callSite, AccessType::Get, usedRegisters, base, value)
     109        codeBlock, codeOrigin, callSite, accessType, usedRegisters, base, value)
    110110{
    111111    RELEASE_ASSERT(base.payloadGPR() != value.tagGPR());
  • trunk/Source/JavaScriptCore/jit/JITInlineCacheGenerator.h

    r190735 r199073  
    9797    JITGetByIdGenerator(
    9898        CodeBlock*, CodeOrigin, CallSiteIndex, const RegisterSet& usedRegisters, JSValueRegs base,
    99         JSValueRegs value);
     99        JSValueRegs value, AccessType);
    100100   
    101101    void generateFastPath(MacroAssembler&);
  • trunk/Source/JavaScriptCore/jit/JITInlines.h

    r198288 r199073  
    456456}
    457457
     458ALWAYS_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
    458464ALWAYS_INLINE MacroAssembler::Call JIT::callOperation(JIT::WithProfileTag, J_JITOperation_ESsiJI operation, int dst, StructureStubInfo* stubInfo, GPRReg arg1, UniquedStringImpl* uid)
    459465{
     
    636642{
    637643    setupArgumentsWithExecState(EABI_32BIT_DUMMY_ARG arg1Payload, arg1Tag);
     644    return appendCallWithExceptionCheckSetJSValueResult(operation, dst);
     645}
     646
     647ALWAYS_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));
    638650    return appendCallWithExceptionCheckSetJSValueResult(operation, dst);
    639651}
  • trunk/Source/JavaScriptCore/jit/JITOperations.cpp

    r198831 r199073  
    154154}
    155155
     156EncodedJSValue 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
     170EncodedJSValue 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
    156186EncodedJSValue JIT_OPERATION operationGetById(ExecState* exec, StructureStubInfo* stubInfo, EncodedJSValue base, UniquedStringImpl* uid)
    157187{
     
    189219    bool hasResult = baseValue.getPropertySlot(exec, ident, slot);
    190220    if (stubInfo->considerCaching())
    191         repatchGetByID(exec, baseValue, ident, slot, *stubInfo);
     221        repatchGetByID(exec, baseValue, ident, slot, *stubInfo, GetByIDKind::Normal);
    192222   
    193223    return JSValue::encode(hasResult? slot.getValue(exec, ident) : jsUndefined());
  • trunk/Source/JavaScriptCore/jit/JITOperations.h

    r198844 r199073  
    288288int32_t JIT_OPERATION operationCallArityCheck(ExecState*) WTF_INTERNAL;
    289289int32_t JIT_OPERATION operationConstructArityCheck(ExecState*) WTF_INTERNAL;
     290EncodedJSValue JIT_OPERATION operationTryGetById(ExecState*, StructureStubInfo*, EncodedJSValue, UniquedStringImpl*) WTF_INTERNAL;
     291EncodedJSValue JIT_OPERATION operationTryGetByIdOptimize(ExecState*, StructureStubInfo*, EncodedJSValue, UniquedStringImpl*) WTF_INTERNAL;
    290292EncodedJSValue JIT_OPERATION operationGetById(ExecState*, StructureStubInfo*, EncodedJSValue, UniquedStringImpl*) WTF_INTERNAL;
    291293EncodedJSValue JIT_OPERATION operationGetByIdGeneric(ExecState*, EncodedJSValue, UniquedStringImpl*) WTF_INTERNAL;
    292 EncodedJSValue JIT_OPERATION operationGetByIdBuildList(ExecState*, StructureStubInfo*, EncodedJSValue, UniquedStringImpl*) WTF_INTERNAL;
    293294EncodedJSValue JIT_OPERATION operationGetByIdOptimize(ExecState*, StructureStubInfo*, EncodedJSValue, UniquedStringImpl*) WTF_INTERNAL;
    294295EncodedJSValue JIT_OPERATION operationInOptimize(ExecState*, StructureStubInfo*, JSCell*, UniquedStringImpl*) WTF_INTERNAL;
  • trunk/Source/JavaScriptCore/jit/JITPropertyAccess.cpp

    r198364 r199073  
    214214    JITGetByIdGenerator gen(
    215215        m_codeBlock, CodeOrigin(m_bytecodeOffset), CallSiteIndex(m_bytecodeOffset), RegisterSet::stubUnavailableRegisters(),
    216         JSValueRegs(regT0), JSValueRegs(regT0));
     216        JSValueRegs(regT0), JSValueRegs(regT0), AccessType::Get);
    217217    gen.generateFastPath(*this);
    218218
     
    532532}
    533533
    534 void JIT::emit_op_get_by_id(Instruction* currentInstruction)
     534void 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
     553void JIT::emitSlow_op_try_get_by_id(Instruction* currentInstruction, Vector<SlowCaseEntry>::iterator& iter)
    535554{
    536555    int resultVReg = currentInstruction[1].u.operand;
     
    538557    const Identifier* ident = &(m_codeBlock->identifier(currentInstruction[3].u.operand));
    539558
     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
     571void 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
    540577    emitGetVirtualRegister(baseVReg, regT0);
    541578   
     
    547584    JITGetByIdGenerator gen(
    548585        m_codeBlock, CodeOrigin(m_bytecodeOffset), CallSiteIndex(m_bytecodeOffset), RegisterSet::stubUnavailableRegisters(),
    549         JSValueRegs(regT0), JSValueRegs(regT0));
     586        JSValueRegs(regT0), JSValueRegs(regT0), AccessType::Get);
    550587    gen.generateFastPath(*this);
    551588    addSlowCase(gen.slowPathJump());
  • trunk/Source/JavaScriptCore/jit/JITPropertyAccess32_64.cpp

    r198364 r199073  
    283283    JITGetByIdGenerator gen(
    284284        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);
    286286    gen.generateFastPath(*this);
    287287
     
    574574}
    575575
     576void 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
     594void 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
    576613void JIT::emit_op_get_by_id(Instruction* currentInstruction)
    577614{
     
    588625    JITGetByIdGenerator gen(
    589626        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);
    591628    gen.generateFastPath(*this);
    592629    addSlowCase(gen.slowPathJump());
  • trunk/Source/JavaScriptCore/jit/Repatch.cpp

    r199069 r199073  
    9494static void repatchByIdSelfAccess(
    9595    CodeBlock* codeBlock, StructureStubInfo& stubInfo, Structure* structure,
    96     PropertyOffset offset, const FunctionPtr &slowPathFunction,
     96    PropertyOffset offset, const FunctionPtr& slowPathFunction,
    9797    bool compact)
    9898{
     
    214214}
    215215
    216 static InlineCacheAction tryCacheGetByID(ExecState* exec, JSValue baseValue, const Identifier& propertyName, const PropertySlot& slot, StructureStubInfo& stubInfo)
     216inline J_JITOperation_ESsiJI appropriateOptimizingGetByIdFunction(GetByIDKind kind)
     217{
     218    if (kind == GetByIDKind::Normal)
     219        return operationGetByIdOptimize;
     220    return operationTryGetByIdOptimize;
     221}
     222
     223inline J_JITOperation_ESsiJI appropriateGenericGetByIdFunction(GetByIDKind kind)
     224{
     225    if (kind == GetByIDKind::Normal)
     226        return operationGetById;
     227    return operationTryGetById;
     228}
     229
     230static InlineCacheAction tryCacheGetByID(ExecState* exec, JSValue baseValue, const Identifier& propertyName, const PropertySlot& slot, StructureStubInfo& stubInfo, GetByIDKind kind)
    217231{
    218232    if (forceICFailure(exec))
     
    263277            && !loadTargetFromProxy) {
    264278            structure->startWatchingPropertyForReplacements(vm, slot.cachedOffset());
    265             repatchByIdSelfAccess(codeBlock, stubInfo, structure, slot.cachedOffset(), operationGetByIdOptimize, true);
     279            repatchByIdSelfAccess(codeBlock, stubInfo, structure, slot.cachedOffset(), appropriateOptimizingGetByIdFunction(kind), true);
    266280            stubInfo.initGetByIdSelf(codeBlock, structure, slot.cachedOffset());
    267281            return RetryCacheLater;
     
    296310            getter = jsDynamicCast<JSFunction*>(slot.getterSetter()->getter());
    297311
    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))
    299325            newCase = AccessCase::getIntrinsic(vm, codeBlock, getter, slot.cachedOffset(), structure, conditionSet);
    300326        else {
     
    331357}
    332358
    333 void repatchGetByID(ExecState* exec, JSValue baseValue, const Identifier& propertyName, const PropertySlot& slot, StructureStubInfo& stubInfo)
     359void repatchGetByID(ExecState* exec, JSValue baseValue, const Identifier& propertyName, const PropertySlot& slot, StructureStubInfo& stubInfo, GetByIDKind kind)
    334360{
    335361    GCSafeConcurrentJITLocker locker(exec->codeBlock()->m_lock, exec->vm().heap);
    336362   
    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));
    339365}
    340366
     
    911937}
    912938
    913 void resetGetByID(CodeBlock* codeBlock, StructureStubInfo& stubInfo)
    914 {
    915     repatchCall(codeBlock, stubInfo.callReturnLocation, operationGetByIdOptimize);
     939void resetGetByID(CodeBlock* codeBlock, StructureStubInfo& stubInfo, GetByIDKind kind)
     940{
     941    repatchCall(codeBlock, stubInfo.callReturnLocation, appropriateOptimizingGetByIdFunction(kind));
    916942    resetGetByIDCheckAndLoad(stubInfo);
    917943    MacroAssembler::repatchJump(stubInfo.callReturnLocation.jumpAtOffset(stubInfo.patch.deltaCallToJump), stubInfo.callReturnLocation.labelAtOffset(stubInfo.patch.deltaCallToSlowCase));
  • trunk/Source/JavaScriptCore/jit/Repatch.h

    r197365 r199073  
    3636namespace JSC {
    3737
    38 void repatchGetByID(ExecState*, JSValue, const Identifier&, const PropertySlot&, StructureStubInfo&);
     38enum class GetByIDKind {
     39    Normal,
     40    Pure
     41};
     42
     43void repatchGetByID(ExecState*, JSValue, const Identifier&, const PropertySlot&, StructureStubInfo&, GetByIDKind);
    3944void buildGetByIDList(ExecState*, JSValue, const Identifier&, const PropertySlot&, StructureStubInfo&);
    4045void buildGetByIDProtoList(ExecState*, JSValue, const Identifier&, const PropertySlot&, StructureStubInfo&);
     
    4752void linkVirtualFor(ExecState*, CallLinkInfo&);
    4853void linkPolymorphicCall(ExecState*, CallLinkInfo&, CallVariant);
    49 void resetGetByID(CodeBlock*, StructureStubInfo&);
     54void resetGetByID(CodeBlock*, StructureStubInfo&, GetByIDKind);
    5055void resetPutByID(CodeBlock*, StructureStubInfo&);
    5156void resetIn(CodeBlock*, StructureStubInfo&);
  • trunk/Source/JavaScriptCore/jsc.cpp

    r198945 r199073  
    2424
    2525#include "ArrayPrototype.h"
     26#include "BuiltinExecutables.h"
    2627#include "ButterflyInlines.h"
    2728#include "BytecodeGenerator.h"
     
    3334#include "Exception.h"
    3435#include "ExceptionHelpers.h"
     36#include "GetterSetter.h"
    3537#include "HeapProfiler.h"
    3638#include "HeapSnapshotBuilder.h"
     
    552554static EncodedJSValue JSC_HOST_CALL functionCreateImpureGetter(ExecState*);
    553555static EncodedJSValue JSC_HOST_CALL functionCreateCustomGetterObject(ExecState*);
     556static EncodedJSValue JSC_HOST_CALL functionCreateBuiltin(ExecState*);
    554557static EncodedJSValue JSC_HOST_CALL functionSetImpureGetterDelegate(ExecState*);
    555558
     
    572575static EncodedJSValue JSC_HOST_CALL functionHeapSize(ExecState*);
    573576static EncodedJSValue JSC_HOST_CALL functionAddressOf(ExecState*);
     577static EncodedJSValue JSC_HOST_CALL functionGetGetterSetter(ExecState*);
    574578#ifndef NDEBUG
    575579static EncodedJSValue JSC_HOST_CALL functionDumpCallFrame(ExecState*);
     
    741745        addFunction(vm, "gcHeapSize", functionHeapSize, 0);
    742746        addFunction(vm, "addressOf", functionAddressOf, 1);
     747        addFunction(vm, "getGetterSetter", functionGetGetterSetter, 2);
    743748#ifndef NDEBUG
    744749        addFunction(vm, "dumpCallFrame", functionDumpCallFrame, 0);
     
    789794        addFunction(vm, "createImpureGetter", functionCreateImpureGetter, 1);
    790795        addFunction(vm, "createCustomGetterObject", functionCreateCustomGetterObject, 0);
     796        addFunction(vm, "createBuiltin", functionCreateBuiltin, 2);
    791797        addFunction(vm, "setImpureGetterDelegate", functionSetImpureGetterDelegate, 2);
    792798
     
    13291335}
    13301336
     1337static 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
    13311361EncodedJSValue JSC_HOST_CALL functionVersion(ExecState*)
    13321362{
     
    17111741        return JSValue::encode(exec->vm().throwException(exec, error));
    17121742    return JSValue::encode(jsUndefined());
     1743}
     1744
     1745EncodedJSValue 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);
    17131759}
    17141760
  • trunk/Source/JavaScriptCore/llint/LLIntData.cpp

    r196868 r199073  
    145145    STATIC_ASSERT(StringType == 6);
    146146    STATIC_ASSERT(SymbolType == 7);
    147     STATIC_ASSERT(ObjectType == 21);
    148     STATIC_ASSERT(FinalObjectType == 22);
    149     STATIC_ASSERT(JSFunctionType == 24);
     147    STATIC_ASSERT(ObjectType == 20);
     148    STATIC_ASSERT(FinalObjectType == 21);
     149    STATIC_ASSERT(JSFunctionType == 23);
    150150    STATIC_ASSERT(MasqueradesAsUndefined == 1);
    151151    STATIC_ASSERT(ImplementsDefaultHasInstance == 2);
  • trunk/Source/JavaScriptCore/llint/LLIntSlowPaths.cpp

    r198288 r199073  
    545545}
    546546
     547LLINT_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
    547560LLINT_SLOW_PATH_DECL(slow_path_get_by_id)
    548561{
  • trunk/Source/JavaScriptCore/llint/LLIntSlowPaths.h

    r198288 r199073  
    7070LLINT_SLOW_PATH_HIDDEN_DECL(slow_path_instanceof);
    7171LLINT_SLOW_PATH_HIDDEN_DECL(slow_path_instanceof_custom);
     72LLINT_SLOW_PATH_HIDDEN_DECL(slow_path_try_get_by_id);
    7273LLINT_SLOW_PATH_HIDDEN_DECL(slow_path_get_by_id);
    7374LLINT_SLOW_PATH_HIDDEN_DECL(slow_path_get_arguments_length);
  • trunk/Source/JavaScriptCore/llint/LowLevelInterpreter.asm

    r198288 r199073  
    327327const StringType = 6
    328328const SymbolType = 7
    329 const ObjectType = 21
    330 const FinalObjectType = 22
    331 const JSFunctionType = 24
     329const ObjectType = 20
     330const FinalObjectType = 21
     331const JSFunctionType = 23
    332332
    333333# Type flags constants.
     
    13021302
    13031303
     1304_llint_op_try_get_by_id:
     1305    traceExecution()
     1306    callSlowPath(_llint_slow_path_try_get_by_id)
     1307    dispatch(4)
     1308
     1309
    13041310_llint_op_del_by_id:
    13051311    traceExecution()
  • trunk/Source/JavaScriptCore/runtime/GetterSetter.cpp

    r198023 r199073  
    3434STATIC_ASSERT_IS_TRIVIALLY_DESTRUCTIBLE(GetterSetter);
    3535
    36 const ClassInfo GetterSetter::s_info = { "GetterSetter", 0, 0, CREATE_METHOD_TABLE(GetterSetter) };
     36const ClassInfo GetterSetter::s_info = { "GetterSetter", &Base::s_info, 0, CREATE_METHOD_TABLE(GetterSetter) };
    3737
    3838void GetterSetter::visitChildren(JSCell* cell, SlotVisitor& visitor)
  • trunk/Source/JavaScriptCore/runtime/GetterSetter.h

    r198023 r199073  
    4242// that constant is observed to have a non-null setter (or getter) then we can
    4343// constant fold that setter (or getter).
    44 class GetterSetter final : public JSCell {
     44class GetterSetter final : public JSNonFinalObject {
    4545    friend class JIT;
    46 
     46    typedef JSNonFinalObject Base;
    4747private:
    4848    GetterSetter(VM& vm, JSGlobalObject* globalObject)
    49         : JSCell(vm, vm.getterSetterStructure.get())
     49        : Base(vm, vm.getterSetterStructure.get())
    5050    {
    5151        m_getter.set(vm, this, globalObject->nullGetterFunction());
     
    5454
    5555public:
    56     typedef JSCell Base;
    57     static const unsigned StructureFlags = Base::StructureFlags | StructureIsImmortal;
     56
     57    static const unsigned StructureFlags = Base::StructureFlags | OverridesGetOwnPropertySlot | StructureIsImmortal;
    5858
    5959    static GetterSetter* create(VM& vm, JSGlobalObject* globalObject)
     
    129129    }
    130130
    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; }
    132137
    133138private:
  • trunk/Source/JavaScriptCore/runtime/JSType.h

    r198844 r199073  
    3636    SymbolType,
    3737
    38     GetterSetterType,
    3938    CustomGetterSetterType,
    4039    APIValueWrapperType,
     
    7675    DataViewType,
    7776
     77    GetterSetterType,
    7878    GlobalObjectType,
    7979    LexicalEnvironmentType,
  • trunk/Source/JavaScriptCore/runtime/PropertySlot.cpp

    r196331 r199073  
    4040}
    4141
     42JSValue 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
    4259} // namespace JSC
  • trunk/Source/JavaScriptCore/runtime/PropertySlot.h

    r198360 r199073  
    9595    JSValue getValue(ExecState*, PropertyName) const;
    9696    JSValue getValue(ExecState*, unsigned propertyName) const;
     97    JSValue getPureResult() const;
    9798
    9899    bool isCacheable() const { return m_cacheability == CachingAllowed && m_offset != invalidOffset; }
  • trunk/Source/JavaScriptCore/runtime/ProxyObject.cpp

    r198813 r199073  
    333333{
    334334    slot.disableCaching();
    335     if (slot.internalMethodType() != PropertySlot::InternalMethodType::VMInquiry)
    336         slot.setIsTaintedByProxy();
     335    slot.setIsTaintedByProxy();
    337336    switch (slot.internalMethodType()) {
    338337    case PropertySlot::InternalMethodType::Get:
Note: See TracChangeset for help on using the changeset viewer.