- Source/JavaScriptCore/ChangeLog +56 lines
Lines 1-3 Source/JavaScriptCore/ChangeLog_sec1
1
2013-12-08  Filip Pizlo  <fpizlo@apple.com>
2
3
        FTL should support UntypedUse versions of Compare nodes
4
        https://bugs.webkit.org/show_bug.cgi?id=125426
5
6
        Reviewed by NOBODY (OOPS!).
7
        
8
        This adds UntypedUse versions of all comparisons except CompareStrictEq, which is
9
        sufficiently different that I thought I'd do it in another patch.
10
        
11
        This also extends our ability to abstract over comparison kind and removes a bunch of
12
        copy-paste code.
13
14
        * dfg/DFGSpeculativeJIT64.cpp:
15
        (JSC::DFG::SpeculativeJIT::nonSpeculativeNonPeepholeCompare):
16
        * ftl/FTLCapabilities.cpp:
17
        (JSC::FTL::canCompile):
18
        * ftl/FTLIntrinsicRepository.h:
19
        * ftl/FTLLowerDFGToLLVM.cpp:
20
        (JSC::FTL::LowerDFGToLLVM::compileCompareEq):
21
        (JSC::FTL::LowerDFGToLLVM::compileCompareLess):
22
        (JSC::FTL::LowerDFGToLLVM::compileCompareLessEq):
23
        (JSC::FTL::LowerDFGToLLVM::compileCompareGreater):
24
        (JSC::FTL::LowerDFGToLLVM::compileCompareGreaterEq):
25
        (JSC::FTL::LowerDFGToLLVM::compare):
26
        (JSC::FTL::LowerDFGToLLVM::nonSpeculativeCompare):
27
        * ftl/FTLOutput.h:
28
        (JSC::FTL::Output::icmp):
29
        (JSC::FTL::Output::equal):
30
        (JSC::FTL::Output::notEqual):
31
        (JSC::FTL::Output::above):
32
        (JSC::FTL::Output::aboveOrEqual):
33
        (JSC::FTL::Output::below):
34
        (JSC::FTL::Output::belowOrEqual):
35
        (JSC::FTL::Output::greaterThan):
36
        (JSC::FTL::Output::greaterThanOrEqual):
37
        (JSC::FTL::Output::lessThan):
38
        (JSC::FTL::Output::lessThanOrEqual):
39
        (JSC::FTL::Output::fcmp):
40
        (JSC::FTL::Output::doubleEqual):
41
        (JSC::FTL::Output::doubleNotEqualOrUnordered):
42
        (JSC::FTL::Output::doubleLessThan):
43
        (JSC::FTL::Output::doubleLessThanOrEqual):
44
        (JSC::FTL::Output::doubleGreaterThan):
45
        (JSC::FTL::Output::doubleGreaterThanOrEqual):
46
        (JSC::FTL::Output::doubleEqualOrUnordered):
47
        (JSC::FTL::Output::doubleNotEqual):
48
        (JSC::FTL::Output::doubleLessThanOrUnordered):
49
        (JSC::FTL::Output::doubleLessThanOrEqualOrUnordered):
50
        (JSC::FTL::Output::doubleGreaterThanOrUnordered):
51
        (JSC::FTL::Output::doubleGreaterThanOrEqualOrUnordered):
52
        * tests/stress/untyped-equality.js: Added.
53
        (foo):
54
        * tests/stress/untyped-less-than.js: Added.
55
        (foo):
56
1
2013-12-07  Filip Pizlo  <fpizlo@apple.com>
57
2013-12-07  Filip Pizlo  <fpizlo@apple.com>
2
58
3
        Fold typedArray.length if typedArray is constant
59
        Fold typedArray.length if typedArray is constant
