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

Side by Side Diff: runtime/vm/intermediate_language_x64.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, 2 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 | « runtime/vm/intermediate_language_ia32.cc ('k') | tests/language/deopt_smi_op.dart » ('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_X64. 5 #include "vm/globals.h" // Needed here to get TARGET_ARCH_X64.
6 #if defined(TARGET_ARCH_X64) 6 #if defined(TARGET_ARCH_X64)
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 1542 matching lines...) Expand 10 before | Expand all | Expand 10 after
1553 } 1553 }
1554 } 1554 }
1555 1555
1556 1556
1557 void BinarySmiOpInstr::EmitNativeCode(FlowGraphCompiler* compiler) { 1557 void BinarySmiOpInstr::EmitNativeCode(FlowGraphCompiler* compiler) {
1558 Register left = locs()->in(0).reg(); 1558 Register left = locs()->in(0).reg();
1559 Register result = locs()->out().reg(); 1559 Register result = locs()->out().reg();
1560 ASSERT(left == result); 1560 ASSERT(left == result);
1561 Label* deopt = NULL; 1561 Label* deopt = NULL;
1562 if (CanDeoptimize()) { 1562 if (CanDeoptimize()) {
1563 deopt = compiler->AddDeoptStub(instance_call()->deopt_id(), 1563 deopt = compiler->AddDeoptStub(deopt_id(),
1564 kDeoptBinarySmiOp); 1564 kDeoptBinarySmiOp);
1565 } 1565 }
1566 1566
1567 if (locs()->in(1).IsConstant()) { 1567 if (locs()->in(1).IsConstant()) {
1568 const Object& constant = locs()->in(1).constant(); 1568 const Object& constant = locs()->in(1).constant();
1569 ASSERT(constant.IsSmi()); 1569 ASSERT(constant.IsSmi());
1570 const int64_t imm = 1570 const int64_t imm =
1571 reinterpret_cast<int64_t>(constant.raw()); 1571 reinterpret_cast<int64_t>(constant.raw());
1572 switch (op_kind()) { 1572 switch (op_kind()) {
1573 case Token::kADD: { 1573 case Token::kADD: {
(...skipping 146 matching lines...) Expand 10 before | Expand all | Expand 10 after
1720 __ jmp(&done); 1720 __ jmp(&done);
1721 { 1721 {
1722 __ Bind(&call_method); 1722 __ Bind(&call_method);
1723 Function& target = Function::ZoneHandle( 1723 Function& target = Function::ZoneHandle(
1724 ic_data()->GetTargetForReceiverClassId(kSmiCid)); 1724 ic_data()->GetTargetForReceiverClassId(kSmiCid));
1725 ASSERT(!target.IsNull()); 1725 ASSERT(!target.IsNull());
1726 const intptr_t kArgumentCount = 2; 1726 const intptr_t kArgumentCount = 2;
1727 __ pushq(temp); 1727 __ pushq(temp);
1728 __ pushq(right); 1728 __ pushq(right);
1729 compiler->GenerateStaticCall( 1729 compiler->GenerateStaticCall(
1730 instance_call()->deopt_id(), 1730 deopt_id(),
1731 instance_call()->token_pos(), 1731 instance_call()->token_pos(),
1732 target, 1732 target,
1733 kArgumentCount, 1733 kArgumentCount,
1734 Array::Handle(), // No argument names. 1734 Array::Handle(), // No argument names.
1735 locs()); 1735 locs());
1736 ASSERT(result == RAX); 1736 ASSERT(result == RAX);
1737 } 1737 }
1738 __ Bind(&done); 1738 __ Bind(&done);
1739 break; 1739 break;
1740 } 1740 }
(...skipping 193 matching lines...) Expand 10 before | Expand all | Expand 10 after
1934 summary->set_out(Location::SameAsFirstInput()); 1934 summary->set_out(Location::SameAsFirstInput());
1935 return summary; 1935 return summary;
1936 } 1936 }
1937 1937
1938 1938
1939 void UnarySmiOpInstr::EmitNativeCode(FlowGraphCompiler* compiler) { 1939 void UnarySmiOpInstr::EmitNativeCode(FlowGraphCompiler* compiler) {
1940 Register value = locs()->in(0).reg(); 1940 Register value = locs()->in(0).reg();
1941 ASSERT(value == locs()->out().reg()); 1941 ASSERT(value == locs()->out().reg());
1942 switch (op_kind()) { 1942 switch (op_kind()) {
1943 case Token::kNEGATE: { 1943 case Token::kNEGATE: {
1944 Label* deopt = compiler->AddDeoptStub(instance_call()->deopt_id(), 1944 Label* deopt = compiler->AddDeoptStub(deopt_id(),
1945 kDeoptUnaryOp); 1945 kDeoptUnaryOp);
1946 __ negq(value); 1946 __ negq(value);
1947 __ j(OVERFLOW, deopt); 1947 __ j(OVERFLOW, deopt);
1948 break; 1948 break;
1949 } 1949 }
1950 case Token::kBIT_NOT: 1950 case Token::kBIT_NOT:
1951 __ notq(value); 1951 __ notq(value);
1952 __ andq(value, Immediate(~kSmiTagMask)); // Remove inverted smi-tag. 1952 __ andq(value, Immediate(~kSmiTagMask)); // Remove inverted smi-tag.
1953 break; 1953 break;
1954 default: 1954 default:
(...skipping 352 matching lines...) Expand 10 before | Expand all | Expand 10 after
2307 2307
2308 void ShiftMintOpInstr::EmitNativeCode(FlowGraphCompiler* compiler) { 2308 void ShiftMintOpInstr::EmitNativeCode(FlowGraphCompiler* compiler) {
2309 UNIMPLEMENTED(); 2309 UNIMPLEMENTED();
2310 } 2310 }
2311 2311
2312 } // namespace dart 2312 } // namespace dart
2313 2313
2314 #undef __ 2314 #undef __
2315 2315
2316 #endif // defined TARGET_ARCH_X64 2316 #endif // defined TARGET_ARCH_X64
OLDNEW
« no previous file with comments | « runtime/vm/intermediate_language_ia32.cc ('k') | tests/language/deopt_smi_op.dart » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698