OLD | NEW |
1 // Copyright 2015 the V8 project authors. All rights reserved. | 1 // Copyright 2015 the V8 project authors. All rights reserved. |
2 // Use of this source code is governed by a BSD-style license that can be | 2 // Use of this source code is governed by a BSD-style license that can be |
3 // found in the LICENSE file. | 3 // found in the LICENSE file. |
4 | 4 |
5 #include "src/v8.h" | 5 #include "src/v8.h" |
6 | 6 |
7 #include "src/ast.h" | 7 #include "src/ast.h" |
8 #include "src/ast-expression-visitor.h" | 8 #include "src/ast-expression-visitor.h" |
9 #include "src/parser.h" | 9 #include "src/parser.h" |
10 #include "src/rewriter.h" | 10 #include "src/rewriter.h" |
(...skipping 909 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
920 CHECK_EXPR(Literal, Bounds(cache.kInt32)); | 920 CHECK_EXPR(Literal, Bounds(cache.kInt32)); |
921 } | 921 } |
922 } | 922 } |
923 } | 923 } |
924 CHECK_SKIP(); | 924 CHECK_SKIP(); |
925 } | 925 } |
926 CHECK_FUNC_TYPES_END | 926 CHECK_FUNC_TYPES_END |
927 } | 927 } |
928 | 928 |
929 | 929 |
| 930 TEST(Load1Constant) { |
| 931 CHECK_FUNC_TYPES_BEGIN( |
| 932 "function bar() { var x = 1; var y = i8[5]|0; }\n" |
| 933 "function foo() { bar(); }") { |
| 934 CHECK_EXPR(FunctionLiteral, FUNC_V_TYPE) { |
| 935 CHECK_EXPR(Assignment, Bounds(cache.kInt32)) { |
| 936 CHECK_VAR(x, Bounds(cache.kInt32)); |
| 937 CHECK_EXPR(Literal, Bounds(cache.kInt32)); |
| 938 } |
| 939 CHECK_EXPR(Assignment, Bounds(cache.kInt32)) { |
| 940 CHECK_VAR(y, Bounds(cache.kInt32)); |
| 941 CHECK_EXPR(BinaryOperation, Bounds(cache.kInt32)) { |
| 942 CHECK_EXPR(Property, Bounds(cache.kInt8)) { |
| 943 CHECK_VAR(i8, Bounds(cache.kInt8Array)); |
| 944 CHECK_EXPR(Literal, Bounds(cache.kInt32)); |
| 945 } |
| 946 CHECK_EXPR(Literal, Bounds(cache.kInt32)); |
| 947 } |
| 948 } |
| 949 } |
| 950 CHECK_SKIP(); |
| 951 } |
| 952 CHECK_FUNC_TYPES_END |
| 953 } |
| 954 |
| 955 |
930 TEST(FunctionTables) { | 956 TEST(FunctionTables) { |
931 CHECK_FUNC_TYPES_BEGIN( | 957 CHECK_FUNC_TYPES_BEGIN( |
932 "function func1(x) { x = x | 0; return (x * 5) | 0; }\n" | 958 "function func1(x) { x = x | 0; return (x * 5) | 0; }\n" |
933 "function func2(x) { x = x | 0; return (x * 25) | 0; }\n" | 959 "function func2(x) { x = x | 0; return (x * 25) | 0; }\n" |
934 "var table1 = [func1, func2];\n" | 960 "var table1 = [func1, func2];\n" |
935 "function bar(x, y) { x = x | 0; y = y | 0;\n" | 961 "function bar(x, y) { x = x | 0; y = y | 0;\n" |
936 " return table1[x & 1](y)|0; }\n" | 962 " return table1[x & 1](y)|0; }\n" |
937 "function foo() { bar(1, 2); }") { | 963 "function foo() { bar(1, 2); }") { |
938 CHECK_EXPR(FunctionLiteral, FUNC_I2I_TYPE) { | 964 CHECK_EXPR(FunctionLiteral, FUNC_I2I_TYPE) { |
939 CHECK_EXPR(Assignment, Bounds(cache.kInt32)) { | 965 CHECK_EXPR(Assignment, Bounds(cache.kInt32)) { |
(...skipping 198 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
1138 "return {foo: foo, bar: 1};" | 1164 "return {foo: foo, bar: 1};" |
1139 "}\n"; | 1165 "}\n"; |
1140 | 1166 |
1141 v8::V8::Initialize(); | 1167 v8::V8::Initialize(); |
1142 HandleAndZoneScope handles; | 1168 HandleAndZoneScope handles; |
1143 Zone* zone = handles.main_zone(); | 1169 Zone* zone = handles.main_zone(); |
1144 ZoneVector<ExpressionTypeEntry> types(zone); | 1170 ZoneVector<ExpressionTypeEntry> types(zone); |
1145 CHECK_EQ("asm: line 40: non-function in function table\n", | 1171 CHECK_EQ("asm: line 40: non-function in function table\n", |
1146 Validate(zone, test_function, &types)); | 1172 Validate(zone, test_function, &types)); |
1147 } | 1173 } |
OLD | NEW |