- a/Source/JavaScriptCore/ChangeLog +32 lines
Lines 1-3 a/Source/JavaScriptCore/ChangeLog_sec1
1
2014-11-06  Gyuyoung Kim  <gyuyoung.kim@samsung.com>
2
3
        Apply std::unique_ptr to slowPathCall()
4
        https://bugs.webkit.org/show_bug.cgi?id=138489
5
6
        Reviewed by NOBODY (OOPS!).
7
8
        As a step to use std::unique_ptr<>, this patch makes slowPathCall() use std::unique_ptr<>,
9
        std::make_unique<>, and WTF::move(). 
10
11
        * dfg/DFGSlowPathGenerator.h:
12
        (JSC::DFG::slowPathCall):
13
        (JSC::DFG::slowPathMove):
14
        * dfg/DFGSpeculativeJIT.cpp:
15
        (JSC::DFG::SpeculativeJIT::emitAllocateJSArray):
16
        (JSC::DFG::SpeculativeJIT::addSlowPathGenerator):
17
        (JSC::DFG::SpeculativeJIT::arrayify):
18
        (JSC::DFG::SpeculativeJIT::compileIn):
19
        (JSC::DFG::SpeculativeJIT::compileGetByValOnString):
20
        * dfg/DFGSpeculativeJIT.h:
21
        * dfg/DFGSpeculativeJIT32_64.cpp:
22
        (JSC::DFG::SpeculativeJIT::cachedGetById):
23
        (JSC::DFG::SpeculativeJIT::cachedPutById):
24
        (JSC::DFG::SpeculativeJIT::nonSpeculativeNonPeepholeCompare):
25
        (JSC::DFG::SpeculativeJIT::compile):
26
        * dfg/DFGSpeculativeJIT64.cpp:
27
        (JSC::DFG::SpeculativeJIT::cachedGetById):
28
        (JSC::DFG::SpeculativeJIT::cachedPutById):
29
        (JSC::DFG::SpeculativeJIT::nonSpeculativeNonPeepholeCompare):
30
        (JSC::DFG::SpeculativeJIT::nonSpeculativeNonPeepholeStrictEq):
31
        (JSC::DFG::SpeculativeJIT::compile):
32
1
2014-11-06  Mark Lam  <mark.lam@apple.com>
33
2014-11-06  Mark Lam  <mark.lam@apple.com>
2
34
3
        slow_path_get_direct_pname() needs to be hardened against a constant baseValue.
35
        slow_path_get_direct_pname() needs to be hardened against a constant baseValue.
- a/Source/JavaScriptCore/dfg/DFGSlowPathGenerator.h -51 / +28 lines
Lines 329-422 protected: a/Source/JavaScriptCore/dfg/DFGSlowPathGenerator.h_sec1
329
};
329
};
330
330
331
template<typename JumpType, typename FunctionType, typename ResultType>
331
template<typename JumpType, typename FunctionType, typename ResultType>
332
inline PassOwnPtr<SlowPathGenerator> slowPathCall(
332
inline std::unique_ptr<SlowPathGenerator> slowPathCall(
333
    JumpType from, SpeculativeJIT* jit, FunctionType function,
333
    JumpType from, SpeculativeJIT* jit, FunctionType function,
334
    ResultType result, SpillRegistersMode spillMode = NeedToSpill)
334
    ResultType result, SpillRegistersMode spillMode = NeedToSpill)
335
{
335
{
336
    return adoptPtr(
336
    return std::make_unique<CallResultAndNoArgumentsSlowPathGenerator<JumpType, FunctionType, ResultType>>(
337
        new CallResultAndNoArgumentsSlowPathGenerator<
337
        from, jit, function, spillMode, result);
338
            JumpType, FunctionType, ResultType>(
339
                from, jit, function, spillMode, result));
340
}
338
}
341
339
342
template<
340
template<
343
    typename JumpType, typename FunctionType, typename ResultType,
341
    typename JumpType, typename FunctionType, typename ResultType,
344
    typename ArgumentType1>
342
    typename ArgumentType1>
345
inline PassOwnPtr<SlowPathGenerator> slowPathCall(
343
inline std::unique_ptr<SlowPathGenerator> slowPathCall(
346
    JumpType from, SpeculativeJIT* jit, FunctionType function,
344
    JumpType from, SpeculativeJIT* jit, FunctionType function,
347
    ResultType result, ArgumentType1 argument1,
345
    ResultType result, ArgumentType1 argument1,
348
    SpillRegistersMode spillMode = NeedToSpill)
346
    SpillRegistersMode spillMode = NeedToSpill)
349
{
347
{
350
    return adoptPtr(
348
    return std::make_unique<CallResultAndOneArgumentSlowPathGenerator<JumpType, FunctionType, ResultType, ArgumentType1>>(
351
        new CallResultAndOneArgumentSlowPathGenerator<
349
        from, jit, function, spillMode, result, argument1);
352
            JumpType, FunctionType, ResultType, ArgumentType1>(
353
                from, jit, function, spillMode, result, argument1));
354
}
350
}
355
351
356
template<
352
template<
357
    typename JumpType, typename FunctionType, typename ResultType,
