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

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: Fix arm32 debug build check errors. 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 485 matching lines...) Expand 10 before | Expand all | Expand 10 after
496 Node* object = m.IntPtrConstant(0xdeadbeef); 496 Node* object = m.IntPtrConstant(0xdeadbeef);
497 int offset = 16; 497 int offset = 16;
498 Node* load_field = m.LoadObjectField(object, offset); 498 Node* load_field = m.LoadObjectField(object, offset);
499 EXPECT_THAT(load_field, 499 EXPECT_THAT(load_field,
500 m.IsLoad(kMachAnyTagged, object, 500 m.IsLoad(kMachAnyTagged, object,
501 IsIntPtrConstant(offset - kHeapObjectTag))); 501 IsIntPtrConstant(offset - kHeapObjectTag)));
502 } 502 }
503 } 503 }
504 504
505 505
506 TARGET_TEST_F(InterpreterAssemblerTest, CallRuntime) { 506 TARGET_TEST_F(InterpreterAssemblerTest, CallRuntime2) {
507 TRACED_FOREACH(interpreter::Bytecode, bytecode, kBytecodes) { 507 TRACED_FOREACH(interpreter::Bytecode, bytecode, kBytecodes) {
508 InterpreterAssemblerForTest m(this, bytecode); 508 InterpreterAssemblerForTest m(this, bytecode);
509 Node* arg1 = m.Int32Constant(2); 509 Node* arg1 = m.Int32Constant(2);
510 Node* arg2 = m.Int32Constant(3); 510 Node* arg2 = m.Int32Constant(3);
511 Node* call_runtime = m.CallRuntime(Runtime::kAdd, arg1, arg2); 511 Node* call_runtime = m.CallRuntime(Runtime::kAdd, arg1, arg2);
512 EXPECT_THAT(call_runtime, 512 EXPECT_THAT(call_runtime,
513 m.IsCall(_, _, arg1, arg2, _, IsInt32Constant(2), 513 m.IsCall(_, _, arg1, arg2, _, IsInt32Constant(2),
514 IsParameter(Linkage::kInterpreterContextParameter))); 514 IsParameter(Linkage::kInterpreterContextParameter)));
515 } 515 }
516 } 516 }
517 517
518 518
519 TARGET_TEST_F(InterpreterAssemblerTest, CallRuntime) {
520 TRACED_FOREACH(interpreter::Bytecode, bytecode, kBytecodes) {
521 InterpreterAssemblerForTest m(this, bytecode);
522 Callable builtin = CodeFactory::InterpreterCEntry(isolate());
523
524 Node* function_id = m.Int32Constant(0);
525 Node* first_arg = m.Int32Constant(1);
526 Node* arg_count = m.Int32Constant(2);
527
528 Matcher<Node*> function_table = IsExternalConstant(
529 ExternalReference::runtime_function_table_address(isolate()));
530 Matcher<Node*> function = IsIntPtrAdd(
531 function_table,
532 IsInt32Mul(function_id, IsInt32Constant(sizeof(Runtime::Function))));
533 Matcher<Node*> function_entry =
534 m.IsLoad(kMachPtr, function,
535 IsInt32Constant(offsetof(Runtime::Function, entry)));
536
537 Node* call_runtime = m.CallRuntime(function_id, first_arg, arg_count);
538 EXPECT_THAT(call_runtime,
539 m.IsCall(_, IsHeapConstant(builtin.code()), arg_count,
540 first_arg, function_entry,
541 IsParameter(Linkage::kInterpreterContextParameter)));
542 }
543 }
544
545
519 TARGET_TEST_F(InterpreterAssemblerTest, CallIC) { 546 TARGET_TEST_F(InterpreterAssemblerTest, CallIC) {
520 TRACED_FOREACH(interpreter::Bytecode, bytecode, kBytecodes) { 547 TRACED_FOREACH(interpreter::Bytecode, bytecode, kBytecodes) {
521 InterpreterAssemblerForTest m(this, bytecode); 548 InterpreterAssemblerForTest m(this, bytecode);
522 LoadWithVectorDescriptor descriptor(isolate()); 549 LoadWithVectorDescriptor descriptor(isolate());
523 Node* target = m.Int32Constant(1); 550 Node* target = m.Int32Constant(1);
524 Node* arg1 = m.Int32Constant(2); 551 Node* arg1 = m.Int32Constant(2);
525 Node* arg2 = m.Int32Constant(3); 552 Node* arg2 = m.Int32Constant(3);
526 Node* arg3 = m.Int32Constant(4); 553 Node* arg3 = m.Int32Constant(4);
527 Node* arg4 = m.Int32Constant(5); 554 Node* arg4 = m.Int32Constant(5);
528 Node* call_ic = m.CallIC(descriptor, target, arg1, arg2, arg3, arg4); 555 Node* call_ic = m.CallIC(descriptor, target, arg1, arg2, arg3, arg4);
529 EXPECT_THAT(call_ic, 556 EXPECT_THAT(call_ic,
530 m.IsCall(_, target, arg1, arg2, arg3, arg4, 557 m.IsCall(_, target, arg1, arg2, arg3, arg4,
531 IsParameter(Linkage::kInterpreterContextParameter))); 558 IsParameter(Linkage::kInterpreterContextParameter)));
532 } 559 }
533 } 560 }
534 561
535 562
536 TARGET_TEST_F(InterpreterAssemblerTest, CallJS) { 563 TARGET_TEST_F(InterpreterAssemblerTest, CallJS) {
537 TRACED_FOREACH(interpreter::Bytecode, bytecode, kBytecodes) { 564 TRACED_FOREACH(interpreter::Bytecode, bytecode, kBytecodes) {
538 InterpreterAssemblerForTest m(this, bytecode); 565 InterpreterAssemblerForTest m(this, bytecode);
539 Callable builtin = CodeFactory::PushArgsAndCall(isolate()); 566 Callable builtin = CodeFactory::InterpreterPushArgsAndCall(isolate());
540 Node* function = m.Int32Constant(0); 567 Node* function = m.Int32Constant(0);
541 Node* first_arg = m.Int32Constant(1); 568 Node* first_arg = m.Int32Constant(1);
542 Node* arg_count = m.Int32Constant(2); 569 Node* arg_count = m.Int32Constant(2);
543 Node* call_js = m.CallJS(function, first_arg, arg_count); 570 Node* call_js = m.CallJS(function, first_arg, arg_count);
544 EXPECT_THAT( 571 EXPECT_THAT(
545 call_js, 572 call_js,
546 m.IsCall(_, IsHeapConstant(builtin.code()), arg_count, first_arg, 573 m.IsCall(_, IsHeapConstant(builtin.code()), arg_count, first_arg,
547 function, IsParameter(Linkage::kInterpreterContextParameter))); 574 function, IsParameter(Linkage::kInterpreterContextParameter)));
548 } 575 }
549 } 576 }
(...skipping 17 matching lines...) Expand all
567 feedback_vector, 594 feedback_vector,
568 m.IsLoad(kMachAnyTagged, load_shared_function_info_matcher, 595 m.IsLoad(kMachAnyTagged, load_shared_function_info_matcher,
569 IsIntPtrConstant(SharedFunctionInfo::kFeedbackVectorOffset - 596 IsIntPtrConstant(SharedFunctionInfo::kFeedbackVectorOffset -
570 kHeapObjectTag))); 597 kHeapObjectTag)));
571 } 598 }
572 } 599 }
573 600
574 } // namespace compiler 601 } // namespace compiler
575 } // namespace internal 602 } // namespace internal
576 } // namespace v8 603 } // 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