| OLD | NEW |
| 1 // Copyright 2012 the V8 project authors. All rights reserved. | 1 // Copyright 2012 the V8 project authors. All rights reserved. |
| 2 // Use of this source code is governed by a BSD-style license that can be | 2 // Use of this source code is governed by a BSD-style license that can be |
| 3 // found in the LICENSE file. | 3 // found in the LICENSE file. |
| 4 | 4 |
| 5 #include "src/v8.h" | 5 #include "src/v8.h" |
| 6 | 6 |
| 7 #if V8_TARGET_ARCH_X87 | 7 #if V8_TARGET_ARCH_X87 |
| 8 | 8 |
| 9 #include "src/hydrogen-osr.h" | 9 #include "src/hydrogen-osr.h" |
| 10 #include "src/lithium-inl.h" | 10 #include "src/lithium-inl.h" |
| (...skipping 2036 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 2047 } | 2047 } |
| 2048 | 2048 |
| 2049 | 2049 |
| 2050 LInstruction* LChunkBuilder::DoConstant(HConstant* instr) { | 2050 LInstruction* LChunkBuilder::DoConstant(HConstant* instr) { |
| 2051 Representation r = instr->representation(); | 2051 Representation r = instr->representation(); |
| 2052 if (r.IsSmi()) { | 2052 if (r.IsSmi()) { |
| 2053 return DefineAsRegister(new(zone()) LConstantS); | 2053 return DefineAsRegister(new(zone()) LConstantS); |
| 2054 } else if (r.IsInteger32()) { | 2054 } else if (r.IsInteger32()) { |
| 2055 return DefineAsRegister(new(zone()) LConstantI); | 2055 return DefineAsRegister(new(zone()) LConstantI); |
| 2056 } else if (r.IsDouble()) { | 2056 } else if (r.IsDouble()) { |
| 2057 double value = instr->DoubleValue(); | 2057 return DefineAsRegister(new(zone()) LConstantD); |
| 2058 bool value_is_zero = BitCast<uint64_t, double>(value) == 0; | |
| 2059 LOperand* temp = value_is_zero ? NULL : TempRegister(); | |
| 2060 return DefineAsRegister(new(zone()) LConstantD(temp)); | |
| 2061 } else if (r.IsExternal()) { | 2058 } else if (r.IsExternal()) { |
| 2062 return DefineAsRegister(new(zone()) LConstantE); | 2059 return DefineAsRegister(new(zone()) LConstantE); |
| 2063 } else if (r.IsTagged()) { | 2060 } else if (r.IsTagged()) { |
| 2064 return DefineAsRegister(new(zone()) LConstantT); | 2061 return DefineAsRegister(new(zone()) LConstantT); |
| 2065 } else { | 2062 } else { |
| 2066 UNREACHABLE(); | 2063 UNREACHABLE(); |
| 2067 return NULL; | 2064 return NULL; |
| 2068 } | 2065 } |
| 2069 } | 2066 } |
| 2070 | 2067 |
| (...skipping 170 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 2241 | 2238 |
| 2242 | 2239 |
| 2243 LInstruction* LChunkBuilder::DoStoreKeyed(HStoreKeyed* instr) { | 2240 LInstruction* LChunkBuilder::DoStoreKeyed(HStoreKeyed* instr) { |
| 2244 if (!instr->is_typed_elements()) { | 2241 if (!instr->is_typed_elements()) { |
| 2245 DCHECK(instr->elements()->representation().IsTagged()); | 2242 DCHECK(instr->elements()->representation().IsTagged()); |
| 2246 DCHECK(instr->key()->representation().IsInteger32() || | 2243 DCHECK(instr->key()->representation().IsInteger32() || |
| 2247 instr->key()->representation().IsSmi()); | 2244 instr->key()->representation().IsSmi()); |
| 2248 | 2245 |
| 2249 if (instr->value()->representation().IsDouble()) { | 2246 if (instr->value()->representation().IsDouble()) { |
| 2250 LOperand* object = UseRegisterAtStart(instr->elements()); | 2247 LOperand* object = UseRegisterAtStart(instr->elements()); |
| 2251 LOperand* val = NULL; | 2248 // For storing double hole, no fp register required. |
| 2252 val = UseRegisterAtStart(instr->value()); | 2249 LOperand* val = instr->IsConstantHoleStore() |
| 2250 ? NULL : UseRegisterAtStart(instr->value()); |
| 2253 LOperand* key = UseRegisterOrConstantAtStart(instr->key()); | 2251 LOperand* key = UseRegisterOrConstantAtStart(instr->key()); |
| 2254 return new(zone()) LStoreKeyed(object, key, val); | 2252 return new(zone()) LStoreKeyed(object, key, val); |
| 2255 } else { | 2253 } else { |
| 2256 DCHECK(instr->value()->representation().IsSmiOrTagged()); | 2254 DCHECK(instr->value()->representation().IsSmiOrTagged()); |
| 2257 bool needs_write_barrier = instr->NeedsWriteBarrier(); | 2255 bool needs_write_barrier = instr->NeedsWriteBarrier(); |
| 2258 | 2256 |
| 2259 LOperand* obj = UseRegister(instr->elements()); | 2257 LOperand* obj = UseRegister(instr->elements()); |
| 2260 LOperand* val; | 2258 LOperand* val; |
| 2261 LOperand* key; | 2259 LOperand* key; |
| 2262 if (needs_write_barrier) { | 2260 if (needs_write_barrier) { |
| (...skipping 415 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 2678 LOperand* function = UseRegisterAtStart(instr->function()); | 2676 LOperand* function = UseRegisterAtStart(instr->function()); |
| 2679 LAllocateBlockContext* result = | 2677 LAllocateBlockContext* result = |
| 2680 new(zone()) LAllocateBlockContext(context, function); | 2678 new(zone()) LAllocateBlockContext(context, function); |
| 2681 return MarkAsCall(DefineFixed(result, esi), instr); | 2679 return MarkAsCall(DefineFixed(result, esi), instr); |
| 2682 } | 2680 } |
| 2683 | 2681 |
| 2684 | 2682 |
| 2685 } } // namespace v8::internal | 2683 } } // namespace v8::internal |
| 2686 | 2684 |
| 2687 #endif // V8_TARGET_ARCH_X87 | 2685 #endif // V8_TARGET_ARCH_X87 |
| OLD | NEW |