353
    typename JumpType, typename FunctionType, typename ResultType,
358
    typename ArgumentType1, typename ArgumentType2>
354
    typename ArgumentType1, typename ArgumentType2>
359
inline PassOwnPtr<SlowPathGenerator> slowPathCall(
355
inline std::unique_ptr<SlowPathGenerator> slowPathCall(
360
    JumpType from, SpeculativeJIT* jit, FunctionType function,
356
    JumpType from, SpeculativeJIT* jit, FunctionType function,
361
    ResultType result, ArgumentType1 argument1, ArgumentType2 argument2,
357
    ResultType result, ArgumentType1 argument1, ArgumentType2 argument2,
362
    SpillRegistersMode spillMode = NeedToSpill)
358
    SpillRegistersMode spillMode = NeedToSpill)
363
{
359
{
364
    return adoptPtr(
360
    return std::make_unique<CallResultAndTwoArgumentsSlowPathGenerator<JumpType, FunctionType, ResultType, ArgumentType1, ArgumentType2>>(
365
        new CallResultAndTwoArgumentsSlowPathGenerator<
361
        from, jit, function, spillMode, result, argument1, argument2);
366
            JumpType, FunctionType, ResultType, ArgumentType1, ArgumentType2>(
367
                from, jit, function, spillMode, result, argument1, argument2));
368
}
362
}
369
363
370
template<
364
template<
371
    typename JumpType, typename FunctionType, typename ResultType,
365
    typename JumpType, typename FunctionType, typename ResultType,
372
    typename ArgumentType1, typename ArgumentType2, typename ArgumentType3>
366
    typename ArgumentType1, typename ArgumentType2, typename ArgumentType3>
373
inline PassOwnPtr<SlowPathGenerator> slowPathCall(
367
inline std::unique_ptr<SlowPathGenerator> slowPathCall(
374
    JumpType from, SpeculativeJIT* jit, FunctionType function,
368
    JumpType from, SpeculativeJIT* jit, FunctionType function,
375
    ResultType result, ArgumentType1 argument1, ArgumentType2 argument2,
369
    ResultType result, ArgumentType1 argument1, ArgumentType2 argument2,
376
    ArgumentType3 argument3, SpillRegistersMode spillMode = NeedToSpill)
370
    ArgumentType3 argument3, SpillRegistersMode spillMode = NeedToSpill)
377
{
371
{
378
    return adoptPtr(
372
    return std::make_unique<CallResultAndThreeArgumentsSlowPathGenerator<JumpType, FunctionType, ResultType, ArgumentType1, ArgumentType2,
379
        new CallResultAndThreeArgumentsSlowPathGenerator<
373
        ArgumentType3>>(from, jit, function, spillMode, result, argument1, argument2, argument3);
380
            JumpType, FunctionType, ResultType, ArgumentType1, ArgumentType2,
381
            ArgumentType3>(
382
                from, jit, function, spillMode, result, argument1, argument2,
383
                argument3));
384
}
374
}
385
375
386
template<
376
template<
387
    typename JumpType, typename FunctionType, typename ResultType,
377
    typename JumpType, typename FunctionType, typename ResultType,
388
    typename ArgumentType1, typename ArgumentType2, typename ArgumentType3,
378
    typename ArgumentType1, typename ArgumentType2, typename ArgumentType3,
389
    typename ArgumentType4>
379
    typename ArgumentType4>
390
inline PassOwnPtr<SlowPathGenerator> slowPathCall(
380
inline std::unique_ptr<SlowPathGenerator> slowPathCall(
391
    JumpType from, SpeculativeJIT* jit, FunctionType function,
381
    JumpType from, SpeculativeJIT* jit, FunctionType function,
392
    ResultType result, ArgumentType1 argument1, ArgumentType2 argument2,
382
    ResultType result, ArgumentType1 argument1, ArgumentType2 argument2,
393
    ArgumentType3 argument3, ArgumentType4 argument4,
383
    ArgumentType3 argument3, ArgumentType4 argument4,
394
    SpillRegistersMode spillMode = NeedToSpill)
384
    SpillRegistersMode spillMode = NeedToSpill)
395
{
385
{
396
    return adoptPtr(
386
    return std::make_unique<CallResultAndFourArgumentsSlowPathGenerator<JumpType, FunctionType, ResultType, ArgumentType1, ArgumentType2,
397
        new CallResultAndFourArgumentsSlowPathGenerator<
387
        ArgumentType3, ArgumentType4>>(from, jit, function, spillMode, result, argument1, argument2, argument3, argument4);
398
            JumpType, FunctionType, ResultType, ArgumentType1, ArgumentType2,
399
            ArgumentType3, ArgumentType4>(
400
                from, jit, function, spillMode, result, argument1, argument2,
401
                argument3, argument4));
402
}
388
}
403
389
404
template<
390
template<
405
    typename JumpType, typename FunctionType, typename ResultType,
