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

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

Issue 1378523005: [Interpreter] Add support for global declarations and load/store of global variables (Closed) Base URL: https://chromium.googlesource.com/v8/v8.git@int_toplevel
Patch Set: Fix test 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 456 matching lines...) Expand 10 before | Expand all | Expand 10 after
467 IsIntPtrAdd( 467 IsIntPtrAdd(
468 IsIntPtrConstant(FixedArray::kHeaderSize - kHeapObjectTag), 468 IsIntPtrConstant(FixedArray::kHeaderSize - kHeapObjectTag),
469 IsWordShl(index, IsInt32Constant(kPointerSizeLog2))))); 469 IsWordShl(index, IsInt32Constant(kPointerSizeLog2)))));
470 } 470 }
471 } 471 }
472 472
473 473
474 TARGET_TEST_F(InterpreterAssemblerTest, LoadContextSlot) { 474 TARGET_TEST_F(InterpreterAssemblerTest, LoadContextSlot) {
475 TRACED_FOREACH(interpreter::Bytecode, bytecode, kBytecodes) { 475 TRACED_FOREACH(interpreter::Bytecode, bytecode, kBytecodes) {
476 InterpreterAssemblerForTest m(this, bytecode); 476 InterpreterAssemblerForTest m(this, bytecode);
477 Node* load_from_current_context = m.LoadContextSlot(22); 477 Node* context = m.Int32Constant(1);
478 Matcher<Node*> load_from_current_context_matcher = m.IsLoad( 478 Node* slot_index = m.Int32Constant(22);
479 kMachAnyTagged, IsParameter(Linkage::kInterpreterContextParameter), 479 Node* load_context_slot = m.LoadContextSlot(context, slot_index);
480 IsIntPtrConstant(Context::SlotOffset(22)));
481 EXPECT_THAT(load_from_current_context, load_from_current_context_matcher);
482 480
483 // Let's imagine that the loaded context slot is another context. 481 Matcher<Node*> offset =
484 Node* load_from_any_context = 482 IsIntPtrAdd(IsWordShl(slot_index, IsInt32Constant(kPointerSizeLog2)),
485 m.LoadContextSlot(load_from_current_context, 23); 483 IsInt32Constant(Context::kHeaderSize - kHeapObjectTag));
486 EXPECT_THAT(load_from_any_context, 484 EXPECT_THAT(load_context_slot, m.IsLoad(kMachAnyTagged, context, offset));
487 m.IsLoad(kMachAnyTagged, load_from_current_context_matcher,
488 IsIntPtrConstant(Context::SlotOffset(23))));
489 } 485 }
490 } 486 }
491 487
492 488
493 TARGET_TEST_F(InterpreterAssemblerTest, LoadObjectField) { 489 TARGET_TEST_F(InterpreterAssemblerTest, LoadObjectField) {
494 TRACED_FOREACH(interpreter::Bytecode, bytecode, kBytecodes) { 490 TRACED_FOREACH(interpreter::Bytecode, bytecode, kBytecodes) {
495 InterpreterAssemblerForTest m(this, bytecode); 491 InterpreterAssemblerForTest m(this, bytecode);
496 Node* object = m.IntPtrConstant(0xdeadbeef); 492 Node* object = m.IntPtrConstant(0xdeadbeef);
497 int offset = 16; 493 int offset = 16;
498 Node* load_field = m.LoadObjectField(object, offset); 494 Node* load_field = m.LoadObjectField(object, offset);
(...skipping 95 matching lines...) Expand 10 before | Expand all | Expand 10 after
594 feedback_vector, 590 feedback_vector,
595 m.IsLoad(kMachAnyTagged, load_shared_function_info_matcher, 591 m.IsLoad(kMachAnyTagged, load_shared_function_info_matcher,
596 IsIntPtrConstant(SharedFunctionInfo::kFeedbackVectorOffset - 592 IsIntPtrConstant(SharedFunctionInfo::kFeedbackVectorOffset -
597 kHeapObjectTag))); 593 kHeapObjectTag)));
598 } 594 }
599 } 595 }
600 596
601 } // namespace compiler 597 } // namespace compiler
602 } // namespace internal 598 } // namespace internal
603 } // namespace v8 599 } // 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