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 165 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
176 CHECK_EXPR(CompareOperation, Bounds(cache.kAsmSigned)) { | 176 CHECK_EXPR(CompareOperation, Bounds(cache.kAsmSigned)) { |
177 CHECK_EXPR(BinaryOperation, Bounds(cache.kAsmSigned)) { | 177 CHECK_EXPR(BinaryOperation, Bounds(cache.kAsmSigned)) { |
178 CHECK_VAR(p, Bounds(cache.kAsmInt)); | 178 CHECK_VAR(p, Bounds(cache.kAsmInt)); |
179 CHECK_EXPR(Literal, Bounds(cache.kAsmFixnum)); | 179 CHECK_EXPR(Literal, Bounds(cache.kAsmFixnum)); |
180 } | 180 } |
181 CHECK_EXPR(BinaryOperation, Bounds(cache.kAsmSigned)) { | 181 CHECK_EXPR(BinaryOperation, Bounds(cache.kAsmSigned)) { |
182 CHECK_VAR(q, Bounds(cache.kAsmInt)); | 182 CHECK_VAR(q, Bounds(cache.kAsmInt)); |
183 CHECK_EXPR(Literal, Bounds(cache.kAsmFixnum)); | 183 CHECK_EXPR(Literal, Bounds(cache.kAsmFixnum)); |
184 } | 184 } |
185 } | 185 } |
186 // p = (p + 8)|0) {\n" | 186 // p = (p + 8)|0) { |
187 CHECK_EXPR(Assignment, Bounds(cache.kAsmInt)) { | 187 CHECK_EXPR(Assignment, Bounds(cache.kAsmInt)) { |
188 CHECK_VAR(p, Bounds(cache.kAsmInt)); | 188 CHECK_VAR(p, Bounds(cache.kAsmInt)); |
189 CHECK_EXPR(BinaryOperation, Bounds(cache.kAsmSigned)) { | 189 CHECK_EXPR(BinaryOperation, Bounds(cache.kAsmSigned)) { |
190 CHECK_EXPR(BinaryOperation, Bounds(cache.kAsmInt)) { | 190 CHECK_EXPR(BinaryOperation, Bounds(cache.kAsmInt)) { |
191 CHECK_VAR(p, Bounds(cache.kAsmInt)); | 191 CHECK_VAR(p, Bounds(cache.kAsmInt)); |
192 CHECK_EXPR(Literal, Bounds(cache.kAsmFixnum)); | 192 CHECK_EXPR(Literal, Bounds(cache.kAsmFixnum)); |
193 } | 193 } |
194 CHECK_EXPR(Literal, Bounds(cache.kAsmFixnum)); | 194 CHECK_EXPR(Literal, Bounds(cache.kAsmFixnum)); |
195 } | 195 } |
196 } | 196 } |
(...skipping 150 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
347 " function bar() {}\n" | 347 " function bar() {}\n" |
348 "}\n"; | 348 "}\n"; |
349 v8::V8::Initialize(); | 349 v8::V8::Initialize(); |
350 HandleAndZoneScope handles; | 350 HandleAndZoneScope handles; |
351 Zone* zone = handles.main_zone(); | 351 Zone* zone = handles.main_zone(); |
352 ZoneVector<ExpressionTypeEntry> types(zone); | 352 ZoneVector<ExpressionTypeEntry> types(zone); |
353 CHECK_EQ("asm: line 2: last statement in module is not a return\n", | 353 CHECK_EQ("asm: line 2: last statement in module is not a return\n", |
354 Validate(zone, test_function, &types)); | 354 Validate(zone, test_function, &types)); |
355 } | 355 } |
356 | 356 |
| 357 #define HARNESS_STDLIB() \ |
| 358 "var Infinity = stdlib.Infinity; " \ |
| 359 "var NaN = stdlib.NaN; " \ |
| 360 "var acos = stdlib.Math.acos; " \ |
| 361 "var asin = stdlib.Math.asin; " \ |
| 362 "var atan = stdlib.Math.atan; " \ |
| 363 "var cos = stdlib.Math.cos; " \ |
| 364 "var sin = stdlib.Math.sin; " \ |
| 365 "var tan = stdlib.Math.tan; " \ |
| 366 "var exp = stdlib.Math.exp; " \ |
| 367 "var log = stdlib.Math.log; " \ |
| 368 "var ceil = stdlib.Math.ceil; " \ |
| 369 "var floor = stdlib.Math.floor; " \ |
| 370 "var sqrt = stdlib.Math.sqrt; " \ |
| 371 "var min = stdlib.Math.min; " \ |
| 372 "var max = stdlib.Math.max; " \ |
| 373 "var atan2 = stdlib.Math.atan2; " \ |
| 374 "var pow = stdlib.Math.pow; " \ |
| 375 "var abs = stdlib.Math.abs; " \ |
| 376 "var imul = stdlib.Math.imul; " \ |
| 377 "var fround = stdlib.Math.fround; " \ |
| 378 "var E = stdlib.Math.E; " \ |
| 379 "var LN10 = stdlib.Math.LN10; " \ |
| 380 "var LN2 = stdlib.Math.LN2; " \ |
| 381 "var LOG2E = stdlib.Math.LOG2E; " \ |
| 382 "var LOG10E = stdlib.Math.LOG10E; " \ |
| 383 "var PI = stdlib.Math.PI; " \ |
| 384 "var SQRT1_2 = stdlib.Math.SQRT1_2; " \ |
| 385 "var SQRT2 = stdlib.Math.SQRT2; " |
357 | 386 |
358 #define HARNESS_STDLIB() \ | 387 #define HARNESS_HEAP() \ |
359 "var Infinity = stdlib.Infinity;\n" \ | 388 "var u8 = new stdlib.Uint8Array(buffer); " \ |
360 "var NaN = stdlib.NaN;\n" \ | 389 "var i8 = new stdlib.Int8Array(buffer); " \ |
361 "var acos = stdlib.Math.acos;\n" \ | 390 "var u16 = new stdlib.Uint16Array(buffer); " \ |
362 "var asin = stdlib.Math.asin;\n" \ | 391 "var i16 = new stdlib.Int16Array(buffer); " \ |
363 "var atan = stdlib.Math.atan;\n" \ | 392 "var u32 = new stdlib.Uint32Array(buffer); " \ |
364 "var cos = stdlib.Math.cos;\n" \ | 393 "var i32 = new stdlib.Int32Array(buffer); " \ |
365 "var sin = stdlib.Math.sin;\n" \ | 394 "var f32 = new stdlib.Float32Array(buffer); " \ |
366 "var tan = stdlib.Math.tan;\n" \ | 395 "var f64 = new stdlib.Float64Array(buffer); " |
367 "var exp = stdlib.Math.exp;\n" \ | |
368 "var log = stdlib.Math.log;\n" \ | |
369 "var ceil = stdlib.Math.ceil;\n" \ | |
370 "var floor = stdlib.Math.floor;\n" \ | |
371 "var sqrt = stdlib.Math.sqrt;\n" \ | |
372 "var min = stdlib.Math.min;\n" \ | |
373 "var max = stdlib.Math.max;\n" \ | |
374 "var atan2 = stdlib.Math.atan2;\n" \ | |
375 "var pow = stdlib.Math.pow;\n" \ | |
376 "var abs = stdlib.Math.abs;\n" \ | |
377 "var imul = stdlib.Math.imul;\n" \ | |
378 "var fround = stdlib.Math.fround;\n" \ | |
379 "var E = stdlib.Math.E;\n" \ | |
380 "var LN10 = stdlib.Math.LN10;\n" \ | |
381 "var LN2 = stdlib.Math.LN2;\n" \ | |
382 "var LOG2E = stdlib.Math.LOG2E;\n" \ | |
383 "var LOG10E = stdlib.Math.LOG10E;\n" \ | |
384 "var PI = stdlib.Math.PI;\n" \ | |
385 "var SQRT1_2 = stdlib.Math.SQRT1_2;\n" \ | |
386 "var SQRT2 = stdlib.Math.SQRT2;\n" | |
387 | 396 |
388 | 397 #define HARNESS_PREAMBLE() \ |
389 #define HARNESS_HEAP() \ | 398 const char test_function[] = \ |
390 "var u8 = new stdlib.Uint8Array(buffer);\n" \ | 399 "function Module(stdlib, foreign, buffer) { " \ |
391 "var i8 = new stdlib.Int8Array(buffer);\n" \ | 400 "\"use asm\"; " HARNESS_STDLIB() HARNESS_HEAP() |
392 "var u16 = new stdlib.Uint16Array(buffer);\n" \ | |
393 "var i16 = new stdlib.Int16Array(buffer);\n" \ | |
394 "var u32 = new stdlib.Uint32Array(buffer);\n" \ | |
395 "var i32 = new stdlib.Int32Array(buffer);\n" \ | |
396 "var f32 = new stdlib.Float32Array(buffer);\n" \ | |
397 "var f64 = new stdlib.Float64Array(buffer);\n" | |
398 | |
399 | |
400 #define HARNESS_PREAMBLE() \ | |
401 const char test_function[] = \ | |
402 "function Module(stdlib, foreign, buffer) {\n" \ | |
403 "\"use asm\";\n" HARNESS_STDLIB() HARNESS_HEAP() | |
404 | |
405 | 401 |
406 #define HARNESS_POSTAMBLE() \ | 402 #define HARNESS_POSTAMBLE() \ |
407 "return { foo: foo };\n" \ | 403 "return { foo: foo }; " \ |
408 "}\n"; | 404 "} "; |
409 | |
410 | 405 |
411 #define CHECK_VAR_MATH_SHORTCUT(name, type) \ | 406 #define CHECK_VAR_MATH_SHORTCUT(name, type) \ |
412 CHECK_EXPR(Assignment, type) { \ | 407 CHECK_EXPR(Assignment, type) { \ |
413 CHECK_VAR(name, type); \ | 408 CHECK_VAR(name, type); \ |
414 CHECK_EXPR(Property, type) { \ | 409 CHECK_EXPR(Property, type) { \ |
415 CHECK_EXPR(Property, Bounds::Unbounded()) { \ | 410 CHECK_EXPR(Property, Bounds::Unbounded()) { \ |
416 CHECK_VAR(stdlib, Bounds::Unbounded()); \ | 411 CHECK_VAR(stdlib, Bounds::Unbounded()); \ |
417 CHECK_EXPR(Literal, Bounds::Unbounded()); \ | 412 CHECK_EXPR(Literal, Bounds::Unbounded()); \ |
418 } \ | 413 } \ |
419 CHECK_EXPR(Literal, Bounds::Unbounded()); \ | 414 CHECK_EXPR(Literal, Bounds::Unbounded()); \ |
(...skipping 661 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
1081 CHECK_SKIP(); | 1076 CHECK_SKIP(); |
1082 } | 1077 } |
1083 CHECK_FUNC_TYPES_END | 1078 CHECK_FUNC_TYPES_END |
1084 } | 1079 } |
1085 | 1080 |
1086 | 1081 |
1087 TEST(UnsignedFromFloat64) { | 1082 TEST(UnsignedFromFloat64) { |
1088 CHECK_FUNC_ERROR( | 1083 CHECK_FUNC_ERROR( |
1089 "function bar() { var x = 1.0; return (x>>>0)|0; }\n" | 1084 "function bar() { var x = 1.0; return (x>>>0)|0; }\n" |
1090 "function foo() { bar(); }", | 1085 "function foo() { bar(); }", |
1091 "asm: line 39: left bitwise operand expected to be an integer\n"); | 1086 "asm: line 1: left bitwise operand expected to be an integer\n"); |
1092 } | 1087 } |
1093 | 1088 |
1094 | 1089 |
1095 TEST(AndFloat64) { | 1090 TEST(AndFloat64) { |
1096 CHECK_FUNC_ERROR( | 1091 CHECK_FUNC_ERROR( |
1097 "function bar() { var x = 1.0; return (x&0)|0; }\n" | 1092 "function bar() { var x = 1.0; return (x&0)|0; }\n" |
1098 "function foo() { bar(); }", | 1093 "function foo() { bar(); }", |
1099 "asm: line 39: left bitwise operand expected to be an integer\n"); | 1094 "asm: line 1: left bitwise operand expected to be an integer\n"); |
1100 } | 1095 } |
1101 | 1096 |
1102 | 1097 |
1103 TEST(TypeMismatchAddInt32Float64) { | 1098 TEST(TypeMismatchAddInt32Float64) { |
1104 CHECK_FUNC_ERROR( | 1099 CHECK_FUNC_ERROR( |
1105 "function bar() { var x = 1.0; var y = 0; return (x + y)|0; }\n" | 1100 "function bar() { var x = 1.0; var y = 0; return (x + y)|0; }\n" |
1106 "function foo() { bar(); }", | 1101 "function foo() { bar(); }", |
1107 "asm: line 39: ill-typed arithmetic operation\n"); | 1102 "asm: line 1: ill-typed arithmetic operation\n"); |
1108 } | 1103 } |
1109 | 1104 |
1110 | 1105 |
1111 TEST(TypeMismatchSubInt32Float64) { | 1106 TEST(TypeMismatchSubInt32Float64) { |
1112 CHECK_FUNC_ERROR( | 1107 CHECK_FUNC_ERROR( |
1113 "function bar() { var x = 1.0; var y = 0; return (x - y)|0; }\n" | 1108 "function bar() { var x = 1.0; var y = 0; return (x - y)|0; }\n" |
1114 "function foo() { bar(); }", | 1109 "function foo() { bar(); }", |
1115 "asm: line 39: ill-typed arithmetic operation\n"); | 1110 "asm: line 1: ill-typed arithmetic operation\n"); |
1116 } | 1111 } |
1117 | 1112 |
1118 | 1113 |
1119 TEST(TypeMismatchDivInt32Float64) { | 1114 TEST(TypeMismatchDivInt32Float64) { |
1120 CHECK_FUNC_ERROR( | 1115 CHECK_FUNC_ERROR( |
1121 "function bar() { var x = 1.0; var y = 0; return (x / y)|0; }\n" | 1116 "function bar() { var x = 1.0; var y = 0; return (x / y)|0; }\n" |
1122 "function foo() { bar(); }", | 1117 "function foo() { bar(); }", |
1123 "asm: line 39: ill-typed arithmetic operation\n"); | 1118 "asm: line 1: ill-typed arithmetic operation\n"); |
1124 } | 1119 } |
1125 | 1120 |
1126 | 1121 |
1127 TEST(TypeMismatchModInt32Float64) { | 1122 TEST(TypeMismatchModInt32Float64) { |
1128 CHECK_FUNC_ERROR( | 1123 CHECK_FUNC_ERROR( |
1129 "function bar() { var x = 1.0; var y = 0; return (x % y)|0; }\n" | 1124 "function bar() { var x = 1.0; var y = 0; return (x % y)|0; }\n" |
1130 "function foo() { bar(); }", | 1125 "function foo() { bar(); }", |
1131 "asm: line 39: ill-typed arithmetic operation\n"); | 1126 "asm: line 1: ill-typed arithmetic operation\n"); |
1132 } | 1127 } |
1133 | 1128 |
1134 | 1129 |
1135 TEST(ModFloat32) { | 1130 TEST(ModFloat32) { |
1136 CHECK_FUNC_ERROR( | 1131 CHECK_FUNC_ERROR( |
1137 "function bar() { var x = fround(1.0); return (x % x)|0; }\n" | 1132 "function bar() { var x = fround(1.0); return (x % x)|0; }\n" |
1138 "function foo() { bar(); }", | 1133 "function foo() { bar(); }", |
1139 "asm: line 39: ill-typed arithmetic operation\n"); | 1134 "asm: line 1: ill-typed arithmetic operation\n"); |
1140 } | 1135 } |
1141 | 1136 |
1142 | 1137 |
1143 TEST(TernaryMismatchInt32Float64) { | 1138 TEST(TernaryMismatchInt32Float64) { |
1144 CHECK_FUNC_ERROR( | 1139 CHECK_FUNC_ERROR( |
1145 "function bar() { var x = 1; var y = 0.0; return (1 ? x : y)|0; }\n" | 1140 "function bar() { var x = 1; var y = 0.0; return (1 ? x : y)|0; }\n" |
1146 "function foo() { bar(); }", | 1141 "function foo() { bar(); }", |
1147 "asm: line 39: then and else expressions in ? must have the same type\n"); | 1142 "asm: line 1: then and else expressions in ? must have the same type\n"); |
1148 } | 1143 } |
1149 | 1144 |
1150 | 1145 |
1151 TEST(TernaryMismatchIntish) { | 1146 TEST(TernaryMismatchIntish) { |
1152 CHECK_FUNC_ERROR( | 1147 CHECK_FUNC_ERROR( |
1153 "function bar() { var x = 1; var y = 0; return (1 ? x + x : y)|0; }\n" | 1148 "function bar() { var x = 1; var y = 0; return (1 ? x + x : y)|0; }\n" |
1154 "function foo() { bar(); }", | 1149 "function foo() { bar(); }", |
1155 "asm: line 39: invalid type in ? then expression\n"); | 1150 "asm: line 1: invalid type in ? then expression\n"); |
1156 } | 1151 } |
1157 | 1152 |
1158 | 1153 |
1159 TEST(TernaryMismatchInt32Float32) { | 1154 TEST(TernaryMismatchInt32Float32) { |
1160 CHECK_FUNC_ERROR( | 1155 CHECK_FUNC_ERROR( |
1161 "function bar() { var x = 1; var y = 2; return (x?fround(y):x)|0; }\n" | 1156 "function bar() { var x = 1; var y = 2; return (x?fround(y):x)|0; }\n" |
1162 "function foo() { bar(); }", | 1157 "function foo() { bar(); }", |
1163 "asm: line 39: then and else expressions in ? must have the same type\n"); | 1158 "asm: line 1: then and else expressions in ? must have the same type\n"); |
1164 } | 1159 } |
1165 | 1160 |
1166 | 1161 |
1167 TEST(TernaryBadCondition) { | 1162 TEST(TernaryBadCondition) { |
1168 CHECK_FUNC_ERROR( | 1163 CHECK_FUNC_ERROR( |
1169 "function bar() { var x = 1; var y = 2.0; return (y?x:1)|0; }\n" | 1164 "function bar() { var x = 1; var y = 2.0; return (y?x:1)|0; }\n" |
1170 "function foo() { bar(); }", | 1165 "function foo() { bar(); }", |
1171 "asm: line 39: condition must be of type int\n"); | 1166 "asm: line 1: condition must be of type int\n"); |
1172 } | 1167 } |
1173 | 1168 |
1174 TEST(BadIntishMultiply) { | 1169 TEST(BadIntishMultiply) { |
1175 CHECK_FUNC_ERROR( | 1170 CHECK_FUNC_ERROR( |
1176 "function bar() { var x = 1; return ((x + x) * 4) | 0; }\n" | 1171 "function bar() { var x = 1; return ((x + x) * 4) | 0; }\n" |
1177 "function foo() { bar(); }", | 1172 "function foo() { bar(); }", |
1178 "asm: line 39: intish not allowed in multiply\n"); | 1173 "asm: line 1: intish not allowed in multiply\n"); |
1179 } | 1174 } |
1180 | 1175 |
1181 TEST(FroundFloat32) { | 1176 TEST(FroundFloat32) { |
1182 CHECK_FUNC_TYPES_BEGIN( | 1177 CHECK_FUNC_TYPES_BEGIN( |
1183 "function bar() { var x = 1; return fround(x); }\n" | 1178 "function bar() { var x = 1; return fround(x); }\n" |
1184 "function foo() { bar(); }") { | 1179 "function foo() { bar(); }") { |
1185 CHECK_EXPR(FunctionLiteral, FUNC_F_TYPE) { | 1180 CHECK_EXPR(FunctionLiteral, FUNC_F_TYPE) { |
1186 CHECK_EXPR(Assignment, Bounds(cache.kAsmInt)) { | 1181 CHECK_EXPR(Assignment, Bounds(cache.kAsmInt)) { |
1187 CHECK_VAR(x, Bounds(cache.kAsmInt)); | 1182 CHECK_VAR(x, Bounds(cache.kAsmInt)); |
1188 CHECK_EXPR(Literal, Bounds(cache.kAsmFixnum)); | 1183 CHECK_EXPR(Literal, Bounds(cache.kAsmFixnum)); |
(...skipping 39 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
1228 CHECK_SKIP(); | 1223 CHECK_SKIP(); |
1229 } | 1224 } |
1230 CHECK_FUNC_TYPES_END | 1225 CHECK_FUNC_TYPES_END |
1231 } | 1226 } |
1232 | 1227 |
1233 | 1228 |
1234 TEST(Multiplication2) { | 1229 TEST(Multiplication2) { |
1235 CHECK_FUNC_ERROR( | 1230 CHECK_FUNC_ERROR( |
1236 "function bar() { var x = 1; var y = 2; return (x*y)|0; }\n" | 1231 "function bar() { var x = 1; var y = 2; return (x*y)|0; }\n" |
1237 "function foo() { bar(); }", | 1232 "function foo() { bar(); }", |
1238 "asm: line 39: multiply must be by an integer literal\n"); | 1233 "asm: line 1: multiply must be by an integer literal\n"); |
1239 } | 1234 } |
1240 | 1235 |
1241 | 1236 |
1242 TEST(Division4) { | 1237 TEST(Division4) { |
1243 CHECK_FUNC_ERROR( | 1238 CHECK_FUNC_ERROR( |
1244 "function bar() { var x = 1; var y = 2; return (x/y/x/y)|0; }\n" | 1239 "function bar() { var x = 1; var y = 2; return (x/y/x/y)|0; }\n" |
1245 "function foo() { bar(); }", | 1240 "function foo() { bar(); }", |
1246 "asm: line 39: too many consecutive multiplicative ops\n"); | 1241 "asm: line 1: too many consecutive multiplicative ops\n"); |
1247 } | 1242 } |
1248 | 1243 |
1249 | 1244 |
1250 TEST(CompareToStringLeft) { | 1245 TEST(CompareToStringLeft) { |
1251 CHECK_FUNC_ERROR( | 1246 CHECK_FUNC_ERROR( |
1252 "function bar() { var x = 1; return ('hi' > x)|0; }\n" | 1247 "function bar() { var x = 1; return ('hi' > x)|0; }\n" |
1253 "function foo() { bar(); }", | 1248 "function foo() { bar(); }", |
1254 "asm: line 39: bad type on left side of comparison\n"); | 1249 "asm: line 1: bad type on left side of comparison\n"); |
1255 } | 1250 } |
1256 | 1251 |
1257 | 1252 |
1258 TEST(CompareToStringRight) { | 1253 TEST(CompareToStringRight) { |
1259 CHECK_FUNC_ERROR( | 1254 CHECK_FUNC_ERROR( |
1260 "function bar() { var x = 1; return (x < 'hi')|0; }\n" | 1255 "function bar() { var x = 1; return (x < 'hi')|0; }\n" |
1261 "function foo() { bar(); }", | 1256 "function foo() { bar(); }", |
1262 "asm: line 39: bad type on right side of comparison\n"); | 1257 "asm: line 1: bad type on right side of comparison\n"); |
1263 } | 1258 } |
1264 | 1259 |
1265 | 1260 |
1266 TEST(CompareMismatchInt32Float64) { | 1261 TEST(CompareMismatchInt32Float64) { |
1267 CHECK_FUNC_ERROR( | 1262 CHECK_FUNC_ERROR( |
1268 "function bar() { var x = 1; var y = 2.0; return (x < y)|0; }\n" | 1263 "function bar() { var x = 1; var y = 2.0; return (x < y)|0; }\n" |
1269 "function foo() { bar(); }", | 1264 "function foo() { bar(); }", |
1270 "asm: line 39: left and right side of comparison must match\n"); | 1265 "asm: line 1: left and right side of comparison must match\n"); |
1271 } | 1266 } |
1272 | 1267 |
1273 | 1268 |
1274 TEST(CompareMismatchInt32Uint32) { | 1269 TEST(CompareMismatchInt32Uint32) { |
1275 CHECK_FUNC_ERROR( | 1270 CHECK_FUNC_ERROR( |
1276 "function bar() { var x = 1; var y = 2; return ((x|0) < (y>>>0))|0; }\n" | 1271 "function bar() { var x = 1; var y = 2; return ((x|0) < (y>>>0))|0; }\n" |
1277 "function foo() { bar(); }", | 1272 "function foo() { bar(); }", |
1278 "asm: line 39: left and right side of comparison must match\n"); | 1273 "asm: line 1: left and right side of comparison must match\n"); |
1279 } | 1274 } |
1280 | 1275 |
1281 | 1276 |
1282 TEST(CompareMismatchInt32Float32) { | 1277 TEST(CompareMismatchInt32Float32) { |
1283 CHECK_FUNC_ERROR( | 1278 CHECK_FUNC_ERROR( |
1284 "function bar() { var x = 1; var y = 2; return (x < fround(y))|0; }\n" | 1279 "function bar() { var x = 1; var y = 2; return (x < fround(y))|0; }\n" |
1285 "function foo() { bar(); }", | 1280 "function foo() { bar(); }", |
1286 "asm: line 39: left and right side of comparison must match\n"); | 1281 "asm: line 1: left and right side of comparison must match\n"); |
1287 } | 1282 } |
1288 | 1283 |
1289 | 1284 |
1290 TEST(Float64ToInt32) { | 1285 TEST(Float64ToInt32) { |
1291 CHECK_FUNC_TYPES_BEGIN( | 1286 CHECK_FUNC_TYPES_BEGIN( |
1292 "function bar() { var x = 1; var y = 0.0; x = ~~y; }\n" | 1287 "function bar() { var x = 1; var y = 0.0; x = ~~y; }\n" |
1293 "function foo() { bar(); }") { | 1288 "function foo() { bar(); }") { |
1294 CHECK_EXPR(FunctionLiteral, FUNC_V_TYPE) { | 1289 CHECK_EXPR(FunctionLiteral, FUNC_V_TYPE) { |
1295 CHECK_EXPR(Assignment, Bounds(cache.kAsmInt)) { | 1290 CHECK_EXPR(Assignment, Bounds(cache.kAsmInt)) { |
1296 CHECK_VAR(x, Bounds(cache.kAsmInt)); | 1291 CHECK_VAR(x, Bounds(cache.kAsmInt)); |
(...skipping 320 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
1617 } | 1612 } |
1618 | 1613 |
1619 | 1614 |
1620 TEST(BadFunctionTable) { | 1615 TEST(BadFunctionTable) { |
1621 CHECK_FUNC_ERROR( | 1616 CHECK_FUNC_ERROR( |
1622 "function func1(x) { x = x | 0; return (x * 5) | 0; }\n" | 1617 "function func1(x) { x = x | 0; return (x * 5) | 0; }\n" |
1623 "var table1 = [func1, 1];\n" | 1618 "var table1 = [func1, 1];\n" |
1624 "function bar(x, y) { x = x | 0; y = y | 0;\n" | 1619 "function bar(x, y) { x = x | 0; y = y | 0;\n" |
1625 " return table1[x & 1](y)|0; }\n" | 1620 " return table1[x & 1](y)|0; }\n" |
1626 "function foo() { bar(1, 2); }", | 1621 "function foo() { bar(1, 2); }", |
1627 "asm: line 40: array component expected to be a function\n"); | 1622 "asm: line 2: array component expected to be a function\n"); |
1628 } | 1623 } |
1629 | 1624 |
1630 | 1625 |
1631 TEST(MissingParameterTypes) { | 1626 TEST(MissingParameterTypes) { |
1632 CHECK_FUNC_ERROR( | 1627 CHECK_FUNC_ERROR( |
1633 "function bar(x) { var y = 1; }\n" | 1628 "function bar(x) { var y = 1; }\n" |
1634 "function foo() { bar(2); }", | 1629 "function foo() { bar(2); }", |
1635 "asm: line 39: missing parameter type annotations\n"); | 1630 "asm: line 1: missing parameter type annotations\n"); |
1636 } | 1631 } |
1637 | 1632 |
1638 | 1633 |
1639 TEST(InvalidTypeAnnotationBinaryOpDiv) { | 1634 TEST(InvalidTypeAnnotationBinaryOpDiv) { |
1640 CHECK_FUNC_ERROR( | 1635 CHECK_FUNC_ERROR( |
1641 "function bar(x) { x = x / 4; }\n" | 1636 "function bar(x) { x = x / 4; }\n" |
1642 "function foo() { bar(2); }", | 1637 "function foo() { bar(2); }", |
1643 "asm: line 39: invalid type annotation on binary op\n"); | 1638 "asm: line 1: invalid type annotation on binary op\n"); |
1644 } | 1639 } |
1645 | 1640 |
1646 | 1641 |
1647 TEST(InvalidTypeAnnotationBinaryOpMul) { | 1642 TEST(InvalidTypeAnnotationBinaryOpMul) { |
1648 CHECK_FUNC_ERROR( | 1643 CHECK_FUNC_ERROR( |
1649 "function bar(x) { x = x * 4.0; }\n" | 1644 "function bar(x) { x = x * 4.0; }\n" |
1650 "function foo() { bar(2); }", | 1645 "function foo() { bar(2); }", |
1651 "asm: line 39: invalid type annotation on binary op\n"); | 1646 "asm: line 1: invalid type annotation on binary op\n"); |
1652 } | 1647 } |
1653 | 1648 |
1654 | 1649 |
1655 TEST(InvalidArgumentCount) { | 1650 TEST(InvalidArgumentCount) { |
1656 CHECK_FUNC_ERROR( | 1651 CHECK_FUNC_ERROR( |
1657 "function bar(x) { return fround(4, 5); }\n" | 1652 "function bar(x) { return fround(4, 5); }\n" |
1658 "function foo() { bar(); }", | 1653 "function foo() { bar(); }", |
1659 "asm: line 39: invalid argument count calling function\n"); | 1654 "asm: line 1: invalid argument count calling function\n"); |
1660 } | 1655 } |
1661 | 1656 |
1662 | 1657 |
1663 TEST(InvalidTypeAnnotationArity) { | 1658 TEST(InvalidTypeAnnotationArity) { |
1664 CHECK_FUNC_ERROR( | 1659 CHECK_FUNC_ERROR( |
1665 "function bar(x) { x = max(x); }\n" | 1660 "function bar(x) { x = max(x); }\n" |
1666 "function foo() { bar(3); }", | 1661 "function foo() { bar(3); }", |
1667 "asm: line 39: only fround allowed on expression annotations\n"); | 1662 "asm: line 1: only fround allowed on expression annotations\n"); |
1668 } | 1663 } |
1669 | 1664 |
1670 | 1665 |
1671 TEST(InvalidTypeAnnotationOnlyFround) { | 1666 TEST(InvalidTypeAnnotationOnlyFround) { |
1672 CHECK_FUNC_ERROR( | 1667 CHECK_FUNC_ERROR( |
1673 "function bar(x) { x = sin(x); }\n" | 1668 "function bar(x) { x = sin(x); }\n" |
1674 "function foo() { bar(3); }", | 1669 "function foo() { bar(3); }", |
1675 "asm: line 39: only fround allowed on expression annotations\n"); | 1670 "asm: line 1: only fround allowed on expression annotations\n"); |
1676 } | 1671 } |
1677 | 1672 |
1678 | 1673 |
1679 TEST(InvalidTypeAnnotation) { | 1674 TEST(InvalidTypeAnnotation) { |
1680 CHECK_FUNC_ERROR( | 1675 CHECK_FUNC_ERROR( |
1681 "function bar(x) { x = (x+x)(x); }\n" | 1676 "function bar(x) { x = (x+x)(x); }\n" |
1682 "function foo() { bar(3); }", | 1677 "function foo() { bar(3); }", |
1683 "asm: line 39: invalid type annotation\n"); | 1678 "asm: line 1: invalid type annotation\n"); |
1684 } | 1679 } |
1685 | 1680 |
1686 | 1681 |
1687 TEST(WithStatement) { | 1682 TEST(WithStatement) { |
1688 CHECK_FUNC_ERROR( | 1683 CHECK_FUNC_ERROR( |
1689 "function bar() { var x = 0; with (x) { x = x + 1; } }\n" | 1684 "function bar() { var x = 0; with (x) { x = x + 1; } }\n" |
1690 "function foo() { bar(); }", | 1685 "function foo() { bar(); }", |
1691 "asm: line 39: bad with statement\n"); | 1686 "asm: line 1: bad with statement\n"); |
1692 } | 1687 } |
1693 | 1688 |
1694 | 1689 |
1695 TEST(NestedFunction) { | 1690 TEST(NestedFunction) { |
1696 CHECK_FUNC_ERROR( | 1691 CHECK_FUNC_ERROR( |
1697 "function bar() { function x() { return 1; } }\n" | 1692 "function bar() { function x() { return 1; } }\n" |
1698 "function foo() { bar(); }", | 1693 "function foo() { bar(); }", |
1699 "asm: line 39: function declared inside another\n"); | 1694 "asm: line 1: function declared inside another\n"); |
1700 } | 1695 } |
1701 | 1696 |
1702 | 1697 |
1703 TEST(UnboundVariable) { | 1698 TEST(UnboundVariable) { |
1704 CHECK_FUNC_ERROR( | 1699 CHECK_FUNC_ERROR( |
1705 "function bar() { var x = y; }\n" | 1700 "function bar() { var x = y; }\n" |
1706 "function foo() { bar(); }", | 1701 "function foo() { bar(); }", |
1707 "asm: line 39: unbound variable\n"); | 1702 "asm: line 1: unbound variable\n"); |
1708 } | 1703 } |
1709 | 1704 |
1710 | 1705 |
1711 TEST(EqStrict) { | 1706 TEST(EqStrict) { |
1712 CHECK_FUNC_ERROR( | 1707 CHECK_FUNC_ERROR( |
1713 "function bar() { return (0 === 0)|0; }\n" | 1708 "function bar() { return (0 === 0)|0; }\n" |
1714 "function foo() { bar(); }", | 1709 "function foo() { bar(); }", |
1715 "asm: line 39: illegal comparison operator\n"); | 1710 "asm: line 1: illegal comparison operator\n"); |
1716 } | 1711 } |
1717 | 1712 |
1718 | 1713 |
1719 TEST(NeStrict) { | 1714 TEST(NeStrict) { |
1720 CHECK_FUNC_ERROR( | 1715 CHECK_FUNC_ERROR( |
1721 "function bar() { return (0 !== 0)|0; }\n" | 1716 "function bar() { return (0 !== 0)|0; }\n" |
1722 "function foo() { bar(); }", | 1717 "function foo() { bar(); }", |
1723 "asm: line 39: illegal comparison operator\n"); | 1718 "asm: line 1: illegal comparison operator\n"); |
1724 } | 1719 } |
1725 | 1720 |
1726 | 1721 |
1727 TEST(InstanceOf) { | 1722 TEST(InstanceOf) { |
1728 const char* errorMsg = FLAG_harmony_instanceof | 1723 const char* errorMsg = FLAG_harmony_instanceof |
1729 ? "asm: line 0: do-expression encountered\n" | 1724 ? "asm: line 0: do-expression encountered\n" |
1730 : "asm: line 39: illegal comparison operator\n"; | 1725 : "asm: line 1: illegal comparison operator\n"; |
1731 | 1726 |
1732 CHECK_FUNC_ERROR( | 1727 CHECK_FUNC_ERROR( |
1733 "function bar() { return (0 instanceof 0)|0; }\n" | 1728 "function bar() { return (0 instanceof 0)|0; }\n" |
1734 "function foo() { bar(); }", | 1729 "function foo() { bar(); }", |
1735 errorMsg); | 1730 errorMsg); |
1736 } | 1731 } |
1737 | 1732 |
1738 | 1733 |
1739 TEST(InOperator) { | 1734 TEST(InOperator) { |
1740 CHECK_FUNC_ERROR( | 1735 CHECK_FUNC_ERROR( |
1741 "function bar() { return (0 in 0)|0; }\n" | 1736 "function bar() { return (0 in 0)|0; }\n" |
1742 "function foo() { bar(); }", | 1737 "function foo() { bar(); }", |
1743 "asm: line 39: illegal comparison operator\n"); | 1738 "asm: line 1: illegal comparison operator\n"); |
1744 } | 1739 } |
1745 | 1740 |
1746 | 1741 |
1747 TEST(LogicalAndOperator) { | 1742 TEST(LogicalAndOperator) { |
1748 CHECK_FUNC_ERROR( | 1743 CHECK_FUNC_ERROR( |
1749 "function bar() { return (0 && 0)|0; }\n" | 1744 "function bar() { return (0 && 0)|0; }\n" |
1750 "function foo() { bar(); }", | 1745 "function foo() { bar(); }", |
1751 "asm: line 39: illegal logical operator\n"); | 1746 "asm: line 1: illegal logical operator\n"); |
1752 } | 1747 } |
1753 | 1748 |
1754 | 1749 |
1755 TEST(LogicalOrOperator) { | 1750 TEST(LogicalOrOperator) { |
1756 CHECK_FUNC_ERROR( | 1751 CHECK_FUNC_ERROR( |
1757 "function bar() { return (0 || 0)|0; }\n" | 1752 "function bar() { return (0 || 0)|0; }\n" |
1758 "function foo() { bar(); }", | 1753 "function foo() { bar(); }", |
1759 "asm: line 39: illegal logical operator\n"); | 1754 "asm: line 1: illegal logical operator\n"); |
1760 } | 1755 } |
1761 | 1756 |
1762 | 1757 |
1763 TEST(BadLiteral) { | 1758 TEST(BadLiteral) { |
1764 CHECK_FUNC_ERROR( | 1759 CHECK_FUNC_ERROR( |
1765 "function bar() { return true | 0; }\n" | 1760 "function bar() { return true | 0; }\n" |
1766 "function foo() { bar(); }", | 1761 "function foo() { bar(); }", |
1767 "asm: line 39: illegal literal\n"); | 1762 "asm: line 1: illegal literal\n"); |
1768 } | 1763 } |
1769 | 1764 |
1770 | 1765 |
1771 TEST(MismatchedReturnTypeLiteral) { | 1766 TEST(MismatchedReturnTypeLiteral) { |
1772 CHECK_FUNC_ERROR( | 1767 CHECK_FUNC_ERROR( |
1773 "function bar() { if(1) { return 1; } return 1.0; }\n" | 1768 "function bar() { if(1) { return 1; } return 1.0; }\n" |
1774 "function foo() { bar(); }", | 1769 "function foo() { bar(); }", |
1775 "asm: line 39: return type does not match function signature\n"); | 1770 "asm: line 1: return type does not match function signature\n"); |
1776 } | 1771 } |
1777 | 1772 |
1778 | 1773 |
1779 TEST(MismatchedReturnTypeExpression) { | 1774 TEST(MismatchedReturnTypeExpression) { |
1780 CHECK_FUNC_ERROR( | 1775 CHECK_FUNC_ERROR( |
1781 "function bar() {\n" | 1776 "function bar() {\n" |
1782 " var x = 1; var y = 1.0; if(1) { return x; } return +y; }\n" | 1777 " var x = 1; var y = 1.0; if(1) { return x; } return +y; }\n" |
1783 "function foo() { bar(); }", | 1778 "function foo() { bar(); }", |
1784 "asm: line 40: return type does not match function signature\n"); | 1779 "asm: line 2: return type does not match function signature\n"); |
1785 } | 1780 } |
1786 | 1781 |
1787 | 1782 |
1788 TEST(AssignToFloatishToF64) { | 1783 TEST(AssignToFloatishToF64) { |
1789 CHECK_FUNC_ERROR( | 1784 CHECK_FUNC_ERROR( |
1790 "function bar() { var v = fround(1.0); f64[0] = v + fround(1.0); }\n" | 1785 "function bar() { var v = fround(1.0); f64[0] = v + fround(1.0); }\n" |
1791 "function foo() { bar(); }", | 1786 "function foo() { bar(); }", |
1792 "asm: line 39: floatish assignment to double array\n"); | 1787 "asm: line 1: floatish assignment to double array\n"); |
1793 } | 1788 } |
1794 | 1789 |
1795 | 1790 |
1796 TEST(ForeignFunction) { | 1791 TEST(ForeignFunction) { |
1797 CHECK_FUNC_TYPES_BEGIN( | 1792 CHECK_FUNC_TYPES_BEGIN( |
1798 "var baz = foreign.baz;\n" | 1793 "var baz = foreign.baz;\n" |
1799 "function bar() { return baz(1, 2)|0; }\n" | 1794 "function bar() { return baz(1, 2)|0; }\n" |
1800 "function foo() { bar(); }") { | 1795 "function foo() { bar(); }") { |
1801 CHECK_EXPR(FunctionLiteral, FUNC_I_TYPE) { | 1796 CHECK_EXPR(FunctionLiteral, FUNC_I_TYPE) { |
1802 CHECK_EXPR(BinaryOperation, Bounds(cache.kAsmSigned)) { | 1797 CHECK_EXPR(BinaryOperation, Bounds(cache.kAsmSigned)) { |
(...skipping 48 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
1851 TEST(BadExports) { | 1846 TEST(BadExports) { |
1852 HARNESS_PREAMBLE() | 1847 HARNESS_PREAMBLE() |
1853 "function foo() {};\n" | 1848 "function foo() {};\n" |
1854 "return {foo: foo, bar: 1};" | 1849 "return {foo: foo, bar: 1};" |
1855 "}\n"; | 1850 "}\n"; |
1856 | 1851 |
1857 v8::V8::Initialize(); | 1852 v8::V8::Initialize(); |
1858 HandleAndZoneScope handles; | 1853 HandleAndZoneScope handles; |
1859 Zone* zone = handles.main_zone(); | 1854 Zone* zone = handles.main_zone(); |
1860 ZoneVector<ExpressionTypeEntry> types(zone); | 1855 ZoneVector<ExpressionTypeEntry> types(zone); |
1861 CHECK_EQ("asm: line 40: non-function in function table\n", | 1856 CHECK_EQ("asm: line 2: non-function in function table\n", |
1862 Validate(zone, test_function, &types)); | 1857 Validate(zone, test_function, &types)); |
1863 } | 1858 } |
1864 | 1859 |
1865 | 1860 |
1866 TEST(NestedHeapAssignment) { | 1861 TEST(NestedHeapAssignment) { |
1867 CHECK_FUNC_ERROR( | 1862 CHECK_FUNC_ERROR( |
1868 "function bar() { var x = 0; i16[x = 1] = 2; }\n" | 1863 "function bar() { var x = 0; i16[x = 1] = 2; }\n" |
1869 "function foo() { bar(); }", | 1864 "function foo() { bar(); }", |
1870 "asm: line 39: expected >> in heap access\n"); | 1865 "asm: line 1: expected >> in heap access\n"); |
1871 } | 1866 } |
1872 | 1867 |
1873 TEST(BadOperatorHeapAssignment) { | 1868 TEST(BadOperatorHeapAssignment) { |
1874 CHECK_FUNC_ERROR( | 1869 CHECK_FUNC_ERROR( |
1875 "function bar() { var x = 0; i16[x & 1] = 2; }\n" | 1870 "function bar() { var x = 0; i16[x & 1] = 2; }\n" |
1876 "function foo() { bar(); }", | 1871 "function foo() { bar(); }", |
1877 "asm: line 39: expected >> in heap access\n"); | 1872 "asm: line 1: expected >> in heap access\n"); |
1878 } | 1873 } |
1879 | 1874 |
1880 | 1875 |
1881 TEST(BadArrayAssignment) { | 1876 TEST(BadArrayAssignment) { |
1882 CHECK_FUNC_ERROR( | 1877 CHECK_FUNC_ERROR( |
1883 "function bar() { i8[0] = 0.0; }\n" | 1878 "function bar() { i8[0] = 0.0; }\n" |
1884 "function foo() { bar(); }", | 1879 "function foo() { bar(); }", |
1885 "asm: line 39: illegal type in assignment\n"); | 1880 "asm: line 1: illegal type in assignment\n"); |
1886 } | 1881 } |
1887 | 1882 |
1888 | 1883 |
1889 TEST(BadStandardFunctionCallOutside) { | 1884 TEST(BadStandardFunctionCallOutside) { |
1890 CHECK_FUNC_ERROR( | 1885 CHECK_FUNC_ERROR( |
1891 "var s0 = sin(0);\n" | 1886 "var s0 = sin(0);\n" |
1892 "function bar() { }\n" | 1887 "function bar() { }\n" |
1893 "function foo() { bar(); }", | 1888 "function foo() { bar(); }", |
1894 "asm: line 39: illegal variable reference in module body\n"); | 1889 "asm: line 1: illegal variable reference in module body\n"); |
1895 } | 1890 } |
1896 | 1891 |
1897 | 1892 |
1898 TEST(BadFunctionCallOutside) { | 1893 TEST(BadFunctionCallOutside) { |
1899 CHECK_FUNC_ERROR( | 1894 CHECK_FUNC_ERROR( |
1900 "function bar() { return 0.0; }\n" | 1895 "function bar() { return 0.0; }\n" |
1901 "var s0 = bar(0);\n" | 1896 "var s0 = bar(0);\n" |
1902 "function foo() { bar(); }", | 1897 "function foo() { bar(); }", |
1903 "asm: line 40: illegal variable reference in module body\n"); | 1898 "asm: line 2: illegal variable reference in module body\n"); |
1904 } | 1899 } |
1905 | 1900 |
1906 | 1901 |
1907 TEST(NestedVariableAssignment) { | 1902 TEST(NestedVariableAssignment) { |
1908 CHECK_FUNC_TYPES_BEGIN( | 1903 CHECK_FUNC_TYPES_BEGIN( |
1909 "function bar() { var x = 0; x = x = 4; }\n" | 1904 "function bar() { var x = 0; x = x = 4; }\n" |
1910 "function foo() { bar(); }") { | 1905 "function foo() { bar(); }") { |
1911 CHECK_EXPR(FunctionLiteral, FUNC_V_TYPE) { | 1906 CHECK_EXPR(FunctionLiteral, FUNC_V_TYPE) { |
1912 CHECK_EXPR(Assignment, Bounds(cache.kAsmInt)) { | 1907 CHECK_EXPR(Assignment, Bounds(cache.kAsmInt)) { |
1913 CHECK_VAR(x, Bounds(cache.kAsmInt)); | 1908 CHECK_VAR(x, Bounds(cache.kAsmInt)); |
(...skipping 238 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
2152 CHECK_SKIP(); | 2147 CHECK_SKIP(); |
2153 } | 2148 } |
2154 CHECK_FUNC_TYPES_END | 2149 CHECK_FUNC_TYPES_END |
2155 } | 2150 } |
2156 | 2151 |
2157 | 2152 |
2158 TEST(BadSwitchRange) { | 2153 TEST(BadSwitchRange) { |
2159 CHECK_FUNC_ERROR( | 2154 CHECK_FUNC_ERROR( |
2160 "function bar() { switch (1) { case -1: case 0x7fffffff: } }\n" | 2155 "function bar() { switch (1) { case -1: case 0x7fffffff: } }\n" |
2161 "function foo() { bar(); }", | 2156 "function foo() { bar(); }", |
2162 "asm: line 39: case range too large\n"); | 2157 "asm: line 1: case range too large\n"); |
2163 } | 2158 } |
2164 | 2159 |
2165 | 2160 |
2166 TEST(DuplicateSwitchCase) { | 2161 TEST(DuplicateSwitchCase) { |
2167 CHECK_FUNC_ERROR( | 2162 CHECK_FUNC_ERROR( |
2168 "function bar() { switch (1) { case 0: case 0: } }\n" | 2163 "function bar() { switch (1) { case 0: case 0: } }\n" |
2169 "function foo() { bar(); }", | 2164 "function foo() { bar(); }", |
2170 "asm: line 39: duplicate case value\n"); | 2165 "asm: line 1: duplicate case value\n"); |
2171 } | 2166 } |
2172 | 2167 |
2173 | 2168 |
2174 TEST(BadSwitchOrder) { | 2169 TEST(BadSwitchOrder) { |
2175 CHECK_FUNC_ERROR( | 2170 CHECK_FUNC_ERROR( |
2176 "function bar() { switch (1) { default: case 0: } }\n" | 2171 "function bar() { switch (1) { default: case 0: } }\n" |
2177 "function foo() { bar(); }", | 2172 "function foo() { bar(); }", |
2178 "asm: line 39: default case out of order\n"); | 2173 "asm: line 1: default case out of order\n"); |
2179 } | 2174 } |
2180 | 2175 |
2181 TEST(BadForeignCall) { | 2176 TEST(BadForeignCall) { |
2182 const char test_function[] = | 2177 const char test_function[] = |
2183 "function TestModule(stdlib, foreign, buffer) {\n" | 2178 "function TestModule(stdlib, foreign, buffer) {\n" |
2184 " \"use asm\";\n" | 2179 " \"use asm\";\n" |
2185 " var ffunc = foreign.foo;\n" | 2180 " var ffunc = foreign.foo;\n" |
2186 " function test1() { var x = 0; ffunc(x); }\n" | 2181 " function test1() { var x = 0; ffunc(x); }\n" |
2187 " return { testFunc1: test1 };\n" | 2182 " return { testFunc1: test1 };\n" |
2188 "}\n"; | 2183 "}\n"; |
(...skipping 220 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
2409 CHECK_EXPR(BinaryOperation, Bounds(cache.kAsmDouble)) { | 2404 CHECK_EXPR(BinaryOperation, Bounds(cache.kAsmDouble)) { |
2410 CHECK_VAR(x, Bounds(cache.kAsmDouble)); | 2405 CHECK_VAR(x, Bounds(cache.kAsmDouble)); |
2411 CHECK_EXPR(Literal, Bounds(cache.kAsmDouble)); | 2406 CHECK_EXPR(Literal, Bounds(cache.kAsmDouble)); |
2412 } | 2407 } |
2413 } | 2408 } |
2414 } | 2409 } |
2415 CHECK_SKIP(); | 2410 CHECK_SKIP(); |
2416 } | 2411 } |
2417 CHECK_FUNC_TYPES_END | 2412 CHECK_FUNC_TYPES_END |
2418 } | 2413 } |
OLD | NEW |