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/ast.h" | 7 #include "src/ast/ast.h" |
8 #include "src/ast/ast-expression-visitor.h" | 8 #include "src/ast/ast-expression-visitor.h" |
9 #include "src/ast/scopes.h" | 9 #include "src/ast/scopes.h" |
10 #include "src/parsing/parser.h" | 10 #include "src/parsing/parser.h" |
(...skipping 1153 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
1164 } | 1164 } |
1165 | 1165 |
1166 | 1166 |
1167 TEST(TernaryBadCondition) { | 1167 TEST(TernaryBadCondition) { |
1168 CHECK_FUNC_ERROR( | 1168 CHECK_FUNC_ERROR( |
1169 "function bar() { var x = 1; var y = 2.0; return (y?x:1)|0; }\n" | 1169 "function bar() { var x = 1; var y = 2.0; return (y?x:1)|0; }\n" |
1170 "function foo() { bar(); }", | 1170 "function foo() { bar(); }", |
1171 "asm: line 39: condition must be of type int\n"); | 1171 "asm: line 39: condition must be of type int\n"); |
1172 } | 1172 } |
1173 | 1173 |
| 1174 TEST(BadIntishMultiply) { |
| 1175 CHECK_FUNC_ERROR( |
| 1176 "function bar() { var x = 1; return ((x + x) * 4) | 0; }\n" |
| 1177 "function foo() { bar(); }", |
| 1178 "asm: line 39: intish not allowed in multiply\n"); |
| 1179 } |
1174 | 1180 |
1175 TEST(FroundFloat32) { | 1181 TEST(FroundFloat32) { |
1176 CHECK_FUNC_TYPES_BEGIN( | 1182 CHECK_FUNC_TYPES_BEGIN( |
1177 "function bar() { var x = 1; return fround(x); }\n" | 1183 "function bar() { var x = 1; return fround(x); }\n" |
1178 "function foo() { bar(); }") { | 1184 "function foo() { bar(); }") { |
1179 CHECK_EXPR(FunctionLiteral, FUNC_F_TYPE) { | 1185 CHECK_EXPR(FunctionLiteral, FUNC_F_TYPE) { |
1180 CHECK_EXPR(Assignment, Bounds(cache.kAsmInt)) { | 1186 CHECK_EXPR(Assignment, Bounds(cache.kAsmInt)) { |
1181 CHECK_VAR(x, Bounds(cache.kAsmInt)); | 1187 CHECK_VAR(x, Bounds(cache.kAsmInt)); |
1182 CHECK_EXPR(Literal, Bounds(cache.kAsmFixnum)); | 1188 CHECK_EXPR(Literal, Bounds(cache.kAsmFixnum)); |
1183 } | 1189 } |
(...skipping 38 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
1222 CHECK_SKIP(); | 1228 CHECK_SKIP(); |
1223 } | 1229 } |
1224 CHECK_FUNC_TYPES_END | 1230 CHECK_FUNC_TYPES_END |
1225 } | 1231 } |
1226 | 1232 |
1227 | 1233 |
1228 TEST(Multiplication2) { | 1234 TEST(Multiplication2) { |
1229 CHECK_FUNC_ERROR( | 1235 CHECK_FUNC_ERROR( |
1230 "function bar() { var x = 1; var y = 2; return (x*y)|0; }\n" | 1236 "function bar() { var x = 1; var y = 2; return (x*y)|0; }\n" |
1231 "function foo() { bar(); }", | 1237 "function foo() { bar(); }", |
1232 "asm: line 39: direct integer multiply forbidden\n"); | 1238 "asm: line 39: multiply must be by an integer literal\n"); |
1233 } | 1239 } |
1234 | 1240 |
1235 | 1241 |
1236 TEST(Division4) { | 1242 TEST(Division4) { |
1237 CHECK_FUNC_ERROR( | 1243 CHECK_FUNC_ERROR( |
1238 "function bar() { var x = 1; var y = 2; return (x/y/x/y)|0; }\n" | 1244 "function bar() { var x = 1; var y = 2; return (x/y/x/y)|0; }\n" |
1239 "function foo() { bar(); }", | 1245 "function foo() { bar(); }", |
1240 "asm: line 39: too many consecutive multiplicative ops\n"); | 1246 "asm: line 39: too many consecutive multiplicative ops\n"); |
1241 } | 1247 } |
1242 | 1248 |
(...skipping 1092 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
2335 } | 2341 } |
2336 // return { testFunc1: test1, testFunc2: test2 }; | 2342 // return { testFunc1: test1, testFunc2: test2 }; |
2337 CHECK_EXPR(ObjectLiteral, Bounds::Unbounded()) { | 2343 CHECK_EXPR(ObjectLiteral, Bounds::Unbounded()) { |
2338 CHECK_VAR(test1, FUNC_I_TYPE); | 2344 CHECK_VAR(test1, FUNC_I_TYPE); |
2339 CHECK_VAR(test2, FUNC_D_TYPE); | 2345 CHECK_VAR(test2, FUNC_D_TYPE); |
2340 } | 2346 } |
2341 } | 2347 } |
2342 } | 2348 } |
2343 CHECK_TYPES_END | 2349 CHECK_TYPES_END |
2344 } | 2350 } |
OLD | NEW |