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 24 matching lines...) Expand all Loading... | |
35 namespace internal { | 35 namespace internal { |
36 | 36 |
37 #define DEFINE_COMPILE(type) \ | 37 #define DEFINE_COMPILE(type) \ |
38 void L##type::CompileToNative(LCodeGen* generator) { \ | 38 void L##type::CompileToNative(LCodeGen* generator) { \ |
39 generator->Do##type(this); \ | 39 generator->Do##type(this); \ |
40 } | 40 } |
41 LITHIUM_CONCRETE_INSTRUCTION_LIST(DEFINE_COMPILE) | 41 LITHIUM_CONCRETE_INSTRUCTION_LIST(DEFINE_COMPILE) |
42 #undef DEFINE_COMPILE | 42 #undef DEFINE_COMPILE |
43 | 43 |
44 LOsrEntry::LOsrEntry() { | 44 LOsrEntry::LOsrEntry() { |
45 for (int i = 0; i < Register::kNumAllocatableRegisters; ++i) { | 45 for (int i = 0; i < Register::NumAllocatableRegisters(); ++i) { |
46 register_spills_[i] = NULL; | 46 register_spills_[i] = NULL; |
47 } | 47 } |
48 for (int i = 0; i < DoubleRegister::kNumAllocatableRegisters; ++i) { | 48 for (int i = 0; i < DoubleRegister::NumAllocatableRegisters(); ++i) { |
49 double_register_spills_[i] = NULL; | 49 double_register_spills_[i] = NULL; |
50 } | 50 } |
51 } | 51 } |
52 | 52 |
53 | 53 |
54 void LOsrEntry::MarkSpilledRegister(int allocation_index, | 54 void LOsrEntry::MarkSpilledRegister(int allocation_index, |
55 LOperand* spill_operand) { | 55 LOperand* spill_operand) { |
56 ASSERT(spill_operand->IsStackSlot()); | 56 ASSERT(spill_operand->IsStackSlot()); |
57 ASSERT(register_spills_[allocation_index] == NULL); | 57 ASSERT(register_spills_[allocation_index] == NULL); |
58 register_spills_[allocation_index] = spill_operand; | 58 register_spills_[allocation_index] = spill_operand; |
(...skipping 525 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... | |
584 int argument_index_accumulator = 0; | 584 int argument_index_accumulator = 0; |
585 instr->set_environment(CreateEnvironment(hydrogen_env, | 585 instr->set_environment(CreateEnvironment(hydrogen_env, |
586 &argument_index_accumulator)); | 586 &argument_index_accumulator)); |
587 return instr; | 587 return instr; |
588 } | 588 } |
589 | 589 |
590 | 590 |
591 LInstruction* LChunkBuilder::MarkAsCall(LInstruction* instr, | 591 LInstruction* LChunkBuilder::MarkAsCall(LInstruction* instr, |
592 HInstruction* hinstr, | 592 HInstruction* hinstr, |
593 CanDeoptimize can_deoptimize) { | 593 CanDeoptimize can_deoptimize) { |
594 info()->MarkAsNonDeferredCalling(); | |
594 #ifdef DEBUG | 595 #ifdef DEBUG |
595 instr->VerifyCall(); | 596 instr->VerifyCall(); |
596 #endif | 597 #endif |
597 instr->MarkAsCall(); | 598 instr->MarkAsCall(); |
598 instr = AssignPointerMap(instr); | 599 instr = AssignPointerMap(instr); |
599 | 600 |
600 if (hinstr->HasObservableSideEffects()) { | 601 if (hinstr->HasObservableSideEffects()) { |
601 ASSERT(hinstr->next()->IsSimulate()); | 602 ASSERT(hinstr->next()->IsSimulate()); |
602 HSimulate* sim = HSimulate::cast(hinstr->next()); | 603 HSimulate* sim = HSimulate::cast(hinstr->next()); |
603 ASSERT(instruction_pending_deoptimization_environment_ == NULL); | 604 ASSERT(instruction_pending_deoptimization_environment_ == NULL); |
(...skipping 1018 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... | |
1622 UNREACHABLE(); | 1623 UNREACHABLE(); |
1623 return NULL; | 1624 return NULL; |
1624 } | 1625 } |
1625 | 1626 |
1626 | 1627 |
1627 LInstruction* LChunkBuilder::DoChange(HChange* instr) { | 1628 LInstruction* LChunkBuilder::DoChange(HChange* instr) { |
1628 Representation from = instr->from(); | 1629 Representation from = instr->from(); |
1629 Representation to = instr->to(); | 1630 Representation to = instr->to(); |
1630 if (from.IsTagged()) { | 1631 if (from.IsTagged()) { |
1631 if (to.IsDouble()) { | 1632 if (to.IsDouble()) { |
1633 info()->MarkAsDeferredCalling(); | |
1632 LOperand* value = UseRegister(instr->value()); | 1634 LOperand* value = UseRegister(instr->value()); |
1633 LNumberUntagD* res = new(zone()) LNumberUntagD(value); | 1635 LNumberUntagD* res = new(zone()) LNumberUntagD(value); |
1634 return AssignEnvironment(DefineAsRegister(res)); | 1636 return AssignEnvironment(DefineAsRegister(res)); |
1635 } else { | 1637 } else { |
1636 ASSERT(to.IsInteger32()); | 1638 ASSERT(to.IsInteger32()); |
1637 LOperand* value = UseRegisterAtStart(instr->value()); | 1639 LOperand* value = UseRegisterAtStart(instr->value()); |
1638 LInstruction* res = NULL; | 1640 LInstruction* res = NULL; |
1639 if (instr->value()->type().IsSmi()) { | 1641 if (instr->value()->type().IsSmi()) { |
1640 res = DefineAsRegister(new(zone()) LSmiUntag(value, false)); | 1642 res = DefineAsRegister(new(zone()) LSmiUntag(value, false)); |
1641 } else { | 1643 } else { |
1642 LOperand* temp1 = TempRegister(); | 1644 LOperand* temp1 = TempRegister(); |
1643 LOperand* temp2 = instr->CanTruncateToInt32() ? TempRegister() | 1645 LOperand* temp2 = instr->CanTruncateToInt32() ? TempRegister() |
1644 : NULL; | 1646 : NULL; |
1645 LOperand* temp3 = FixedTemp(d11); | 1647 LOperand* temp3 = FixedTemp(d11); |
1646 res = DefineSameAsFirst(new(zone()) LTaggedToI(value, | 1648 res = DefineSameAsFirst(new(zone()) LTaggedToI(value, |
1647 temp1, | 1649 temp1, |
1648 temp2, | 1650 temp2, |
1649 temp3)); | 1651 temp3)); |
1650 res = AssignEnvironment(res); | 1652 res = AssignEnvironment(res); |
1651 } | 1653 } |
1652 return res; | 1654 return res; |
1653 } | 1655 } |
1654 } else if (from.IsDouble()) { | 1656 } else if (from.IsDouble()) { |
1655 if (to.IsTagged()) { | 1657 if (to.IsTagged()) { |
1658 info()->MarkAsDeferredCalling(); | |
1656 LOperand* value = UseRegister(instr->value()); | 1659 LOperand* value = UseRegister(instr->value()); |
1657 LOperand* temp1 = TempRegister(); | 1660 LOperand* temp1 = TempRegister(); |
1658 LOperand* temp2 = TempRegister(); | 1661 LOperand* temp2 = TempRegister(); |
1659 | 1662 |
1660 // Make sure that the temp and result_temp registers are | 1663 // Make sure that the temp and result_temp registers are |
1661 // different. | 1664 // different. |
1662 LUnallocated* result_temp = TempRegister(); | 1665 LUnallocated* result_temp = TempRegister(); |
1663 LNumberTagD* result = new(zone()) LNumberTagD(value, temp1, temp2); | 1666 LNumberTagD* result = new(zone()) LNumberTagD(value, temp1, temp2); |
1664 Define(result, result_temp); | 1667 Define(result, result_temp); |
1665 return AssignPointerMap(result); | 1668 return AssignPointerMap(result); |
1666 } else { | 1669 } else { |
1667 ASSERT(to.IsInteger32()); | 1670 ASSERT(to.IsInteger32()); |
1668 LOperand* value = UseRegister(instr->value()); | 1671 LOperand* value = UseRegister(instr->value()); |
1669 LOperand* temp1 = TempRegister(); | 1672 LOperand* temp1 = TempRegister(); |
1670 LOperand* temp2 = instr->CanTruncateToInt32() ? TempRegister() : NULL; | 1673 LOperand* temp2 = instr->CanTruncateToInt32() ? TempRegister() : NULL; |
1671 LDoubleToI* res = new(zone()) LDoubleToI(value, temp1, temp2); | 1674 LDoubleToI* res = new(zone()) LDoubleToI(value, temp1, temp2); |
1672 return AssignEnvironment(DefineAsRegister(res)); | 1675 return AssignEnvironment(DefineAsRegister(res)); |
1673 } | 1676 } |
1674 } else if (from.IsInteger32()) { | 1677 } else if (from.IsInteger32()) { |
1678 info()->MarkAsDeferredCalling(); | |
1675 if (to.IsTagged()) { | 1679 if (to.IsTagged()) { |
1676 HValue* val = instr->value(); | 1680 HValue* val = instr->value(); |
1677 LOperand* value = UseRegisterAtStart(val); | 1681 LOperand* value = UseRegisterAtStart(val); |
1678 if (val->CheckFlag(HInstruction::kUint32)) { | 1682 if (val->CheckFlag(HInstruction::kUint32)) { |
1679 LNumberTagU* result = new(zone()) LNumberTagU(value); | 1683 LNumberTagU* result = new(zone()) LNumberTagU(value); |
1680 return AssignEnvironment(AssignPointerMap(DefineSameAsFirst(result))); | 1684 return AssignEnvironment(AssignPointerMap(DefineSameAsFirst(result))); |
1681 } else if (val->HasRange() && val->range()->IsInSmiRange()) { | 1685 } else if (val->HasRange() && val->range()->IsInSmiRange()) { |
1682 return DefineAsRegister(new(zone()) LSmiTag(value)); | 1686 return DefineAsRegister(new(zone()) LSmiTag(value)); |
1683 } else { | 1687 } else { |
1684 LNumberTagI* result = new(zone()) LNumberTagI(value); | 1688 LNumberTagI* result = new(zone()) LNumberTagI(value); |
(...skipping 435 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... | |
2120 | 2124 |
2121 LInstruction* LChunkBuilder::DoOsrEntry(HOsrEntry* instr) { | 2125 LInstruction* LChunkBuilder::DoOsrEntry(HOsrEntry* instr) { |
2122 ASSERT(argument_count_ == 0); | 2126 ASSERT(argument_count_ == 0); |
2123 allocator_->MarkAsOsrEntry(); | 2127 allocator_->MarkAsOsrEntry(); |
2124 current_block_->last_environment()->set_ast_id(instr->ast_id()); | 2128 current_block_->last_environment()->set_ast_id(instr->ast_id()); |
2125 return AssignEnvironment(new(zone()) LOsrEntry); | 2129 return AssignEnvironment(new(zone()) LOsrEntry); |
2126 } | 2130 } |
2127 | 2131 |
2128 | 2132 |
2129 LInstruction* LChunkBuilder::DoParameter(HParameter* instr) { | 2133 LInstruction* LChunkBuilder::DoParameter(HParameter* instr) { |
2130 int spill_index = chunk()->GetParameterStackSlot(instr->index()); | 2134 LParameter* result = new(zone()) LParameter; |
2131 return DefineAsSpilled(new(zone()) LParameter, spill_index); | 2135 switch (instr->kind()) { |
2136 case FUNCTION_PARAMETER: { | |
2137 int spill_index = chunk()->GetParameterStackSlot(instr->index()); | |
2138 return DefineAsSpilled(new(zone()) LParameter, spill_index); | |
2139 } | |
2140 case KEYED_LOAD_IC_PARAMETER: { | |
2141 if (instr->index() == 0) return DefineFixed(result, r1); | |
2142 if (instr->index() == 1) return DefineFixed(result, r0); | |
2143 UNREACHABLE(); | |
2144 break; | |
2145 } | |
2146 case KEYED_STORE_IC_PARAMETER: | |
Jakob Kummerow
2012/11/19 12:36:00
remove for now
danno
2012/11/26 17:16:18
Done.
| |
2147 if (instr->index() == 0) return DefineFixed(result, r2); | |
2148 if (instr->index() == 1) return DefineFixed(result, r1); | |
2149 if (instr->index() == 2) return DefineFixed(result, r0); | |
2150 break; | |
2151 default: | |
2152 UNREACHABLE(); | |
2153 } | |
2154 return NULL; | |
2132 } | 2155 } |
2133 | 2156 |
2134 | 2157 |
2135 LInstruction* LChunkBuilder::DoUnknownOSRValue(HUnknownOSRValue* instr) { | 2158 LInstruction* LChunkBuilder::DoUnknownOSRValue(HUnknownOSRValue* instr) { |
2136 int spill_index = chunk()->GetNextSpillIndex(false); // Not double-width. | 2159 int spill_index = chunk()->GetNextSpillIndex(false); // Not double-width. |
2137 if (spill_index > LUnallocated::kMaxFixedIndex) { | 2160 if (spill_index > LUnallocated::kMaxFixedIndex) { |
2138 Abort("Too many spill slots needed for OSR"); | 2161 Abort("Too many spill slots needed for OSR"); |
2139 spill_index = 0; | 2162 spill_index = 0; |
2140 } | 2163 } |
2141 return DefineAsSpilled(new(zone()) LUnknownOSRValue, spill_index); | 2164 return DefineAsSpilled(new(zone()) LUnknownOSRValue, spill_index); |
(...skipping 158 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... | |
2300 | 2323 |
2301 | 2324 |
2302 LInstruction* LChunkBuilder::DoLoadFieldByIndex(HLoadFieldByIndex* instr) { | 2325 LInstruction* LChunkBuilder::DoLoadFieldByIndex(HLoadFieldByIndex* instr) { |
2303 LOperand* object = UseRegister(instr->object()); | 2326 LOperand* object = UseRegister(instr->object()); |
2304 LOperand* index = UseRegister(instr->index()); | 2327 LOperand* index = UseRegister(instr->index()); |
2305 return DefineAsRegister(new(zone()) LLoadFieldByIndex(object, index)); | 2328 return DefineAsRegister(new(zone()) LLoadFieldByIndex(object, index)); |
2306 } | 2329 } |
2307 | 2330 |
2308 | 2331 |
2309 } } // namespace v8::internal | 2332 } } // namespace v8::internal |
OLD | NEW |