| 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 259 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 270 stream->Add(" = "); | 270 stream->Add(" = "); |
| 271 function()->PrintTo(stream); | 271 function()->PrintTo(stream); |
| 272 stream->Add(".code_entry = "); | 272 stream->Add(".code_entry = "); |
| 273 code_object()->PrintTo(stream); | 273 code_object()->PrintTo(stream); |
| 274 } | 274 } |
| 275 | 275 |
| 276 | 276 |
| 277 void LInnerAllocatedObject::PrintDataTo(StringStream* stream) { | 277 void LInnerAllocatedObject::PrintDataTo(StringStream* stream) { |
| 278 stream->Add(" = "); | 278 stream->Add(" = "); |
| 279 base_object()->PrintTo(stream); | 279 base_object()->PrintTo(stream); |
| 280 stream->Add(" + %d", offset()); | 280 stream->Add(" + "); |
| 281 offset()->PrintTo(stream); |
| 281 } | 282 } |
| 282 | 283 |
| 283 | 284 |
| 284 void LCallConstantFunction::PrintDataTo(StringStream* stream) { | 285 void LCallConstantFunction::PrintDataTo(StringStream* stream) { |
| 285 stream->Add("#%d / ", arity()); | 286 stream->Add("#%d / ", arity()); |
| 286 } | 287 } |
| 287 | 288 |
| 288 | 289 |
| 289 void LLoadContextSlot::PrintDataTo(StringStream* stream) { | 290 void LLoadContextSlot::PrintDataTo(StringStream* stream) { |
| 290 context()->PrintTo(stream); | 291 context()->PrintTo(stream); |
| (...skipping 789 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 1080 UseFixed(instr->left(), a0), | 1081 UseFixed(instr->left(), a0), |
| 1081 FixedTemp(t0)); | 1082 FixedTemp(t0)); |
| 1082 return MarkAsCall(DefineFixed(result, v0), instr); | 1083 return MarkAsCall(DefineFixed(result, v0), instr); |
| 1083 } | 1084 } |
| 1084 | 1085 |
| 1085 | 1086 |
| 1086 LInstruction* LChunkBuilder::DoWrapReceiver(HWrapReceiver* instr) { | 1087 LInstruction* LChunkBuilder::DoWrapReceiver(HWrapReceiver* instr) { |
| 1087 LOperand* receiver = UseRegisterAtStart(instr->receiver()); | 1088 LOperand* receiver = UseRegisterAtStart(instr->receiver()); |
| 1088 LOperand* function = UseRegisterAtStart(instr->function()); | 1089 LOperand* function = UseRegisterAtStart(instr->function()); |
| 1089 LWrapReceiver* result = new(zone()) LWrapReceiver(receiver, function); | 1090 LWrapReceiver* result = new(zone()) LWrapReceiver(receiver, function); |
| 1090 return AssignEnvironment(DefineSameAsFirst(result)); | 1091 return AssignEnvironment(DefineAsRegister(result)); |
| 1091 } | 1092 } |
| 1092 | 1093 |
| 1093 | 1094 |
| 1094 LInstruction* LChunkBuilder::DoApplyArguments(HApplyArguments* instr) { | 1095 LInstruction* LChunkBuilder::DoApplyArguments(HApplyArguments* instr) { |
| 1095 LOperand* function = UseFixed(instr->function(), a1); | 1096 LOperand* function = UseFixed(instr->function(), a1); |
| 1096 LOperand* receiver = UseFixed(instr->receiver(), a0); | 1097 LOperand* receiver = UseFixed(instr->receiver(), a0); |
| 1097 LOperand* length = UseFixed(instr->length(), a2); | 1098 LOperand* length = UseFixed(instr->length(), a2); |
| 1098 LOperand* elements = UseFixed(instr->elements(), a3); | 1099 LOperand* elements = UseFixed(instr->elements(), a3); |
| 1099 LApplyArguments* result = new(zone()) LApplyArguments(function, | 1100 LApplyArguments* result = new(zone()) LApplyArguments(function, |
| 1100 receiver, | 1101 receiver, |
| (...skipping 11 matching lines...) Expand all Loading... |
| 1112 | 1113 |
| 1113 LInstruction* LChunkBuilder::DoStoreCodeEntry( | 1114 LInstruction* LChunkBuilder::DoStoreCodeEntry( |
| 1114 HStoreCodeEntry* store_code_entry) { | 1115 HStoreCodeEntry* store_code_entry) { |
| 1115 LOperand* function = UseRegister(store_code_entry->function()); | 1116 LOperand* function = UseRegister(store_code_entry->function()); |
| 1116 LOperand* code_object = UseTempRegister(store_code_entry->code_object()); | 1117 LOperand* code_object = UseTempRegister(store_code_entry->code_object()); |
| 1117 return new(zone()) LStoreCodeEntry(function, code_object); | 1118 return new(zone()) LStoreCodeEntry(function, code_object); |
| 1118 } | 1119 } |
| 1119 | 1120 |
| 1120 | 1121 |
| 1121 LInstruction* LChunkBuilder::DoInnerAllocatedObject( | 1122 LInstruction* LChunkBuilder::DoInnerAllocatedObject( |
| 1122 HInnerAllocatedObject* inner_object) { | 1123 HInnerAllocatedObject* instr) { |
| 1123 LOperand* base_object = UseRegisterAtStart(inner_object->base_object()); | 1124 LOperand* base_object = UseRegisterAtStart(instr->base_object()); |
| 1124 LInnerAllocatedObject* result = | 1125 LOperand* offset = UseRegisterOrConstantAtStart(instr->offset()); |
| 1125 new(zone()) LInnerAllocatedObject(base_object); | 1126 return DefineAsRegister( |
| 1126 return DefineAsRegister(result); | 1127 new(zone()) LInnerAllocatedObject(base_object, offset)); |
| 1127 } | 1128 } |
| 1128 | 1129 |
| 1129 | 1130 |
| 1130 LInstruction* LChunkBuilder::DoThisFunction(HThisFunction* instr) { | 1131 LInstruction* LChunkBuilder::DoThisFunction(HThisFunction* instr) { |
| 1131 return instr->HasNoUses() | 1132 return instr->HasNoUses() |
| 1132 ? NULL | 1133 ? NULL |
| 1133 : DefineAsRegister(new(zone()) LThisFunction); | 1134 : DefineAsRegister(new(zone()) LThisFunction); |
| 1134 } | 1135 } |
| 1135 | 1136 |
| 1136 | 1137 |
| (...skipping 45 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 1182 return MarkAsCall(DefineFixed(result, v0), instr, CANNOT_DEOPTIMIZE_EAGERLY); | 1183 return MarkAsCall(DefineFixed(result, v0), instr, CANNOT_DEOPTIMIZE_EAGERLY); |
| 1183 } | 1184 } |
| 1184 | 1185 |
| 1185 | 1186 |
| 1186 LInstruction* LChunkBuilder::DoUnaryMathOperation(HUnaryMathOperation* instr) { | 1187 LInstruction* LChunkBuilder::DoUnaryMathOperation(HUnaryMathOperation* instr) { |
| 1187 switch (instr->op()) { | 1188 switch (instr->op()) { |
| 1188 case kMathFloor: return DoMathFloor(instr); | 1189 case kMathFloor: return DoMathFloor(instr); |
| 1189 case kMathRound: return DoMathRound(instr); | 1190 case kMathRound: return DoMathRound(instr); |
| 1190 case kMathAbs: return DoMathAbs(instr); | 1191 case kMathAbs: return DoMathAbs(instr); |
| 1191 case kMathLog: return DoMathLog(instr); | 1192 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); | 1193 case kMathExp: return DoMathExp(instr); |
| 1196 case kMathSqrt: return DoMathSqrt(instr); | 1194 case kMathSqrt: return DoMathSqrt(instr); |
| 1197 case kMathPowHalf: return DoMathPowHalf(instr); | 1195 case kMathPowHalf: return DoMathPowHalf(instr); |
| 1198 default: | 1196 default: |
| 1199 UNREACHABLE(); | 1197 UNREACHABLE(); |
| 1200 return NULL; | 1198 return NULL; |
| 1201 } | 1199 } |
| 1202 } | 1200 } |
| 1203 | 1201 |
| 1204 | 1202 |
| 1205 LInstruction* LChunkBuilder::DoMathLog(HUnaryMathOperation* instr) { | 1203 LInstruction* LChunkBuilder::DoMathLog(HUnaryMathOperation* instr) { |
| 1206 LOperand* input = UseFixedDouble(instr->value(), f4); | 1204 LOperand* input = UseFixedDouble(instr->value(), f4); |
| 1207 LMathLog* result = new(zone()) LMathLog(input); | 1205 LMathLog* result = new(zone()) LMathLog(input); |
| 1208 return MarkAsCall(DefineFixedDouble(result, f4), instr); | 1206 return MarkAsCall(DefineFixedDouble(result, f4), instr); |
| 1209 } | 1207 } |
| 1210 | 1208 |
| 1211 | 1209 |
| 1212 LInstruction* LChunkBuilder::DoMathSin(HUnaryMathOperation* instr) { | |
| 1213 LOperand* input = UseFixedDouble(instr->value(), f4); | |
| 1214 LMathSin* result = new(zone()) LMathSin(input); | |
| 1215 return MarkAsCall(DefineFixedDouble(result, f4), instr); | |
| 1216 } | |
| 1217 | |
| 1218 | |
| 1219 LInstruction* LChunkBuilder::DoMathCos(HUnaryMathOperation* instr) { | |
| 1220 LOperand* input = UseFixedDouble(instr->value(), f4); | |
| 1221 LMathCos* result = new(zone()) LMathCos(input); | |
| 1222 return MarkAsCall(DefineFixedDouble(result, f4), instr); | |
| 1223 } | |
| 1224 | |
| 1225 | |
| 1226 LInstruction* LChunkBuilder::DoMathTan(HUnaryMathOperation* instr) { | |
| 1227 LOperand* input = UseFixedDouble(instr->value(), f4); | |
| 1228 LMathTan* result = new(zone()) LMathTan(input); | |
| 1229 return MarkAsCall(DefineFixedDouble(result, f4), instr); | |
| 1230 } | |
| 1231 | |
| 1232 | |
| 1233 LInstruction* LChunkBuilder::DoMathExp(HUnaryMathOperation* instr) { | 1210 LInstruction* LChunkBuilder::DoMathExp(HUnaryMathOperation* instr) { |
| 1234 ASSERT(instr->representation().IsDouble()); | 1211 ASSERT(instr->representation().IsDouble()); |
| 1235 ASSERT(instr->value()->representation().IsDouble()); | 1212 ASSERT(instr->value()->representation().IsDouble()); |
| 1236 LOperand* input = UseRegister(instr->value()); | 1213 LOperand* input = UseRegister(instr->value()); |
| 1237 LOperand* temp1 = TempRegister(); | 1214 LOperand* temp1 = TempRegister(); |
| 1238 LOperand* temp2 = TempRegister(); | 1215 LOperand* temp2 = TempRegister(); |
| 1239 LOperand* double_temp = FixedTemp(f6); // Chosen by fair dice roll. | 1216 LOperand* double_temp = FixedTemp(f6); // Chosen by fair dice roll. |
| 1240 LMathExp* result = new(zone()) LMathExp(input, double_temp, temp1, temp2); | 1217 LMathExp* result = new(zone()) LMathExp(input, double_temp, temp1, temp2); |
| 1241 return DefineAsRegister(result); | 1218 return DefineAsRegister(result); |
| 1242 } | 1219 } |
| (...skipping 204 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 1447 | 1424 |
| 1448 LInstruction* LChunkBuilder::DoMod(HMod* instr) { | 1425 LInstruction* LChunkBuilder::DoMod(HMod* instr) { |
| 1449 HValue* left = instr->left(); | 1426 HValue* left = instr->left(); |
| 1450 HValue* right = instr->right(); | 1427 HValue* right = instr->right(); |
| 1451 if (instr->representation().IsSmiOrInteger32()) { | 1428 if (instr->representation().IsSmiOrInteger32()) { |
| 1452 ASSERT(instr->left()->representation().Equals(instr->representation())); | 1429 ASSERT(instr->left()->representation().Equals(instr->representation())); |
| 1453 ASSERT(instr->right()->representation().Equals(instr->representation())); | 1430 ASSERT(instr->right()->representation().Equals(instr->representation())); |
| 1454 if (instr->HasPowerOf2Divisor()) { | 1431 if (instr->HasPowerOf2Divisor()) { |
| 1455 ASSERT(!right->CanBeZero()); | 1432 ASSERT(!right->CanBeZero()); |
| 1456 LModI* mod = new(zone()) LModI(UseRegisterAtStart(left), | 1433 LModI* mod = new(zone()) LModI(UseRegisterAtStart(left), |
| 1457 UseOrConstant(right)); | 1434 UseConstant(right)); |
| 1458 LInstruction* result = DefineAsRegister(mod); | 1435 LInstruction* result = DefineAsRegister(mod); |
| 1459 return (left->CanBeNegative() && | 1436 return (left->CanBeNegative() && |
| 1460 instr->CheckFlag(HValue::kBailoutOnMinusZero)) | 1437 instr->CheckFlag(HValue::kBailoutOnMinusZero)) |
| 1461 ? AssignEnvironment(result) | 1438 ? AssignEnvironment(result) |
| 1462 : result; | 1439 : result; |
| 1463 } else { | 1440 } else { |
| 1464 LModI* mod = new(zone()) LModI(UseRegister(left), | 1441 LModI* mod = new(zone()) LModI(UseRegister(left), |
| 1465 UseRegister(right), | 1442 UseRegister(right), |
| 1466 TempRegister(), | 1443 TempRegister(), |
| 1467 FixedTemp(f20), | 1444 FixedTemp(f20), |
| (...skipping 465 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 1933 LDoubleToI* res = new(zone()) LDoubleToI(value); | 1910 LDoubleToI* res = new(zone()) LDoubleToI(value); |
| 1934 return AssignEnvironment(DefineAsRegister(res)); | 1911 return AssignEnvironment(DefineAsRegister(res)); |
| 1935 } | 1912 } |
| 1936 } else if (from.IsInteger32()) { | 1913 } else if (from.IsInteger32()) { |
| 1937 info()->MarkAsDeferredCalling(); | 1914 info()->MarkAsDeferredCalling(); |
| 1938 if (to.IsTagged()) { | 1915 if (to.IsTagged()) { |
| 1939 HValue* val = instr->value(); | 1916 HValue* val = instr->value(); |
| 1940 LOperand* value = UseRegisterAtStart(val); | 1917 LOperand* value = UseRegisterAtStart(val); |
| 1941 if (val->CheckFlag(HInstruction::kUint32)) { | 1918 if (val->CheckFlag(HInstruction::kUint32)) { |
| 1942 LNumberTagU* result = new(zone()) LNumberTagU(value); | 1919 LNumberTagU* result = new(zone()) LNumberTagU(value); |
| 1943 return AssignEnvironment(AssignPointerMap(DefineSameAsFirst(result))); | 1920 return AssignEnvironment(AssignPointerMap(DefineAsRegister(result))); |
| 1944 } else if (val->HasRange() && val->range()->IsInSmiRange()) { | 1921 } else if (val->HasRange() && val->range()->IsInSmiRange()) { |
| 1945 return DefineAsRegister(new(zone()) LSmiTag(value)); | 1922 return DefineAsRegister(new(zone()) LSmiTag(value)); |
| 1946 } else { | 1923 } else { |
| 1947 LNumberTagI* result = new(zone()) LNumberTagI(value); | 1924 LNumberTagI* result = new(zone()) LNumberTagI(value); |
| 1948 return AssignEnvironment(AssignPointerMap(DefineAsRegister(result))); | 1925 return AssignEnvironment(AssignPointerMap(DefineAsRegister(result))); |
| 1949 } | 1926 } |
| 1950 } else if (to.IsSmi()) { | 1927 } else if (to.IsSmi()) { |
| 1951 HValue* val = instr->value(); | 1928 HValue* val = instr->value(); |
| 1952 LOperand* value = UseRegister(val); | 1929 LOperand* value = UseRegister(val); |
| 1953 LInstruction* result = val->CheckFlag(HInstruction::kUint32) | 1930 LInstruction* result = val->CheckFlag(HInstruction::kUint32) |
| (...skipping 643 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 2597 | 2574 |
| 2598 | 2575 |
| 2599 LInstruction* LChunkBuilder::DoLoadFieldByIndex(HLoadFieldByIndex* instr) { | 2576 LInstruction* LChunkBuilder::DoLoadFieldByIndex(HLoadFieldByIndex* instr) { |
| 2600 LOperand* object = UseRegister(instr->object()); | 2577 LOperand* object = UseRegister(instr->object()); |
| 2601 LOperand* index = UseRegister(instr->index()); | 2578 LOperand* index = UseRegister(instr->index()); |
| 2602 return DefineAsRegister(new(zone()) LLoadFieldByIndex(object, index)); | 2579 return DefineAsRegister(new(zone()) LLoadFieldByIndex(object, index)); |
| 2603 } | 2580 } |
| 2604 | 2581 |
| 2605 | 2582 |
| 2606 } } // namespace v8::internal | 2583 } } // namespace v8::internal |
| OLD | NEW |