- Source/JavaScriptCore/ChangeLog +31 lines
Lines 1-3 Source/JavaScriptCore/ChangeLog_sec1
1
2016-01-04  Filip Pizlo  <fpizlo@apple.com>
2
3
        FTL B3 should do all of the non-bitop binary snippets
4
        https://bugs.webkit.org/show_bug.cgi?id=152709
5
6
        Reviewed by NOBODY (OOPS!).
7
8
        * ftl/FTLLowerDFGToLLVM.cpp:
9
        (JSC::FTL::DFG::LowerDFGToLLVM::compileValueAdd):
10
        (JSC::FTL::DFG::LowerDFGToLLVM::compileStrCat):
11
        (JSC::FTL::DFG::LowerDFGToLLVM::compileArithMul):
12
        (JSC::FTL::DFG::LowerDFGToLLVM::compileArithDiv):
13
        * tests/stress/object-add.js: Added.
14
        (foo):
15
        (things.valueOf):
16
        * tests/stress/object-div.js: Added.
17
        (foo):
18
        (things.valueOf):
19
        * tests/stress/object-mul.js: Added.
20
        (foo):
21
        (things.valueOf):
22
        * tests/stress/untyped-add.js: Added.
23
        (foo):
24
        (valueOf):
25
        * tests/stress/untyped-div.js: Added.
26
        (foo):
27
        (valueOf):
28
        * tests/stress/untyped-mul.js: Added.
29
        (foo):
30
        (valueOf):
31
1
2016-01-04  Filip Pizlo  <fpizlo@apple.com>
32
2016-01-04  Filip Pizlo  <fpizlo@apple.com>
2
33
3
        FTL B3 should do the ArithSub binary snippet
34
        FTL B3 should do the ArithSub binary snippet
- Source/JavaScriptCore/ftl/FTLLowerDFGToLLVM.cpp +15 lines
Lines 51-56 Source/JavaScriptCore/ftl/FTLLowerDFGToLLVM.cpp_sec1
51
#include "FTLOutput.h"
51
#include "FTLOutput.h"
52
#include "FTLThunks.h"
52
#include "FTLThunks.h"
53
#include "FTLWeightedTarget.h"
53
#include "FTLWeightedTarget.h"
54
#include "JITAddGenerator.h"
55
#include "JITDivGenerator.h"
56
#include "JITMulGenerator.h"
54
#include "JITSubGenerator.h"
57
#include "JITSubGenerator.h"
55
#include "JSArrowFunction.h"
58
#include "JSArrowFunction.h"
56
#include "JSCInlines.h"
59
#include "JSCInlines.h"
Lines 1596-1602 private: Source/JavaScriptCore/ftl/FTLLowerDFGToLLVM.cpp_sec2
1596
    
1599
    
1597
    void compileValueAdd()
1600
    void compileValueAdd()
1598
    {
1601
    {
1602
#if FTL_USES_B3
1603
        emitBinarySnippet<JITAddGenerator>(operationValueAdd);
1604
#else // FTL_USES_B3
1599
        compileUntypedBinaryOp<ValueAddDescriptor>();
1605
        compileUntypedBinaryOp<ValueAddDescriptor>();
1606
#endif // FTL_USES_B3
1600
    }
1607
    }
1601
    
1608
    
1602
    void compileStrCat()
1609
    void compileStrCat()
Lines 1845-1851 private: Source/JavaScriptCore/ftl/FTLLowerDFGToLLVM.cpp_sec3
1845
        }
1852
        }
1846
1853
1847
        case UntypedUse: {
1854
        case UntypedUse: {
1855
#if FTL_USES_B3
1856
            emitBinarySnippet<JITMulGenerator>(operationValueMul);
1857
#else // FTL_USES_B3
1848
            compileUntypedBinaryOp<ArithMulDescriptor>();
1858
            compileUntypedBinaryOp<ArithMulDescriptor>();
1859
#endif // FTL_USES_B3
1849
            break;
1860
            break;
1850
        }
1861
        }
1851
1862
Lines 1914-1920 private: Source/JavaScriptCore/ftl/FTLLowerDFGToLLVM.cpp_sec4
1914
        }
1925
        }
