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 291 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... | |
302 // return { geometricMean: geometricMean }; | 302 // return { geometricMean: geometricMean }; |
303 CHECK_EXPR(ObjectLiteral, Bounds::Unbounded()) { | 303 CHECK_EXPR(ObjectLiteral, Bounds::Unbounded()) { |
304 CHECK_VAR(geometricMean, FUNC_II2D_TYPE); | 304 CHECK_VAR(geometricMean, FUNC_II2D_TYPE); |
305 } | 305 } |
306 } | 306 } |
307 } | 307 } |
308 CHECK_TYPES_END | 308 CHECK_TYPES_END |
309 } | 309 } |
310 | 310 |
311 | 311 |
312 TEST(MissingUseAsm) { | |
313 const char test_function[] = | |
314 "function foo() {\n" | |
315 " function bar() {}\n" | |
316 " return { bar: bar };\n" | |
317 "}\n"; | |
318 v8::V8::Initialize(); | |
319 HandleAndZoneScope handles; | |
320 Zone* zone = handles.main_zone(); | |
321 ZoneVector<ExpressionTypeEntry> types(zone); | |
322 CHECK_EQ("asm: line 1: missing \"use asm\"\n", | |
323 Validate(zone, test_function, &types)); | |
324 } | |
325 | |
326 | |
327 TEST(WrongUseAsm) { | |
328 const char test_function[] = | |
329 "function foo() {\n" | |
330 " \"use wasm\"\n" | |
331 " function bar() {}\n" | |
332 " return { bar: bar };\n" | |
333 "}\n"; | |
334 v8::V8::Initialize(); | |
335 HandleAndZoneScope handles; | |
336 Zone* zone = handles.main_zone(); | |
337 ZoneVector<ExpressionTypeEntry> types(zone); | |
338 CHECK_EQ("asm: line 1: missing \"use asm\"\n", | |
339 Validate(zone, test_function, &types)); | |
340 } | |
341 | |
342 | |
343 TEST(MissingReturnExports) { | |
aseemgarg
2016/01/08 22:30:56
Is this correct? Although useless, it is not clear
bradn
2016/01/09 01:05:53
Actually it does seem to require a ValidateExports
| |
344 const char test_function[] = | |
345 "function foo() {\n" | |
346 " \"use asm\"\n" | |
347 " function bar() {}\n" | |
348 "}\n"; | |
349 v8::V8::Initialize(); | |
350 HandleAndZoneScope handles; | |
351 Zone* zone = handles.main_zone(); | |
352 ZoneVector<ExpressionTypeEntry> types(zone); | |
353 CHECK_EQ("asm: line 2: last statement in module is not a return\n", | |
354 Validate(zone, test_function, &types)); | |
355 } | |
356 | |
357 | |
312 #define HARNESS_STDLIB() \ | 358 #define HARNESS_STDLIB() \ |
313 "var Infinity = stdlib.Infinity;\n" \ | 359 "var Infinity = stdlib.Infinity;\n" \ |
314 "var NaN = stdlib.NaN;\n" \ | 360 "var NaN = stdlib.NaN;\n" \ |
315 "var acos = stdlib.Math.acos;\n" \ | 361 "var acos = stdlib.Math.acos;\n" \ |
316 "var asin = stdlib.Math.asin;\n" \ | 362 "var asin = stdlib.Math.asin;\n" \ |
317 "var atan = stdlib.Math.atan;\n" \ | 363 "var atan = stdlib.Math.atan;\n" \ |
318 "var cos = stdlib.Math.cos;\n" \ | 364 "var cos = stdlib.Math.cos;\n" \ |
319 "var sin = stdlib.Math.sin;\n" \ | 365 "var sin = stdlib.Math.sin;\n" \ |
320 "var tan = stdlib.Math.tan;\n" \ | 366 "var tan = stdlib.Math.tan;\n" \ |
321 "var exp = stdlib.Math.exp;\n" \ | 367 "var exp = stdlib.Math.exp;\n" \ |
(...skipping 1603 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... | |
1925 CHECK(!cache.kAsmFloat->Is(cache.kAsmFixnum)); | 1971 CHECK(!cache.kAsmFloat->Is(cache.kAsmFixnum)); |
1926 CHECK(!cache.kAsmFloat->Is(cache.kAsmDouble)); | 1972 CHECK(!cache.kAsmFloat->Is(cache.kAsmDouble)); |
1927 | 1973 |
1928 CHECK(cache.kAsmDouble->Is(cache.kAsmDouble)); | 1974 CHECK(cache.kAsmDouble->Is(cache.kAsmDouble)); |
1929 CHECK(!cache.kAsmDouble->Is(cache.kAsmInt)); | 1975 CHECK(!cache.kAsmDouble->Is(cache.kAsmInt)); |
1930 CHECK(!cache.kAsmDouble->Is(cache.kAsmUnsigned)); | 1976 CHECK(!cache.kAsmDouble->Is(cache.kAsmUnsigned)); |
1931 CHECK(!cache.kAsmDouble->Is(cache.kAsmSigned)); | 1977 CHECK(!cache.kAsmDouble->Is(cache.kAsmSigned)); |
1932 CHECK(!cache.kAsmDouble->Is(cache.kAsmFixnum)); | 1978 CHECK(!cache.kAsmDouble->Is(cache.kAsmFixnum)); |
1933 CHECK(!cache.kAsmDouble->Is(cache.kAsmFloat)); | 1979 CHECK(!cache.kAsmDouble->Is(cache.kAsmFloat)); |
1934 } | 1980 } |
OLD | NEW |