| 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 14 matching lines...) Expand all Loading... |
| 25 // on the stack and return the result in a fixed register RAX. | 25 // on the stack and return the result in a fixed register RAX. |
| 26 LocationSummary* Computation::MakeCallSummary() { | 26 LocationSummary* Computation::MakeCallSummary() { |
| 27 LocationSummary* result = new LocationSummary(0, 0, LocationSummary::kCall); | 27 LocationSummary* result = new LocationSummary(0, 0, LocationSummary::kCall); |
| 28 result->set_out(Location::RegisterLocation(RAX)); | 28 result->set_out(Location::RegisterLocation(RAX)); |
| 29 return result; | 29 return result; |
| 30 } | 30 } |
| 31 | 31 |
| 32 | 32 |
| 33 void BindInstr::EmitNativeCode(FlowGraphCompiler* compiler) { | 33 void BindInstr::EmitNativeCode(FlowGraphCompiler* compiler) { |
| 34 computation()->EmitNativeCode(compiler); | 34 computation()->EmitNativeCode(compiler); |
| 35 if (is_used() && locs()->out().kind() == Location::kRegister) { | 35 if (is_used() && locs()->out().IsRegister()) { |
| 36 // TODO(vegorov): this should really happen only for comparisons fused | 36 // TODO(vegorov): this should really happen only for comparisons fused |
| 37 // with branches. Currrently IR does not provide an easy way to remove | 37 // with branches. Currrently IR does not provide an easy way to remove |
| 38 // instructions from the graph so we just leave fused comparison in it | 38 // instructions from the graph so we just leave fused comparison in it |
| 39 // but change its result location to be NoLocation. | 39 // but change its result location to be NoLocation. |
| 40 compiler->frame_register_allocator()->Push(locs()->out().reg(), this); | 40 compiler->frame_register_allocator()->Push(locs()->out().reg(), this); |
| 41 } | 41 } |
| 42 } | 42 } |
| 43 | 43 |
| 44 | 44 |
| 45 LocationSummary* ReturnInstr::MakeLocationSummary() const { | 45 LocationSummary* ReturnInstr::MakeLocationSummary() const { |
| (...skipping 102 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 148 } | 148 } |
| 149 | 149 |
| 150 | 150 |
| 151 LocationSummary* ConstantVal::MakeLocationSummary() const { | 151 LocationSummary* ConstantVal::MakeLocationSummary() const { |
| 152 return LocationSummary::Make(0, Location::RequiresRegister()); | 152 return LocationSummary::Make(0, Location::RequiresRegister()); |
| 153 } | 153 } |
| 154 | 154 |
| 155 | 155 |
| 156 void ConstantVal::EmitNativeCode(FlowGraphCompiler* compiler) { | 156 void ConstantVal::EmitNativeCode(FlowGraphCompiler* compiler) { |
| 157 Register result = locs()->out().reg(); | 157 Register result = locs()->out().reg(); |
| 158 if (value().IsSmi()) { | 158 __ LoadObject(result, value()); |
| 159 int64_t imm = reinterpret_cast<int64_t>(value().raw()); | |
| 160 __ movq(result, Immediate(imm)); | |
| 161 } else { | |
| 162 __ LoadObject(result, value()); | |
| 163 } | |
| 164 } | 159 } |
| 165 | 160 |
| 166 | 161 |
| 167 LocationSummary* AssertAssignableComp::MakeLocationSummary() const { | 162 LocationSummary* AssertAssignableComp::MakeLocationSummary() const { |
| 168 const intptr_t kNumInputs = 3; | 163 const intptr_t kNumInputs = 3; |
| 169 const intptr_t kNumTemps = 0; | 164 const intptr_t kNumTemps = 0; |
| 170 LocationSummary* summary = new LocationSummary(kNumInputs, | 165 LocationSummary* summary = new LocationSummary(kNumInputs, |
| 171 kNumTemps, | 166 kNumTemps, |
| 172 LocationSummary::kCall); | 167 LocationSummary::kCall); |
| 173 summary->set_in(0, Location::RegisterLocation(RAX)); // Value. | 168 summary->set_in(0, Location::RegisterLocation(RAX)); // Value. |
| (...skipping 267 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 441 LocationSummary* RelationalOpComp::MakeLocationSummary() const { | 436 LocationSummary* RelationalOpComp::MakeLocationSummary() const { |
| 442 const LocationSummary::ContainsBranch contains_branch = | 437 const LocationSummary::ContainsBranch contains_branch = |
| 443 is_fused_with_branch() ? LocationSummary::kBranch | 438 is_fused_with_branch() ? LocationSummary::kBranch |
| 444 : LocationSummary::kNoBranch; | 439 : LocationSummary::kNoBranch; |
| 445 | 440 |
| 446 if (operands_class_id() == kSmi || operands_class_id() == kDouble) { | 441 if (operands_class_id() == kSmi || operands_class_id() == kDouble) { |
| 447 const intptr_t kNumInputs = 2; | 442 const intptr_t kNumInputs = 2; |
| 448 const intptr_t kNumTemps = 1; | 443 const intptr_t kNumTemps = 1; |
| 449 LocationSummary* summary = new LocationSummary(kNumInputs, | 444 LocationSummary* summary = new LocationSummary(kNumInputs, |
| 450 kNumTemps, | 445 kNumTemps, |
| 451 LocationSummary::kCall, | 446 LocationSummary::kNoCall, |
| 452 contains_branch); | 447 contains_branch); |
| 453 summary->set_in(0, Location::RequiresRegister()); | 448 summary->set_in(0, Location::RequiresRegister()); |
| 454 summary->set_in(1, Location::RequiresRegister()); | 449 summary->set_in(1, Location::RequiresRegister()); |
| 455 if (!is_fused_with_branch()) { | 450 if (!is_fused_with_branch()) { |
| 456 summary->set_out(Location::RequiresRegister()); | 451 summary->set_out(Location::RequiresRegister()); |
| 457 } | 452 } |
| 458 summary->set_temp(0, Location::RequiresRegister()); | 453 summary->set_temp(0, Location::RequiresRegister()); |
| 459 return summary; | 454 return summary; |
| 460 } | 455 } |
| 461 ASSERT(!is_fused_with_branch()); | 456 ASSERT(!is_fused_with_branch()); |
| (...skipping 1512 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 1974 compiler->GenerateStaticCall(instance_call()->cid(), | 1969 compiler->GenerateStaticCall(instance_call()->cid(), |
| 1975 instance_call()->token_pos(), | 1970 instance_call()->token_pos(), |
| 1976 instance_call()->try_index(), | 1971 instance_call()->try_index(), |
| 1977 target, | 1972 target, |
| 1978 instance_call()->ArgumentCount(), | 1973 instance_call()->ArgumentCount(), |
| 1979 instance_call()->argument_names()); | 1974 instance_call()->argument_names()); |
| 1980 } | 1975 } |
| 1981 __ Bind(&done); | 1976 __ Bind(&done); |
| 1982 } | 1977 } |
| 1983 | 1978 |
| 1979 |
| 1984 } // namespace dart | 1980 } // namespace dart |
| 1985 | 1981 |
| 1986 #undef __ | 1982 #undef __ |
| 1987 | 1983 |
| 1988 #endif // defined TARGET_ARCH_X64 | 1984 #endif // defined TARGET_ARCH_X64 |
| OLD | NEW |