391
    typename JumpType, typename FunctionType, typename ResultType,
406
    typename ArgumentType1, typename ArgumentType2, typename ArgumentType3,
392
    typename ArgumentType1, typename ArgumentType2, typename ArgumentType3,
407
    typename ArgumentType4, typename ArgumentType5>
393
    typename ArgumentType4, typename ArgumentType5>
408
inline PassOwnPtr<SlowPathGenerator> slowPathCall(
394
inline std::unique_ptr<SlowPathGenerator> slowPathCall(
409
    JumpType from, SpeculativeJIT* jit, FunctionType function,
395
    JumpType from, SpeculativeJIT* jit, FunctionType function,
410
    ResultType result, ArgumentType1 argument1, ArgumentType2 argument2,
396
    ResultType result, ArgumentType1 argument1, ArgumentType2 argument2,
411
    ArgumentType3 argument3, ArgumentType4 argument4, ArgumentType5 argument5,
397
    ArgumentType3 argument3, ArgumentType4 argument4, ArgumentType5 argument5,
412
    SpillRegistersMode spillMode = NeedToSpill)
398
    SpillRegistersMode spillMode = NeedToSpill)
413
{
399
{
414
    return adoptPtr(
400
    return std::make_unique<CallResultAndFiveArgumentsSlowPathGenerator<JumpType, FunctionType, ResultType, ArgumentType1, ArgumentType2,
415
        new CallResultAndFiveArgumentsSlowPathGenerator<
401
        ArgumentType3, ArgumentType4, ArgumentType5>>(from, jit, function, spillMode, result, argument1, argument2, argument3,
416
            JumpType, FunctionType, ResultType, ArgumentType1, ArgumentType2,
402
        argument4, argument5);
417
            ArgumentType3, ArgumentType4, ArgumentType5>(
418
                from, jit, function, spillMode, result, argument1, argument2,
419
                argument3, argument4, argument5));
420
}
403
}
421
404
422
template<typename JumpType, typename DestinationType, typename SourceType, unsigned numberOfAssignments>
405
template<typename JumpType, typename DestinationType, typename SourceType, unsigned numberOfAssignments>
Lines 449-485 private: a/Source/JavaScriptCore/dfg/DFGSlowPathGenerator.h_sec2
449
};
432
};
450
433
451
template<typename JumpType, typename DestinationType, typename SourceType, unsigned numberOfAssignments>
434
template<typename JumpType, typename DestinationType, typename SourceType, unsigned numberOfAssignments>
452
inline PassOwnPtr<SlowPathGenerator> slowPathMove(
435
inline std::unique_ptr<SlowPathGenerator> slowPathMove(
453
    JumpType from, SpeculativeJIT* jit, SourceType source[numberOfAssignments], DestinationType destination[numberOfAssignments])
436
    JumpType from, SpeculativeJIT* jit, SourceType source[numberOfAssignments], DestinationType destination[numberOfAssignments])
454
{
437
{
455
    return adoptPtr(
438
    return std::make_unique<AssigningSlowPathGenerator<JumpType, DestinationType, SourceType, numberOfAssignments>>(
456
        new AssigningSlowPathGenerator<
439
        from, jit, destination, source);
457
            JumpType, DestinationType, SourceType, numberOfAssignments>(
458
                from, jit, destination, source));
459
}
440
}
460
441
461
template<typename JumpType, typename DestinationType, typename SourceType>
442
template<typename JumpType, typename DestinationType, typename SourceType>
462
inline PassOwnPtr<SlowPathGenerator> slowPathMove(
443
inline std::unique_ptr<SlowPathGenerator> slowPathMove(
463
    JumpType from, SpeculativeJIT* jit, SourceType source, DestinationType destination)
444
    JumpType from, SpeculativeJIT* jit, SourceType source, DestinationType destination)
464
{
445
{
465
    SourceType sourceArray[1] = { source };
446
    SourceType sourceArray[1] = { source };
466
    DestinationType destinationArray[1] = { destination };
447
    DestinationType destinationArray[1] = { destination };
467
    return adoptPtr(
448
    return std::make_unique<AssigningSlowPathGenerator<JumpType, DestinationType, SourceType, 1>>(
468
        new AssigningSlowPathGenerator<
449
        from, jit, destinationArray, sourceArray);
469
            JumpType, DestinationType, SourceType, 1>(
470
                from, jit, destinationArray, sourceArray));
471
}
450
}
472
451
473
template<typename JumpType, typename DestinationType, typename SourceType>
452
template<typename JumpType, typename DestinationType, typename SourceType>
474
inline PassOwnPtr<SlowPathGenerator> slowPathMove(
453
inline std::unique_ptr<SlowPathGenerator> slowPathMove(
475
    JumpType from, SpeculativeJIT* jit, SourceType source1, DestinationType destination1, SourceType source2, DestinationType destination2)
454
    JumpType from, SpeculativeJIT* jit, SourceType source1, DestinationType destination1, SourceType source2, DestinationType destination2)
