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

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: 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 443 matching lines...) Expand 10 before | Expand all | Expand 10 after
454 Node* object = m.IntPtrConstant(0xdeadbeef); 454 Node* object = m.IntPtrConstant(0xdeadbeef);
455 int offset = 16; 455 int offset = 16;
456 Node* load_field = m.LoadObjectField(object, offset); 456 Node* load_field = m.LoadObjectField(object, offset);
457 EXPECT_THAT(load_field, 457 EXPECT_THAT(load_field,
458 m.IsLoad(kMachAnyTagged, object, 458 m.IsLoad(kMachAnyTagged, object,
459 IsIntPtrConstant(offset - kHeapObjectTag))); 459 IsIntPtrConstant(offset - kHeapObjectTag)));
460 } 460 }
461 } 461 }
462 462
463 463
464 TARGET_TEST_F(InterpreterAssemblerTest, CallRuntime) { 464 TARGET_TEST_F(InterpreterAssemblerTest, CallRuntime2) {
465 TRACED_FOREACH(interpreter::Bytecode, bytecode, kBytecodes) { 465 TRACED_FOREACH(interpreter::Bytecode, bytecode, kBytecodes) {
466 InterpreterAssemblerForTest m(this, bytecode); 466 InterpreterAssemblerForTest m(this, bytecode);
467 Node* arg1 = m.Int32Constant(2); 467 Node* arg1 = m.Int32Constant(2);
468 Node* arg2 = m.Int32Constant(3); 468 Node* arg2 = m.Int32Constant(3);
469 Node* call_runtime = m.CallRuntime(Runtime::kAdd, arg1, arg2); 469 Node* call_runtime = m.CallRuntime(Runtime::kAdd, arg1, arg2);
470 EXPECT_THAT(call_runtime, 470 EXPECT_THAT(call_runtime,
471 m.IsCall(_, _, arg1, arg2, _, IsInt32Constant(2), 471 m.IsCall(_, _, arg1, arg2, _, IsInt32Constant(2),
472 IsParameter(Linkage::kInterpreterContextParameter))); 472 IsParameter(Linkage::kInterpreterContextParameter)));
473 } 473 }
474 } 474 }
475 475
476 476
477 TARGET_TEST_F(InterpreterAssemblerTest, CallRuntime) {
478 TRACED_FOREACH(interpreter::Bytecode, bytecode, kBytecodes) {
479 InterpreterAssemblerForTest m(this, bytecode);
480 Callable builtin = CodeFactory::InterpreterCEntry(isolate());
481 Node* function_id = m.Int32Constant(0);
482 Node* first_arg = m.Int32Constant(1);
483 Node* arg_count = m.Int32Constant(2);
484 Node* call_runtime = m.CallRuntime(function_id, first_arg, arg_count);
485 EXPECT_THAT(call_runtime,
486 m.IsCall(_, IsHeapConstant(builtin.code()), arg_count,
487 first_arg, function_id,
488 IsParameter(Linkage::kInterpreterContextParameter)));
489 }
490 }
491
492
477 TARGET_TEST_F(InterpreterAssemblerTest, CallIC) { 493 TARGET_TEST_F(InterpreterAssemblerTest, CallIC) {
478 TRACED_FOREACH(interpreter::Bytecode, bytecode, kBytecodes) { 494 TRACED_FOREACH(interpreter::Bytecode, bytecode, kBytecodes) {
479 InterpreterAssemblerForTest m(this, bytecode); 495 InterpreterAssemblerForTest m(this, bytecode);
480 LoadWithVectorDescriptor descriptor(isolate()); 496 LoadWithVectorDescriptor descriptor(isolate());
481 Node* target = m.Int32Constant(1); 497 Node* target = m.Int32Constant(1);
482 Node* arg1 = m.Int32Constant(2); 498 Node* arg1 = m.Int32Constant(2);
483 Node* arg2 = m.Int32Constant(3); 499 Node* arg2 = m.Int32Constant(3);
484 Node* arg3 = m.Int32Constant(4); 500 Node* arg3 = m.Int32Constant(4);
485 Node* arg4 = m.Int32Constant(5); 501 Node* arg4 = m.Int32Constant(5);
486 Node* call_ic = m.CallIC(descriptor, target, arg1, arg2, arg3, arg4); 502 Node* call_ic = m.CallIC(descriptor, target, arg1, arg2, arg3, arg4);
487 EXPECT_THAT(call_ic, 503 EXPECT_THAT(call_ic,
488 m.IsCall(_, target, arg1, arg2, arg3, arg4, 504 m.IsCall(_, target, arg1, arg2, arg3, arg4,
489 IsParameter(Linkage::kInterpreterContextParameter))); 505 IsParameter(Linkage::kInterpreterContextParameter)));
490 } 506 }
491 } 507 }
492 508
493 509
494 TARGET_TEST_F(InterpreterAssemblerTest, CallJS) { 510 TARGET_TEST_F(InterpreterAssemblerTest, CallJS) {
495 TRACED_FOREACH(interpreter::Bytecode, bytecode, kBytecodes) { 511 TRACED_FOREACH(interpreter::Bytecode, bytecode, kBytecodes) {
496 InterpreterAssemblerForTest m(this, bytecode); 512 InterpreterAssemblerForTest m(this, bytecode);
497 Callable builtin = CodeFactory::PushArgsAndCall(isolate()); 513 Callable builtin = CodeFactory::InterpreterPushArgsAndCall(isolate());
498 Node* function = m.Int32Constant(0); 514 Node* function = m.Int32Constant(0);
499 Node* first_arg = m.Int32Constant(1); 515 Node* first_arg = m.Int32Constant(1);
500 Node* arg_count = m.Int32Constant(2); 516 Node* arg_count = m.Int32Constant(2);
501 Node* call_js = m.CallJS(function, first_arg, arg_count); 517 Node* call_js = m.CallJS(function, first_arg, arg_count);
502 EXPECT_THAT( 518 EXPECT_THAT(
503 call_js, 519 call_js,
504 m.IsCall(_, IsHeapConstant(builtin.code()), arg_count, first_arg, 520 m.IsCall(_, IsHeapConstant(builtin.code()), arg_count, first_arg,
505 function, IsParameter(Linkage::kInterpreterContextParameter))); 521 function, IsParameter(Linkage::kInterpreterContextParameter)));
506 } 522 }
507 } 523 }
(...skipping 17 matching lines...) Expand all
525 feedback_vector, 541 feedback_vector,
526 m.IsLoad(kMachAnyTagged, load_shared_function_info_matcher, 542 m.IsLoad(kMachAnyTagged, load_shared_function_info_matcher,
527 IsIntPtrConstant(SharedFunctionInfo::kFeedbackVectorOffset - 543 IsIntPtrConstant(SharedFunctionInfo::kFeedbackVectorOffset -
528 kHeapObjectTag))); 544 kHeapObjectTag)));
529 } 545 }
530 } 546 }
531 547
532 } // namespace compiler 548 } // namespace compiler
533 } // namespace internal 549 } // namespace internal
534 } // namespace v8 550 } // namespace v8
OLDNEW

Powered by Google App Engine
This is Rietveld 408576698