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

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

Issue 1387543002: Revert of [Interpreter] Add CallRuntime support to the interpreter. (Closed) Base URL: https://chromium.googlesource.com/v8/v8.git@master
Patch Set: 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, CallRuntime2) { 506 TARGET_TEST_F(InterpreterAssemblerTest, CallRuntime) {
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
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 517
545 518
546 TARGET_TEST_F(InterpreterAssemblerTest, CallIC) { 519 TARGET_TEST_F(InterpreterAssemblerTest, CallIC) {
547 TRACED_FOREACH(interpreter::Bytecode, bytecode, kBytecodes) { 520 TRACED_FOREACH(interpreter::Bytecode, bytecode, kBytecodes) {
548 InterpreterAssemblerForTest m(this, bytecode); 521 InterpreterAssemblerForTest m(this, bytecode);
549 LoadWithVectorDescriptor descriptor(isolate()); 522 LoadWithVectorDescriptor descriptor(isolate());
550 Node* target = m.Int32Constant(1); 523 Node* target = m.Int32Constant(1);
551 Node* arg1 = m.Int32Constant(2); 524 Node* arg1 = m.Int32Constant(2);
552 Node* arg2 = m.Int32Constant(3); 525 Node* arg2 = m.Int32Constant(3);
553 Node* arg3 = m.Int32Constant(4); 526 Node* arg3 = m.Int32Constant(4);
554 Node* arg4 = m.Int32Constant(5); 527 Node* arg4 = m.Int32Constant(5);
555 Node* call_ic = m.CallIC(descriptor, target, arg1, arg2, arg3, arg4); 528 Node* call_ic = m.CallIC(descriptor, target, arg1, arg2, arg3, arg4);
556 EXPECT_THAT(call_ic, 529 EXPECT_THAT(call_ic,
557 m.IsCall(_, target, arg1, arg2, arg3, arg4, 530 m.IsCall(_, target, arg1, arg2, arg3, arg4,
558 IsParameter(Linkage::kInterpreterContextParameter))); 531 IsParameter(Linkage::kInterpreterContextParameter)));
559 } 532 }
560 } 533 }
561 534
562 535
563 TARGET_TEST_F(InterpreterAssemblerTest, CallJS) { 536 TARGET_TEST_F(InterpreterAssemblerTest, CallJS) {
564 TRACED_FOREACH(interpreter::Bytecode, bytecode, kBytecodes) { 537 TRACED_FOREACH(interpreter::Bytecode, bytecode, kBytecodes) {
565 InterpreterAssemblerForTest m(this, bytecode); 538 InterpreterAssemblerForTest m(this, bytecode);
566 Callable builtin = CodeFactory::InterpreterPushArgsAndCall(isolate()); 539 Callable builtin = CodeFactory::PushArgsAndCall(isolate());
567 Node* function = m.Int32Constant(0); 540 Node* function = m.Int32Constant(0);
568 Node* first_arg = m.Int32Constant(1); 541 Node* first_arg = m.Int32Constant(1);
569 Node* arg_count = m.Int32Constant(2); 542 Node* arg_count = m.Int32Constant(2);
570 Node* call_js = m.CallJS(function, first_arg, arg_count); 543 Node* call_js = m.CallJS(function, first_arg, arg_count);
571 EXPECT_THAT( 544 EXPECT_THAT(
572 call_js, 545 call_js,
573 m.IsCall(_, IsHeapConstant(builtin.code()), arg_count, first_arg, 546 m.IsCall(_, IsHeapConstant(builtin.code()), arg_count, first_arg,
574 function, IsParameter(Linkage::kInterpreterContextParameter))); 547 function, IsParameter(Linkage::kInterpreterContextParameter)));
575 } 548 }
576 } 549 }
(...skipping 17 matching lines...) Expand all
594 feedback_vector, 567 feedback_vector,
595 m.IsLoad(kMachAnyTagged, load_shared_function_info_matcher, 568 m.IsLoad(kMachAnyTagged, load_shared_function_info_matcher,
596 IsIntPtrConstant(SharedFunctionInfo::kFeedbackVectorOffset - 569 IsIntPtrConstant(SharedFunctionInfo::kFeedbackVectorOffset -
597 kHeapObjectTag))); 570 kHeapObjectTag)));
598 } 571 }
599 } 572 }
600 573
601 } // namespace compiler 574 } // namespace compiler
602 } // namespace internal 575 } // namespace internal
603 } // namespace v8 576 } // 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