Chromium Code Reviews
chromiumcodereview-hr@appspot.gserviceaccount.com (chromiumcodereview-hr) | Please choose your nickname with Settings | Help | Chromium Project | Gerrit Changes | Sign out
(346)

Side by Side Diff: runtime/vm/deopt_instructions.cc

Issue 172653002: Unbox/Box Float64x2 and inline typed array loads and stores (Closed) Base URL: https://dart.googlecode.com/svn/branches/bleeding_edge/dart
Patch Set: Created 6 years, 10 months ago
Use n/p to move between diff chunks; N/P to move between comments. Draft comments are only viewable by you.
Jump to:
View unified diff | Download patch | Annotate | Revision Log
« no previous file with comments | « runtime/vm/deopt_instructions.h ('k') | runtime/vm/flow_graph_allocator.cc » ('j') | no next file with comments »
Toggle Intra-line Diffs ('i') | Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
OLDNEW
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 494 matching lines...) Expand 10 before | Expand all | Expand 10 after
505 *source_addr, reinterpret_cast<RawFloat32x4**>(dest_addr)); 505 *source_addr, reinterpret_cast<RawFloat32x4**>(dest_addr));
506 } 506 }
507 507
508 private: 508 private:
509 const intptr_t stack_slot_index_; // First argument is 0, always >= 0. 509 const intptr_t stack_slot_index_; // First argument is 0, always >= 0.
510 510
511 DISALLOW_COPY_AND_ASSIGN(DeoptFloat32x4StackSlotInstr); 511 DISALLOW_COPY_AND_ASSIGN(DeoptFloat32x4StackSlotInstr);
512 }; 512 };
513 513
514 514
515 class DeoptFloat64x2StackSlotInstr : public DeoptInstr {
516 public:
517 explicit DeoptFloat64x2StackSlotInstr(intptr_t source_index)
518 : stack_slot_index_(source_index) {
519 ASSERT(stack_slot_index_ >= 0);
520 }
521
522 virtual intptr_t source_index() const { return stack_slot_index_; }
523 virtual DeoptInstr::Kind kind() const { return kFloat64x2StackSlot; }
524
525 virtual const char* ToCString() const {
526 return Isolate::Current()->current_zone()->PrintToString(
527 "f64x2s%" Pd "", stack_slot_index_);
528 }
529
530 void Execute(DeoptContext* deopt_context, intptr_t* dest_addr) {
531 intptr_t source_index =
532 deopt_context->source_frame_size() - stack_slot_index_ - 1;
533 simd128_value_t* source_addr = reinterpret_cast<simd128_value_t*>(
534 deopt_context->GetSourceFrameAddressAt(source_index));
535 *reinterpret_cast<RawSmi**>(dest_addr) = Smi::New(0);
536 deopt_context->DeferFloat64x2Materialization(
537 *source_addr, reinterpret_cast<RawFloat64x2**>(dest_addr));
538 }
539
540 private:
541 const intptr_t stack_slot_index_; // First argument is 0, always >= 0.
542
543 DISALLOW_COPY_AND_ASSIGN(DeoptFloat64x2StackSlotInstr);
544 };
545
546
515 class DeoptInt32x4StackSlotInstr : public DeoptInstr { 547 class DeoptInt32x4StackSlotInstr : public DeoptInstr {
516 public: 548 public:
517 explicit DeoptInt32x4StackSlotInstr(intptr_t source_index) 549 explicit DeoptInt32x4StackSlotInstr(intptr_t source_index)
518 : stack_slot_index_(source_index) { 550 : stack_slot_index_(source_index) {
519 ASSERT(stack_slot_index_ >= 0); 551 ASSERT(stack_slot_index_ >= 0);
520 } 552 }
521 553
522 virtual intptr_t source_index() const { return stack_slot_index_; } 554 virtual intptr_t source_index() const { return stack_slot_index_; }
523 virtual DeoptInstr::Kind kind() const { return kInt32x4StackSlot; } 555 virtual DeoptInstr::Kind kind() const { return kInt32x4StackSlot; }
524 556
(...skipping 218 matching lines...) Expand 10 before | Expand all | Expand 10 after
743 value, reinterpret_cast<RawFloat32x4**>(dest_addr)); 775 value, reinterpret_cast<RawFloat32x4**>(dest_addr));
744 } 776 }
745 777
746 private: 778 private:
747 const FpuRegister reg_; 779 const FpuRegister reg_;
748 780
749 DISALLOW_COPY_AND_ASSIGN(DeoptFloat32x4FpuRegisterInstr); 781 DISALLOW_COPY_AND_ASSIGN(DeoptFloat32x4FpuRegisterInstr);
750 }; 782 };
751 783
752 784
785 class DeoptFloat64x2FpuRegisterInstr: public DeoptInstr {
786 public:
787 explicit DeoptFloat64x2FpuRegisterInstr(intptr_t reg_as_int)
788 : reg_(static_cast<FpuRegister>(reg_as_int)) {}
789
790 virtual intptr_t source_index() const { return static_cast<intptr_t>(reg_); }
791 virtual DeoptInstr::Kind kind() const { return kFloat64x2FpuRegister; }
792
793 virtual const char* ToCString() const {
794 return Isolate::Current()->current_zone()->PrintToString(
795 "%s(f64x2)", Assembler::FpuRegisterName(reg_));
796 }
797
798 void Execute(DeoptContext* deopt_context, intptr_t* dest_addr) {
799 simd128_value_t value = deopt_context->FpuRegisterValueAsSimd128(reg_);
800 *reinterpret_cast<RawSmi**>(dest_addr) = Smi::New(0);
801 deopt_context->DeferFloat64x2Materialization(
802 value, reinterpret_cast<RawFloat64x2**>(dest_addr));
803 }
804
805 private:
806 const FpuRegister reg_;
807
808 DISALLOW_COPY_AND_ASSIGN(DeoptFloat64x2FpuRegisterInstr);
809 };
810
811
753 // Deoptimization instruction moving an XMM register. 812 // Deoptimization instruction moving an XMM register.
754 class DeoptInt32x4FpuRegisterInstr: public DeoptInstr { 813 class DeoptInt32x4FpuRegisterInstr: public DeoptInstr {
755 public: 814 public:
756 explicit DeoptInt32x4FpuRegisterInstr(intptr_t reg_as_int) 815 explicit DeoptInt32x4FpuRegisterInstr(intptr_t reg_as_int)
757 : reg_(static_cast<FpuRegister>(reg_as_int)) {} 816 : reg_(static_cast<FpuRegister>(reg_as_int)) {}
758 817
759 virtual intptr_t source_index() const { return static_cast<intptr_t>(reg_); } 818 virtual intptr_t source_index() const { return static_cast<intptr_t>(reg_); }
760 virtual DeoptInstr::Kind kind() const { return kInt32x4FpuRegister; } 819 virtual DeoptInstr::Kind kind() const { return kInt32x4FpuRegister; }
761 820
762 virtual const char* ToCString() const { 821 virtual const char* ToCString() const {
(...skipping 307 matching lines...) Expand 10 before | Expand all | Expand 10 after
1070 1129
1071 1130
1072 DeoptInstr* DeoptInstr::Create(intptr_t kind_as_int, intptr_t source_index) { 1131 DeoptInstr* DeoptInstr::Create(intptr_t kind_as_int, intptr_t source_index) {
1073 Kind kind = static_cast<Kind>(kind_as_int); 1132 Kind kind = static_cast<Kind>(kind_as_int);
1074 switch (kind) { 1133 switch (kind) {
1075 case kStackSlot: return new DeoptStackSlotInstr(source_index); 1134 case kStackSlot: return new DeoptStackSlotInstr(source_index);
1076 case kDoubleStackSlot: return new DeoptDoubleStackSlotInstr(source_index); 1135 case kDoubleStackSlot: return new DeoptDoubleStackSlotInstr(source_index);
1077 case kInt64StackSlot: return new DeoptInt64StackSlotInstr(source_index); 1136 case kInt64StackSlot: return new DeoptInt64StackSlotInstr(source_index);
1078 case kFloat32x4StackSlot: 1137 case kFloat32x4StackSlot:
1079 return new DeoptFloat32x4StackSlotInstr(source_index); 1138 return new DeoptFloat32x4StackSlotInstr(source_index);
1139 case kFloat64x2StackSlot:
1140 return new DeoptFloat64x2StackSlotInstr(source_index);
1080 case kInt32x4StackSlot: 1141 case kInt32x4StackSlot:
1081 return new DeoptInt32x4StackSlotInstr(source_index); 1142 return new DeoptInt32x4StackSlotInstr(source_index);
1082 case kRetAddress: return new DeoptRetAddressInstr(source_index); 1143 case kRetAddress: return new DeoptRetAddressInstr(source_index);
1083 case kConstant: return new DeoptConstantInstr(source_index); 1144 case kConstant: return new DeoptConstantInstr(source_index);
1084 case kRegister: return new DeoptRegisterInstr(source_index); 1145 case kRegister: return new DeoptRegisterInstr(source_index);
1085 case kFpuRegister: return new DeoptFpuRegisterInstr(source_index); 1146 case kFpuRegister: return new DeoptFpuRegisterInstr(source_index);
1086 case kInt64FpuRegister: return new DeoptInt64FpuRegisterInstr(source_index); 1147 case kInt64FpuRegister: return new DeoptInt64FpuRegisterInstr(source_index);
1087 case kFloat32x4FpuRegister: 1148 case kFloat32x4FpuRegister:
1088 return new DeoptFloat32x4FpuRegisterInstr(source_index); 1149 return new DeoptFloat32x4FpuRegisterInstr(source_index);
1150 case kFloat64x2FpuRegister:
1151 return new DeoptFloat64x2FpuRegisterInstr(source_index);
1089 case kInt32x4FpuRegister: 1152 case kInt32x4FpuRegister:
1090 return new DeoptInt32x4FpuRegisterInstr(source_index); 1153 return new DeoptInt32x4FpuRegisterInstr(source_index);
1091 case kPcMarker: return new DeoptPcMarkerInstr(source_index); 1154 case kPcMarker: return new DeoptPcMarkerInstr(source_index);
1092 case kPp: return new DeoptPpInstr(source_index); 1155 case kPp: return new DeoptPpInstr(source_index);
1093 case kCallerFp: return new DeoptCallerFpInstr(); 1156 case kCallerFp: return new DeoptCallerFpInstr();
1094 case kCallerPp: return new DeoptCallerPpInstr(); 1157 case kCallerPp: return new DeoptCallerPpInstr();
1095 case kCallerPc: return new DeoptCallerPcInstr(); 1158 case kCallerPc: return new DeoptCallerPcInstr();
1096 case kSuffix: return new DeoptSuffixInstr(source_index); 1159 case kSuffix: return new DeoptSuffixInstr(source_index);
1097 case kMaterializedObjectRef: 1160 case kMaterializedObjectRef:
1098 return new DeoptMaterializedObjectRefInstr(source_index); 1161 return new DeoptMaterializedObjectRefInstr(source_index);
(...skipping 111 matching lines...) Expand 10 before | Expand all | Expand 10 after
1210 } else if (source_loc.IsRegister()) { 1273 } else if (source_loc.IsRegister()) {
1211 ASSERT(value->definition()->representation() == kTagged); 1274 ASSERT(value->definition()->representation() == kTagged);
1212 deopt_instr = new DeoptRegisterInstr(source_loc.reg()); 1275 deopt_instr = new DeoptRegisterInstr(source_loc.reg());
1213 } else if (source_loc.IsFpuRegister()) { 1276 } else if (source_loc.IsFpuRegister()) {
1214 if (value->definition()->representation() == kUnboxedDouble) { 1277 if (value->definition()->representation() == kUnboxedDouble) {
1215 deopt_instr = new DeoptFpuRegisterInstr(source_loc.fpu_reg()); 1278 deopt_instr = new DeoptFpuRegisterInstr(source_loc.fpu_reg());
1216 } else if (value->definition()->representation() == kUnboxedMint) { 1279 } else if (value->definition()->representation() == kUnboxedMint) {
1217 deopt_instr = new DeoptInt64FpuRegisterInstr(source_loc.fpu_reg()); 1280 deopt_instr = new DeoptInt64FpuRegisterInstr(source_loc.fpu_reg());
1218 } else if (value->definition()->representation() == kUnboxedFloat32x4) { 1281 } else if (value->definition()->representation() == kUnboxedFloat32x4) {
1219 deopt_instr = new DeoptFloat32x4FpuRegisterInstr(source_loc.fpu_reg()); 1282 deopt_instr = new DeoptFloat32x4FpuRegisterInstr(source_loc.fpu_reg());
1283 } else if (value->definition()->representation() == kUnboxedInt32x4) {
1284 deopt_instr = new DeoptInt32x4FpuRegisterInstr(source_loc.fpu_reg());
1220 } else { 1285 } else {
1221 ASSERT(value->definition()->representation() == kUnboxedInt32x4); 1286 ASSERT(value->definition()->representation() == kUnboxedFloat64x2);
1222 deopt_instr = new DeoptInt32x4FpuRegisterInstr(source_loc.fpu_reg()); 1287 deopt_instr = new DeoptFloat64x2FpuRegisterInstr(source_loc.fpu_reg());
1223 } 1288 }
1224 } else if (source_loc.IsStackSlot()) { 1289 } else if (source_loc.IsStackSlot()) {
1225 ASSERT(value->definition()->representation() == kTagged); 1290 ASSERT(value->definition()->representation() == kTagged);
1226 intptr_t source_index = CalculateStackIndex(source_loc); 1291 intptr_t source_index = CalculateStackIndex(source_loc);
1227 deopt_instr = new DeoptStackSlotInstr(source_index); 1292 deopt_instr = new DeoptStackSlotInstr(source_index);
1228 } else if (source_loc.IsDoubleStackSlot()) { 1293 } else if (source_loc.IsDoubleStackSlot()) {
1229 intptr_t source_index = CalculateStackIndex(source_loc); 1294 intptr_t source_index = CalculateStackIndex(source_loc);
1230 if (value->definition()->representation() == kUnboxedDouble) { 1295 if (value->definition()->representation() == kUnboxedDouble) {
1231 deopt_instr = new DeoptDoubleStackSlotInstr(source_index); 1296 deopt_instr = new DeoptDoubleStackSlotInstr(source_index);
1232 } else { 1297 } else {
1233 ASSERT(value->definition()->representation() == kUnboxedMint); 1298 ASSERT(value->definition()->representation() == kUnboxedMint);
1234 deopt_instr = new DeoptInt64StackSlotInstr(source_index); 1299 deopt_instr = new DeoptInt64StackSlotInstr(source_index);
1235 } 1300 }
1236 } else if (source_loc.IsQuadStackSlot()) { 1301 } else if (source_loc.IsQuadStackSlot()) {
1237 intptr_t source_index = CalculateStackIndex(source_loc); 1302 intptr_t source_index = CalculateStackIndex(source_loc);
1238 if (value->definition()->representation() == kUnboxedFloat32x4) { 1303 if (value->definition()->representation() == kUnboxedFloat32x4) {
1239 deopt_instr = new DeoptFloat32x4StackSlotInstr(source_index); 1304 deopt_instr = new DeoptFloat32x4StackSlotInstr(source_index);
1305 } else if (value->definition()->representation() == kUnboxedInt32x4) {
1306 deopt_instr = new DeoptInt32x4StackSlotInstr(source_index);
1240 } else { 1307 } else {
1241 ASSERT(value->definition()->representation() == kUnboxedInt32x4); 1308 ASSERT(value->definition()->representation() == kUnboxedFloat64x2);
1242 deopt_instr = new DeoptInt32x4StackSlotInstr(source_index); 1309 deopt_instr = new DeoptFloat64x2StackSlotInstr(source_index);
1243 } 1310 }
1244 } else if (source_loc.IsInvalid() && 1311 } else if (source_loc.IsInvalid() &&
1245 value->definition()->IsMaterializeObject()) { 1312 value->definition()->IsMaterializeObject()) {
1246 const intptr_t index = FindMaterialization( 1313 const intptr_t index = FindMaterialization(
1247 value->definition()->AsMaterializeObject()); 1314 value->definition()->AsMaterializeObject());
1248 ASSERT(index >= 0); 1315 ASSERT(index >= 0);
1249 deopt_instr = new DeoptMaterializedObjectRefInstr(index); 1316 deopt_instr = new DeoptMaterializedObjectRefInstr(index);
1250 } else { 1317 } else {
1251 UNREACHABLE(); 1318 UNREACHABLE();
1252 } 1319 }
(...skipping 162 matching lines...) Expand 10 before | Expand all | Expand 10 after
1415 Smi* offset, 1482 Smi* offset,
1416 DeoptInfo* info, 1483 DeoptInfo* info,
1417 Smi* reason) { 1484 Smi* reason) {
1418 intptr_t i = index * kEntrySize; 1485 intptr_t i = index * kEntrySize;
1419 *offset ^= table.At(i); 1486 *offset ^= table.At(i);
1420 *info ^= table.At(i + 1); 1487 *info ^= table.At(i + 1);
1421 *reason ^= table.At(i + 2); 1488 *reason ^= table.At(i + 2);
1422 } 1489 }
1423 1490
1424 } // namespace dart 1491 } // namespace dart
OLDNEW
« no previous file with comments | « runtime/vm/deopt_instructions.h ('k') | runtime/vm/flow_graph_allocator.cc » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698