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

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

Issue 1403943004: [Interpreter] Add support for local context loads and stores. (Closed) Base URL: https://chromium.googlesource.com/v8/v8.git@int_contextchain
Patch Set: Add back outer_ &&] 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 468 matching lines...) Expand 10 before | Expand all | Expand 10 after
479 Node* load_context_slot = m.LoadContextSlot(context, slot_index); 479 Node* load_context_slot = m.LoadContextSlot(context, slot_index);
480 480
481 Matcher<Node*> offset = 481 Matcher<Node*> offset =
482 IsIntPtrAdd(IsWordShl(slot_index, IsInt32Constant(kPointerSizeLog2)), 482 IsIntPtrAdd(IsWordShl(slot_index, IsInt32Constant(kPointerSizeLog2)),
483 IsInt32Constant(Context::kHeaderSize - kHeapObjectTag)); 483 IsInt32Constant(Context::kHeaderSize - kHeapObjectTag));
484 EXPECT_THAT(load_context_slot, m.IsLoad(kMachAnyTagged, context, offset)); 484 EXPECT_THAT(load_context_slot, m.IsLoad(kMachAnyTagged, context, offset));
485 } 485 }
486 } 486 }
487 487
488 488
489 TARGET_TEST_F(InterpreterAssemblerTest, StoreContextSlot) {
490 TRACED_FOREACH(interpreter::Bytecode, bytecode, kBytecodes) {
491 InterpreterAssemblerForTest m(this, bytecode);
492 Node* context = m.Int32Constant(1);
493 Node* slot_index = m.Int32Constant(22);
494 Node* value = m.Int32Constant(100);
495 Node* store_context_slot = m.StoreContextSlot(context, slot_index, value);
496
497 Matcher<Node*> offset =
498 IsIntPtrAdd(IsWordShl(slot_index, IsInt32Constant(kPointerSizeLog2)),
499 IsInt32Constant(Context::kHeaderSize - kHeapObjectTag));
500 EXPECT_THAT(store_context_slot,
501 m.IsStore(StoreRepresentation(kMachAnyTagged, kNoWriteBarrier),
502 context, offset, value));
503 }
504 }
505
506
489 TARGET_TEST_F(InterpreterAssemblerTest, LoadObjectField) { 507 TARGET_TEST_F(InterpreterAssemblerTest, LoadObjectField) {
490 TRACED_FOREACH(interpreter::Bytecode, bytecode, kBytecodes) { 508 TRACED_FOREACH(interpreter::Bytecode, bytecode, kBytecodes) {
491 InterpreterAssemblerForTest m(this, bytecode); 509 InterpreterAssemblerForTest m(this, bytecode);
492 Node* object = m.IntPtrConstant(0xdeadbeef); 510 Node* object = m.IntPtrConstant(0xdeadbeef);
493 int offset = 16; 511 int offset = 16;
494 Node* load_field = m.LoadObjectField(object, offset); 512 Node* load_field = m.LoadObjectField(object, offset);
495 EXPECT_THAT(load_field, 513 EXPECT_THAT(load_field,
496 m.IsLoad(kMachAnyTagged, object, 514 m.IsLoad(kMachAnyTagged, object,
497 IsIntPtrConstant(offset - kHeapObjectTag))); 515 IsIntPtrConstant(offset - kHeapObjectTag)));
498 } 516 }
(...skipping 91 matching lines...) Expand 10 before | Expand all | Expand 10 after
590 feedback_vector, 608 feedback_vector,
591 m.IsLoad(kMachAnyTagged, load_shared_function_info_matcher, 609 m.IsLoad(kMachAnyTagged, load_shared_function_info_matcher,
592 IsIntPtrConstant(SharedFunctionInfo::kFeedbackVectorOffset - 610 IsIntPtrConstant(SharedFunctionInfo::kFeedbackVectorOffset -
593 kHeapObjectTag))); 611 kHeapObjectTag)));
594 } 612 }
595 } 613 }
596 614
597 } // namespace compiler 615 } // namespace compiler
598 } // namespace internal 616 } // namespace internal
599 } // namespace v8 617 } // namespace v8
OLDNEW

Powered by Google App Engine
This is Rietveld 408576698