OLD | NEW |
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/base/bits.h" | 6 #include "src/base/bits.h" |
7 #include "src/compiler/instruction-selector-impl.h" | 7 #include "src/compiler/instruction-selector-impl.h" |
8 #include "src/compiler/node-matchers.h" | 8 #include "src/compiler/node-matchers.h" |
9 #include "src/compiler/node-properties.h" | 9 #include "src/compiler/node-properties.h" |
10 | 10 |
(...skipping 337 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
348 Node* base = node->InputAt(0); | 348 Node* base = node->InputAt(0); |
349 Node* index = node->InputAt(1); | 349 Node* index = node->InputAt(1); |
350 Node* value = node->InputAt(2); | 350 Node* value = node->InputAt(2); |
351 | 351 |
352 StoreRepresentation store_rep = StoreRepresentationOf(node->op()); | 352 StoreRepresentation store_rep = StoreRepresentationOf(node->op()); |
353 WriteBarrierKind write_barrier_kind = store_rep.write_barrier_kind(); | 353 WriteBarrierKind write_barrier_kind = store_rep.write_barrier_kind(); |
354 MachineRepresentation rep = store_rep.representation(); | 354 MachineRepresentation rep = store_rep.representation(); |
355 | 355 |
356 if (write_barrier_kind != kNoWriteBarrier) { | 356 if (write_barrier_kind != kNoWriteBarrier) { |
357 DCHECK_EQ(MachineRepresentation::kTagged, rep); | 357 DCHECK_EQ(MachineRepresentation::kTagged, rep); |
| 358 AddressingMode addressing_mode; |
358 InstructionOperand inputs[3]; | 359 InstructionOperand inputs[3]; |
359 size_t input_count = 0; | 360 size_t input_count = 0; |
360 inputs[input_count++] = g.UseUniqueRegister(base); | 361 inputs[input_count++] = g.UseUniqueRegister(base); |
361 inputs[input_count++] = g.UseUniqueRegister(index); | 362 // OutOfLineRecordWrite uses the index in an 'add' instruction as well as |
| 363 // for the store itself, so we must check compatibility with both. |
| 364 if (g.CanBeImmediate(index, kArmAdd) && g.CanBeImmediate(index, kArmStr)) { |
| 365 inputs[input_count++] = g.UseImmediate(index); |
| 366 addressing_mode = kMode_Offset_RI; |
| 367 } else { |
| 368 inputs[input_count++] = g.UseUniqueRegister(index); |
| 369 addressing_mode = kMode_Offset_RR; |
| 370 } |
362 inputs[input_count++] = (write_barrier_kind == kMapWriteBarrier) | 371 inputs[input_count++] = (write_barrier_kind == kMapWriteBarrier) |
363 ? g.UseRegister(value) | 372 ? g.UseRegister(value) |
364 : g.UseUniqueRegister(value); | 373 : g.UseUniqueRegister(value); |
365 RecordWriteMode record_write_mode = RecordWriteMode::kValueIsAny; | 374 RecordWriteMode record_write_mode = RecordWriteMode::kValueIsAny; |
366 switch (write_barrier_kind) { | 375 switch (write_barrier_kind) { |
367 case kNoWriteBarrier: | 376 case kNoWriteBarrier: |
368 UNREACHABLE(); | 377 UNREACHABLE(); |
369 break; | 378 break; |
370 case kMapWriteBarrier: | 379 case kMapWriteBarrier: |
371 record_write_mode = RecordWriteMode::kValueIsMap; | 380 record_write_mode = RecordWriteMode::kValueIsMap; |
372 break; | 381 break; |
373 case kPointerWriteBarrier: | 382 case kPointerWriteBarrier: |
374 record_write_mode = RecordWriteMode::kValueIsPointer; | 383 record_write_mode = RecordWriteMode::kValueIsPointer; |
375 break; | 384 break; |
376 case kFullWriteBarrier: | 385 case kFullWriteBarrier: |
377 record_write_mode = RecordWriteMode::kValueIsAny; | 386 record_write_mode = RecordWriteMode::kValueIsAny; |
378 break; | 387 break; |
379 } | 388 } |
380 InstructionOperand temps[] = {g.TempRegister(), g.TempRegister()}; | 389 InstructionOperand temps[] = {g.TempRegister(), g.TempRegister()}; |
381 size_t const temp_count = arraysize(temps); | 390 size_t const temp_count = arraysize(temps); |
382 InstructionCode code = kArchStoreWithWriteBarrier; | 391 InstructionCode code = kArchStoreWithWriteBarrier; |
| 392 code |= AddressingModeField::encode(addressing_mode); |
383 code |= MiscField::encode(static_cast<int>(record_write_mode)); | 393 code |= MiscField::encode(static_cast<int>(record_write_mode)); |
384 Emit(code, 0, nullptr, input_count, inputs, temp_count, temps); | 394 Emit(code, 0, nullptr, input_count, inputs, temp_count, temps); |
385 } else { | 395 } else { |
386 ArchOpcode opcode = kArchNop; | 396 ArchOpcode opcode = kArchNop; |
387 switch (rep) { | 397 switch (rep) { |
388 case MachineRepresentation::kFloat32: | 398 case MachineRepresentation::kFloat32: |
389 opcode = kArmVstrF32; | 399 opcode = kArmVstrF32; |
390 break; | 400 break; |
391 case MachineRepresentation::kFloat64: | 401 case MachineRepresentation::kFloat64: |
392 opcode = kArmVstrF64; | 402 opcode = kArmVstrF64; |
(...skipping 1228 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
1621 MachineOperatorBuilder::kFloat64RoundTiesAway | | 1631 MachineOperatorBuilder::kFloat64RoundTiesAway | |
1622 MachineOperatorBuilder::kFloat32RoundTiesEven | | 1632 MachineOperatorBuilder::kFloat32RoundTiesEven | |
1623 MachineOperatorBuilder::kFloat64RoundTiesEven; | 1633 MachineOperatorBuilder::kFloat64RoundTiesEven; |
1624 } | 1634 } |
1625 return flags; | 1635 return flags; |
1626 } | 1636 } |
1627 | 1637 |
1628 } // namespace compiler | 1638 } // namespace compiler |
1629 } // namespace internal | 1639 } // namespace internal |
1630 } // namespace v8 | 1640 } // namespace v8 |
OLD | NEW |