- Source/JavaScriptCore/dfg/DFGSpeculativeJIT64.cpp +1 lines
Lines 486-491 private: Source/JavaScriptCore/dfg/DFGSpeculativeJIT64.cpp_sec1
486
486
487
void SpeculativeJIT::nonSpeculativeNonPeepholeCompare(Node* node, MacroAssembler::RelationalCondition cond, S_JITOperation_EJJ helperFunction)
487
void SpeculativeJIT::nonSpeculativeNonPeepholeCompare(Node* node, MacroAssembler::RelationalCondition cond, S_JITOperation_EJJ helperFunction)
488
{
488
{
489
    ASSERT(node->isBinaryUseKind(UntypedUse));
489
    JSValueOperand arg1(this, node->child1());
490
    JSValueOperand arg1(this, node->child1());
490
    JSValueOperand arg2(this, node->child2());
491
    JSValueOperand arg2(this, node->child2());
491
    GPRReg arg1GPR = arg1.gpr();
492
    GPRReg arg1GPR = arg1.gpr();
- Source/JavaScriptCore/ftl/FTLCapabilities.cpp +13 lines
Lines 179-184 inline CapabilityLevel canCompile(Node* Source/JavaScriptCore/ftl/FTLCapabilities.cpp_sec1
179
        }
179
        }
180
        break;
180
        break;
181
    case CompareEq:
181
    case CompareEq:
182
        if (node->isBinaryUseKind(Int32Use))
183
            break;
184
        if (node->isBinaryUseKind(MachineIntUse))
185
            break;
186
        if (node->isBinaryUseKind(NumberUse))
187
            break;
188
        if (node->isBinaryUseKind(ObjectUse))
189
            break;
190
        if (node->isBinaryUseKind(UntypedUse))
191
            break;
192
        return CannotCompile;
182
    case CompareStrictEq:
193
    case CompareStrictEq:
183
        if (node->isBinaryUseKind(Int32Use))
194
        if (node->isBinaryUseKind(Int32Use))
184
            break;
195
            break;
Lines 199-204 inline CapabilityLevel canCompile(Node* Source/JavaScriptCore/ftl/FTLCapabilities.cpp_sec2
199
            break;
210
            break;
200
        if (node->isBinaryUseKind(NumberUse))
211
        if (node->isBinaryUseKind(NumberUse))
201
            break;
212
            break;
213
        if (node->isBinaryUseKind(UntypedUse))
214
            break;
202
        return CannotCompile;
215
        return CannotCompile;
203
    case Switch:
216
    case Switch:
204
        switch (node->switchData()->kind) {
217
        switch (node->switchData()->kind) {
- Source/JavaScriptCore/ftl/FTLIntrinsicRepository.h +1 lines
Lines 67-72 namespace JSC { namespace FTL { Source/JavaScriptCore/ftl/FTLIntrinsicRepository.h_sec1
67
    macro(P_JITOperation_EStSS, functionType(intPtr, intPtr, intPtr, intPtr, intPtr)) \
67
    macro(P_JITOperation_EStSS, functionType(intPtr, intPtr, intPtr, intPtr, intPtr)) \
68
    macro(P_JITOperation_EStZ, functionType(intPtr, intPtr, intPtr, int32)) \
68
    macro(P_JITOperation_EStZ, functionType(intPtr, intPtr, intPtr, int32)) \
69
    macro(S_JITOperation_EJ, functionType(intPtr, intPtr, int64)) \
69
    macro(S_JITOperation_EJ, functionType(intPtr, intPtr, int64)) \
70
    macro(S_JITOperation_EJJ, functionType(intPtr, intPtr, int64, int64)) \
70
    macro(V_JITOperation_EJJJ, functionType(voidType, intPtr, int64, int64, int64)) \
71
    macro(V_JITOperation_EJJJ, functionType(voidType, intPtr, int64, int64, int64)) \
71
    macro(V_JITOperation_EOZD, functionType(voidType, intPtr, intPtr, int32, doubleType)) \
72
    macro(V_JITOperation_EOZD, functionType(voidType, intPtr, intPtr, int32, doubleType)) \
72
    macro(V_JITOperation_EOZJ, functionType(voidType, intPtr, intPtr, int32, int64)) \
73
    macro(V_JITOperation_EOZJ, functionType(voidType, intPtr, intPtr, int32, int64)) \
- Source/JavaScriptCore/ftl/FTLLowerDFGToLLVM.cpp -88 / +72 lines
Lines 2396-2401 private: Source/JavaScriptCore/ftl/FTLLowerDFGToLLVM.cpp_sec1
2396
            return;
2396
            return;
2397
        }
2397
        }
2398
        
2398
        
2399
        if (m_node->isBinaryUseKind(UntypedUse)) {
2400
            nonSpeculativeCompare(LLVMIntEQ, operationCompareEq);
2401
            return;
2402
        }
2403
        
2399
        RELEASE_ASSERT_NOT_REACHED();
2404
        RELEASE_ASSERT_NOT_REACHED();
2400
    }
2405
    }
2401
    
2406
    
Lines 2464-2569 private: Source/JavaScriptCore/ftl/FTLLowerDFGToLLVM.cpp_sec2
2464
    
2469
    
2465
    void compileCompareLess()
2470
    void compileCompareLess()
2466
    {
2471
    {
2467
        if (m_node->isBinaryUseKind(Int32Use)) {
2472
        compare(LLVMIntSLT, LLVMRealOLT, operationCompareLess);
2468
            setBoolean(
2469
                m_out.lessThan(lowInt32(m_node->child1()), lowInt32(m_node->child2())));
2470
            return;
2471
        }
2472
        
2473
        if (m_node->isBinaryUseKind(MachineIntUse)) {
2474
            Int52Kind kind;
2475
            LValue left = lowWhicheverInt52(m_node->child1(), kind);
2476
            LValue right = lowInt52(m_node->child2(), kind);
2477
            setBoolean(m_out.lessThan(left, right));
2478
            return;
2479
        }
2480
        
2481
        if (m_node->isBinaryUseKind(NumberUse)) {
2482
            setBoolean(
2483
                m_out.doubleLessThan(lowDouble(m_node->child1()), lowDouble(m_node->child2())));
2484
            return;
2485
        }
2486
        
2487
        RELEASE_ASSERT_NOT_REACHED();
2488
    }
2473
    }
2489
    
2474
    
2490
    void compileCompareLessEq()
2475
    void compileCompareLessEq()
2491
    {
2476
    {
2492
        if (m_node->isBinaryUseKind(Int32Use)) {
2477
        compare(LLVMIntSLE, LLVMRealOLE, operationCompareLessEq);
2493
            setBoolean(
2494
                m_out.lessThanOrEqual(lowInt32(m_node->child1()), lowInt32(m_node->child2())));
2495
            return;
2496
        }
2497
        
2498
        if (m_node->isBinaryUseKind(MachineIntUse)) {
2499
            Int52Kind kind;
2500
            LValue left = lowWhicheverInt52(m_node->child1(), kind);
2501
            LValue right = lowInt52(m_node->child2(), kind);
2502
            setBoolean(m_out.lessThanOrEqual(left, right));
2503
            return;
2504
        }
2505
        
2506
        if (m_node->isBinaryUseKind(NumberUse)) {
2507
            setBoolean(
2508
                m_out.doubleLessThanOrEqual(
2509
                    lowDouble(m_node->child1()), lowDouble(m_node->child2())));
2510
            return;
2511
        }
2512
        
2513
        RELEASE_ASSERT_NOT_REACHED();
2514
    }
2478
    }
2515
    
2479
    
2516
    void compileCompareGreater()
2480
    void compileCompareGreater()
2517
    {
2481
    {
2518
        if (m_node->isBinaryUseKind(Int32Use)) {
2482
        compare(LLVMIntSGT, LLVMRealOGT, operationCompareGreater);
2519
            setBoolean(
2520
                m_out.greaterThan(lowInt32(m_node->child1()), lowInt32(m_node->child2())));
2521
            return;
2522
        }
2523
        
2524
        if (m_node->isBinaryUseKind(MachineIntUse)) {
2525
            Int52Kind kind;
2526
            LValue left = lowWhicheverInt52(m_node->child1(), kind);
2527
            LValue right = lowInt52(m_node->child2(), kind);
2528
            setBoolean(m_out.greaterThan(left, right));
2529
            return;
2530
        }
2531
        
2532
        if (m_node->isBinaryUseKind(NumberUse)) {
2533
            setBoolean(
2534
                m_out.doubleGreaterThan(
2535
                    lowDouble(m_node->child1()), lowDouble(m_node->child2())));
2536
            return;
2537
        }
2538
        
2539
        RELEASE_ASSERT_NOT_REACHED();
2540
    }
2483
    }
2541
    
2484
    
2542
    void compileCompareGreaterEq()
2485
    void compileCompareGreaterEq()
2543
    {
2486
    {
2544
        if (m_node->isBinaryUseKind(Int32Use)) {
2487
        compare(LLVMIntSGE, LLVMRealOGE, operationCompareGreaterEq);
2545
            setBoolean(
2546
                m_out.greaterThanOrEqual(
2547
                    lowInt32(m_node->child1()), lowInt32(m_node->child2())));
2548
            return;
2549
        }
2550
        
2551
        if (m_node->isBinaryUseKind(MachineIntUse)) {
2552
            Int52Kind kind;
2553
            LValue left = lowWhicheverInt52(m_node->child1(), kind);
2554
            LValue right = lowInt52(m_node->child2(), kind);
2555
            setBoolean(m_out.greaterThanOrEqual(left, right));
2556
            return;
2557
        }
2558
        
2559
        if (m_node->isBinaryUseKind(NumberUse)) {
2560
            setBoolean(
2561
                m_out.doubleGreaterThanOrEqual(
2562
                    lowDouble(m_node->child1()), lowDouble(m_node->child2())));
2563
            return;
2564
        }
2565
        
2566
        RELEASE_ASSERT_NOT_REACHED();
2567
    }
2488
    }
2568
    
2489
    
2569
    void compileLogicalNot()
2490
    void compileLogicalNot()
Lines 2800-2805 private: Source/JavaScriptCore/ftl/FTLLowerDFGToLLVM.cpp_sec3
2800
            m_state.forNode(edge).m_value);
2721
            m_state.forNode(edge).m_value);
