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

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

Issue 10542167: Inline Math.sqrt in new compilers. (Closed) Base URL: http://dart.googlecode.com/svn/branches/bleeding_edge/dart/
Patch Set: Created 8 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 | « runtime/vm/intermediate_language_ia32.cc ('k') | runtime/vm/opt_code_generator_ia32.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_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 1443 matching lines...) Expand 10 before | Expand all | Expand 10 after
1454 } 1454 }
1455 1455
1456 1456
1457 static void EmitDoubleBinaryOp(FlowGraphCompiler* compiler, 1457 static void EmitDoubleBinaryOp(FlowGraphCompiler* compiler,
1458 BinaryOpComp* comp) { 1458 BinaryOpComp* comp) {
1459 Register left = comp->locs()->in(0).reg(); 1459 Register left = comp->locs()->in(0).reg();
1460 Register right = comp->locs()->in(1).reg(); 1460 Register right = comp->locs()->in(1).reg();
1461 Register temp = comp->locs()->temp(0).reg(); 1461 Register temp = comp->locs()->temp(0).reg();
1462 Register result = comp->locs()->out().reg(); 1462 Register result = comp->locs()->out().reg();
1463 1463
1464 const Class& double_class = 1464 const Class& double_class = compiler->double_class();
1465 Class::ZoneHandle(Isolate::Current()->object_store()->double_class());
1466 const Code& stub = 1465 const Code& stub =
1467 Code::Handle(StubCode::GetAllocationStubForClass(double_class)); 1466 Code::Handle(StubCode::GetAllocationStubForClass(double_class));
1468 const ExternalLabel label(double_class.ToCString(), stub.EntryPoint()); 1467 const ExternalLabel label(double_class.ToCString(), stub.EntryPoint());
1469 __ pushq(left); 1468 __ pushq(left);
1470 __ pushq(right); 1469 __ pushq(right);
1471 compiler->GenerateCall(comp->instance_call()->token_index(), 1470 compiler->GenerateCall(comp->instance_call()->token_index(),
1472 comp->instance_call()->try_index(), 1471 comp->instance_call()->try_index(),
1473 &label, 1472 &label,
1474 PcDescriptors::kOther); 1473 PcDescriptors::kOther);
1475 // Newly allocated object is now in the result register (RAX). 1474 // Newly allocated object is now in the result register (RAX).
(...skipping 118 matching lines...) Expand 10 before | Expand all | Expand 10 after
1594 instance_call()->try_index(), 1593 instance_call()->try_index(),
1595 kDeoptSmiBinaryOp, 1594 kDeoptSmiBinaryOp,
1596 value); 1595 value);
1597 if (test_class.id() == kDouble) { 1596 if (test_class.id() == kDouble) {
1598 Register temp = locs()->temp(0).reg(); 1597 Register temp = locs()->temp(0).reg();
1599 __ testq(value, Immediate(kSmiTagMask)); 1598 __ testq(value, Immediate(kSmiTagMask));
1600 __ j(ZERO, deopt); // Smi. 1599 __ j(ZERO, deopt); // Smi.
1601 __ CompareClassId(value, kDouble); 1600 __ CompareClassId(value, kDouble);
1602 __ j(NOT_EQUAL, deopt); 1601 __ j(NOT_EQUAL, deopt);
1603 // Allocate result object. 1602 // Allocate result object.
1604 const Class& double_class = 1603 const Class& double_class = compiler->double_class();
1605 Class::ZoneHandle(Isolate::Current()->object_store()->double_class());
1606 const Code& stub = 1604 const Code& stub =
1607 Code::Handle(StubCode::GetAllocationStubForClass(double_class)); 1605 Code::Handle(StubCode::GetAllocationStubForClass(double_class));
1608 const ExternalLabel label(double_class.ToCString(), stub.EntryPoint()); 1606 const ExternalLabel label(double_class.ToCString(), stub.EntryPoint());
1609 __ pushq(value); 1607 __ pushq(value);
1610 compiler->GenerateCall(instance_call()->token_index(), 1608 compiler->GenerateCall(instance_call()->token_index(),
1611 instance_call()->try_index(), 1609 instance_call()->try_index(),
1612 &label, 1610 &label,
1613 PcDescriptors::kOther); 1611 PcDescriptors::kOther);
1614 // Result is in RAX. 1612 // Result is in RAX.
1615 ASSERT(result != temp); 1613 ASSERT(result != temp);
(...skipping 39 matching lines...) Expand 10 before | Expand all | Expand 10 after
1655 __ testq(value, Immediate(kSmiTagMask)); 1653 __ testq(value, Immediate(kSmiTagMask));
1656 __ j(ZERO, deopt); // Deoptimize if Smi. 1654 __ j(ZERO, deopt); // Deoptimize if Smi.
1657 __ CompareClassId(value, kDouble); 1655 __ CompareClassId(value, kDouble);
1658 __ j(NOT_EQUAL, deopt); // Deoptimize if not Double. 1656 __ j(NOT_EQUAL, deopt); // Deoptimize if not Double.
1659 ASSERT(value == result); 1657 ASSERT(value == result);
1660 return; 1658 return;
1661 } 1659 }
1662 1660
1663 ASSERT(from() == kSmi); 1661 ASSERT(from() == kSmi);
1664 1662
1665 // TODO(vegorov): allocate a single ZoneHandle in FlowGraphCompiler for 1663 const Class& double_class = compiler->double_class();
1666 // double class.
1667 const Class& double_class =
1668 Class::ZoneHandle(Isolate::Current()->object_store()->double_class());
1669
1670 const Code& stub = 1664 const Code& stub =
1671 Code::Handle(StubCode::GetAllocationStubForClass(double_class)); 1665 Code::Handle(StubCode::GetAllocationStubForClass(double_class));
1672
1673 const ExternalLabel label(double_class.ToCString(), stub.EntryPoint()); 1666 const ExternalLabel label(double_class.ToCString(), stub.EntryPoint());
1674 1667
1675 // TODO(vegorov): allocate box in the driver loop to avoid pushing and poping. 1668 // TODO(vegorov): allocate box in the driver loop to avoid pushing and poping.
1676 __ pushq(value); 1669 __ pushq(value);
1677 compiler->GenerateCall(instance_call()->token_index(), 1670 compiler->GenerateCall(instance_call()->token_index(),
1678 instance_call()->try_index(), 1671 instance_call()->try_index(),
1679 &label, 1672 &label,
1680 PcDescriptors::kOther); 1673 PcDescriptors::kOther);
1681 ASSERT(result == RAX); 1674 ASSERT(result == RAX);
1682 __ popq(value); 1675 __ popq(value);
(...skipping 52 matching lines...) Expand 10 before | Expand all | Expand 10 after
1735 instance_call()->argument_names()); 1728 instance_call()->argument_names());
1736 } 1729 }
1737 __ Bind(&done); 1730 __ Bind(&done);
1738 } 1731 }
1739 1732
1740 } // namespace dart 1733 } // namespace dart
1741 1734
1742 #undef __ 1735 #undef __
1743 1736
1744 #endif // defined TARGET_ARCH_X64 1737 #endif // defined TARGET_ARCH_X64
OLDNEW
« no previous file with comments | « runtime/vm/intermediate_language_ia32.cc ('k') | runtime/vm/opt_code_generator_ia32.cc » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698