Chromium Code Reviews
chromiumcodereview-hr@appspot.gserviceaccount.com (chromiumcodereview-hr) | Please choose your nickname with Settings | Help | Chromium Project | Gerrit Changes | Sign out
(1221)

Side by Side Diff: test/cctest/interpreter/test-interpreter.cc

Issue 1664593003: [Interpreter] Adds support for rest parameters to interpreter. (Closed) Base URL: https://chromium.googlesource.com/v8/v8.git@master
Patch Set: Fixes comments. Created 4 years, 10 months ago
Use n/p to move between diff chunks; N/P to move between comments. Draft comments are only viewable by you.
Jump to:
View unified diff | Download patch
« no previous file with comments | « test/cctest/interpreter/test-bytecode-generator.cc ('k') | test/test262/test262.status » ('j') | no next file with comments »
Toggle Intra-line Diffs ('i') | Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
OLDNEW
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/execution.h" 7 #include "src/execution.h"
8 #include "src/handles.h" 8 #include "src/handles.h"
9 #include "src/interpreter/bytecode-array-builder.h" 9 #include "src/interpreter/bytecode-array-builder.h"
10 #include "src/interpreter/interpreter.h" 10 #include "src/interpreter/interpreter.h"
(...skipping 2279 matching lines...) Expand 10 before | Expand all | Expand 10 after
2290 std::make_pair("function f(a, b, c, d) {" 2290 std::make_pair("function f(a, b, c, d) {"
2291 "'use strict'; return arguments[2]; }", 2291 "'use strict'; return arguments[2]; }",
2292 2), 2292 2),
2293 // Check arguments are mapped in sloppy mode and unmapped in strict. 2293 // Check arguments are mapped in sloppy mode and unmapped in strict.
2294 std::make_pair("function f(a, b, c, d) {" 2294 std::make_pair("function f(a, b, c, d) {"
2295 " c = b; return arguments[2]; }", 2295 " c = b; return arguments[2]; }",
2296 1), 2296 1),
2297 std::make_pair("function f(a, b, c, d) {" 2297 std::make_pair("function f(a, b, c, d) {"
2298 " 'use strict'; c = b; return arguments[2]; }", 2298 " 'use strict'; c = b; return arguments[2]; }",
2299 2), 2299 2),
2300 // check rest parameters
2301 std::make_pair("function f(...restArray) { return restArray[0]; }", 0),
2302 std::make_pair("function f(a, ...restArray) { return restArray[0]; }", 1),
2303 std::make_pair("function f(a, ...restArray) { return arguments[0]; }", 0),
2304 std::make_pair("function f(a, ...restArray) { return arguments[1]; }", 1),
2305 std::make_pair("function f(a, ...restArray) { return restArray[1]; }", 2),
2306 std::make_pair("function f(a, ...arguments) { return arguments[0]; }", 1),
2307 std::make_pair("function f(a, b, ...restArray) { return restArray[0]; }",
2308 2),
2300 }; 2309 };
2301 2310
2302 // Test passing no arguments. 2311 // Test passing no arguments.
2303 for (size_t i = 0; i < arraysize(create_args); i++) { 2312 for (size_t i = 0; i < arraysize(create_args); i++) {
2304 InterpreterTester tester(handles.main_isolate(), create_args[i].first); 2313 InterpreterTester tester(handles.main_isolate(), create_args[i].first);
2305 auto callable = tester.GetCallable<>(); 2314 auto callable = tester.GetCallable<>();
2306 Handle<Object> return_val = callable().ToHandleChecked(); 2315 Handle<Object> return_val = callable().ToHandleChecked();
2307 CHECK(return_val.is_identical_to(factory->undefined_value())); 2316 CHECK(return_val.is_identical_to(factory->undefined_value()));
2308 } 2317 }
2309 2318
(...skipping 1520 matching lines...) Expand 10 before | Expand all | Expand 10 after
3830 Handle<i::Object> return_value = callable().ToHandleChecked(); 3839 Handle<i::Object> return_value = callable().ToHandleChecked();
3831 CHECK(return_value->SameValue(*do_expr[i].second)); 3840 CHECK(return_value->SameValue(*do_expr[i].second));
3832 } 3841 }
3833 3842
3834 FLAG_harmony_do_expressions = old_flag; 3843 FLAG_harmony_do_expressions = old_flag;
3835 } 3844 }
3836 3845
3837 } // namespace interpreter 3846 } // namespace interpreter
3838 } // namespace internal 3847 } // namespace internal
3839 } // namespace v8 3848 } // namespace v8
OLDNEW
« no previous file with comments | « test/cctest/interpreter/test-bytecode-generator.cc ('k') | test/test262/test262.status » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698