| 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 175 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 186 switch (kind) { | 186 switch (kind) { |
| 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::kMint: |
| 196 case DeoptInstr::kMintPair: | 197 case DeoptInstr::kMintPair: |
| 197 case DeoptInstr::kInt32: | 198 case DeoptInstr::kInt32: |
| 198 case DeoptInstr::kUint32: | 199 case DeoptInstr::kUint32: |
| 199 return true; | 200 return true; |
| 200 | 201 |
| 201 case DeoptInstr::kRetAddress: | 202 case DeoptInstr::kRetAddress: |
| 202 case DeoptInstr::kPcMarker: | 203 case DeoptInstr::kPcMarker: |
| 203 case DeoptInstr::kCallerFp: | 204 case DeoptInstr::kCallerFp: |
| 204 case DeoptInstr::kCallerPc: | 205 case DeoptInstr::kCallerPc: |
| 205 return false; | 206 return false; |
| (...skipping 356 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 562 | 563 |
| 563 private: | 564 private: |
| 564 const CpuRegisterSource source_; | 565 const CpuRegisterSource source_; |
| 565 | 566 |
| 566 DISALLOW_COPY_AND_ASSIGN(DeoptIntInstr); | 567 DISALLOW_COPY_AND_ASSIGN(DeoptIntInstr); |
| 567 }; | 568 }; |
| 568 | 569 |
| 569 | 570 |
| 570 typedef DeoptIntInstr<DeoptInstr::kUint32, uint32_t> DeoptUint32Instr; | 571 typedef DeoptIntInstr<DeoptInstr::kUint32, uint32_t> DeoptUint32Instr; |
| 571 typedef DeoptIntInstr<DeoptInstr::kInt32, int32_t> DeoptInt32Instr; | 572 typedef DeoptIntInstr<DeoptInstr::kInt32, int32_t> DeoptInt32Instr; |
| 573 typedef DeoptIntInstr<DeoptInstr::kMint, int64_t> DeoptMintInstr; |
| 572 | 574 |
| 573 | 575 |
| 574 template<DeoptInstr::Kind K, | 576 template<DeoptInstr::Kind K, |
| 575 typename Type, | 577 typename Type, |
| 576 typename RawObjectType> | 578 typename RawObjectType> |
| 577 class DeoptFpuInstr: public DeoptInstr { | 579 class DeoptFpuInstr: public DeoptInstr { |
| 578 public: | 580 public: |
| 579 explicit DeoptFpuInstr(intptr_t source_index) | 581 explicit DeoptFpuInstr(intptr_t source_index) |
| 580 : source_(source_index) {} | 582 : source_(source_index) {} |
| 581 | 583 |
| (...skipping 309 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 891 } | 893 } |
| 892 | 894 |
| 893 | 895 |
| 894 DeoptInstr* DeoptInstr::Create(intptr_t kind_as_int, intptr_t source_index) { | 896 DeoptInstr* DeoptInstr::Create(intptr_t kind_as_int, intptr_t source_index) { |
| 895 Kind kind = static_cast<Kind>(kind_as_int); | 897 Kind kind = static_cast<Kind>(kind_as_int); |
| 896 switch (kind) { | 898 switch (kind) { |
| 897 case kWord: | 899 case kWord: |
| 898 return new DeoptWordInstr(source_index); | 900 return new DeoptWordInstr(source_index); |
| 899 case kDouble: | 901 case kDouble: |
| 900 return new DeoptDoubleInstr(source_index); | 902 return new DeoptDoubleInstr(source_index); |
| 903 case kMint: |
| 904 return new DeoptMintInstr(source_index); |
| 901 case kMintPair: | 905 case kMintPair: |
| 902 return new DeoptMintPairInstr(source_index); | 906 return new DeoptMintPairInstr(source_index); |
| 903 case kInt32: | 907 case kInt32: |
| 904 return new DeoptInt32Instr(source_index); | 908 return new DeoptInt32Instr(source_index); |
| 905 case kUint32: | 909 case kUint32: |
| 906 return new DeoptUint32Instr(source_index); | 910 return new DeoptUint32Instr(source_index); |
| 907 case kFloat32x4: | 911 case kFloat32x4: |
| 908 return new DeoptFloat32x4Instr(source_index); | 912 return new DeoptFloat32x4Instr(source_index); |
| 909 case kFloat64x2: | 913 case kFloat64x2: |
| 910 return new DeoptFloat64x2Instr(source_index); | 914 return new DeoptFloat64x2Instr(source_index); |
| (...skipping 24 matching lines...) Expand all Loading... |
| 935 return NULL; | 939 return NULL; |
| 936 } | 940 } |
| 937 | 941 |
| 938 | 942 |
| 939 const char* DeoptInstr::KindToCString(Kind kind) { | 943 const char* DeoptInstr::KindToCString(Kind kind) { |
| 940 switch (kind) { | 944 switch (kind) { |
| 941 case kWord: | 945 case kWord: |
| 942 return "word"; | 946 return "word"; |
| 943 case kDouble: | 947 case kDouble: |
| 944 return "double"; | 948 return "double"; |
| 949 case kMint: |
| 945 case kMintPair: | 950 case kMintPair: |
| 946 return "mint"; | 951 return "mint"; |
| 947 case kInt32: | 952 case kInt32: |
| 948 return "int32"; | 953 return "int32"; |
| 949 case kUint32: | 954 case kUint32: |
| 950 return "uint32"; | 955 return "uint32"; |
| 951 case kFloat32x4: | 956 case kFloat32x4: |
| 952 return "float32x4"; | 957 return "float32x4"; |
| 953 case kFloat64x2: | 958 case kFloat64x2: |
| 954 return "float64x2"; | 959 return "float64x2"; |
| (...skipping 162 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 1117 ASSERT(index >= 0); | 1122 ASSERT(index >= 0); |
| 1118 deopt_instr = new(isolate()) DeoptMaterializedObjectRefInstr(index); | 1123 deopt_instr = new(isolate()) DeoptMaterializedObjectRefInstr(index); |
| 1119 } else { | 1124 } else { |
| 1120 ASSERT(!source_loc.IsInvalid()); | 1125 ASSERT(!source_loc.IsInvalid()); |
| 1121 switch (value->definition()->representation()) { | 1126 switch (value->definition()->representation()) { |
| 1122 case kTagged: | 1127 case kTagged: |
| 1123 deopt_instr = new(isolate()) DeoptWordInstr( | 1128 deopt_instr = new(isolate()) DeoptWordInstr( |
| 1124 ToCpuRegisterSource(source_loc)); | 1129 ToCpuRegisterSource(source_loc)); |
| 1125 break; | 1130 break; |
| 1126 case kUnboxedMint: { | 1131 case kUnboxedMint: { |
| 1127 ASSERT(source_loc.IsPairLocation()); | 1132 if (source_loc.IsPairLocation()) { |
| 1128 PairLocation* pair = source_loc.AsPairLocation(); | 1133 PairLocation* pair = source_loc.AsPairLocation(); |
| 1129 deopt_instr = new(isolate()) DeoptMintPairInstr( | 1134 deopt_instr = new(isolate()) DeoptMintPairInstr( |
| 1130 ToCpuRegisterSource(pair->At(0)), | 1135 ToCpuRegisterSource(pair->At(0)), |
| 1131 ToCpuRegisterSource(pair->At(1))); | 1136 ToCpuRegisterSource(pair->At(1))); |
| 1137 } else { |
| 1138 ASSERT(!source_loc.IsPairLocation()); |
| 1139 deopt_instr = new(isolate()) DeoptMintInstr( |
| 1140 ToCpuRegisterSource(source_loc)); |
| 1141 } |
| 1132 break; | 1142 break; |
| 1133 } | 1143 } |
| 1134 case kUnboxedInt32: | 1144 case kUnboxedInt32: |
| 1135 deopt_instr = new(isolate()) DeoptInt32Instr( | 1145 deopt_instr = new(isolate()) DeoptInt32Instr( |
| 1136 ToCpuRegisterSource(source_loc)); | 1146 ToCpuRegisterSource(source_loc)); |
| 1137 break; | 1147 break; |
| 1138 case kUnboxedUint32: | 1148 case kUnboxedUint32: |
| 1139 deopt_instr = new(isolate()) DeoptUint32Instr( | 1149 deopt_instr = new(isolate()) DeoptUint32Instr( |
| 1140 ToCpuRegisterSource(source_loc)); | 1150 ToCpuRegisterSource(source_loc)); |
| 1141 break; | 1151 break; |
| (...skipping 194 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 1336 Smi* offset, | 1346 Smi* offset, |
| 1337 DeoptInfo* info, | 1347 DeoptInfo* info, |
| 1338 Smi* reason) { | 1348 Smi* reason) { |
| 1339 intptr_t i = index * kEntrySize; | 1349 intptr_t i = index * kEntrySize; |
| 1340 *offset ^= table.At(i); | 1350 *offset ^= table.At(i); |
| 1341 *info ^= table.At(i + 1); | 1351 *info ^= table.At(i + 1); |
| 1342 *reason ^= table.At(i + 2); | 1352 *reason ^= table.At(i + 2); |
| 1343 } | 1353 } |
| 1344 | 1354 |
| 1345 } // namespace dart | 1355 } // namespace dart |
| OLD | NEW |