Title: [265036] trunk
Revision
265036
Author
[email protected]
Date
2020-07-29 03:32:27 -0700 (Wed, 29 Jul 2020)

Log Message

for..of intrinsics implementation for 32bits
https://bugs.webkit.org/show_bug.cgi?id=214737

Reviewed by Yusuke Suzuki.

Joint work with Caio Lima <[email protected]>.
JSTests:

Unskip tests previously skipped due to missing for..of intrinsics.

* stress/for-of-array-different-globals.js:
* stress/for-of-iterator-open-osr-at-inlined-return-non-object.js:
* stress/for-of-iterator-open-osr-at-iterator-set-local.js:
* stress/for-of-iterator-open-return-non-object.js:

Source/_javascript_Core:

Implements for..of intrinsics for 32bits.
Adds or8 instruction to ARMv7 and MIPS Macro Assembler.
Adds intrinsic operations to LLInt and Baseline for 32bits.
Fixes DFG OSR Exit bug, where checkpoint temporary value is
incorrectly recreated for Baseline.
Refactors code in DFG OSR Exit to be easier to modify and
maintain by separating the switch cases for 32 and 64bits.

* assembler/MacroAssemblerARMv7.h:
(JSC::MacroAssemblerARMv7::or8): Adds or8(TrustedImm, AbsoluteAddress)
(JSC::MacroAssemblerARMv7::or32):
(JSC::MacroAssemblerARMv7::store8):
* assembler/MacroAssemblerMIPS.h:
(JSC::MacroAssemblerMIPS::or8): Adds or8(TrustedImm, AbsoluteAddress)
(JSC::MacroAssemblerMIPS::store8):
* assembler/testmasm.cpp:
(JSC::testOrImmMem): Tests or8
* bytecompiler/BytecodeGenerator.cpp:
(JSC::BytecodeGenerator::emitEnumeration):
* dfg/DFGOSRExit.cpp:
(JSC::DFG::OSRExit::compileExit): Fixes DFG OSR Exit bug, where checkpoint temporary value is
incorrectly recreated for Baseline. Refactors code in DFG OSR Exit to be easier to modify and
maintain by separating the switch cases for 32 and 64bits.
* jit/JIT.h:
* jit/JITCall32_64.cpp:
(JSC::JIT::emitPutCallResult):
(JSC::JIT::compileSetupFrame):
(JSC::JIT::compileOpCall):
(JSC::JIT::emit_op_iterator_open):
(JSC::JIT::emitSlow_op_iterator_open):
(JSC::JIT::emit_op_iterator_next):
(JSC::JIT::emitSlow_op_iterator_next):
* jit/JITInlines.h:
(JSC::JIT::emitJumpSlowCaseIfNotJSCell):
* llint/LowLevelInterpreter32_64.asm:

Modified Paths

Diff

Modified: trunk/JSTests/ChangeLog (265035 => 265036)


--- trunk/JSTests/ChangeLog	2020-07-29 08:45:12 UTC (rev 265035)
+++ trunk/JSTests/ChangeLog	2020-07-29 10:32:27 UTC (rev 265036)
@@ -1,3 +1,18 @@
+2020-07-29  Paulo Matos  <[email protected]>
+
+        for..of intrinsics implementation for 32bits
+        https://bugs.webkit.org/show_bug.cgi?id=214737
+
+        Reviewed by Yusuke Suzuki.
+
+        Joint work with Caio Lima <[email protected]>.
+        Unskip tests previously skipped due to missing for..of intrinsics.
+
+        * stress/for-of-array-different-globals.js:
+        * stress/for-of-iterator-open-osr-at-inlined-return-non-object.js:
+        * stress/for-of-iterator-open-osr-at-iterator-set-local.js:
+        * stress/for-of-iterator-open-return-non-object.js:
+
 2020-07-29  Yusuke Suzuki  <[email protected]>
 
         [JSC] Reflect object should have toStringTag with "Reflect"

Modified: trunk/JSTests/stress/for-of-array-different-globals.js (265035 => 265036)


