| 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/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); |
| 22 } | 23 } |
| 23 | 24 |
| 24 | 25 |
| 25 template <class... A> | 26 template <class... A> |
| 26 static MaybeHandle<Object> CallInterpreter(Isolate* isolate, | 27 static MaybeHandle<Object> CallInterpreter(Isolate* isolate, |
| 27 Handle<JSFunction> function, | 28 Handle<JSFunction> function, |
| 28 A... args) { | 29 A... args) { |
| 29 Handle<Object> argv[] = { args... }; | 30 Handle<Object> argv[] = { args... }; |
| 30 return Execution::Call(isolate, function, | 31 return Execution::Call(isolate, function, |
| 31 isolate->factory()->undefined_value(), sizeof...(args), | 32 isolate->factory()->undefined_value(), sizeof...(args), |
| 32 argv); | 33 argv, false); |
| 33 } | 34 } |
| 34 | 35 |
| 35 | 36 |
| 36 template <class... A> | 37 template <class... A> |
| 37 class InterpreterCallable { | 38 class InterpreterCallable { |
| 38 public: | 39 public: |
| 39 InterpreterCallable(Isolate* isolate, Handle<JSFunction> function) | 40 InterpreterCallable(Isolate* isolate, Handle<JSFunction> function) |
| 40 : isolate_(isolate), function_(function) {} | 41 : isolate_(isolate), function_(function) {} |
| 41 virtual ~InterpreterCallable() {} | 42 virtual ~InterpreterCallable() {} |
| 42 | 43 |
| (...skipping 754 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 797 " this.func = function(a, b, c, d, e, f, g, h, i, j) {" | 798 " this.func = function(a, b, c, d, e, f, g, h, i, j) {" |
| 798 " return this.prefix + a + b + c + d + e + f + g + h + i + j;" | 799 " return this.prefix + a + b + c + d + e + f + g + h + i + j;" |
| 799 " }" | 800 " }" |
| 800 "})()"); | 801 "})()"); |
| 801 Handle<Object> return_val = callable(object).ToHandleChecked(); | 802 Handle<Object> return_val = callable(object).ToHandleChecked(); |
| 802 Handle<i::String> expected = | 803 Handle<i::String> expected = |
| 803 factory->NewStringFromAsciiChecked("prefix_abcdefghij"); | 804 factory->NewStringFromAsciiChecked("prefix_abcdefghij"); |
| 804 CHECK(i::String::cast(*return_val)->Equals(*expected)); | 805 CHECK(i::String::cast(*return_val)->Equals(*expected)); |
| 805 } | 806 } |
| 806 } | 807 } |
| OLD | NEW |