476
{
455
{
477
    SourceType sourceArray[2] = { source1, source2 };
456
    SourceType sourceArray[2] = { source1, source2 };
478
    DestinationType destinationArray[2] = { destination1, destination2 };
457
    DestinationType destinationArray[2] = { destination1, destination2 };
479
    return adoptPtr(
458
    return std::make_unique<AssigningSlowPathGenerator<JumpType, DestinationType, SourceType, 2>>(
480
        new AssigningSlowPathGenerator<
459
        from, jit, destinationArray, sourceArray);
481
            JumpType, DestinationType, SourceType, 2>(
482
                from, jit, destinationArray, sourceArray));
483
}
460
}
484
461
485
} } // namespace JSC::DFG
462
} } // namespace JSC::DFG
- a/Source/JavaScriptCore/dfg/DFGSpeculativeJIT.cpp -17 / +16 lines
Lines 102-111 void SpeculativeJIT::emitAllocateJSArray(GPRReg resultGPR, Structure* structure, a/Source/JavaScriptCore/dfg/DFGSpeculativeJIT.cpp_sec1
102
    // I want a slow path that also loads out the storage pointer, and that's
102
    // I want a slow path that also loads out the storage pointer, and that's
103
    // what this custom CallArrayAllocatorSlowPathGenerator gives me. It's a lot
103
    // what this custom CallArrayAllocatorSlowPathGenerator gives me. It's a lot
104
    // of work for a very small piece of functionality. :-/
104
    // of work for a very small piece of functionality. :-/
105
    addSlowPathGenerator(adoptPtr(
105
    addSlowPathGenerator(std::make_unique<CallArrayAllocatorSlowPathGenerator>(
106
        new CallArrayAllocatorSlowPathGenerator(
107
            slowCases, this, operationNewArrayWithSize, resultGPR, storageGPR,
106
            slowCases, this, operationNewArrayWithSize, resultGPR, storageGPR,
108
            structure, numElements)));
107
            structure, numElements));
109
}
108
}
110
109
111
void SpeculativeJIT::emitAllocateArguments(GPRReg resultGPR, GPRReg scratchGPR1, GPRReg scratchGPR2, MacroAssembler::JumpList& slowPath)
110
void SpeculativeJIT::emitAllocateArguments(GPRReg resultGPR, GPRReg scratchGPR1, GPRReg scratchGPR2, MacroAssembler::JumpList& slowPath)
Lines 257-265 RegisterSet SpeculativeJIT::usedRegisters() a/Source/JavaScriptCore/dfg/DFGSpeculativeJIT.cpp_sec2
257
    return result;
256
    return result;
258
}
257
}
259
258
260
void SpeculativeJIT::addSlowPathGenerator(PassOwnPtr<SlowPathGenerator> slowPathGenerator)
259
void SpeculativeJIT::addSlowPathGenerator(std::unique_ptr<SlowPathGenerator> slowPathGenerator)
261
{
260
{
262
    m_slowPathGenerators.append(slowPathGenerator);
261
    m_slowPathGenerators.append(WTF::move(slowPathGenerator));
263
}
262
}
264
263
265
void SpeculativeJIT::runSlowPathGenerators()
264
void SpeculativeJIT::runSlowPathGenerators()
Lines 781-788 void SpeculativeJIT::arrayify(Node* node, GPRReg baseReg, GPRReg propertyReg) a/Source/JavaScriptCore/dfg/DFGSpeculativeJIT.cpp_sec3
781
        slowPath.append(jumpSlowForUnwantedArrayMode(tempGPR, node->arrayMode()));
780
        slowPath.append(jumpSlowForUnwantedArrayMode(tempGPR, node->arrayMode()));
782
    }
781
    }
783
    
782
    
784
    addSlowPathGenerator(adoptPtr(new ArrayifySlowPathGenerator(
783
    addSlowPathGenerator(std::make_unique<ArrayifySlowPathGenerator>(
785
        slowPath, this, node, baseReg, propertyReg, tempGPR, structureGPR)));
784
        slowPath, this, node, baseReg, propertyReg, tempGPR, structureGPR));
786
    
785
    
787
    noResult(m_currentNode);
786
    noResult(m_currentNode);
788
}
787
}
Lines 879-885 void SpeculativeJIT::compileIn(Node* node) a/Source/JavaScriptCore/dfg/DFGSpeculativeJIT.cpp_sec4
879
            MacroAssembler::PatchableJump jump = m_jit.patchableJump();
878
            MacroAssembler::PatchableJump jump = m_jit.patchableJump();
880
            MacroAssembler::Label done = m_jit.label();
879
            MacroAssembler::Label done = m_jit.label();
881
            
880
            
