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

Side by Side Diff: runtime/vm/intermediate_language_ia32.cc

Issue 11270013: Fix deoptimzation bug in hoisting smi operation out of loops. (Closed) Base URL: http://dart.googlecode.com/svn/branches/bleeding_edge/dart/
Patch Set: more test cases Created 8 years, 1 month 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 | « runtime/vm/intermediate_language.h ('k') | runtime/vm/intermediate_language_x64.cc » ('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 (c) 2012, the Dart project authors. Please see the AUTHORS file 1 // Copyright (c) 2012, the Dart project authors. Please see the AUTHORS file
2 // for details. All rights reserved. Use of this source code is governed by a 2 // for details. All rights reserved. Use of this source code is governed by a
3 // BSD-style license that can be found in the LICENSE file. 3 // BSD-style license that can be found in the LICENSE file.
4 4
5 #include "vm/globals.h" // Needed here to get TARGET_ARCH_IA32. 5 #include "vm/globals.h" // Needed here to get TARGET_ARCH_IA32.
6 #if defined(TARGET_ARCH_IA32) 6 #if defined(TARGET_ARCH_IA32)
7 7
8 #include "vm/intermediate_language.h" 8 #include "vm/intermediate_language.h"
9 9
10 #include "lib/error.h" 10 #include "lib/error.h"
(...skipping 1571 matching lines...) Expand 10 before | Expand all | Expand 10 after
1582 } 1582 }
1583 } 1583 }
1584 1584
1585 1585
1586 void BinarySmiOpInstr::EmitNativeCode(FlowGraphCompiler* compiler) { 1586 void BinarySmiOpInstr::EmitNativeCode(FlowGraphCompiler* compiler) {
1587 Register left = locs()->in(0).reg(); 1587 Register left = locs()->in(0).reg();
1588 Register result = locs()->out().reg(); 1588 Register result = locs()->out().reg();
1589 ASSERT(left == result); 1589 ASSERT(left == result);
1590 Label* deopt = NULL; 1590 Label* deopt = NULL;
1591 if (CanDeoptimize()) { 1591 if (CanDeoptimize()) {
1592 deopt = compiler->AddDeoptStub(instance_call()->deopt_id(), 1592 deopt = compiler->AddDeoptStub(deopt_id(),
1593 kDeoptBinarySmiOp); 1593 kDeoptBinarySmiOp);
1594 } 1594 }
1595 1595
1596 if (locs()->in(1).IsConstant()) { 1596 if (locs()->in(1).IsConstant()) {
1597 const Object& constant = locs()->in(1).constant(); 1597 const Object& constant = locs()->in(1).constant();
1598 ASSERT(constant.IsSmi()); 1598 ASSERT(constant.IsSmi());
1599 const int32_t imm = 1599 const int32_t imm =
1600 reinterpret_cast<int32_t>(constant.raw()); 1600 reinterpret_cast<int32_t>(constant.raw());
1601 switch (op_kind()) { 1601 switch (op_kind()) {
1602 case Token::kADD: 1602 case Token::kADD:
(...skipping 152 matching lines...) Expand 10 before | Expand all | Expand 10 after
1755 __ jmp(&done); 1755 __ jmp(&done);
1756 { 1756 {
1757 __ Bind(&call_method); 1757 __ Bind(&call_method);
1758 Function& target = Function::ZoneHandle( 1758 Function& target = Function::ZoneHandle(
1759 ic_data()->GetTargetForReceiverClassId(kSmiCid)); 1759 ic_data()->GetTargetForReceiverClassId(kSmiCid));
1760 ASSERT(!target.IsNull()); 1760 ASSERT(!target.IsNull());
1761 const intptr_t kArgumentCount = 2; 1761 const intptr_t kArgumentCount = 2;
1762 __ pushl(temp); 1762 __ pushl(temp);
1763 __ pushl(right); 1763 __ pushl(right);
1764 compiler->GenerateStaticCall( 1764 compiler->GenerateStaticCall(
1765 instance_call()->deopt_id(), 1765 deopt_id(),
1766 instance_call()->token_pos(), 1766 instance_call()->token_pos(),
1767 target, 1767 target,
1768 kArgumentCount, 1768 kArgumentCount,
1769 Array::Handle(), // No argument names. 1769 Array::Handle(), // No argument names.
1770 locs()); 1770 locs());
1771 ASSERT(result == EAX); 1771 ASSERT(result == EAX);
1772 } 1772 }
1773 __ Bind(&done); 1773 __ Bind(&done);
1774 break; 1774 break;
1775 } 1775 }
(...skipping 193 matching lines...) Expand 10 before | Expand all | Expand 10 after
1969 summary->set_out(Location::SameAsFirstInput()); 1969 summary->set_out(Location::SameAsFirstInput());
1970 return summary; 1970 return summary;
1971 } 1971 }
1972 1972
1973 1973
1974 void UnarySmiOpInstr::EmitNativeCode(FlowGraphCompiler* compiler) { 1974 void UnarySmiOpInstr::EmitNativeCode(FlowGraphCompiler* compiler) {
1975 Register value = locs()->in(0).reg(); 1975 Register value = locs()->in(0).reg();
1976 ASSERT(value == locs()->out().reg()); 1976 ASSERT(value == locs()->out().reg());
1977 switch (op_kind()) { 1977 switch (op_kind()) {
1978 case Token::kNEGATE: { 1978 case Token::kNEGATE: {
1979 Label* deopt = compiler->AddDeoptStub(instance_call()->deopt_id(), 1979 Label* deopt = compiler->AddDeoptStub(deopt_id(),
1980 kDeoptUnaryOp); 1980 kDeoptUnaryOp);
1981 __ negl(value); 1981 __ negl(value);
1982 __ j(OVERFLOW, deopt); 1982 __ j(OVERFLOW, deopt);
1983 break; 1983 break;
1984 } 1984 }
1985 case Token::kBIT_NOT: 1985 case Token::kBIT_NOT:
1986 __ notl(value); 1986 __ notl(value);
1987 __ andl(value, Immediate(~kSmiTagMask)); // Remove inverted smi-tag. 1987 __ andl(value, Immediate(~kSmiTagMask)); // Remove inverted smi-tag.
1988 break; 1988 break;
1989 default: 1989 default:
(...skipping 593 matching lines...) Expand 10 before | Expand all | Expand 10 after
2583 __ pcmpeqq(XMM0, XMM0); // Generate all 1's. 2583 __ pcmpeqq(XMM0, XMM0); // Generate all 1's.
2584 __ pxor(value, XMM0); 2584 __ pxor(value, XMM0);
2585 } 2585 }
2586 2586
2587 2587
2588 } // namespace dart 2588 } // namespace dart
2589 2589
2590 #undef __ 2590 #undef __
2591 2591
2592 #endif // defined TARGET_ARCH_X64 2592 #endif // defined TARGET_ARCH_X64
OLDNEW
« no previous file with comments | « runtime/vm/intermediate_language.h ('k') | runtime/vm/intermediate_language_x64.cc » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698