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

Side by Side Diff: src/compiler/instruction.cc

Issue 884503002: store InstructionOperands directly in Instruction (Closed) Base URL: https://chromium.googlesource.com/v8/v8.git@master
Patch Set: Created 5 years, 10 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/compiler/instruction.h ('k') | test/cctest/compiler/test-instruction.cc » ('j') | no next file with comments »
Toggle Intra-line Diffs ('i') | Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
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/compiler/common-operator.h" 5 #include "src/compiler/common-operator.h"
6 #include "src/compiler/graph.h" 6 #include "src/compiler/graph.h"
7 #include "src/compiler/instruction.h" 7 #include "src/compiler/instruction.h"
8 8
9 namespace v8 { 9 namespace v8 {
10 namespace internal { 10 namespace internal {
(...skipping 99 matching lines...) Expand 10 before | Expand all | Expand 10 after
110 110
111 111
112 bool ParallelMove::IsRedundant() const { 112 bool ParallelMove::IsRedundant() const {
113 for (int i = 0; i < move_operands_.length(); ++i) { 113 for (int i = 0; i < move_operands_.length(); ++i) {
114 if (!move_operands_[i].IsRedundant()) return false; 114 if (!move_operands_[i].IsRedundant()) return false;
115 } 115 }
116 return true; 116 return true;
117 } 117 }
118 118
119 119
120 static void SetOperand(UnallocatedOperand* loc, InstructionOperand* value) {
121 if (value->IsUnallocated()) {
122 loc[0] = *UnallocatedOperand::cast(value);
123 } else {
124 InstructionOperand* casted = static_cast<InstructionOperand*>(loc);
125 casted[0] = *value;
126 }
127 }
128
129
130 Instruction::Instruction(InstructionCode opcode)
131 : opcode_(opcode),
132 bit_field_(OutputCountField::encode(0) | InputCountField::encode(0) |
133 TempCountField::encode(0) | IsCallField::encode(false) |
134 IsControlField::encode(false)),
135 pointer_map_(NULL) {}
136
137
138 Instruction::Instruction(InstructionCode opcode, size_t output_count,
139 InstructionOperand** outputs, size_t input_count,
140 InstructionOperand** inputs, size_t temp_count,
141 InstructionOperand** temps)
142 : opcode_(opcode),
143 bit_field_(OutputCountField::encode(output_count) |
144 InputCountField::encode(input_count) |
145 TempCountField::encode(temp_count) |
146 IsCallField::encode(false) | IsControlField::encode(false)),
147 pointer_map_(NULL) {
148 size_t offset = 0;
149 for (size_t i = 0; i < output_count; ++i) {
150 SetOperand(&operands_[offset++], outputs[i]);
151 }
152 for (size_t i = 0; i < input_count; ++i) {
153 SetOperand(&operands_[offset++], inputs[i]);
154 }
155 for (size_t i = 0; i < temp_count; ++i) {
156 SetOperand(&operands_[offset++], temps[i]);
157 }
158 }
159
160
120 bool GapInstruction::IsRedundant() const { 161 bool GapInstruction::IsRedundant() const {
121 for (int i = GapInstruction::FIRST_INNER_POSITION; 162 for (int i = GapInstruction::FIRST_INNER_POSITION;
122 i <= GapInstruction::LAST_INNER_POSITION; i++) { 163 i <= GapInstruction::LAST_INNER_POSITION; i++) {
123 if (parallel_moves_[i] != NULL && !parallel_moves_[i]->IsRedundant()) 164 if (parallel_moves_[i] != NULL && !parallel_moves_[i]->IsRedundant())
124 return false; 165 return false;
125 } 166 }
126 return true; 167 return true;
127 } 168 }
128 169
129 170
(...skipping 563 matching lines...) Expand 10 before | Expand all | Expand 10 after
693 os << " B" << succ_block->id(); 734 os << " B" << succ_block->id();
694 } 735 }
695 os << "\n"; 736 os << "\n";
696 } 737 }
697 return os; 738 return os;
698 } 739 }
699 740
700 } // namespace compiler 741 } // namespace compiler
701 } // namespace internal 742 } // namespace internal
702 } // namespace v8 743 } // namespace v8
OLDNEW
« no previous file with comments | « src/compiler/instruction.h ('k') | test/cctest/compiler/test-instruction.cc » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698