| 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 1300 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 1311 "function bar() { var x = 1; var y = 2; return (x*y)|0; }\n" | 1311 "function bar() { var x = 1; var y = 2; return (x*y)|0; }\n" |
| 1312 "function foo() { bar(); }", | 1312 "function foo() { bar(); }", |
| 1313 "asm: line 1: multiply must be by an integer literal\n"); | 1313 "asm: line 1: multiply must be by an integer literal\n"); |
| 1314 } | 1314 } |
| 1315 | 1315 |
| 1316 | 1316 |
| 1317 TEST(Division4) { | 1317 TEST(Division4) { |
| 1318 CHECK_FUNC_ERROR( | 1318 CHECK_FUNC_ERROR( |
| 1319 "function bar() { var x = 1; var y = 2; return (x/y/x/y)|0; }\n" | 1319 "function bar() { var x = 1; var y = 2; return (x/y/x/y)|0; }\n" |
| 1320 "function foo() { bar(); }", | 1320 "function foo() { bar(); }", |
| 1321 "asm: line 1: too many consecutive multiplicative ops\n"); | 1321 "asm: line 1: left and right side of integer / or % " |
| 1322 "must match and be signed or unsigned\n"); |
| 1323 } |
| 1324 |
| 1325 TEST(ModInt) { |
| 1326 CHECK_FUNC_ERROR( |
| 1327 "function bar() { var x = 1; var y = 2; return (x%y)|0; }\n" |
| 1328 "function foo() { bar(); }", |
| 1329 "asm: line 1: left and right side of integer / or % " |
| 1330 "must match and be signed or unsigned\n"); |
| 1331 } |
| 1332 |
| 1333 TEST(DivInt) { |
| 1334 CHECK_FUNC_ERROR( |
| 1335 "function bar() { var x = 1; var y = 2; return (x/y)|0; }\n" |
| 1336 "function foo() { bar(); }", |
| 1337 "asm: line 1: left and right side of integer / or % " |
| 1338 "must match and be signed or unsigned\n"); |
| 1339 } |
| 1340 |
| 1341 TEST(ModIntMismatch) { |
| 1342 CHECK_FUNC_ERROR( |
| 1343 "function bar() { var x = 1; var y = 2; return ((x|0)%(y>>>0))|0; }\n" |
| 1344 "function foo() { bar(); }", |
| 1345 "asm: line 1: left and right side of integer / or % " |
| 1346 "must match and be signed or unsigned\n"); |
| 1347 } |
| 1348 |
| 1349 TEST(DivIntMismatch) { |
| 1350 CHECK_FUNC_ERROR( |
| 1351 "function bar() { var x = 1; var y = 2; return ((x|0)/(y>>>0))|0; }\n" |
| 1352 "function foo() { bar(); }", |
| 1353 "asm: line 1: left and right side of integer / or % " |
| 1354 "must match and be signed or unsigned\n"); |
| 1322 } | 1355 } |
| 1323 | 1356 |
| 1324 | 1357 |
| 1325 TEST(CompareToStringLeft) { | 1358 TEST(CompareToStringLeft) { |
| 1326 CHECK_FUNC_ERROR( | 1359 CHECK_FUNC_ERROR( |
| 1327 "function bar() { var x = 1; return ('hi' > x)|0; }\n" | 1360 "function bar() { var x = 1; return ('hi' > x)|0; }\n" |
| 1328 "function foo() { bar(); }", | 1361 "function foo() { bar(); }", |
| 1329 "asm: line 1: bad type on left side of comparison\n"); | 1362 "asm: line 1: bad type on left side of comparison\n"); |
| 1330 } | 1363 } |
| 1331 | 1364 |
| (...skipping 1174 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 2506 CHECK_EXPR(BinaryOperation, Bounds(cache.kAsmDouble)) { | 2539 CHECK_EXPR(BinaryOperation, Bounds(cache.kAsmDouble)) { |
| 2507 CHECK_VAR(x, Bounds(cache.kAsmDouble)); | 2540 CHECK_VAR(x, Bounds(cache.kAsmDouble)); |
| 2508 CHECK_EXPR(Literal, Bounds(cache.kAsmDouble)); | 2541 CHECK_EXPR(Literal, Bounds(cache.kAsmDouble)); |
| 2509 } | 2542 } |
| 2510 } | 2543 } |
| 2511 } | 2544 } |
| 2512 CHECK_SKIP(); | 2545 CHECK_SKIP(); |
| 2513 } | 2546 } |
| 2514 CHECK_FUNC_TYPES_END | 2547 CHECK_FUNC_TYPES_END |
| 2515 } | 2548 } |
| OLD | NEW |