| OLD | NEW |
| 1 // Copyright (c) 2014, the Dart project authors. Please see the AUTHORS file | 1 // Copyright (c) 2014, 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_ARM64. | 5 #include "vm/globals.h" // Needed here to get TARGET_ARCH_ARM64. |
| 6 #if defined(TARGET_ARCH_ARM64) | 6 #if defined(TARGET_ARCH_ARM64) |
| 7 | 7 |
| 8 #include "vm/intermediate_language.h" | 8 #include "vm/intermediate_language.h" |
| 9 | 9 |
| 10 #include "vm/dart_entry.h" | 10 #include "vm/dart_entry.h" |
| (...skipping 2167 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 2178 deopt_id(), | 2178 deopt_id(), |
| 2179 kInstantiateTypeArgumentsRuntimeEntry, | 2179 kInstantiateTypeArgumentsRuntimeEntry, |
| 2180 2, | 2180 2, |
| 2181 locs()); | 2181 locs()); |
| 2182 __ Drop(2); // Drop instantiator and uninstantiated type arguments. | 2182 __ Drop(2); // Drop instantiator and uninstantiated type arguments. |
| 2183 __ Pop(result_reg); // Pop instantiated type arguments. | 2183 __ Pop(result_reg); // Pop instantiated type arguments. |
| 2184 __ Bind(&type_arguments_instantiated); | 2184 __ Bind(&type_arguments_instantiated); |
| 2185 } | 2185 } |
| 2186 | 2186 |
| 2187 | 2187 |
| 2188 LocationSummary* AllocateUninitializedContextInstr::MakeLocationSummary( |
| 2189 Isolate* isolate, |
| 2190 bool opt) const { |
| 2191 ASSERT(opt); |
| 2192 const intptr_t kNumInputs = 0; |
| 2193 const intptr_t kNumTemps = 3; |
| 2194 LocationSummary* locs = new(isolate) LocationSummary( |
| 2195 isolate, kNumInputs, kNumTemps, LocationSummary::kCallOnSlowPath); |
| 2196 locs->set_temp(0, Location::RegisterLocation(R1)); |
| 2197 locs->set_temp(1, Location::RegisterLocation(R2)); |
| 2198 locs->set_temp(2, Location::RegisterLocation(R3)); |
| 2199 locs->set_out(0, Location::RegisterLocation(R0)); |
| 2200 return locs; |
| 2201 } |
| 2202 |
| 2203 |
| 2204 class AllocateContextSlowPath : public SlowPathCode { |
| 2205 public: |
| 2206 explicit AllocateContextSlowPath( |
| 2207 AllocateUninitializedContextInstr* instruction) |
| 2208 : instruction_(instruction) { } |
| 2209 |
| 2210 virtual void EmitNativeCode(FlowGraphCompiler* compiler) { |
| 2211 __ Comment("AllocateContextSlowPath"); |
| 2212 __ Bind(entry_label()); |
| 2213 |
| 2214 LocationSummary* locs = instruction_->locs(); |
| 2215 locs->live_registers()->Remove(locs->out(0)); |
| 2216 |
| 2217 compiler->SaveLiveRegisters(locs); |
| 2218 |
| 2219 __ LoadImmediate(R1, instruction_->num_context_variables(), PP); |
| 2220 StubCode* stub_code = compiler->isolate()->stub_code(); |
| 2221 const ExternalLabel label(stub_code->AllocateContextEntryPoint()); |
| 2222 compiler->GenerateCall(instruction_->token_pos(), |
| 2223 &label, |
| 2224 RawPcDescriptors::kOther, |
| 2225 locs); |
| 2226 ASSERT(instruction_->locs()->out(0).reg() == R0); |
| 2227 compiler->RestoreLiveRegisters(instruction_->locs()); |
| 2228 __ b(exit_label()); |
| 2229 } |
| 2230 |
| 2231 private: |
| 2232 AllocateUninitializedContextInstr* instruction_; |
| 2233 }; |
| 2234 |
| 2235 |
| 2236 |
| 2237 void AllocateUninitializedContextInstr::EmitNativeCode( |
| 2238 FlowGraphCompiler* compiler) { |
| 2239 Register temp0 = locs()->temp(0).reg(); |
| 2240 Register temp1 = locs()->temp(1).reg(); |
| 2241 Register temp2 = locs()->temp(2).reg(); |
| 2242 Register result = locs()->out(0).reg(); |
| 2243 // Try allocate the object. |
| 2244 AllocateContextSlowPath* slow_path = new AllocateContextSlowPath(this); |
| 2245 compiler->AddSlowPathCode(slow_path); |
| 2246 intptr_t instance_size = Context::InstanceSize(num_context_variables()); |
| 2247 |
| 2248 __ TryAllocateArray(kContextCid, instance_size, slow_path->entry_label(), |
| 2249 result, // instance |
| 2250 temp0, |
| 2251 temp1, |
| 2252 temp2); |
| 2253 |
| 2254 // Setup up number of context variables field. |
| 2255 __ LoadImmediate(temp0, num_context_variables(), PP); |
| 2256 __ str(temp0, FieldAddress(result, Context::num_variables_offset())); |
| 2257 |
| 2258 // Setup isolate field. |
| 2259 __ ldr(temp0, FieldAddress(CTX, Context::isolate_offset())); |
| 2260 __ str(temp0, FieldAddress(result, Context::isolate_offset())); |
| 2261 |
| 2262 __ Bind(slow_path->exit_label()); |
| 2263 } |
| 2264 |
| 2265 |
| 2188 LocationSummary* AllocateContextInstr::MakeLocationSummary(Isolate* isolate, | 2266 LocationSummary* AllocateContextInstr::MakeLocationSummary(Isolate* isolate, |
| 2189 bool opt) const { | 2267 bool opt) const { |
| 2190 const intptr_t kNumInputs = 0; | 2268 const intptr_t kNumInputs = 0; |
| 2191 const intptr_t kNumTemps = 1; | 2269 const intptr_t kNumTemps = 1; |
| 2192 LocationSummary* locs = new(isolate) LocationSummary( | 2270 LocationSummary* locs = new(isolate) LocationSummary( |
| 2193 isolate, kNumInputs, kNumTemps, LocationSummary::kCall); | 2271 isolate, kNumInputs, kNumTemps, LocationSummary::kCall); |
| 2194 locs->set_temp(0, Location::RegisterLocation(R1)); | 2272 locs->set_temp(0, Location::RegisterLocation(R1)); |
| 2195 locs->set_out(0, Location::RegisterLocation(R0)); | 2273 locs->set_out(0, Location::RegisterLocation(R0)); |
| 2196 return locs; | 2274 return locs; |
| 2197 } | 2275 } |
| (...skipping 3119 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 5317 compiler->GenerateCall(token_pos(), &label, stub_kind_, locs()); | 5395 compiler->GenerateCall(token_pos(), &label, stub_kind_, locs()); |
| 5318 #if defined(DEBUG) | 5396 #if defined(DEBUG) |
| 5319 __ LoadImmediate(R4, kInvalidObjectPointer, kNoPP); | 5397 __ LoadImmediate(R4, kInvalidObjectPointer, kNoPP); |
| 5320 __ LoadImmediate(R5, kInvalidObjectPointer, kNoPP); | 5398 __ LoadImmediate(R5, kInvalidObjectPointer, kNoPP); |
| 5321 #endif | 5399 #endif |
| 5322 } | 5400 } |
| 5323 | 5401 |
| 5324 } // namespace dart | 5402 } // namespace dart |
| 5325 | 5403 |
| 5326 #endif // defined TARGET_ARCH_ARM64 | 5404 #endif // defined TARGET_ARCH_ARM64 |
| OLD | NEW |