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 #include "src/compiler/code-generator-impl.h" | 6 #include "src/compiler/code-generator-impl.h" |
7 #include "src/compiler/gap-resolver.h" | 7 #include "src/compiler/gap-resolver.h" |
8 #include "src/compiler/node-matchers.h" | 8 #include "src/compiler/node-matchers.h" |
9 #include "src/compiler/osr.h" | 9 #include "src/compiler/osr.h" |
10 #include "src/mips/macro-assembler-mips.h" | 10 #include "src/mips/macro-assembler-mips.h" |
(...skipping 195 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
206 }; | 206 }; |
207 | 207 |
208 | 208 |
209 class OutOfLineCeil final : public OutOfLineRound { | 209 class OutOfLineCeil final : public OutOfLineRound { |
210 public: | 210 public: |
211 OutOfLineCeil(CodeGenerator* gen, DoubleRegister result) | 211 OutOfLineCeil(CodeGenerator* gen, DoubleRegister result) |
212 : OutOfLineRound(gen, result) {} | 212 : OutOfLineRound(gen, result) {} |
213 }; | 213 }; |
214 | 214 |
215 | 215 |
| 216 class OutOfLineRecordWrite final : public OutOfLineCode { |
| 217 public: |
| 218 OutOfLineRecordWrite(CodeGenerator* gen, Register object, Register index, |
| 219 Register value, Register scratch0, Register scratch1, |
| 220 RecordWriteMode mode) |
| 221 : OutOfLineCode(gen), |
| 222 object_(object), |
| 223 index_(index), |
| 224 value_(value), |
| 225 scratch0_(scratch0), |
| 226 scratch1_(scratch1), |
| 227 mode_(mode) {} |
| 228 |
| 229 void Generate() final { |
| 230 if (mode_ > RecordWriteMode::kValueIsPointer) { |
| 231 __ JumpIfSmi(value_, exit()); |
| 232 } |
| 233 if (mode_ > RecordWriteMode::kValueIsMap) { |
| 234 __ CheckPageFlag(value_, scratch0_, |
| 235 MemoryChunk::kPointersToHereAreInterestingMask, eq, |
| 236 exit()); |
| 237 } |
| 238 SaveFPRegsMode const save_fp_mode = |
| 239 frame()->DidAllocateDoubleRegisters() ? kSaveFPRegs : kDontSaveFPRegs; |
| 240 // TODO(turbofan): Once we get frame elision working, we need to save |
| 241 // and restore lr properly here if the frame was elided. |
| 242 RecordWriteStub stub(isolate(), object_, scratch0_, scratch1_, |
| 243 EMIT_REMEMBERED_SET, save_fp_mode); |
| 244 __ Addu(scratch1_, object_, index_); |
| 245 __ CallStub(&stub); |
| 246 } |
| 247 |
| 248 private: |
| 249 Register const object_; |
| 250 Register const index_; |
| 251 Register const value_; |
| 252 Register const scratch0_; |
| 253 Register const scratch1_; |
| 254 RecordWriteMode const mode_; |
| 255 }; |
| 256 |
| 257 |
216 Condition FlagsConditionToConditionCmp(FlagsCondition condition) { | 258 Condition FlagsConditionToConditionCmp(FlagsCondition condition) { |
217 switch (condition) { | 259 switch (condition) { |
218 case kEqual: | 260 case kEqual: |
219 return eq; | 261 return eq; |
220 case kNotEqual: | 262 case kNotEqual: |
221 return ne; | 263 return ne; |
222 case kSignedLessThan: | 264 case kSignedLessThan: |
223 return lt; | 265 return lt; |
224 case kSignedGreaterThanOrEqual: | 266 case kSignedGreaterThanOrEqual: |
225 return ge; | 267 return ge; |
(...skipping 285 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
511 break; | 553 break; |
512 case kArchStackPointer: | 554 case kArchStackPointer: |
513 __ mov(i.OutputRegister(), sp); | 555 __ mov(i.OutputRegister(), sp); |
514 break; | 556 break; |
515 case kArchFramePointer: | 557 case kArchFramePointer: |
516 __ mov(i.OutputRegister(), fp); | 558 __ mov(i.OutputRegister(), fp); |
517 break; | 559 break; |
518 case kArchTruncateDoubleToI: | 560 case kArchTruncateDoubleToI: |
519 __ TruncateDoubleToI(i.OutputRegister(), i.InputDoubleRegister(0)); | 561 __ TruncateDoubleToI(i.OutputRegister(), i.InputDoubleRegister(0)); |
520 break; | 562 break; |
| 563 case kArchStoreWithWriteBarrier: { |
| 564 RecordWriteMode mode = |
| 565 static_cast<RecordWriteMode>(MiscField::decode(instr->opcode())); |
| 566 Register object = i.InputRegister(0); |
| 567 Register index = i.InputRegister(1); |
| 568 Register value = i.InputRegister(2); |
| 569 Register scratch0 = i.TempRegister(0); |
| 570 Register scratch1 = i.TempRegister(1); |
| 571 auto ool = new (zone()) OutOfLineRecordWrite(this, object, index, value, |
| 572 scratch0, scratch1, mode); |
| 573 __ Daddu(at, object, index); |
| 574 __ sd(value, MemOperand(at)); |
| 575 __ CheckPageFlag(object, scratch0, |
| 576 MemoryChunk::kPointersFromHereAreInterestingMask, ne, |
| 577 ool->entry()); |
| 578 __ bind(ool->exit()); |
| 579 break; |
| 580 } |
521 case kMips64Add: | 581 case kMips64Add: |
522 __ Addu(i.OutputRegister(), i.InputRegister(0), i.InputOperand(1)); | 582 __ Addu(i.OutputRegister(), i.InputRegister(0), i.InputOperand(1)); |
523 break; | 583 break; |
524 case kMips64Dadd: | 584 case kMips64Dadd: |
525 __ Daddu(i.OutputRegister(), i.InputRegister(0), i.InputOperand(1)); | 585 __ Daddu(i.OutputRegister(), i.InputRegister(0), i.InputOperand(1)); |
526 break; | 586 break; |
527 case kMips64Sub: | 587 case kMips64Sub: |
528 __ Subu(i.OutputRegister(), i.InputRegister(0), i.InputOperand(1)); | 588 __ Subu(i.OutputRegister(), i.InputRegister(0), i.InputOperand(1)); |
529 break; | 589 break; |
530 case kMips64Dsub: | 590 case kMips64Dsub: |
(...skipping 429 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
960 break; | 1020 break; |
961 } | 1021 } |
962 case kMips64StoreToStackSlot: { | 1022 case kMips64StoreToStackSlot: { |
963 if (instr->InputAt(0)->IsDoubleRegister()) { | 1023 if (instr->InputAt(0)->IsDoubleRegister()) { |
964 __ sdc1(i.InputDoubleRegister(0), MemOperand(sp, i.InputInt32(1))); | 1024 __ sdc1(i.InputDoubleRegister(0), MemOperand(sp, i.InputInt32(1))); |
965 } else { | 1025 } else { |
966 __ sd(i.InputRegister(0), MemOperand(sp, i.InputInt32(1))); | 1026 __ sd(i.InputRegister(0), MemOperand(sp, i.InputInt32(1))); |
967 } | 1027 } |
968 break; | 1028 break; |
969 } | 1029 } |
970 case kMips64StoreWriteBarrier: { | |
971 Register object = i.InputRegister(0); | |
972 Register index = i.InputRegister(1); | |
973 Register value = i.InputRegister(2); | |
974 __ daddu(index, object, index); | |
975 __ sd(value, MemOperand(index)); | |
976 SaveFPRegsMode mode = | |
977 frame()->DidAllocateDoubleRegisters() ? kSaveFPRegs : kDontSaveFPRegs; | |
978 RAStatus ra_status = kRAHasNotBeenSaved; | |
979 __ RecordWrite(object, index, value, ra_status, mode); | |
980 break; | |
981 } | |
982 case kCheckedLoadInt8: | 1030 case kCheckedLoadInt8: |
983 ASSEMBLE_CHECKED_LOAD_INTEGER(lb); | 1031 ASSEMBLE_CHECKED_LOAD_INTEGER(lb); |
984 break; | 1032 break; |
985 case kCheckedLoadUint8: | 1033 case kCheckedLoadUint8: |
986 ASSEMBLE_CHECKED_LOAD_INTEGER(lbu); | 1034 ASSEMBLE_CHECKED_LOAD_INTEGER(lbu); |
987 break; | 1035 break; |
988 case kCheckedLoadInt16: | 1036 case kCheckedLoadInt16: |
989 ASSEMBLE_CHECKED_LOAD_INTEGER(lh); | 1037 ASSEMBLE_CHECKED_LOAD_INTEGER(lh); |
990 break; | 1038 break; |
991 case kCheckedLoadUint16: | 1039 case kCheckedLoadUint16: |
(...skipping 615 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
1607 padding_size -= v8::internal::Assembler::kInstrSize; | 1655 padding_size -= v8::internal::Assembler::kInstrSize; |
1608 } | 1656 } |
1609 } | 1657 } |
1610 } | 1658 } |
1611 | 1659 |
1612 #undef __ | 1660 #undef __ |
1613 | 1661 |
1614 } // namespace compiler | 1662 } // namespace compiler |
1615 } // namespace internal | 1663 } // namespace internal |
1616 } // namespace v8 | 1664 } // namespace v8 |
OLD | NEW |