2801
    }
2722
    }
2802
    
2723
    
2724
    void compare(
2725
        LIntPredicate intCondition, LRealPredicate realCondition,
2726
        S_JITOperation_EJJ helperFunction)
2727
    {
2728
        if (m_node->isBinaryUseKind(Int32Use)) {
2729
            LValue left = lowInt32(m_node->child1());
2730
            LValue right = lowInt32(m_node->child2());
2731
            setBoolean(m_out.icmp(intCondition, left, right));
2732
            return;
2733
        }
2734
        
2735
        if (m_node->isBinaryUseKind(MachineIntUse)) {
2736
            Int52Kind kind;
2737
            LValue left = lowWhicheverInt52(m_node->child1(), kind);
2738
            LValue right = lowInt52(m_node->child2(), kind);
2739
            setBoolean(m_out.icmp(intCondition, left, right));
2740
            return;
2741
        }
2742
        
2743
        if (m_node->isBinaryUseKind(NumberUse)) {
2744
            LValue left = lowDouble(m_node->child1());
2745
            LValue right = lowDouble(m_node->child2());
2746
            setBoolean(m_out.fcmp(realCondition, left, right));
2747
            return;
2748
        }
2749
        
2750
        if (m_node->isBinaryUseKind(UntypedUse)) {
2751
            nonSpeculativeCompare(intCondition, helperFunction);
2752
            return;
2753
        }
2754
        
2755
        RELEASE_ASSERT_NOT_REACHED();
2756
    }
