| 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 83 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 94 // Emit all kMaterializeObject instructions describing objects to be | 94 // Emit all kMaterializeObject instructions describing objects to be |
| 95 // materialized on the deoptimization as a prefix to the deoptimization info. | 95 // materialized on the deoptimization as a prefix to the deoptimization info. |
| 96 EmitMaterializations(deopt_env_, builder); | 96 EmitMaterializations(deopt_env_, builder); |
| 97 | 97 |
| 98 // The real frame starts here. | 98 // The real frame starts here. |
| 99 builder->MarkFrameStart(); | 99 builder->MarkFrameStart(); |
| 100 | 100 |
| 101 Zone* zone = compiler->zone(); | 101 Zone* zone = compiler->zone(); |
| 102 | 102 |
| 103 // Current PP, FP, and PC. | 103 // Current PP, FP, and PC. |
| 104 builder->AddPp(Function::Handle(zone, current->code().function()), slot_ix++); | 104 builder->AddPp(current->function(), slot_ix++); |
| 105 builder->AddPcMarker(Function::Handle(zone), slot_ix++); | 105 builder->AddPcMarker(Function::Handle(zone), slot_ix++); |
| 106 builder->AddCallerFp(slot_ix++); | 106 builder->AddCallerFp(slot_ix++); |
| 107 builder->AddReturnAddress(Function::Handle(zone, current->code().function()), | 107 builder->AddReturnAddress(current->function(), deopt_id(), slot_ix++); |
| 108 deopt_id(), | |
| 109 slot_ix++); | |
| 110 | 108 |
| 111 // Emit all values that are needed for materialization as a part of the | 109 // Emit all values that are needed for materialization as a part of the |
| 112 // expression stack for the bottom-most frame. This guarantees that GC | 110 // expression stack for the bottom-most frame. This guarantees that GC |
| 113 // will be able to find them during materialization. | 111 // will be able to find them during materialization. |
| 114 slot_ix = builder->EmitMaterializationArguments(slot_ix); | 112 slot_ix = builder->EmitMaterializationArguments(slot_ix); |
| 115 | 113 |
| 116 // For the innermost environment, set outgoing arguments and the locals. | 114 // For the innermost environment, set outgoing arguments and the locals. |
| 117 for (intptr_t i = current->Length() - 1; | 115 for (intptr_t i = current->Length() - 1; |
| 118 i >= current->fixed_parameter_count(); | 116 i >= current->fixed_parameter_count(); |
| 119 i--) { | 117 i--) { |
| 120 builder->AddCopy(current->ValueAt(i), current->LocationAt(i), slot_ix++); | 118 builder->AddCopy(current->ValueAt(i), current->LocationAt(i), slot_ix++); |
| 121 } | 119 } |
| 122 | 120 |
| 123 Environment* previous = current; | 121 Environment* previous = current; |
| 124 current = current->outer(); | 122 current = current->outer(); |
| 125 while (current != NULL) { | 123 while (current != NULL) { |
| 126 // PP, FP, and PC. | 124 // PP, FP, and PC. |
| 127 builder->AddPp(Function::Handle(zone, current->code().function()), | 125 builder->AddPp(current->function(), slot_ix++); |
| 128 slot_ix++); | 126 builder->AddPcMarker(previous->function(), slot_ix++); |
| 129 builder->AddPcMarker(Function::Handle(zone, previous->code().function()), | |
| 130 slot_ix++); | |
| 131 builder->AddCallerFp(slot_ix++); | 127 builder->AddCallerFp(slot_ix++); |
| 132 | 128 |
| 133 // For any outer environment the deopt id is that of the call instruction | 129 // For any outer environment the deopt id is that of the call instruction |
| 134 // which is recorded in the outer environment. | 130 // which is recorded in the outer environment. |
| 135 builder->AddReturnAddress( | 131 builder->AddReturnAddress( |
| 136 Function::Handle(zone, current->code().function()), | 132 current->function(), |
| 137 Isolate::ToDeoptAfter(current->deopt_id()), | 133 Isolate::ToDeoptAfter(current->deopt_id()), |
| 138 slot_ix++); | 134 slot_ix++); |
| 139 | 135 |
| 140 // The values of outgoing arguments can be changed from the inlined call so | 136 // The values of outgoing arguments can be changed from the inlined call so |
| 141 // we must read them from the previous environment. | 137 // we must read them from the previous environment. |
| 142 for (intptr_t i = previous->fixed_parameter_count() - 1; i >= 0; i--) { | 138 for (intptr_t i = previous->fixed_parameter_count() - 1; i >= 0; i--) { |
| 143 builder->AddCopy(previous->ValueAt(i), | 139 builder->AddCopy(previous->ValueAt(i), |
| 144 previous->LocationAt(i), | 140 previous->LocationAt(i), |
| 145 slot_ix++); | 141 slot_ix++); |
| 146 } | 142 } |
| (...skipping 10 matching lines...) Expand all Loading... |
| 157 // Iterate on the outer environment. | 153 // Iterate on the outer environment. |
| 158 previous = current; | 154 previous = current; |
| 159 current = current->outer(); | 155 current = current->outer(); |
| 160 } | 156 } |
| 161 // The previous pointer is now the outermost environment. | 157 // The previous pointer is now the outermost environment. |
| 162 ASSERT(previous != NULL); | 158 ASSERT(previous != NULL); |
| 163 | 159 |
| 164 // For the outermost environment, set caller PC, caller PP, and caller FP. | 160 // For the outermost environment, set caller PC, caller PP, and caller FP. |
| 165 builder->AddCallerPp(slot_ix++); | 161 builder->AddCallerPp(slot_ix++); |
| 166 // PC marker. | 162 // PC marker. |
| 167 builder->AddPcMarker(Function::Handle(zone, previous->code().function()), | 163 builder->AddPcMarker(previous->function(), slot_ix++); |
| 168 slot_ix++); | |
| 169 builder->AddCallerFp(slot_ix++); | 164 builder->AddCallerFp(slot_ix++); |
| 170 builder->AddCallerPc(slot_ix++); | 165 builder->AddCallerPc(slot_ix++); |
| 171 | 166 |
| 172 // For the outermost environment, set the incoming arguments. | 167 // For the outermost environment, set the incoming arguments. |
| 173 for (intptr_t i = previous->fixed_parameter_count() - 1; i >= 0; i--) { | 168 for (intptr_t i = previous->fixed_parameter_count() - 1; i >= 0; i--) { |
| 174 builder->AddCopy(previous->ValueAt(i), previous->LocationAt(i), slot_ix++); | 169 builder->AddCopy(previous->ValueAt(i), previous->LocationAt(i), slot_ix++); |
| 175 } | 170 } |
| 176 | 171 |
| 177 return builder->CreateDeoptInfo(deopt_table); | 172 return builder->CreateDeoptInfo(deopt_table); |
| 178 } | 173 } |
| (...skipping 1616 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 1795 __ movups(reg, Address(RSP, 0)); | 1790 __ movups(reg, Address(RSP, 0)); |
| 1796 __ AddImmediate(RSP, Immediate(kFpuRegisterSize)); | 1791 __ AddImmediate(RSP, Immediate(kFpuRegisterSize)); |
| 1797 } | 1792 } |
| 1798 | 1793 |
| 1799 | 1794 |
| 1800 #undef __ | 1795 #undef __ |
| 1801 | 1796 |
| 1802 } // namespace dart | 1797 } // namespace dart |
| 1803 | 1798 |
| 1804 #endif // defined TARGET_ARCH_X64 | 1799 #endif // defined TARGET_ARCH_X64 |
| OLD | NEW |