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

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

Issue 2369873002: [Interpreter] Replace BytecodeRegisterAllocator with a simple bump pointer. (Closed)
Patch Set: Rebase Created 4 years, 2 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
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/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 {
11 namespace internal { 11 namespace internal {
12 namespace interpreter { 12 namespace interpreter {
13 13
14 namespace { 14 namespace {
15 15
16 class InvokeIntrinsicHelper { 16 class InvokeIntrinsicHelper {
17 public: 17 public:
18 InvokeIntrinsicHelper(Isolate* isolate, Zone* zone, 18 InvokeIntrinsicHelper(Isolate* isolate, Zone* zone,
19 Runtime::FunctionId function_id) 19 Runtime::FunctionId function_id)
20 : isolate_(isolate), 20 : isolate_(isolate),
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 RegisterList reg_list(builder.Parameter(0).index(), sizeof...(args));
30 .Return(); 30 builder.CallRuntime(function_id_, reg_list).Return();
31 InterpreterTester tester(isolate_, builder.ToBytecodeArray(isolate_)); 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(); }
(...skipping 243 matching lines...) Expand 10 before | Expand all | Expand 10 after
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
OLDNEW
« no previous file with comments | « test/cctest/interpreter/test-interpreter.cc ('k') | test/unittests/interpreter/bytecode-array-builder-unittest.cc » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698