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

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

Issue 1353723002: [runtime] Initial step towards switching Execution::Call to callable. (Closed) Base URL: https://chromium.googlesource.com/v8/v8.git@master
Patch Set: Handle sloppy mode api functions correctly. Created 5 years, 3 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/compiler/test-simplified-lowering.cc ('k') | no next file » | 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"
11 #include "test/cctest/cctest.h" 11 #include "test/cctest/cctest.h"
12 12
13 namespace v8 { 13 namespace v8 {
14 namespace internal { 14 namespace internal {
15 namespace interpreter { 15 namespace interpreter {
16 16
17 17
18 static MaybeHandle<Object> CallInterpreter(Isolate* isolate, 18 static MaybeHandle<Object> CallInterpreter(Isolate* isolate,
19 Handle<JSFunction> function) { 19 Handle<JSFunction> function) {
20 return Execution::Call(isolate, function, 20 return Execution::Call(isolate, function,
21 isolate->factory()->undefined_value(), 0, nullptr, 21 isolate->factory()->undefined_value(), 0, nullptr);
22 false);
23 } 22 }
24 23
25 24
26 template <class... A> 25 template <class... A>
27 static MaybeHandle<Object> CallInterpreter(Isolate* isolate, 26 static MaybeHandle<Object> CallInterpreter(Isolate* isolate,
28 Handle<JSFunction> function, 27 Handle<JSFunction> function,
29 A... args) { 28 A... args) {
30 Handle<Object> argv[] = { args... }; 29 Handle<Object> argv[] = { args... };
31 return Execution::Call(isolate, function, 30 return Execution::Call(isolate, function,
32 isolate->factory()->undefined_value(), sizeof...(args), 31 isolate->factory()->undefined_value(), sizeof...(args),
33 argv, false); 32 argv);
34 } 33 }
35 34
36 35
37 template <class... A> 36 template <class... A>
38 class InterpreterCallable { 37 class InterpreterCallable {
39 public: 38 public:
40 InterpreterCallable(Isolate* isolate, Handle<JSFunction> function) 39 InterpreterCallable(Isolate* isolate, Handle<JSFunction> function)
41 : isolate_(isolate), function_(function) {} 40 : isolate_(isolate), function_(function) {}
42 virtual ~InterpreterCallable() {} 41 virtual ~InterpreterCallable() {}
43 42
(...skipping 754 matching lines...) Expand 10 before | Expand all | Expand 10 after
798 " this.func = function(a, b, c, d, e, f, g, h, i, j) {" 797 " this.func = function(a, b, c, d, e, f, g, h, i, j) {"
799 " return this.prefix + a + b + c + d + e + f + g + h + i + j;" 798 " return this.prefix + a + b + c + d + e + f + g + h + i + j;"
800 " }" 799 " }"
801 "})()"); 800 "})()");
802 Handle<Object> return_val = callable(object).ToHandleChecked(); 801 Handle<Object> return_val = callable(object).ToHandleChecked();
803 Handle<i::String> expected = 802 Handle<i::String> expected =
804 factory->NewStringFromAsciiChecked("prefix_abcdefghij"); 803 factory->NewStringFromAsciiChecked("prefix_abcdefghij");
805 CHECK(i::String::cast(*return_val)->Equals(*expected)); 804 CHECK(i::String::cast(*return_val)->Equals(*expected));
806 } 805 }
807 } 806 }
OLDNEW
« no previous file with comments | « test/cctest/compiler/test-simplified-lowering.cc ('k') | no next file » | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698