--- trunk/JSTests/stress/for-of-array-different-globals.js	2020-07-29 08:45:12 UTC (rev 265035)
+++ trunk/JSTests/stress/for-of-array-different-globals.js	2020-07-29 10:32:27 UTC (rev 265036)
@@ -1,4 +1,3 @@
-//@ skip if ["arm", "mips"].include?($architecture)
 let count = 0;
 
 function foo(array) {

Modified: trunk/JSTests/stress/for-of-iterator-open-osr-at-inlined-return-non-object.js (265035 => 265036)


--- trunk/JSTests/stress/for-of-iterator-open-osr-at-inlined-return-non-object.js	2020-07-29 08:45:12 UTC (rev 265035)
+++ trunk/JSTests/stress/for-of-iterator-open-osr-at-inlined-return-non-object.js	2020-07-29 10:32:27 UTC (rev 265036)
@@ -1,5 +1,3 @@
-//@ skip if $model == "Apple Watch Series 3" # We are not supporting fast for-of for 32bit architecture.
-//@ skip if ["arm", "mips"].include?($architecture)
 let shouldVendNull = false;
 function vendIterator() {
     if (shouldVendNull)

Modified: trunk/JSTests/stress/for-of-iterator-open-osr-at-iterator-set-local.js (265035 => 265036)


--- trunk/JSTests/stress/for-of-iterator-open-osr-at-iterator-set-local.js	2020-07-29 08:45:12 UTC (rev 265035)
+++ trunk/JSTests/stress/for-of-iterator-open-osr-at-iterator-set-local.js	2020-07-29 10:32:27 UTC (rev 265036)
@@ -1,5 +1,3 @@
-//@ skip if $model == "Apple Watch Series 3" # We are not supporting fast for-of for 32bit architecture.
-//@ skip if ["arm", "mips"].include?($architecture)
 let shouldVendNull = false;
 function vendIterator() {
     if (shouldVendNull)

Modified: trunk/JSTests/stress/for-of-iterator-open-return-non-object.js (265035 => 265036)


--- trunk/JSTests/stress/for-of-iterator-open-return-non-object.js	2020-07-29 08:45:12 UTC (rev 265035)
+++ trunk/JSTests/stress/for-of-iterator-open-return-non-object.js	2020-07-29 10:32:27 UTC (rev 265036)
@@ -1,5 +1,3 @@
-//@ skip if $model == "Apple Watch Series 3" # We are not supporting fast for-of for 32bit architecture.
-//@ skip if ["arm", "mips"].include?($architecture)
 function vendIterator() {
     return 1;
 }

Modified: trunk/Source/_javascript_Core/ChangeLog (265035 => 265036)


--- trunk/Source/_javascript_Core/ChangeLog	2020-07-29 08:45:12 UTC (rev 265035)
+++ trunk/Source/_javascript_Core/ChangeLog	2020-07-29 10:32:27 UTC (rev 265036)
@@ -1,3 +1,48 @@
+2020-07-29  Paulo Matos  <[email protected]>
+
+        for..of intrinsics implementation for 32bits
+        https://bugs.webkit.org/show_bug.cgi?id=214737
+
+        Reviewed by Yusuke Suzuki.
+
+        Joint work with Caio Lima <[email protected]>.
+
+        Implements for..of intrinsics for 32bits.
+        Adds or8 instruction to ARMv7 and MIPS Macro Assembler.
+        Adds intrinsic operations to LLInt and Baseline for 32bits.
+        Fixes DFG OSR Exit bug, where checkpoint temporary value is
+        incorrectly recreated for Baseline.
+        Refactors code in DFG OSR Exit to be easier to modify and
+        maintain by separating the switch cases for 32 and 64bits.
+
+        * assembler/MacroAssemblerARMv7.h:
+        (JSC::MacroAssemblerARMv7::or8): Adds or8(TrustedImm, AbsoluteAddress)
+        (JSC::MacroAssemblerARMv7::or32):
+        (JSC::MacroAssemblerARMv7::store8):
+        * assembler/MacroAssemblerMIPS.h:
+        (JSC::MacroAssemblerMIPS::or8): Adds or8(TrustedImm, AbsoluteAddress)
+        (JSC::MacroAssemblerMIPS::store8):
+        * assembler/testmasm.cpp:
+        (JSC::testOrImmMem): Tests or8
+        * bytecompiler/BytecodeGenerator.cpp:
+        (JSC::BytecodeGenerator::emitEnumeration):
+        * dfg/DFGOSRExit.cpp:
+        (JSC::DFG::OSRExit::compileExit): Fixes DFG OSR Exit bug, where checkpoint temporary value is
+        incorrectly recreated for Baseline. Refactors code in DFG OSR Exit to be easier to modify and
+        maintain by separating the switch cases for 32 and 64bits.
+        * jit/JIT.h:
+        * jit/JITCall32_64.cpp:
+        (JSC::JIT::emitPutCallResult):
+        (JSC::JIT::compileSetupFrame):
+        (JSC::JIT::compileOpCall):
+        (JSC::JIT::emit_op_iterator_open):
+        (JSC::JIT::emitSlow_op_iterator_open):
+        (JSC::JIT::emit_op_iterator_next):
+        (JSC::JIT::emitSlow_op_iterator_next):
+        * jit/JITInlines.h:
+        (JSC::JIT::emitJumpSlowCaseIfNotJSCell):
+        * llint/LowLevelInterpreter32_64.asm:
+
 2020-07-29  Yusuke Suzuki  <[email protected]>
 
         [JSC] Reflect object should have toStringTag with "Reflect"

Modified: trunk/Source/_javascript_Core/assembler/MacroAssemblerARMv7.h (265035 => 265036)


--- trunk/Source/_javascript_Core/assembler/MacroAssemblerARMv7.h	2020-07-29 08:45:12 UTC (rev 265035)
+++ trunk/Source/_javascript_Core/assembler/MacroAssemblerARMv7.h	2020-07-29 10:32:27 UTC (rev 265036)
@@ -362,9 +362,22 @@
         m_assembler.neg(dest, src);
     }
 
-    void or32(RegisterID src, RegisterID dest)
+    void or8(TrustedImm32 imm, AbsoluteAddress address)
     {
-        m_assembler.orr(dest, dest, src);
+        ARMThumbImmediate armImm = ARMThumbImmediate::makeEncodedImm(imm.m_value);
+        if (armImm.isValid()) {
+            move(TrustedImmPtr(address.m_ptr), addressTempRegister);
+            load8(addressTempRegister, dataTempRegister);
+            m_assembler.orr(dataTempRegister, dataTempRegister, armImm);
+            store8(dataTempRegister, addressTempRegister);
+        } else {
+            move(TrustedImmPtr(address.m_ptr), addressTempRegister);
+            load8(addressTempRegister, dataTempRegister);
+            move(imm, addressTempRegister);
+            m_assembler.orr(dataTempRegister, dataTempRegister, addressTempRegister);
+            move(TrustedImmPtr(address.m_ptr), addressTempRegister);
+            store8(dataTempRegister, addressTempRegister);
+        }
     }
 
     void or16(TrustedImm32 imm, AbsoluteAddress dest)
@@ -384,7 +397,12 @@
             store16(dataTempRegister, addressTempRegister);
         }
     }
-    
+
+    void or32(RegisterID src, RegisterID dest)
+    {
+        m_assembler.orr(dest, dest, src);
+    }
+
     void or32(RegisterID src, AbsoluteAddress dest)
     {
         move(TrustedImmPtr(dest.m_ptr), addressTempRegister);
@@ -897,13 +915,13 @@
         store8(src, setupArmAddress(address));
     }
     
-    void store8(RegisterID src, void* address)
+    void store8(RegisterID src, const void *address)
     {
         move(TrustedImmPtr(address), addressTempRegister);
         store8(src, ArmAddress(addressTempRegister, 0));
     }
     
-    void store8(TrustedImm32 imm, void* address)
+    void store8(TrustedImm32 imm, const void *address)
     {
         TrustedImm32 imm8(static_cast<int8_t>(imm.m_value));
         move(imm8, dataTempRegister);
@@ -917,6 +935,11 @@
         store8(dataTempRegister, address);
     }
 
+    void store8(RegisterID src, RegisterID addrreg)
+    {
+        store8(src, ArmAddress(addrreg, 0));
+    }
+    
     void store16(RegisterID src, ImplicitAddress address)
     {
         store16(src, setupArmAddress(address));

Modified: trunk/Source/_javascript_Core/assembler/MacroAssemblerMIPS.h (265035 => 265036)


--- trunk/Source/_javascript_Core/assembler/MacroAssemblerMIPS.h	2020-07-29 08:45:12 UTC (rev 265035)
+++ trunk/Source/_javascript_Core/assembler/MacroAssemblerMIPS.h	2020-07-29 10:32:27 UTC (rev 265036)
@@ -475,6 +475,25 @@
         m_assembler.subu(dest, MIPSRegisters::zero, src);
     }
 