882
            OwnPtr<SlowPathGenerator> slowPath = slowPathCall(
881
            auto slowPath = slowPathCall(
883
                jump.m_jump, this, operationInOptimize,
882
                jump.m_jump, this, operationInOptimize,
884
                JSValueRegs::payloadOnly(resultGPR), stubInfo, baseGPR,
883
                JSValueRegs::payloadOnly(resultGPR), stubInfo, baseGPR,
885
                string->tryGetValueImpl());
884
                string->tryGetValueImpl());
Lines 889-905 void SpeculativeJIT::compileIn(Node* node) a/Source/JavaScriptCore/dfg/DFGSpeculativeJIT.cpp_sec5
889
            stubInfo->patch.valueGPR = static_cast<int8_t>(resultGPR);
888
            stubInfo->patch.valueGPR = static_cast<int8_t>(resultGPR);
890
            stubInfo->patch.usedRegisters = usedRegisters();
889
            stubInfo->patch.usedRegisters = usedRegisters();
891
            stubInfo->patch.spillMode = NeedToSpill;
890
            stubInfo->patch.spillMode = NeedToSpill;
892
            
891
893
            m_jit.addIn(InRecord(jump, done, slowPath.get(), stubInfo));
892
            m_jit.addIn(InRecord(jump, done, slowPath.get(), stubInfo));
894
            addSlowPathGenerator(slowPath.release());
893
            addSlowPathGenerator(WTF::move(slowPath));
895
                
894
896
            base.use();
895
            base.use();
897
            
896
898
            blessedBooleanResult(resultGPR, node, UseChildrenCalledExplicitly);
897
            blessedBooleanResult(resultGPR, node, UseChildrenCalledExplicitly);
899
            return;
898
            return;
900
        }
899
        }
901
    }
900
    }
902
        
901
903
    JSValueOperand key(this, node->child1());
902
    JSValueOperand key(this, node->child1());
904
    JSValueRegs regs = key.jsValueRegs();
903
    JSValueRegs regs = key.jsValueRegs();
905
        
904
        
Lines 1779-1790 void SpeculativeJIT::compileGetByValOnString(Node* node) a/Source/JavaScriptCore/dfg/DFGSpeculativeJIT.cpp_sec6
1779
        JSGlobalObject* globalObject = m_jit.globalObjectFor(node->origin.semantic);
1778
        JSGlobalObject* globalObject = m_jit.globalObjectFor(node->origin.semantic);
