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

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

Issue 10806047: Fix crash during parallel moves. (Closed) Base URL: http://dart.googlecode.com/svn/branches/bleeding_edge/dart/
Patch Set: Created 8 years, 5 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/flow_graph_compiler_ia32.cc ('k') | runtime/vm/il_printer.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) 2012, the Dart project authors. Please see the AUTHORS file 1 // Copyright (c) 2012, 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/globals.h" // Needed here to get TARGET_ARCH_X64. 5 #include "vm/globals.h" // Needed here to get TARGET_ARCH_X64.
6 #if defined(TARGET_ARCH_X64) 6 #if defined(TARGET_ARCH_X64)
7 7
8 #include "vm/flow_graph_compiler.h" 8 #include "vm/flow_graph_compiler.h"
9 9
10 #include "lib/error.h" 10 #include "lib/error.h"
(...skipping 27 matching lines...) Expand all
38 } else { 38 } else {
39 // We have a deoptimization environment, we have to tear down optimized 39 // We have a deoptimization environment, we have to tear down optimized
40 // frame and recreate non-optimized one. 40 // frame and recreate non-optimized one.
41 __ leaq(RSP, 41 __ leaq(RSP,
42 Address(RBP, ParsedFunction::kFirstLocalSlotIndex * kWordSize)); 42 Address(RBP, ParsedFunction::kFirstLocalSlotIndex * kWordSize));
43 43
44 const GrowableArray<Value*>& values = deoptimization_env_->values(); 44 const GrowableArray<Value*>& values = deoptimization_env_->values();
45 const GrowableArray<Location>* locations = deoptimization_env_->locations(); 45 const GrowableArray<Location>* locations = deoptimization_env_->locations();
46 46
47 for (intptr_t i = 0; i < values.length(); i++) { 47 for (intptr_t i = 0; i < values.length(); i++) {
48 Location loc = (*locations)[i]; 48 const Location loc = (*locations)[i];
49 if (loc.IsInvalid()) { 49 if (loc.IsInvalid()) {
50 ASSERT(values[i]->IsConstant()); 50 ASSERT(values[i]->IsConstant());
51 __ PushObject(values[i]->AsConstant()->value()); 51 __ PushObject(values[i]->AsConstant()->value());
52 } else { 52 } else {
53 ASSERT(loc.IsRegister()); 53 ASSERT(loc.IsRegister());
54 __ pushq(loc.reg()); 54 __ pushq(loc.reg());
55 } 55 }
56 } 56 }
57 } 57 }
58 58
(...skipping 1047 matching lines...) Expand 10 before | Expand all | Expand 10 after
1106 __ cvtsi2sd(result, temp); 1106 __ cvtsi2sd(result, temp);
1107 __ Bind(&done); 1107 __ Bind(&done);
1108 } 1108 }
1109 1109
1110 1110
1111 #undef __ 1111 #undef __
1112 #define __ compiler_->assembler()-> 1112 #define __ compiler_->assembler()->
1113 1113
1114 1114
1115 void ParallelMoveResolver::EmitMove(int index) { 1115 void ParallelMoveResolver::EmitMove(int index) {
1116 Location source = moves_[index].src(); 1116 MoveOperands* move = moves_[index];
1117 Location destination = moves_[index].dest(); 1117 const Location source = move->src();
1118 const Location destination = move->dest();
1118 1119
1119 ASSERT(destination.IsRegister()); 1120 ASSERT(destination.IsRegister());
1120 if (source.IsRegister()) { 1121 if (source.IsRegister()) {
1121 __ movq(destination.reg(), source.reg()); 1122 __ movq(destination.reg(), source.reg());
1122 } else { 1123 } else {
1123 ASSERT(source.IsConstant()); 1124 ASSERT(source.IsConstant());
1124 __ LoadObject(destination.reg(), source.constant()); 1125 __ LoadObject(destination.reg(), source.constant());
1125 } 1126 }
1126 moves_[index].Eliminate(); 1127 move->Eliminate();
1127 } 1128 }
1128 1129
1129 1130
1130 void ParallelMoveResolver::EmitSwap(int index) { 1131 void ParallelMoveResolver::EmitSwap(int index) {
1131 Location source = moves_[index].src(); 1132 MoveOperands* move = moves_[index];
1132 Location destination = moves_[index].dest(); 1133 const Location source = move->src();
1134 const Location destination = move->dest();
1133 1135
1134 ASSERT(source.IsRegister() && destination.IsRegister()); 1136 ASSERT(source.IsRegister() && destination.IsRegister());
1135 __ xchgq(destination.reg(), source.reg()); 1137 __ xchgq(destination.reg(), source.reg());
1136 1138
1137 // The swap of source and destination has executed a move from source to 1139 // The swap of source and destination has executed a move from source to
1138 // destination. 1140 // destination.
1139 moves_[index].Eliminate(); 1141 move->Eliminate();
1140 1142
1141 // Any unperformed (including pending) move with a source of either 1143 // Any unperformed (including pending) move with a source of either
1142 // this move's source or destination needs to have their source 1144 // this move's source or destination needs to have their source
1143 // changed to reflect the state of affairs after the swap. 1145 // changed to reflect the state of affairs after the swap.
1144 for (int i = 0; i < moves_.length(); ++i) { 1146 for (int i = 0; i < moves_.length(); ++i) {
1145 MoveOperands other_move = moves_[i]; 1147 const MoveOperands& other_move = *moves_[i];
1146 if (other_move.Blocks(source)) { 1148 if (other_move.Blocks(source)) {
1147 moves_[i].set_src(destination); 1149 moves_[i]->set_src(destination);
1148 } else if (other_move.Blocks(destination)) { 1150 } else if (other_move.Blocks(destination)) {
1149 moves_[i].set_src(source); 1151 moves_[i]->set_src(source);
1150 } 1152 }
1151 } 1153 }
1152 } 1154 }
1153 1155
1154 1156
1155 #undef __ 1157 #undef __
1156 1158
1157 } // namespace dart 1159 } // namespace dart
1158 1160
1159 #endif // defined TARGET_ARCH_X64 1161 #endif // defined TARGET_ARCH_X64
OLDNEW
« no previous file with comments | « runtime/vm/flow_graph_compiler_ia32.cc ('k') | runtime/vm/il_printer.cc » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698