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

Side by Side Diff: src/arm/lithium-arm.cc

Issue 112863002: Merge bleeding_edge 18021:18297 (Closed) Base URL: https://v8.googlecode.com/svn/branches/experimental/parser
Patch Set: Created 7 years 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 | « src/arm/lithium-arm.h ('k') | src/arm/lithium-codegen-arm.h » ('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 2012 the V8 project authors. All rights reserved. 1 // Copyright 2012 the V8 project authors. All rights reserved.
2 // Redistribution and use in source and binary forms, with or without 2 // Redistribution and use in source and binary forms, with or without
3 // modification, are permitted provided that the following conditions are 3 // modification, are permitted provided that the following conditions are
4 // met: 4 // met:
5 // 5 //
6 // * Redistributions of source code must retain the above copyright 6 // * Redistributions of source code must retain the above copyright
7 // notice, this list of conditions and the following disclaimer. 7 // notice, this list of conditions and the following disclaimer.
8 // * Redistributions in binary form must reproduce the above 8 // * Redistributions in binary form must reproduce the above
9 // copyright notice, this list of conditions and the following 9 // copyright notice, this list of conditions and the following
10 // disclaimer in the documentation and/or other materials provided 10 // disclaimer in the documentation and/or other materials provided
(...skipping 238 matching lines...) Expand 10 before | Expand all | Expand 10 after
249 *hydrogen()->class_name(), 249 *hydrogen()->class_name(),
250 true_block_id(), 250 true_block_id(),
251 false_block_id()); 251 false_block_id());
252 } 252 }
253 253
254 254
255 void LTypeofIsAndBranch::PrintDataTo(StringStream* stream) { 255 void LTypeofIsAndBranch::PrintDataTo(StringStream* stream) {
256 stream->Add("if typeof "); 256 stream->Add("if typeof ");
257 value()->PrintTo(stream); 257 value()->PrintTo(stream);
258 stream->Add(" == \"%s\" then B%d else B%d", 258 stream->Add(" == \"%s\" then B%d else B%d",
259 *hydrogen()->type_literal()->ToCString(), 259 hydrogen()->type_literal()->ToCString().get(),
260 true_block_id(), false_block_id()); 260 true_block_id(), false_block_id());
261 } 261 }
262 262
263 263
264 void LStoreCodeEntry::PrintDataTo(StringStream* stream) { 264 void LStoreCodeEntry::PrintDataTo(StringStream* stream) {
265 stream->Add(" = "); 265 stream->Add(" = ");
266 function()->PrintTo(stream); 266 function()->PrintTo(stream);
267 stream->Add(".code_entry = "); 267 stream->Add(".code_entry = ");
268 code_object()->PrintTo(stream); 268 code_object()->PrintTo(stream);
269 } 269 }
270 270
271 271
272 void LInnerAllocatedObject::PrintDataTo(StringStream* stream) { 272 void LInnerAllocatedObject::PrintDataTo(StringStream* stream) {
273 stream->Add(" = "); 273 stream->Add(" = ");
274 base_object()->PrintTo(stream); 274 base_object()->PrintTo(stream);
275 stream->Add(" + %d", offset()); 275 stream->Add(" + ");
276 offset()->PrintTo(stream);
276 } 277 }
277 278
278 279
279 void LCallConstantFunction::PrintDataTo(StringStream* stream) { 280 void LCallConstantFunction::PrintDataTo(StringStream* stream) {
280 stream->Add("#%d / ", arity()); 281 stream->Add("#%d / ", arity());
281 } 282 }
282 283
283 284
284 void LLoadContextSlot::PrintDataTo(StringStream* stream) { 285 void LLoadContextSlot::PrintDataTo(StringStream* stream) {
285 context()->PrintTo(stream); 286 context()->PrintTo(stream);
(...skipping 15 matching lines...) Expand all
301 } 302 }
302 303
303 304
304 void LCallKeyed::PrintDataTo(StringStream* stream) { 305 void LCallKeyed::PrintDataTo(StringStream* stream) {
305 stream->Add("[r2] #%d / ", arity()); 306 stream->Add("[r2] #%d / ", arity());
306 } 307 }
307 308
308 309
309 void LCallNamed::PrintDataTo(StringStream* stream) { 310 void LCallNamed::PrintDataTo(StringStream* stream) {
310 SmartArrayPointer<char> name_string = name()->ToCString(); 311 SmartArrayPointer<char> name_string = name()->ToCString();
311 stream->Add("%s #%d / ", *name_string, arity()); 312 stream->Add("%s #%d / ", name_string.get(), arity());
312 } 313 }
313 314
314 315
315 void LCallGlobal::PrintDataTo(StringStream* stream) { 316 void LCallGlobal::PrintDataTo(StringStream* stream) {
316 SmartArrayPointer<char> name_string = name()->ToCString(); 317 SmartArrayPointer<char> name_string = name()->ToCString();
317 stream->Add("%s #%d / ", *name_string, arity()); 318 stream->Add("%s #%d / ", name_string.get(), arity());
318 } 319 }
319 320
320 321
321 void LCallKnownGlobal::PrintDataTo(StringStream* stream) { 322 void LCallKnownGlobal::PrintDataTo(StringStream* stream) {
322 stream->Add("#%d / ", arity()); 323 stream->Add("#%d / ", arity());
323 } 324 }
324 325
325 326
326 void LCallNew::PrintDataTo(StringStream* stream) { 327 void LCallNew::PrintDataTo(StringStream* stream) {
327 stream->Add("= "); 328 stream->Add("= ");
(...skipping 24 matching lines...) Expand all
352 object()->PrintTo(stream); 353 object()->PrintTo(stream);
353 hydrogen()->access().PrintTo(stream); 354 hydrogen()->access().PrintTo(stream);
354 stream->Add(" <- "); 355 stream->Add(" <- ");
355 value()->PrintTo(stream); 356 value()->PrintTo(stream);
356 } 357 }
357 358
358 359
359 void LStoreNamedGeneric::PrintDataTo(StringStream* stream) { 360 void LStoreNamedGeneric::PrintDataTo(StringStream* stream) {
360 object()->PrintTo(stream); 361 object()->PrintTo(stream);
361 stream->Add("."); 362 stream->Add(".");
362 stream->Add(*String::cast(*name())->ToCString()); 363 stream->Add(String::cast(*name())->ToCString().get());
363 stream->Add(" <- "); 364 stream->Add(" <- ");
364 value()->PrintTo(stream); 365 value()->PrintTo(stream);
365 } 366 }
366 367
367 368
368 void LLoadKeyed::PrintDataTo(StringStream* stream) { 369 void LLoadKeyed::PrintDataTo(StringStream* stream) {
369 elements()->PrintTo(stream); 370 elements()->PrintTo(stream);
370 stream->Add("["); 371 stream->Add("[");
371 key()->PrintTo(stream); 372 key()->PrintTo(stream);
372 if (hydrogen()->IsDehoisted()) { 373 if (hydrogen()->IsDehoisted()) {
(...skipping 378 matching lines...) Expand 10 before | Expand all | Expand 10 after
751 } 752 }
752 } 753 }
753 754
754 755
755 LInstruction* LChunkBuilder::DoArithmeticD(Token::Value op, 756 LInstruction* LChunkBuilder::DoArithmeticD(Token::Value op,
756 HArithmeticBinaryOperation* instr) { 757 HArithmeticBinaryOperation* instr) {
757 ASSERT(instr->representation().IsDouble()); 758 ASSERT(instr->representation().IsDouble());
758 ASSERT(instr->left()->representation().IsDouble()); 759 ASSERT(instr->left()->representation().IsDouble());
759 ASSERT(instr->right()->representation().IsDouble()); 760 ASSERT(instr->right()->representation().IsDouble());
760 if (op == Token::MOD) { 761 if (op == Token::MOD) {
761 LOperand* left = UseFixedDouble(instr->left(), d1); 762 LOperand* left = UseFixedDouble(instr->left(), d0);
762 LOperand* right = UseFixedDouble(instr->right(), d2); 763 LOperand* right = UseFixedDouble(instr->right(), d1);
763 LArithmeticD* result = new(zone()) LArithmeticD(op, left, right); 764 LArithmeticD* result = new(zone()) LArithmeticD(op, left, right);
764 // We call a C function for double modulo. It can't trigger a GC. We need 765 return MarkAsCall(DefineFixedDouble(result, d0), instr);
765 // to use fixed result register for the call.
766 // TODO(fschneider): Allow any register as input registers.
767 return MarkAsCall(DefineFixedDouble(result, d1), instr);
768 } else { 766 } else {
769 LOperand* left = UseRegisterAtStart(instr->left()); 767 LOperand* left = UseRegisterAtStart(instr->left());
770 LOperand* right = UseRegisterAtStart(instr->right()); 768 LOperand* right = UseRegisterAtStart(instr->right());
771 LArithmeticD* result = new(zone()) LArithmeticD(op, left, right); 769 LArithmeticD* result = new(zone()) LArithmeticD(op, left, right);
772 return DefineAsRegister(result); 770 return DefineAsRegister(result);
773 } 771 }
774 } 772 }
775 773
776 774
777 LInstruction* LChunkBuilder::DoArithmeticT(Token::Value op, 775 LInstruction* LChunkBuilder::DoArithmeticT(Token::Value op,
(...skipping 302 matching lines...) Expand 10 before | Expand all | Expand 10 after
1080 UseFixed(instr->left(), r0), 1078 UseFixed(instr->left(), r0),
1081 FixedTemp(r4)); 1079 FixedTemp(r4));
1082 return MarkAsCall(DefineFixed(result, r0), instr); 1080 return MarkAsCall(DefineFixed(result, r0), instr);
1083 } 1081 }
1084 1082
1085 1083
1086 LInstruction* LChunkBuilder::DoWrapReceiver(HWrapReceiver* instr) { 1084 LInstruction* LChunkBuilder::DoWrapReceiver(HWrapReceiver* instr) {
1087 LOperand* receiver = UseRegisterAtStart(instr->receiver()); 1085 LOperand* receiver = UseRegisterAtStart(instr->receiver());
1088 LOperand* function = UseRegisterAtStart(instr->function()); 1086 LOperand* function = UseRegisterAtStart(instr->function());
1089 LWrapReceiver* result = new(zone()) LWrapReceiver(receiver, function); 1087 LWrapReceiver* result = new(zone()) LWrapReceiver(receiver, function);
1090 return AssignEnvironment(DefineSameAsFirst(result)); 1088 return AssignEnvironment(DefineAsRegister(result));
1091 } 1089 }
1092 1090
1093 1091
1094 LInstruction* LChunkBuilder::DoApplyArguments(HApplyArguments* instr) { 1092 LInstruction* LChunkBuilder::DoApplyArguments(HApplyArguments* instr) {
1095 LOperand* function = UseFixed(instr->function(), r1); 1093 LOperand* function = UseFixed(instr->function(), r1);
1096 LOperand* receiver = UseFixed(instr->receiver(), r0); 1094 LOperand* receiver = UseFixed(instr->receiver(), r0);
1097 LOperand* length = UseFixed(instr->length(), r2); 1095 LOperand* length = UseFixed(instr->length(), r2);
1098 LOperand* elements = UseFixed(instr->elements(), r3); 1096 LOperand* elements = UseFixed(instr->elements(), r3);
1099 LApplyArguments* result = new(zone()) LApplyArguments(function, 1097 LApplyArguments* result = new(zone()) LApplyArguments(function,
1100 receiver, 1098 receiver,
(...skipping 11 matching lines...) Expand all
1112 1110
1113 LInstruction* LChunkBuilder::DoStoreCodeEntry( 1111 LInstruction* LChunkBuilder::DoStoreCodeEntry(
1114 HStoreCodeEntry* store_code_entry) { 1112 HStoreCodeEntry* store_code_entry) {
1115 LOperand* function = UseRegister(store_code_entry->function()); 1113 LOperand* function = UseRegister(store_code_entry->function());
1116 LOperand* code_object = UseTempRegister(store_code_entry->code_object()); 1114 LOperand* code_object = UseTempRegister(store_code_entry->code_object());
1117 return new(zone()) LStoreCodeEntry(function, code_object); 1115 return new(zone()) LStoreCodeEntry(function, code_object);
1118 } 1116 }
1119 1117
1120 1118
1121 LInstruction* LChunkBuilder::DoInnerAllocatedObject( 1119 LInstruction* LChunkBuilder::DoInnerAllocatedObject(
1122 HInnerAllocatedObject* inner_object) { 1120 HInnerAllocatedObject* instr) {
1123 LOperand* base_object = UseRegisterAtStart(inner_object->base_object()); 1121 LOperand* base_object = UseRegisterAtStart(instr->base_object());
1124 LInnerAllocatedObject* result = 1122 LOperand* offset = UseRegisterOrConstantAtStart(instr->offset());
1125 new(zone()) LInnerAllocatedObject(base_object); 1123 return DefineAsRegister(
1126 return DefineAsRegister(result); 1124 new(zone()) LInnerAllocatedObject(base_object, offset));
1127 } 1125 }
1128 1126
1129 1127
1130 LInstruction* LChunkBuilder::DoThisFunction(HThisFunction* instr) { 1128 LInstruction* LChunkBuilder::DoThisFunction(HThisFunction* instr) {
1131 return instr->HasNoUses() 1129 return instr->HasNoUses()
1132 ? NULL 1130 ? NULL
1133 : DefineAsRegister(new(zone()) LThisFunction); 1131 : DefineAsRegister(new(zone()) LThisFunction);
1134 } 1132 }
1135 1133
1136 1134
(...skipping 45 matching lines...) Expand 10 before | Expand all | Expand 10 after
1182 return MarkAsCall(DefineFixed(result, r0), instr, CANNOT_DEOPTIMIZE_EAGERLY); 1180 return MarkAsCall(DefineFixed(result, r0), instr, CANNOT_DEOPTIMIZE_EAGERLY);
1183 } 1181 }
1184 1182
1185 1183
1186 LInstruction* LChunkBuilder::DoUnaryMathOperation(HUnaryMathOperation* instr) { 1184 LInstruction* LChunkBuilder::DoUnaryMathOperation(HUnaryMathOperation* instr) {
1187 switch (instr->op()) { 1185 switch (instr->op()) {
1188 case kMathFloor: return DoMathFloor(instr); 1186 case kMathFloor: return DoMathFloor(instr);
1189 case kMathRound: return DoMathRound(instr); 1187 case kMathRound: return DoMathRound(instr);
1190 case kMathAbs: return DoMathAbs(instr); 1188 case kMathAbs: return DoMathAbs(instr);
1191 case kMathLog: return DoMathLog(instr); 1189 case kMathLog: return DoMathLog(instr);
1192 case kMathSin: return DoMathSin(instr);
1193 case kMathCos: return DoMathCos(instr);
1194 case kMathTan: return DoMathTan(instr);
1195 case kMathExp: return DoMathExp(instr); 1190 case kMathExp: return DoMathExp(instr);
1196 case kMathSqrt: return DoMathSqrt(instr); 1191 case kMathSqrt: return DoMathSqrt(instr);
1197 case kMathPowHalf: return DoMathPowHalf(instr); 1192 case kMathPowHalf: return DoMathPowHalf(instr);
1198 default: 1193 default:
1199 UNREACHABLE(); 1194 UNREACHABLE();
1200 return NULL; 1195 return NULL;
1201 } 1196 }
1202 } 1197 }
1203 1198
1204 1199
(...skipping 23 matching lines...) Expand all
1228 } 1223 }
1229 1224
1230 1225
1231 LInstruction* LChunkBuilder::DoMathLog(HUnaryMathOperation* instr) { 1226 LInstruction* LChunkBuilder::DoMathLog(HUnaryMathOperation* instr) {
1232 LOperand* input = UseFixedDouble(instr->value(), d2); 1227 LOperand* input = UseFixedDouble(instr->value(), d2);
1233 LMathLog* result = new(zone()) LMathLog(input); 1228 LMathLog* result = new(zone()) LMathLog(input);
1234 return MarkAsCall(DefineFixedDouble(result, d2), instr); 1229 return MarkAsCall(DefineFixedDouble(result, d2), instr);
1235 } 1230 }
1236 1231
1237 1232
1238 LInstruction* LChunkBuilder::DoMathSin(HUnaryMathOperation* instr) {
1239 LOperand* input = UseFixedDouble(instr->value(), d2);
1240 LMathSin* result = new(zone()) LMathSin(input);
1241 return MarkAsCall(DefineFixedDouble(result, d2), instr);
1242 }
1243
1244
1245 LInstruction* LChunkBuilder::DoMathCos(HUnaryMathOperation* instr) {
1246 LOperand* input = UseFixedDouble(instr->value(), d2);
1247 LMathCos* result = new(zone()) LMathCos(input);
1248 return MarkAsCall(DefineFixedDouble(result, d2), instr);
1249 }
1250
1251
1252 LInstruction* LChunkBuilder::DoMathTan(HUnaryMathOperation* instr) {
1253 LOperand* input = UseFixedDouble(instr->value(), d2);
1254 LMathTan* result = new(zone()) LMathTan(input);
1255 return MarkAsCall(DefineFixedDouble(result, d2), instr);
1256 }
1257
1258
1259 LInstruction* LChunkBuilder::DoMathExp(HUnaryMathOperation* instr) { 1233 LInstruction* LChunkBuilder::DoMathExp(HUnaryMathOperation* instr) {
1260 ASSERT(instr->representation().IsDouble()); 1234 ASSERT(instr->representation().IsDouble());
1261 ASSERT(instr->value()->representation().IsDouble()); 1235 ASSERT(instr->value()->representation().IsDouble());
1262 LOperand* input = UseRegister(instr->value()); 1236 LOperand* input = UseRegister(instr->value());
1263 LOperand* temp1 = TempRegister(); 1237 LOperand* temp1 = TempRegister();
1264 LOperand* temp2 = TempRegister(); 1238 LOperand* temp2 = TempRegister();
1265 LOperand* double_temp = FixedTemp(d3); // Chosen by fair dice roll. 1239 LOperand* double_temp = FixedTemp(d3); // Chosen by fair dice roll.
1266 LMathExp* result = new(zone()) LMathExp(input, double_temp, temp1, temp2); 1240 LMathExp* result = new(zone()) LMathExp(input, double_temp, temp1, temp2);
1267 return DefineAsRegister(result); 1241 return DefineAsRegister(result);
1268 } 1242 }
1269 1243
1270 1244
1271 LInstruction* LChunkBuilder::DoMathSqrt(HUnaryMathOperation* instr) { 1245 LInstruction* LChunkBuilder::DoMathSqrt(HUnaryMathOperation* instr) {
1272 LOperand* input = UseRegister(instr->value()); 1246 LOperand* input = UseRegisterAtStart(instr->value());
1273 LMathSqrt* result = new(zone()) LMathSqrt(input); 1247 LMathSqrt* result = new(zone()) LMathSqrt(input);
1274 return DefineAsRegister(result); 1248 return DefineAsRegister(result);
1275 } 1249 }
1276 1250
1277 1251
1278 LInstruction* LChunkBuilder::DoMathPowHalf(HUnaryMathOperation* instr) { 1252 LInstruction* LChunkBuilder::DoMathPowHalf(HUnaryMathOperation* instr) {
1279 LOperand* input = UseFixedDouble(instr->value(), d2); 1253 LOperand* input = UseRegisterAtStart(instr->value());
1280 LOperand* temp = FixedTemp(d3); 1254 LMathPowHalf* result = new(zone()) LMathPowHalf(input);
1281 LMathPowHalf* result = new(zone()) LMathPowHalf(input, temp); 1255 return DefineAsRegister(result);
1282 return DefineFixedDouble(result, d2);
1283 } 1256 }
1284 1257
1285 1258
1286 LInstruction* LChunkBuilder::DoCallKeyed(HCallKeyed* instr) { 1259 LInstruction* LChunkBuilder::DoCallKeyed(HCallKeyed* instr) {
1287 ASSERT(instr->key()->representation().IsTagged()); 1260 ASSERT(instr->key()->representation().IsTagged());
1288 LOperand* context = UseFixed(instr->context(), cp); 1261 LOperand* context = UseFixed(instr->context(), cp);
1289 LOperand* key = UseFixed(instr->key(), r2); 1262 LOperand* key = UseFixed(instr->key(), r2);
1290 return MarkAsCall( 1263 return MarkAsCall(
1291 DefineFixed(new(zone()) LCallKeyed(context, key), r0), instr); 1264 DefineFixed(new(zone()) LCallKeyed(context, key), r0), instr);
1292 } 1265 }
(...skipping 177 matching lines...) Expand 10 before | Expand all | Expand 10 after
1470 1443
1471 LInstruction* LChunkBuilder::DoMod(HMod* instr) { 1444 LInstruction* LChunkBuilder::DoMod(HMod* instr) {
1472 HValue* left = instr->left(); 1445 HValue* left = instr->left();
1473 HValue* right = instr->right(); 1446 HValue* right = instr->right();
1474 if (instr->representation().IsSmiOrInteger32()) { 1447 if (instr->representation().IsSmiOrInteger32()) {
1475 ASSERT(instr->left()->representation().Equals(instr->representation())); 1448 ASSERT(instr->left()->representation().Equals(instr->representation()));
1476 ASSERT(instr->right()->representation().Equals(instr->representation())); 1449 ASSERT(instr->right()->representation().Equals(instr->representation()));
1477 if (instr->HasPowerOf2Divisor()) { 1450 if (instr->HasPowerOf2Divisor()) {
1478 ASSERT(!right->CanBeZero()); 1451 ASSERT(!right->CanBeZero());
1479 LModI* mod = new(zone()) LModI(UseRegisterAtStart(left), 1452 LModI* mod = new(zone()) LModI(UseRegisterAtStart(left),
1480 UseOrConstant(right)); 1453 UseConstant(right));
1481 LInstruction* result = DefineAsRegister(mod); 1454 LInstruction* result = DefineAsRegister(mod);
1482 return (left->CanBeNegative() && 1455 return (left->CanBeNegative() &&
1483 instr->CheckFlag(HValue::kBailoutOnMinusZero)) 1456 instr->CheckFlag(HValue::kBailoutOnMinusZero))
1484 ? AssignEnvironment(result) 1457 ? AssignEnvironment(result)
1485 : result; 1458 : result;
1486 } else if (CpuFeatures::IsSupported(SUDIV)) { 1459 } else if (CpuFeatures::IsSupported(SUDIV)) {
1487 LModI* mod = new(zone()) LModI(UseRegister(left), 1460 LModI* mod = new(zone()) LModI(UseRegister(left),
1488 UseRegister(right)); 1461 UseRegister(right));
1489 LInstruction* result = DefineAsRegister(mod); 1462 LInstruction* result = DefineAsRegister(mod);
1490 return (right->CanBeZero() || 1463 return (right->CanBeZero() ||
(...skipping 169 matching lines...) Expand 10 before | Expand all | Expand 10 after
1660 ASSERT(instr->left()->representation().Equals(instr->representation())); 1633 ASSERT(instr->left()->representation().Equals(instr->representation()));
1661 ASSERT(instr->right()->representation().Equals(instr->representation())); 1634 ASSERT(instr->right()->representation().Equals(instr->representation()));
1662 LOperand* left = UseRegisterAtStart(instr->BetterLeftOperand()); 1635 LOperand* left = UseRegisterAtStart(instr->BetterLeftOperand());
1663 LOperand* right = UseOrConstantAtStart(instr->BetterRightOperand()); 1636 LOperand* right = UseOrConstantAtStart(instr->BetterRightOperand());
1664 LAddI* add = new(zone()) LAddI(left, right); 1637 LAddI* add = new(zone()) LAddI(left, right);
1665 LInstruction* result = DefineAsRegister(add); 1638 LInstruction* result = DefineAsRegister(add);
1666 if (instr->CheckFlag(HValue::kCanOverflow)) { 1639 if (instr->CheckFlag(HValue::kCanOverflow)) {
1667 result = AssignEnvironment(result); 1640 result = AssignEnvironment(result);
1668 } 1641 }
1669 return result; 1642 return result;
1643 } else if (instr->representation().IsExternal()) {
1644 ASSERT(instr->left()->representation().IsExternal());
1645 ASSERT(instr->right()->representation().IsInteger32());
1646 ASSERT(!instr->CheckFlag(HValue::kCanOverflow));
1647 LOperand* left = UseRegisterAtStart(instr->left());
1648 LOperand* right = UseOrConstantAtStart(instr->right());
1649 LAddI* add = new(zone()) LAddI(left, right);
1650 LInstruction* result = DefineAsRegister(add);
1651 return result;
1670 } else if (instr->representation().IsDouble()) { 1652 } else if (instr->representation().IsDouble()) {
1671 if (instr->left()->IsMul()) { 1653 if (instr->left()->IsMul()) {
1672 return DoMultiplyAdd(HMul::cast(instr->left()), instr->right()); 1654 return DoMultiplyAdd(HMul::cast(instr->left()), instr->right());
1673 } 1655 }
1674 1656
1675 if (instr->right()->IsMul()) { 1657 if (instr->right()->IsMul()) {
1676 ASSERT(!instr->left()->IsMul()); 1658 ASSERT(!instr->left()->IsMul());
1677 return DoMultiplyAdd(HMul::cast(instr->right()), instr->left()); 1659 return DoMultiplyAdd(HMul::cast(instr->right()), instr->left());
1678 } 1660 }
1679 1661
(...skipping 22 matching lines...) Expand all
1702 return DefineAsRegister(new(zone()) LMathMinMax(left, right)); 1684 return DefineAsRegister(new(zone()) LMathMinMax(left, right));
1703 } 1685 }
1704 1686
1705 1687
1706 LInstruction* LChunkBuilder::DoPower(HPower* instr) { 1688 LInstruction* LChunkBuilder::DoPower(HPower* instr) {
1707 ASSERT(instr->representation().IsDouble()); 1689 ASSERT(instr->representation().IsDouble());
1708 // We call a C function for double power. It can't trigger a GC. 1690 // We call a C function for double power. It can't trigger a GC.
1709 // We need to use fixed result register for the call. 1691 // We need to use fixed result register for the call.
1710 Representation exponent_type = instr->right()->representation(); 1692 Representation exponent_type = instr->right()->representation();
1711 ASSERT(instr->left()->representation().IsDouble()); 1693 ASSERT(instr->left()->representation().IsDouble());
1712 LOperand* left = UseFixedDouble(instr->left(), d1); 1694 LOperand* left = UseFixedDouble(instr->left(), d0);
1713 LOperand* right = exponent_type.IsDouble() ? 1695 LOperand* right = exponent_type.IsDouble() ?
1714 UseFixedDouble(instr->right(), d2) : 1696 UseFixedDouble(instr->right(), d1) :
1715 UseFixed(instr->right(), r2); 1697 UseFixed(instr->right(), r2);
1716 LPower* result = new(zone()) LPower(left, right); 1698 LPower* result = new(zone()) LPower(left, right);
1717 return MarkAsCall(DefineFixedDouble(result, d3), 1699 return MarkAsCall(DefineFixedDouble(result, d2),
1718 instr, 1700 instr,
1719 CAN_DEOPTIMIZE_EAGERLY); 1701 CAN_DEOPTIMIZE_EAGERLY);
1720 } 1702 }
1721 1703
1722 1704
1723 LInstruction* LChunkBuilder::DoCompareGeneric(HCompareGeneric* instr) { 1705 LInstruction* LChunkBuilder::DoCompareGeneric(HCompareGeneric* instr) {
1724 ASSERT(instr->left()->representation().IsTagged()); 1706 ASSERT(instr->left()->representation().IsTagged());
1725 ASSERT(instr->right()->representation().IsTagged()); 1707 ASSERT(instr->right()->representation().IsTagged());
1726 LOperand* context = UseFixed(instr->context(), cp); 1708 LOperand* context = UseFixed(instr->context(), cp);
1727 LOperand* left = UseFixed(instr->left(), r1); 1709 LOperand* left = UseFixed(instr->left(), r1);
(...skipping 276 matching lines...) Expand 10 before | Expand all | Expand 10 after
2004 LDoubleToI* res = new(zone()) LDoubleToI(value); 1986 LDoubleToI* res = new(zone()) LDoubleToI(value);
2005 return AssignEnvironment(DefineAsRegister(res)); 1987 return AssignEnvironment(DefineAsRegister(res));
2006 } 1988 }
2007 } else if (from.IsInteger32()) { 1989 } else if (from.IsInteger32()) {
2008 info()->MarkAsDeferredCalling(); 1990 info()->MarkAsDeferredCalling();
2009 if (to.IsTagged()) { 1991 if (to.IsTagged()) {
2010 HValue* val = instr->value(); 1992 HValue* val = instr->value();
2011 LOperand* value = UseRegisterAtStart(val); 1993 LOperand* value = UseRegisterAtStart(val);
2012 if (val->CheckFlag(HInstruction::kUint32)) { 1994 if (val->CheckFlag(HInstruction::kUint32)) {
2013 LNumberTagU* result = new(zone()) LNumberTagU(value); 1995 LNumberTagU* result = new(zone()) LNumberTagU(value);
2014 return AssignEnvironment(AssignPointerMap(DefineSameAsFirst(result))); 1996 return AssignEnvironment(AssignPointerMap(DefineAsRegister(result)));
2015 } else if (val->HasRange() && val->range()->IsInSmiRange()) { 1997 } else if (val->HasRange() && val->range()->IsInSmiRange()) {
2016 return DefineAsRegister(new(zone()) LSmiTag(value)); 1998 return DefineAsRegister(new(zone()) LSmiTag(value));
2017 } else { 1999 } else {
2018 LNumberTagI* result = new(zone()) LNumberTagI(value); 2000 LNumberTagI* result = new(zone()) LNumberTagI(value);
2019 return AssignEnvironment(AssignPointerMap(DefineAsRegister(result))); 2001 return AssignEnvironment(AssignPointerMap(DefineAsRegister(result)));
2020 } 2002 }
2021 } else if (to.IsSmi()) { 2003 } else if (to.IsSmi()) {
2022 HValue* val = instr->value(); 2004 HValue* val = instr->value();
2023 LOperand* value = UseRegister(val); 2005 LOperand* value = UseRegister(val);
2024 LInstruction* result = val->CheckFlag(HInstruction::kUint32) 2006 LInstruction* result = val->CheckFlag(HInstruction::kUint32)
2025 ? DefineSameAsFirst(new(zone()) LUint32ToSmi(value)) 2007 ? DefineAsRegister(new(zone()) LUint32ToSmi(value))
2026 : DefineSameAsFirst(new(zone()) LInteger32ToSmi(value)); 2008 : DefineAsRegister(new(zone()) LInteger32ToSmi(value));
2027 if (val->HasRange() && val->range()->IsInSmiRange()) { 2009 if (val->HasRange() && val->range()->IsInSmiRange()) {
2028 return result; 2010 return result;
2029 } 2011 }
2030 return AssignEnvironment(result); 2012 return AssignEnvironment(result);
2031 } else { 2013 } else {
2032 ASSERT(to.IsDouble()); 2014 ASSERT(to.IsDouble());
2033 if (instr->value()->CheckFlag(HInstruction::kUint32)) { 2015 if (instr->value()->CheckFlag(HInstruction::kUint32)) {
2034 return DefineAsRegister( 2016 return DefineAsRegister(
2035 new(zone()) LUint32ToDouble(UseRegister(instr->value()))); 2017 new(zone()) LUint32ToDouble(UseRegister(instr->value())));
2036 } else { 2018 } else {
(...skipping 517 matching lines...) Expand 10 before | Expand all | Expand 10 after
2554 LOperand* context = UseFixed(instr->context(), cp); 2536 LOperand* context = UseFixed(instr->context(), cp);
2555 LTypeof* result = new(zone()) LTypeof(context, UseFixed(instr->value(), r0)); 2537 LTypeof* result = new(zone()) LTypeof(context, UseFixed(instr->value(), r0));
2556 return MarkAsCall(DefineFixed(result, r0), instr); 2538 return MarkAsCall(DefineFixed(result, r0), instr);
2557 } 2539 }
2558 2540
2559 2541
2560 LInstruction* LChunkBuilder::DoTypeofIsAndBranch(HTypeofIsAndBranch* instr) { 2542 LInstruction* LChunkBuilder::DoTypeofIsAndBranch(HTypeofIsAndBranch* instr) {
2561 LInstruction* goto_instr = CheckElideControlInstruction(instr); 2543 LInstruction* goto_instr = CheckElideControlInstruction(instr);
2562 if (goto_instr != NULL) return goto_instr; 2544 if (goto_instr != NULL) return goto_instr;
2563 2545
2564 return new(zone()) LTypeofIsAndBranch(UseTempRegister(instr->value())); 2546 return new(zone()) LTypeofIsAndBranch(UseRegister(instr->value()));
2565 } 2547 }
2566 2548
2567 2549
2568 LInstruction* LChunkBuilder::DoIsConstructCallAndBranch( 2550 LInstruction* LChunkBuilder::DoIsConstructCallAndBranch(
2569 HIsConstructCallAndBranch* instr) { 2551 HIsConstructCallAndBranch* instr) {
2570 return new(zone()) LIsConstructCallAndBranch(TempRegister()); 2552 return new(zone()) LIsConstructCallAndBranch(TempRegister());
2571 } 2553 }
2572 2554
2573 2555
2574 LInstruction* LChunkBuilder::DoSimulate(HSimulate* instr) { 2556 LInstruction* LChunkBuilder::DoSimulate(HSimulate* instr) {
(...skipping 89 matching lines...) Expand 10 before | Expand all | Expand 10 after
2664 return AssignEnvironment(new(zone()) LCheckMapValue(value, map)); 2646 return AssignEnvironment(new(zone()) LCheckMapValue(value, map));
2665 } 2647 }
2666 2648
2667 2649
2668 LInstruction* LChunkBuilder::DoLoadFieldByIndex(HLoadFieldByIndex* instr) { 2650 LInstruction* LChunkBuilder::DoLoadFieldByIndex(HLoadFieldByIndex* instr) {
2669 LOperand* object = UseRegister(instr->object()); 2651 LOperand* object = UseRegister(instr->object());
2670 LOperand* index = UseRegister(instr->index()); 2652 LOperand* index = UseRegister(instr->index());
2671 return DefineAsRegister(new(zone()) LLoadFieldByIndex(object, index)); 2653 return DefineAsRegister(new(zone()) LLoadFieldByIndex(object, index));
2672 } 2654 }
2673 2655
2674
2675 } } // namespace v8::internal 2656 } } // namespace v8::internal
OLDNEW
« no previous file with comments | « src/arm/lithium-arm.h ('k') | src/arm/lithium-codegen-arm.h » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698