1780
        if (globalObject->stringPrototypeChainIsSane()) {
1779
        if (globalObject->stringPrototypeChainIsSane()) {
1781
#if USE(JSVALUE64)
1780
#if USE(JSVALUE64)
1782
            addSlowPathGenerator(adoptPtr(new SaneStringGetByValSlowPathGenerator(
1781
            addSlowPathGenerator(std::make_unique<SaneStringGetByValSlowPathGenerator>(
1783
                outOfBounds, this, JSValueRegs(scratchReg), baseReg, propertyReg)));
1782
                outOfBounds, this, JSValueRegs(scratchReg), baseReg, propertyReg));
1784
#else
1783
#else
1785
            addSlowPathGenerator(adoptPtr(new SaneStringGetByValSlowPathGenerator(
1784
            addSlowPathGenerator(std::make_unique<SaneStringGetByValSlowPathGenerator>(
1786
                outOfBounds, this, JSValueRegs(resultTagReg, scratchReg),
1785
                outOfBounds, this, JSValueRegs(resultTagReg, scratchReg),
1787
                baseReg, propertyReg)));
1786
                baseReg, propertyReg));
1788
#endif
1787
#endif
1789
        } else {
1788
        } else {
1790
#if USE(JSVALUE64)
1789
#if USE(JSVALUE64)
- a/Source/JavaScriptCore/dfg/DFGSpeculativeJIT.h -2 / +2 lines
Lines 316-322 public: a/Source/JavaScriptCore/dfg/DFGSpeculativeJIT.h_sec1
316
    GPRReg fillSpeculateBoolean(Edge);
316
    GPRReg fillSpeculateBoolean(Edge);
317
    GeneratedOperandType checkGeneratedTypeForToInt32(Node*);
317
    GeneratedOperandType checkGeneratedTypeForToInt32(Node*);
318
318
319
    void addSlowPathGenerator(PassOwnPtr<SlowPathGenerator>);
319
    void addSlowPathGenerator(std::unique_ptr<SlowPathGenerator>);
320
    void runSlowPathGenerators();
320
    void runSlowPathGenerators();
321
    
321
    
322
    void compile(Node*);
322
    void compile(Node*);
Lines 2433-2439 public: a/Source/JavaScriptCore/dfg/DFGSpeculativeJIT.h_sec2
2433
    
2433
    
2434
    bool m_isCheckingArgumentTypes;
2434
    bool m_isCheckingArgumentTypes;
2435
    
2435
    
2436
    Vector<OwnPtr<SlowPathGenerator>, 8> m_slowPathGenerators;
2436
    Vector<std::unique_ptr<SlowPathGenerator>, 8> m_slowPathGenerators;
2437
    Vector<SilentRegisterSavePlan> m_plans;
2437
    Vector<SilentRegisterSavePlan> m_plans;
2438
};
2438
};
2439
2439
- a/Source/JavaScriptCore/dfg/DFGSpeculativeJIT32_64.cpp -12 / +10 lines
Lines 189-196 void SpeculativeJIT::cachedGetById( a/Source/JavaScriptCore/dfg/DFGSpeculativeJIT32_64.cpp_sec1
189
    if (slowPathTarget.isSet())
189
    if (slowPathTarget.isSet())
190
        slowCases.append(slowPathTarget);
190
        slowCases.append(slowPathTarget);
191
    slowCases.append(gen.slowPathJump());
191
    slowCases.append(gen.slowPathJump());
192
    
192
193
    OwnPtr<SlowPathGenerator> slowPath;
193
    std::unique_ptr<SlowPathGenerator> slowPath;
194
    if (baseTagGPROrNone == InvalidGPRReg) {
194
    if (baseTagGPROrNone == InvalidGPRReg) {
195
        slowPath = slowPathCall(
195
        slowPath = slowPathCall(
196
            slowCases, this, operationGetByIdOptimize,
196
            slowCases, this, operationGetByIdOptimize,
Lines 203-211 void SpeculativeJIT::cachedGetById( a/Source/JavaScriptCore/dfg/DFGSpeculativeJIT32_64.cpp_sec2
203
            JSValueRegs(resultTagGPR, resultPayloadGPR), gen.stubInfo(), baseTagGPROrNone,
203
            JSValueRegs(resultTagGPR, resultPayloadGPR), gen.stubInfo(), baseTagGPROrNone,
204
            basePayloadGPR, identifierUID(identifierNumber));
204
            basePayloadGPR, identifierUID(identifierNumber));
205
    }
205
    }
206
    
206
207
    m_jit.addGetById(gen, slowPath.get());
207
    m_jit.addGetById(gen, slowPath.get());
208
    addSlowPathGenerator(slowPath.release());
208
    addSlowPathGenerator(WTF::move(slowPath));
209
}
209
}
210
210
211
void SpeculativeJIT::cachedPutById(CodeOrigin codeOrigin, GPRReg basePayloadGPR, GPRReg valueTagGPR, GPRReg valuePayloadGPR, GPRReg scratchGPR, unsigned identifierNumber, PutKind putKind, JITCompiler::Jump slowPathTarget, SpillRegistersMode spillMode)
211
void SpeculativeJIT::cachedPutById(CodeOrigin codeOrigin, GPRReg basePayloadGPR, GPRReg valueTagGPR, GPRReg valuePayloadGPR, GPRReg scratchGPR, unsigned identifierNumber, PutKind putKind, JITCompiler::Jump slowPathTarget, SpillRegistersMode spillMode)
Lines 222-233 void SpeculativeJIT::cachedPutById(CodeOrigin codeOrigin, GPRReg basePayloadGPR, a/Source/JavaScriptCore/dfg/DFGSpeculativeJIT32_64.cpp_sec3
222
        slowCases.append(slowPathTarget);
222
        slowCases.append(slowPathTarget);
223
    slowCases.append(gen.slowPathJump());
223
    slowCases.append(gen.slowPathJump());
224
224
225
    OwnPtr<SlowPathGenerator> slowPath = slowPathCall(
225
    auto slowPath = slowPathCall(
226
        slowCases, this, gen.slowPathFunction(), NoResult, gen.stubInfo(), valueTagGPR,
226
        slowCases, this, gen.slowPathFunction(), NoResult, gen.stubInfo(), valueTagGPR,
227
        valuePayloadGPR, basePayloadGPR, identifierUID(identifierNumber));
227
        valuePayloadGPR, basePayloadGPR, identifierUID(identifierNumber));
228
228
229
    m_jit.addPutById(gen, slowPath.get());
229
    m_jit.addPutById(gen, slowPath.get());
230
    addSlowPathGenerator(slowPath.release());
230
    addSlowPathGenerator(WTF::move(slowPath));
231
}
231
}
232
232
233
void SpeculativeJIT::nonSpeculativeNonPeepholeCompareNull(Edge operand, bool invert)
233
void SpeculativeJIT::nonSpeculativeNonPeepholeCompareNull(Edge operand, bool invert)
Lines 513-522 void SpeculativeJIT::nonSpeculativeNonPeepholeCompare(Node* node, MacroAssembler a/Source/JavaScriptCore/dfg/DFGSpeculativeJIT32_64.cpp_sec4
513
        m_jit.compare32(cond, arg1PayloadGPR, arg2PayloadGPR, resultPayloadGPR);
513
        m_jit.compare32(cond, arg1PayloadGPR, arg2PayloadGPR, resultPayloadGPR);
514
    
514
    
515
        if (!isKnownInteger(node->child1().node()) || !isKnownInteger(node->child2().node())) {
515
        if (!isKnownInteger(node->child1().node()) || !isKnownInteger(node->child2().node())) {
516
            addSlowPathGenerator(adoptPtr(
516
            addSlowPathGenerator(std::make_unique<CompareAndBoxBooleanSlowPathGenerator<JITCompiler::JumpList>>(
517
                new CompareAndBoxBooleanSlowPathGenerator<JITCompiler::JumpList>(
518
                    slowPath, this, helperFunction, resultPayloadGPR, arg1TagGPR,
517
                    slowPath, this, helperFunction, resultPayloadGPR, arg1TagGPR,
519
                    arg1PayloadGPR, arg2TagGPR, arg2PayloadGPR)));
518
                    arg1PayloadGPR, arg2TagGPR, arg2PayloadGPR));
520
        }
519
        }
521
        
520
        
522
        booleanResult(resultPayloadGPR, node, UseChildrenCalledExplicitly);
521
        booleanResult(resultPayloadGPR, node, UseChildrenCalledExplicitly);
Lines 3281-3292 void SpeculativeJIT::compile(Node* node) a/Source/JavaScriptCore/dfg/DFGSpeculativeJIT32_64.cpp_sec5
3281
                done.link(&m_jit);
3280
                done.link(&m_jit);
3282
            }