2757
    
2758
    void nonSpeculativeCompare(LIntPredicate intCondition, S_JITOperation_EJJ helperFunction)
2759
    {
2760
        LValue left = lowJSValue(m_node->child1());
2761
        LValue right = lowJSValue(m_node->child2());
2762
        
2763
        LBasicBlock leftIsInt = FTL_NEW_BLOCK(m_out, ("CompareEq untyped left is int"));
2764
        LBasicBlock fastPath = FTL_NEW_BLOCK(m_out, ("CompareEq untyped fast path"));
2765
        LBasicBlock slowPath = FTL_NEW_BLOCK(m_out, ("CompareEq untyped slow path"));
2766
        LBasicBlock continuation = FTL_NEW_BLOCK(m_out, ("CompareEq untyped continuation"));
2767
        
2768
        m_out.branch(isNotInt32(left), slowPath, leftIsInt);
2769
        
2770
        LBasicBlock lastNext = m_out.appendTo(leftIsInt, fastPath);
2771
        m_out.branch(isNotInt32(right), slowPath, fastPath);
2772
        
2773
        m_out.appendTo(fastPath, slowPath);
2774
        ValueFromBlock fastResult = m_out.anchor(
2775
            m_out.icmp(intCondition, unboxInt32(left), unboxInt32(right)));
2776
        m_out.jump(continuation);
2777
        
2778
        m_out.appendTo(slowPath, continuation);
2779
        ValueFromBlock slowResult = m_out.anchor(m_out.notNull(vmCall(
2780
            m_out.operation(helperFunction), m_callFrame, left, right)));
2781
        m_out.jump(continuation);
2782
        
2783
        m_out.appendTo(continuation, lastNext);
2784
        setBoolean(m_out.phi(m_out.boolean, fastResult, slowResult));
2785
    }
2786
    
2803
    LValue allocateCell(LValue allocator, LValue structure, LBasicBlock slowPath)
2787
    LValue allocateCell(LValue allocator, LValue structure, LBasicBlock slowPath)
