| OLD | NEW |
| 1 // Copyright (c) 2014, the Dart project authors. Please see the AUTHORS file | 1 // Copyright (c) 2014, 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_ARM64. | 5 #include "vm/globals.h" // Needed here to get TARGET_ARCH_ARM64. |
| 6 #if defined(TARGET_ARCH_ARM64) | 6 #if defined(TARGET_ARCH_ARM64) |
| 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 43 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 54 // where PushArgument is handled by BindInstr::EmitNativeCode. | 54 // where PushArgument is handled by BindInstr::EmitNativeCode. |
| 55 if (compiler->is_optimizing()) { | 55 if (compiler->is_optimizing()) { |
| 56 Location value = locs()->in(0); | 56 Location value = locs()->in(0); |
| 57 if (value.IsRegister()) { | 57 if (value.IsRegister()) { |
| 58 __ Push(value.reg()); | 58 __ Push(value.reg()); |
| 59 } else if (value.IsConstant()) { | 59 } else if (value.IsConstant()) { |
| 60 __ PushObject(value.constant(), PP); | 60 __ PushObject(value.constant(), PP); |
| 61 } else { | 61 } else { |
| 62 ASSERT(value.IsStackSlot()); | 62 ASSERT(value.IsStackSlot()); |
| 63 const intptr_t value_offset = value.ToStackSlotOffset(); | 63 const intptr_t value_offset = value.ToStackSlotOffset(); |
| 64 __ LoadFromOffset(TMP, FP, value_offset, PP); | 64 __ LoadFromOffset(TMP, value.base_reg(), value_offset, PP); |
| 65 __ Push(TMP); | 65 __ Push(TMP); |
| 66 } | 66 } |
| 67 } | 67 } |
| 68 } | 68 } |
| 69 | 69 |
| 70 | 70 |
| 71 LocationSummary* ReturnInstr::MakeLocationSummary(Isolate* isolate, | 71 LocationSummary* ReturnInstr::MakeLocationSummary(Isolate* isolate, |
| 72 bool opt) const { | 72 bool opt) const { |
| 73 const intptr_t kNumInputs = 1; | 73 const intptr_t kNumInputs = 1; |
| 74 const intptr_t kNumTemps = 0; | 74 const intptr_t kNumTemps = 0; |
| 75 LocationSummary* locs = new(isolate) LocationSummary( | 75 LocationSummary* locs = new(isolate) LocationSummary( |
| 76 isolate, kNumInputs, kNumTemps, LocationSummary::kNoCall); | 76 isolate, kNumInputs, kNumTemps, LocationSummary::kNoCall); |
| 77 locs->set_in(0, Location::RegisterLocation(R0)); | 77 locs->set_in(0, Location::RegisterLocation(R0)); |
| 78 return locs; | 78 return locs; |
| 79 } | 79 } |
| 80 | 80 |
| 81 | 81 |
| 82 // Attempt optimized compilation at return instruction instead of at the entry. | 82 // Attempt optimized compilation at return instruction instead of at the entry. |
| 83 // The entry needs to be patchable, no inlined objects are allowed in the area | 83 // The entry needs to be patchable, no inlined objects are allowed in the area |
| 84 // that will be overwritten by the patch instructions: a branch macro sequence. | 84 // that will be overwritten by the patch instructions: a branch macro sequence. |
| 85 void ReturnInstr::EmitNativeCode(FlowGraphCompiler* compiler) { | 85 void ReturnInstr::EmitNativeCode(FlowGraphCompiler* compiler) { |
| 86 const Register result = locs()->in(0).reg(); | 86 const Register result = locs()->in(0).reg(); |
| 87 ASSERT(result == R0); | 87 ASSERT(result == R0); |
| 88 |
| 89 if (is_intrinsic_) { |
| 90 // Intrinsics don't have a frame. |
| 91 __ ret(); |
| 92 return; |
| 93 } |
| 94 |
| 88 #if defined(DEBUG) | 95 #if defined(DEBUG) |
| 89 Label stack_ok; | 96 Label stack_ok; |
| 90 __ Comment("Stack Check"); | 97 __ Comment("Stack Check"); |
| 91 const intptr_t fp_sp_dist = | 98 const intptr_t fp_sp_dist = |
| 92 (kFirstLocalSlotFromFp + 1 - compiler->StackSize()) * kWordSize; | 99 (kFirstLocalSlotFromFp + 1 - compiler->StackSize()) * kWordSize; |
| 93 ASSERT(fp_sp_dist <= 0); | 100 ASSERT(fp_sp_dist <= 0); |
| 94 __ sub(R2, SP, Operand(FP)); | 101 __ sub(R2, SP, Operand(FP)); |
| 95 __ CompareImmediate(R2, fp_sp_dist, PP); | 102 __ CompareImmediate(R2, fp_sp_dist, PP); |
| 96 __ b(&stack_ok, EQ); | 103 __ b(&stack_ok, EQ); |
| 97 __ brk(0); | 104 __ brk(0); |
| (...skipping 5324 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 5422 compiler->GenerateCall(token_pos(), &label, stub_kind_, locs()); | 5429 compiler->GenerateCall(token_pos(), &label, stub_kind_, locs()); |
| 5423 #if defined(DEBUG) | 5430 #if defined(DEBUG) |
| 5424 __ LoadImmediate(R4, kInvalidObjectPointer, kNoPP); | 5431 __ LoadImmediate(R4, kInvalidObjectPointer, kNoPP); |
| 5425 __ LoadImmediate(R5, kInvalidObjectPointer, kNoPP); | 5432 __ LoadImmediate(R5, kInvalidObjectPointer, kNoPP); |
| 5426 #endif | 5433 #endif |
| 5427 } | 5434 } |
| 5428 | 5435 |
| 5429 } // namespace dart | 5436 } // namespace dart |
| 5430 | 5437 |
| 5431 #endif // defined TARGET_ARCH_ARM64 | 5438 #endif // defined TARGET_ARCH_ARM64 |
| OLD | NEW |