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_MIPS. | 5 #include "vm/globals.h" // Needed here to get TARGET_ARCH_MIPS. |
6 #if defined(TARGET_ARCH_MIPS) | 6 #if defined(TARGET_ARCH_MIPS) |
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 79 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
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 Zone* zone = compiler->zone(); | 97 Zone* zone = compiler->zone(); |
98 | 98 |
99 // Current PP, FP, and PC. | 99 // Current PP, FP, and PC. |
100 builder->AddPp(Function::Handle(zone, current->code().function()), slot_ix++); | 100 builder->AddPp(current->function(), slot_ix++); |
101 builder->AddCallerFp(slot_ix++); | 101 builder->AddCallerFp(slot_ix++); |
102 builder->AddReturnAddress(Function::Handle(zone, current->code().function()), | 102 builder->AddReturnAddress(current->function(), deopt_id(), slot_ix++); |
103 deopt_id(), | |
104 slot_ix++); | |
105 | 103 |
106 // Callee's PC marker is not used anymore. Pass Code::null() to set to 0. | 104 // Callee's PC marker is not used anymore. Pass Code::null() to set to 0. |
107 builder->AddPcMarker(Function::Handle(zone), slot_ix++); | 105 builder->AddPcMarker(Function::Handle(zone), slot_ix++); |
108 | 106 |
109 // Emit all values that are needed for materialization as a part of the | 107 // Emit all values that are needed for materialization as a part of the |
110 // expression stack for the bottom-most frame. This guarantees that GC | 108 // expression stack for the bottom-most frame. This guarantees that GC |
111 // will be able to find them during materialization. | 109 // will be able to find them during materialization. |
112 slot_ix = builder->EmitMaterializationArguments(slot_ix); | 110 slot_ix = builder->EmitMaterializationArguments(slot_ix); |
113 | 111 |
114 // For the innermost environment, set outgoing arguments and the locals. | 112 // For the innermost environment, set outgoing arguments and the locals. |
115 for (intptr_t i = current->Length() - 1; | 113 for (intptr_t i = current->Length() - 1; |
116 i >= current->fixed_parameter_count(); | 114 i >= current->fixed_parameter_count(); |
117 i--) { | 115 i--) { |
118 builder->AddCopy(current->ValueAt(i), current->LocationAt(i), slot_ix++); | 116 builder->AddCopy(current->ValueAt(i), current->LocationAt(i), slot_ix++); |
119 } | 117 } |
120 | 118 |
121 Environment* previous = current; | 119 Environment* previous = current; |
122 current = current->outer(); | 120 current = current->outer(); |
123 while (current != NULL) { | 121 while (current != NULL) { |
124 // PP, FP, and PC. | 122 // PP, FP, and PC. |
125 builder->AddPp( | 123 builder->AddPp(current->function(), slot_ix++); |
126 Function::Handle(zone, current->code().function()), slot_ix++); | |
127 builder->AddCallerFp(slot_ix++); | 124 builder->AddCallerFp(slot_ix++); |
128 | 125 |
129 // 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 |
130 // which is recorded in the outer environment. | 127 // which is recorded in the outer environment. |
131 builder->AddReturnAddress( | 128 builder->AddReturnAddress( |
132 Function::Handle(zone, current->code().function()), | 129 current->function(), |
133 Isolate::ToDeoptAfter(current->deopt_id()), | 130 Isolate::ToDeoptAfter(current->deopt_id()), |
134 slot_ix++); | 131 slot_ix++); |
135 | 132 |
136 // PC marker. | 133 // PC marker. |
137 builder->AddPcMarker(Function::Handle(zone, previous->code().function()), | 134 builder->AddPcMarker(previous->function(), slot_ix++); |
138 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 } |
147 | 143 |
148 // Set the locals, note that outgoing arguments are not in the environment. | 144 // Set the locals, note that outgoing arguments are not in the environment. |
(...skipping 11 matching lines...) Expand all Loading... |
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 builder->AddCallerFp(slot_ix++); | 162 builder->AddCallerFp(slot_ix++); |
167 builder->AddCallerPc(slot_ix++); | 163 builder->AddCallerPc(slot_ix++); |
168 | 164 |
169 // PC marker. | 165 // PC marker. |
170 builder->AddPcMarker(Function::Handle(zone, previous->code().function()), | 166 builder->AddPcMarker(previous->function(), slot_ix++); |
171 slot_ix++); | |
172 | 167 |
173 // For the outermost environment, set the incoming arguments. | 168 // For the outermost environment, set the incoming arguments. |
174 for (intptr_t i = previous->fixed_parameter_count() - 1; i >= 0; i--) { | 169 for (intptr_t i = previous->fixed_parameter_count() - 1; i >= 0; i--) { |
175 builder->AddCopy(previous->ValueAt(i), previous->LocationAt(i), slot_ix++); | 170 builder->AddCopy(previous->ValueAt(i), previous->LocationAt(i), slot_ix++); |
176 } | 171 } |
177 | 172 |
178 return builder->CreateDeoptInfo(deopt_table); | 173 return builder->CreateDeoptInfo(deopt_table); |
179 } | 174 } |
180 | 175 |
181 | 176 |
(...skipping 1682 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
1864 __ AddImmediate(SP, kDoubleSize); | 1859 __ AddImmediate(SP, kDoubleSize); |
1865 } | 1860 } |
1866 | 1861 |
1867 | 1862 |
1868 #undef __ | 1863 #undef __ |
1869 | 1864 |
1870 | 1865 |
1871 } // namespace dart | 1866 } // namespace dart |
1872 | 1867 |
1873 #endif // defined TARGET_ARCH_MIPS | 1868 #endif // defined TARGET_ARCH_MIPS |
OLD | NEW |