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_IA32. | 5 #include "vm/globals.h" // Needed here to get TARGET_ARCH_IA32. |
6 #if defined(TARGET_ARCH_IA32) | 6 #if defined(TARGET_ARCH_IA32) |
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 // Callee's PC marker is not used anymore. Pass Code::null() to set to 0. | 97 // Callee's PC marker is not used anymore. Pass Code::null() to set to 0. |
98 builder->AddPcMarker(Code::Handle(), slot_ix++); | 98 builder->AddPcMarker(Function::Handle(), slot_ix++); |
99 | 99 |
100 // Current FP and PC. | 100 // Current FP and PC. |
101 builder->AddCallerFp(slot_ix++); | 101 builder->AddCallerFp(slot_ix++); |
102 builder->AddReturnAddress(current->code(), deopt_id(), slot_ix++); | 102 builder->AddReturnAddress(Function::Handle(current->code().function()), |
| 103 deopt_id(), |
| 104 slot_ix++); |
103 | 105 |
104 // Emit all values that are needed for materialization as a part of the | 106 // Emit all values that are needed for materialization as a part of the |
105 // expression stack for the bottom-most frame. This guarantees that GC | 107 // expression stack for the bottom-most frame. This guarantees that GC |
106 // will be able to find them during materialization. | 108 // will be able to find them during materialization. |
107 slot_ix = builder->EmitMaterializationArguments(slot_ix); | 109 slot_ix = builder->EmitMaterializationArguments(slot_ix); |
108 | 110 |
109 // For the innermost environment, set outgoing arguments and the locals. | 111 // For the innermost environment, set outgoing arguments and the locals. |
110 for (intptr_t i = current->Length() - 1; | 112 for (intptr_t i = current->Length() - 1; |
111 i >= current->fixed_parameter_count(); | 113 i >= current->fixed_parameter_count(); |
112 i--) { | 114 i--) { |
113 builder->AddCopy(current->ValueAt(i), current->LocationAt(i), slot_ix++); | 115 builder->AddCopy(current->ValueAt(i), current->LocationAt(i), slot_ix++); |
114 } | 116 } |
115 | 117 |
116 // Current PC marker and caller FP. | 118 // Current PC marker and caller FP. |
117 builder->AddPcMarker(current->code(), slot_ix++); | 119 builder->AddPcMarker(Function::Handle(current->code().function()), slot_ix++); |
118 builder->AddCallerFp(slot_ix++); | 120 builder->AddCallerFp(slot_ix++); |
119 | 121 |
120 Environment* previous = current; | 122 Environment* previous = current; |
121 current = current->outer(); | 123 current = current->outer(); |
122 while (current != NULL) { | 124 while (current != NULL) { |
123 // For any outer environment the deopt id is that of the call instruction | 125 // For any outer environment the deopt id is that of the call instruction |
124 // which is recorded in the outer environment. | 126 // which is recorded in the outer environment. |
125 builder->AddReturnAddress(current->code(), | 127 builder->AddReturnAddress(Function::Handle(current->code().function()), |
126 Isolate::ToDeoptAfter(current->deopt_id()), | 128 Isolate::ToDeoptAfter(current->deopt_id()), |
127 slot_ix++); | 129 slot_ix++); |
128 | 130 |
129 // The values of outgoing arguments can be changed from the inlined call so | 131 // The values of outgoing arguments can be changed from the inlined call so |
130 // we must read them from the previous environment. | 132 // we must read them from the previous environment. |
131 for (intptr_t i = previous->fixed_parameter_count() - 1; i >= 0; i--) { | 133 for (intptr_t i = previous->fixed_parameter_count() - 1; i >= 0; i--) { |
132 builder->AddCopy(previous->ValueAt(i), | 134 builder->AddCopy(previous->ValueAt(i), |
133 previous->LocationAt(i), | 135 previous->LocationAt(i), |
134 slot_ix++); | 136 slot_ix++); |
135 } | 137 } |
136 | 138 |
137 // Set the locals, note that outgoing arguments are not in the environment. | 139 // Set the locals, note that outgoing arguments are not in the environment. |
138 for (intptr_t i = current->Length() - 1; | 140 for (intptr_t i = current->Length() - 1; |
139 i >= current->fixed_parameter_count(); | 141 i >= current->fixed_parameter_count(); |
140 i--) { | 142 i--) { |
141 builder->AddCopy(current->ValueAt(i), | 143 builder->AddCopy(current->ValueAt(i), |
142 current->LocationAt(i), | 144 current->LocationAt(i), |
143 slot_ix++); | 145 slot_ix++); |
144 } | 146 } |
145 | 147 |
146 // PC marker and caller FP. | 148 // PC marker and caller FP. |
147 builder->AddPcMarker(current->code(), slot_ix++); | 149 builder->AddPcMarker(Function::Handle(current->code().function()), |
| 150 slot_ix++); |
148 builder->AddCallerFp(slot_ix++); | 151 builder->AddCallerFp(slot_ix++); |
149 | 152 |
150 // Iterate on the outer environment. | 153 // Iterate on the outer environment. |
151 previous = current; | 154 previous = current; |
152 current = current->outer(); | 155 current = current->outer(); |
153 } | 156 } |
154 // The previous pointer is now the outermost environment. | 157 // The previous pointer is now the outermost environment. |
155 ASSERT(previous != NULL); | 158 ASSERT(previous != NULL); |
156 | 159 |
157 // For the outermost environment, set caller PC. | 160 // For the outermost environment, set caller PC. |
(...skipping 1683 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
1841 __ movups(reg, Address(ESP, 0)); | 1844 __ movups(reg, Address(ESP, 0)); |
1842 __ addl(ESP, Immediate(kFpuRegisterSize)); | 1845 __ addl(ESP, Immediate(kFpuRegisterSize)); |
1843 } | 1846 } |
1844 | 1847 |
1845 | 1848 |
1846 #undef __ | 1849 #undef __ |
1847 | 1850 |
1848 } // namespace dart | 1851 } // namespace dart |
1849 | 1852 |
1850 #endif // defined TARGET_ARCH_IA32 | 1853 #endif // defined TARGET_ARCH_IA32 |
OLD | NEW |