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

Side by Side Diff: test/cctest/compiler/test-jump-threading.cc

Issue 1081373002: [turbofan] cleanup ParallelMove (Closed) Base URL: https://chromium.googlesource.com/v8/v8.git@master
Patch Set: Created 5 years, 8 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 2014 the V8 project authors. All rights reserved. 1 // Copyright 2014 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 "src/v8.h" 5 #include "src/v8.h"
6 #include "test/cctest/cctest.h" 6 #include "test/cctest/cctest.h"
7 7
8 #include "src/compiler/instruction.h" 8 #include "src/compiler/instruction.h"
9 #include "src/compiler/instruction-codes.h" 9 #include "src/compiler/instruction-codes.h"
10 #include "src/compiler/jump-threading.h" 10 #include "src/compiler/jump-threading.h"
(...skipping 41 matching lines...) Expand 10 before | Expand all | Expand 10 after
52 return pos; 52 return pos;
53 } 53 }
54 void Nop() { 54 void Nop() {
55 Start(); 55 Start();
56 sequence_.AddInstruction(Instruction::New(main_zone(), kArchNop)); 56 sequence_.AddInstruction(Instruction::New(main_zone(), kArchNop));
57 } 57 }
58 void RedundantMoves() { 58 void RedundantMoves() {
59 Start(); 59 Start();
60 sequence_.AddInstruction(Instruction::New(main_zone(), kArchNop)); 60 sequence_.AddInstruction(Instruction::New(main_zone(), kArchNop));
61 int index = static_cast<int>(sequence_.instructions().size()) - 1; 61 int index = static_cast<int>(sequence_.instructions().size()) - 1;
62 AddGapMove(index, RegisterOperand::New(main_zone(), 13), 62 AddGapMove(index, RegisterOperand(13), RegisterOperand(13));
63 RegisterOperand::New(main_zone(), 13));
64 } 63 }
65 void NonRedundantMoves() { 64 void NonRedundantMoves() {
66 Start(); 65 Start();
67 sequence_.AddInstruction(Instruction::New(main_zone(), kArchNop)); 66 sequence_.AddInstruction(Instruction::New(main_zone(), kArchNop));
68 int index = static_cast<int>(sequence_.instructions().size()) - 1; 67 int index = static_cast<int>(sequence_.instructions().size()) - 1;
69 AddGapMove(index, ConstantOperand::New(main_zone(), 11), 68 AddGapMove(index, ConstantOperand(11), RegisterOperand(11));
70 RegisterOperand::New(main_zone(), 11));
71 } 69 }
72 void Other() { 70 void Other() {
73 Start(); 71 Start();
74 sequence_.AddInstruction(Instruction::New(main_zone(), 155)); 72 sequence_.AddInstruction(Instruction::New(main_zone(), 155));
75 } 73 }
76 void End() { 74 void End() {
77 Start(); 75 Start();
78 sequence_.EndBlock(current_->rpo_number()); 76 sequence_.EndBlock(current_->rpo_number());
79 current_ = NULL; 77 current_ = NULL;
80 rpo_number_ = RpoNumber::FromInt(rpo_number_.ToInt() + 1); 78 rpo_number_ = RpoNumber::FromInt(rpo_number_.ToInt() + 1);
81 } 79 }
82 InstructionOperand UseRpo(int num) { 80 InstructionOperand UseRpo(int num) {
83 return sequence_.AddImmediate(Constant(RpoNumber::FromInt(num))); 81 return sequence_.AddImmediate(Constant(RpoNumber::FromInt(num)));
84 } 82 }
85 void Start(bool deferred = false) { 83 void Start(bool deferred = false) {
86 if (current_ == NULL) { 84 if (current_ == NULL) {
87 current_ = new (main_zone()) 85 current_ = new (main_zone())
88 InstructionBlock(main_zone(), rpo_number_, RpoNumber::Invalid(), 86 InstructionBlock(main_zone(), rpo_number_, RpoNumber::Invalid(),
89 RpoNumber::Invalid(), deferred); 87 RpoNumber::Invalid(), deferred);
90 blocks_.push_back(current_); 88 blocks_.push_back(current_);
91 sequence_.StartBlock(rpo_number_); 89 sequence_.StartBlock(rpo_number_);
92 } 90 }
93 } 91 }
94 void Defer() { 92 void Defer() {
95 CHECK(current_ == NULL); 93 CHECK(current_ == NULL);
96 Start(true); 94 Start(true);
97 } 95 }
98 void AddGapMove(int index, InstructionOperand* from, InstructionOperand* to) { 96 void AddGapMove(int index, const InstructionOperand& from,
97 const InstructionOperand& to) {
99 sequence_.InstructionAt(index) 98 sequence_.InstructionAt(index)
100 ->GetOrCreateParallelMove(Instruction::START, main_zone()) 99 ->GetOrCreateParallelMove(Instruction::START, main_zone())
101 ->AddMove(from, to, main_zone()); 100 ->AddMove(from, to);
102 } 101 }
103 }; 102 };
104 103
105 104
106 void VerifyForwarding(TestCode& code, int count, int* expected) { 105 void VerifyForwarding(TestCode& code, int count, int* expected) {
107 Zone local_zone; 106 Zone local_zone;
108 ZoneVector<RpoNumber> result(&local_zone); 107 ZoneVector<RpoNumber> result(&local_zone);
109 JumpThreading::ComputeForwarding(&local_zone, result, &code.sequence_); 108 JumpThreading::ComputeForwarding(&local_zone, result, &code.sequence_);
110 109
111 CHECK(count == static_cast<int>(result.size())); 110 CHECK(count == static_cast<int>(result.size()));
(...skipping 645 matching lines...) Expand 10 before | Expand all | Expand 10 after
757 for (int k = 4; k < 5; k++) assembly[k]--; 756 for (int k = 4; k < 5; k++) assembly[k]--;
758 } 757 }
759 CheckAssemblyOrder(code, 5, assembly); 758 CheckAssemblyOrder(code, 5, assembly);
760 } 759 }
761 } 760 }
762 } 761 }
763 762
764 } // namespace compiler 763 } // namespace compiler
765 } // namespace internal 764 } // namespace internal
766 } // namespace v8 765 } // namespace v8
OLDNEW
« no previous file with comments | « test/cctest/compiler/test-instruction.cc ('k') | test/unittests/compiler/move-optimizer-unittest.cc » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698