| OLD | NEW |
| 1 // Copyright (c) 2013, the Dart project authors. Please see the AUTHORS file | 1 // Copyright (c) 2013, the Dart project authors. Please see the AUTHORS file |
| 2 // for details. All rights reserved. Use of this source code is governed by a | 2 // for details. All rights reserved. Use of this source code is governed by a |
| 3 // BSD-style license that can be found in the LICENSE file. | 3 // BSD-style license that can be found in the LICENSE file. |
| 4 | 4 |
| 5 #include "vm/deopt_instructions.h" | 5 #include "vm/deopt_instructions.h" |
| 6 | 6 |
| 7 #include "vm/assembler.h" | 7 #include "vm/assembler.h" |
| 8 #include "vm/code_patcher.h" | 8 #include "vm/code_patcher.h" |
| 9 #include "vm/intermediate_language.h" | 9 #include "vm/intermediate_language.h" |
| 10 #include "vm/locations.h" | 10 #include "vm/locations.h" |
| (...skipping 176 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 187 case DeoptInstr::kConstant: | 187 case DeoptInstr::kConstant: |
| 188 case DeoptInstr::kPp: | 188 case DeoptInstr::kPp: |
| 189 case DeoptInstr::kCallerPp: | 189 case DeoptInstr::kCallerPp: |
| 190 case DeoptInstr::kMaterializedObjectRef: | 190 case DeoptInstr::kMaterializedObjectRef: |
| 191 case DeoptInstr::kFloat32x4: | 191 case DeoptInstr::kFloat32x4: |
| 192 case DeoptInstr::kInt32x4: | 192 case DeoptInstr::kInt32x4: |
| 193 case DeoptInstr::kFloat64x2: | 193 case DeoptInstr::kFloat64x2: |
| 194 case DeoptInstr::kWord: | 194 case DeoptInstr::kWord: |
| 195 case DeoptInstr::kDouble: | 195 case DeoptInstr::kDouble: |
| 196 case DeoptInstr::kMintPair: | 196 case DeoptInstr::kMintPair: |
| 197 case DeoptInstr::kInt32: |
| 198 case DeoptInstr::kUint32: |
| 197 return true; | 199 return true; |
| 198 | 200 |
| 199 case DeoptInstr::kRetAddress: | 201 case DeoptInstr::kRetAddress: |
| 200 case DeoptInstr::kPcMarker: | 202 case DeoptInstr::kPcMarker: |
| 201 case DeoptInstr::kCallerFp: | 203 case DeoptInstr::kCallerFp: |
| 202 case DeoptInstr::kCallerPc: | 204 case DeoptInstr::kCallerPc: |
| 203 return false; | 205 return false; |
| 204 | 206 |
| 205 case DeoptInstr::kSuffix: | 207 case DeoptInstr::kSuffix: |
| 206 case DeoptInstr::kMaterializeObject: | 208 case DeoptInstr::kMaterializeObject: |
| (...skipping 322 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 529 class LoRegister : public BitField<intptr_t, 0, kFieldWidth> { }; | 531 class LoRegister : public BitField<intptr_t, 0, kFieldWidth> { }; |
| 530 class HiRegister : public BitField<intptr_t, kFieldWidth, kFieldWidth> { }; | 532 class HiRegister : public BitField<intptr_t, kFieldWidth, kFieldWidth> { }; |
| 531 | 533 |
| 532 const CpuRegisterSource lo_; | 534 const CpuRegisterSource lo_; |
| 533 const CpuRegisterSource hi_; | 535 const CpuRegisterSource hi_; |
| 534 | 536 |
| 535 DISALLOW_COPY_AND_ASSIGN(DeoptMintPairInstr); | 537 DISALLOW_COPY_AND_ASSIGN(DeoptMintPairInstr); |
| 536 }; | 538 }; |
| 537 | 539 |
| 538 | 540 |
| 539 class DeoptUint32Instr : public DeoptIntegerInstrBase { | 541 template<DeoptInstr::Kind K, typename T> |
| 542 class DeoptIntInstr : public DeoptIntegerInstrBase { |
| 540 public: | 543 public: |
| 541 explicit DeoptUint32Instr(intptr_t source_index) | 544 explicit DeoptIntInstr(intptr_t source_index) |
| 542 : DeoptIntegerInstrBase(), source_(source_index) { | 545 : DeoptIntegerInstrBase(), source_(source_index) { |
| 543 } | 546 } |
| 544 | 547 |
| 545 explicit DeoptUint32Instr(const CpuRegisterSource& source) | 548 explicit DeoptIntInstr(const CpuRegisterSource& source) |
| 546 : DeoptIntegerInstrBase(), source_(source) { | 549 : DeoptIntegerInstrBase(), source_(source) { |
| 547 } | 550 } |
| 548 | 551 |
| 549 virtual intptr_t source_index() const { return source_.source_index(); } | 552 virtual intptr_t source_index() const { return source_.source_index(); } |
| 550 virtual DeoptInstr::Kind kind() const { return kUint32; } | 553 virtual DeoptInstr::Kind kind() const { return K; } |
| 551 | 554 |
| 552 virtual const char* ArgumentsToCString() const { | 555 virtual const char* ArgumentsToCString() const { |
| 553 return source_.ToCString(); | 556 return source_.ToCString(); |
| 554 } | 557 } |
| 555 | 558 |
| 556 virtual int64_t GetValue(DeoptContext* deopt_context) { | 559 virtual int64_t GetValue(DeoptContext* deopt_context) { |
| 557 return static_cast<int64_t>(source_.Value<uint32_t>(deopt_context)); | 560 return static_cast<int64_t>(source_.Value<T>(deopt_context)); |
| 558 } | 561 } |
| 559 | 562 |
| 560 private: | 563 private: |
| 561 const CpuRegisterSource source_; | 564 const CpuRegisterSource source_; |
| 562 | 565 |
| 563 DISALLOW_COPY_AND_ASSIGN(DeoptUint32Instr); | 566 DISALLOW_COPY_AND_ASSIGN(DeoptIntInstr); |
| 564 }; | 567 }; |
| 565 | 568 |
| 566 | 569 |
| 570 typedef DeoptIntInstr<DeoptInstr::kUint32, uint32_t> DeoptUint32Instr; |
| 571 typedef DeoptIntInstr<DeoptInstr::kInt32, int32_t> DeoptInt32Instr; |
| 572 |
| 573 |
| 567 template<DeoptInstr::Kind K, | 574 template<DeoptInstr::Kind K, |
| 568 typename Type, | 575 typename Type, |
| 569 typename RawObjectType> | 576 typename RawObjectType> |
| 570 class DeoptFpuInstr: public DeoptInstr { | 577 class DeoptFpuInstr: public DeoptInstr { |
| 571 public: | 578 public: |
| 572 explicit DeoptFpuInstr(intptr_t source_index) | 579 explicit DeoptFpuInstr(intptr_t source_index) |
| 573 : source_(source_index) {} | 580 : source_(source_index) {} |
| 574 | 581 |
| 575 explicit DeoptFpuInstr(const FpuRegisterSource& source) | 582 explicit DeoptFpuInstr(const FpuRegisterSource& source) |
| 576 : source_(source) {} | 583 : source_(source) {} |
| (...skipping 309 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 886 | 893 |
| 887 DeoptInstr* DeoptInstr::Create(intptr_t kind_as_int, intptr_t source_index) { | 894 DeoptInstr* DeoptInstr::Create(intptr_t kind_as_int, intptr_t source_index) { |
| 888 Kind kind = static_cast<Kind>(kind_as_int); | 895 Kind kind = static_cast<Kind>(kind_as_int); |
| 889 switch (kind) { | 896 switch (kind) { |
| 890 case kWord: | 897 case kWord: |
| 891 return new DeoptWordInstr(source_index); | 898 return new DeoptWordInstr(source_index); |
| 892 case kDouble: | 899 case kDouble: |
| 893 return new DeoptDoubleInstr(source_index); | 900 return new DeoptDoubleInstr(source_index); |
| 894 case kMintPair: | 901 case kMintPair: |
| 895 return new DeoptMintPairInstr(source_index); | 902 return new DeoptMintPairInstr(source_index); |
| 903 case kInt32: |
| 904 return new DeoptInt32Instr(source_index); |
| 896 case kUint32: | 905 case kUint32: |
| 897 return new DeoptUint32Instr(source_index); | 906 return new DeoptUint32Instr(source_index); |
| 898 case kFloat32x4: | 907 case kFloat32x4: |
| 899 return new DeoptFloat32x4Instr(source_index); | 908 return new DeoptFloat32x4Instr(source_index); |
| 900 case kFloat64x2: | 909 case kFloat64x2: |
| 901 return new DeoptFloat64x2Instr(source_index); | 910 return new DeoptFloat64x2Instr(source_index); |
| 902 case kInt32x4: | 911 case kInt32x4: |
| 903 return new DeoptInt32x4Instr(source_index); | 912 return new DeoptInt32x4Instr(source_index); |
| 904 case kRetAddress: | 913 case kRetAddress: |
| 905 return new DeoptRetAddressInstr(source_index); | 914 return new DeoptRetAddressInstr(source_index); |
| (...skipping 22 matching lines...) Expand all Loading... |
| 928 | 937 |
| 929 | 938 |
| 930 const char* DeoptInstr::KindToCString(Kind kind) { | 939 const char* DeoptInstr::KindToCString(Kind kind) { |
| 931 switch (kind) { | 940 switch (kind) { |
| 932 case kWord: | 941 case kWord: |
| 933 return "word"; | 942 return "word"; |
| 934 case kDouble: | 943 case kDouble: |
| 935 return "double"; | 944 return "double"; |
| 936 case kMintPair: | 945 case kMintPair: |
| 937 return "mint"; | 946 return "mint"; |
| 947 case kInt32: |
| 948 return "int32"; |
| 938 case kUint32: | 949 case kUint32: |
| 939 return "uint32"; | 950 return "uint32"; |
| 940 case kFloat32x4: | 951 case kFloat32x4: |
| 941 return "float32x4"; | 952 return "float32x4"; |
| 942 case kFloat64x2: | 953 case kFloat64x2: |
| 943 return "float64x2"; | 954 return "float64x2"; |
| 944 case kInt32x4: | 955 case kInt32x4: |
| 945 return "int32x4"; | 956 return "int32x4"; |
| 946 case kRetAddress: | 957 case kRetAddress: |
| 947 return "retaddr"; | 958 return "retaddr"; |
| (...skipping 165 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 1113 ToCpuRegisterSource(source_loc)); | 1124 ToCpuRegisterSource(source_loc)); |
| 1114 break; | 1125 break; |
| 1115 case kUnboxedMint: { | 1126 case kUnboxedMint: { |
| 1116 ASSERT(source_loc.IsPairLocation()); | 1127 ASSERT(source_loc.IsPairLocation()); |
| 1117 PairLocation* pair = source_loc.AsPairLocation(); | 1128 PairLocation* pair = source_loc.AsPairLocation(); |
| 1118 deopt_instr = new(isolate()) DeoptMintPairInstr( | 1129 deopt_instr = new(isolate()) DeoptMintPairInstr( |
| 1119 ToCpuRegisterSource(pair->At(0)), | 1130 ToCpuRegisterSource(pair->At(0)), |
| 1120 ToCpuRegisterSource(pair->At(1))); | 1131 ToCpuRegisterSource(pair->At(1))); |
| 1121 break; | 1132 break; |
| 1122 } | 1133 } |
| 1134 case kUnboxedInt32: |
| 1135 deopt_instr = new(isolate()) DeoptInt32Instr( |
| 1136 ToCpuRegisterSource(source_loc)); |
| 1137 break; |
| 1123 case kUnboxedUint32: | 1138 case kUnboxedUint32: |
| 1124 deopt_instr = new(isolate()) DeoptUint32Instr( | 1139 deopt_instr = new(isolate()) DeoptUint32Instr( |
| 1125 ToCpuRegisterSource(source_loc)); | 1140 ToCpuRegisterSource(source_loc)); |
| 1126 break; | 1141 break; |
| 1127 case kUnboxedDouble: | 1142 case kUnboxedDouble: |
| 1128 deopt_instr = new(isolate()) DeoptDoubleInstr( | 1143 deopt_instr = new(isolate()) DeoptDoubleInstr( |
| 1129 ToFpuRegisterSource(source_loc, Location::kDoubleStackSlot)); | 1144 ToFpuRegisterSource(source_loc, Location::kDoubleStackSlot)); |
| 1130 break; | 1145 break; |
| 1131 case kUnboxedFloat32x4: | 1146 case kUnboxedFloat32x4: |
| 1132 deopt_instr = new(isolate()) DeoptFloat32x4Instr( | 1147 deopt_instr = new(isolate()) DeoptFloat32x4Instr( |
| (...skipping 188 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 1321 Smi* offset, | 1336 Smi* offset, |
| 1322 DeoptInfo* info, | 1337 DeoptInfo* info, |
| 1323 Smi* reason) { | 1338 Smi* reason) { |
| 1324 intptr_t i = index * kEntrySize; | 1339 intptr_t i = index * kEntrySize; |
| 1325 *offset ^= table.At(i); | 1340 *offset ^= table.At(i); |
| 1326 *info ^= table.At(i + 1); | 1341 *info ^= table.At(i + 1); |
| 1327 *reason ^= table.At(i + 2); | 1342 *reason ^= table.At(i + 2); |
| 1328 } | 1343 } |
| 1329 | 1344 |
| 1330 } // namespace dart | 1345 } // namespace dart |
| OLD | NEW |