OLD | NEW |
1 // Copyright 2013 the V8 project authors. All rights reserved. | 1 // Copyright 2013 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 266 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
277 for (int i = 0; i < 4; i++) { | 277 for (int i = 0; i < 4; i++) { |
278 stream->Add("("); | 278 stream->Add("("); |
279 if (parallel_moves_[i] != NULL) { | 279 if (parallel_moves_[i] != NULL) { |
280 parallel_moves_[i]->PrintDataTo(stream); | 280 parallel_moves_[i]->PrintDataTo(stream); |
281 } | 281 } |
282 stream->Add(") "); | 282 stream->Add(") "); |
283 } | 283 } |
284 } | 284 } |
285 | 285 |
286 | 286 |
287 ExternalReference LLinkObjectInList::GetReference(Isolate* isolate) { | |
288 switch (hydrogen()->known_list()) { | |
289 case HLinkObjectInList::ALLOCATION_SITE_LIST: | |
290 return ExternalReference::allocation_sites_list_address(isolate); | |
291 } | |
292 | |
293 UNREACHABLE(); | |
294 // Return a dummy value | |
295 return ExternalReference::isolate_address(isolate); | |
296 } | |
297 | |
298 | |
299 void LLinkObjectInList::PrintDataTo(StringStream* stream) { | |
300 object()->PrintTo(stream); | |
301 stream->Add(" offset %d", hydrogen()->store_field().offset()); | |
302 } | |
303 | |
304 | |
305 void LLoadContextSlot::PrintDataTo(StringStream* stream) { | 287 void LLoadContextSlot::PrintDataTo(StringStream* stream) { |
306 context()->PrintTo(stream); | 288 context()->PrintTo(stream); |
307 stream->Add("[%d]", slot_index()); | 289 stream->Add("[%d]", slot_index()); |
308 } | 290 } |
309 | 291 |
310 | 292 |
311 void LStoreContextSlot::PrintDataTo(StringStream* stream) { | 293 void LStoreContextSlot::PrintDataTo(StringStream* stream) { |
312 context()->PrintTo(stream); | 294 context()->PrintTo(stream); |
313 stream->Add("[%d] <- ", slot_index()); | 295 stream->Add("[%d] <- ", slot_index()); |
314 value()->PrintTo(stream); | 296 value()->PrintTo(stream); |
(...skipping 74 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
389 case Token::SHL: return "shl-t"; | 371 case Token::SHL: return "shl-t"; |
390 case Token::SAR: return "sar-t"; | 372 case Token::SAR: return "sar-t"; |
391 case Token::SHR: return "shr-t"; | 373 case Token::SHR: return "shr-t"; |
392 default: | 374 default: |
393 UNREACHABLE(); | 375 UNREACHABLE(); |
394 return NULL; | 376 return NULL; |
395 } | 377 } |
396 } | 378 } |
397 | 379 |
398 | 380 |
399 void LChunkBuilder::Abort(const char* reason) { | 381 void LChunkBuilder::Abort(BailoutReason reason) { |
400 info()->set_bailout_reason(reason); | 382 info()->set_bailout_reason(reason); |
401 status_ = ABORTED; | 383 status_ = ABORTED; |
402 } | 384 } |
403 | 385 |
404 | 386 |
405 LUnallocated* LChunkBuilder::ToUnallocated(Register reg) { | 387 LUnallocated* LChunkBuilder::ToUnallocated(Register reg) { |
406 return new(zone()) LUnallocated(LUnallocated::FIXED_REGISTER, | 388 return new(zone()) LUnallocated(LUnallocated::FIXED_REGISTER, |
407 Register::ToAllocationIndex(reg)); | 389 Register::ToAllocationIndex(reg)); |
408 } | 390 } |
409 | 391 |
(...skipping 150 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
560 instr->set_pointer_map(new(zone()) LPointerMap(position_, zone())); | 542 instr->set_pointer_map(new(zone()) LPointerMap(position_, zone())); |
561 return instr; | 543 return instr; |
562 } | 544 } |
563 | 545 |
564 | 546 |
565 LUnallocated* LChunkBuilder::TempRegister() { | 547 LUnallocated* LChunkBuilder::TempRegister() { |
566 LUnallocated* operand = | 548 LUnallocated* operand = |
567 new(zone()) LUnallocated(LUnallocated::MUST_HAVE_REGISTER); | 549 new(zone()) LUnallocated(LUnallocated::MUST_HAVE_REGISTER); |
568 int vreg = allocator_->GetVirtualRegister(); | 550 int vreg = allocator_->GetVirtualRegister(); |
569 if (!allocator_->AllocationOk()) { | 551 if (!allocator_->AllocationOk()) { |
570 Abort("Out of virtual registers while trying to allocate temp register."); | 552 Abort(kOutOfVirtualRegistersWhileTryingToAllocateTempRegister); |
571 vreg = 0; | 553 vreg = 0; |
572 } | 554 } |
573 operand->set_virtual_register(vreg); | 555 operand->set_virtual_register(vreg); |
574 return operand; | 556 return operand; |
575 } | 557 } |
576 | 558 |
577 | 559 |
578 int LPlatformChunk::GetNextSpillIndex() { | 560 int LPlatformChunk::GetNextSpillIndex() { |
579 return spill_slot_count_++; | 561 return spill_slot_count_++; |
580 } | 562 } |
(...skipping 262 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
843 LOperand* left_operand = UseFixed(left, x1); | 825 LOperand* left_operand = UseFixed(left, x1); |
844 LOperand* right_operand = UseFixed(right, x0); | 826 LOperand* right_operand = UseFixed(right, x0); |
845 LArithmeticT* result = | 827 LArithmeticT* result = |
846 new(zone()) LArithmeticT(op, left_operand, right_operand); | 828 new(zone()) LArithmeticT(op, left_operand, right_operand); |
847 return MarkAsCall(DefineFixed(result, x0), instr); | 829 return MarkAsCall(DefineFixed(result, x0), instr); |
848 } | 830 } |
849 | 831 |
850 | 832 |
851 #define UNIMPLEMENTED_INSTRUCTION() \ | 833 #define UNIMPLEMENTED_INSTRUCTION() \ |
852 do { \ | 834 do { \ |
853 static char msg[128]; \ | 835 info_->set_bailout_reason(kUnimplementedHydrogenInstruction); \ |
854 snprintf(msg, sizeof(msg), \ | |
855 "unsupported hydrogen instruction (%s)", __func__); \ | |
856 info_->set_bailout_reason(msg); \ | |
857 status_ = ABORTED; \ | 836 status_ = ABORTED; \ |
858 return NULL; \ | 837 return NULL; \ |
859 } while (0) | 838 } while (0) |
860 | 839 |
861 | 840 |
862 LInstruction* LChunkBuilder::DoBoundsCheckBaseIndexInformation( | 841 LInstruction* LChunkBuilder::DoBoundsCheckBaseIndexInformation( |
863 HBoundsCheckBaseIndexInformation* instr) { | 842 HBoundsCheckBaseIndexInformation* instr) { |
864 UNREACHABLE(); | 843 UNREACHABLE(); |
865 return NULL; | 844 return NULL; |
866 } | 845 } |
(...skipping 513 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
1380 | 1359 |
1381 | 1360 |
1382 LInstruction* LChunkBuilder::DoConstant(HConstant* instr) { | 1361 LInstruction* LChunkBuilder::DoConstant(HConstant* instr) { |
1383 Representation r = instr->representation(); | 1362 Representation r = instr->representation(); |
1384 if (r.IsSmi()) { | 1363 if (r.IsSmi()) { |
1385 return DefineAsRegister(new(zone()) LConstantS); | 1364 return DefineAsRegister(new(zone()) LConstantS); |
1386 } else if (r.IsInteger32()) { | 1365 } else if (r.IsInteger32()) { |
1387 return DefineAsRegister(new(zone()) LConstantI); | 1366 return DefineAsRegister(new(zone()) LConstantI); |
1388 } else if (r.IsDouble()) { | 1367 } else if (r.IsDouble()) { |
1389 return DefineAsRegister(new(zone()) LConstantD); | 1368 return DefineAsRegister(new(zone()) LConstantD); |
| 1369 } else if (r.IsExternal()) { |
| 1370 return DefineAsRegister(new(zone()) LConstantE); |
1390 } else if (r.IsTagged()) { | 1371 } else if (r.IsTagged()) { |
1391 return DefineAsRegister(new(zone()) LConstantT); | 1372 return DefineAsRegister(new(zone()) LConstantT); |
1392 } else { | 1373 } else { |
1393 UNREACHABLE(); | 1374 UNREACHABLE(); |
1394 return NULL; | 1375 return NULL; |
1395 } | 1376 } |
1396 } | 1377 } |
1397 | 1378 |
1398 | 1379 |
1399 LInstruction* LChunkBuilder::DoContext(HContext* instr) { | 1380 LInstruction* LChunkBuilder::DoContext(HContext* instr) { |
(...skipping 243 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
1643 } | 1624 } |
1644 | 1625 |
1645 HEnvironment* outer = | 1626 HEnvironment* outer = |
1646 current_block_->last_environment()->DiscardInlined(false); | 1627 current_block_->last_environment()->DiscardInlined(false); |
1647 current_block_->UpdateEnvironment(outer); | 1628 current_block_->UpdateEnvironment(outer); |
1648 | 1629 |
1649 return pop; | 1630 return pop; |
1650 } | 1631 } |
1651 | 1632 |
1652 | 1633 |
1653 LInstruction* LChunkBuilder::DoLinkObjectInList(HLinkObjectInList* instr) { | |
1654 LOperand* object = UseRegister(instr->value()); | |
1655 LOperand* temp = TempRegister(); | |
1656 LLinkObjectInList* result = new(zone()) LLinkObjectInList(object, temp); | |
1657 return result; | |
1658 } | |
1659 | |
1660 | |
1661 LInstruction* LChunkBuilder::DoLoadContextSlot(HLoadContextSlot* instr) { | 1634 LInstruction* LChunkBuilder::DoLoadContextSlot(HLoadContextSlot* instr) { |
1662 LOperand* context = UseRegisterAtStart(instr->value()); | 1635 LOperand* context = UseRegisterAtStart(instr->value()); |
1663 LInstruction* result = | 1636 LInstruction* result = |
1664 DefineAsRegister(new(zone()) LLoadContextSlot(context)); | 1637 DefineAsRegister(new(zone()) LLoadContextSlot(context)); |
1665 return instr->RequiresHoleCheck() ? AssignEnvironment(result) : result; | 1638 return instr->RequiresHoleCheck() ? AssignEnvironment(result) : result; |
1666 } | 1639 } |
1667 | 1640 |
1668 | 1641 |
1669 LInstruction* LChunkBuilder::DoLoadExternalArrayPointer( | 1642 LInstruction* LChunkBuilder::DoLoadExternalArrayPointer( |
1670 HLoadExternalArrayPointer* instr) { | 1643 HLoadExternalArrayPointer* instr) { |
(...skipping 621 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
2292 ASSERT(instr->left()->representation().IsTagged()); | 2265 ASSERT(instr->left()->representation().IsTagged()); |
2293 ASSERT(instr->right()->representation().IsTagged()); | 2266 ASSERT(instr->right()->representation().IsTagged()); |
2294 LOperand* left = UseFixed(instr->left(), x1); | 2267 LOperand* left = UseFixed(instr->left(), x1); |
2295 LOperand* right = UseFixed(instr->right(), x0); | 2268 LOperand* right = UseFixed(instr->right(), x0); |
2296 LStringCompareAndBranch* result = | 2269 LStringCompareAndBranch* result = |
2297 new(zone()) LStringCompareAndBranch(left, right); | 2270 new(zone()) LStringCompareAndBranch(left, right); |
2298 return MarkAsCall(result, instr); | 2271 return MarkAsCall(result, instr); |
2299 } | 2272 } |
2300 | 2273 |
2301 | 2274 |
2302 LInstruction* LChunkBuilder::DoStringLength(HStringLength* instr) { | |
2303 // TODO(all): This instruction doesn't exist anymore on bleeding_edge. | |
2304 LOperand* string = UseRegisterAtStart(instr->value()); | |
2305 return DefineAsRegister(new(zone()) LStringLength(string)); | |
2306 } | |
2307 | |
2308 | |
2309 LInstruction* LChunkBuilder::DoSub(HSub* instr) { | 2275 LInstruction* LChunkBuilder::DoSub(HSub* instr) { |
2310 // TODO(jbramley): Add smi support. | 2276 // TODO(jbramley): Add smi support. |
2311 if (instr->representation().IsInteger32()) { | 2277 if (instr->representation().IsInteger32()) { |
2312 ASSERT(instr->left()->representation().IsInteger32()); | 2278 ASSERT(instr->left()->representation().IsInteger32()); |
2313 ASSERT(instr->right()->representation().IsInteger32()); | 2279 ASSERT(instr->right()->representation().IsInteger32()); |
2314 | 2280 |
2315 LOperand *left; | 2281 LOperand *left; |
2316 if (instr->left()->IsConstant() && | 2282 if (instr->left()->IsConstant() && |
2317 (HConstant::cast(instr->left())->Integer32Value() == 0)) { | 2283 (HConstant::cast(instr->left())->Integer32Value() == 0)) { |
2318 left = UseConstant(instr->left()); | 2284 left = UseConstant(instr->left()); |
(...skipping 85 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
2404 | 2370 |
2405 return new(zone()) LTypeofIsAndBranch( | 2371 return new(zone()) LTypeofIsAndBranch( |
2406 UseRegister(instr->value()), temp1, temp2); | 2372 UseRegister(instr->value()), temp1, temp2); |
2407 } | 2373 } |
2408 | 2374 |
2409 | 2375 |
2410 LInstruction* LChunkBuilder::DoUnaryMathOperation(HUnaryMathOperation* instr) { | 2376 LInstruction* LChunkBuilder::DoUnaryMathOperation(HUnaryMathOperation* instr) { |
2411 switch (instr->op()) { | 2377 switch (instr->op()) { |
2412 case kMathAbs: { | 2378 case kMathAbs: { |
2413 Representation r = instr->representation(); | 2379 Representation r = instr->representation(); |
| 2380 // TODO(jbramley): Support smis in LMathAbs and use that. |
2414 if (r.IsTagged() || r.IsSmi()) { | 2381 if (r.IsTagged() || r.IsSmi()) { |
2415 // The tagged case might need to allocate a HeapNumber for the result, | 2382 // The tagged case might need to allocate a HeapNumber for the result, |
2416 // so it is handled by a separate LInstruction. | 2383 // so it is handled by a separate LInstruction. |
2417 LOperand* input = UseRegister(instr->value()); | 2384 LOperand* input = UseRegister(instr->value()); |
2418 LOperand* temp1 = TempRegister(); | 2385 LOperand* temp1 = TempRegister(); |
2419 LOperand* temp2 = TempRegister(); | 2386 LOperand* temp2 = TempRegister(); |
2420 LOperand* temp3 = TempRegister(); | 2387 LOperand* temp3 = TempRegister(); |
2421 LMathAbsTagged* result = | 2388 LMathAbsTagged* result = |
2422 new(zone()) LMathAbsTagged(input, temp1, temp2, temp3); | 2389 new(zone()) LMathAbsTagged(input, temp1, temp2, temp3); |
2423 return AssignEnvironment(AssignPointerMap(DefineAsRegister(result))); | 2390 return AssignEnvironment(AssignPointerMap(DefineAsRegister(result))); |
(...skipping 87 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
2511 default: | 2478 default: |
2512 UNREACHABLE(); | 2479 UNREACHABLE(); |
2513 return NULL; | 2480 return NULL; |
2514 } | 2481 } |
2515 } | 2482 } |
2516 | 2483 |
2517 | 2484 |
2518 LInstruction* LChunkBuilder::DoUnknownOSRValue(HUnknownOSRValue* instr) { | 2485 LInstruction* LChunkBuilder::DoUnknownOSRValue(HUnknownOSRValue* instr) { |
2519 int spill_index = chunk_->GetNextSpillIndex(); | 2486 int spill_index = chunk_->GetNextSpillIndex(); |
2520 if (spill_index > LUnallocated::kMaxFixedSlotIndex) { | 2487 if (spill_index > LUnallocated::kMaxFixedSlotIndex) { |
2521 Abort("Too many spill slots needed for OSR"); | 2488 Abort(kTooManySpillSlotsNeededForOSR); |
2522 spill_index = 0; | 2489 spill_index = 0; |
2523 } | 2490 } |
2524 return DefineAsSpilled(new(zone()) LUnknownOSRValue, spill_index); | 2491 return DefineAsSpilled(new(zone()) LUnknownOSRValue, spill_index); |
2525 } | 2492 } |
2526 | 2493 |
2527 | 2494 |
2528 LInstruction* LChunkBuilder::DoUseConst(HUseConst* instr) { | 2495 LInstruction* LChunkBuilder::DoUseConst(HUseConst* instr) { |
2529 return NULL; | 2496 return NULL; |
2530 } | 2497 } |
2531 | 2498 |
(...skipping 38 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
2570 LInstruction* LChunkBuilder::DoWrapReceiver(HWrapReceiver* instr) { | 2537 LInstruction* LChunkBuilder::DoWrapReceiver(HWrapReceiver* instr) { |
2571 LOperand* receiver = UseRegister(instr->receiver()); | 2538 LOperand* receiver = UseRegister(instr->receiver()); |
2572 LOperand* function = UseRegisterAtStart(instr->function()); | 2539 LOperand* function = UseRegisterAtStart(instr->function()); |
2573 LOperand* temp = TempRegister(); | 2540 LOperand* temp = TempRegister(); |
2574 LWrapReceiver* result = new(zone()) LWrapReceiver(receiver, function, temp); | 2541 LWrapReceiver* result = new(zone()) LWrapReceiver(receiver, function, temp); |
2575 return AssignEnvironment(DefineAsRegister(result)); | 2542 return AssignEnvironment(DefineAsRegister(result)); |
2576 } | 2543 } |
2577 | 2544 |
2578 | 2545 |
2579 } } // namespace v8::internal | 2546 } } // namespace v8::internal |
OLD | NEW |