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

Side by Side Diff: test/unittests/compiler/interpreter-assembler-unittest.cc

Issue 1362383002: [Interpreter] Add CallRuntime support to the interpreter. (Closed) Base URL: https://chromium.googlesource.com/v8/v8.git@master
Patch Set: Move function address calculation into bytecode handler and have an option on CEntry stub for argv_… Created 5 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 "test/unittests/compiler/interpreter-assembler-unittest.h" 5 #include "test/unittests/compiler/interpreter-assembler-unittest.h"
6 6
7 #include "src/code-factory.h" 7 #include "src/code-factory.h"
8 #include "src/compiler/graph.h" 8 #include "src/compiler/graph.h"
9 #include "src/compiler/node.h" 9 #include "src/compiler/node.h"
10 #include "src/interface-descriptors.h" 10 #include "src/interface-descriptors.h"
(...skipping 458 matching lines...) Expand 10 before | Expand all | Expand 10 after
469 Node* object = m.IntPtrConstant(0xdeadbeef); 469 Node* object = m.IntPtrConstant(0xdeadbeef);
470 int offset = 16; 470 int offset = 16;
471 Node* load_field = m.LoadObjectField(object, offset); 471 Node* load_field = m.LoadObjectField(object, offset);
472 EXPECT_THAT(load_field, 472 EXPECT_THAT(load_field,
473 m.IsLoad(kMachAnyTagged, object, 473 m.IsLoad(kMachAnyTagged, object,
474 IsIntPtrConstant(offset - kHeapObjectTag))); 474 IsIntPtrConstant(offset - kHeapObjectTag)));
475 } 475 }
476 } 476 }
477 477
478 478
479 TARGET_TEST_F(InterpreterAssemblerTest, CallRuntime) { 479 TARGET_TEST_F(InterpreterAssemblerTest, CallRuntime2) {
480 TRACED_FOREACH(interpreter::Bytecode, bytecode, kBytecodes) { 480 TRACED_FOREACH(interpreter::Bytecode, bytecode, kBytecodes) {
481 InterpreterAssemblerForTest m(this, bytecode); 481 InterpreterAssemblerForTest m(this, bytecode);
482 Node* arg1 = m.Int32Constant(2); 482 Node* arg1 = m.Int32Constant(2);
483 Node* arg2 = m.Int32Constant(3); 483 Node* arg2 = m.Int32Constant(3);
484 Node* call_runtime = m.CallRuntime(Runtime::kAdd, arg1, arg2); 484 Node* call_runtime = m.CallRuntime(Runtime::kAdd, arg1, arg2);
485 EXPECT_THAT(call_runtime, 485 EXPECT_THAT(call_runtime,
486 m.IsCall(_, _, arg1, arg2, _, IsInt32Constant(2), 486 m.IsCall(_, _, arg1, arg2, _, IsInt32Constant(2),
487 IsParameter(Linkage::kInterpreterContextParameter))); 487 IsParameter(Linkage::kInterpreterContextParameter)));
488 } 488 }
489 } 489 }
490 490
491 491
492 TARGET_TEST_F(InterpreterAssemblerTest, CallRuntime) {
493 TRACED_FOREACH(interpreter::Bytecode, bytecode, kBytecodes) {
494 InterpreterAssemblerForTest m(this, bytecode);
495 Callable builtin = CodeFactory::InterpreterCEntry(isolate());
496
497 Node* function_id = m.Int32Constant(0);
498 Node* first_arg = m.Int32Constant(1);
499 Node* arg_count = m.Int32Constant(2);
500
501 Matcher<Node*> function_table = IsExternalConstant(
502 ExternalReference::runtime_function_table_address(isolate()));
503 Matcher<Node*> function = IsIntPtrAdd(
504 function_table,
505 IsInt32Mul(function_id, IsInt32Constant(sizeof(Runtime::Function))));
506 Matcher<Node*> function_entry =
507 m.IsLoad(kMachPtr, function,
508 IsInt32Constant(offsetof(Runtime::Function, entry)));
509
510 Node* call_runtime = m.CallRuntime(function_id, first_arg, arg_count);
511 EXPECT_THAT(call_runtime,
512 m.IsCall(_, IsHeapConstant(builtin.code()), arg_count,
513 first_arg, function_entry,
514 IsParameter(Linkage::kInterpreterContextParameter)));
515 }
516 }
517
518
492 TARGET_TEST_F(InterpreterAssemblerTest, CallIC) { 519 TARGET_TEST_F(InterpreterAssemblerTest, CallIC) {
493 TRACED_FOREACH(interpreter::Bytecode, bytecode, kBytecodes) { 520 TRACED_FOREACH(interpreter::Bytecode, bytecode, kBytecodes) {
494 InterpreterAssemblerForTest m(this, bytecode); 521 InterpreterAssemblerForTest m(this, bytecode);
495 LoadWithVectorDescriptor descriptor(isolate()); 522 LoadWithVectorDescriptor descriptor(isolate());
496 Node* target = m.Int32Constant(1); 523 Node* target = m.Int32Constant(1);
497 Node* arg1 = m.Int32Constant(2); 524 Node* arg1 = m.Int32Constant(2);
498 Node* arg2 = m.Int32Constant(3); 525 Node* arg2 = m.Int32Constant(3);
499 Node* arg3 = m.Int32Constant(4); 526 Node* arg3 = m.Int32Constant(4);
500 Node* arg4 = m.Int32Constant(5); 527 Node* arg4 = m.Int32Constant(5);
501 Node* call_ic = m.CallIC(descriptor, target, arg1, arg2, arg3, arg4); 528 Node* call_ic = m.CallIC(descriptor, target, arg1, arg2, arg3, arg4);
502 EXPECT_THAT(call_ic, 529 EXPECT_THAT(call_ic,
503 m.IsCall(_, target, arg1, arg2, arg3, arg4, 530 m.IsCall(_, target, arg1, arg2, arg3, arg4,
504 IsParameter(Linkage::kInterpreterContextParameter))); 531 IsParameter(Linkage::kInterpreterContextParameter)));
505 } 532 }
506 } 533 }
507 534
508 535
509 TARGET_TEST_F(InterpreterAssemblerTest, CallJS) { 536 TARGET_TEST_F(InterpreterAssemblerTest, CallJS) {
510 TRACED_FOREACH(interpreter::Bytecode, bytecode, kBytecodes) { 537 TRACED_FOREACH(interpreter::Bytecode, bytecode, kBytecodes) {
511 InterpreterAssemblerForTest m(this, bytecode); 538 InterpreterAssemblerForTest m(this, bytecode);
512 Callable builtin = CodeFactory::PushArgsAndCall(isolate()); 539 Callable builtin = CodeFactory::InterpreterPushArgsAndCall(isolate());
513 Node* function = m.Int32Constant(0); 540 Node* function = m.Int32Constant(0);
514 Node* first_arg = m.Int32Constant(1); 541 Node* first_arg = m.Int32Constant(1);
515 Node* arg_count = m.Int32Constant(2); 542 Node* arg_count = m.Int32Constant(2);
516 Node* call_js = m.CallJS(function, first_arg, arg_count); 543 Node* call_js = m.CallJS(function, first_arg, arg_count);
517 EXPECT_THAT( 544 EXPECT_THAT(
518 call_js, 545 call_js,
519 m.IsCall(_, IsHeapConstant(builtin.code()), arg_count, first_arg, 546 m.IsCall(_, IsHeapConstant(builtin.code()), arg_count, first_arg,
520 function, IsParameter(Linkage::kInterpreterContextParameter))); 547 function, IsParameter(Linkage::kInterpreterContextParameter)));
521 } 548 }
522 } 549 }
(...skipping 17 matching lines...) Expand all
540 feedback_vector, 567 feedback_vector,
541 m.IsLoad(kMachAnyTagged, load_shared_function_info_matcher, 568 m.IsLoad(kMachAnyTagged, load_shared_function_info_matcher,
542 IsIntPtrConstant(SharedFunctionInfo::kFeedbackVectorOffset - 569 IsIntPtrConstant(SharedFunctionInfo::kFeedbackVectorOffset -
543 kHeapObjectTag))); 570 kHeapObjectTag)));
544 } 571 }
545 } 572 }
546 573
547 } // namespace compiler 574 } // namespace compiler
548 } // namespace internal 575 } // namespace internal
549 } // namespace v8 576 } // namespace v8
OLDNEW

Powered by Google App Engine
This is Rietveld 408576698