OLD | NEW |
1 // Copyright 2013 the V8 project authors. All rights reserved. | 1 // Copyright 2013 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 1647 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
1658 LLoadGlobalGeneric* result = | 1658 LLoadGlobalGeneric* result = |
1659 new(zone()) LLoadGlobalGeneric(context, global_object); | 1659 new(zone()) LLoadGlobalGeneric(context, global_object); |
1660 return MarkAsCall(DefineFixed(result, x0), instr); | 1660 return MarkAsCall(DefineFixed(result, x0), instr); |
1661 } | 1661 } |
1662 | 1662 |
1663 | 1663 |
1664 LInstruction* LChunkBuilder::DoLoadKeyed(HLoadKeyed* instr) { | 1664 LInstruction* LChunkBuilder::DoLoadKeyed(HLoadKeyed* instr) { |
1665 ASSERT(instr->key()->representation().IsSmiOrInteger32()); | 1665 ASSERT(instr->key()->representation().IsSmiOrInteger32()); |
1666 ElementsKind elements_kind = instr->elements_kind(); | 1666 ElementsKind elements_kind = instr->elements_kind(); |
1667 LOperand* elements = UseRegister(instr->elements()); | 1667 LOperand* elements = UseRegister(instr->elements()); |
1668 LOperand* key = UseRegisterOrConstantAtStart(instr->key()); | |
1669 | 1668 |
1670 if (!instr->is_typed_elements()) { | 1669 if (!instr->is_typed_elements()) { |
| 1670 LOperand* key = UseRegisterOrConstantAtStart(instr->key()); |
| 1671 |
1671 if (instr->representation().IsDouble()) { | 1672 if (instr->representation().IsDouble()) { |
1672 LOperand* temp = (!instr->key()->IsConstant() || | 1673 LOperand* temp = (!instr->key()->IsConstant() || |
1673 instr->RequiresHoleCheck()) | 1674 instr->RequiresHoleCheck()) |
1674 ? TempRegister() | 1675 ? TempRegister() |
1675 : NULL; | 1676 : NULL; |
1676 | 1677 |
1677 LLoadKeyedFixedDouble* result = | 1678 LLoadKeyedFixedDouble* result = |
1678 new(zone()) LLoadKeyedFixedDouble(elements, key, temp); | 1679 new(zone()) LLoadKeyedFixedDouble(elements, key, temp); |
1679 return instr->RequiresHoleCheck() | 1680 return instr->RequiresHoleCheck() |
1680 ? AssignEnvironment(DefineAsRegister(result)) | 1681 ? AssignEnvironment(DefineAsRegister(result)) |
1681 : DefineAsRegister(result); | 1682 : DefineAsRegister(result); |
1682 } else { | 1683 } else { |
1683 ASSERT(instr->representation().IsSmiOrTagged() || | 1684 ASSERT(instr->representation().IsSmiOrTagged() || |
1684 instr->representation().IsInteger32()); | 1685 instr->representation().IsInteger32()); |
1685 LOperand* temp = instr->key()->IsConstant() ? NULL : TempRegister(); | 1686 LOperand* temp = instr->key()->IsConstant() ? NULL : TempRegister(); |
1686 LLoadKeyedFixed* result = | 1687 LLoadKeyedFixed* result = |
1687 new(zone()) LLoadKeyedFixed(elements, key, temp); | 1688 new(zone()) LLoadKeyedFixed(elements, key, temp); |
1688 return instr->RequiresHoleCheck() | 1689 return instr->RequiresHoleCheck() |
1689 ? AssignEnvironment(DefineAsRegister(result)) | 1690 ? AssignEnvironment(DefineAsRegister(result)) |
1690 : DefineAsRegister(result); | 1691 : DefineAsRegister(result); |
1691 } | 1692 } |
1692 } else { | 1693 } else { |
1693 ASSERT((instr->representation().IsInteger32() && | 1694 ASSERT((instr->representation().IsInteger32() && |
1694 !IsDoubleOrFloatElementsKind(instr->elements_kind())) || | 1695 !IsDoubleOrFloatElementsKind(instr->elements_kind())) || |
1695 (instr->representation().IsDouble() && | 1696 (instr->representation().IsDouble() && |
1696 IsDoubleOrFloatElementsKind(instr->elements_kind()))); | 1697 IsDoubleOrFloatElementsKind(instr->elements_kind()))); |
1697 | 1698 |
| 1699 LOperand* key = UseRegisterOrConstant(instr->key()); |
1698 LOperand* temp = instr->key()->IsConstant() ? NULL : TempRegister(); | 1700 LOperand* temp = instr->key()->IsConstant() ? NULL : TempRegister(); |
1699 LInstruction* result = DefineAsRegister( | 1701 LInstruction* result = DefineAsRegister( |
1700 new(zone()) LLoadKeyedExternal(elements, key, temp)); | 1702 new(zone()) LLoadKeyedExternal(elements, key, temp)); |
1701 if ((elements_kind == EXTERNAL_UINT32_ELEMENTS || | 1703 if ((elements_kind == EXTERNAL_UINT32_ELEMENTS || |
1702 elements_kind == UINT32_ELEMENTS) && | 1704 elements_kind == UINT32_ELEMENTS) && |
1703 !instr->CheckFlag(HInstruction::kUint32)) { | 1705 !instr->CheckFlag(HInstruction::kUint32)) { |
1704 result = AssignEnvironment(result); | 1706 result = AssignEnvironment(result); |
1705 } | 1707 } |
1706 return result; | 1708 return result; |
1707 } | 1709 } |
(...skipping 472 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
2180 } else { | 2182 } else { |
2181 return new(zone()) LStoreGlobalCell(value, TempRegister(), NULL); | 2183 return new(zone()) LStoreGlobalCell(value, TempRegister(), NULL); |
2182 } | 2184 } |
2183 } | 2185 } |
2184 | 2186 |
2185 | 2187 |
2186 LInstruction* LChunkBuilder::DoStoreKeyed(HStoreKeyed* instr) { | 2188 LInstruction* LChunkBuilder::DoStoreKeyed(HStoreKeyed* instr) { |
2187 LOperand* temp = NULL; | 2189 LOperand* temp = NULL; |
2188 LOperand* elements = NULL; | 2190 LOperand* elements = NULL; |
2189 LOperand* val = NULL; | 2191 LOperand* val = NULL; |
2190 LOperand* key = UseRegisterOrConstantAtStart(instr->key()); | |
2191 | 2192 |
2192 if (!instr->is_typed_elements() && | 2193 if (!instr->is_typed_elements() && |
2193 instr->value()->representation().IsTagged() && | 2194 instr->value()->representation().IsTagged() && |
2194 instr->NeedsWriteBarrier()) { | 2195 instr->NeedsWriteBarrier()) { |
2195 // RecordWrite() will clobber all registers. | 2196 // RecordWrite() will clobber all registers. |
2196 elements = UseRegisterAndClobber(instr->elements()); | 2197 elements = UseRegisterAndClobber(instr->elements()); |
2197 val = UseRegisterAndClobber(instr->value()); | 2198 val = UseRegisterAndClobber(instr->value()); |
2198 temp = TempRegister(); | 2199 temp = TempRegister(); |
2199 } else { | 2200 } else { |
2200 elements = UseRegister(instr->elements()); | 2201 elements = UseRegister(instr->elements()); |
2201 val = UseRegister(instr->value()); | 2202 val = UseRegister(instr->value()); |
2202 temp = instr->key()->IsConstant() ? NULL : TempRegister(); | 2203 temp = instr->key()->IsConstant() ? NULL : TempRegister(); |
2203 } | 2204 } |
2204 | 2205 |
2205 if (instr->is_typed_elements()) { | 2206 if (instr->is_typed_elements()) { |
2206 ASSERT((instr->value()->representation().IsInteger32() && | 2207 ASSERT((instr->value()->representation().IsInteger32() && |
2207 !IsDoubleOrFloatElementsKind(instr->elements_kind())) || | 2208 !IsDoubleOrFloatElementsKind(instr->elements_kind())) || |
2208 (instr->value()->representation().IsDouble() && | 2209 (instr->value()->representation().IsDouble() && |
2209 IsDoubleOrFloatElementsKind(instr->elements_kind()))); | 2210 IsDoubleOrFloatElementsKind(instr->elements_kind()))); |
2210 ASSERT((instr->is_fixed_typed_array() && | 2211 ASSERT((instr->is_fixed_typed_array() && |
2211 instr->elements()->representation().IsTagged()) || | 2212 instr->elements()->representation().IsTagged()) || |
2212 (instr->is_external() && | 2213 (instr->is_external() && |
2213 instr->elements()->representation().IsExternal())); | 2214 instr->elements()->representation().IsExternal())); |
| 2215 LOperand* key = UseRegisterOrConstant(instr->key()); |
2214 return new(zone()) LStoreKeyedExternal(elements, key, val, temp); | 2216 return new(zone()) LStoreKeyedExternal(elements, key, val, temp); |
2215 | 2217 |
2216 } else if (instr->value()->representation().IsDouble()) { | 2218 } else if (instr->value()->representation().IsDouble()) { |
2217 ASSERT(instr->elements()->representation().IsTagged()); | 2219 ASSERT(instr->elements()->representation().IsTagged()); |
| 2220 LOperand* key = UseRegisterOrConstantAtStart(instr->key()); |
2218 return new(zone()) LStoreKeyedFixedDouble(elements, key, val, temp); | 2221 return new(zone()) LStoreKeyedFixedDouble(elements, key, val, temp); |
2219 | 2222 |
2220 } else { | 2223 } else { |
2221 ASSERT(instr->elements()->representation().IsTagged()); | 2224 ASSERT(instr->elements()->representation().IsTagged()); |
2222 ASSERT(instr->value()->representation().IsSmiOrTagged() || | 2225 ASSERT(instr->value()->representation().IsSmiOrTagged() || |
2223 instr->value()->representation().IsInteger32()); | 2226 instr->value()->representation().IsInteger32()); |
| 2227 LOperand* key = UseRegisterOrConstantAtStart(instr->key()); |
2224 return new(zone()) LStoreKeyedFixed(elements, key, val, temp); | 2228 return new(zone()) LStoreKeyedFixed(elements, key, val, temp); |
2225 } | 2229 } |
2226 } | 2230 } |
2227 | 2231 |
2228 | 2232 |
2229 LInstruction* LChunkBuilder::DoStoreKeyedGeneric(HStoreKeyedGeneric* instr) { | 2233 LInstruction* LChunkBuilder::DoStoreKeyedGeneric(HStoreKeyedGeneric* instr) { |
2230 LOperand* context = UseFixed(instr->context(), cp); | 2234 LOperand* context = UseFixed(instr->context(), cp); |
2231 LOperand* object = UseFixed(instr->object(), x2); | 2235 LOperand* object = UseFixed(instr->object(), x2); |
2232 LOperand* key = UseFixed(instr->key(), x1); | 2236 LOperand* key = UseFixed(instr->key(), x1); |
2233 LOperand* value = UseFixed(instr->value(), x0); | 2237 LOperand* value = UseFixed(instr->value(), x0); |
(...skipping 336 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
2570 | 2574 |
2571 LInstruction* LChunkBuilder::DoWrapReceiver(HWrapReceiver* instr) { | 2575 LInstruction* LChunkBuilder::DoWrapReceiver(HWrapReceiver* instr) { |
2572 LOperand* receiver = UseRegister(instr->receiver()); | 2576 LOperand* receiver = UseRegister(instr->receiver()); |
2573 LOperand* function = UseRegister(instr->function()); | 2577 LOperand* function = UseRegister(instr->function()); |
2574 LWrapReceiver* result = new(zone()) LWrapReceiver(receiver, function); | 2578 LWrapReceiver* result = new(zone()) LWrapReceiver(receiver, function); |
2575 return AssignEnvironment(DefineAsRegister(result)); | 2579 return AssignEnvironment(DefineAsRegister(result)); |
2576 } | 2580 } |
2577 | 2581 |
2578 | 2582 |
2579 } } // namespace v8::internal | 2583 } } // namespace v8::internal |
OLD | NEW |