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