| OLD | NEW |
| 1 // Copyright 2011 the V8 project authors. All rights reserved. | 1 // Copyright 2011 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 221 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 232 } | 232 } |
| 233 | 233 |
| 234 | 234 |
| 235 void LIsSmiAndBranch::PrintDataTo(StringStream* stream) { | 235 void LIsSmiAndBranch::PrintDataTo(StringStream* stream) { |
| 236 stream->Add("if is_smi("); | 236 stream->Add("if is_smi("); |
| 237 InputAt(0)->PrintTo(stream); | 237 InputAt(0)->PrintTo(stream); |
| 238 stream->Add(") then B%d else B%d", true_block_id(), false_block_id()); | 238 stream->Add(") then B%d else B%d", true_block_id(), false_block_id()); |
| 239 } | 239 } |
| 240 | 240 |
| 241 | 241 |
| 242 void LIsUndetectableAndBranch::PrintDataTo(StringStream* stream) { |
| 243 stream->Add("if is_undetectable("); |
| 244 InputAt(0)->PrintTo(stream); |
| 245 stream->Add(") then B%d else B%d", true_block_id(), false_block_id()); |
| 246 } |
| 247 |
| 248 |
| 242 void LHasInstanceTypeAndBranch::PrintDataTo(StringStream* stream) { | 249 void LHasInstanceTypeAndBranch::PrintDataTo(StringStream* stream) { |
| 243 stream->Add("if has_instance_type("); | 250 stream->Add("if has_instance_type("); |
| 244 InputAt(0)->PrintTo(stream); | 251 InputAt(0)->PrintTo(stream); |
| 245 stream->Add(") then B%d else B%d", true_block_id(), false_block_id()); | 252 stream->Add(") then B%d else B%d", true_block_id(), false_block_id()); |
| 246 } | 253 } |
| 247 | 254 |
| 248 | 255 |
| 249 void LHasCachedArrayIndexAndBranch::PrintDataTo(StringStream* stream) { | 256 void LHasCachedArrayIndexAndBranch::PrintDataTo(StringStream* stream) { |
| 250 stream->Add("if has_cached_array_index("); | 257 stream->Add("if has_cached_array_index("); |
| 251 InputAt(0)->PrintTo(stream); | 258 InputAt(0)->PrintTo(stream); |
| (...skipping 751 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 1003 ASSERT(ast_id != AstNode::kNoNumber); | 1010 ASSERT(ast_id != AstNode::kNoNumber); |
| 1004 int value_count = hydrogen_env->length(); | 1011 int value_count = hydrogen_env->length(); |
| 1005 LEnvironment* result = new LEnvironment(hydrogen_env->closure(), | 1012 LEnvironment* result = new LEnvironment(hydrogen_env->closure(), |
| 1006 ast_id, | 1013 ast_id, |
| 1007 hydrogen_env->parameter_count(), | 1014 hydrogen_env->parameter_count(), |
| 1008 argument_count_, | 1015 argument_count_, |
| 1009 value_count, | 1016 value_count, |
| 1010 outer); | 1017 outer); |
| 1011 int argument_index = 0; | 1018 int argument_index = 0; |
| 1012 for (int i = 0; i < value_count; ++i) { | 1019 for (int i = 0; i < value_count; ++i) { |
| 1020 if (hydrogen_env->is_special_index(i)) continue; |
| 1021 |
| 1013 HValue* value = hydrogen_env->values()->at(i); | 1022 HValue* value = hydrogen_env->values()->at(i); |
| 1014 LOperand* op = NULL; | 1023 LOperand* op = NULL; |
| 1015 if (value->IsArgumentsObject()) { | 1024 if (value->IsArgumentsObject()) { |
| 1016 op = NULL; | 1025 op = NULL; |
| 1017 } else if (value->IsPushArgument()) { | 1026 } else if (value->IsPushArgument()) { |
| 1018 op = new LArgument(argument_index++); | 1027 op = new LArgument(argument_index++); |
| 1019 } else { | 1028 } else { |
| 1020 op = UseAny(value); | 1029 op = UseAny(value); |
| 1021 } | 1030 } |
| 1022 result->AddValue(op, value->representation()); | 1031 result->AddValue(op, value->representation()); |
| (...skipping 48 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 1071 LOperand* right_operand = UseFixed(right, reversed ? edx : eax); | 1080 LOperand* right_operand = UseFixed(right, reversed ? edx : eax); |
| 1072 LCmpTAndBranch* result = new LCmpTAndBranch(left_operand, | 1081 LCmpTAndBranch* result = new LCmpTAndBranch(left_operand, |
| 1073 right_operand); | 1082 right_operand); |
| 1074 return MarkAsCall(result, instr); | 1083 return MarkAsCall(result, instr); |
| 1075 } | 1084 } |
| 1076 } else if (v->IsIsSmi()) { | 1085 } else if (v->IsIsSmi()) { |
| 1077 HIsSmi* compare = HIsSmi::cast(v); | 1086 HIsSmi* compare = HIsSmi::cast(v); |
| 1078 ASSERT(compare->value()->representation().IsTagged()); | 1087 ASSERT(compare->value()->representation().IsTagged()); |
| 1079 | 1088 |
| 1080 return new LIsSmiAndBranch(Use(compare->value())); | 1089 return new LIsSmiAndBranch(Use(compare->value())); |
| 1090 } else if (v->IsIsUndetectable()) { |
| 1091 HIsUndetectable* compare = HIsUndetectable::cast(v); |
| 1092 ASSERT(compare->value()->representation().IsTagged()); |
| 1093 |
| 1094 return new LIsUndetectableAndBranch(UseRegisterAtStart(compare->value()), |
| 1095 TempRegister()); |
| 1081 } else if (v->IsHasInstanceType()) { | 1096 } else if (v->IsHasInstanceType()) { |
| 1082 HHasInstanceType* compare = HHasInstanceType::cast(v); | 1097 HHasInstanceType* compare = HHasInstanceType::cast(v); |
| 1083 ASSERT(compare->value()->representation().IsTagged()); | 1098 ASSERT(compare->value()->representation().IsTagged()); |
| 1084 | 1099 |
| 1085 return new LHasInstanceTypeAndBranch(UseRegisterAtStart(compare->value()), | 1100 return new LHasInstanceTypeAndBranch(UseRegisterAtStart(compare->value()), |
| 1086 TempRegister()); | 1101 TempRegister()); |
| 1087 } else if (v->IsHasCachedArrayIndex()) { | 1102 } else if (v->IsHasCachedArrayIndex()) { |
| 1088 HHasCachedArrayIndex* compare = HHasCachedArrayIndex::cast(v); | 1103 HHasCachedArrayIndex* compare = HHasCachedArrayIndex::cast(v); |
| 1089 ASSERT(compare->value()->representation().IsTagged()); | 1104 ASSERT(compare->value()->representation().IsTagged()); |
| 1090 | 1105 |
| (...skipping 13 matching lines...) Expand all Loading... |
| 1104 | 1119 |
| 1105 LOperand* temp1 = TempRegister(); | 1120 LOperand* temp1 = TempRegister(); |
| 1106 LOperand* temp2 = TempRegister(); | 1121 LOperand* temp2 = TempRegister(); |
| 1107 return new LIsObjectAndBranch(UseRegisterAtStart(compare->value()), | 1122 return new LIsObjectAndBranch(UseRegisterAtStart(compare->value()), |
| 1108 temp1, | 1123 temp1, |
| 1109 temp2); | 1124 temp2); |
| 1110 } else if (v->IsCompareJSObjectEq()) { | 1125 } else if (v->IsCompareJSObjectEq()) { |
| 1111 HCompareJSObjectEq* compare = HCompareJSObjectEq::cast(v); | 1126 HCompareJSObjectEq* compare = HCompareJSObjectEq::cast(v); |
| 1112 return new LCmpJSObjectEqAndBranch(UseRegisterAtStart(compare->left()), | 1127 return new LCmpJSObjectEqAndBranch(UseRegisterAtStart(compare->left()), |
| 1113 UseRegisterAtStart(compare->right())); | 1128 UseRegisterAtStart(compare->right())); |
| 1129 } else if (v->IsCompareSymbolEq()) { |
| 1130 HCompareSymbolEq* compare = HCompareSymbolEq::cast(v); |
| 1131 return new LCmpSymbolEqAndBranch(UseRegisterAtStart(compare->left()), |
| 1132 UseRegisterAtStart(compare->right())); |
| 1114 } else if (v->IsInstanceOf()) { | 1133 } else if (v->IsInstanceOf()) { |
| 1115 HInstanceOf* instance_of = HInstanceOf::cast(v); | 1134 HInstanceOf* instance_of = HInstanceOf::cast(v); |
| 1116 LOperand* left = UseFixed(instance_of->left(), InstanceofStub::left()); | 1135 LOperand* left = UseFixed(instance_of->left(), InstanceofStub::left()); |
| 1117 LOperand* right = UseFixed(instance_of->right(), InstanceofStub::right()); | 1136 LOperand* right = UseFixed(instance_of->right(), InstanceofStub::right()); |
| 1118 LOperand* context = UseFixed(instance_of->context(), esi); | 1137 LOperand* context = UseFixed(instance_of->context(), esi); |
| 1119 LInstanceOfAndBranch* result = | 1138 LInstanceOfAndBranch* result = |
| 1120 new LInstanceOfAndBranch(context, left, right); | 1139 new LInstanceOfAndBranch(context, left, right); |
| 1121 return MarkAsCall(result, instr); | 1140 return MarkAsCall(result, instr); |
| 1122 } else if (v->IsTypeofIs()) { | 1141 } else if (v->IsTypeofIs()) { |
| 1123 HTypeofIs* typeof_is = HTypeofIs::cast(v); | 1142 HTypeofIs* typeof_is = HTypeofIs::cast(v); |
| (...skipping 68 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 1192 | 1211 |
| 1193 | 1212 |
| 1194 LInstruction* LChunkBuilder::DoPushArgument(HPushArgument* instr) { | 1213 LInstruction* LChunkBuilder::DoPushArgument(HPushArgument* instr) { |
| 1195 ++argument_count_; | 1214 ++argument_count_; |
| 1196 LOperand* argument = UseAny(instr->argument()); | 1215 LOperand* argument = UseAny(instr->argument()); |
| 1197 return new LPushArgument(argument); | 1216 return new LPushArgument(argument); |
| 1198 } | 1217 } |
| 1199 | 1218 |
| 1200 | 1219 |
| 1201 LInstruction* LChunkBuilder::DoContext(HContext* instr) { | 1220 LInstruction* LChunkBuilder::DoContext(HContext* instr) { |
| 1202 return DefineAsRegister(new LContext); | 1221 return instr->HasNoUses() ? NULL : DefineAsRegister(new LContext); |
| 1203 } | 1222 } |
| 1204 | 1223 |
| 1205 | 1224 |
| 1206 LInstruction* LChunkBuilder::DoOuterContext(HOuterContext* instr) { | 1225 LInstruction* LChunkBuilder::DoOuterContext(HOuterContext* instr) { |
| 1207 LOperand* context = UseRegisterAtStart(instr->value()); | 1226 LOperand* context = UseRegisterAtStart(instr->value()); |
| 1208 return DefineAsRegister(new LOuterContext(context)); | 1227 return DefineAsRegister(new LOuterContext(context)); |
| 1209 } | 1228 } |
| 1210 | 1229 |
| 1211 | 1230 |
| 1212 LInstruction* LChunkBuilder::DoGlobalObject(HGlobalObject* instr) { | 1231 LInstruction* LChunkBuilder::DoGlobalObject(HGlobalObject* instr) { |
| (...skipping 318 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 1531 | 1550 |
| 1532 LInstruction* LChunkBuilder::DoCompareJSObjectEq( | 1551 LInstruction* LChunkBuilder::DoCompareJSObjectEq( |
| 1533 HCompareJSObjectEq* instr) { | 1552 HCompareJSObjectEq* instr) { |
| 1534 LOperand* left = UseRegisterAtStart(instr->left()); | 1553 LOperand* left = UseRegisterAtStart(instr->left()); |
| 1535 LOperand* right = UseRegisterAtStart(instr->right()); | 1554 LOperand* right = UseRegisterAtStart(instr->right()); |
| 1536 LCmpJSObjectEq* result = new LCmpJSObjectEq(left, right); | 1555 LCmpJSObjectEq* result = new LCmpJSObjectEq(left, right); |
| 1537 return DefineAsRegister(result); | 1556 return DefineAsRegister(result); |
| 1538 } | 1557 } |
| 1539 | 1558 |
| 1540 | 1559 |
| 1560 LInstruction* LChunkBuilder::DoCompareSymbolEq( |
| 1561 HCompareSymbolEq* instr) { |
| 1562 LOperand* left = UseRegisterAtStart(instr->left()); |
| 1563 LOperand* right = UseRegisterAtStart(instr->right()); |
| 1564 LCmpSymbolEq* result = new LCmpSymbolEq(left, right); |
| 1565 return DefineAsRegister(result); |
| 1566 } |
| 1567 |
| 1568 |
| 1541 LInstruction* LChunkBuilder::DoIsNull(HIsNull* instr) { | 1569 LInstruction* LChunkBuilder::DoIsNull(HIsNull* instr) { |
| 1542 ASSERT(instr->value()->representation().IsTagged()); | 1570 ASSERT(instr->value()->representation().IsTagged()); |
| 1543 LOperand* value = UseRegisterAtStart(instr->value()); | 1571 LOperand* value = UseRegisterAtStart(instr->value()); |
| 1544 | 1572 |
| 1545 return DefineAsRegister(new LIsNull(value)); | 1573 return DefineAsRegister(new LIsNull(value)); |
| 1546 } | 1574 } |
| 1547 | 1575 |
| 1548 | 1576 |
| 1549 LInstruction* LChunkBuilder::DoIsObject(HIsObject* instr) { | 1577 LInstruction* LChunkBuilder::DoIsObject(HIsObject* instr) { |
| 1550 ASSERT(instr->value()->representation().IsTagged()); | 1578 ASSERT(instr->value()->representation().IsTagged()); |
| 1551 LOperand* value = UseRegister(instr->value()); | 1579 LOperand* value = UseRegister(instr->value()); |
| 1552 | 1580 |
| 1553 return DefineAsRegister(new LIsObject(value, TempRegister())); | 1581 return DefineAsRegister(new LIsObject(value, TempRegister())); |
| 1554 } | 1582 } |
| 1555 | 1583 |
| 1556 | 1584 |
| 1557 LInstruction* LChunkBuilder::DoIsSmi(HIsSmi* instr) { | 1585 LInstruction* LChunkBuilder::DoIsSmi(HIsSmi* instr) { |
| 1558 ASSERT(instr->value()->representation().IsTagged()); | 1586 ASSERT(instr->value()->representation().IsTagged()); |
| 1559 LOperand* value = UseAtStart(instr->value()); | 1587 LOperand* value = UseAtStart(instr->value()); |
| 1560 | 1588 |
| 1561 return DefineAsRegister(new LIsSmi(value)); | 1589 return DefineAsRegister(new LIsSmi(value)); |
| 1562 } | 1590 } |
| 1563 | 1591 |
| 1564 | 1592 |
| 1593 LInstruction* LChunkBuilder::DoIsUndetectable(HIsUndetectable* instr) { |
| 1594 ASSERT(instr->value()->representation().IsTagged()); |
| 1595 LOperand* value = UseRegisterAtStart(instr->value()); |
| 1596 |
| 1597 return DefineAsRegister(new LIsUndetectable(value)); |
| 1598 } |
| 1599 |
| 1600 |
| 1565 LInstruction* LChunkBuilder::DoHasInstanceType(HHasInstanceType* instr) { | 1601 LInstruction* LChunkBuilder::DoHasInstanceType(HHasInstanceType* instr) { |
| 1566 ASSERT(instr->value()->representation().IsTagged()); | 1602 ASSERT(instr->value()->representation().IsTagged()); |
| 1567 LOperand* value = UseRegisterAtStart(instr->value()); | 1603 LOperand* value = UseRegisterAtStart(instr->value()); |
| 1568 | 1604 |
| 1569 return DefineAsRegister(new LHasInstanceType(value)); | 1605 return DefineAsRegister(new LHasInstanceType(value)); |
| 1570 } | 1606 } |
| 1571 | 1607 |
| 1572 | 1608 |
| 1573 LInstruction* LChunkBuilder::DoGetCachedArrayIndex( | 1609 LInstruction* LChunkBuilder::DoGetCachedArrayIndex( |
| 1574 HGetCachedArrayIndex* instr) { | 1610 HGetCachedArrayIndex* instr) { |
| (...skipping 59 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 1634 return NULL; | 1670 return NULL; |
| 1635 } | 1671 } |
| 1636 | 1672 |
| 1637 | 1673 |
| 1638 LInstruction* LChunkBuilder::DoThrow(HThrow* instr) { | 1674 LInstruction* LChunkBuilder::DoThrow(HThrow* instr) { |
| 1639 LOperand* value = UseFixed(instr->value(), eax); | 1675 LOperand* value = UseFixed(instr->value(), eax); |
| 1640 return MarkAsCall(new LThrow(value), instr); | 1676 return MarkAsCall(new LThrow(value), instr); |
| 1641 } | 1677 } |
| 1642 | 1678 |
| 1643 | 1679 |
| 1680 LInstruction* LChunkBuilder::DoForceRepresentation(HForceRepresentation* bad) { |
| 1681 // All HForceRepresentation instructions should be eliminated in the |
| 1682 // representation change phase of Hydrogen. |
| 1683 UNREACHABLE(); |
| 1684 return NULL; |
| 1685 } |
| 1686 |
| 1687 |
| 1644 LInstruction* LChunkBuilder::DoChange(HChange* instr) { | 1688 LInstruction* LChunkBuilder::DoChange(HChange* instr) { |
| 1645 Representation from = instr->from(); | 1689 Representation from = instr->from(); |
| 1646 Representation to = instr->to(); | 1690 Representation to = instr->to(); |
| 1647 if (from.IsTagged()) { | 1691 if (from.IsTagged()) { |
| 1648 if (to.IsDouble()) { | 1692 if (to.IsDouble()) { |
| 1649 LOperand* value = UseRegister(instr->value()); | 1693 LOperand* value = UseRegister(instr->value()); |
| 1650 LNumberUntagD* res = new LNumberUntagD(value); | 1694 LNumberUntagD* res = new LNumberUntagD(value); |
| 1651 return AssignEnvironment(DefineAsRegister(res)); | 1695 return AssignEnvironment(DefineAsRegister(res)); |
| 1652 } else { | 1696 } else { |
| 1653 ASSERT(to.IsInteger32()); | 1697 ASSERT(to.IsInteger32()); |
| (...skipping 81 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 1735 } | 1779 } |
| 1736 | 1780 |
| 1737 | 1781 |
| 1738 LInstruction* LChunkBuilder::DoCheckMap(HCheckMap* instr) { | 1782 LInstruction* LChunkBuilder::DoCheckMap(HCheckMap* instr) { |
| 1739 LOperand* value = UseRegisterAtStart(instr->value()); | 1783 LOperand* value = UseRegisterAtStart(instr->value()); |
| 1740 LCheckMap* result = new LCheckMap(value); | 1784 LCheckMap* result = new LCheckMap(value); |
| 1741 return AssignEnvironment(result); | 1785 return AssignEnvironment(result); |
| 1742 } | 1786 } |
| 1743 | 1787 |
| 1744 | 1788 |
| 1789 LInstruction* LChunkBuilder::DoClampToUint8(HClampToUint8* instr) { |
| 1790 HValue* value = instr->value(); |
| 1791 Representation input_rep = value->representation(); |
| 1792 if (input_rep.IsDouble()) { |
| 1793 LOperand* reg = UseRegister(value); |
| 1794 return DefineAsRegister(new LClampDToUint8(reg)); |
| 1795 } else if (input_rep.IsInteger32()) { |
| 1796 LOperand* reg = UseFixed(value, eax); |
| 1797 return DefineFixed(new LClampIToUint8(reg), eax); |
| 1798 } else { |
| 1799 ASSERT(input_rep.IsTagged()); |
| 1800 LOperand* reg = UseFixed(value, eax); |
| 1801 // Register allocator doesn't (yet) support allocation of double |
| 1802 // temps. Reserve xmm1 explicitly. |
| 1803 LOperand* temp = FixedTemp(xmm1); |
| 1804 LClampTToUint8* result = new LClampTToUint8(reg, temp); |
| 1805 return AssignEnvironment(DefineFixed(result, eax)); |
| 1806 } |
| 1807 } |
| 1808 |
| 1809 |
| 1745 LInstruction* LChunkBuilder::DoReturn(HReturn* instr) { | 1810 LInstruction* LChunkBuilder::DoReturn(HReturn* instr) { |
| 1746 return new LReturn(UseFixed(instr->value(), eax)); | 1811 return new LReturn(UseFixed(instr->value(), eax)); |
| 1747 } | 1812 } |
| 1748 | 1813 |
| 1749 | 1814 |
| 1750 LInstruction* LChunkBuilder::DoConstant(HConstant* instr) { | 1815 LInstruction* LChunkBuilder::DoConstant(HConstant* instr) { |
| 1751 Representation r = instr->representation(); | 1816 Representation r = instr->representation(); |
| 1752 if (r.IsInteger32()) { | 1817 if (r.IsInteger32()) { |
| 1753 return DefineAsRegister(new LConstantI); | 1818 return DefineAsRegister(new LConstantI); |
| 1754 } else if (r.IsDouble()) { | 1819 } else if (r.IsDouble()) { |
| (...skipping 133 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 1888 HLoadKeyedSpecializedArrayElement* instr) { | 1953 HLoadKeyedSpecializedArrayElement* instr) { |
| 1889 ExternalArrayType array_type = instr->array_type(); | 1954 ExternalArrayType array_type = instr->array_type(); |
| 1890 Representation representation(instr->representation()); | 1955 Representation representation(instr->representation()); |
| 1891 ASSERT( | 1956 ASSERT( |
| 1892 (representation.IsInteger32() && (array_type != kExternalFloatArray && | 1957 (representation.IsInteger32() && (array_type != kExternalFloatArray && |
| 1893 array_type != kExternalDoubleArray)) || | 1958 array_type != kExternalDoubleArray)) || |
| 1894 (representation.IsDouble() && (array_type == kExternalFloatArray || | 1959 (representation.IsDouble() && (array_type == kExternalFloatArray || |
| 1895 array_type == kExternalDoubleArray))); | 1960 array_type == kExternalDoubleArray))); |
| 1896 ASSERT(instr->key()->representation().IsInteger32()); | 1961 ASSERT(instr->key()->representation().IsInteger32()); |
| 1897 LOperand* external_pointer = UseRegister(instr->external_pointer()); | 1962 LOperand* external_pointer = UseRegister(instr->external_pointer()); |
| 1898 LOperand* key = UseRegister(instr->key()); | 1963 LOperand* key = UseRegisterOrConstant(instr->key()); |
| 1899 LLoadKeyedSpecializedArrayElement* result = | 1964 LLoadKeyedSpecializedArrayElement* result = |
| 1900 new LLoadKeyedSpecializedArrayElement(external_pointer, | 1965 new LLoadKeyedSpecializedArrayElement(external_pointer, |
| 1901 key); | 1966 key); |
| 1902 LInstruction* load_instr = DefineAsRegister(result); | 1967 LInstruction* load_instr = DefineAsRegister(result); |
| 1903 // An unsigned int array load might overflow and cause a deopt, make sure it | 1968 // An unsigned int array load might overflow and cause a deopt, make sure it |
| 1904 // has an environment. | 1969 // has an environment. |
| 1905 return (array_type == kExternalUnsignedIntArray) | 1970 return (array_type == kExternalUnsignedIntArray) |
| 1906 ? AssignEnvironment(load_instr) | 1971 ? AssignEnvironment(load_instr) |
| 1907 : load_instr; | 1972 : load_instr; |
| 1908 } | 1973 } |
| (...skipping 34 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 1943 ExternalArrayType array_type = instr->array_type(); | 2008 ExternalArrayType array_type = instr->array_type(); |
| 1944 ASSERT( | 2009 ASSERT( |
| 1945 (representation.IsInteger32() && (array_type != kExternalFloatArray && | 2010 (representation.IsInteger32() && (array_type != kExternalFloatArray && |
| 1946 array_type != kExternalDoubleArray)) || | 2011 array_type != kExternalDoubleArray)) || |
| 1947 (representation.IsDouble() && (array_type == kExternalFloatArray || | 2012 (representation.IsDouble() && (array_type == kExternalFloatArray || |
| 1948 array_type == kExternalDoubleArray))); | 2013 array_type == kExternalDoubleArray))); |
| 1949 ASSERT(instr->external_pointer()->representation().IsExternal()); | 2014 ASSERT(instr->external_pointer()->representation().IsExternal()); |
| 1950 ASSERT(instr->key()->representation().IsInteger32()); | 2015 ASSERT(instr->key()->representation().IsInteger32()); |
| 1951 | 2016 |
| 1952 LOperand* external_pointer = UseRegister(instr->external_pointer()); | 2017 LOperand* external_pointer = UseRegister(instr->external_pointer()); |
| 1953 LOperand* key = UseRegister(instr->key()); | 2018 LOperand* key = UseRegisterOrConstant(instr->key()); |
| 1954 LOperand* temp = NULL; | |
| 1955 | |
| 1956 if (array_type == kExternalPixelArray) { | |
| 1957 // The generated code for pixel array stores requires that the clamped value | |
| 1958 // is in a byte register. eax is an arbitrary choice to satisfy this | |
| 1959 // requirement. | |
| 1960 temp = FixedTemp(eax); | |
| 1961 } | |
| 1962 | |
| 1963 LOperand* val = NULL; | 2019 LOperand* val = NULL; |
| 1964 if (array_type == kExternalByteArray || | 2020 if (array_type == kExternalByteArray || |
| 1965 array_type == kExternalUnsignedByteArray) { | 2021 array_type == kExternalUnsignedByteArray) { |
| 1966 // We need a byte register in this case for the value. | 2022 // We need a byte register in this case for the value. |
| 1967 val = UseFixed(instr->value(), eax); | 2023 val = UseFixed(instr->value(), eax); |
| 1968 } else { | 2024 } else { |
| 1969 val = UseRegister(instr->value()); | 2025 val = UseRegister(instr->value()); |
| 1970 } | 2026 } |
| 1971 | 2027 |
| 1972 return new LStoreKeyedSpecializedArrayElement(external_pointer, | 2028 return new LStoreKeyedSpecializedArrayElement(external_pointer, |
| 1973 key, | 2029 key, |
| 1974 val, | 2030 val); |
| 1975 temp); | |
| 1976 } | 2031 } |
| 1977 | 2032 |
| 1978 | 2033 |
| 1979 LInstruction* LChunkBuilder::DoStoreKeyedGeneric(HStoreKeyedGeneric* instr) { | 2034 LInstruction* LChunkBuilder::DoStoreKeyedGeneric(HStoreKeyedGeneric* instr) { |
| 1980 LOperand* context = UseFixed(instr->context(), esi); | 2035 LOperand* context = UseFixed(instr->context(), esi); |
| 1981 LOperand* object = UseFixed(instr->object(), edx); | 2036 LOperand* object = UseFixed(instr->object(), edx); |
| 1982 LOperand* key = UseFixed(instr->key(), ecx); | 2037 LOperand* key = UseFixed(instr->key(), ecx); |
| 1983 LOperand* value = UseFixed(instr->value(), eax); | 2038 LOperand* value = UseFixed(instr->value(), eax); |
| 1984 | 2039 |
| 1985 ASSERT(instr->object()->representation().IsTagged()); | 2040 ASSERT(instr->object()->representation().IsTagged()); |
| (...skipping 228 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 2214 LOperand* key = UseOrConstantAtStart(instr->key()); | 2269 LOperand* key = UseOrConstantAtStart(instr->key()); |
| 2215 LOperand* object = UseOrConstantAtStart(instr->object()); | 2270 LOperand* object = UseOrConstantAtStart(instr->object()); |
| 2216 LIn* result = new LIn(key, object); | 2271 LIn* result = new LIn(key, object); |
| 2217 return MarkAsCall(DefineFixed(result, eax), instr); | 2272 return MarkAsCall(DefineFixed(result, eax), instr); |
| 2218 } | 2273 } |
| 2219 | 2274 |
| 2220 | 2275 |
| 2221 } } // namespace v8::internal | 2276 } } // namespace v8::internal |
| 2222 | 2277 |
| 2223 #endif // V8_TARGET_ARCH_IA32 | 2278 #endif // V8_TARGET_ARCH_IA32 |
| OLD | NEW |