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/compiler/instruction-selector-impl.h" | 5 #include "src/compiler/instruction-selector-impl.h" |
6 #include "src/compiler/node-matchers.h" | 6 #include "src/compiler/node-matchers.h" |
7 #include "src/compiler/node-properties.h" | 7 #include "src/compiler/node-properties.h" |
8 | 8 |
9 namespace v8 { | 9 namespace v8 { |
10 namespace internal { | 10 namespace internal { |
(...skipping 380 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
391 Node* index = node->InputAt(1); | 391 Node* index = node->InputAt(1); |
392 Node* value = node->InputAt(2); | 392 Node* value = node->InputAt(2); |
393 | 393 |
394 StoreRepresentation store_rep = StoreRepresentationOf(node->op()); | 394 StoreRepresentation store_rep = StoreRepresentationOf(node->op()); |
395 WriteBarrierKind write_barrier_kind = store_rep.write_barrier_kind(); | 395 WriteBarrierKind write_barrier_kind = store_rep.write_barrier_kind(); |
396 MachineRepresentation rep = store_rep.representation(); | 396 MachineRepresentation rep = store_rep.representation(); |
397 | 397 |
398 // TODO(arm64): I guess this could be done in a better way. | 398 // TODO(arm64): I guess this could be done in a better way. |
399 if (write_barrier_kind != kNoWriteBarrier) { | 399 if (write_barrier_kind != kNoWriteBarrier) { |
400 DCHECK_EQ(MachineRepresentation::kTagged, rep); | 400 DCHECK_EQ(MachineRepresentation::kTagged, rep); |
| 401 AddressingMode addressing_mode; |
401 InstructionOperand inputs[3]; | 402 InstructionOperand inputs[3]; |
402 size_t input_count = 0; | 403 size_t input_count = 0; |
403 inputs[input_count++] = g.UseUniqueRegister(base); | 404 inputs[input_count++] = g.UseUniqueRegister(base); |
404 inputs[input_count++] = g.UseUniqueRegister(index); | 405 // OutOfLineRecordWrite uses the index in an arithmetic instruction, so we |
| 406 // must check kArithmeticImm as well as kLoadStoreImm64. |
| 407 if (g.CanBeImmediate(index, kArithmeticImm) && |
| 408 g.CanBeImmediate(index, kLoadStoreImm64)) { |
| 409 inputs[input_count++] = g.UseImmediate(index); |
| 410 addressing_mode = kMode_MRI; |
| 411 } else { |
| 412 inputs[input_count++] = g.UseUniqueRegister(index); |
| 413 addressing_mode = kMode_MRR; |
| 414 } |
405 inputs[input_count++] = (write_barrier_kind == kMapWriteBarrier) | 415 inputs[input_count++] = (write_barrier_kind == kMapWriteBarrier) |
406 ? g.UseRegister(value) | 416 ? g.UseRegister(value) |
407 : g.UseUniqueRegister(value); | 417 : g.UseUniqueRegister(value); |
408 RecordWriteMode record_write_mode = RecordWriteMode::kValueIsAny; | 418 RecordWriteMode record_write_mode = RecordWriteMode::kValueIsAny; |
409 switch (write_barrier_kind) { | 419 switch (write_barrier_kind) { |
410 case kNoWriteBarrier: | 420 case kNoWriteBarrier: |
411 UNREACHABLE(); | 421 UNREACHABLE(); |
412 break; | 422 break; |
413 case kMapWriteBarrier: | 423 case kMapWriteBarrier: |
414 record_write_mode = RecordWriteMode::kValueIsMap; | 424 record_write_mode = RecordWriteMode::kValueIsMap; |
415 break; | 425 break; |
416 case kPointerWriteBarrier: | 426 case kPointerWriteBarrier: |
417 record_write_mode = RecordWriteMode::kValueIsPointer; | 427 record_write_mode = RecordWriteMode::kValueIsPointer; |
418 break; | 428 break; |
419 case kFullWriteBarrier: | 429 case kFullWriteBarrier: |
420 record_write_mode = RecordWriteMode::kValueIsAny; | 430 record_write_mode = RecordWriteMode::kValueIsAny; |
421 break; | 431 break; |
422 } | 432 } |
423 InstructionOperand temps[] = {g.TempRegister(), g.TempRegister()}; | 433 InstructionOperand temps[] = {g.TempRegister(), g.TempRegister()}; |
424 size_t const temp_count = arraysize(temps); | 434 size_t const temp_count = arraysize(temps); |
425 InstructionCode code = kArchStoreWithWriteBarrier; | 435 InstructionCode code = kArchStoreWithWriteBarrier; |
| 436 code |= AddressingModeField::encode(addressing_mode); |
426 code |= MiscField::encode(static_cast<int>(record_write_mode)); | 437 code |= MiscField::encode(static_cast<int>(record_write_mode)); |
427 Emit(code, 0, nullptr, input_count, inputs, temp_count, temps); | 438 Emit(code, 0, nullptr, input_count, inputs, temp_count, temps); |
428 } else { | 439 } else { |
429 ArchOpcode opcode = kArchNop; | 440 ArchOpcode opcode = kArchNop; |
430 ImmediateMode immediate_mode = kNoImmediate; | 441 ImmediateMode immediate_mode = kNoImmediate; |
431 switch (rep) { | 442 switch (rep) { |
432 case MachineRepresentation::kFloat32: | 443 case MachineRepresentation::kFloat32: |
433 opcode = kArm64StrS; | 444 opcode = kArm64StrS; |
434 immediate_mode = kLoadStoreImm32; | 445 immediate_mode = kLoadStoreImm32; |
435 break; | 446 break; |
(...skipping 1761 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
2197 MachineOperatorBuilder::kFloat32RoundTiesEven | | 2208 MachineOperatorBuilder::kFloat32RoundTiesEven | |
2198 MachineOperatorBuilder::kFloat64RoundTiesEven | | 2209 MachineOperatorBuilder::kFloat64RoundTiesEven | |
2199 MachineOperatorBuilder::kWord32ShiftIsSafe | | 2210 MachineOperatorBuilder::kWord32ShiftIsSafe | |
2200 MachineOperatorBuilder::kInt32DivIsSafe | | 2211 MachineOperatorBuilder::kInt32DivIsSafe | |
2201 MachineOperatorBuilder::kUint32DivIsSafe; | 2212 MachineOperatorBuilder::kUint32DivIsSafe; |
2202 } | 2213 } |
2203 | 2214 |
2204 } // namespace compiler | 2215 } // namespace compiler |
2205 } // namespace internal | 2216 } // namespace internal |
2206 } // namespace v8 | 2217 } // namespace v8 |
OLD | NEW |