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

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

Issue 513213002: Generate some intrinsics using our IR. (Closed) Base URL: http://dart.googlecode.com/svn/branches/bleeding_edge/dart/
Patch Set: addressed Slava's feedback Created 6 years, 3 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_mips.cc ('k') | runtime/vm/intrinsifier.h » ('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) 2013, the Dart project authors. Please see the AUTHORS file 1 // Copyright (c) 2013, 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 "vm/dart_entry.h" 10 #include "vm/dart_entry.h"
(...skipping 65 matching lines...) Expand 10 before | Expand all | Expand 10 after
76 return locs; 76 return locs;
77 } 77 }
78 78
79 79
80 // Attempt optimized compilation at return instruction instead of at the entry. 80 // Attempt optimized compilation at return instruction instead of at the entry.
81 // The entry needs to be patchable, no inlined objects are allowed in the area 81 // The entry needs to be patchable, no inlined objects are allowed in the area
82 // that will be overwritten by the patch instruction: a jump). 82 // that will be overwritten by the patch instruction: a jump).
83 void ReturnInstr::EmitNativeCode(FlowGraphCompiler* compiler) { 83 void ReturnInstr::EmitNativeCode(FlowGraphCompiler* compiler) {
84 Register result = locs()->in(0).reg(); 84 Register result = locs()->in(0).reg();
85 ASSERT(result == RAX); 85 ASSERT(result == RAX);
86
87 if (compiler->intrinsic_mode()) {
88 // Intrinsics don't have a frame.
89 __ ret();
90 return;
91 }
92
86 #if defined(DEBUG) 93 #if defined(DEBUG)
87 __ Comment("Stack Check"); 94 __ Comment("Stack Check");
88 Label done; 95 Label done;
89 const intptr_t fp_sp_dist = 96 const intptr_t fp_sp_dist =
90 (kFirstLocalSlotFromFp + 1 - compiler->StackSize()) * kWordSize; 97 (kFirstLocalSlotFromFp + 1 - compiler->StackSize()) * kWordSize;
91 ASSERT(fp_sp_dist <= 0); 98 ASSERT(fp_sp_dist <= 0);
92 __ movq(RDI, RSP); 99 __ movq(RDI, RSP);
93 __ subq(RDI, RBP); 100 __ subq(RDI, RBP);
94 __ CompareImmediate(RDI, Immediate(fp_sp_dist), PP); 101 __ CompareImmediate(RDI, Immediate(fp_sp_dist), PP);
95 __ j(EQUAL, &done, Assembler::kNearJump); 102 __ j(EQUAL, &done, Assembler::kNearJump);
(...skipping 1420 matching lines...) Expand 10 before | Expand all | Expand 10 after
1516 virtual void EmitNativeCode(FlowGraphCompiler* compiler) { 1523 virtual void EmitNativeCode(FlowGraphCompiler* compiler) {
1517 Isolate* isolate = compiler->isolate(); 1524 Isolate* isolate = compiler->isolate();
1518 StubCode* stub_code = isolate->stub_code(); 1525 StubCode* stub_code = isolate->stub_code();
1519 1526
1520 if (Assembler::EmittingComments()) { 1527 if (Assembler::EmittingComments()) {
1521 __ Comment("%s slow path allocation of %s", 1528 __ Comment("%s slow path allocation of %s",
1522 instruction_->DebugName(), 1529 instruction_->DebugName(),
1523 String::Handle(cls_.PrettyName()).ToCString()); 1530 String::Handle(cls_.PrettyName()).ToCString());
1524 } 1531 }
1525 __ Bind(entry_label()); 1532 __ Bind(entry_label());
1526
1527 const Code& stub = 1533 const Code& stub =
1528 Code::Handle(isolate, stub_code->GetAllocationStubForClass(cls_)); 1534 Code::Handle(isolate, stub_code->GetAllocationStubForClass(cls_));
1529 const ExternalLabel label(stub.EntryPoint()); 1535 const ExternalLabel label(stub.EntryPoint());
1530 1536
1531 LocationSummary* locs = instruction_->locs(); 1537 LocationSummary* locs = instruction_->locs();
1532 1538
1533 locs->live_registers()->Remove(Location::RegisterLocation(result_)); 1539 locs->live_registers()->Remove(Location::RegisterLocation(result_));
1534 1540
1535 compiler->SaveLiveRegisters(locs); 1541 compiler->SaveLiveRegisters(locs);
1536 compiler->GenerateCall(Scanner::kNoSourcePos, // No token position. 1542 compiler->GenerateCall(Scanner::kNoSourcePos, // No token position.
1537 &label, 1543 &label,
1538 RawPcDescriptors::kOther, 1544 RawPcDescriptors::kOther,
1539 locs); 1545 locs);
1540 __ MoveRegister(result_, RAX); 1546 __ MoveRegister(result_, RAX);
1541 compiler->RestoreLiveRegisters(locs); 1547 compiler->RestoreLiveRegisters(locs);
1542 __ jmp(exit_label()); 1548 __ jmp(exit_label());
1543 } 1549 }
1544 1550
1545 static void Allocate(FlowGraphCompiler* compiler, 1551 static void Allocate(FlowGraphCompiler* compiler,
1546 Instruction* instruction, 1552 Instruction* instruction,
1547 const Class& cls, 1553 const Class& cls,
1548 Register result) { 1554 Register result) {
1549 BoxAllocationSlowPath* slow_path = 1555 if (compiler->intrinsic_mode()) {
1550 new BoxAllocationSlowPath(instruction, cls, result); 1556 __ TryAllocate(cls,
1551 compiler->AddSlowPathCode(slow_path); 1557 compiler->intrinsic_slow_path_label(),
1558 Assembler::kFarJump,
1559 result,
1560 PP);
1561 } else {
1562 BoxAllocationSlowPath* slow_path =
1563 new BoxAllocationSlowPath(instruction, cls, result);
1564 compiler->AddSlowPathCode(slow_path);
1552 1565
1553 __ TryAllocate(cls, 1566 __ TryAllocate(cls,
1554 slow_path->entry_label(), 1567 slow_path->entry_label(),
1555 Assembler::kFarJump, 1568 Assembler::kFarJump,
1556 result, 1569 result,
1557 PP); 1570 PP);
1558 __ Bind(slow_path->exit_label()); 1571 __ Bind(slow_path->exit_label());
1572 }
1559 } 1573 }
1560 1574
1561 private: 1575 private:
1562 Instruction* instruction_; 1576 Instruction* instruction_;
1563 const Class& cls_; 1577 const Class& cls_;
1564 Register result_; 1578 const Register result_;
1565 }; 1579 };
1566 1580
1567 1581
1568 LocationSummary* StoreInstanceFieldInstr::MakeLocationSummary(Isolate* isolate, 1582 LocationSummary* StoreInstanceFieldInstr::MakeLocationSummary(Isolate* isolate,
1569 bool opt) const { 1583 bool opt) const {
1570 const intptr_t kNumInputs = 2; 1584 const intptr_t kNumInputs = 2;
1571 const intptr_t kNumTemps = 1585 const intptr_t kNumTemps =
1572 (IsUnboxedStore() && opt) ? 2 : 1586 (IsUnboxedStore() && opt) ? 2 :
1573 ((IsPotentialUnboxedStore()) ? 3 : 0); 1587 ((IsPotentialUnboxedStore()) ? 3 : 0);
1574 LocationSummary* summary = new(isolate) LocationSummary( 1588 LocationSummary* summary = new(isolate) LocationSummary(
(...skipping 4269 matching lines...) Expand 10 before | Expand all | Expand 10 after
5844 __ movq(R10, Immediate(kInvalidObjectPointer)); 5858 __ movq(R10, Immediate(kInvalidObjectPointer));
5845 __ movq(RBX, Immediate(kInvalidObjectPointer)); 5859 __ movq(RBX, Immediate(kInvalidObjectPointer));
5846 #endif 5860 #endif
5847 } 5861 }
5848 5862
5849 } // namespace dart 5863 } // namespace dart
5850 5864
5851 #undef __ 5865 #undef __
5852 5866
5853 #endif // defined TARGET_ARCH_X64 5867 #endif // defined TARGET_ARCH_X64
OLDNEW
« no previous file with comments | « runtime/vm/intermediate_language_mips.cc ('k') | runtime/vm/intrinsifier.h » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698