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/code-generator.h" | 5 #include "src/compiler/code-generator.h" |
6 | 6 |
7 #include "src/arm64/frames-arm64.h" | 7 #include "src/arm64/frames-arm64.h" |
8 #include "src/arm64/macro-assembler-arm64.h" | 8 #include "src/arm64/macro-assembler-arm64.h" |
9 #include "src/ast/scopes.h" | 9 #include "src/ast/scopes.h" |
10 #include "src/compiler/code-generator-impl.h" | 10 #include "src/compiler/code-generator-impl.h" |
(...skipping 252 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
263 | 263 |
264 void Generate() final { __ Mov(result_, 0); } | 264 void Generate() final { __ Mov(result_, 0); } |
265 | 265 |
266 private: | 266 private: |
267 Register const result_; | 267 Register const result_; |
268 }; | 268 }; |
269 | 269 |
270 | 270 |
271 class OutOfLineRecordWrite final : public OutOfLineCode { | 271 class OutOfLineRecordWrite final : public OutOfLineCode { |
272 public: | 272 public: |
273 OutOfLineRecordWrite(CodeGenerator* gen, Register object, Register index, | 273 OutOfLineRecordWrite(CodeGenerator* gen, Register object, Operand index, |
274 Register value, Register scratch0, Register scratch1, | 274 Register value, Register scratch0, Register scratch1, |
275 RecordWriteMode mode) | 275 RecordWriteMode mode) |
276 : OutOfLineCode(gen), | 276 : OutOfLineCode(gen), |
277 object_(object), | 277 object_(object), |
278 index_(index), | 278 index_(index), |
279 value_(value), | 279 value_(value), |
280 scratch0_(scratch0), | 280 scratch0_(scratch0), |
281 scratch1_(scratch1), | 281 scratch1_(scratch1), |
282 mode_(mode) {} | 282 mode_(mode) {} |
283 | 283 |
(...skipping 11 matching lines...) Expand all Loading... |
295 // TODO(turbofan): Once we get frame elision working, we need to save | 295 // TODO(turbofan): Once we get frame elision working, we need to save |
296 // and restore lr properly here if the frame was elided. | 296 // and restore lr properly here if the frame was elided. |
297 RecordWriteStub stub(isolate(), object_, scratch0_, scratch1_, | 297 RecordWriteStub stub(isolate(), object_, scratch0_, scratch1_, |
298 EMIT_REMEMBERED_SET, save_fp_mode); | 298 EMIT_REMEMBERED_SET, save_fp_mode); |
299 __ Add(scratch1_, object_, index_); | 299 __ Add(scratch1_, object_, index_); |
300 __ CallStub(&stub); | 300 __ CallStub(&stub); |
301 } | 301 } |
302 | 302 |
303 private: | 303 private: |
304 Register const object_; | 304 Register const object_; |
305 Register const index_; | 305 Operand const index_; |
306 Register const value_; | 306 Register const value_; |
307 Register const scratch0_; | 307 Register const scratch0_; |
308 Register const scratch1_; | 308 Register const scratch1_; |
309 RecordWriteMode const mode_; | 309 RecordWriteMode const mode_; |
310 }; | 310 }; |
311 | 311 |
312 | 312 |
313 Condition FlagsConditionToCondition(FlagsCondition condition) { | 313 Condition FlagsConditionToCondition(FlagsCondition condition) { |
314 switch (condition) { | 314 switch (condition) { |
315 case kEqual: | 315 case kEqual: |
(...skipping 309 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
625 break; | 625 break; |
626 case kArchFramePointer: | 626 case kArchFramePointer: |
627 __ mov(i.OutputRegister(), fp); | 627 __ mov(i.OutputRegister(), fp); |
628 break; | 628 break; |
629 case kArchTruncateDoubleToI: | 629 case kArchTruncateDoubleToI: |
630 __ TruncateDoubleToI(i.OutputRegister(), i.InputDoubleRegister(0)); | 630 __ TruncateDoubleToI(i.OutputRegister(), i.InputDoubleRegister(0)); |
631 break; | 631 break; |
632 case kArchStoreWithWriteBarrier: { | 632 case kArchStoreWithWriteBarrier: { |
633 RecordWriteMode mode = | 633 RecordWriteMode mode = |
634 static_cast<RecordWriteMode>(MiscField::decode(instr->opcode())); | 634 static_cast<RecordWriteMode>(MiscField::decode(instr->opcode())); |
| 635 AddressingMode addressing_mode = |
| 636 AddressingModeField::decode(instr->opcode()); |
635 Register object = i.InputRegister(0); | 637 Register object = i.InputRegister(0); |
636 Register index = i.InputRegister(1); | 638 Operand index(0); |
| 639 if (addressing_mode == kMode_MRI) { |
| 640 index = Operand(i.InputInt64(1)); |
| 641 } else { |
| 642 DCHECK_EQ(addressing_mode, kMode_MRR); |
| 643 index = Operand(i.InputRegister(1)); |
| 644 } |
637 Register value = i.InputRegister(2); | 645 Register value = i.InputRegister(2); |
638 Register scratch0 = i.TempRegister(0); | 646 Register scratch0 = i.TempRegister(0); |
639 Register scratch1 = i.TempRegister(1); | 647 Register scratch1 = i.TempRegister(1); |
640 auto ool = new (zone()) OutOfLineRecordWrite(this, object, index, value, | 648 auto ool = new (zone()) OutOfLineRecordWrite(this, object, index, value, |
641 scratch0, scratch1, mode); | 649 scratch0, scratch1, mode); |
642 __ Str(value, MemOperand(object, index)); | 650 __ Str(value, MemOperand(object, index)); |
643 __ CheckPageFlagSet(object, scratch0, | 651 __ CheckPageFlagSet(object, scratch0, |
644 MemoryChunk::kPointersFromHereAreInterestingMask, | 652 MemoryChunk::kPointersFromHereAreInterestingMask, |
645 ool->entry()); | 653 ool->entry()); |
646 __ Bind(ool->exit()); | 654 __ Bind(ool->exit()); |
(...skipping 1052 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
1699 padding_size -= kInstructionSize; | 1707 padding_size -= kInstructionSize; |
1700 } | 1708 } |
1701 } | 1709 } |
1702 } | 1710 } |
1703 | 1711 |
1704 #undef __ | 1712 #undef __ |
1705 | 1713 |
1706 } // namespace compiler | 1714 } // namespace compiler |
1707 } // namespace internal | 1715 } // namespace internal |
1708 } // namespace v8 | 1716 } // namespace v8 |
OLD | NEW |