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 2128 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
2139 Representation r = instr->representation(); | 2139 Representation r = instr->representation(); |
2140 if (r.IsSmi()) { | 2140 if (r.IsSmi()) { |
2141 return DefineAsRegister(new(zone()) LConstantS); | 2141 return DefineAsRegister(new(zone()) LConstantS); |
2142 } else if (r.IsInteger32()) { | 2142 } else if (r.IsInteger32()) { |
2143 return DefineAsRegister(new(zone()) LConstantI); | 2143 return DefineAsRegister(new(zone()) LConstantI); |
2144 } else if (r.IsDouble()) { | 2144 } else if (r.IsDouble()) { |
2145 double value = instr->DoubleValue(); | 2145 double value = instr->DoubleValue(); |
2146 bool value_is_zero = BitCast<uint64_t, double>(value) == 0; | 2146 bool value_is_zero = BitCast<uint64_t, double>(value) == 0; |
2147 LOperand* temp = value_is_zero ? NULL : TempRegister(); | 2147 LOperand* temp = value_is_zero ? NULL : TempRegister(); |
2148 return DefineAsRegister(new(zone()) LConstantD(temp)); | 2148 return DefineAsRegister(new(zone()) LConstantD(temp)); |
| 2149 } else if (r.IsExternal()) { |
| 2150 return DefineAsRegister(new(zone()) LConstantE); |
2149 } else if (r.IsTagged()) { | 2151 } else if (r.IsTagged()) { |
2150 return DefineAsRegister(new(zone()) LConstantT); | 2152 return DefineAsRegister(new(zone()) LConstantT); |
2151 } else { | 2153 } else { |
2152 UNREACHABLE(); | 2154 UNREACHABLE(); |
2153 return NULL; | 2155 return NULL; |
2154 } | 2156 } |
2155 } | 2157 } |
2156 | 2158 |
2157 | 2159 |
2158 LInstruction* LChunkBuilder::DoLoadGlobalCell(HLoadGlobalCell* instr) { | 2160 LInstruction* LChunkBuilder::DoLoadGlobalCell(HLoadGlobalCell* instr) { |
(...skipping 56 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
2215 } else { | 2217 } else { |
2216 value = UseRegister(instr->value()); | 2218 value = UseRegister(instr->value()); |
2217 temp = NULL; | 2219 temp = NULL; |
2218 } | 2220 } |
2219 LInstruction* result = new(zone()) LStoreContextSlot(context, value, temp); | 2221 LInstruction* result = new(zone()) LStoreContextSlot(context, value, temp); |
2220 return instr->RequiresHoleCheck() ? AssignEnvironment(result) : result; | 2222 return instr->RequiresHoleCheck() ? AssignEnvironment(result) : result; |
2221 } | 2223 } |
2222 | 2224 |
2223 | 2225 |
2224 LInstruction* LChunkBuilder::DoLoadNamedField(HLoadNamedField* instr) { | 2226 LInstruction* LChunkBuilder::DoLoadNamedField(HLoadNamedField* instr) { |
2225 LOperand* obj = UseRegisterAtStart(instr->object()); | 2227 LOperand* obj = (instr->access().IsExternalMemory() && |
| 2228 instr->access().offset() == 0) |
| 2229 ? UseRegisterOrConstantAtStart(instr->object()) |
| 2230 : UseRegisterAtStart(instr->object()); |
2226 return DefineAsRegister(new(zone()) LLoadNamedField(obj)); | 2231 return DefineAsRegister(new(zone()) LLoadNamedField(obj)); |
2227 } | 2232 } |
2228 | 2233 |
2229 | 2234 |
2230 LInstruction* LChunkBuilder::DoLoadNamedFieldPolymorphic( | 2235 LInstruction* LChunkBuilder::DoLoadNamedFieldPolymorphic( |
2231 HLoadNamedFieldPolymorphic* instr) { | 2236 HLoadNamedFieldPolymorphic* instr) { |
2232 ASSERT(instr->representation().IsTagged()); | 2237 ASSERT(instr->representation().IsTagged()); |
2233 if (instr->need_generic()) { | 2238 if (instr->need_generic()) { |
2234 LOperand* context = UseFixed(instr->context(), esi); | 2239 LOperand* context = UseFixed(instr->context(), esi); |
2235 LOperand* obj = UseFixed(instr->object(), edx); | 2240 LOperand* obj = UseFixed(instr->object(), edx); |
(...skipping 193 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
2429 LOperand* object = UseRegister(instr->object()); | 2434 LOperand* object = UseRegister(instr->object()); |
2430 LOperand* temp = TempRegister(); | 2435 LOperand* temp = TempRegister(); |
2431 LTrapAllocationMemento* result = | 2436 LTrapAllocationMemento* result = |
2432 new(zone()) LTrapAllocationMemento(object, temp); | 2437 new(zone()) LTrapAllocationMemento(object, temp); |
2433 return AssignEnvironment(result); | 2438 return AssignEnvironment(result); |
2434 } | 2439 } |
2435 | 2440 |
2436 | 2441 |
2437 LInstruction* LChunkBuilder::DoStoreNamedField(HStoreNamedField* instr) { | 2442 LInstruction* LChunkBuilder::DoStoreNamedField(HStoreNamedField* instr) { |
2438 bool is_in_object = instr->access().IsInobject(); | 2443 bool is_in_object = instr->access().IsInobject(); |
| 2444 bool is_external_location = instr->access().IsExternalMemory() && |
| 2445 instr->access().offset() == 0; |
2439 bool needs_write_barrier = instr->NeedsWriteBarrier(); | 2446 bool needs_write_barrier = instr->NeedsWriteBarrier(); |
2440 bool needs_write_barrier_for_map = !instr->transition().is_null() && | 2447 bool needs_write_barrier_for_map = !instr->transition().is_null() && |
2441 instr->NeedsWriteBarrierForMap(); | 2448 instr->NeedsWriteBarrierForMap(); |
2442 | 2449 |
2443 LOperand* obj; | 2450 LOperand* obj; |
2444 if (needs_write_barrier) { | 2451 if (needs_write_barrier) { |
2445 obj = is_in_object | 2452 obj = is_in_object |
2446 ? UseRegister(instr->object()) | 2453 ? UseRegister(instr->object()) |
2447 : UseTempRegister(instr->object()); | 2454 : UseTempRegister(instr->object()); |
| 2455 } else if (is_external_location) { |
| 2456 ASSERT(!is_in_object); |
| 2457 ASSERT(!needs_write_barrier); |
| 2458 ASSERT(!needs_write_barrier_for_map); |
| 2459 obj = UseRegisterOrConstant(instr->object()); |
2448 } else { | 2460 } else { |
2449 obj = needs_write_barrier_for_map | 2461 obj = needs_write_barrier_for_map |
2450 ? UseRegister(instr->object()) | 2462 ? UseRegister(instr->object()) |
2451 : UseRegisterAtStart(instr->object()); | 2463 : UseRegisterAtStart(instr->object()); |
2452 } | 2464 } |
2453 | 2465 |
2454 bool can_be_constant = instr->value()->IsConstant() && | 2466 bool can_be_constant = instr->value()->IsConstant() && |
2455 HConstant::cast(instr->value())->NotInNewSpace() && | 2467 HConstant::cast(instr->value())->NotInNewSpace() && |
2456 !(FLAG_track_double_fields && instr->field_representation().IsDouble()); | 2468 !(FLAG_track_double_fields && instr->field_representation().IsDouble()); |
2457 | 2469 |
(...skipping 307 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
2765 LInstruction* LChunkBuilder::DoLoadFieldByIndex(HLoadFieldByIndex* instr) { | 2777 LInstruction* LChunkBuilder::DoLoadFieldByIndex(HLoadFieldByIndex* instr) { |
2766 LOperand* object = UseRegister(instr->object()); | 2778 LOperand* object = UseRegister(instr->object()); |
2767 LOperand* index = UseTempRegister(instr->index()); | 2779 LOperand* index = UseTempRegister(instr->index()); |
2768 return DefineSameAsFirst(new(zone()) LLoadFieldByIndex(object, index)); | 2780 return DefineSameAsFirst(new(zone()) LLoadFieldByIndex(object, index)); |
2769 } | 2781 } |
2770 | 2782 |
2771 | 2783 |
2772 } } // namespace v8::internal | 2784 } } // namespace v8::internal |
2773 | 2785 |
2774 #endif // V8_TARGET_ARCH_IA32 | 2786 #endif // V8_TARGET_ARCH_IA32 |
OLD | NEW |