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/interpreter/interpreter-intrinsics.h" | 7 #include "src/interpreter/interpreter-intrinsics.h" |
8 #include "test/cctest/interpreter/interpreter-tester.h" | 8 #include "test/cctest/interpreter/interpreter-tester.h" |
9 | 9 |
10 namespace v8 { | 10 namespace v8 { |
(...skipping 10 matching lines...) Expand all Loading... |
21 zone_(zone), | 21 zone_(zone), |
22 factory_(isolate->factory()), | 22 factory_(isolate->factory()), |
23 function_id_(function_id) {} | 23 function_id_(function_id) {} |
24 | 24 |
25 template <class... A> | 25 template <class... A> |
26 Handle<Object> Invoke(A... args) { | 26 Handle<Object> Invoke(A... args) { |
27 CHECK(IntrinsicsHelper::IsSupported(function_id_)); | 27 CHECK(IntrinsicsHelper::IsSupported(function_id_)); |
28 BytecodeArrayBuilder builder(isolate_, zone_, sizeof...(args), 0, 0); | 28 BytecodeArrayBuilder builder(isolate_, zone_, sizeof...(args), 0, 0); |
29 builder.CallRuntime(function_id_, builder.Parameter(0), sizeof...(args)) | 29 builder.CallRuntime(function_id_, builder.Parameter(0), sizeof...(args)) |
30 .Return(); | 30 .Return(); |
31 InterpreterTester tester(isolate_, builder.ToBytecodeArray()); | 31 InterpreterTester tester(isolate_, builder.ToBytecodeArray(isolate_)); |
32 auto callable = tester.GetCallable<A...>(); | 32 auto callable = tester.GetCallable<A...>(); |
33 return callable(args...).ToHandleChecked(); | 33 return callable(args...).ToHandleChecked(); |
34 } | 34 } |
35 | 35 |
36 Handle<Object> NewObject(const char* script) { | 36 Handle<Object> NewObject(const char* script) { |
37 return v8::Utils::OpenHandle(*CompileRun(script)); | 37 return v8::Utils::OpenHandle(*CompileRun(script)); |
38 } | 38 } |
39 | 39 |
40 Handle<Object> Undefined() { return factory_->undefined_value(); } | 40 Handle<Object> Undefined() { return factory_->undefined_value(); } |
41 Handle<Object> Null() { return factory_->null_value(); } | 41 Handle<Object> Null() { return factory_->null_value(); } |
(...skipping 242 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
284 ->SameValue(*helper.NewObject("'Date'"))); | 284 ->SameValue(*helper.NewObject("'Date'"))); |
285 CHECK(helper.Invoke(helper.NewObject("new Set")) | 285 CHECK(helper.Invoke(helper.NewObject("new Set")) |
286 ->SameValue(*helper.NewObject("'Set'"))); | 286 ->SameValue(*helper.NewObject("'Set'"))); |
287 CHECK(helper.Invoke(helper.NewObject("/x/")) | 287 CHECK(helper.Invoke(helper.NewObject("/x/")) |
288 ->SameValue(*helper.NewObject("'RegExp'"))); | 288 ->SameValue(*helper.NewObject("'RegExp'"))); |
289 } | 289 } |
290 | 290 |
291 } // namespace interpreter | 291 } // namespace interpreter |
292 } // namespace internal | 292 } // namespace internal |
293 } // namespace v8 | 293 } // namespace v8 |
OLD | NEW |