+
+    void or8(TrustedImm32 imm, AbsoluteAddress dest)
+    {
+        if (!imm.m_value && !m_fixedWidth)
+            return;
+
+        if (m_fixedWidth) {
+            load8(dest.m_ptr, immTempRegister);
+            or32(imm, immTempRegister);
+            store8(immTempRegister, dest.m_ptr);
+        } else {
+            uintptr_t adr = reinterpret_cast<uintptr_t>(dest.m_ptr);
+            m_assembler.lui(addrTempRegister, (adr + 0x8000) >> 16);
+            m_assembler.lbu(immTempRegister, addrTempRegister, adr & 0xffff);
+            or32(imm, immTempRegister);
+            m_assembler.sb(immTempRegister, addrTempRegister, adr & 0xffff);            
+        }
+    }
+    
     void or16(TrustedImm32 imm, AbsoluteAddress dest)
     {
         if (!imm.m_value && !m_fixedWidth)
@@ -1312,7 +1331,7 @@
         }
     }
 
-    void store8(RegisterID src, void* address)
+    void store8(RegisterID src, const void* address)
     {
         if (m_fixedWidth) {
             /*

Modified: trunk/Source/_javascript_Core/assembler/testmasm.cpp (265035 => 265036)


--- trunk/Source/_javascript_Core/assembler/testmasm.cpp	2020-07-29 08:45:12 UTC (rev 265035)
+++ trunk/Source/_javascript_Core/assembler/testmasm.cpp	2020-07-29 10:32:27 UTC (rev 265036)
@@ -2281,6 +2281,16 @@
     CHECK_EQ(memoryLocation, 0x12341234 | 42);
 
     memoryLocation = 0x12341234;
+    auto or8 = compile([&] (CCallHelpers& jit) {
+        emitFunctionPrologue(jit);
+        jit.or8(CCallHelpers::TrustedImm32(42), CCallHelpers::AbsoluteAddress(&memoryLocation));
+        emitFunctionEpilogue(jit);
+        jit.ret();
+    });
+    invoke<void>(or8);
+    CHECK_EQ(memoryLocation, 0x12341234 | 42);
+
+    memoryLocation = 0x12341234;
     auto or16InvalidLogicalImmInARM64 = compile([&] (CCallHelpers& jit) {
         emitFunctionPrologue(jit);
         jit.or16(CCallHelpers::TrustedImm32(0), CCallHelpers::AbsoluteAddress(&memoryLocation));

Modified: trunk/Source/_javascript_Core/bytecompiler/BytecodeGenerator.cpp (265035 => 265036)


--- trunk/Source/_javascript_Core/bytecompiler/BytecodeGenerator.cpp	2020-07-29 08:45:12 UTC (rev 265035)
+++ trunk/Source/_javascript_Core/bytecompiler/BytecodeGenerator.cpp	2020-07-29 10:32:27 UTC (rev 265036)
@@ -4189,7 +4189,7 @@
 
 void BytecodeGenerator::emitEnumeration(ThrowableExpressionData* node, ExpressionNode* subjectNode, const ScopedLambda<void(BytecodeGenerator&, RegisterID*)>& callBack, ForOfNode* forLoopNode, RegisterID* forLoopSymbolTable)
 {
-    if (!Options::useIterationIntrinsics() || is32Bit() || (forLoopNode && forLoopNode->isForAwait())) {
+    if (!Options::useIterationIntrinsics() || (forLoopNode && forLoopNode->isForAwait())) {
         emitGenericEnumeration(node, subjectNode, callBack, forLoopNode, forLoopSymbolTable);
         return;
     }

Modified: trunk/Source/_javascript_Core/dfg/DFGOSRExit.cpp (265035 => 265036)


--- trunk/Source/_javascript_Core/dfg/DFGOSRExit.cpp	2020-07-29 08:45:12 UTC (rev 265035)
+++ trunk/Source/_javascript_Core/dfg/DFGOSRExit.cpp	2020-07-29 10:32:27 UTC (rev 265036)
@@ -599,10 +599,12 @@
                     auto& recovery = values[i + tmpOffset];
                     // FIXME: We should do what the FTL does and materialize all the JSValues into the scratch buffer.
                     switch (recovery.technique()) {
+
                     case Constant:
                         sideState->tmps[i] = recovery.constant();
                         break;
-
+                        
+#if USE(JSVALUE64)
                     case UnboxedInt32InGPR:
                     case Int32DisplacedInJSStack: {
                         sideState->tmps[i] = jsNumber(static_cast<int32_t>(tmpScratch[i + tmpOffset]));
@@ -609,31 +611,47 @@
                         break;
                     }
 
-#if USE(JSVALUE32_64)
-                    case InPair:
-#endif
-                    case InGPR:
                     case BooleanDisplacedInJSStack:
                     case CellDisplacedInJSStack:
+                    case UnboxedCellInGPR:
+                    case InGPR:
                     case DisplacedInJSStack: {
                         sideState->tmps[i] = reinterpret_cast<JSValue*>(tmpScratch)[i + tmpOffset];
                         break;
                     }
 
+                    case UnboxedBooleanInGPR: {
+                        sideState->tmps[i] = jsBoolean(static_cast<bool>(tmpScratch[i + tmpOffset]));
+                        break;
+                    }
+
+#else // USE(JSVALUE32_64)
+                    case UnboxedInt32InGPR:
+                    case Int32DisplacedInJSStack: {
+                        sideState->tmps[i] = jsNumber(static_cast<int32_t>(tmpScratch[i + tmpOffset]));
+                        break;
+                    }
+
+                    case InPair:
+                    case DisplacedInJSStack: {
+                        sideState->tmps[i] = reinterpret_cast<JSValue*>(tmpScratch)[i + tmpOffset];
+                        break;
+                    }
+
+                    case CellDisplacedInJSStack:
                     case UnboxedCellInGPR: {
-#if USE(JSVALUE64)
-                        sideState->tmps[i] = reinterpret_cast<JSValue*>(tmpScratch)[i + tmpOffset];
-#else
                         EncodedValueDescriptor* valueDescriptor = bitwise_cast<EncodedValueDescriptor*>(tmpScratch + i + tmpOffset);
                         sideState->tmps[i] = JSValue(JSValue::CellTag, valueDescriptor->asBits.payload);
-#endif
                         break;
                     }
 
+                    case BooleanDisplacedInJSStack:
                     case UnboxedBooleanInGPR: {
                         sideState->tmps[i] = jsBoolean(static_cast<bool>(tmpScratch[i + tmpOffset]));
                         break;
                     }
+                        
+#endif // USE(JSVALUE64)
 
                     default: 
                         RELEASE_ASSERT_NOT_REACHED();

Modified: trunk/Source/_javascript_Core/jit/JIT.h (265035 => 265036)


--- trunk/Source/_javascript_Core/jit/JIT.h	2020-07-29 08:45:12 UTC (rev 265035)
+++ trunk/Source/_javascript_Core/jit/JIT.h	2020-07-29 10:32:27 UTC (rev 265036)
@@ -443,6 +443,7 @@
 
         void emitJumpSlowCaseIfNotJSCell(VirtualRegister);
         void emitJumpSlowCaseIfNotJSCell(VirtualRegister, RegisterID tag);
+        void emitJumpSlowCaseIfNotJSCell(RegisterID);
 
         void compileGetByIdHotPath(const Identifier*);
 

Modified: trunk/Source/_javascript_Core/jit/JITCall32_64.cpp (265035 => 265036)


--- trunk/Source/_javascript_Core/jit/JITCall32_64.cpp	2020-07-29 08:45:12 UTC (rev 265035)
+++ trunk/Source/_javascript_Core/jit/JITCall32_64.cpp	2020-07-29 10:32:27 UTC (rev 265036)
@@ -1,4 +1,6 @@
 /*
+ * Copyright (C) 2020 Igalia, S.L. All rights reserved.
+ * Copyright (C) 2020 Metrological Group B.V.
  * Copyright (C) 2008-2019 Apple Inc. All rights reserved.
  *
  * Redistribution and use in source and binary forms, with or without
@@ -29,6 +31,7 @@
 #if USE(JSVALUE32_64)
 #include "JIT.h"
 
+#include "CacheableIdentifierInlines.h"
 #include "CodeBlock.h"
 #include "Interpreter.h"
 #include "JITInlines.h"
@@ -39,6 +42,7 @@
 #include "OpcodeInlines.h"
 #include "ResultType.h"
 #include "SetupVarargsFrame.h"
+#include "SlowPathCall.h"
 #include "StackAlignment.h"
 #include "ThunkGenerators.h"
 #include <wtf/StringPrintStream.h>
@@ -49,7 +53,7 @@
 void JIT::emitPutCallResult(const Op& bytecode)
 {
     emitValueProfilingSite(bytecode.metadata(m_codeBlock));
-    emitStore(bytecode.m_dst, regT1, regT0);
+    emitStore(destinationFor(bytecode, m_bytecodeIndex.checkpoint()).virtualRegister(), regT1, regT0);
 }
 
 void JIT::emit_op_ret(const Instruction* currentInstruction)
@@ -152,9 +156,10 @@
 , void>
 JIT::compileSetupFrame(const Op& bytecode, CallLinkInfo*)
 {
+    unsigned checkpoint = m_bytecodeIndex.checkpoint();
     auto& metadata = bytecode.metadata(m_codeBlock);
-    int argCount = bytecode.m_argc;
-    int registerOffset = -static_cast<int>(bytecode.m_argv);
+    int argCount = argumentCountIncludingThisFor(bytecode, checkpoint);
+    int registerOffset = -static_cast<int>(stackOffsetInRegistersForCall(bytecode, checkpoint));
 
     if (Op::opcodeID == op_call && shouldEmitProfiling()) {
         emitLoad(VirtualRegister(registerOffset + CallFrame::argumentOffsetIncludingThis(0)), regT0, regT1);
@@ -269,7 +274,7 @@
 {
     OpcodeID opcodeID = Op::opcodeID;
     auto bytecode = instruction->as<Op>();
-    VirtualRegister callee = bytecode.m_callee;
+    VirtualRegister callee = calleeFor(bytecode, m_bytecodeIndex.checkpoint());
 
     /* Caller always:
         - Updates callFrameRegister to callee callFrame.
@@ -366,24 +371,263 @@
     emitPutCallResult(bytecode);
 }
 
-void JIT::emit_op_iterator_open(const Instruction*)
+void JIT::emit_op_iterator_open(const Instruction* instruction)
 {
-    UNREACHABLE_FOR_PLATFORM();
+    auto bytecode = instruction->as<OpIteratorOpen>();
+    auto* tryFastFunction = ([&] () {
+        switch (instruction->width()) {
+        case Narrow: return iterator_open_try_fast_narrow;
+        case Wide16: return iterator_open_try_fast_wide16;
+        case Wide32: return iterator_open_try_fast_wide32;
+        default: RELEASE_ASSERT_NOT_REACHED();
+        }
+    })();
+
+    JITSlowPathCall slowPathCall(this, instruction, tryFastFunction);
+    slowPathCall.call();
+    Jump fastCase = branch32(NotEqual, GPRInfo::returnValueGPR2, TrustedImm32(static_cast<uint32_t>(IterationMode::Generic)));
+
+    compileOpCall<OpIteratorOpen>(instruction, m_callLinkInfoIndex++);
+
+    VirtualRegister vr = destinationFor(bytecode, m_bytecodeIndex.checkpoint()).virtualRegister();
+    advanceToNextCheckpoint();
+    
+    // call result (iterator) is in regT1 (tag)/regT0 (payload)
+    const Identifier* ident = &vm().propertyNames->next;
+    
+    emitJumpSlowCaseIfNotJSCell(vr, regT1);
+
+    GPRReg tagIteratorGPR = regT1;
+    GPRReg payloadIteratorGPR = regT0;
+
+    GPRReg tagNextGPR = tagIteratorGPR;
+    GPRReg payloadNextGPR = payloadIteratorGPR;
+
+    JITGetByIdGenerator gen(
+        m_codeBlock,
+        CodeOrigin(m_bytecodeIndex),
+        CallSiteIndex(BytecodeIndex(m_bytecodeIndex.offset())),
+        RegisterSet::stubUnavailableRegisters(),
+        CacheableIdentifier::createFromImmortalIdentifier(ident->impl()),
+        JSValueRegs(tagIteratorGPR, payloadIteratorGPR),
+        JSValueRegs(tagNextGPR, payloadNextGPR),
+        AccessType::GetById);
+    
+    gen.generateFastPath(*this);
+    addSlowCase(gen.slowPathJump());
+    m_getByIds.append(gen);
+
+    emitValueProfilingSite(bytecode.metadata(m_codeBlock));
+    emitPutVirtualRegister(bytecode.m_next, JSValueRegs(tagNextGPR, payloadNextGPR));
+
+    fastCase.link(this);
 }
 
-void JIT::emitSlow_op_iterator_open(const Instruction*, Vector<SlowCaseEntry>::iterator&)
+void JIT::emitSlow_op_iterator_open(const Instruction* instruction, Vector<SlowCaseEntry>::iterator& iter)
 {
-    UNREACHABLE_FOR_PLATFORM();
+    linkAllSlowCases(iter);
+    compileOpCallSlowCase<OpIteratorOpen>(instruction, iter, m_callLinkInfoIndex++);
+    emitJumpSlowToHotForCheckpoint(jump());
+
+    linkAllSlowCases(iter);
+
+    GPRReg tagIteratorGPR = regT1;
+    GPRReg payloadIteratorGPR = regT0;
+
+    JumpList notObject;
+    notObject.append(branchIfNotCell(tagIteratorGPR));
+    notObject.append(branchIfNotObject(payloadIteratorGPR));
+
+    auto bytecode = instruction->as<OpIteratorOpen>();
+    VirtualRegister nextVReg = bytecode.m_next;
+    UniquedStringImpl* ident = vm().propertyNames->next.impl();
+
+    JITGetByIdGenerator& gen = m_getByIds[m_getByIdIndex++];
+    
+    Label coldPathBegin = label();
+
+    Call call = callOperationWithProfile(
+        bytecode.metadata(m_codeBlock), // metadata
+        operationGetByIdOptimize, // operation
+        nextVReg, // result
+        TrustedImmPtr(m_codeBlock->globalObject()), // arg1
+        gen.stubInfo(), // arg2
+        JSValueRegs(tagIteratorGPR, payloadIteratorGPR), // arg3
+        CacheableIdentifier::createFromImmortalIdentifier(ident).rawBits()); // arg4
+    
+    gen.reportSlowPathCall(coldPathBegin, call);
+    auto done = jump();
+
+    notObject.link(this);
+    callOperation(operationThrowIteratorResultIsNotObject, TrustedImmPtr(m_codeBlock->globalObject()));
+
+    done.link(this);
 }
 
-void JIT::emit_op_iterator_next(const Instruction*)
+void JIT::emit_op_iterator_next(const Instruction* instruction)
 {
-    UNREACHABLE_FOR_PLATFORM();
+    auto bytecode = instruction->as<OpIteratorNext>();
+    auto& metadata = bytecode.metadata(m_codeBlock);
+    auto* tryFastFunction = ([&] () {
+        switch (instruction->width()) {
+        case Narrow: return iterator_next_try_fast_narrow;
+        case Wide16: return iterator_next_try_fast_wide16;
+        case Wide32: return iterator_next_try_fast_wide32;
+        default: RELEASE_ASSERT_NOT_REACHED();
+        }
+    })();
+
+    JSValueRegs nextRegs(regT1, regT0);
+    emitGetVirtualRegister(bytecode.m_next, nextRegs);
+    Jump genericCase = branchIfNotEmpty(nextRegs);
+
+    JITSlowPathCall slowPathCall(this, instruction, tryFastFunction);
+    slowPathCall.call();
+    Jump fastCase = branch32(NotEqual, GPRInfo::returnValueGPR2, TrustedImm32(static_cast<uint32_t>(IterationMode::Generic)));
+
+    genericCase.link(this);
+    or8(TrustedImm32(static_cast<uint8_t>(IterationMode::Generic)), AbsoluteAddress(&metadata.m_iterationMetadata.seenModes));
+    compileOpCall<OpIteratorNext>(instruction, m_callLinkInfoIndex++);
+    advanceToNextCheckpoint();
+    // call result ({ done, value } JSObject) in regT1, regT0
+
+    GPRReg tagValueGPR = regT1;
+    GPRReg payloadValueGPR = regT0;
+        
+    GPRReg tagDoneGPR = regT5;
+    GPRReg payloadDoneGPR = regT4;
+
+    {
+        GPRReg tagIterResultGPR = regT3;
+        GPRReg payloadIterResultGPR = regT2;
+        
+        // iterResultGPR will get trashed by the first get by id below.
+        move(regT1, tagIterResultGPR);
+        move(regT0, payloadIterResultGPR);
+
+        emitJumpSlowCaseIfNotJSCell(tagIterResultGPR);
+
+        RegisterSet preservedRegs = RegisterSet::stubUnavailableRegisters();
+        preservedRegs.add(tagValueGPR);
+        preservedRegs.add(payloadValueGPR);
+        JITGetByIdGenerator gen(
+            m_codeBlock,
+            CodeOrigin(m_bytecodeIndex),
+            CallSiteIndex(BytecodeIndex(m_bytecodeIndex.offset())),
+            preservedRegs,
+            CacheableIdentifier::createFromImmortalIdentifier(vm().propertyNames->done.impl()),
+            JSValueRegs(tagIterResultGPR, payloadIterResultGPR),
+            JSValueRegs(tagDoneGPR, payloadDoneGPR),
+            AccessType::GetById);
+        gen.generateFastPath(*this);
+        addSlowCase(gen.slowPathJump());
+        m_getByIds.append(gen);
+
+        emitValueProfilingSite(metadata);
+        emitPutVirtualRegister(bytecode.m_done, JSValueRegs(tagDoneGPR, payloadDoneGPR));
+        advanceToNextCheckpoint();
+    }
+
+    {
+        GPRReg tagIterResultGPR = regT1;
+        GPRReg payloadIterResultGPR = regT0;
+
+        GPRReg scratch1 = regT6;
+        GPRReg scratch2 = regT7;
+        const bool shouldCheckMasqueradesAsUndefined = false;
+        JumpList iterationDone = branchIfTruthy(vm(), JSValueRegs(tagDoneGPR, payloadDoneGPR), scratch1, scratch2, fpRegT0, fpRegT1, shouldCheckMasqueradesAsUndefined, m_codeBlock->globalObject());
+
+        JITGetByIdGenerator gen(
+            m_codeBlock,
+            CodeOrigin(m_bytecodeIndex),
+            CallSiteIndex(BytecodeIndex(m_bytecodeIndex.offset())),
+            RegisterSet::stubUnavailableRegisters(),
+            CacheableIdentifier::createFromImmortalIdentifier(vm().propertyNames->value.impl()),
+            JSValueRegs(tagIterResultGPR, payloadIterResultGPR),
+            JSValueRegs(tagValueGPR, payloadValueGPR),
+            AccessType::GetById);
+        gen.generateFastPath(*this);
+        addSlowCase(gen.slowPathJump());
+        m_getByIds.append(gen);
+
+        emitValueProfilingSite(metadata);
+        emitPutVirtualRegister(bytecode.m_value, JSValueRegs(tagValueGPR, payloadValueGPR));
+
+        iterationDone.link(this);
+    }
+
+    fastCase.link(this);
 }
 
-void JIT::emitSlow_op_iterator_next(const Instruction*, Vector<SlowCaseEntry>::iterator&)
+void JIT::emitSlow_op_iterator_next(const Instruction* instruction, Vector<SlowCaseEntry>::iterator& iter)
 {
-    UNREACHABLE_FOR_PLATFORM();
+    linkAllSlowCases(iter);
+    compileOpCallSlowCase<OpIteratorNext>(instruction, iter, m_callLinkInfoIndex++);
+    emitJumpSlowToHotForCheckpoint(jump());
+
+    auto bytecode = instruction->as<OpIteratorNext>();
+    {
+        VirtualRegister doneVReg = bytecode.m_done;
+        GPRReg tagValueGPR = regT1;
+        GPRReg payloadValueGPR = regT0;
+            
+        GPRReg tagIterResultGPR = regT3;
+        GPRReg payloadIterResultGPR = regT2;
+        
+        GPRReg tagDoneGPR = regT5;
+        GPRReg payloadDoneGPR = regT4;
+
+        linkAllSlowCases(iter);
+        JumpList notObject;
+        notObject.append(branchIfNotCell(tagIterResultGPR));
+        notObject.append(branchIfNotObject(payloadIterResultGPR));
+
+        UniquedStringImpl* ident = vm().propertyNames->done.impl();
+        JITGetByIdGenerator& gen = m_getByIds[m_getByIdIndex++];
+        
+        Label coldPathBegin = label();
+
+        Call call = callOperationWithProfile(
+            bytecode.metadata(m_codeBlock), // metadata
+            operationGetByIdOptimize, // operation
+            doneVReg, // result
+            TrustedImmPtr(m_codeBlock->globalObject()), // arg1
+            gen.stubInfo(), // arg2
+            JSValueRegs(tagIterResultGPR, payloadIterResultGPR), // arg3
+            CacheableIdentifier::createFromImmortalIdentifier(ident).rawBits()); // arg4
+
+        gen.reportSlowPathCall(coldPathBegin, call);
+        emitGetVirtualRegister(doneVReg, JSValueRegs(tagDoneGPR, payloadDoneGPR));
+        emitGetVirtualRegister(bytecode.m_value, JSValueRegs(tagValueGPR, payloadValueGPR));
+        emitJumpSlowToHotForCheckpoint(jump());
+
+        notObject.link(this);
+        callOperation(operationThrowIteratorResultIsNotObject, TrustedImmPtr(m_codeBlock->globalObject()));
+    }
+
+    {   
+        GPRReg tagIterResultGPR = regT1;
+        GPRReg payloadIterResultGPR = regT0;
+
+        linkAllSlowCases(iter);
+        VirtualRegister valueVReg = bytecode.m_value;
+
+        UniquedStringImpl* ident = vm().propertyNames->value.impl();
+        JITGetByIdGenerator& gen = m_getByIds[m_getByIdIndex++];
+
+        Label coldPathBegin = label();
+
+        Call call = callOperationWithProfile(
+            bytecode.metadata(m_codeBlock), // metadata
+            operationGetByIdOptimize, // operation
+            valueVReg, // result
+            TrustedImmPtr(m_codeBlock->globalObject()), // arg1
+            gen.stubInfo(), // arg2
+            JSValueRegs(tagIterResultGPR, payloadIterResultGPR), // arg3
+            CacheableIdentifier::createFromImmortalIdentifier(ident).rawBits()); // arg4
+
+        gen.reportSlowPathCall(coldPathBegin, call);
+    }
 }
 
 } // namespace JSC

Modified: trunk/Source/_javascript_Core/jit/JITInlines.h (265035 => 265036)


--- trunk/Source/_javascript_Core/jit/JITInlines.h	2020-07-29 08:45:12 UTC (rev 265035)
+++ trunk/Source/_javascript_Core/jit/JITInlines.h	2020-07-29 10:32:27 UTC (rev 265036)
@@ -616,11 +616,6 @@
     addSlowCase(branchIfCell(reg));
 }
 
-ALWAYS_INLINE void JIT::emitJumpSlowCaseIfNotJSCell(RegisterID reg)
-{
-    addSlowCase(branchIfNotCell(reg));
-}
-
 ALWAYS_INLINE void JIT::emitJumpSlowCaseIfNotJSCell(RegisterID reg, VirtualRegister vReg)
 {
     if (!m_codeBlock->isKnownCell(vReg))
@@ -656,6 +651,11 @@
 
 #endif // USE(JSVALUE32_64)
 
+ALWAYS_INLINE void JIT::emitJumpSlowCaseIfNotJSCell(RegisterID reg)
+{
+    addSlowCase(branchIfNotCell(reg));
+}
+
 ALWAYS_INLINE int JIT::jumpTarget(const Instruction* instruction, int target)
 {
     if (target)

Modified: trunk/Source/_javascript_Core/llint/LowLevelInterpreter32_64.asm (265035 => 265036)


--- trunk/Source/_javascript_Core/llint/LowLevelInterpreter32_64.asm	2020-07-29 08:45:12 UTC (rev 265035)
+++ trunk/Source/_javascript_Core/llint/LowLevelInterpreter32_64.asm	2020-07-29 10:32:27 UTC (rev 265036)
@@ -488,6 +488,9 @@
         end)
 end
 
+# loadVariable loads the value of field fieldName using macro get
+# into register tagReg and payloadReg
+# Clobbers: indexReg
 macro loadVariable(get, fieldName, indexReg, tagReg, payloadReg)
     get(fieldName, indexReg)
     loadi TagOffset[cfr, indexReg, 8], tagReg
@@ -651,7 +654,7 @@
 end
 
 macro valueProfile(opcodeStruct, profileName, metadata, tag, payload)
-    storei tag, %opcodeStruct%::Metadata::m_profile.m_buckets + TagOffset[metadata]
+    storei tag, %opcodeStruct%::Metadata::%profileName%.m_buckets + TagOffset[metadata]
     storei payload, %opcodeStruct%::Metadata::%profileName%.m_buckets + PayloadOffset[metadata]
 end
 
@@ -1410,7 +1413,54 @@
     dispatch()
 end)
 
+# Assumption: The base object is in t3
+# FIXME: this is very close to the 64bit version. Consider refactoring.
+macro performGetByIDHelper(opcodeStruct, modeMetadataName, valueProfileName, slowLabel, size, metadata, return)
+    metadata(t2, t1)
+    loadb %opcodeStruct%::Metadata::%modeMetadataName%.mode[t2], t1
+        
+.opGetByIdDefault:
+    bbneq t1, constexpr GetByIdMode::Default, .opGetByIdProtoLoad
+    loadi JSCell::m_structureID[t3], t1 # assumes base object in t3
+    loadi %opcodeStruct%::Metadata::%modeMetadataName%.defaultMode.structureID[t2], t0
+    bineq t0, t1, slowLabel
+    loadis %opcodeStruct%::Metadata::%modeMetadataName%.defaultMode.cachedOffset[t2], t1
+    loadPropertyAtVariableOffset(t1, t3, t0, t1)
+    valueProfile(opcodeStruct, valueProfileName, t2, t0, t1)
+    return(t0, t1)
 
+.opGetByIdProtoLoad:
+    bbneq t1, constexpr GetByIdMode::ProtoLoad, .opGetByIdArrayLength
+    loadi JSCell::m_structureID[t3], t1
+    loadi %opcodeStruct%::Metadata::%modeMetadataName%.protoLoadMode.structureID[t2], t3
+    bineq t3, t1, slowLabel
+    loadis %opcodeStruct%::Metadata::%modeMetadataName%.protoLoadMode.cachedOffset[t2], t1
+    loadp %opcodeStruct%::Metadata::%modeMetadataName%.protoLoadMode.cachedSlot[t2], t3
+    loadPropertyAtVariableOffset(t1, t3, t0, t1)
+    valueProfile(opcodeStruct, valueProfileName, t2, t0, t1)
+    return(t0, t1)
+
+.opGetByIdArrayLength:
+    bbneq t1, constexpr GetByIdMode::ArrayLength, .opGetByIdUnset
+    move t3, t0
+    arrayProfile(%opcodeStruct%::Metadata::%modeMetadataName%.arrayLengthMode.arrayProfile, t0, t2, t5)
+    btiz t0, IsArray, slowLabel
+    btiz t0, IndexingShapeMask, slowLabel
+    loadp JSObject::m_butterfly[t3], t0
+    loadi -sizeof IndexingHeader + IndexingHeader::u.lengths.publicLength[t0], t0
+    bilt t0, 0, slowLabel
+    valueProfile(opcodeStruct, valueProfileName, t2, Int32Tag, t0)
+    return(Int32Tag, t0)
+    
+.opGetByIdUnset:
+    loadi JSCell::m_structureID[t3], t1
+    loadi %opcodeStruct%::Metadata::%modeMetadataName%.unsetMode.structureID[t2], t0
+    bineq t0, t1, slowLabel
+    valueProfile(opcodeStruct, valueProfileName, t2, UndefinedTag, 0)
+    return(UndefinedTag, 0)
+
+end
+
 llintOpWithMetadata(op_get_by_id, OpGetById, macro (size, get, dispatch, metadata, return)
     metadata(t5, t0)
     loadb OpGetById::Metadata::m_modeMetadata.mode[t5], t1
@@ -1982,6 +2032,30 @@
 .done:
 end
 
+macro callHelper(opcodeName, slowPath, opcodeStruct, valueProfileName, dstVirtualRegister, prepareCall, size, dispatch, metadata, getCallee, getArgumentStart, getArgumentCountIncludingThis)
+    metadata(t5, t0)
+    getCallee(t0)
+
+    loadp %opcodeStruct%::Metadata::m_callLinkInfo.m_calleeOrLastSeenCalleeWithLinkBit[t5], t2
+    loadConstantOrVariablePayload(size, t0, CellTag, t3, .opCallSlow)
+    bineq t3, t2, .opCallSlow
+    getArgumentStart(t3)
+    lshifti 3, t3
+    negi t3
+    addp cfr, t3  # t3 contains the new value of cfr
+    storei t2, Callee + PayloadOffset[t3]
+    getArgumentCountIncludingThis(t2)    
+    storei PC, ArgumentCountIncludingThis + TagOffset[cfr]
+    storei t2, ArgumentCountIncludingThis + PayloadOffset[t3]
+    storei CellTag, Callee + TagOffset[t3]
+    move t3, sp
+    prepareCall(%opcodeStruct%::Metadata::m_callLinkInfo.m_machineCodeTarget[t5], t2, t3, t4, JSEntryPtrTag)
+    callTargetFunction(opcodeName, size, opcodeStruct, valueProfileName, dstVirtualRegister, dispatch, %opcodeStruct%::Metadata::m_callLinkInfo.m_machineCodeTarget[t5], JSEntryPtrTag)
+
+.opCallSlow:
+    slowPathForCall(opcodeName, size, opcodeStruct, valueProfileName, dstVirtualRegister, dispatch, slowPath, prepareCall)
+end
+        
 macro commonCallOp(opcodeName, slowPath, opcodeStruct, prepareCall, prologue)
     llintOpWithMetadata(opcodeName, opcodeStruct, macro (size, get, dispatch, metadata, return)
         metadata(t5, t0)
@@ -1990,25 +2064,19 @@
             getu(size, opcodeStruct, fieldName, dst)
         end, metadata)
 
-        get(m_callee, t0)
-        loadp %opcodeStruct%::Metadata::m_callLinkInfo.m_calleeOrLastSeenCalleeWithLinkBit[t5], t2
-        loadConstantOrVariablePayload(size, t0, CellTag, t3, .opCallSlow)
-        bineq t3, t2, .opCallSlow
-        getu(size, opcodeStruct, m_argv, t3)
-        lshifti 3, t3
-        negi t3
-        addp cfr, t3  # t3 contains the new value of cfr
-        storei t2, Callee + PayloadOffset[t3]
-        getu(size, opcodeStruct, m_argc, t2)
-        storei PC, ArgumentCountIncludingThis + TagOffset[cfr]
-        storei t2, ArgumentCountIncludingThis + PayloadOffset[t3]
-        storei CellTag, Callee + TagOffset[t3]
-        move t3, sp
-        prepareCall(%opcodeStruct%::Metadata::m_callLinkInfo.m_machineCodeTarget[t5], t2, t3, t4, JSEntryPtrTag)
-        callTargetFunction(opcodeName, size, opcodeStruct, m_profile, m_dst, dispatch, %opcodeStruct%::Metadata::m_callLinkInfo.m_machineCodeTarget[t5], JSEntryPtrTag)
+        macro getCallee(dst)
+           get(m_callee, t0)
+        end
 
-    .opCallSlow:
-        slowPathForCall(opcodeName, size, opcodeStruct, m_profile, m_dst, dispatch, slowPath, prepareCall)
+        macro getArgumentStart(dst)
+            getu(size, opcodeStruct, m_argv, dst)
+        end
+
+        macro getArgumentCount(dst)
+            getu(size, opcodeStruct, m_argc, dst)
+        end
+        
+        callHelper(opcodeName, slowPath, opcodeStruct, m_profile, m_dst, prepareCall, size, dispatch, metadata, getCallee, getArgumentStart, getArgumentCount)
     end)
 end
 
@@ -2642,25 +2710,150 @@
     return(Int32Tag, t0)
 end)
 
-llintOp(op_iterator_open, OpIteratorOpen, macro (size, get, dispatch)
-    defineOSRExitReturnLabel(op_iterator_open, size)
-    break
-    if C_LOOP or C_LOOP_WIN
-        # Insert superflous call return labels for Cloop.
-        cloopCallJSFunction a0 # symbolIterator
-        cloopCallJSFunction a0 # get next
+llintOpWithMetadata(op_iterator_open, OpIteratorOpen, macro (size, get, dispatch, metadata, return)
+    macro fastNarrow()
+        callSlowPath(_iterator_open_try_fast_narrow)
     end
+    macro fastWide16()
+        callSlowPath(_iterator_open_try_fast_wide16)
+    end
+    macro fastWide32()
+        callSlowPath(_iterator_open_try_fast_wide32)
+    end
+    size(fastNarrow, fastWide16, fastWide32, macro (callOp) callOp() end)
+
+    # FIXME: We should do this with inline assembly since it's the "fast" case.
+    bbeq r1, constexpr IterationMode::Generic, .iteratorOpenGeneric
+    dispatch()
+
+.iteratorOpenGeneric:
+    macro gotoGetByIdCheckpoint()
+        jmp .getByIdStart
+    end
+
+    macro getCallee(dst)
+        get(m_symbolIterator, dst)
+    end
+
+    macro getArgumentIncludingThisStart(dst)
+        getu(size, OpIteratorOpen, m_stackOffset, dst)
+    end
+
+    macro getArgumentIncludingThisCount(dst)
+        move 1, dst
+    end
+
+    callHelper(op_iterator_open, _llint_slow_path_iterator_open_call, OpIteratorOpen, m_iteratorProfile, m_iterator, prepareForRegularCall, size, gotoGetByIdCheckpoint, metadata, getCallee, getArgumentIncludingThisStart, getArgumentIncludingThisCount)
+
+.getByIdStart:
+    macro storeNextAndDispatch(valueTag, valuePayload)
+        move valueTag, t2
+        move valuePayload, t3
+        get(m_next, t1)
+        storei t2, TagOffset[cfr, t1, 8]
+        storei t3, PayloadOffset[cfr, t1, 8]
+        dispatch()
+    end
+
+    # We need to load m_iterator into t3 because that's where
+    # performGetByIDHelper expects the base object    
+    loadVariable(get, m_iterator, t3, t0, t3)
+    bineq t0, CellTag, .iteratorOpenGenericGetNextSlow
+    performGetByIDHelper(OpIteratorOpen, m_modeMetadata, m_nextProfile, .iteratorOpenGenericGetNextSlow, size, metadata, storeNextAndDispatch)
+
+.iteratorOpenGenericGetNextSlow:
+    callSlowPath(_llint_slow_path_iterator_open_get_next)
+    dispatch()
 end)
 
-llintOp(op_iterator_next, OpIteratorNext, macro (size, get, dispatch)
-    defineOSRExitReturnLabel(op_iterator_next, size)
-    break
-    if C_LOOP or C_LOOP_WIN
-        # Insert superflous call return labels for Cloop.
-        # FIXME: Not sure why two are only needed...
-        cloopCallJSFunction a0 # next
-        cloopCallJSFunction a0 # get done
+llintOpWithMetadata(op_iterator_next, OpIteratorNext, macro (size, get, dispatch, metadata, return)
+        
+    loadVariable(get, m_next, t0, t1, t0)
+    bieq t1, UndefinedTag, .iteratorNextGeneric
+    btinz t0, .iteratorNextGeneric
+
+    macro fastNarrow()
+        callSlowPath(_iterator_next_try_fast_narrow)
     end
+    macro fastWide16()
+        callSlowPath(_iterator_next_try_fast_wide16)
+    end
+    macro fastWide32()
+        callSlowPath(_iterator_next_try_fast_wide32)
+    end
+    size(fastNarrow, fastWide16, fastWide32, macro (callOp) callOp() end)
+
+    # FIXME: We should do this with inline assembly since it's the "fast" case.
+    bbeq r1, constexpr IterationMode::Generic, .iteratorNextGeneric
+    dispatch()
+
+.iteratorNextGeneric:
+    macro gotoGetDoneCheckpoint()
+        jmp .getDoneStart
+    end
+
+    macro getCallee(dst)
+        get(m_next, dst)
+    end
+
+    macro getArgumentIncludingThisStart(dst)
+        getu(size, OpIteratorNext, m_stackOffset, dst)
+    end
+
+    macro getArgumentIncludingThisCount(dst)
+        move 1, dst
+    end
+
+    # Use m_value slot as a tmp since we are going to write to it later.
+    callHelper(op_iterator_next, _llint_slow_path_iterator_next_call, OpIteratorNext, m_nextResultProfile, m_value, prepareForRegularCall, size, gotoGetDoneCheckpoint, metadata, getCallee, getArgumentIncludingThisStart, getArgumentIncludingThisCount)
+
+.getDoneStart:
+    macro storeDoneAndJmpToGetValue(doneValueTag, doneValuePayload)
+        move doneValueTag, t0
+        move doneValuePayload, t1
+        get(m_done, t2)
+        storei t0, TagOffset[cfr, t2, 8]
+        storei t1, PayloadOffset[cfr, t2, 8]
+        jmp .getValueStart
+    end
+
+    loadVariable(get, m_value, t3, t0, t3)
+    bineq t0, CellTag, .getDoneSlow
+    performGetByIDHelper(OpIteratorNext, m_doneModeMetadata, m_doneProfile, .getDoneSlow, size, metadata, storeDoneAndJmpToGetValue)
+
+.getDoneSlow:
+    callSlowPath(_llint_slow_path_iterator_next_get_done)
+    branchIfException(_llint_throw_from_slow_path_trampoline)
+    loadVariable(get, m_done, t1, t0, t1)
+
+    # storeDoneAndJmpToGetValue puts the doneValue into t0
+.getValueStart:
+    # In 32 bits, following slow path if tags is not null, undefined, int32, boolean.
+    # These satisfy the mask ~0x3.
+    # Therefore if the mask is _not_ satisfied, we branch to the slow case.
+    btinz t0, ~0x3, .getValueSlow
+    btiz t1, 0x1, .notDone
+    dispatch()
+
+.notDone:
+    macro storeValueAndDispatch(vTag, vPayload)
+        move vTag, t2
+        move vPayload, t3
+        get(m_value, t1)
+        storei t2, TagOffset[cfr, t1, 8]
+        storei t3, PayloadOffset[cfr, t1, 8]
+        checkStackPointerAlignment(t0, 0xbaddb01e)
+        dispatch()
+    end
+
+    # Reload the next result tmp since the get_by_id above may have clobbered t3.
+    loadVariable(get, m_value, t3, t0, t3)
+    # We don't need to check if the iterator result is a cell here since we will have thrown an error before.
+    performGetByIDHelper(OpIteratorNext, m_valueModeMetadata, m_valueProfile, .getValueSlow, size, metadata, storeValueAndDispatch)
+
+.getValueSlow:
+    callSlowPath(_llint_slow_path_iterator_next_get_value)
+    dispatch()
 end)
 
 llintOpWithProfile(op_get_internal_field, OpGetInternalField, macro (size, get, dispatch, return)
_______________________________________________
webkit-changes mailing list
[email protected]
https://lists.webkit.org/mailman/listinfo/webkit-changes

Reply via email to