1915
1926
1916
        case UntypedUse: {
1927
        case UntypedUse: {
1928
#if FTL_USES_B3
1929
            emitBinarySnippet<JITDivGenerator, NeedScratchFPR>(operationValueDiv);
1930
#else // FTL_USES_B3
1917
            compileUntypedBinaryOp<ArithDivDescriptor, HasConstInt32OperandOptimization, HasConstDoubleOperandOptimization>();
1931
            compileUntypedBinaryOp<ArithDivDescriptor, HasConstInt32OperandOptimization, HasConstDoubleOperandOptimization>();
1932
#endif // FTL_USES_B3
1918
            break;
1933
            break;
1919
        }
1934
        }
1920
1935
- Source/JavaScriptCore/tests/stress/object-add.js +16 lines
Line 0 Source/JavaScriptCore/tests/stress/object-add.js_sec1
1
function foo(a, b) {
2
    return a + b;
3
}
4
5
noInline(foo);
6
7
var things = [{valueOf: function() { return 4; }}];
8
var results = [5];
9
10
for (var i = 0; i < 100000; ++i) {
11
    var result = foo(things[i % things.length], 1);
12
    var expected = results[i % results.length];
13
    if (result != expected)
14
        throw "Error: bad result for i = " + i + ": " + result;
15
}
16
- Source/JavaScriptCore/tests/stress/object-div.js +16 lines
Line 0 Source/JavaScriptCore/tests/stress/object-div.js_sec1
1
function foo(a, b) {
2
    return a / b;
3
}
4
5
noInline(foo);
6
7
var things = [{valueOf: function() { return 4; }}];
8
var results = [2];
9
10
for (var i = 0; i < 100000; ++i) {
11
    var result = foo(things[i % things.length], 2);
12
    var expected = results[i % results.length];
13
    if (result != expected)
14
        throw "Error: bad result for i = " + i + ": " + result;
15
}
16
- Source/JavaScriptCore/tests/stress/object-mul.js +16 lines
Line 0 Source/JavaScriptCore/tests/stress/object-mul.js_sec1
1
function foo(a, b) {
2
    return a * b;
3
}
4
5
noInline(foo);
6
7
var things = [{valueOf: function() { return 4; }}];
8
var results = [8];
9
10
for (var i = 0; i < 100000; ++i) {
11
    var result = foo(things[i % things.length], 2);
12
    var expected = results[i % results.length];
13
    if (result != expected)
14
        throw "Error: bad result for i = " + i + ": " + result;
15
}
16
- Source/JavaScriptCore/tests/stress/untyped-add.js +16 lines
Line 0 Source/JavaScriptCore/tests/stress/untyped-add.js_sec1
1
function foo(a, b) {
2
    return a + b;
3
}
4
5
noInline(foo);
6
7
var things = [1, 2.5, "3", {valueOf: function() { return 4; }}];
8
var results = [2, 3.5, "31", 5];
9
10
for (var i = 0; i < 100000; ++i) {
11
    var result = foo(things[i % things.length], 1);
12
    var expected = results[i % results.length];
13
    if (result != expected)
14
        throw "Error: bad result for i = " + i + ": " + result;
15
}
16
- Source/JavaScriptCore/tests/stress/untyped-div.js +16 lines
Line 0 Source/JavaScriptCore/tests/stress/untyped-div.js_sec1
1
function foo(a, b) {
2
    return a / b;
3
}
4
5
noInline(foo);
6
7
var things = [1, 2.5, "3", {valueOf: function() { return 4; }}];
8
var results = [0.5, 1.25, 1.5, 2];
9
10
for (var i = 0; i < 100000; ++i) {
11
    var result = foo(things[i % things.length], 2);
12
    var expected = results[i % results.length];
13
    if (result != expected)
14
        throw "Error: bad result for i = " + i + ": " + result;
15
}
16
- Source/JavaScriptCore/tests/stress/untyped-mul.js +16 lines
Line 0 Source/JavaScriptCore/tests/stress/untyped-mul.js_sec1
1
function foo(a, b) {
2
    return a * b;
3
}
4
5
noInline(foo);
6
7
var things = [1, 2.5, "3", {valueOf: function() { return 4; }}];
8
var results = [2, 5, 6, 8];
9
10
for (var i = 0; i < 100000; ++i) {
11
    var result = foo(things[i % things.length], 2);
12
    var expected = results[i % results.length];
13
    if (result != expected)
14
        throw "Error: bad result for i = " + i + ": " + result;
15
}
16

Return to Bug 152709