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

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

Issue 678763004: Make CTX allocatable by the register allocator. (Closed) Base URL: http://dart.googlecode.com/svn/branches/bleeding_edge/dart/
Patch Set: incorporated latest comments Created 6 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
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 12 matching lines...) Expand all
23 namespace dart { 23 namespace dart {
24 24
25 DECLARE_FLAG(bool, emit_edge_counters); 25 DECLARE_FLAG(bool, emit_edge_counters);
26 DECLARE_FLAG(int, optimization_counter_threshold); 26 DECLARE_FLAG(int, optimization_counter_threshold);
27 DECLARE_FLAG(bool, propagate_ic_data); 27 DECLARE_FLAG(bool, propagate_ic_data);
28 DECLARE_FLAG(bool, throw_on_javascript_int_overflow); 28 DECLARE_FLAG(bool, throw_on_javascript_int_overflow);
29 DECLARE_FLAG(bool, use_osr); 29 DECLARE_FLAG(bool, use_osr);
30 30
31 // Generic summary for call instructions that have all arguments pushed 31 // Generic summary for call instructions that have all arguments pushed
32 // on the stack and return the result in a fixed register RAX. 32 // on the stack and return the result in a fixed register RAX.
33 LocationSummary* Instruction::MakeCallSummary() { 33 LocationSummary* Instruction::MakeCallSummary(Isolate* isolate) {
34 LocationSummary* result = new LocationSummary( 34 LocationSummary* result = new(isolate) LocationSummary(
35 Isolate::Current(), 0, 0, LocationSummary::kCall); 35 Isolate::Current(), 0, 0, LocationSummary::kCall);
36 result->set_out(0, Location::RegisterLocation(RAX)); 36 result->set_out(0, Location::RegisterLocation(RAX));
37 return result; 37 return result;
38 } 38 }
39 39
40 40
41 LocationSummary* PushArgumentInstr::MakeLocationSummary(Isolate* isolate, 41 LocationSummary* PushArgumentInstr::MakeLocationSummary(Isolate* isolate,
42 bool opt) const { 42 bool opt) const {
43 const intptr_t kNumInputs = 1; 43 const intptr_t kNumInputs = 1;
44 const intptr_t kNumTemps= 0; 44 const intptr_t kNumTemps= 0;
(...skipping 700 matching lines...) Expand 10 before | Expand all | Expand 10 after
745 void RelationalOpInstr::EmitBranchCode(FlowGraphCompiler* compiler, 745 void RelationalOpInstr::EmitBranchCode(FlowGraphCompiler* compiler,
746 BranchInstr* branch) { 746 BranchInstr* branch) {
747 BranchLabels labels = compiler->CreateBranchLabels(branch); 747 BranchLabels labels = compiler->CreateBranchLabels(branch);
748 Condition true_condition = EmitComparisonCode(compiler, labels); 748 Condition true_condition = EmitComparisonCode(compiler, labels);
749 EmitBranchOnCondition(compiler, true_condition, labels); 749 EmitBranchOnCondition(compiler, true_condition, labels);
750 } 750 }
751 751
752 752
753 LocationSummary* NativeCallInstr::MakeLocationSummary(Isolate* isolate, 753 LocationSummary* NativeCallInstr::MakeLocationSummary(Isolate* isolate,
754 bool opt) const { 754 bool opt) const {
755 const intptr_t kNumInputs = 0; 755 return MakeCallSummary(isolate);
756 const intptr_t kNumTemps = 3;
757 LocationSummary* locs = new(isolate) LocationSummary(
758 isolate, kNumInputs, kNumTemps, LocationSummary::kCall);
759 locs->set_temp(0, Location::RegisterLocation(RAX));
760 locs->set_temp(1, Location::RegisterLocation(RBX));
761 locs->set_temp(2, Location::RegisterLocation(R10));
762 locs->set_out(0, Location::RegisterLocation(RAX));
763 return locs;
764 } 756 }
765 757
766 758
767 void NativeCallInstr::EmitNativeCode(FlowGraphCompiler* compiler) { 759 void NativeCallInstr::EmitNativeCode(FlowGraphCompiler* compiler) {
768 ASSERT(locs()->temp(0).reg() == RAX);
769 ASSERT(locs()->temp(1).reg() == RBX);
770 ASSERT(locs()->temp(2).reg() == R10);
771 Register result = locs()->out(0).reg(); 760 Register result = locs()->out(0).reg();
772 const intptr_t argc_tag = NativeArguments::ComputeArgcTag(function()); 761 const intptr_t argc_tag = NativeArguments::ComputeArgcTag(function());
773 const bool is_leaf_call = 762 const bool is_leaf_call =
774 (argc_tag & NativeArguments::AutoSetupScopeMask()) == 0; 763 (argc_tag & NativeArguments::AutoSetupScopeMask()) == 0;
775 StubCode* stub_code = compiler->isolate()->stub_code(); 764 StubCode* stub_code = compiler->isolate()->stub_code();
776 765
777 // Push the result place holder initialized to NULL. 766 // Push the result place holder initialized to NULL.
778 __ PushObject(Object::null_object(), PP); 767 __ PushObject(Object::null_object(), PP);
779 // Pass a pointer to the first argument in RAX. 768 // Pass a pointer to the first argument in RAX.
780 if (!function().HasOptionalParameters()) { 769 if (!function().HasOptionalParameters()) {
(...skipping 4511 matching lines...) Expand 10 before | Expand all | Expand 10 after
5292 __ movq(RSP, locs()->temp(0).reg()); 5281 __ movq(RSP, locs()->temp(0).reg());
5293 5282
5294 return; 5283 return;
5295 } 5284 }
5296 UNIMPLEMENTED(); 5285 UNIMPLEMENTED();
5297 } 5286 }
5298 5287
5299 5288
5300 LocationSummary* PolymorphicInstanceCallInstr::MakeLocationSummary( 5289 LocationSummary* PolymorphicInstanceCallInstr::MakeLocationSummary(
5301 Isolate* isolate, bool opt) const { 5290 Isolate* isolate, bool opt) const {
5302 return MakeCallSummary(); 5291 return MakeCallSummary(isolate);
5303 } 5292 }
5304 5293
5305 5294
5306 void PolymorphicInstanceCallInstr::EmitNativeCode(FlowGraphCompiler* compiler) { 5295 void PolymorphicInstanceCallInstr::EmitNativeCode(FlowGraphCompiler* compiler) {
5307 ASSERT(ic_data().NumArgsTested() == 1); 5296 ASSERT(ic_data().NumArgsTested() == 1);
5308 if (!with_checks()) { 5297 if (!with_checks()) {
5309 ASSERT(ic_data().HasOneTarget()); 5298 ASSERT(ic_data().HasOneTarget());
5310 const Function& target = Function::ZoneHandle(ic_data().GetTargetAt(0)); 5299 const Function& target = Function::ZoneHandle(ic_data().GetTargetAt(0));
5311 compiler->GenerateStaticCall(deopt_id(), 5300 compiler->GenerateStaticCall(deopt_id(),
5312 instance_call()->token_pos(), 5301 instance_call()->token_pos(),
(...skipping 1055 matching lines...) Expand 10 before | Expand all | Expand 10 after
6368 __ LoadObject(result, Bool::True(), PP); 6357 __ LoadObject(result, Bool::True(), PP);
6369 __ CompareRegisters(result, value); 6358 __ CompareRegisters(result, value);
6370 __ j(NOT_EQUAL, &done, Assembler::kNearJump); 6359 __ j(NOT_EQUAL, &done, Assembler::kNearJump);
6371 __ LoadObject(result, Bool::False(), PP); 6360 __ LoadObject(result, Bool::False(), PP);
6372 __ Bind(&done); 6361 __ Bind(&done);
6373 } 6362 }
6374 6363
6375 6364
6376 LocationSummary* AllocateObjectInstr::MakeLocationSummary(Isolate* isolate, 6365 LocationSummary* AllocateObjectInstr::MakeLocationSummary(Isolate* isolate,
6377 bool opt) const { 6366 bool opt) const {
6378 return MakeCallSummary(); 6367 return MakeCallSummary(isolate);
6379 } 6368 }
6380 6369
6381 6370
6382 void AllocateObjectInstr::EmitNativeCode(FlowGraphCompiler* compiler) { 6371 void AllocateObjectInstr::EmitNativeCode(FlowGraphCompiler* compiler) {
6383 Isolate* isolate = compiler->isolate(); 6372 Isolate* isolate = compiler->isolate();
6384 StubCode* stub_code = isolate->stub_code(); 6373 StubCode* stub_code = isolate->stub_code();
6385 const Code& stub = Code::Handle(isolate, 6374 const Code& stub = Code::Handle(isolate,
6386 stub_code->GetAllocationStubForClass(cls())); 6375 stub_code->GetAllocationStubForClass(cls()));
6387 const ExternalLabel label(stub.EntryPoint()); 6376 const ExternalLabel label(stub.EntryPoint());
6388 compiler->GenerateCall(token_pos(), 6377 compiler->GenerateCall(token_pos(),
(...skipping 14 matching lines...) Expand all
6403 __ movq(R10, Immediate(kInvalidObjectPointer)); 6392 __ movq(R10, Immediate(kInvalidObjectPointer));
6404 __ movq(RBX, Immediate(kInvalidObjectPointer)); 6393 __ movq(RBX, Immediate(kInvalidObjectPointer));
6405 #endif 6394 #endif
6406 } 6395 }
6407 6396
6408 } // namespace dart 6397 } // namespace dart
6409 6398
6410 #undef __ 6399 #undef __
6411 6400
6412 #endif // defined TARGET_ARCH_X64 6401 #endif // defined TARGET_ARCH_X64
OLDNEW

Powered by Google App Engine
This is Rietveld 408576698