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

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

Issue 889843003: [turbofan] Don't allocate UnallocatedOperands in Zone memory during instruction selection (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') | src/compiler/instruction-selector.h » ('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 101 matching lines...) Expand 10 before | Expand all | Expand 10 after
112 112
113 113
114 bool ParallelMove::IsRedundant() const { 114 bool ParallelMove::IsRedundant() const {
115 for (int i = 0; i < move_operands_.length(); ++i) { 115 for (int i = 0; i < move_operands_.length(); ++i) {
116 if (!move_operands_[i].IsRedundant()) return false; 116 if (!move_operands_[i].IsRedundant()) return false;
117 } 117 }
118 return true; 118 return true;
119 } 119 }
120 120
121 121
122 static void SetOperand(UnallocatedOperand* loc, InstructionOperand* value) {
123 if (value->IsUnallocated()) {
124 loc[0] = *UnallocatedOperand::cast(value);
125 } else {
126 InstructionOperand* casted = static_cast<InstructionOperand*>(loc);
127 casted[0] = *value;
128 }
129 }
130
131
132 Instruction::Instruction(InstructionCode opcode) 122 Instruction::Instruction(InstructionCode opcode)
133 : opcode_(opcode), 123 : opcode_(opcode),
134 bit_field_(OutputCountField::encode(0) | InputCountField::encode(0) | 124 bit_field_(OutputCountField::encode(0) | InputCountField::encode(0) |
135 TempCountField::encode(0) | IsCallField::encode(false) | 125 TempCountField::encode(0) | IsCallField::encode(false) |
136 IsControlField::encode(false)), 126 IsControlField::encode(false)),
137 pointer_map_(NULL) {} 127 pointer_map_(NULL) {}
138 128
139 129
140 Instruction::Instruction(InstructionCode opcode, size_t output_count, 130 Instruction::Instruction(InstructionCode opcode, size_t output_count,
141 InstructionOperand** outputs, size_t input_count, 131 InstructionOperand* outputs, size_t input_count,
142 InstructionOperand** inputs, size_t temp_count, 132 InstructionOperand* inputs, size_t temp_count,
143 InstructionOperand** temps) 133 InstructionOperand* temps)
144 : opcode_(opcode), 134 : opcode_(opcode),
145 bit_field_(OutputCountField::encode(output_count) | 135 bit_field_(OutputCountField::encode(output_count) |
146 InputCountField::encode(input_count) | 136 InputCountField::encode(input_count) |
147 TempCountField::encode(temp_count) | 137 TempCountField::encode(temp_count) |
148 IsCallField::encode(false) | IsControlField::encode(false)), 138 IsCallField::encode(false) | IsControlField::encode(false)),
149 pointer_map_(NULL) { 139 pointer_map_(NULL) {
150 size_t offset = 0; 140 size_t offset = 0;
151 for (size_t i = 0; i < output_count; ++i) { 141 for (size_t i = 0; i < output_count; ++i) {
152 SetOperand(&operands_[offset++], outputs[i]); 142 DCHECK(!outputs[i].IsInvalid());
143 operands_[offset++] = outputs[i];
153 } 144 }
154 for (size_t i = 0; i < input_count; ++i) { 145 for (size_t i = 0; i < input_count; ++i) {
155 SetOperand(&operands_[offset++], inputs[i]); 146 DCHECK(!inputs[i].IsInvalid());
147 operands_[offset++] = inputs[i];
156 } 148 }
157 for (size_t i = 0; i < temp_count; ++i) { 149 for (size_t i = 0; i < temp_count; ++i) {
158 SetOperand(&operands_[offset++], temps[i]); 150 DCHECK(!temps[i].IsInvalid());
151 operands_[offset++] = temps[i];
159 } 152 }
160 } 153 }
161 154
162 155
163 bool GapInstruction::IsRedundant() const { 156 bool GapInstruction::IsRedundant() const {
164 for (int i = GapInstruction::FIRST_INNER_POSITION; 157 for (int i = GapInstruction::FIRST_INNER_POSITION;
165 i <= GapInstruction::LAST_INNER_POSITION; i++) { 158 i <= GapInstruction::LAST_INNER_POSITION; i++) {
166 if (parallel_moves_[i] != NULL && !parallel_moves_[i]->IsRedundant()) 159 if (parallel_moves_[i] != NULL && !parallel_moves_[i]->IsRedundant())
167 return false; 160 return false;
168 } 161 }
(...skipping 567 matching lines...) Expand 10 before | Expand all | Expand 10 after
736 os << " B" << succ_block->id(); 729 os << " B" << succ_block->id();
737 } 730 }
738 os << "\n"; 731 os << "\n";
739 } 732 }
740 return os; 733 return os;
741 } 734 }
742 735
743 } // namespace compiler 736 } // namespace compiler
744 } // namespace internal 737 } // namespace internal
745 } // namespace v8 738 } // namespace v8
OLDNEW
« no previous file with comments | « src/compiler/instruction.h ('k') | src/compiler/instruction-selector.h » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698