| 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 <fstream> | 5 #include <fstream> |
| 6 | 6 |
| 7 #include "src/v8.h" | 7 #include "src/v8.h" |
| 8 | 8 |
| 9 #include "src/interpreter/bytecode-array-iterator.h" | 9 #include "src/interpreter/bytecode-array-iterator.h" |
| 10 #include "src/interpreter/bytecode-generator.h" | 10 #include "src/interpreter/bytecode-generator.h" |
| (...skipping 2325 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 2336 " constructor(...args) { super(1, ...args, 1); }\n" | 2336 " constructor(...args) { super(1, ...args, 1); }\n" |
| 2337 " }\n" | 2337 " }\n" |
| 2338 " test = new B(1, 2, 3).constructor;\n" | 2338 " test = new B(1, 2, 3).constructor;\n" |
| 2339 "})();\n", | 2339 "})();\n", |
| 2340 }; | 2340 }; |
| 2341 | 2341 |
| 2342 CHECK(CompareTexts(BuildActual(printer, snippets), | 2342 CHECK(CompareTexts(BuildActual(printer, snippets), |
| 2343 LoadGolden("SuperCallAndSpread.golden"))); | 2343 LoadGolden("SuperCallAndSpread.golden"))); |
| 2344 } | 2344 } |
| 2345 | 2345 |
| 2346 TEST(CallAndSpread) { | |
| 2347 InitializedIgnitionHandleScope scope; | |
| 2348 BytecodeExpectationsPrinter printer(CcTest::isolate()); | |
| 2349 const char* snippets[] = {"Math.max(...[1, 2, 3]);\n", | |
| 2350 "Math.max(0, ...[1, 2, 3]);\n", | |
| 2351 "Math.max(0, ...[1, 2, 3], 4);\n"}; | |
| 2352 | |
| 2353 CHECK(CompareTexts(BuildActual(printer, snippets), | |
| 2354 LoadGolden("CallAndSpread.golden"))); | |
| 2355 } | |
| 2356 | |
| 2357 TEST(NewAndSpread) { | |
| 2358 InitializedIgnitionHandleScope scope; | |
| 2359 BytecodeExpectationsPrinter printer(CcTest::isolate()); | |
| 2360 const char* snippets[] = { | |
| 2361 "class A { constructor(...args) { this.args = args; } }\n" | |
| 2362 "new A(...[1, 2, 3]);\n", | |
| 2363 | |
| 2364 "class A { constructor(...args) { this.args = args; } }\n" | |
| 2365 "new A(0, ...[1, 2, 3]);\n", | |
| 2366 | |
| 2367 "class A { constructor(...args) { this.args = args; } }\n" | |
| 2368 "new A(0, ...[1, 2, 3], 4);\n"}; | |
| 2369 | |
| 2370 CHECK(CompareTexts(BuildActual(printer, snippets), | |
| 2371 LoadGolden("NewAndSpread.golden"))); | |
| 2372 } | |
| 2373 | |
| 2374 } // namespace interpreter | 2346 } // namespace interpreter |
| 2375 } // namespace internal | 2347 } // namespace internal |
| 2376 } // namespace v8 | 2348 } // namespace v8 |
| OLD | NEW |