3281
            }
3283
            
3282
            
3284
            addSlowPathGenerator(adoptPtr(
3283
            addSlowPathGenerator(std::make_unique<CallArrayAllocatorWithVariableSizeSlowPathGenerator>(
3285
                new CallArrayAllocatorWithVariableSizeSlowPathGenerator(
3286
                    slowCases, this, operationNewArrayWithSize, resultGPR,
3284
                    slowCases, this, operationNewArrayWithSize, resultGPR,
3287
                    globalObject->arrayStructureForIndexingTypeDuringAllocation(node->indexingType()),
3285
                    globalObject->arrayStructureForIndexingTypeDuringAllocation(node->indexingType()),
3288
                    globalObject->arrayStructureForIndexingTypeDuringAllocation(ArrayWithArrayStorage),
3286
                    globalObject->arrayStructureForIndexingTypeDuringAllocation(ArrayWithArrayStorage),
3289
                    sizeGPR)));
3287
                    sizeGPR));
3290
            
3288
            
3291
            cellResult(resultGPR, node);
3289
            cellResult(resultGPR, node);
3292
            break;
3290
            break;
- a/Source/JavaScriptCore/dfg/DFGSpeculativeJIT64.cpp -14 / +10 lines
Lines 159-170 void SpeculativeJIT::cachedGetById(CodeOrigin codeOrigin, GPRReg baseGPR, GPRReg a/Source/JavaScriptCore/dfg/DFGSpeculativeJIT64.cpp_sec1
159
        slowCases.append(slowPathTarget);
159
        slowCases.append(slowPathTarget);
160
    slowCases.append(gen.slowPathJump());
160
    slowCases.append(gen.slowPathJump());
161
    
161
    
162
    OwnPtr<SlowPathGenerator> slowPath = slowPathCall(
162
    auto slowPath = slowPathCall(
163
        slowCases, this, operationGetByIdOptimize, resultGPR, gen.stubInfo(), baseGPR,
163
        slowCases, this, operationGetByIdOptimize, resultGPR, gen.stubInfo(), baseGPR,
164
        identifierUID(identifierNumber), spillMode);
164
        identifierUID(identifierNumber), spillMode);
165
    
165
    
166
    m_jit.addGetById(gen, slowPath.get());
166
    m_jit.addGetById(gen, slowPath.get());
167
    addSlowPathGenerator(slowPath.release());
167
    addSlowPathGenerator(WTF::move(slowPath));
168
}
168
}
169
169
170
void SpeculativeJIT::cachedPutById(CodeOrigin codeOrigin, GPRReg baseGPR, GPRReg valueGPR, GPRReg scratchGPR, unsigned identifierNumber, PutKind putKind, JITCompiler::Jump slowPathTarget, SpillRegistersMode spillMode)
170
void SpeculativeJIT::cachedPutById(CodeOrigin codeOrigin, GPRReg baseGPR, GPRReg valueGPR, GPRReg scratchGPR, unsigned identifierNumber, PutKind putKind, JITCompiler::Jump slowPathTarget, SpillRegistersMode spillMode)
Lines 180-191 void SpeculativeJIT::cachedPutById(CodeOrigin codeOrigin, GPRReg baseGPR, GPRReg a/Source/JavaScriptCore/dfg/DFGSpeculativeJIT64.cpp_sec2
180
        slowCases.append(slowPathTarget);
180
        slowCases.append(slowPathTarget);
181
    slowCases.append(gen.slowPathJump());
181
    slowCases.append(gen.slowPathJump());
182
    
182
    
183
    OwnPtr<SlowPathGenerator> slowPath = slowPathCall(
183
    auto slowPath = slowPathCall(
184
        slowCases, this, gen.slowPathFunction(), NoResult, gen.stubInfo(), valueGPR, baseGPR,
184
        slowCases, this, gen.slowPathFunction(), NoResult, gen.stubInfo(), valueGPR, baseGPR,
185
        identifierUID(identifierNumber));
185
        identifierUID(identifierNumber));
186
186
187
    m_jit.addPutById(gen, slowPath.get());
187
    m_jit.addPutById(gen, slowPath.get());
188
    addSlowPathGenerator(slowPath.release());
188
    addSlowPathGenerator(WTF::move(slowPath));
189
}
189
}
190
190
191
void SpeculativeJIT::nonSpeculativeNonPeepholeCompareNull(Edge operand, bool invert)
191
void SpeculativeJIT::nonSpeculativeNonPeepholeCompareNull(Edge operand, bool invert)
Lines 465-473 void SpeculativeJIT::nonSpeculativeNonPeepholeCompare(Node* node, MacroAssembler a/Source/JavaScriptCore/dfg/DFGSpeculativeJIT64.cpp_sec3
465
        m_jit.or32(TrustedImm32(ValueFalse), resultGPR);
465
        m_jit.or32(TrustedImm32(ValueFalse), resultGPR);
466
        
466
        
467
        if (!isKnownInteger(node->child1().node()) || !isKnownInteger(node->child2().node())) {
467
        if (!isKnownInteger(node->child1().node()) || !isKnownInteger(node->child2().node())) {
468
            addSlowPathGenerator(adoptPtr(
468
            addSlowPathGenerator(std::make_unique<CompareAndBoxBooleanSlowPathGenerator<JITCompiler::JumpList>>(
469
                new CompareAndBoxBooleanSlowPathGenerator<JITCompiler::JumpList>(
469
                slowPath, this, helperFunction, resultGPR, arg1GPR, arg2GPR));
470
                    slowPath, this, helperFunction, resultGPR, arg1GPR, arg2GPR)));
471
        }
470
        }
472
471
473
        jsValueResult(resultGPR, m_currentNode, DataFormatJSBoolean, UseChildrenCalledExplicitly);
472
        jsValueResult(resultGPR, m_currentNode, DataFormatJSBoolean, UseChildrenCalledExplicitly);
Lines 597-607 void SpeculativeJIT::nonSpeculativeNonPeepholeStrictEq(Node* node, bool invert) a/Source/JavaScriptCore/dfg/DFGSpeculativeJIT64.cpp_sec4
597
        
596
        
598
        m_jit.move(JITCompiler::TrustedImm64(JSValue::encode(jsBoolean(!invert))), resultGPR);
597
        m_jit.move(JITCompiler::TrustedImm64(JSValue::encode(jsBoolean(!invert))), resultGPR);
599
        
598
        
600
        addSlowPathGenerator(
599
        addSlowPathGenerator(std::make_unique<CompareAndBoxBooleanSlowPathGenerator<MacroAssembler::JumpList>>(
601
            adoptPtr(
602
                new CompareAndBoxBooleanSlowPathGenerator<MacroAssembler::JumpList>(
603
                    slowPathCases, this, operationCompareStrictEq, resultGPR, arg1GPR,
600
                    slowPathCases, this, operationCompareStrictEq, resultGPR, arg1GPR,
604
                    arg2GPR)));
601
                    arg2GPR));
605
        
602
        
606
        done.link(&m_jit);
603
        done.link(&m_jit);
607
    }
