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

Side by Side Diff: src/compiler/ppc/instruction-selector-ppc.cc

Issue 1695333002: PPC: Support immediate indices for StoreWriteBarrier. (Closed) Base URL: https://chromium.googlesource.com/v8/v8.git@master
Patch Set: Created 4 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/ppc/code-generator-ppc.cc ('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 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/base/adapters.h" 5 #include "src/base/adapters.h"
6 #include "src/compiler/instruction-selector-impl.h" 6 #include "src/compiler/instruction-selector-impl.h"
7 #include "src/compiler/node-matchers.h" 7 #include "src/compiler/node-matchers.h"
8 #include "src/compiler/node-properties.h" 8 #include "src/compiler/node-properties.h"
9 #include "src/ppc/frames-ppc.h" 9 #include "src/ppc/frames-ppc.h"
10 10
(...skipping 209 matching lines...) Expand 10 before | Expand all | Expand 10 after
220 void InstructionSelector::VisitStore(Node* node) { 220 void InstructionSelector::VisitStore(Node* node) {
221 PPCOperandGenerator g(this); 221 PPCOperandGenerator g(this);
222 Node* base = node->InputAt(0); 222 Node* base = node->InputAt(0);
223 Node* offset = node->InputAt(1); 223 Node* offset = node->InputAt(1);
224 Node* value = node->InputAt(2); 224 Node* value = node->InputAt(2);
225 225
226 StoreRepresentation store_rep = StoreRepresentationOf(node->op()); 226 StoreRepresentation store_rep = StoreRepresentationOf(node->op());
227 WriteBarrierKind write_barrier_kind = store_rep.write_barrier_kind(); 227 WriteBarrierKind write_barrier_kind = store_rep.write_barrier_kind();
228 MachineRepresentation rep = store_rep.representation(); 228 MachineRepresentation rep = store_rep.representation();
229 229
230 // TODO(ppc): I guess this could be done in a better way.
231 if (write_barrier_kind != kNoWriteBarrier) { 230 if (write_barrier_kind != kNoWriteBarrier) {
232 DCHECK_EQ(MachineRepresentation::kTagged, rep); 231 DCHECK_EQ(MachineRepresentation::kTagged, rep);
232 AddressingMode addressing_mode;
233 InstructionOperand inputs[3]; 233 InstructionOperand inputs[3];
234 size_t input_count = 0; 234 size_t input_count = 0;
235 inputs[input_count++] = g.UseUniqueRegister(base); 235 inputs[input_count++] = g.UseUniqueRegister(base);
236 inputs[input_count++] = g.UseUniqueRegister(offset); 236 // OutOfLineRecordWrite uses the offset in an 'add' instruction as well as
237 // for the store itself, so we must check compatibility with both.
238 if (g.CanBeImmediate(offset, kInt16Imm)
239 #if V8_TARGET_ARCH_PPC64
240 && g.CanBeImmediate(offset, kInt16Imm_4ByteAligned)
241 #endif
242 ) {
243 inputs[input_count++] = g.UseImmediate(offset);
244 addressing_mode = kMode_MRI;
245 } else {
246 inputs[input_count++] = g.UseUniqueRegister(offset);
247 addressing_mode = kMode_MRR;
248 }
237 inputs[input_count++] = (write_barrier_kind == kMapWriteBarrier) 249 inputs[input_count++] = (write_barrier_kind == kMapWriteBarrier)
238 ? g.UseRegister(value) 250 ? g.UseRegister(value)
239 : g.UseUniqueRegister(value); 251 : g.UseUniqueRegister(value);
240 RecordWriteMode record_write_mode = RecordWriteMode::kValueIsAny; 252 RecordWriteMode record_write_mode = RecordWriteMode::kValueIsAny;
241 switch (write_barrier_kind) { 253 switch (write_barrier_kind) {
242 case kNoWriteBarrier: 254 case kNoWriteBarrier:
243 UNREACHABLE(); 255 UNREACHABLE();
244 break; 256 break;
245 case kMapWriteBarrier: 257 case kMapWriteBarrier:
246 record_write_mode = RecordWriteMode::kValueIsMap; 258 record_write_mode = RecordWriteMode::kValueIsMap;
247 break; 259 break;
248 case kPointerWriteBarrier: 260 case kPointerWriteBarrier:
249 record_write_mode = RecordWriteMode::kValueIsPointer; 261 record_write_mode = RecordWriteMode::kValueIsPointer;
250 break; 262 break;
251 case kFullWriteBarrier: 263 case kFullWriteBarrier:
252 record_write_mode = RecordWriteMode::kValueIsAny; 264 record_write_mode = RecordWriteMode::kValueIsAny;
253 break; 265 break;
254 } 266 }
255 InstructionOperand temps[] = {g.TempRegister(), g.TempRegister()}; 267 InstructionOperand temps[] = {g.TempRegister(), g.TempRegister()};
256 size_t const temp_count = arraysize(temps); 268 size_t const temp_count = arraysize(temps);
257 InstructionCode code = kArchStoreWithWriteBarrier; 269 InstructionCode code = kArchStoreWithWriteBarrier;
270 code |= AddressingModeField::encode(addressing_mode);
258 code |= MiscField::encode(static_cast<int>(record_write_mode)); 271 code |= MiscField::encode(static_cast<int>(record_write_mode));
259 Emit(code, 0, nullptr, input_count, inputs, temp_count, temps); 272 Emit(code, 0, nullptr, input_count, inputs, temp_count, temps);
260 } else { 273 } else {
261 ArchOpcode opcode = kArchNop; 274 ArchOpcode opcode = kArchNop;
262 ImmediateMode mode = kInt16Imm; 275 ImmediateMode mode = kInt16Imm;
263 switch (rep) { 276 switch (rep) {
264 case MachineRepresentation::kFloat32: 277 case MachineRepresentation::kFloat32:
265 opcode = kPPC_StoreFloat32; 278 opcode = kPPC_StoreFloat32;
266 break; 279 break;
267 case MachineRepresentation::kFloat64: 280 case MachineRepresentation::kFloat64:
(...skipping 1515 matching lines...) Expand 10 before | Expand all | Expand 10 after
1783 MachineOperatorBuilder::kFloat64RoundTruncate | 1796 MachineOperatorBuilder::kFloat64RoundTruncate |
1784 MachineOperatorBuilder::kFloat64RoundTiesAway | 1797 MachineOperatorBuilder::kFloat64RoundTiesAway |
1785 MachineOperatorBuilder::kWord32Popcnt | 1798 MachineOperatorBuilder::kWord32Popcnt |
1786 MachineOperatorBuilder::kWord64Popcnt; 1799 MachineOperatorBuilder::kWord64Popcnt;
1787 // We omit kWord32ShiftIsSafe as s[rl]w use 0x3f as a mask rather than 0x1f. 1800 // We omit kWord32ShiftIsSafe as s[rl]w use 0x3f as a mask rather than 0x1f.
1788 } 1801 }
1789 1802
1790 } // namespace compiler 1803 } // namespace compiler
1791 } // namespace internal 1804 } // namespace internal
1792 } // namespace v8 1805 } // namespace v8
OLDNEW
« no previous file with comments | « src/compiler/ppc/code-generator-ppc.cc ('k') | no next file » | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698