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 351 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
362 return spill_slot_count_++; | 362 return spill_slot_count_++; |
363 } | 363 } |
364 | 364 |
365 | 365 |
366 LOperand* LChunk::GetNextSpillSlot(bool is_double) { | 366 LOperand* LChunk::GetNextSpillSlot(bool is_double) { |
367 // All stack slots are Double stack slots on x64. | 367 // All stack slots are Double stack slots on x64. |
368 // Alternatively, at some point, start using half-size | 368 // Alternatively, at some point, start using half-size |
369 // stack slots for int32 values. | 369 // stack slots for int32 values. |
370 int index = GetNextSpillIndex(is_double); | 370 int index = GetNextSpillIndex(is_double); |
371 if (is_double) { | 371 if (is_double) { |
372 return LDoubleStackSlot::Create(index); | 372 return LDoubleStackSlot::Create(index, zone()); |
373 } else { | 373 } else { |
374 return LStackSlot::Create(index); | 374 return LStackSlot::Create(index, zone()); |
375 } | 375 } |
376 } | 376 } |
377 | 377 |
378 | 378 |
379 void LChunk::MarkEmptyBlocks() { | 379 void LChunk::MarkEmptyBlocks() { |
380 HPhase phase("L_Mark empty blocks", this); | 380 HPhase phase("L_Mark empty blocks", this); |
381 for (int i = 0; i < graph()->blocks()->length(); ++i) { | 381 for (int i = 0; i < graph()->blocks()->length(); ++i) { |
382 HBasicBlock* block = graph()->blocks()->at(i); | 382 HBasicBlock* block = graph()->blocks()->at(i); |
383 int first = block->first_instruction_index(); | 383 int first = block->first_instruction_index(); |
384 int last = block->last_instruction_index(); | 384 int last = block->last_instruction_index(); |
(...skipping 75 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
460 void LTransitionElementsKind::PrintDataTo(StringStream* stream) { | 460 void LTransitionElementsKind::PrintDataTo(StringStream* stream) { |
461 object()->PrintTo(stream); | 461 object()->PrintTo(stream); |
462 stream->Add(" %p -> %p", *original_map(), *transitioned_map()); | 462 stream->Add(" %p -> %p", *original_map(), *transitioned_map()); |
463 } | 463 } |
464 | 464 |
465 | 465 |
466 void LChunk::AddInstruction(LInstruction* instr, HBasicBlock* block) { | 466 void LChunk::AddInstruction(LInstruction* instr, HBasicBlock* block) { |
467 LInstructionGap* gap = new(graph_->zone()) LInstructionGap(block); | 467 LInstructionGap* gap = new(graph_->zone()) LInstructionGap(block); |
468 int index = -1; | 468 int index = -1; |
469 if (instr->IsControl()) { | 469 if (instr->IsControl()) { |
470 instructions_.Add(gap); | 470 instructions_.Add(gap, zone()); |
471 index = instructions_.length(); | 471 index = instructions_.length(); |
472 instructions_.Add(instr); | 472 instructions_.Add(instr, zone()); |
473 } else { | 473 } else { |
474 index = instructions_.length(); | 474 index = instructions_.length(); |
475 instructions_.Add(instr); | 475 instructions_.Add(instr, zone()); |
476 instructions_.Add(gap); | 476 instructions_.Add(gap, zone()); |
477 } | 477 } |
478 if (instr->HasPointerMap()) { | 478 if (instr->HasPointerMap()) { |
479 pointer_maps_.Add(instr->pointer_map()); | 479 pointer_maps_.Add(instr->pointer_map(), zone()); |
480 instr->pointer_map()->set_lithium_position(index); | 480 instr->pointer_map()->set_lithium_position(index); |
481 } | 481 } |
482 } | 482 } |
483 | 483 |
484 | 484 |
485 LConstantOperand* LChunk::DefineConstantOperand(HConstant* constant) { | 485 LConstantOperand* LChunk::DefineConstantOperand(HConstant* constant) { |
486 return LConstantOperand::Create(constant->id()); | 486 return LConstantOperand::Create(constant->id(), zone()); |
487 } | 487 } |
488 | 488 |
489 | 489 |
490 int LChunk::GetParameterStackSlot(int index) const { | 490 int LChunk::GetParameterStackSlot(int index) const { |
491 // The receiver is at index 0, the first parameter at index 1, so we | 491 // The receiver is at index 0, the first parameter at index 1, so we |
492 // shift all parameter indexes down by the number of parameters, and | 492 // shift all parameter indexes down by the number of parameters, and |
493 // make sure they end up negative so they are distinguishable from | 493 // make sure they end up negative so they are distinguishable from |
494 // spill slots. | 494 // spill slots. |
495 int result = index - info()->scope()->num_parameters() - 1; | 495 int result = index - info()->scope()->num_parameters() - 1; |
496 ASSERT(result < 0); | 496 ASSERT(result < 0); |
(...skipping 18 matching lines...) Expand all Loading... |
515 } | 515 } |
516 | 516 |
517 | 517 |
518 int LChunk::NearestGapPos(int index) const { | 518 int LChunk::NearestGapPos(int index) const { |
519 while (!IsGapAt(index)) index--; | 519 while (!IsGapAt(index)) index--; |
520 return index; | 520 return index; |
521 } | 521 } |
522 | 522 |
523 | 523 |
524 void LChunk::AddGapMove(int index, LOperand* from, LOperand* to) { | 524 void LChunk::AddGapMove(int index, LOperand* from, LOperand* to) { |
525 GetGapAt(index)->GetOrCreateParallelMove(LGap::START)->AddMove(from, to); | 525 GetGapAt(index)->GetOrCreateParallelMove( |
| 526 LGap::START, zone())->AddMove(from, to, zone()); |
526 } | 527 } |
527 | 528 |
528 | 529 |
529 Handle<Object> LChunk::LookupLiteral(LConstantOperand* operand) const { | 530 Handle<Object> LChunk::LookupLiteral(LConstantOperand* operand) const { |
530 return HConstant::cast(graph_->LookupValue(operand->index()))->handle(); | 531 return HConstant::cast(graph_->LookupValue(operand->index()))->handle(); |
531 } | 532 } |
532 | 533 |
533 | 534 |
534 Representation LChunk::LookupLiteralRepresentation( | 535 Representation LChunk::LookupLiteralRepresentation( |
535 LConstantOperand* operand) const { | 536 LConstantOperand* operand) const { |
(...skipping 214 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
750 if (needs_environment && !instr->HasEnvironment()) { | 751 if (needs_environment && !instr->HasEnvironment()) { |
751 instr = AssignEnvironment(instr); | 752 instr = AssignEnvironment(instr); |
752 } | 753 } |
753 | 754 |
754 return instr; | 755 return instr; |
755 } | 756 } |
756 | 757 |
757 | 758 |
758 LInstruction* LChunkBuilder::AssignPointerMap(LInstruction* instr) { | 759 LInstruction* LChunkBuilder::AssignPointerMap(LInstruction* instr) { |
759 ASSERT(!instr->HasPointerMap()); | 760 ASSERT(!instr->HasPointerMap()); |
760 instr->set_pointer_map(new(zone()) LPointerMap(position_)); | 761 instr->set_pointer_map(new(zone()) LPointerMap(position_, zone())); |
761 return instr; | 762 return instr; |
762 } | 763 } |
763 | 764 |
764 | 765 |
765 LUnallocated* LChunkBuilder::TempRegister() { | 766 LUnallocated* LChunkBuilder::TempRegister() { |
766 LUnallocated* operand = | 767 LUnallocated* operand = |
767 new(zone()) LUnallocated(LUnallocated::MUST_HAVE_REGISTER); | 768 new(zone()) LUnallocated(LUnallocated::MUST_HAVE_REGISTER); |
768 operand->set_virtual_register(allocator_->GetVirtualRegister()); | 769 operand->set_virtual_register(allocator_->GetVirtualRegister()); |
769 if (!allocator_->AllocationOk()) Abort("Not enough virtual registers."); | 770 if (!allocator_->AllocationOk()) Abort("Not enough virtual registers."); |
770 return operand; | 771 return operand; |
(...skipping 816 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
1587 | 1588 |
1588 LInstruction* LChunkBuilder::DoValueOf(HValueOf* instr) { | 1589 LInstruction* LChunkBuilder::DoValueOf(HValueOf* instr) { |
1589 LOperand* object = UseRegister(instr->value()); | 1590 LOperand* object = UseRegister(instr->value()); |
1590 LValueOf* result = new(zone()) LValueOf(object); | 1591 LValueOf* result = new(zone()) LValueOf(object); |
1591 return DefineSameAsFirst(result); | 1592 return DefineSameAsFirst(result); |
1592 } | 1593 } |
1593 | 1594 |
1594 | 1595 |
1595 LInstruction* LChunkBuilder::DoDateField(HDateField* instr) { | 1596 LInstruction* LChunkBuilder::DoDateField(HDateField* instr) { |
1596 LOperand* object = UseFixed(instr->value(), rax); | 1597 LOperand* object = UseFixed(instr->value(), rax); |
1597 LDateField* result = new LDateField(object, instr->index()); | 1598 LDateField* result = new(zone()) LDateField(object, instr->index()); |
1598 return MarkAsCall(DefineFixed(result, rax), instr); | 1599 return MarkAsCall(DefineFixed(result, rax), instr); |
1599 } | 1600 } |
1600 | 1601 |
1601 | 1602 |
1602 LInstruction* LChunkBuilder::DoBoundsCheck(HBoundsCheck* instr) { | 1603 LInstruction* LChunkBuilder::DoBoundsCheck(HBoundsCheck* instr) { |
1603 LOperand* value = UseRegisterOrConstantAtStart(instr->index()); | 1604 LOperand* value = UseRegisterOrConstantAtStart(instr->index()); |
1604 LOperand* length = Use(instr->length()); | 1605 LOperand* length = Use(instr->length()); |
1605 return AssignEnvironment(new(zone()) LBoundsCheck(value, length)); | 1606 return AssignEnvironment(new(zone()) LBoundsCheck(value, length)); |
1606 } | 1607 } |
1607 | 1608 |
(...skipping 488 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
2096 } | 2097 } |
2097 | 2098 |
2098 | 2099 |
2099 LInstruction* LChunkBuilder::DoStringLength(HStringLength* instr) { | 2100 LInstruction* LChunkBuilder::DoStringLength(HStringLength* instr) { |
2100 LOperand* string = UseRegisterAtStart(instr->value()); | 2101 LOperand* string = UseRegisterAtStart(instr->value()); |
2101 return DefineAsRegister(new(zone()) LStringLength(string)); | 2102 return DefineAsRegister(new(zone()) LStringLength(string)); |
2102 } | 2103 } |
2103 | 2104 |
2104 | 2105 |
2105 LInstruction* LChunkBuilder::DoAllocateObject(HAllocateObject* instr) { | 2106 LInstruction* LChunkBuilder::DoAllocateObject(HAllocateObject* instr) { |
2106 LAllocateObject* result = new LAllocateObject(TempRegister()); | 2107 LAllocateObject* result = new(zone()) LAllocateObject(TempRegister()); |
2107 return AssignPointerMap(DefineAsRegister(result)); | 2108 return AssignPointerMap(DefineAsRegister(result)); |
2108 } | 2109 } |
2109 | 2110 |
2110 | 2111 |
2111 LInstruction* LChunkBuilder::DoFastLiteral(HFastLiteral* instr) { | 2112 LInstruction* LChunkBuilder::DoFastLiteral(HFastLiteral* instr) { |
2112 return MarkAsCall(DefineFixed(new(zone()) LFastLiteral, rax), instr); | 2113 return MarkAsCall(DefineFixed(new(zone()) LFastLiteral, rax), instr); |
2113 } | 2114 } |
2114 | 2115 |
2115 | 2116 |
2116 LInstruction* LChunkBuilder::DoArrayLiteral(HArrayLiteral* instr) { | 2117 LInstruction* LChunkBuilder::DoArrayLiteral(HArrayLiteral* instr) { |
(...skipping 209 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
2326 LInstruction* LChunkBuilder::DoLoadFieldByIndex(HLoadFieldByIndex* instr) { | 2327 LInstruction* LChunkBuilder::DoLoadFieldByIndex(HLoadFieldByIndex* instr) { |
2327 LOperand* object = UseRegister(instr->object()); | 2328 LOperand* object = UseRegister(instr->object()); |
2328 LOperand* index = UseTempRegister(instr->index()); | 2329 LOperand* index = UseTempRegister(instr->index()); |
2329 return DefineSameAsFirst(new(zone()) LLoadFieldByIndex(object, index)); | 2330 return DefineSameAsFirst(new(zone()) LLoadFieldByIndex(object, index)); |
2330 } | 2331 } |
2331 | 2332 |
2332 | 2333 |
2333 } } // namespace v8::internal | 2334 } } // namespace v8::internal |
2334 | 2335 |
2335 #endif // V8_TARGET_ARCH_X64 | 2336 #endif // V8_TARGET_ARCH_X64 |
OLD | NEW |