| 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 1607 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 1618 return MarkAsCall(DefineFixed(result, x0), instr); | 1618 return MarkAsCall(DefineFixed(result, x0), instr); |
| 1619 } | 1619 } |
| 1620 | 1620 |
| 1621 | 1621 |
| 1622 LInstruction* LChunkBuilder::DoLoadKeyed(HLoadKeyed* instr) { | 1622 LInstruction* LChunkBuilder::DoLoadKeyed(HLoadKeyed* instr) { |
| 1623 ASSERT(instr->key()->representation().IsSmiOrInteger32()); | 1623 ASSERT(instr->key()->representation().IsSmiOrInteger32()); |
| 1624 ElementsKind elements_kind = instr->elements_kind(); | 1624 ElementsKind elements_kind = instr->elements_kind(); |
| 1625 LOperand* elements = UseRegister(instr->elements()); | 1625 LOperand* elements = UseRegister(instr->elements()); |
| 1626 LOperand* key = UseRegisterOrConstantAtStart(instr->key()); | 1626 LOperand* key = UseRegisterOrConstantAtStart(instr->key()); |
| 1627 | 1627 |
| 1628 if (!instr->is_external()) { | 1628 if (!instr->is_typed_elements()) { |
| 1629 if (instr->representation().IsDouble()) { | 1629 if (instr->representation().IsDouble()) { |
| 1630 LOperand* temp = (!instr->key()->IsConstant() || | 1630 LOperand* temp = (!instr->key()->IsConstant() || |
| 1631 instr->RequiresHoleCheck()) | 1631 instr->RequiresHoleCheck()) |
| 1632 ? TempRegister() | 1632 ? TempRegister() |
| 1633 : NULL; | 1633 : NULL; |
| 1634 | 1634 |
| 1635 LLoadKeyedFixedDouble* result = | 1635 LLoadKeyedFixedDouble* result = |
| 1636 new(zone()) LLoadKeyedFixedDouble(elements, key, temp); | 1636 new(zone()) LLoadKeyedFixedDouble(elements, key, temp); |
| 1637 return instr->RequiresHoleCheck() | 1637 return instr->RequiresHoleCheck() |
| 1638 ? AssignEnvironment(DefineAsRegister(result)) | 1638 ? AssignEnvironment(DefineAsRegister(result)) |
| 1639 : DefineAsRegister(result); | 1639 : DefineAsRegister(result); |
| 1640 } else { | 1640 } else { |
| 1641 ASSERT(instr->representation().IsSmiOrTagged() || | 1641 ASSERT(instr->representation().IsSmiOrTagged() || |
| 1642 instr->representation().IsInteger32()); | 1642 instr->representation().IsInteger32()); |
| 1643 LOperand* temp = instr->key()->IsConstant() ? NULL : TempRegister(); | 1643 LOperand* temp = instr->key()->IsConstant() ? NULL : TempRegister(); |
| 1644 LLoadKeyedFixed* result = | 1644 LLoadKeyedFixed* result = |
| 1645 new(zone()) LLoadKeyedFixed(elements, key, temp); | 1645 new(zone()) LLoadKeyedFixed(elements, key, temp); |
| 1646 return instr->RequiresHoleCheck() | 1646 return instr->RequiresHoleCheck() |
| 1647 ? AssignEnvironment(DefineAsRegister(result)) | 1647 ? AssignEnvironment(DefineAsRegister(result)) |
| 1648 : DefineAsRegister(result); | 1648 : DefineAsRegister(result); |
| 1649 } | 1649 } |
| 1650 } else { | 1650 } else { |
| 1651 ASSERT((instr->representation().IsInteger32() && | 1651 ASSERT((instr->representation().IsInteger32() && |
| 1652 (elements_kind != EXTERNAL_FLOAT_ELEMENTS) && | 1652 !IsDoubleOrFloatElementsKind(instr->elements_kind())) || |
| 1653 (elements_kind != EXTERNAL_DOUBLE_ELEMENTS)) || | |
| 1654 (instr->representation().IsDouble() && | 1653 (instr->representation().IsDouble() && |
| 1655 ((elements_kind == EXTERNAL_FLOAT_ELEMENTS) || | 1654 IsDoubleOrFloatElementsKind(instr->elements_kind()))); |
| 1656 (elements_kind == EXTERNAL_DOUBLE_ELEMENTS)))); | |
| 1657 | 1655 |
| 1658 LOperand* temp = instr->key()->IsConstant() ? NULL : TempRegister(); | 1656 LOperand* temp = instr->key()->IsConstant() ? NULL : TempRegister(); |
| 1659 LLoadKeyedExternal* result = | 1657 LLoadKeyedExternal* result = |
| 1660 new(zone()) LLoadKeyedExternal(elements, key, temp); | 1658 new(zone()) LLoadKeyedExternal(elements, key, temp); |
| 1661 // An unsigned int array load might overflow and cause a deopt. Make sure it | 1659 // An unsigned int array load might overflow and cause a deopt. Make sure it |
| 1662 // has an environment. | 1660 // has an environment. |
| 1663 return (elements_kind == EXTERNAL_UNSIGNED_INT_ELEMENTS) | 1661 if (instr->RequiresHoleCheck() || |
| 1664 ? AssignEnvironment(DefineAsRegister(result)) | 1662 elements_kind == EXTERNAL_UNSIGNED_INT_ELEMENTS || |
| 1665 : DefineAsRegister(result); | 1663 elements_kind == UINT32_ELEMENTS) { |
| 1664 return AssignEnvironment(DefineAsRegister(result)); |
| 1665 } else { |
| 1666 return DefineAsRegister(result); |
| 1667 } |
| 1666 } | 1668 } |
| 1667 } | 1669 } |
| 1668 | 1670 |
| 1669 | 1671 |
| 1670 LInstruction* LChunkBuilder::DoLoadKeyedGeneric(HLoadKeyedGeneric* instr) { | 1672 LInstruction* LChunkBuilder::DoLoadKeyedGeneric(HLoadKeyedGeneric* instr) { |
| 1671 LOperand* object = UseFixed(instr->object(), x1); | 1673 LOperand* object = UseFixed(instr->object(), x1); |
| 1672 LOperand* key = UseFixed(instr->key(), x0); | 1674 LOperand* key = UseFixed(instr->key(), x0); |
| 1673 | 1675 |
| 1674 LInstruction* result = | 1676 LInstruction* result = |
| 1675 DefineFixed(new(zone()) LLoadKeyedGeneric(object, key), x0); | 1677 DefineFixed(new(zone()) LLoadKeyedGeneric(object, key), x0); |
| (...skipping 393 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 2069 if (instr->RequiresHoleCheck()) { | 2071 if (instr->RequiresHoleCheck()) { |
| 2070 return AssignEnvironment(new(zone()) LStoreGlobalCell(value, | 2072 return AssignEnvironment(new(zone()) LStoreGlobalCell(value, |
| 2071 TempRegister(), | 2073 TempRegister(), |
| 2072 TempRegister())); | 2074 TempRegister())); |
| 2073 } else { | 2075 } else { |
| 2074 return new(zone()) LStoreGlobalCell(value, TempRegister(), NULL); | 2076 return new(zone()) LStoreGlobalCell(value, TempRegister(), NULL); |
| 2075 } | 2077 } |
| 2076 } | 2078 } |
| 2077 | 2079 |
| 2078 | 2080 |
| 2079 LInstruction* LChunkBuilder::DoStoreGlobalGeneric(HStoreGlobalGeneric* instr) { | |
| 2080 LOperand* global_object = UseFixed(instr->global_object(), x1); | |
| 2081 LOperand* value = UseFixed(instr->value(), x0); | |
| 2082 LStoreGlobalGeneric* result = | |
| 2083 new(zone()) LStoreGlobalGeneric(global_object, value); | |
| 2084 return MarkAsCall(result, instr); | |
| 2085 } | |
| 2086 | |
| 2087 | |
| 2088 LInstruction* LChunkBuilder::DoStoreKeyed(HStoreKeyed* instr) { | 2081 LInstruction* LChunkBuilder::DoStoreKeyed(HStoreKeyed* instr) { |
| 2089 LOperand* temp = NULL; | 2082 LOperand* temp = NULL; |
| 2090 LOperand* elements = NULL; | 2083 LOperand* elements = NULL; |
| 2091 LOperand* val = NULL; | 2084 LOperand* val = NULL; |
| 2092 LOperand* key = NULL; | 2085 LOperand* key = NULL; |
| 2093 | 2086 |
| 2094 if (!instr->is_external() && instr->value()->representation().IsTagged() && | 2087 if (!instr->is_typed_elements() && |
| 2088 instr->value()->representation().IsTagged() && |
| 2095 instr->NeedsWriteBarrier()) { | 2089 instr->NeedsWriteBarrier()) { |
| 2096 // RecordWrite() will clobber all registers. | 2090 // RecordWrite() will clobber all registers. |
| 2097 elements = UseRegisterAndClobber(instr->elements()); | 2091 elements = UseRegisterAndClobber(instr->elements()); |
| 2098 val = UseRegisterAndClobber(instr->value()); | 2092 val = UseRegisterAndClobber(instr->value()); |
| 2099 key = UseRegisterAndClobber(instr->key()); | 2093 key = UseRegisterAndClobber(instr->key()); |
| 2100 } else { | 2094 } else { |
| 2101 elements = UseRegister(instr->elements()); | 2095 elements = UseRegister(instr->elements()); |
| 2102 val = UseRegister(instr->value()); | 2096 val = UseRegister(instr->value()); |
| 2103 key = UseRegisterOrConstantAtStart(instr->key()); | 2097 key = UseRegisterOrConstantAtStart(instr->key()); |
| 2104 } | 2098 } |
| 2105 | 2099 |
| 2106 if (instr->is_external()) { | 2100 if (instr->is_typed_elements()) { |
| 2107 ASSERT(instr->elements()->representation().IsExternal()); | 2101 ASSERT(instr->elements()->representation().IsExternal()); |
| 2108 ASSERT((instr->value()->representation().IsInteger32() && | 2102 ASSERT((instr->value()->representation().IsInteger32() && |
| 2109 (instr->elements_kind() != EXTERNAL_FLOAT_ELEMENTS) && | 2103 !IsDoubleOrFloatElementsKind(instr->elements_kind())) || |
| 2110 (instr->elements_kind() != EXTERNAL_DOUBLE_ELEMENTS)) || | |
| 2111 (instr->value()->representation().IsDouble() && | 2104 (instr->value()->representation().IsDouble() && |
| 2112 ((instr->elements_kind() == EXTERNAL_FLOAT_ELEMENTS) || | 2105 IsDoubleOrFloatElementsKind(instr->elements_kind()))); |
| 2113 (instr->elements_kind() == EXTERNAL_DOUBLE_ELEMENTS)))); | 2106 ASSERT((instr->is_fixed_typed_array() && |
| 2107 instr->elements()->representation().IsTagged()) || |
| 2108 (instr->is_external() && |
| 2109 instr->elements()->representation().IsExternal())); |
| 2114 temp = instr->key()->IsConstant() ? NULL : TempRegister(); | 2110 temp = instr->key()->IsConstant() ? NULL : TempRegister(); |
| 2115 return new(zone()) LStoreKeyedExternal(elements, key, val, temp); | 2111 return new(zone()) LStoreKeyedExternal(elements, key, val, temp); |
| 2112 |
| 2116 } else if (instr->value()->representation().IsDouble()) { | 2113 } else if (instr->value()->representation().IsDouble()) { |
| 2117 ASSERT(instr->elements()->representation().IsTagged()); | 2114 ASSERT(instr->elements()->representation().IsTagged()); |
| 2118 | 2115 |
| 2119 // The constraint used here is UseRegister, even though the StoreKeyed | 2116 // The constraint used here is UseRegister, even though the StoreKeyed |
| 2120 // instruction may canonicalize the value in the register if it is a NaN. | 2117 // instruction may canonicalize the value in the register if it is a NaN. |
| 2121 temp = TempRegister(); | 2118 temp = TempRegister(); |
| 2122 return new(zone()) LStoreKeyedFixedDouble(elements, key, val, temp); | 2119 return new(zone()) LStoreKeyedFixedDouble(elements, key, val, temp); |
| 2120 |
| 2123 } else { | 2121 } else { |
| 2124 ASSERT(instr->elements()->representation().IsTagged()); | 2122 ASSERT(instr->elements()->representation().IsTagged()); |
| 2125 ASSERT(instr->value()->representation().IsSmiOrTagged() || | 2123 ASSERT(instr->value()->representation().IsSmiOrTagged() || |
| 2126 instr->value()->representation().IsInteger32()); | 2124 instr->value()->representation().IsInteger32()); |
| 2127 | 2125 |
| 2128 temp = TempRegister(); | 2126 temp = TempRegister(); |
| 2129 return new(zone()) LStoreKeyedFixed(elements, key, val, temp); | 2127 return new(zone()) LStoreKeyedFixed(elements, key, val, temp); |
| 2130 } | 2128 } |
| 2131 } | 2129 } |
| 2132 | 2130 |
| (...skipping 37 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 2170 | 2168 |
| 2171 LInstruction* LChunkBuilder::DoStoreNamedGeneric(HStoreNamedGeneric* instr) { | 2169 LInstruction* LChunkBuilder::DoStoreNamedGeneric(HStoreNamedGeneric* instr) { |
| 2172 LOperand* object = UseFixed(instr->object(), x1); | 2170 LOperand* object = UseFixed(instr->object(), x1); |
| 2173 LOperand* value = UseFixed(instr->value(), x0); | 2171 LOperand* value = UseFixed(instr->value(), x0); |
| 2174 LInstruction* result = new(zone()) LStoreNamedGeneric(object, value); | 2172 LInstruction* result = new(zone()) LStoreNamedGeneric(object, value); |
| 2175 return MarkAsCall(result, instr); | 2173 return MarkAsCall(result, instr); |
| 2176 } | 2174 } |
| 2177 | 2175 |
| 2178 | 2176 |
| 2179 LInstruction* LChunkBuilder::DoStringAdd(HStringAdd* instr) { | 2177 LInstruction* LChunkBuilder::DoStringAdd(HStringAdd* instr) { |
| 2180 LOperand* left = FLAG_new_string_add ? UseFixed(instr->left(), x1) | 2178 LOperand* left = UseFixed(instr->left(), x1); |
| 2181 : UseRegisterAtStart(instr->left()); | 2179 LOperand* right = UseFixed(instr->right(), x0); |
| 2182 LOperand* right = FLAG_new_string_add ? UseFixed(instr->right(), x0) | |
| 2183 : UseRegisterAtStart(instr->right()); | |
| 2184 | 2180 |
| 2185 LStringAdd* result = new(zone()) LStringAdd(left, right); | 2181 LStringAdd* result = new(zone()) LStringAdd(left, right); |
| 2186 return MarkAsCall(DefineFixed(result, x0), instr); | 2182 return MarkAsCall(DefineFixed(result, x0), instr); |
| 2187 } | 2183 } |
| 2188 | 2184 |
| 2189 | 2185 |
| 2190 LInstruction* LChunkBuilder::DoStringCharCodeAt(HStringCharCodeAt* instr) { | 2186 LInstruction* LChunkBuilder::DoStringCharCodeAt(HStringCharCodeAt* instr) { |
| 2191 LOperand* string = UseRegisterAndClobber(instr->string()); | 2187 LOperand* string = UseRegisterAndClobber(instr->string()); |
| 2192 LOperand* index = UseRegisterAndClobber(instr->index()); | 2188 LOperand* index = UseRegisterAndClobber(instr->index()); |
| 2193 LStringCharCodeAt* result = new(zone()) LStringCharCodeAt(string, index); | 2189 LStringCharCodeAt* result = new(zone()) LStringCharCodeAt(string, index); |
| (...skipping 273 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 2467 | 2463 |
| 2468 LInstruction* LChunkBuilder::DoWrapReceiver(HWrapReceiver* instr) { | 2464 LInstruction* LChunkBuilder::DoWrapReceiver(HWrapReceiver* instr) { |
| 2469 LOperand* receiver = UseRegister(instr->receiver()); | 2465 LOperand* receiver = UseRegister(instr->receiver()); |
| 2470 LOperand* function = UseRegister(instr->function()); | 2466 LOperand* function = UseRegister(instr->function()); |
| 2471 LWrapReceiver* result = new(zone()) LWrapReceiver(receiver, function); | 2467 LWrapReceiver* result = new(zone()) LWrapReceiver(receiver, function); |
| 2472 return AssignEnvironment(DefineAsRegister(result)); | 2468 return AssignEnvironment(DefineAsRegister(result)); |
| 2473 } | 2469 } |
| 2474 | 2470 |
| 2475 | 2471 |
| 2476 } } // namespace v8::internal | 2472 } } // namespace v8::internal |
| OLD | NEW |