2804
    {
2788
    {
2805
        LBasicBlock success = FTL_NEW_BLOCK(m_out, ("object allocation success"));
2789
        LBasicBlock success = FTL_NEW_BLOCK(m_out, ("object allocation success"));
- Source/JavaScriptCore/ftl/FTLOutput.h -23 / +25 lines
Lines 314-342 public: Source/JavaScriptCore/ftl/FTLOutput.h_sec1
314
    void storePtr(LValue value, LValue base, const AbstractField& field) { storePtr(value, address(base, field)); }
314
    void storePtr(LValue value, LValue base, const AbstractField& field) { storePtr(value, address(base, field)); }
315
    void storeDouble(LValue value, LValue base, const AbstractField& field) { storeDouble(value, address(base, field)); }
315
    void storeDouble(LValue value, LValue base, const AbstractField& field) { storeDouble(value, address(base, field)); }
316
    
316
    
317
    LValue equal(LValue left, LValue right) { return buildICmp(m_builder, LLVMIntEQ, left, right); }
317
    LValue icmp(LIntPredicate cond, LValue left, LValue right) { return buildICmp(m_builder, cond, left, right); }
318
    LValue notEqual(LValue left, LValue right) { return buildICmp(m_builder, LLVMIntNE, left, right); }
318
    LValue equal(LValue left, LValue right) { return icmp(LLVMIntEQ, left, right); }
319
    LValue above(LValue left, LValue right) { return buildICmp(m_builder, LLVMIntUGT, left, right); }
319
    LValue notEqual(LValue left, LValue right) { return icmp(LLVMIntNE, left, right); }
320
    LValue aboveOrEqual(LValue left, LValue right) { return buildICmp(m_builder, LLVMIntUGE, left, right); }
320
    LValue above(LValue left, LValue right) { return icmp(LLVMIntUGT, left, right); }
321
    LValue below(LValue left, LValue right) { return buildICmp(m_builder, LLVMIntULT, left, right); }
321
    LValue aboveOrEqual(LValue left, LValue right) { return icmp(LLVMIntUGE, left, right); }
322
    LValue belowOrEqual(LValue left, LValue right) { return buildICmp(m_builder, LLVMIntULE, left, right); }
322
    LValue below(LValue left, LValue right) { return icmp(LLVMIntULT, left, right); }
323
    LValue greaterThan(LValue left, LValue right) { return buildICmp(m_builder, LLVMIntSGT, left, right); }
323
    LValue belowOrEqual(LValue left, LValue right) { return icmp(LLVMIntULE, left, right); }
324
    LValue greaterThanOrEqual(LValue left, LValue right) { return buildICmp(m_builder, LLVMIntSGE, left, right); }
324
    LValue greaterThan(LValue left, LValue right) { return icmp(LLVMIntSGT, left, right); }
325
    LValue lessThan(LValue left, LValue right) { return buildICmp(m_builder, LLVMIntSLT, left, right); }
325
    LValue greaterThanOrEqual(LValue left, LValue right) { return icmp(LLVMIntSGE, left, right); }
326
    LValue lessThanOrEqual(LValue left, LValue right) { return buildICmp(m_builder, LLVMIntSLE, left, right); }
326
    LValue lessThan(LValue left, LValue right) { return icmp(LLVMIntSLT, left, right); }
327
    
327
    LValue lessThanOrEqual(LValue left, LValue right) { return icmp(LLVMIntSLE, left, right); }
328
    LValue doubleEqual(LValue left, LValue right) { return buildFCmp(m_builder, LLVMRealOEQ, left, right); }
328
    
329
    LValue doubleNotEqualOrUnordered(LValue left, LValue right) { return buildFCmp(m_builder, LLVMRealUNE, left, right); }
329
    LValue fcmp(LRealPredicate cond, LValue left, LValue right) { return buildFCmp(m_builder, cond, left, right); }
330
    LValue doubleLessThan(LValue left, LValue right) { return buildFCmp(m_builder, LLVMRealOLT, left, right); }
330
    LValue doubleEqual(LValue left, LValue right) { return fcmp(LLVMRealOEQ, left, right); }
331
    LValue doubleLessThanOrEqual(LValue left, LValue right) { return buildFCmp(m_builder, LLVMRealOLE, left, right); }
331
    LValue doubleNotEqualOrUnordered(LValue left, LValue right) { return fcmp(LLVMRealUNE, left, right); }
332
    LValue doubleGreaterThan(LValue left, LValue right) { return buildFCmp(m_builder, LLVMRealOGT, left, right); }
332
    LValue doubleLessThan(LValue left, LValue right) { return fcmp(LLVMRealOLT, left, right); }
333
    LValue doubleGreaterThanOrEqual(LValue left, LValue right) { return buildFCmp(m_builder, LLVMRealOGE, left, right); }
333
    LValue doubleLessThanOrEqual(LValue left, LValue right) { return fcmp(LLVMRealOLE, left, right); }
334
    LValue doubleEqualOrUnordered(LValue left, LValue right) { return buildFCmp(m_builder, LLVMRealUEQ, left, right); }
334
    LValue doubleGreaterThan(LValue left, LValue right) { return fcmp(LLVMRealOGT, left, right); }
335
    LValue doubleNotEqual(LValue left, LValue right) { return buildFCmp(m_builder, LLVMRealONE, left, right); }
335
    LValue doubleGreaterThanOrEqual(LValue left, LValue right) { return fcmp(LLVMRealOGE, left, right); }
336
    LValue doubleLessThanOrUnordered(LValue left, LValue right) { return buildFCmp(m_builder, LLVMRealULT, left, right); }
336
    LValue doubleEqualOrUnordered(LValue left, LValue right) { return fcmp(LLVMRealUEQ, left, right); }
337
    LValue doubleLessThanOrEqualOrUnordered(LValue left, LValue right) { return buildFCmp(m_builder, LLVMRealULE, left, right); }
337
    LValue doubleNotEqual(LValue left, LValue right) { return fcmp(LLVMRealONE, left, right); }
338
    LValue doubleGreaterThanOrUnordered(LValue left, LValue right) { return buildFCmp(m_builder, LLVMRealUGT, left, right); }
338
    LValue doubleLessThanOrUnordered(LValue left, LValue right) { return fcmp(LLVMRealULT, left, right); }
339
    LValue doubleGreaterThanOrEqualOrUnordered(LValue left, LValue right) { return buildFCmp(m_builder, LLVMRealUGE, left, right); }
339
    LValue doubleLessThanOrEqualOrUnordered(LValue left, LValue right) { return fcmp(LLVMRealULE, left, right); }
340
    LValue doubleGreaterThanOrUnordered(LValue left, LValue right) { return fcmp(LLVMRealUGT, left, right); }
341
    LValue doubleGreaterThanOrEqualOrUnordered(LValue left, LValue right) { return fcmp(LLVMRealUGE, left, right); }
340
    
342
    
341
    LValue isZero8(LValue value) { return equal(value, int8Zero); }
343
    LValue isZero8(LValue value) { return equal(value, int8Zero); }
342
    LValue notZero8(LValue value) { return notEqual(value, int8Zero); }
344
    LValue notZero8(LValue value) { return notEqual(value, int8Zero); }
- Source/JavaScriptCore/tests/stress/untyped-equality.js +20 lines
Line 0 Source/JavaScriptCore/tests/stress/untyped-equality.js_sec1
1
function foo(a, b) {
2
    return a == b;
3
}
4
5
noInline(foo);
6
7
var data = [
8
    [5, 6.5, false],
9
    ["foo", "bar", false],
10
    [true, false, false],
11
    ["42", 42, true],
12
    [1.2, 1.2, true]
13
];
14
15
for (var i = 0; i < 100000; ++i) {
16
    var test = data[i % data.length];
17
    var result = foo(test[0], test[1]);
18
    if (result != test[2])
19
        throw "Error: bad result for " + test + ": " + result;
20
}
- Source/JavaScriptCore/tests/stress/untyped-less-than.js +23 lines
Line 0 Source/JavaScriptCore/tests/stress/untyped-less-than.js_sec1
1
function foo(a, b) {
2
    return a < b;
3
}
4
5
noInline(foo);
6
7
var data = [
8
    [5, 6.5, true],
9
    ["foo", "bar", false],
10
    [true, false, false],
11
    [false, true, true],
12
    ["42", 42, false],
13
    [1.2, 1.2, false],
14
    ["-1", 1, true],
15
    [-1, "1", true]
16
];
17
18
for (var i = 0; i < 100000; ++i) {
19
    var test = data[i % data.length];
20
    var result = foo(test[0], test[1]);
21
    if (result != test[2])
22
        throw "Error: bad result for " + test + ": " + result;
23
}

Return to Bug 125426