| OLD | NEW |
| 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 254 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 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 791 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 1077 UseFixed(instr->left(), r0), | 1078 UseFixed(instr->left(), r0), |
| 1078 FixedTemp(r4)); | 1079 FixedTemp(r4)); |
| 1079 return MarkAsCall(DefineFixed(result, r0), instr); | 1080 return MarkAsCall(DefineFixed(result, r0), instr); |
| 1080 } | 1081 } |
| 1081 | 1082 |
| 1082 | 1083 |
| 1083 LInstruction* LChunkBuilder::DoWrapReceiver(HWrapReceiver* instr) { | 1084 LInstruction* LChunkBuilder::DoWrapReceiver(HWrapReceiver* instr) { |
| 1084 LOperand* receiver = UseRegisterAtStart(instr->receiver()); | 1085 LOperand* receiver = UseRegisterAtStart(instr->receiver()); |
| 1085 LOperand* function = UseRegisterAtStart(instr->function()); | 1086 LOperand* function = UseRegisterAtStart(instr->function()); |
| 1086 LWrapReceiver* result = new(zone()) LWrapReceiver(receiver, function); | 1087 LWrapReceiver* result = new(zone()) LWrapReceiver(receiver, function); |
| 1087 return AssignEnvironment(DefineSameAsFirst(result)); | 1088 return AssignEnvironment(DefineAsRegister(result)); |
| 1088 } | 1089 } |
| 1089 | 1090 |
| 1090 | 1091 |
| 1091 LInstruction* LChunkBuilder::DoApplyArguments(HApplyArguments* instr) { | 1092 LInstruction* LChunkBuilder::DoApplyArguments(HApplyArguments* instr) { |
| 1092 LOperand* function = UseFixed(instr->function(), r1); | 1093 LOperand* function = UseFixed(instr->function(), r1); |
| 1093 LOperand* receiver = UseFixed(instr->receiver(), r0); | 1094 LOperand* receiver = UseFixed(instr->receiver(), r0); |
| 1094 LOperand* length = UseFixed(instr->length(), r2); | 1095 LOperand* length = UseFixed(instr->length(), r2); |
| 1095 LOperand* elements = UseFixed(instr->elements(), r3); | 1096 LOperand* elements = UseFixed(instr->elements(), r3); |
| 1096 LApplyArguments* result = new(zone()) LApplyArguments(function, | 1097 LApplyArguments* result = new(zone()) LApplyArguments(function, |
| 1097 receiver, | 1098 receiver, |
| (...skipping 11 matching lines...) Expand all Loading... |
| 1109 | 1110 |
| 1110 LInstruction* LChunkBuilder::DoStoreCodeEntry( | 1111 LInstruction* LChunkBuilder::DoStoreCodeEntry( |
| 1111 HStoreCodeEntry* store_code_entry) { | 1112 HStoreCodeEntry* store_code_entry) { |
| 1112 LOperand* function = UseRegister(store_code_entry->function()); | 1113 LOperand* function = UseRegister(store_code_entry->function()); |
| 1113 LOperand* code_object = UseTempRegister(store_code_entry->code_object()); | 1114 LOperand* code_object = UseTempRegister(store_code_entry->code_object()); |
| 1114 return new(zone()) LStoreCodeEntry(function, code_object); | 1115 return new(zone()) LStoreCodeEntry(function, code_object); |
| 1115 } | 1116 } |
| 1116 | 1117 |
| 1117 | 1118 |
| 1118 LInstruction* LChunkBuilder::DoInnerAllocatedObject( | 1119 LInstruction* LChunkBuilder::DoInnerAllocatedObject( |
| 1119 HInnerAllocatedObject* inner_object) { | 1120 HInnerAllocatedObject* instr) { |
| 1120 LOperand* base_object = UseRegisterAtStart(inner_object->base_object()); | 1121 LOperand* base_object = UseRegisterAtStart(instr->base_object()); |
| 1121 LInnerAllocatedObject* result = | 1122 LOperand* offset = UseRegisterOrConstantAtStart(instr->offset()); |
| 1122 new(zone()) LInnerAllocatedObject(base_object); | 1123 return DefineAsRegister( |
| 1123 return DefineAsRegister(result); | 1124 new(zone()) LInnerAllocatedObject(base_object, offset)); |
| 1124 } | 1125 } |
| 1125 | 1126 |
| 1126 | 1127 |
| 1127 LInstruction* LChunkBuilder::DoThisFunction(HThisFunction* instr) { | 1128 LInstruction* LChunkBuilder::DoThisFunction(HThisFunction* instr) { |
| 1128 return instr->HasNoUses() | 1129 return instr->HasNoUses() |
| 1129 ? NULL | 1130 ? NULL |
| 1130 : DefineAsRegister(new(zone()) LThisFunction); | 1131 : DefineAsRegister(new(zone()) LThisFunction); |
| 1131 } | 1132 } |
| 1132 | 1133 |
| 1133 | 1134 |
| (...skipping 45 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 1179 return MarkAsCall(DefineFixed(result, r0), instr, CANNOT_DEOPTIMIZE_EAGERLY); | 1180 return MarkAsCall(DefineFixed(result, r0), instr, CANNOT_DEOPTIMIZE_EAGERLY); |
| 1180 } | 1181 } |
| 1181 | 1182 |
| 1182 | 1183 |
| 1183 LInstruction* LChunkBuilder::DoUnaryMathOperation(HUnaryMathOperation* instr) { | 1184 LInstruction* LChunkBuilder::DoUnaryMathOperation(HUnaryMathOperation* instr) { |
| 1184 switch (instr->op()) { | 1185 switch (instr->op()) { |
| 1185 case kMathFloor: return DoMathFloor(instr); | 1186 case kMathFloor: return DoMathFloor(instr); |
| 1186 case kMathRound: return DoMathRound(instr); | 1187 case kMathRound: return DoMathRound(instr); |
| 1187 case kMathAbs: return DoMathAbs(instr); | 1188 case kMathAbs: return DoMathAbs(instr); |
| 1188 case kMathLog: return DoMathLog(instr); | 1189 case kMathLog: return DoMathLog(instr); |
| 1189 case kMathSin: return DoMathSin(instr); | |
| 1190 case kMathCos: return DoMathCos(instr); | |
| 1191 case kMathTan: return DoMathTan(instr); | |
| 1192 case kMathExp: return DoMathExp(instr); | 1190 case kMathExp: return DoMathExp(instr); |
| 1193 case kMathSqrt: return DoMathSqrt(instr); | 1191 case kMathSqrt: return DoMathSqrt(instr); |
| 1194 case kMathPowHalf: return DoMathPowHalf(instr); | 1192 case kMathPowHalf: return DoMathPowHalf(instr); |
| 1195 default: | 1193 default: |
| 1196 UNREACHABLE(); | 1194 UNREACHABLE(); |
| 1197 return NULL; | 1195 return NULL; |
| 1198 } | 1196 } |
| 1199 } | 1197 } |
| 1200 | 1198 |
| 1201 | 1199 |
| (...skipping 23 matching lines...) Expand all Loading... |
| 1225 } | 1223 } |
| 1226 | 1224 |
| 1227 | 1225 |
| 1228 LInstruction* LChunkBuilder::DoMathLog(HUnaryMathOperation* instr) { | 1226 LInstruction* LChunkBuilder::DoMathLog(HUnaryMathOperation* instr) { |
| 1229 LOperand* input = UseFixedDouble(instr->value(), d2); | 1227 LOperand* input = UseFixedDouble(instr->value(), d2); |
| 1230 LMathLog* result = new(zone()) LMathLog(input); | 1228 LMathLog* result = new(zone()) LMathLog(input); |
| 1231 return MarkAsCall(DefineFixedDouble(result, d2), instr); | 1229 return MarkAsCall(DefineFixedDouble(result, d2), instr); |
| 1232 } | 1230 } |
| 1233 | 1231 |
| 1234 | 1232 |
| 1235 LInstruction* LChunkBuilder::DoMathSin(HUnaryMathOperation* instr) { | |
| 1236 LOperand* input = UseFixedDouble(instr->value(), d2); | |
| 1237 LMathSin* result = new(zone()) LMathSin(input); | |
| 1238 return MarkAsCall(DefineFixedDouble(result, d2), instr); | |
| 1239 } | |
| 1240 | |
| 1241 | |
| 1242 LInstruction* LChunkBuilder::DoMathCos(HUnaryMathOperation* instr) { | |
| 1243 LOperand* input = UseFixedDouble(instr->value(), d2); | |
| 1244 LMathCos* result = new(zone()) LMathCos(input); | |
| 1245 return MarkAsCall(DefineFixedDouble(result, d2), instr); | |
| 1246 } | |
| 1247 | |
| 1248 | |
| 1249 LInstruction* LChunkBuilder::DoMathTan(HUnaryMathOperation* instr) { | |
| 1250 LOperand* input = UseFixedDouble(instr->value(), d2); | |
| 1251 LMathTan* result = new(zone()) LMathTan(input); | |
| 1252 return MarkAsCall(DefineFixedDouble(result, d2), instr); | |
| 1253 } | |
| 1254 | |
| 1255 | |
| 1256 LInstruction* LChunkBuilder::DoMathExp(HUnaryMathOperation* instr) { | 1233 LInstruction* LChunkBuilder::DoMathExp(HUnaryMathOperation* instr) { |
| 1257 ASSERT(instr->representation().IsDouble()); | 1234 ASSERT(instr->representation().IsDouble()); |
| 1258 ASSERT(instr->value()->representation().IsDouble()); | 1235 ASSERT(instr->value()->representation().IsDouble()); |
| 1259 LOperand* input = UseRegister(instr->value()); | 1236 LOperand* input = UseRegister(instr->value()); |
| 1260 LOperand* temp1 = TempRegister(); | 1237 LOperand* temp1 = TempRegister(); |
| 1261 LOperand* temp2 = TempRegister(); | 1238 LOperand* temp2 = TempRegister(); |
| 1262 LOperand* double_temp = FixedTemp(d3); // Chosen by fair dice roll. | 1239 LOperand* double_temp = FixedTemp(d3); // Chosen by fair dice roll. |
| 1263 LMathExp* result = new(zone()) LMathExp(input, double_temp, temp1, temp2); | 1240 LMathExp* result = new(zone()) LMathExp(input, double_temp, temp1, temp2); |
| 1264 return DefineAsRegister(result); | 1241 return DefineAsRegister(result); |
| 1265 } | 1242 } |
| (...skipping 200 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 1466 | 1443 |
| 1467 LInstruction* LChunkBuilder::DoMod(HMod* instr) { | 1444 LInstruction* LChunkBuilder::DoMod(HMod* instr) { |
| 1468 HValue* left = instr->left(); | 1445 HValue* left = instr->left(); |
| 1469 HValue* right = instr->right(); | 1446 HValue* right = instr->right(); |
| 1470 if (instr->representation().IsSmiOrInteger32()) { | 1447 if (instr->representation().IsSmiOrInteger32()) { |
| 1471 ASSERT(instr->left()->representation().Equals(instr->representation())); | 1448 ASSERT(instr->left()->representation().Equals(instr->representation())); |
| 1472 ASSERT(instr->right()->representation().Equals(instr->representation())); | 1449 ASSERT(instr->right()->representation().Equals(instr->representation())); |
| 1473 if (instr->HasPowerOf2Divisor()) { | 1450 if (instr->HasPowerOf2Divisor()) { |
| 1474 ASSERT(!right->CanBeZero()); | 1451 ASSERT(!right->CanBeZero()); |
| 1475 LModI* mod = new(zone()) LModI(UseRegisterAtStart(left), | 1452 LModI* mod = new(zone()) LModI(UseRegisterAtStart(left), |
| 1476 UseOrConstant(right)); | 1453 UseConstant(right)); |
| 1477 LInstruction* result = DefineAsRegister(mod); | 1454 LInstruction* result = DefineAsRegister(mod); |
| 1478 return (left->CanBeNegative() && | 1455 return (left->CanBeNegative() && |
| 1479 instr->CheckFlag(HValue::kBailoutOnMinusZero)) | 1456 instr->CheckFlag(HValue::kBailoutOnMinusZero)) |
| 1480 ? AssignEnvironment(result) | 1457 ? AssignEnvironment(result) |
| 1481 : result; | 1458 : result; |
| 1482 } else if (CpuFeatures::IsSupported(SUDIV)) { | 1459 } else if (CpuFeatures::IsSupported(SUDIV)) { |
| 1483 LModI* mod = new(zone()) LModI(UseRegister(left), | 1460 LModI* mod = new(zone()) LModI(UseRegister(left), |
| 1484 UseRegister(right)); | 1461 UseRegister(right)); |
| 1485 LInstruction* result = DefineAsRegister(mod); | 1462 LInstruction* result = DefineAsRegister(mod); |
| 1486 return (right->CanBeZero() || | 1463 return (right->CanBeZero() || |
| (...skipping 522 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 2009 LDoubleToI* res = new(zone()) LDoubleToI(value); | 1986 LDoubleToI* res = new(zone()) LDoubleToI(value); |
| 2010 return AssignEnvironment(DefineAsRegister(res)); | 1987 return AssignEnvironment(DefineAsRegister(res)); |
| 2011 } | 1988 } |
| 2012 } else if (from.IsInteger32()) { | 1989 } else if (from.IsInteger32()) { |
| 2013 info()->MarkAsDeferredCalling(); | 1990 info()->MarkAsDeferredCalling(); |
| 2014 if (to.IsTagged()) { | 1991 if (to.IsTagged()) { |
| 2015 HValue* val = instr->value(); | 1992 HValue* val = instr->value(); |
| 2016 LOperand* value = UseRegisterAtStart(val); | 1993 LOperand* value = UseRegisterAtStart(val); |
| 2017 if (val->CheckFlag(HInstruction::kUint32)) { | 1994 if (val->CheckFlag(HInstruction::kUint32)) { |
| 2018 LNumberTagU* result = new(zone()) LNumberTagU(value); | 1995 LNumberTagU* result = new(zone()) LNumberTagU(value); |
| 2019 return AssignEnvironment(AssignPointerMap(DefineSameAsFirst(result))); | 1996 return AssignEnvironment(AssignPointerMap(DefineAsRegister(result))); |
| 2020 } else if (val->HasRange() && val->range()->IsInSmiRange()) { | 1997 } else if (val->HasRange() && val->range()->IsInSmiRange()) { |
| 2021 return DefineAsRegister(new(zone()) LSmiTag(value)); | 1998 return DefineAsRegister(new(zone()) LSmiTag(value)); |
| 2022 } else { | 1999 } else { |
| 2023 LNumberTagI* result = new(zone()) LNumberTagI(value); | 2000 LNumberTagI* result = new(zone()) LNumberTagI(value); |
| 2024 return AssignEnvironment(AssignPointerMap(DefineAsRegister(result))); | 2001 return AssignEnvironment(AssignPointerMap(DefineAsRegister(result))); |
| 2025 } | 2002 } |
| 2026 } else if (to.IsSmi()) { | 2003 } else if (to.IsSmi()) { |
| 2027 HValue* val = instr->value(); | 2004 HValue* val = instr->value(); |
| 2028 LOperand* value = UseRegister(val); | 2005 LOperand* value = UseRegister(val); |
| 2029 LInstruction* result = val->CheckFlag(HInstruction::kUint32) | 2006 LInstruction* result = val->CheckFlag(HInstruction::kUint32) |
| (...skipping 639 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 2669 return AssignEnvironment(new(zone()) LCheckMapValue(value, map)); | 2646 return AssignEnvironment(new(zone()) LCheckMapValue(value, map)); |
| 2670 } | 2647 } |
| 2671 | 2648 |
| 2672 | 2649 |
| 2673 LInstruction* LChunkBuilder::DoLoadFieldByIndex(HLoadFieldByIndex* instr) { | 2650 LInstruction* LChunkBuilder::DoLoadFieldByIndex(HLoadFieldByIndex* instr) { |
| 2674 LOperand* object = UseRegister(instr->object()); | 2651 LOperand* object = UseRegister(instr->object()); |
| 2675 LOperand* index = UseRegister(instr->index()); | 2652 LOperand* index = UseRegister(instr->index()); |
| 2676 return DefineAsRegister(new(zone()) LLoadFieldByIndex(object, index)); | 2653 return DefineAsRegister(new(zone()) LLoadFieldByIndex(object, index)); |
| 2677 } | 2654 } |
| 2678 | 2655 |
| 2679 | |
| 2680 } } // namespace v8::internal | 2656 } } // namespace v8::internal |
| OLD | NEW |