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

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

Issue 2650273006: Make enabling of CSA verifier a build-time flag (Closed)
Patch Set: Fix tests Created 3 years, 11 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
« no previous file with comments | « src/flag-definitions.h ('k') | no next file » | no next file with comments »
Toggle Intra-line Diffs ('i') | Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
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/interpreter/interpreter-assembler-unittest.h" 5 #include "test/unittests/interpreter/interpreter-assembler-unittest.h"
6 6
7 #include "src/code-factory.h" 7 #include "src/code-factory.h"
8 #include "src/compiler/node.h" 8 #include "src/compiler/node.h"
9 #include "src/interface-descriptors.h" 9 #include "src/interface-descriptors.h"
10 #include "src/isolate.h" 10 #include "src/isolate.h"
11 #include "test/unittests/compiler/compiler-test-utils.h" 11 #include "test/unittests/compiler/compiler-test-utils.h"
12 #include "test/unittests/compiler/node-test-utils.h" 12 #include "test/unittests/compiler/node-test-utils.h"
13 13
14 using ::testing::_; 14 using ::testing::_;
15 15
16 namespace v8 { 16 namespace v8 {
17 namespace internal { 17 namespace internal {
18 18
19 using namespace compiler; 19 using namespace compiler;
20 20
21 #ifdef ENABLE_VERIFY_CSA
22 #define IS_BITCAST_WORD_TO_TAGGED_SIGNED(x) IsBitcastWordToTaggedSigned(x)
23 #define IS_BITCAST_TAGGED_TO_WORD(x) IsBitcastTaggedToWord(x)
24 #else
25 #define IS_BITCAST_WORD_TO_TAGGED_SIGNED(x) (x)
26 #define IS_BITCAST_TAGGED_TO_WORD(x) (x)
27 #endif
28
21 namespace interpreter { 29 namespace interpreter {
22 30
23 InterpreterAssemblerTestState::InterpreterAssemblerTestState( 31 InterpreterAssemblerTestState::InterpreterAssemblerTestState(
24 InterpreterAssemblerTest* test, Bytecode bytecode) 32 InterpreterAssemblerTest* test, Bytecode bytecode)
25 : compiler::CodeAssemblerState( 33 : compiler::CodeAssemblerState(
26 test->isolate(), test->zone(), 34 test->isolate(), test->zone(),
27 InterpreterDispatchDescriptor(test->isolate()), 35 InterpreterDispatchDescriptor(test->isolate()),
28 Code::ComputeFlags(Code::BYTECODE_HANDLER), 36 Code::ComputeFlags(Code::BYTECODE_HANDLER),
29 Bytecodes::ToString(bytecode), Bytecodes::ReturnCount(bytecode)) {} 37 Bytecodes::ToString(bytecode), Bytecodes::ReturnCount(bytecode)) {}
30 38
(...skipping 512 matching lines...) Expand 10 before | Expand all | Expand 10 after
543 IsWordShl(reg_index_node, IsIntPtrConstant(kPointerSizeLog2)), 551 IsWordShl(reg_index_node, IsIntPtrConstant(kPointerSizeLog2)),
544 store_value)); 552 store_value));
545 } 553 }
546 } 554 }
547 555
548 TARGET_TEST_F(InterpreterAssemblerTest, SmiTag) { 556 TARGET_TEST_F(InterpreterAssemblerTest, SmiTag) {
549 TRACED_FOREACH(interpreter::Bytecode, bytecode, kBytecodes) { 557 TRACED_FOREACH(interpreter::Bytecode, bytecode, kBytecodes) {
550 InterpreterAssemblerTestState state(this, bytecode); 558 InterpreterAssemblerTestState state(this, bytecode);
551 InterpreterAssemblerForTest m(&state, bytecode); 559 InterpreterAssemblerForTest m(&state, bytecode);
552 Node* value = m.Int32Constant(44); 560 Node* value = m.Int32Constant(44);
553 EXPECT_THAT(m.SmiTag(value), IsBitcastWordToTaggedSigned(IsIntPtrConstant( 561 EXPECT_THAT(
554 static_cast<intptr_t>(44) 562 m.SmiTag(value),
555 << (kSmiShiftSize + kSmiTagSize)))); 563 IS_BITCAST_WORD_TO_TAGGED_SIGNED(IsIntPtrConstant(
564 static_cast<intptr_t>(44) << (kSmiShiftSize + kSmiTagSize))));
556 EXPECT_THAT(m.SmiUntag(value), 565 EXPECT_THAT(m.SmiUntag(value),
557 IsWordSar(IsBitcastTaggedToWord(value), 566 IsWordSar(IS_BITCAST_TAGGED_TO_WORD(value),
558 IsIntPtrConstant(kSmiShiftSize + kSmiTagSize))); 567 IsIntPtrConstant(kSmiShiftSize + kSmiTagSize)));
559 } 568 }
560 } 569 }
561 570
562 TARGET_TEST_F(InterpreterAssemblerTest, IntPtrAdd) { 571 TARGET_TEST_F(InterpreterAssemblerTest, IntPtrAdd) {
563 TRACED_FOREACH(interpreter::Bytecode, bytecode, kBytecodes) { 572 TRACED_FOREACH(interpreter::Bytecode, bytecode, kBytecodes) {
564 InterpreterAssemblerTestState state(this, bytecode); 573 InterpreterAssemblerTestState state(this, bytecode);
565 InterpreterAssemblerForTest m(&state, bytecode); 574 InterpreterAssemblerForTest m(&state, bytecode);
566 Node* a = m.Parameter(0); 575 Node* a = m.Parameter(0);
567 Node* b = m.Int32Constant(1); 576 Node* b = m.Int32Constant(1);
(...skipping 155 matching lines...) Expand 10 before | Expand all | Expand 10 after
723 EXPECT_THAT(feedback_vector, 732 EXPECT_THAT(feedback_vector,
724 m.IsLoad(MachineType::AnyTagged(), load_literals_matcher, 733 m.IsLoad(MachineType::AnyTagged(), load_literals_matcher,
725 IsIntPtrConstant(LiteralsArray::kFeedbackVectorOffset - 734 IsIntPtrConstant(LiteralsArray::kFeedbackVectorOffset -
726 kHeapObjectTag))); 735 kHeapObjectTag)));
727 } 736 }
728 } 737 }
729 738
730 } // namespace interpreter 739 } // namespace interpreter
731 } // namespace internal 740 } // namespace internal
732 } // namespace v8 741 } // namespace v8
OLDNEW
« no previous file with comments | « src/flag-definitions.h ('k') | no next file » | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698