| 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 268 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 279 *hydrogen()->class_name(), | 279 *hydrogen()->class_name(), |
| 280 true_block_id(), | 280 true_block_id(), |
| 281 false_block_id()); | 281 false_block_id()); |
| 282 } | 282 } |
| 283 | 283 |
| 284 | 284 |
| 285 void LTypeofIsAndBranch::PrintDataTo(StringStream* stream) { | 285 void LTypeofIsAndBranch::PrintDataTo(StringStream* stream) { |
| 286 stream->Add("if typeof "); | 286 stream->Add("if typeof "); |
| 287 value()->PrintTo(stream); | 287 value()->PrintTo(stream); |
| 288 stream->Add(" == \"%s\" then B%d else B%d", | 288 stream->Add(" == \"%s\" then B%d else B%d", |
| 289 *hydrogen()->type_literal()->ToCString(), | 289 hydrogen()->type_literal()->ToCString().get(), |
| 290 true_block_id(), false_block_id()); | 290 true_block_id(), false_block_id()); |
| 291 } | 291 } |
| 292 | 292 |
| 293 | 293 |
| 294 void LStoreCodeEntry::PrintDataTo(StringStream* stream) { | 294 void LStoreCodeEntry::PrintDataTo(StringStream* stream) { |
| 295 stream->Add(" = "); | 295 stream->Add(" = "); |
| 296 function()->PrintTo(stream); | 296 function()->PrintTo(stream); |
| 297 stream->Add(".code_entry = "); | 297 stream->Add(".code_entry = "); |
| 298 code_object()->PrintTo(stream); | 298 code_object()->PrintTo(stream); |
| 299 } | 299 } |
| 300 | 300 |
| 301 | 301 |
| 302 void LInnerAllocatedObject::PrintDataTo(StringStream* stream) { | 302 void LInnerAllocatedObject::PrintDataTo(StringStream* stream) { |
| 303 stream->Add(" = "); | 303 stream->Add(" = "); |
| 304 base_object()->PrintTo(stream); | 304 base_object()->PrintTo(stream); |
| 305 stream->Add(" + %d", offset()); | 305 stream->Add(" + "); |
| 306 offset()->PrintTo(stream); |
| 306 } | 307 } |
| 307 | 308 |
| 308 | 309 |
| 309 void LCallConstantFunction::PrintDataTo(StringStream* stream) { | 310 void LCallConstantFunction::PrintDataTo(StringStream* stream) { |
| 310 stream->Add("#%d / ", arity()); | 311 stream->Add("#%d / ", arity()); |
| 311 } | 312 } |
| 312 | 313 |
| 313 | 314 |
| 314 void LLoadContextSlot::PrintDataTo(StringStream* stream) { | 315 void LLoadContextSlot::PrintDataTo(StringStream* stream) { |
| 315 context()->PrintTo(stream); | 316 context()->PrintTo(stream); |
| (...skipping 17 matching lines...) Expand all Loading... |
| 333 } | 334 } |
| 334 | 335 |
| 335 | 336 |
| 336 void LCallKeyed::PrintDataTo(StringStream* stream) { | 337 void LCallKeyed::PrintDataTo(StringStream* stream) { |
| 337 stream->Add("[ecx] #%d / ", arity()); | 338 stream->Add("[ecx] #%d / ", arity()); |
| 338 } | 339 } |
| 339 | 340 |
| 340 | 341 |
| 341 void LCallNamed::PrintDataTo(StringStream* stream) { | 342 void LCallNamed::PrintDataTo(StringStream* stream) { |
| 342 SmartArrayPointer<char> name_string = name()->ToCString(); | 343 SmartArrayPointer<char> name_string = name()->ToCString(); |
| 343 stream->Add("%s #%d / ", *name_string, arity()); | 344 stream->Add("%s #%d / ", name_string.get(), arity()); |
| 344 } | 345 } |
| 345 | 346 |
| 346 | 347 |
| 347 void LCallGlobal::PrintDataTo(StringStream* stream) { | 348 void LCallGlobal::PrintDataTo(StringStream* stream) { |
| 348 SmartArrayPointer<char> name_string = name()->ToCString(); | 349 SmartArrayPointer<char> name_string = name()->ToCString(); |
| 349 stream->Add("%s #%d / ", *name_string, arity()); | 350 stream->Add("%s #%d / ", name_string.get(), arity()); |
| 350 } | 351 } |
| 351 | 352 |
| 352 | 353 |
| 353 void LCallKnownGlobal::PrintDataTo(StringStream* stream) { | 354 void LCallKnownGlobal::PrintDataTo(StringStream* stream) { |
| 354 stream->Add("#%d / ", arity()); | 355 stream->Add("#%d / ", arity()); |
| 355 } | 356 } |
| 356 | 357 |
| 357 | 358 |
| 358 void LCallNew::PrintDataTo(StringStream* stream) { | 359 void LCallNew::PrintDataTo(StringStream* stream) { |
| 359 stream->Add("= "); | 360 stream->Add("= "); |
| (...skipping 52 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 412 object()->PrintTo(stream); | 413 object()->PrintTo(stream); |
| 413 hydrogen()->access().PrintTo(stream); | 414 hydrogen()->access().PrintTo(stream); |
| 414 stream->Add(" <- "); | 415 stream->Add(" <- "); |
| 415 value()->PrintTo(stream); | 416 value()->PrintTo(stream); |
| 416 } | 417 } |
| 417 | 418 |
| 418 | 419 |
| 419 void LStoreNamedGeneric::PrintDataTo(StringStream* stream) { | 420 void LStoreNamedGeneric::PrintDataTo(StringStream* stream) { |
| 420 object()->PrintTo(stream); | 421 object()->PrintTo(stream); |
| 421 stream->Add("."); | 422 stream->Add("."); |
| 422 stream->Add(*String::cast(*name())->ToCString()); | 423 stream->Add(String::cast(*name())->ToCString().get()); |
| 423 stream->Add(" <- "); | 424 stream->Add(" <- "); |
| 424 value()->PrintTo(stream); | 425 value()->PrintTo(stream); |
| 425 } | 426 } |
| 426 | 427 |
| 427 | 428 |
| 428 void LLoadKeyed::PrintDataTo(StringStream* stream) { | 429 void LLoadKeyed::PrintDataTo(StringStream* stream) { |
| 429 elements()->PrintTo(stream); | 430 elements()->PrintTo(stream); |
| 430 stream->Add("["); | 431 stream->Add("["); |
| 431 key()->PrintTo(stream); | 432 key()->PrintTo(stream); |
| 432 if (hydrogen()->IsDehoisted()) { | 433 if (hydrogen()->IsDehoisted()) { |
| (...skipping 761 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 1194 | 1195 |
| 1195 LInstruction* LChunkBuilder::DoStoreCodeEntry( | 1196 LInstruction* LChunkBuilder::DoStoreCodeEntry( |
| 1196 HStoreCodeEntry* store_code_entry) { | 1197 HStoreCodeEntry* store_code_entry) { |
| 1197 LOperand* function = UseRegister(store_code_entry->function()); | 1198 LOperand* function = UseRegister(store_code_entry->function()); |
| 1198 LOperand* code_object = UseTempRegister(store_code_entry->code_object()); | 1199 LOperand* code_object = UseTempRegister(store_code_entry->code_object()); |
| 1199 return new(zone()) LStoreCodeEntry(function, code_object); | 1200 return new(zone()) LStoreCodeEntry(function, code_object); |
| 1200 } | 1201 } |
| 1201 | 1202 |
| 1202 | 1203 |
| 1203 LInstruction* LChunkBuilder::DoInnerAllocatedObject( | 1204 LInstruction* LChunkBuilder::DoInnerAllocatedObject( |
| 1204 HInnerAllocatedObject* inner_object) { | 1205 HInnerAllocatedObject* instr) { |
| 1205 LOperand* base_object = UseRegisterAtStart(inner_object->base_object()); | 1206 LOperand* base_object = UseRegisterAtStart(instr->base_object()); |
| 1206 LInnerAllocatedObject* result = | 1207 LOperand* offset = UseRegisterOrConstantAtStart(instr->offset()); |
| 1207 new(zone()) LInnerAllocatedObject(base_object); | 1208 return DefineAsRegister( |
| 1208 return DefineAsRegister(result); | 1209 new(zone()) LInnerAllocatedObject(base_object, offset)); |
| 1209 } | 1210 } |
| 1210 | 1211 |
| 1211 | 1212 |
| 1212 LInstruction* LChunkBuilder::DoThisFunction(HThisFunction* instr) { | 1213 LInstruction* LChunkBuilder::DoThisFunction(HThisFunction* instr) { |
| 1213 return instr->HasNoUses() | 1214 return instr->HasNoUses() |
| 1214 ? NULL | 1215 ? NULL |
| 1215 : DefineAsRegister(new(zone()) LThisFunction); | 1216 : DefineAsRegister(new(zone()) LThisFunction); |
| 1216 } | 1217 } |
| 1217 | 1218 |
| 1218 | 1219 |
| (...skipping 45 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 1264 return MarkAsCall(DefineFixed(result, eax), instr, CANNOT_DEOPTIMIZE_EAGERLY); | 1265 return MarkAsCall(DefineFixed(result, eax), instr, CANNOT_DEOPTIMIZE_EAGERLY); |
| 1265 } | 1266 } |
| 1266 | 1267 |
| 1267 | 1268 |
| 1268 LInstruction* LChunkBuilder::DoUnaryMathOperation(HUnaryMathOperation* instr) { | 1269 LInstruction* LChunkBuilder::DoUnaryMathOperation(HUnaryMathOperation* instr) { |
| 1269 switch (instr->op()) { | 1270 switch (instr->op()) { |
| 1270 case kMathFloor: return DoMathFloor(instr); | 1271 case kMathFloor: return DoMathFloor(instr); |
| 1271 case kMathRound: return DoMathRound(instr); | 1272 case kMathRound: return DoMathRound(instr); |
| 1272 case kMathAbs: return DoMathAbs(instr); | 1273 case kMathAbs: return DoMathAbs(instr); |
| 1273 case kMathLog: return DoMathLog(instr); | 1274 case kMathLog: return DoMathLog(instr); |
| 1274 case kMathSin: return DoMathSin(instr); | |
| 1275 case kMathCos: return DoMathCos(instr); | |
| 1276 case kMathTan: return DoMathTan(instr); | |
| 1277 case kMathExp: return DoMathExp(instr); | 1275 case kMathExp: return DoMathExp(instr); |
| 1278 case kMathSqrt: return DoMathSqrt(instr); | 1276 case kMathSqrt: return DoMathSqrt(instr); |
| 1279 case kMathPowHalf: return DoMathPowHalf(instr); | 1277 case kMathPowHalf: return DoMathPowHalf(instr); |
| 1280 default: | 1278 default: |
| 1281 UNREACHABLE(); | 1279 UNREACHABLE(); |
| 1282 return NULL; | 1280 return NULL; |
| 1283 } | 1281 } |
| 1284 } | 1282 } |
| 1285 | 1283 |
| 1286 | 1284 |
| (...skipping 22 matching lines...) Expand all Loading... |
| 1309 | 1307 |
| 1310 LInstruction* LChunkBuilder::DoMathLog(HUnaryMathOperation* instr) { | 1308 LInstruction* LChunkBuilder::DoMathLog(HUnaryMathOperation* instr) { |
| 1311 ASSERT(instr->representation().IsDouble()); | 1309 ASSERT(instr->representation().IsDouble()); |
| 1312 ASSERT(instr->value()->representation().IsDouble()); | 1310 ASSERT(instr->value()->representation().IsDouble()); |
| 1313 LOperand* input = UseRegisterAtStart(instr->value()); | 1311 LOperand* input = UseRegisterAtStart(instr->value()); |
| 1314 LMathLog* result = new(zone()) LMathLog(input); | 1312 LMathLog* result = new(zone()) LMathLog(input); |
| 1315 return DefineSameAsFirst(result); | 1313 return DefineSameAsFirst(result); |
| 1316 } | 1314 } |
| 1317 | 1315 |
| 1318 | 1316 |
| 1319 LInstruction* LChunkBuilder::DoMathSin(HUnaryMathOperation* instr) { | |
| 1320 LOperand* input = UseFixedDouble(instr->value(), xmm1); | |
| 1321 LMathSin* result = new(zone()) LMathSin(input); | |
| 1322 return MarkAsCall(DefineFixedDouble(result, xmm1), instr); | |
| 1323 } | |
| 1324 | |
| 1325 | |
| 1326 LInstruction* LChunkBuilder::DoMathCos(HUnaryMathOperation* instr) { | |
| 1327 LOperand* input = UseFixedDouble(instr->value(), xmm1); | |
| 1328 LMathCos* result = new(zone()) LMathCos(input); | |
| 1329 return MarkAsCall(DefineFixedDouble(result, xmm1), instr); | |
| 1330 } | |
| 1331 | |
| 1332 | |
| 1333 LInstruction* LChunkBuilder::DoMathTan(HUnaryMathOperation* instr) { | |
| 1334 LOperand* input = UseFixedDouble(instr->value(), xmm1); | |
| 1335 LMathTan* result = new(zone()) LMathTan(input); | |
| 1336 return MarkAsCall(DefineFixedDouble(result, xmm1), instr); | |
| 1337 } | |
| 1338 | |
| 1339 | |
| 1340 LInstruction* LChunkBuilder::DoMathExp(HUnaryMathOperation* instr) { | 1317 LInstruction* LChunkBuilder::DoMathExp(HUnaryMathOperation* instr) { |
| 1341 ASSERT(instr->representation().IsDouble()); | 1318 ASSERT(instr->representation().IsDouble()); |
| 1342 ASSERT(instr->value()->representation().IsDouble()); | 1319 ASSERT(instr->value()->representation().IsDouble()); |
| 1343 LOperand* value = UseTempRegister(instr->value()); | 1320 LOperand* value = UseTempRegister(instr->value()); |
| 1344 LOperand* temp1 = TempRegister(); | 1321 LOperand* temp1 = TempRegister(); |
| 1345 LOperand* temp2 = TempRegister(); | 1322 LOperand* temp2 = TempRegister(); |
| 1346 LMathExp* result = new(zone()) LMathExp(value, temp1, temp2); | 1323 LMathExp* result = new(zone()) LMathExp(value, temp1, temp2); |
| 1347 return DefineAsRegister(result); | 1324 return DefineAsRegister(result); |
| 1348 } | 1325 } |
| 1349 | 1326 |
| (...skipping 296 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 1646 bool can_overflow = instr->CheckFlag(HValue::kCanOverflow); | 1623 bool can_overflow = instr->CheckFlag(HValue::kCanOverflow); |
| 1647 LInstruction* result = use_lea | 1624 LInstruction* result = use_lea |
| 1648 ? DefineAsRegister(add) | 1625 ? DefineAsRegister(add) |
| 1649 : DefineSameAsFirst(add); | 1626 : DefineSameAsFirst(add); |
| 1650 if (can_overflow) { | 1627 if (can_overflow) { |
| 1651 result = AssignEnvironment(result); | 1628 result = AssignEnvironment(result); |
| 1652 } | 1629 } |
| 1653 return result; | 1630 return result; |
| 1654 } else if (instr->representation().IsDouble()) { | 1631 } else if (instr->representation().IsDouble()) { |
| 1655 return DoArithmeticD(Token::ADD, instr); | 1632 return DoArithmeticD(Token::ADD, instr); |
| 1633 } else if (instr->representation().IsExternal()) { |
| 1634 ASSERT(instr->left()->representation().IsExternal()); |
| 1635 ASSERT(instr->right()->representation().IsInteger32()); |
| 1636 ASSERT(!instr->CheckFlag(HValue::kCanOverflow)); |
| 1637 bool use_lea = LAddI::UseLea(instr); |
| 1638 LOperand* left = UseRegisterAtStart(instr->left()); |
| 1639 HValue* right_candidate = instr->right(); |
| 1640 LOperand* right = use_lea |
| 1641 ? UseRegisterOrConstantAtStart(right_candidate) |
| 1642 : UseOrConstantAtStart(right_candidate); |
| 1643 LAddI* add = new(zone()) LAddI(left, right); |
| 1644 LInstruction* result = use_lea |
| 1645 ? DefineAsRegister(add) |
| 1646 : DefineSameAsFirst(add); |
| 1647 return result; |
| 1656 } else { | 1648 } else { |
| 1657 return DoArithmeticT(Token::ADD, instr); | 1649 return DoArithmeticT(Token::ADD, instr); |
| 1658 } | 1650 } |
| 1659 } | 1651 } |
| 1660 | 1652 |
| 1661 | 1653 |
| 1662 LInstruction* LChunkBuilder::DoMathMinMax(HMathMinMax* instr) { | 1654 LInstruction* LChunkBuilder::DoMathMinMax(HMathMinMax* instr) { |
| 1663 LOperand* left = NULL; | 1655 LOperand* left = NULL; |
| 1664 LOperand* right = NULL; | 1656 LOperand* right = NULL; |
| 1665 if (instr->representation().IsSmiOrInteger32()) { | 1657 if (instr->representation().IsSmiOrInteger32()) { |
| (...skipping 732 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 2398 LOperand* object = UseRegister(instr->object()); | 2390 LOperand* object = UseRegister(instr->object()); |
| 2399 if (IsSimpleMapChangeTransition(instr->from_kind(), instr->to_kind())) { | 2391 if (IsSimpleMapChangeTransition(instr->from_kind(), instr->to_kind())) { |
| 2400 LOperand* object = UseRegister(instr->object()); | 2392 LOperand* object = UseRegister(instr->object()); |
| 2401 LOperand* new_map_reg = TempRegister(); | 2393 LOperand* new_map_reg = TempRegister(); |
| 2402 LOperand* temp_reg = TempRegister(); | 2394 LOperand* temp_reg = TempRegister(); |
| 2403 LTransitionElementsKind* result = | 2395 LTransitionElementsKind* result = |
| 2404 new(zone()) LTransitionElementsKind(object, NULL, | 2396 new(zone()) LTransitionElementsKind(object, NULL, |
| 2405 new_map_reg, temp_reg); | 2397 new_map_reg, temp_reg); |
| 2406 return result; | 2398 return result; |
| 2407 } else { | 2399 } else { |
| 2408 LOperand* context = UseRegister(instr->context()); | 2400 LOperand* context = UseFixed(instr->context(), esi); |
| 2409 LTransitionElementsKind* result = | 2401 LTransitionElementsKind* result = |
| 2410 new(zone()) LTransitionElementsKind(object, context, NULL, NULL); | 2402 new(zone()) LTransitionElementsKind(object, context, NULL, NULL); |
| 2411 return AssignPointerMap(result); | 2403 return AssignPointerMap(result); |
| 2412 } | 2404 } |
| 2413 } | 2405 } |
| 2414 | 2406 |
| 2415 | 2407 |
| 2416 LInstruction* LChunkBuilder::DoTrapAllocationMemento( | 2408 LInstruction* LChunkBuilder::DoTrapAllocationMemento( |
| 2417 HTrapAllocationMemento* instr) { | 2409 HTrapAllocationMemento* instr) { |
| 2418 LOperand* object = UseRegister(instr->object()); | 2410 LOperand* object = UseRegister(instr->object()); |
| (...skipping 354 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 2773 LInstruction* LChunkBuilder::DoLoadFieldByIndex(HLoadFieldByIndex* instr) { | 2765 LInstruction* LChunkBuilder::DoLoadFieldByIndex(HLoadFieldByIndex* instr) { |
| 2774 LOperand* object = UseRegister(instr->object()); | 2766 LOperand* object = UseRegister(instr->object()); |
| 2775 LOperand* index = UseTempRegister(instr->index()); | 2767 LOperand* index = UseTempRegister(instr->index()); |
| 2776 return DefineSameAsFirst(new(zone()) LLoadFieldByIndex(object, index)); | 2768 return DefineSameAsFirst(new(zone()) LLoadFieldByIndex(object, index)); |
| 2777 } | 2769 } |
| 2778 | 2770 |
| 2779 | 2771 |
| 2780 } } // namespace v8::internal | 2772 } } // namespace v8::internal |
| 2781 | 2773 |
| 2782 #endif // V8_TARGET_ARCH_IA32 | 2774 #endif // V8_TARGET_ARCH_IA32 |
| OLD | NEW |