Chromium Code Reviews
chromiumcodereview-hr@appspot.gserviceaccount.com (chromiumcodereview-hr) | Please choose your nickname with Settings | Help | Chromium Project | Gerrit Changes | Sign out
(772)

Side by Side Diff: src/x64/lithium-x64.cc

Issue 6961019: Prevent deopt on double value assignment to typed arrays (Closed) Base URL: https://v8.googlecode.com/svn/branches/bleeding_edge
Patch Set: more review feedback Created 9 years, 6 months ago
Use n/p to move between diff chunks; N/P to move between comments. Draft comments are only viewable by you.
Jump to:
View unified diff | Download patch | Annotate | Revision Log
« no previous file with comments | « src/x64/lithium-x64.h ('k') | test/mjsunit/external-array.js » ('j') | no next file with comments »
Toggle Intra-line Diffs ('i') | Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
OLDNEW
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 1637 matching lines...) Expand 10 before | Expand all | Expand 10 after
1648 if (from.IsTagged()) { 1648 if (from.IsTagged()) {
1649 if (to.IsDouble()) { 1649 if (to.IsDouble()) {
1650 LOperand* value = UseRegister(instr->value()); 1650 LOperand* value = UseRegister(instr->value());
1651 LNumberUntagD* res = new LNumberUntagD(value); 1651 LNumberUntagD* res = new LNumberUntagD(value);
1652 return AssignEnvironment(DefineAsRegister(res)); 1652 return AssignEnvironment(DefineAsRegister(res));
1653 } else { 1653 } else {
1654 ASSERT(to.IsInteger32()); 1654 ASSERT(to.IsInteger32());
1655 LOperand* value = UseRegister(instr->value()); 1655 LOperand* value = UseRegister(instr->value());
1656 bool needs_check = !instr->value()->type().IsSmi(); 1656 bool needs_check = !instr->value()->type().IsSmi();
1657 if (needs_check) { 1657 if (needs_check) {
1658 LOperand* xmm_temp = instr->CanTruncateToInt32() ? NULL 1658 bool truncating = instr->CanTruncateToInt32();
1659 : FixedTemp(xmm1); 1659 LOperand* xmm_temp = truncating ? NULL : FixedTemp(xmm1);
1660 LTaggedToI* res = new LTaggedToI(value, xmm_temp); 1660 LTaggedToI* res = new LTaggedToI(value, xmm_temp);
1661 return AssignEnvironment(DefineSameAsFirst(res)); 1661 return AssignEnvironment(DefineSameAsFirst(res));
1662 } else { 1662 } else {
1663 return DefineSameAsFirst(new LSmiUntag(value, needs_check)); 1663 return DefineSameAsFirst(new LSmiUntag(value, needs_check));
1664 } 1664 }
1665 } 1665 }
1666 } else if (from.IsDouble()) { 1666 } else if (from.IsDouble()) {
1667 if (to.IsTagged()) { 1667 if (to.IsTagged()) {
1668 LOperand* value = UseRegister(instr->value()); 1668 LOperand* value = UseRegister(instr->value());
1669 LOperand* temp = TempRegister(); 1669 LOperand* temp = TempRegister();
(...skipping 80 matching lines...) Expand 10 before | Expand all | Expand 10 after
1750 // Register allocator doesn't (yet) support allocation of double 1750 // Register allocator doesn't (yet) support allocation of double
1751 // temps. Reserve xmm1 explicitly. 1751 // temps. Reserve xmm1 explicitly.
1752 LClampTToUint8* result = new LClampTToUint8(reg, 1752 LClampTToUint8* result = new LClampTToUint8(reg,
1753 TempRegister(), 1753 TempRegister(),
1754 FixedTemp(xmm1)); 1754 FixedTemp(xmm1));
1755 return AssignEnvironment(DefineSameAsFirst(result)); 1755 return AssignEnvironment(DefineSameAsFirst(result));
1756 } 1756 }
1757 } 1757 }
1758 1758
1759 1759
1760 LInstruction* LChunkBuilder::DoToInt32(HToInt32* instr) {
1761 HValue* value = instr->value();
1762 Representation input_rep = value->representation();
1763 LOperand* reg = UseRegister(value);
1764 if (input_rep.IsDouble()) {
1765 return AssignEnvironment(DefineAsRegister(new LDoubleToI(reg)));
1766 } else if (input_rep.IsInteger32()) {
1767 // Canonicalization should already have removed the hydrogen instruction in
1768 // this case, since it is a noop.
1769 UNREACHABLE();
1770 return NULL;
1771 } else {
1772 ASSERT(input_rep.IsTagged());
1773 LOperand* reg = UseRegister(value);
1774 // Register allocator doesn't (yet) support allocation of double
1775 // temps. Reserve xmm1 explicitly.
1776 LOperand* xmm_temp =
1777 CpuFeatures::IsSupported(SSE3)
1778 ? NULL
1779 : FixedTemp(xmm1);
1780 return AssignEnvironment(
1781 DefineSameAsFirst(new LTaggedToI(reg, xmm_temp)));
1782 }
1783 }
1784
1785
1760 LInstruction* LChunkBuilder::DoReturn(HReturn* instr) { 1786 LInstruction* LChunkBuilder::DoReturn(HReturn* instr) {
1761 return new LReturn(UseFixed(instr->value(), rax)); 1787 return new LReturn(UseFixed(instr->value(), rax));
1762 } 1788 }
1763 1789
1764 1790
1765 LInstruction* LChunkBuilder::DoConstant(HConstant* instr) { 1791 LInstruction* LChunkBuilder::DoConstant(HConstant* instr) {
1766 Representation r = instr->representation(); 1792 Representation r = instr->representation();
1767 if (r.IsInteger32()) { 1793 if (r.IsInteger32()) {
1768 return DefineAsRegister(new LConstantI); 1794 return DefineAsRegister(new LConstantI);
1769 } else if (r.IsDouble()) { 1795 } else if (r.IsDouble()) {
(...skipping 423 matching lines...) Expand 10 before | Expand all | Expand 10 after
2193 LOperand* key = UseOrConstantAtStart(instr->key()); 2219 LOperand* key = UseOrConstantAtStart(instr->key());
2194 LOperand* object = UseOrConstantAtStart(instr->object()); 2220 LOperand* object = UseOrConstantAtStart(instr->object());
2195 LIn* result = new LIn(key, object); 2221 LIn* result = new LIn(key, object);
2196 return MarkAsCall(DefineFixed(result, rax), instr); 2222 return MarkAsCall(DefineFixed(result, rax), instr);
2197 } 2223 }
2198 2224
2199 2225
2200 } } // namespace v8::internal 2226 } } // namespace v8::internal
2201 2227
2202 #endif // V8_TARGET_ARCH_X64 2228 #endif // V8_TARGET_ARCH_X64
OLDNEW
« no previous file with comments | « src/x64/lithium-x64.h ('k') | test/mjsunit/external-array.js » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698