604
    }
Lines 3404-3415 void SpeculativeJIT::compile(Node* node) a/Source/JavaScriptCore/dfg/DFGSpeculativeJIT64.cpp_sec5
3404
                done.link(&m_jit);
3401
                done.link(&m_jit);
3405
            }
3402
            }
3406
            
3403
            
3407
            addSlowPathGenerator(adoptPtr(
3404
            addSlowPathGenerator(std::make_unique<CallArrayAllocatorWithVariableSizeSlowPathGenerator>(
3408
                new CallArrayAllocatorWithVariableSizeSlowPathGenerator(
3409
                    slowCases, this, operationNewArrayWithSize, resultGPR,
3405
                    slowCases, this, operationNewArrayWithSize, resultGPR,
3410
                    globalObject->arrayStructureForIndexingTypeDuringAllocation(node->indexingType()),
3406
                    globalObject->arrayStructureForIndexingTypeDuringAllocation(node->indexingType()),
3411
                    globalObject->arrayStructureForIndexingTypeDuringAllocation(ArrayWithArrayStorage),
3407
                    globalObject->arrayStructureForIndexingTypeDuringAllocation(ArrayWithArrayStorage),
3412
                    sizeGPR)));
3408
                    sizeGPR));
3413
            
3409
            
3414
            cellResult(resultGPR, node);
3410
            cellResult(resultGPR, node);
3415
            break;
3411
            break;

Return to Bug 138489