| 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/intermediate_language.h" | 8 #include "vm/intermediate_language.h" |
| 9 | 9 |
| 10 #include "lib/error.h" | 10 #include "lib/error.h" |
| (...skipping 118 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 129 | 129 |
| 130 LocationSummary* LoadLocalComp::MakeLocationSummary() const { | 130 LocationSummary* LoadLocalComp::MakeLocationSummary() const { |
| 131 return LocationSummary::Make(0, | 131 return LocationSummary::Make(0, |
| 132 Location::RequiresRegister(), | 132 Location::RequiresRegister(), |
| 133 LocationSummary::kNoCall); | 133 LocationSummary::kNoCall); |
| 134 } | 134 } |
| 135 | 135 |
| 136 | 136 |
| 137 void LoadLocalComp::EmitNativeCode(FlowGraphCompiler* compiler) { | 137 void LoadLocalComp::EmitNativeCode(FlowGraphCompiler* compiler) { |
| 138 Register result = locs()->out().reg(); | 138 Register result = locs()->out().reg(); |
| 139 __ movq(result, Address(RBP, local().index() * kWordSize)); | 139 __ movq(result, Address(RBP, local()->index() * kWordSize)); |
| 140 } | 140 } |
| 141 | 141 |
| 142 | 142 |
| 143 LocationSummary* StoreLocalComp::MakeLocationSummary() const { | 143 LocationSummary* StoreLocalComp::MakeLocationSummary() const { |
| 144 return LocationSummary::Make(1, | 144 return LocationSummary::Make(1, |
| 145 Location::SameAsFirstInput(), | 145 Location::SameAsFirstInput(), |
| 146 LocationSummary::kNoCall); | 146 LocationSummary::kNoCall); |
| 147 } | 147 } |
| 148 | 148 |
| 149 | 149 |
| 150 void StoreLocalComp::EmitNativeCode(FlowGraphCompiler* compiler) { | 150 void StoreLocalComp::EmitNativeCode(FlowGraphCompiler* compiler) { |
| 151 Register value = locs()->in(0).reg(); | 151 Register value = locs()->in(0).reg(); |
| 152 Register result = locs()->out().reg(); | 152 Register result = locs()->out().reg(); |
| 153 ASSERT(result == value); // Assert that register assignment is correct. | 153 ASSERT(result == value); // Assert that register assignment is correct. |
| 154 __ movq(Address(RBP, local().index() * kWordSize), value); | 154 __ movq(Address(RBP, local()->index() * kWordSize), value); |
| 155 } | 155 } |
| 156 | 156 |
| 157 | 157 |
| 158 LocationSummary* ConstantVal::MakeLocationSummary() const { | 158 LocationSummary* ConstantVal::MakeLocationSummary() const { |
| 159 return LocationSummary::Make(0, | 159 return LocationSummary::Make(0, |
| 160 Location::RequiresRegister(), | 160 Location::RequiresRegister(), |
| 161 LocationSummary::kNoCall); | 161 LocationSummary::kNoCall); |
| 162 } | 162 } |
| 163 | 163 |
| 164 | 164 |
| (...skipping 1303 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 1468 // exception and stack trace variables. | 1468 // exception and stack trace variables. |
| 1469 void CatchEntryComp::EmitNativeCode(FlowGraphCompiler* compiler) { | 1469 void CatchEntryComp::EmitNativeCode(FlowGraphCompiler* compiler) { |
| 1470 // Restore RSP from RBP as we are coming from a throw and the code for | 1470 // Restore RSP from RBP as we are coming from a throw and the code for |
| 1471 // popping arguments has not been run. | 1471 // popping arguments has not been run. |
| 1472 const intptr_t locals_space_size = compiler->StackSize() * kWordSize; | 1472 const intptr_t locals_space_size = compiler->StackSize() * kWordSize; |
| 1473 ASSERT(locals_space_size >= 0); | 1473 ASSERT(locals_space_size >= 0); |
| 1474 const intptr_t offset_size = | 1474 const intptr_t offset_size = |
| 1475 -locals_space_size + FlowGraphCompiler::kLocalsOffsetFromFP; | 1475 -locals_space_size + FlowGraphCompiler::kLocalsOffsetFromFP; |
| 1476 __ leaq(RSP, Address(RBP, offset_size)); | 1476 __ leaq(RSP, Address(RBP, offset_size)); |
| 1477 | 1477 |
| 1478 ASSERT(!exception_var().is_captured()); | 1478 ASSERT(!exception_var()->is_captured()); |
| 1479 ASSERT(!stacktrace_var().is_captured()); | 1479 ASSERT(!stacktrace_var()->is_captured()); |
| 1480 __ movq(Address(RBP, exception_var().index() * kWordSize), | 1480 __ movq(Address(RBP, exception_var()->index() * kWordSize), |
| 1481 kExceptionObjectReg); | 1481 kExceptionObjectReg); |
| 1482 __ movq(Address(RBP, stacktrace_var().index() * kWordSize), | 1482 __ movq(Address(RBP, stacktrace_var()->index() * kWordSize), |
| 1483 kStackTraceObjectReg); | 1483 kStackTraceObjectReg); |
| 1484 } | 1484 } |
| 1485 | 1485 |
| 1486 | 1486 |
| 1487 LocationSummary* CheckStackOverflowComp::MakeLocationSummary() const { | 1487 LocationSummary* CheckStackOverflowComp::MakeLocationSummary() const { |
| 1488 const intptr_t kNumInputs = 0; | 1488 const intptr_t kNumInputs = 0; |
| 1489 const intptr_t kNumTemps = 1; | 1489 const intptr_t kNumTemps = 1; |
| 1490 // TODO(vegorov): spilling is required only on an infrequently executed path. | 1490 // TODO(vegorov): spilling is required only on an infrequently executed path. |
| 1491 LocationSummary* summary = | 1491 LocationSummary* summary = |
| 1492 new LocationSummary(kNumInputs, kNumTemps, LocationSummary::kCall); | 1492 new LocationSummary(kNumInputs, kNumTemps, LocationSummary::kCall); |
| (...skipping 710 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 2203 ASSERT(locs()->out().reg() == RAX); | 2203 ASSERT(locs()->out().reg() == RAX); |
| 2204 __ CompareObject(locs()->out().reg(), compiler->bool_true()); | 2204 __ CompareObject(locs()->out().reg(), compiler->bool_true()); |
| 2205 EmitBranchOnCondition(compiler, branch_condition); | 2205 EmitBranchOnCondition(compiler, branch_condition); |
| 2206 } | 2206 } |
| 2207 | 2207 |
| 2208 } // namespace dart | 2208 } // namespace dart |
| 2209 | 2209 |
| 2210 #undef __ | 2210 #undef __ |
| 2211 | 2211 |
| 2212 #endif // defined TARGET_ARCH_X64 | 2212 #endif // defined TARGET_ARCH_X64 |
| OLD | NEW |