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 1979 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
1990 | 1990 |
1991 LInstruction* LChunkBuilder::DoConstant(HConstant* instr) { | 1991 LInstruction* LChunkBuilder::DoConstant(HConstant* instr) { |
1992 Representation r = instr->representation(); | 1992 Representation r = instr->representation(); |
1993 if (r.IsSmi()) { | 1993 if (r.IsSmi()) { |
1994 return DefineAsRegister(new(zone()) LConstantS); | 1994 return DefineAsRegister(new(zone()) LConstantS); |
1995 } else if (r.IsInteger32()) { | 1995 } else if (r.IsInteger32()) { |
1996 return DefineAsRegister(new(zone()) LConstantI); | 1996 return DefineAsRegister(new(zone()) LConstantI); |
1997 } else if (r.IsDouble()) { | 1997 } else if (r.IsDouble()) { |
1998 LOperand* temp = TempRegister(); | 1998 LOperand* temp = TempRegister(); |
1999 return DefineAsRegister(new(zone()) LConstantD(temp)); | 1999 return DefineAsRegister(new(zone()) LConstantD(temp)); |
| 2000 } else if (r.IsExternal()) { |
| 2001 return DefineAsRegister(new(zone()) LConstantE); |
2000 } else if (r.IsTagged()) { | 2002 } else if (r.IsTagged()) { |
2001 return DefineAsRegister(new(zone()) LConstantT); | 2003 return DefineAsRegister(new(zone()) LConstantT); |
2002 } else { | 2004 } else { |
2003 UNREACHABLE(); | 2005 UNREACHABLE(); |
2004 return NULL; | 2006 return NULL; |
2005 } | 2007 } |
2006 } | 2008 } |
2007 | 2009 |
2008 | 2010 |
2009 LInstruction* LChunkBuilder::DoLoadGlobalCell(HLoadGlobalCell* instr) { | 2011 LInstruction* LChunkBuilder::DoLoadGlobalCell(HLoadGlobalCell* instr) { |
(...skipping 57 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
2067 context = UseRegister(instr->context()); | 2069 context = UseRegister(instr->context()); |
2068 value = UseRegister(instr->value()); | 2070 value = UseRegister(instr->value()); |
2069 temp = NULL; | 2071 temp = NULL; |
2070 } | 2072 } |
2071 LInstruction* result = new(zone()) LStoreContextSlot(context, value, temp); | 2073 LInstruction* result = new(zone()) LStoreContextSlot(context, value, temp); |
2072 return instr->RequiresHoleCheck() ? AssignEnvironment(result) : result; | 2074 return instr->RequiresHoleCheck() ? AssignEnvironment(result) : result; |
2073 } | 2075 } |
2074 | 2076 |
2075 | 2077 |
2076 LInstruction* LChunkBuilder::DoLoadNamedField(HLoadNamedField* instr) { | 2078 LInstruction* LChunkBuilder::DoLoadNamedField(HLoadNamedField* instr) { |
| 2079 if (instr->access().IsExternalMemory() && instr->access().offset() == 0) { |
| 2080 LOperand* obj = UseRegisterOrConstantAtStart(instr->object()); |
| 2081 return DefineFixed(new(zone()) LLoadNamedField(obj), rax); |
| 2082 } |
2077 LOperand* obj = UseRegisterAtStart(instr->object()); | 2083 LOperand* obj = UseRegisterAtStart(instr->object()); |
2078 return DefineAsRegister(new(zone()) LLoadNamedField(obj)); | 2084 return DefineAsRegister(new(zone()) LLoadNamedField(obj)); |
2079 } | 2085 } |
2080 | 2086 |
2081 | 2087 |
2082 LInstruction* LChunkBuilder::DoLoadNamedFieldPolymorphic( | 2088 LInstruction* LChunkBuilder::DoLoadNamedFieldPolymorphic( |
2083 HLoadNamedFieldPolymorphic* instr) { | 2089 HLoadNamedFieldPolymorphic* instr) { |
2084 ASSERT(instr->representation().IsTagged()); | 2090 ASSERT(instr->representation().IsTagged()); |
2085 if (instr->need_generic()) { | 2091 if (instr->need_generic()) { |
2086 LOperand* obj = UseFixed(instr->object(), rax); | 2092 LOperand* obj = UseFixed(instr->object(), rax); |
(...skipping 155 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
2242 LOperand* object = UseRegister(instr->object()); | 2248 LOperand* object = UseRegister(instr->object()); |
2243 LOperand* temp = TempRegister(); | 2249 LOperand* temp = TempRegister(); |
2244 LTrapAllocationMemento* result = | 2250 LTrapAllocationMemento* result = |
2245 new(zone()) LTrapAllocationMemento(object, temp); | 2251 new(zone()) LTrapAllocationMemento(object, temp); |
2246 return AssignEnvironment(result); | 2252 return AssignEnvironment(result); |
2247 } | 2253 } |
2248 | 2254 |
2249 | 2255 |
2250 LInstruction* LChunkBuilder::DoStoreNamedField(HStoreNamedField* instr) { | 2256 LInstruction* LChunkBuilder::DoStoreNamedField(HStoreNamedField* instr) { |
2251 bool is_in_object = instr->access().IsInobject(); | 2257 bool is_in_object = instr->access().IsInobject(); |
| 2258 bool is_external_location = instr->access().IsExternalMemory() && |
| 2259 instr->access().offset() == 0; |
2252 bool needs_write_barrier = instr->NeedsWriteBarrier(); | 2260 bool needs_write_barrier = instr->NeedsWriteBarrier(); |
2253 bool needs_write_barrier_for_map = !instr->transition().is_null() && | 2261 bool needs_write_barrier_for_map = !instr->transition().is_null() && |
2254 instr->NeedsWriteBarrierForMap(); | 2262 instr->NeedsWriteBarrierForMap(); |
2255 | 2263 |
2256 LOperand* obj; | 2264 LOperand* obj; |
2257 if (needs_write_barrier) { | 2265 if (needs_write_barrier) { |
2258 obj = is_in_object | 2266 obj = is_in_object |
2259 ? UseRegister(instr->object()) | 2267 ? UseRegister(instr->object()) |
2260 : UseTempRegister(instr->object()); | 2268 : UseTempRegister(instr->object()); |
| 2269 } else if (is_external_location) { |
| 2270 ASSERT(!is_in_object); |
| 2271 ASSERT(!needs_write_barrier); |
| 2272 ASSERT(!needs_write_barrier_for_map); |
| 2273 obj = UseRegisterOrConstant(instr->object()); |
2261 } else { | 2274 } else { |
2262 obj = needs_write_barrier_for_map | 2275 obj = needs_write_barrier_for_map |
2263 ? UseRegister(instr->object()) | 2276 ? UseRegister(instr->object()) |
2264 : UseRegisterAtStart(instr->object()); | 2277 : UseRegisterAtStart(instr->object()); |
2265 } | 2278 } |
2266 | 2279 |
2267 bool can_be_constant = instr->value()->IsConstant() && | 2280 bool can_be_constant = instr->value()->IsConstant() && |
2268 HConstant::cast(instr->value())->NotInNewSpace() && | 2281 HConstant::cast(instr->value())->NotInNewSpace() && |
2269 !(FLAG_track_double_fields && instr->field_representation().IsDouble()); | 2282 !(FLAG_track_double_fields && instr->field_representation().IsDouble()); |
2270 | 2283 |
2271 LOperand* val; | 2284 LOperand* val; |
2272 if (needs_write_barrier) { | 2285 if (needs_write_barrier) { |
2273 val = UseTempRegister(instr->value()); | 2286 val = UseTempRegister(instr->value()); |
| 2287 } else if (is_external_location) { |
| 2288 val = UseFixed(instr->value(), rax); |
2274 } else if (can_be_constant) { | 2289 } else if (can_be_constant) { |
2275 val = UseRegisterOrConstant(instr->value()); | 2290 val = UseRegisterOrConstant(instr->value()); |
2276 } else if (FLAG_track_fields && instr->field_representation().IsSmi()) { | 2291 } else if (FLAG_track_fields && instr->field_representation().IsSmi()) { |
2277 val = UseTempRegister(instr->value()); | 2292 val = UseTempRegister(instr->value()); |
2278 } else if (FLAG_track_double_fields && | 2293 } else if (FLAG_track_double_fields && |
2279 instr->field_representation().IsDouble()) { | 2294 instr->field_representation().IsDouble()) { |
2280 val = UseRegisterAtStart(instr->value()); | 2295 val = UseRegisterAtStart(instr->value()); |
2281 } else { | 2296 } else { |
2282 val = UseRegister(instr->value()); | 2297 val = UseRegister(instr->value()); |
2283 } | 2298 } |
(...skipping 270 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
2554 LInstruction* LChunkBuilder::DoLoadFieldByIndex(HLoadFieldByIndex* instr) { | 2569 LInstruction* LChunkBuilder::DoLoadFieldByIndex(HLoadFieldByIndex* instr) { |
2555 LOperand* object = UseRegister(instr->object()); | 2570 LOperand* object = UseRegister(instr->object()); |
2556 LOperand* index = UseTempRegister(instr->index()); | 2571 LOperand* index = UseTempRegister(instr->index()); |
2557 return DefineSameAsFirst(new(zone()) LLoadFieldByIndex(object, index)); | 2572 return DefineSameAsFirst(new(zone()) LLoadFieldByIndex(object, index)); |
2558 } | 2573 } |
2559 | 2574 |
2560 | 2575 |
2561 } } // namespace v8::internal | 2576 } } // namespace v8::internal |
2562 | 2577 |
2563 #endif // V8_TARGET_ARCH_X64 | 2578 #endif // V8_TARGET_ARCH_X64 |
OLD | NEW |