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

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

Issue 10807070: Various cleanups, adding tests. (Closed) Base URL: http://dart.googlecode.com/svn/branches/bleeding_edge/dart/
Patch Set: Created 8 years, 4 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/assembler_x64_test.cc ('k') | no next file » | 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_IA32. 5 #include "vm/globals.h" // Needed here to get TARGET_ARCH_IA32.
6 #if defined(TARGET_ARCH_IA32) 6 #if defined(TARGET_ARCH_IA32)
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 1091 matching lines...) Expand 10 before | Expand all | Expand 10 after
1102 __ SmiUntag(temp); 1102 __ SmiUntag(temp);
1103 __ cvtsi2sd(result, temp); 1103 __ cvtsi2sd(result, temp);
1104 __ Bind(&done); 1104 __ Bind(&done);
1105 } 1105 }
1106 1106
1107 1107
1108 #undef __ 1108 #undef __
1109 #define __ compiler_->assembler()-> 1109 #define __ compiler_->assembler()->
1110 1110
1111 1111
1112 static Address ToAddress(Location loc) { 1112 static Address ToSpillAddress(Location loc) {
1113 ASSERT(loc.IsSpillSlot()); 1113 ASSERT(loc.IsSpillSlot());
1114 const intptr_t offset = 1114 const intptr_t offset =
1115 (ParsedFunction::kFirstLocalSlotIndex - loc.spill_index()) * kWordSize; 1115 (ParsedFunction::kFirstLocalSlotIndex - loc.spill_index()) * kWordSize;
1116 return Address(EBP, offset); 1116 return Address(EBP, offset);
1117 } 1117 }
1118 1118
1119 1119
1120 void ParallelMoveResolver::EmitMove(int index) { 1120 void ParallelMoveResolver::EmitMove(int index) {
1121 MoveOperands* move = moves_[index]; 1121 MoveOperands* move = moves_[index];
1122 const Location source = move->src(); 1122 const Location source = move->src();
1123 const Location destination = move->dest(); 1123 const Location destination = move->dest();
1124 1124
1125 if (source.IsRegister()) { 1125 if (source.IsRegister()) {
1126 if (destination.IsRegister()) { 1126 if (destination.IsRegister()) {
1127 __ movl(destination.reg(), source.reg()); 1127 __ movl(destination.reg(), source.reg());
1128 } else { 1128 } else {
1129 ASSERT(destination.IsSpillSlot()); 1129 ASSERT(destination.IsSpillSlot());
1130 __ movl(ToAddress(destination), source.reg()); 1130 __ movl(ToSpillAddress(destination), source.reg());
1131 } 1131 }
1132 } else if (source.IsSpillSlot()) { 1132 } else if (source.IsSpillSlot()) {
1133 if (destination.IsRegister()) { 1133 if (destination.IsRegister()) {
1134 __ movl(destination.reg(), ToAddress(source)); 1134 __ movl(destination.reg(), ToSpillAddress(source));
1135 } else { 1135 } else {
1136 ASSERT(destination.IsSpillSlot()); 1136 ASSERT(destination.IsSpillSlot());
1137 MoveMemoryToMemory(ToAddress(destination), ToAddress(source)); 1137 MoveMemoryToMemory(ToSpillAddress(destination), ToSpillAddress(source));
1138 } 1138 }
1139 } else { 1139 } else {
1140 ASSERT(source.IsConstant()); 1140 ASSERT(source.IsConstant());
1141 if (destination.IsRegister()) { 1141 if (destination.IsRegister()) {
1142 __ LoadObject(destination.reg(), source.constant()); 1142 __ LoadObject(destination.reg(), source.constant());
1143 } else { 1143 } else {
1144 ASSERT(destination.IsSpillSlot()); 1144 ASSERT(destination.IsSpillSlot());
1145 StoreObject(ToAddress(destination), source.constant()); 1145 StoreObject(ToSpillAddress(destination), source.constant());
1146 } 1146 }
1147 } 1147 }
1148 1148
1149 move->Eliminate(); 1149 move->Eliminate();
1150 } 1150 }
1151 1151
1152 1152
1153 void ParallelMoveResolver::EmitSwap(int index) { 1153 void ParallelMoveResolver::EmitSwap(int index) {
1154 MoveOperands* move = moves_[index]; 1154 MoveOperands* move = moves_[index];
1155 const Location source = move->src(); 1155 const Location source = move->src();
1156 const Location destination = move->dest(); 1156 const Location destination = move->dest();
1157 1157
1158 if (source.IsRegister() && destination.IsRegister()) { 1158 if (source.IsRegister() && destination.IsRegister()) {
1159 __ xchgl(destination.reg(), source.reg()); 1159 __ xchgl(destination.reg(), source.reg());
1160 } else if (source.IsRegister() && destination.IsSpillSlot()) { 1160 } else if (source.IsRegister() && destination.IsSpillSlot()) {
1161 Exchange(source.reg(), ToAddress(destination)); 1161 Exchange(source.reg(), ToSpillAddress(destination));
1162 } else if (source.IsSpillSlot() && destination.IsRegister()) { 1162 } else if (source.IsSpillSlot() && destination.IsRegister()) {
1163 Exchange(destination.reg(), ToAddress(source)); 1163 Exchange(destination.reg(), ToSpillAddress(source));
1164 } else if (source.IsSpillSlot() && destination.IsSpillSlot()) { 1164 } else if (source.IsSpillSlot() && destination.IsSpillSlot()) {
1165 Exchange(ToAddress(destination), ToAddress(source)); 1165 Exchange(ToSpillAddress(destination), ToSpillAddress(source));
1166 } else { 1166 } else {
1167 UNREACHABLE(); 1167 UNREACHABLE();
1168 } 1168 }
1169 1169
1170 // The swap of source and destination has executed a move from source to 1170 // The swap of source and destination has executed a move from source to
1171 // destination. 1171 // destination.
1172 move->Eliminate(); 1172 move->Eliminate();
1173 1173
1174 // Any unperformed (including pending) move with a source of either 1174 // Any unperformed (including pending) move with a source of either
1175 // this move's source or destination needs to have their source 1175 // this move's source or destination needs to have their source
(...skipping 50 matching lines...) Expand 10 before | Expand all | Expand 10 after
1226 __ popl(ECX); 1226 __ popl(ECX);
1227 __ popl(EAX); 1227 __ popl(EAX);
1228 } 1228 }
1229 1229
1230 1230
1231 #undef __ 1231 #undef __
1232 1232
1233 } // namespace dart 1233 } // namespace dart
1234 1234
1235 #endif // defined TARGET_ARCH_IA32 1235 #endif // defined TARGET_ARCH_IA32
OLDNEW
« no previous file with comments | « runtime/vm/assembler_x64_test.cc ('k') | no next file » | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698