| OLD | NEW |
| 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/flow_graph_compiler.h" | 8 #include "vm/flow_graph_compiler.h" |
| 9 | 9 |
| 10 #include "vm/ast_printer.h" | 10 #include "vm/ast_printer.h" |
| (...skipping 77 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 88 Environment* current = deopt_env_; | 88 Environment* current = deopt_env_; |
| 89 | 89 |
| 90 // Emit all kMaterializeObject instructions describing objects to be | 90 // Emit all kMaterializeObject instructions describing objects to be |
| 91 // materialized on the deoptimization as a prefix to the deoptimization info. | 91 // materialized on the deoptimization as a prefix to the deoptimization info. |
| 92 EmitMaterializations(deopt_env_, builder); | 92 EmitMaterializations(deopt_env_, builder); |
| 93 | 93 |
| 94 // The real frame starts here. | 94 // The real frame starts here. |
| 95 builder->MarkFrameStart(); | 95 builder->MarkFrameStart(); |
| 96 | 96 |
| 97 // Current PP, FP, and PC. | 97 // Current PP, FP, and PC. |
| 98 builder->AddPp(current->code(), slot_ix++); | 98 builder->AddPp(Function::Handle(current->code().function()), slot_ix++); |
| 99 builder->AddPcMarker(Code::Handle(), slot_ix++); | 99 builder->AddPcMarker(Function::Handle(), slot_ix++); |
| 100 builder->AddCallerFp(slot_ix++); | 100 builder->AddCallerFp(slot_ix++); |
| 101 builder->AddReturnAddress(current->code(), deopt_id(), slot_ix++); | 101 builder->AddReturnAddress(Function::Handle(current->code().function()), |
| 102 deopt_id(), |
| 103 slot_ix++); |
| 102 | 104 |
| 103 // Emit all values that are needed for materialization as a part of the | 105 // Emit all values that are needed for materialization as a part of the |
| 104 // expression stack for the bottom-most frame. This guarantees that GC | 106 // expression stack for the bottom-most frame. This guarantees that GC |
| 105 // will be able to find them during materialization. | 107 // will be able to find them during materialization. |
| 106 slot_ix = builder->EmitMaterializationArguments(slot_ix); | 108 slot_ix = builder->EmitMaterializationArguments(slot_ix); |
| 107 | 109 |
| 108 // For the innermost environment, set outgoing arguments and the locals. | 110 // For the innermost environment, set outgoing arguments and the locals. |
| 109 for (intptr_t i = current->Length() - 1; | 111 for (intptr_t i = current->Length() - 1; |
| 110 i >= current->fixed_parameter_count(); | 112 i >= current->fixed_parameter_count(); |
| 111 i--) { | 113 i--) { |
| 112 builder->AddCopy(current->ValueAt(i), current->LocationAt(i), slot_ix++); | 114 builder->AddCopy(current->ValueAt(i), current->LocationAt(i), slot_ix++); |
| 113 } | 115 } |
| 114 | 116 |
| 115 Environment* previous = current; | 117 Environment* previous = current; |
| 116 current = current->outer(); | 118 current = current->outer(); |
| 117 while (current != NULL) { | 119 while (current != NULL) { |
| 118 // PP, FP, and PC. | 120 // PP, FP, and PC. |
| 119 builder->AddPp(current->code(), slot_ix++); | 121 builder->AddPp(Function::Handle(current->code().function()), slot_ix++); |
| 120 builder->AddPcMarker(previous->code(), slot_ix++); | 122 builder->AddPcMarker(Function::Handle(previous->code().function()), |
| 123 slot_ix++); |
| 121 builder->AddCallerFp(slot_ix++); | 124 builder->AddCallerFp(slot_ix++); |
| 122 | 125 |
| 123 // For any outer environment the deopt id is that of the call instruction | 126 // For any outer environment the deopt id is that of the call instruction |
| 124 // which is recorded in the outer environment. | 127 // which is recorded in the outer environment. |
| 125 builder->AddReturnAddress(current->code(), | 128 builder->AddReturnAddress(Function::Handle(current->code().function()), |
| 126 Isolate::ToDeoptAfter(current->deopt_id()), | 129 Isolate::ToDeoptAfter(current->deopt_id()), |
| 127 slot_ix++); | 130 slot_ix++); |
| 128 | 131 |
| 129 // The values of outgoing arguments can be changed from the inlined call so | 132 // The values of outgoing arguments can be changed from the inlined call so |
| 130 // we must read them from the previous environment. | 133 // we must read them from the previous environment. |
| 131 for (intptr_t i = previous->fixed_parameter_count() - 1; i >= 0; i--) { | 134 for (intptr_t i = previous->fixed_parameter_count() - 1; i >= 0; i--) { |
| 132 builder->AddCopy(previous->ValueAt(i), | 135 builder->AddCopy(previous->ValueAt(i), |
| 133 previous->LocationAt(i), | 136 previous->LocationAt(i), |
| 134 slot_ix++); | 137 slot_ix++); |
| 135 } | 138 } |
| (...skipping 10 matching lines...) Expand all Loading... |
| 146 // Iterate on the outer environment. | 149 // Iterate on the outer environment. |
| 147 previous = current; | 150 previous = current; |
| 148 current = current->outer(); | 151 current = current->outer(); |
| 149 } | 152 } |
| 150 // The previous pointer is now the outermost environment. | 153 // The previous pointer is now the outermost environment. |
| 151 ASSERT(previous != NULL); | 154 ASSERT(previous != NULL); |
| 152 | 155 |
| 153 // For the outermost environment, set caller PC, caller PP, and caller FP. | 156 // For the outermost environment, set caller PC, caller PP, and caller FP. |
| 154 builder->AddCallerPp(slot_ix++); | 157 builder->AddCallerPp(slot_ix++); |
| 155 // PC marker. | 158 // PC marker. |
| 156 builder->AddPcMarker(previous->code(), slot_ix++); | 159 builder->AddPcMarker(Function::Handle(previous->code().function()), |
| 160 slot_ix++); |
| 157 builder->AddCallerFp(slot_ix++); | 161 builder->AddCallerFp(slot_ix++); |
| 158 builder->AddCallerPc(slot_ix++); | 162 builder->AddCallerPc(slot_ix++); |
| 159 | 163 |
| 160 // For the outermost environment, set the incoming arguments. | 164 // For the outermost environment, set the incoming arguments. |
| 161 for (intptr_t i = previous->fixed_parameter_count() - 1; i >= 0; i--) { | 165 for (intptr_t i = previous->fixed_parameter_count() - 1; i >= 0; i--) { |
| 162 builder->AddCopy(previous->ValueAt(i), previous->LocationAt(i), slot_ix++); | 166 builder->AddCopy(previous->ValueAt(i), previous->LocationAt(i), slot_ix++); |
| 163 } | 167 } |
| 164 | 168 |
| 165 return builder->CreateDeoptInfo(deopt_table); | 169 return builder->CreateDeoptInfo(deopt_table); |
| 166 } | 170 } |
| (...skipping 1607 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 1774 __ movups(reg, Address(RSP, 0)); | 1778 __ movups(reg, Address(RSP, 0)); |
| 1775 __ AddImmediate(RSP, Immediate(kFpuRegisterSize), PP); | 1779 __ AddImmediate(RSP, Immediate(kFpuRegisterSize), PP); |
| 1776 } | 1780 } |
| 1777 | 1781 |
| 1778 | 1782 |
| 1779 #undef __ | 1783 #undef __ |
| 1780 | 1784 |
| 1781 } // namespace dart | 1785 } // namespace dart |
| 1782 | 1786 |
| 1783 #endif // defined TARGET_ARCH_X64 | 1787 #endif // defined TARGET_ARCH_X64 |
| OLD | NEW |