| 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 172 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 183 switch (kind) { | 183 switch (kind) { |
| 184 case DeoptInstr::kConstant: | 184 case DeoptInstr::kConstant: |
| 185 case DeoptInstr::kPp: | 185 case DeoptInstr::kPp: |
| 186 case DeoptInstr::kCallerPp: | 186 case DeoptInstr::kCallerPp: |
| 187 case DeoptInstr::kMaterializedObjectRef: | 187 case DeoptInstr::kMaterializedObjectRef: |
| 188 case DeoptInstr::kFloat32x4: | 188 case DeoptInstr::kFloat32x4: |
| 189 case DeoptInstr::kInt32x4: | 189 case DeoptInstr::kInt32x4: |
| 190 case DeoptInstr::kFloat64x2: | 190 case DeoptInstr::kFloat64x2: |
| 191 case DeoptInstr::kWord: | 191 case DeoptInstr::kWord: |
| 192 case DeoptInstr::kDouble: | 192 case DeoptInstr::kDouble: |
| 193 case DeoptInstr::kMint: |
| 193 case DeoptInstr::kMintPair: | 194 case DeoptInstr::kMintPair: |
| 194 case DeoptInstr::kInt32: | 195 case DeoptInstr::kInt32: |
| 195 case DeoptInstr::kUint32: | 196 case DeoptInstr::kUint32: |
| 196 return true; | 197 return true; |
| 197 | 198 |
| 198 case DeoptInstr::kRetAddress: | 199 case DeoptInstr::kRetAddress: |
| 199 case DeoptInstr::kPcMarker: | 200 case DeoptInstr::kPcMarker: |
| 200 case DeoptInstr::kCallerFp: | 201 case DeoptInstr::kCallerFp: |
| 201 case DeoptInstr::kCallerPc: | 202 case DeoptInstr::kCallerPc: |
| 202 return false; | 203 return false; |
| (...skipping 365 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 568 | 569 |
| 569 private: | 570 private: |
| 570 const CpuRegisterSource source_; | 571 const CpuRegisterSource source_; |
| 571 | 572 |
| 572 DISALLOW_COPY_AND_ASSIGN(DeoptIntInstr); | 573 DISALLOW_COPY_AND_ASSIGN(DeoptIntInstr); |
| 573 }; | 574 }; |
| 574 | 575 |
| 575 | 576 |
| 576 typedef DeoptIntInstr<DeoptInstr::kUint32, uint32_t> DeoptUint32Instr; | 577 typedef DeoptIntInstr<DeoptInstr::kUint32, uint32_t> DeoptUint32Instr; |
| 577 typedef DeoptIntInstr<DeoptInstr::kInt32, int32_t> DeoptInt32Instr; | 578 typedef DeoptIntInstr<DeoptInstr::kInt32, int32_t> DeoptInt32Instr; |
| 579 typedef DeoptIntInstr<DeoptInstr::kMint, int64_t> DeoptMintInstr; |
| 578 | 580 |
| 579 | 581 |
| 580 template<DeoptInstr::Kind K, | 582 template<DeoptInstr::Kind K, |
| 581 typename Type, | 583 typename Type, |
| 582 typename RawObjectType> | 584 typename RawObjectType> |
| 583 class DeoptFpuInstr: public DeoptInstr { | 585 class DeoptFpuInstr: public DeoptInstr { |
| 584 public: | 586 public: |
| 585 explicit DeoptFpuInstr(intptr_t source_index) | 587 explicit DeoptFpuInstr(intptr_t source_index) |
| 586 : source_(source_index) {} | 588 : source_(source_index) {} |
| 587 | 589 |
| (...skipping 309 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 897 } | 899 } |
| 898 | 900 |
| 899 | 901 |
| 900 DeoptInstr* DeoptInstr::Create(intptr_t kind_as_int, intptr_t source_index) { | 902 DeoptInstr* DeoptInstr::Create(intptr_t kind_as_int, intptr_t source_index) { |
| 901 Kind kind = static_cast<Kind>(kind_as_int); | 903 Kind kind = static_cast<Kind>(kind_as_int); |
| 902 switch (kind) { | 904 switch (kind) { |
| 903 case kWord: | 905 case kWord: |
| 904 return new DeoptWordInstr(source_index); | 906 return new DeoptWordInstr(source_index); |
| 905 case kDouble: | 907 case kDouble: |
| 906 return new DeoptDoubleInstr(source_index); | 908 return new DeoptDoubleInstr(source_index); |
| 909 case kMint: |
| 910 return new DeoptMintInstr(source_index); |
| 907 case kMintPair: | 911 case kMintPair: |
| 908 return new DeoptMintPairInstr(source_index); | 912 return new DeoptMintPairInstr(source_index); |
| 909 case kInt32: | 913 case kInt32: |
| 910 return new DeoptInt32Instr(source_index); | 914 return new DeoptInt32Instr(source_index); |
| 911 case kUint32: | 915 case kUint32: |
| 912 return new DeoptUint32Instr(source_index); | 916 return new DeoptUint32Instr(source_index); |
| 913 case kFloat32x4: | 917 case kFloat32x4: |
| 914 return new DeoptFloat32x4Instr(source_index); | 918 return new DeoptFloat32x4Instr(source_index); |
| 915 case kFloat64x2: | 919 case kFloat64x2: |
| 916 return new DeoptFloat64x2Instr(source_index); | 920 return new DeoptFloat64x2Instr(source_index); |
| (...skipping 24 matching lines...) Expand all Loading... |
| 941 return NULL; | 945 return NULL; |
| 942 } | 946 } |
| 943 | 947 |
| 944 | 948 |
| 945 const char* DeoptInstr::KindToCString(Kind kind) { | 949 const char* DeoptInstr::KindToCString(Kind kind) { |
| 946 switch (kind) { | 950 switch (kind) { |
| 947 case kWord: | 951 case kWord: |
| 948 return "word"; | 952 return "word"; |
| 949 case kDouble: | 953 case kDouble: |
| 950 return "double"; | 954 return "double"; |
| 955 case kMint: |
| 951 case kMintPair: | 956 case kMintPair: |
| 952 return "mint"; | 957 return "mint"; |
| 953 case kInt32: | 958 case kInt32: |
| 954 return "int32"; | 959 return "int32"; |
| 955 case kUint32: | 960 case kUint32: |
| 956 return "uint32"; | 961 return "uint32"; |
| 957 case kFloat32x4: | 962 case kFloat32x4: |
| 958 return "float32x4"; | 963 return "float32x4"; |
| 959 case kFloat64x2: | 964 case kFloat64x2: |
| 960 return "float64x2"; | 965 return "float64x2"; |
| (...skipping 162 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 1123 ASSERT(index >= 0); | 1128 ASSERT(index >= 0); |
| 1124 deopt_instr = new(isolate()) DeoptMaterializedObjectRefInstr(index); | 1129 deopt_instr = new(isolate()) DeoptMaterializedObjectRefInstr(index); |
| 1125 } else { | 1130 } else { |
| 1126 ASSERT(!source_loc.IsInvalid()); | 1131 ASSERT(!source_loc.IsInvalid()); |
| 1127 switch (value->definition()->representation()) { | 1132 switch (value->definition()->representation()) { |
| 1128 case kTagged: | 1133 case kTagged: |
| 1129 deopt_instr = new(isolate()) DeoptWordInstr( | 1134 deopt_instr = new(isolate()) DeoptWordInstr( |
| 1130 ToCpuRegisterSource(source_loc)); | 1135 ToCpuRegisterSource(source_loc)); |
| 1131 break; | 1136 break; |
| 1132 case kUnboxedMint: { | 1137 case kUnboxedMint: { |
| 1133 ASSERT(source_loc.IsPairLocation()); | 1138 if (source_loc.IsPairLocation()) { |
| 1134 PairLocation* pair = source_loc.AsPairLocation(); | 1139 PairLocation* pair = source_loc.AsPairLocation(); |
| 1135 deopt_instr = new(isolate()) DeoptMintPairInstr( | 1140 deopt_instr = new(isolate()) DeoptMintPairInstr( |
| 1136 ToCpuRegisterSource(pair->At(0)), | 1141 ToCpuRegisterSource(pair->At(0)), |
| 1137 ToCpuRegisterSource(pair->At(1))); | 1142 ToCpuRegisterSource(pair->At(1))); |
| 1143 } else { |
| 1144 ASSERT(!source_loc.IsPairLocation()); |
| 1145 deopt_instr = new(isolate()) DeoptMintInstr( |
| 1146 ToCpuRegisterSource(source_loc)); |
| 1147 } |
| 1138 break; | 1148 break; |
| 1139 } | 1149 } |
| 1140 case kUnboxedInt32: | 1150 case kUnboxedInt32: |
| 1141 deopt_instr = new(isolate()) DeoptInt32Instr( | 1151 deopt_instr = new(isolate()) DeoptInt32Instr( |
| 1142 ToCpuRegisterSource(source_loc)); | 1152 ToCpuRegisterSource(source_loc)); |
| 1143 break; | 1153 break; |
| 1144 case kUnboxedUint32: | 1154 case kUnboxedUint32: |
| 1145 deopt_instr = new(isolate()) DeoptUint32Instr( | 1155 deopt_instr = new(isolate()) DeoptUint32Instr( |
| 1146 ToCpuRegisterSource(source_loc)); | 1156 ToCpuRegisterSource(source_loc)); |
| 1147 break; | 1157 break; |
| (...skipping 194 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 1342 Smi* offset, | 1352 Smi* offset, |
| 1343 DeoptInfo* info, | 1353 DeoptInfo* info, |
| 1344 Smi* reason) { | 1354 Smi* reason) { |
| 1345 intptr_t i = index * kEntrySize; | 1355 intptr_t i = index * kEntrySize; |
| 1346 *offset ^= table.At(i); | 1356 *offset ^= table.At(i); |
| 1347 *info ^= table.At(i + 1); | 1357 *info ^= table.At(i + 1); |
| 1348 *reason ^= table.At(i + 2); | 1358 *reason ^= table.At(i + 2); |
| 1349 } | 1359 } |
| 1350 | 1360 |
| 1351 } // namespace dart | 1361 } // namespace dart |
| OLD | NEW |