| OLD | NEW |
| 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/flow_graph_compiler.h" | 8 #include "vm/flow_graph_compiler.h" |
| 9 #include "vm/locations.h" | 9 #include "vm/locations.h" |
| 10 #include "vm/object_store.h" | 10 #include "vm/object_store.h" |
| (...skipping 26 matching lines...) Expand all Loading... |
| 37 | 37 |
| 38 | 38 |
| 39 void BindInstr::EmitNativeCode(FlowGraphCompiler* compiler) { | 39 void BindInstr::EmitNativeCode(FlowGraphCompiler* compiler) { |
| 40 computation()->EmitNativeCode(compiler); | 40 computation()->EmitNativeCode(compiler); |
| 41 __ pushq(locs()->out().reg()); | 41 __ pushq(locs()->out().reg()); |
| 42 } | 42 } |
| 43 | 43 |
| 44 | 44 |
| 45 static LocationSummary* MakeSimpleLocationSummary( | 45 static LocationSummary* MakeSimpleLocationSummary( |
| 46 intptr_t input_count, Location out) { | 46 intptr_t input_count, Location out) { |
| 47 LocationSummary* summary = new LocationSummary(input_count); | 47 LocationSummary* summary = new LocationSummary(input_count, 0); |
| 48 for (intptr_t i = 0; i < input_count; i++) { | 48 for (intptr_t i = 0; i < input_count; i++) { |
| 49 summary->set_in(i, Location::RequiresRegister()); | 49 summary->set_in(i, Location::RequiresRegister()); |
| 50 } | 50 } |
| 51 summary->set_out(out); | 51 summary->set_out(out); |
| 52 return summary; | 52 return summary; |
| 53 } | 53 } |
| 54 | 54 |
| 55 | 55 |
| 56 LocationSummary* CurrentContextComp::MakeLocationSummary() const { | 56 LocationSummary* CurrentContextComp::MakeLocationSummary() const { |
| 57 return MakeSimpleLocationSummary(0, Location::RequiresRegister()); | 57 return MakeSimpleLocationSummary(0, Location::RequiresRegister()); |
| 58 } | 58 } |
| 59 | 59 |
| 60 | 60 |
| 61 void CurrentContextComp::EmitNativeCode(FlowGraphCompiler* compiler) { | 61 void CurrentContextComp::EmitNativeCode(FlowGraphCompiler* compiler) { |
| 62 __ movq(locs()->out().reg(), CTX); | 62 __ movq(locs()->out().reg(), CTX); |
| 63 } | 63 } |
| 64 | 64 |
| 65 | 65 |
| 66 LocationSummary* StoreContextComp::MakeLocationSummary() const { | 66 LocationSummary* StoreContextComp::MakeLocationSummary() const { |
| 67 LocationSummary* summary = new LocationSummary(1); | 67 LocationSummary* summary = new LocationSummary(1, 0); |
| 68 summary->set_in(0, Location::RegisterLocation(CTX)); | 68 summary->set_in(0, Location::RegisterLocation(CTX)); |
| 69 return summary; | 69 return summary; |
| 70 } | 70 } |
| 71 | 71 |
| 72 | 72 |
| 73 void StoreContextComp::EmitNativeCode(FlowGraphCompiler* compiler) { | 73 void StoreContextComp::EmitNativeCode(FlowGraphCompiler* compiler) { |
| 74 // Nothing to do. Context register were loaded by register allocator. | 74 // Nothing to do. Context register were loaded by register allocator. |
| 75 ASSERT(locs()->in(0).reg() == CTX); | 75 ASSERT(locs()->in(0).reg() == CTX); |
| 76 } | 76 } |
| 77 | 77 |
| (...skipping 22 matching lines...) Expand all Loading... |
| 100 __ jmp(&done, Assembler::kNearJump); | 100 __ jmp(&done, Assembler::kNearJump); |
| 101 __ Bind(&load_true); | 101 __ Bind(&load_true); |
| 102 __ LoadObject(result, bool_true); | 102 __ LoadObject(result, bool_true); |
| 103 __ Bind(&done); | 103 __ Bind(&done); |
| 104 } | 104 } |
| 105 | 105 |
| 106 | 106 |
| 107 // Generic summary for call instructions that have all arguments pushed | 107 // Generic summary for call instructions that have all arguments pushed |
| 108 // on the stack and return the result in a fixed register RAX. | 108 // on the stack and return the result in a fixed register RAX. |
| 109 static LocationSummary* MakeCallSummary() { | 109 static LocationSummary* MakeCallSummary() { |
| 110 LocationSummary* result = new LocationSummary(0); | 110 LocationSummary* result = new LocationSummary(0, 0); |
| 111 result->set_out(Location::RegisterLocation(RAX)); | 111 result->set_out(Location::RegisterLocation(RAX)); |
| 112 return result; | 112 return result; |
| 113 } | 113 } |
| 114 | 114 |
| 115 | 115 |
| 116 LocationSummary* ClosureCallComp::MakeLocationSummary() const { | 116 LocationSummary* ClosureCallComp::MakeLocationSummary() const { |
| 117 return MakeCallSummary(); | 117 return MakeCallSummary(); |
| 118 } | 118 } |
| 119 | 119 |
| 120 | 120 |
| (...skipping 186 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 307 return NULL; | 307 return NULL; |
| 308 } | 308 } |
| 309 | 309 |
| 310 | 310 |
| 311 void StoreInstanceFieldComp::EmitNativeCode(FlowGraphCompiler* compiler) { | 311 void StoreInstanceFieldComp::EmitNativeCode(FlowGraphCompiler* compiler) { |
| 312 UNIMPLEMENTED(); | 312 UNIMPLEMENTED(); |
| 313 } | 313 } |
| 314 | 314 |
| 315 | 315 |
| 316 LocationSummary* LoadStaticFieldComp::MakeLocationSummary() const { | 316 LocationSummary* LoadStaticFieldComp::MakeLocationSummary() const { |
| 317 return NULL; | 317 return MakeSimpleLocationSummary(0, Location::RequiresRegister()); |
| 318 } | 318 } |
| 319 | 319 |
| 320 | 320 |
| 321 void LoadStaticFieldComp::EmitNativeCode(FlowGraphCompiler* compiler) { | 321 void LoadStaticFieldComp::EmitNativeCode(FlowGraphCompiler* compiler) { |
| 322 UNIMPLEMENTED(); | 322 Register result = locs()->out().reg(); |
| 323 __ LoadObject(result, field()); |
| 324 __ movq(result, FieldAddress(result, Field::value_offset())); |
| 323 } | 325 } |
| 324 | 326 |
| 325 | 327 |
| 326 LocationSummary* StoreStaticFieldComp::MakeLocationSummary() const { | 328 LocationSummary* StoreStaticFieldComp::MakeLocationSummary() const { |
| 327 return NULL; | 329 LocationSummary* locs = new LocationSummary(1, 1); |
| 330 locs->set_in(0, Location::RequiresRegister()); |
| 331 locs->set_temp(0, Location::RequiresRegister()); |
| 332 locs->set_out(Location::SameAsFirstInput()); |
| 333 return locs; |
| 328 } | 334 } |
| 329 | 335 |
| 330 | 336 |
| 331 void StoreStaticFieldComp::EmitNativeCode(FlowGraphCompiler* compiler) { | 337 void StoreStaticFieldComp::EmitNativeCode(FlowGraphCompiler* compiler) { |
| 332 UNIMPLEMENTED(); | 338 Register value = locs()->in(0).reg(); |
| 339 Register temp = locs()->temp(0).reg(); |
| 340 ASSERT(locs()->out().reg() == value); |
| 341 |
| 342 __ LoadObject(temp, field()); |
| 343 __ StoreIntoObject(temp, FieldAddress(temp, Field::value_offset()), value); |
| 333 } | 344 } |
| 334 | 345 |
| 335 | 346 |
| 336 LocationSummary* BooleanNegateComp::MakeLocationSummary() const { | 347 LocationSummary* BooleanNegateComp::MakeLocationSummary() const { |
| 337 return NULL; | 348 return NULL; |
| 338 } | 349 } |
| 339 | 350 |
| 340 | 351 |
| 341 void BooleanNegateComp::EmitNativeCode(FlowGraphCompiler* compiler) { | 352 void BooleanNegateComp::EmitNativeCode(FlowGraphCompiler* compiler) { |
| 342 UNIMPLEMENTED(); | 353 UNIMPLEMENTED(); |
| (...skipping 248 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 591 if (locs()->out().reg() != RAX) { | 602 if (locs()->out().reg() != RAX) { |
| 592 __ movq(locs()->out().reg(), RAX); | 603 __ movq(locs()->out().reg(), RAX); |
| 593 } | 604 } |
| 594 } | 605 } |
| 595 | 606 |
| 596 } // namespace dart | 607 } // namespace dart |
| 597 | 608 |
| 598 #undef __ | 609 #undef __ |
| 599 | 610 |
| 600 #endif // defined TARGET_ARCH_X64 | 611 #endif // defined TARGET_ARCH_X64 |
| OLD | NEW |