OLD | NEW |
1 | 1 |
2 // Copyright (c) 2013, the Dart project authors. Please see the AUTHORS file | 2 // Copyright (c) 2013, the Dart project authors. Please see the AUTHORS file |
3 // for details. All rights reserved. Use of this source code is governed by a | 3 // for details. All rights reserved. Use of this source code is governed by a |
4 // BSD-style license that can be found in the LICENSE file. | 4 // BSD-style license that can be found in the LICENSE file. |
5 | 5 |
6 #include "vm/globals.h" // Needed here to get TARGET_ARCH_ARM. | 6 #include "vm/globals.h" // Needed here to get TARGET_ARCH_ARM. |
7 #if defined(TARGET_ARCH_ARM) | 7 #if defined(TARGET_ARCH_ARM) |
8 | 8 |
9 #include "vm/intermediate_language.h" | 9 #include "vm/intermediate_language.h" |
10 | 10 |
(...skipping 223 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
234 // R0: Function. | 234 // R0: Function. |
235 ASSERT(locs()->in(0).reg() == R0); | 235 ASSERT(locs()->in(0).reg() == R0); |
236 __ ldr(CODE_REG, FieldAddress(R0, Function::code_offset())); | 236 __ ldr(CODE_REG, FieldAddress(R0, Function::code_offset())); |
237 __ ldr(R2, FieldAddress(R0, Function::entry_point_offset())); | 237 __ ldr(R2, FieldAddress(R0, Function::entry_point_offset())); |
238 | 238 |
239 // R2: instructions entry point. | 239 // R2: instructions entry point. |
240 // R9: Smi 0 (no IC data; the lazy-compile stub expects a GC-safe value). | 240 // R9: Smi 0 (no IC data; the lazy-compile stub expects a GC-safe value). |
241 __ LoadImmediate(R9, 0); | 241 __ LoadImmediate(R9, 0); |
242 __ blx(R2); | 242 __ blx(R2); |
243 compiler->RecordSafepoint(locs()); | 243 compiler->RecordSafepoint(locs()); |
244 compiler->EmitCatchEntryState(); | |
245 // Marks either the continuation point in unoptimized code or the | 244 // Marks either the continuation point in unoptimized code or the |
246 // deoptimization point in optimized code, after call. | 245 // deoptimization point in optimized code, after call. |
247 const intptr_t deopt_id_after = Thread::ToDeoptAfter(deopt_id()); | 246 const intptr_t deopt_id_after = Thread::ToDeoptAfter(deopt_id()); |
248 if (compiler->is_optimizing()) { | 247 if (compiler->is_optimizing()) { |
249 compiler->AddDeoptIndexAtCall(deopt_id_after); | 248 compiler->AddDeoptIndexAtCall(deopt_id_after); |
250 } | 249 } |
251 // Add deoptimization continuation point after the call and before the | 250 // Add deoptimization continuation point after the call and before the |
252 // arguments are removed. | 251 // arguments are removed. |
253 // In optimized code this descriptor is needed for exception handling. | 252 // In optimized code this descriptor is needed for exception handling. |
254 compiler->AddCurrentDescriptor(RawPcDescriptors::kDeopt, deopt_id_after, | 253 compiler->AddCurrentDescriptor(RawPcDescriptors::kDeopt, deopt_id_after, |
(...skipping 2215 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
2470 kAllocateArrayRuntimeEntry, 2, locs()); | 2469 kAllocateArrayRuntimeEntry, 2, locs()); |
2471 __ Drop(2); | 2470 __ Drop(2); |
2472 __ Pop(kResultReg); | 2471 __ Pop(kResultReg); |
2473 __ Bind(&done); | 2472 __ Bind(&done); |
2474 return; | 2473 return; |
2475 } | 2474 } |
2476 } | 2475 } |
2477 const Code& stub = Code::ZoneHandle(compiler->zone(), | 2476 const Code& stub = Code::ZoneHandle(compiler->zone(), |
2478 StubCode::AllocateArray_entry()->code()); | 2477 StubCode::AllocateArray_entry()->code()); |
2479 compiler->AddStubCallTarget(stub); | 2478 compiler->AddStubCallTarget(stub); |
2480 compiler->GenerateCallWithDeopt(token_pos(), deopt_id(), | 2479 compiler->GenerateCall(token_pos(), *StubCode::AllocateArray_entry(), |
2481 *StubCode::AllocateArray_entry(), | 2480 RawPcDescriptors::kOther, locs()); |
2482 RawPcDescriptors::kOther, locs()); | |
2483 ASSERT(locs()->out(0).reg() == kResultReg); | 2481 ASSERT(locs()->out(0).reg() == kResultReg); |
2484 } | 2482 } |
2485 | 2483 |
2486 | 2484 |
2487 LocationSummary* LoadFieldInstr::MakeLocationSummary(Zone* zone, | 2485 LocationSummary* LoadFieldInstr::MakeLocationSummary(Zone* zone, |
2488 bool opt) const { | 2486 bool opt) const { |
2489 const intptr_t kNumInputs = 1; | 2487 const intptr_t kNumInputs = 1; |
2490 const intptr_t kNumTemps = | 2488 const intptr_t kNumTemps = |
2491 (IsUnboxedLoad() && opt) ? 1 : ((IsPotentialUnboxedLoad()) ? 3 : 0); | 2489 (IsUnboxedLoad() && opt) ? 1 : ((IsPotentialUnboxedLoad()) ? 3 : 0); |
2492 | 2490 |
(...skipping 629 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
3122 virtual void EmitNativeCode(FlowGraphCompiler* compiler) { | 3120 virtual void EmitNativeCode(FlowGraphCompiler* compiler) { |
3123 if (Assembler::EmittingComments()) { | 3121 if (Assembler::EmittingComments()) { |
3124 __ Comment("slow path smi operation"); | 3122 __ Comment("slow path smi operation"); |
3125 } | 3123 } |
3126 __ Bind(entry_label()); | 3124 __ Bind(entry_label()); |
3127 LocationSummary* locs = instruction_->locs(); | 3125 LocationSummary* locs = instruction_->locs(); |
3128 Register result = locs->out(0).reg(); | 3126 Register result = locs->out(0).reg(); |
3129 locs->live_registers()->Remove(Location::RegisterLocation(result)); | 3127 locs->live_registers()->Remove(Location::RegisterLocation(result)); |
3130 | 3128 |
3131 compiler->SaveLiveRegisters(locs); | 3129 compiler->SaveLiveRegisters(locs); |
3132 if (instruction_->env() != NULL) { | |
3133 Environment* env = compiler->SlowPathEnvironmentFor(instruction_); | |
3134 compiler->pending_deoptimization_env_ = env; | |
3135 } | |
3136 __ Push(locs->in(0).reg()); | 3130 __ Push(locs->in(0).reg()); |
3137 __ Push(locs->in(1).reg()); | 3131 __ Push(locs->in(1).reg()); |
3138 compiler->EmitMegamorphicInstanceCall( | 3132 compiler->EmitMegamorphicInstanceCall( |
3139 *instruction_->call()->ic_data(), instruction_->call()->ArgumentCount(), | 3133 *instruction_->call()->ic_data(), instruction_->call()->ArgumentCount(), |
3140 instruction_->call()->deopt_id(), instruction_->call()->token_pos(), | 3134 instruction_->call()->deopt_id(), instruction_->call()->token_pos(), |
3141 locs, try_index_, | 3135 locs, try_index_, |
3142 /* slow_path_argument_count = */ 2); | 3136 /* slow_path_argument_count = */ 2); |
3143 __ mov(result, Operand(R0)); | 3137 __ mov(result, Operand(R0)); |
3144 compiler->RestoreLiveRegisters(locs); | 3138 compiler->RestoreLiveRegisters(locs); |
3145 __ b(exit_label()); | 3139 __ b(exit_label()); |
3146 compiler->pending_deoptimization_env_ = NULL; | |
3147 } | 3140 } |
3148 | 3141 |
3149 private: | 3142 private: |
3150 CheckedSmiOpInstr* instruction_; | 3143 CheckedSmiOpInstr* instruction_; |
3151 intptr_t try_index_; | 3144 intptr_t try_index_; |
3152 }; | 3145 }; |
3153 | 3146 |
3154 | 3147 |
3155 LocationSummary* CheckedSmiOpInstr::MakeLocationSummary(Zone* zone, | 3148 LocationSummary* CheckedSmiOpInstr::MakeLocationSummary(Zone* zone, |
3156 bool opt) const { | 3149 bool opt) const { |
(...skipping 104 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
3261 virtual void EmitNativeCode(FlowGraphCompiler* compiler) { | 3254 virtual void EmitNativeCode(FlowGraphCompiler* compiler) { |
3262 if (Assembler::EmittingComments()) { | 3255 if (Assembler::EmittingComments()) { |
3263 __ Comment("slow path smi operation"); | 3256 __ Comment("slow path smi operation"); |
3264 } | 3257 } |
3265 __ Bind(entry_label()); | 3258 __ Bind(entry_label()); |
3266 LocationSummary* locs = instruction_->locs(); | 3259 LocationSummary* locs = instruction_->locs(); |
3267 Register result = merged_ ? locs->temp(0).reg() : locs->out(0).reg(); | 3260 Register result = merged_ ? locs->temp(0).reg() : locs->out(0).reg(); |
3268 locs->live_registers()->Remove(Location::RegisterLocation(result)); | 3261 locs->live_registers()->Remove(Location::RegisterLocation(result)); |
3269 | 3262 |
3270 compiler->SaveLiveRegisters(locs); | 3263 compiler->SaveLiveRegisters(locs); |
3271 if (instruction_->env() != NULL) { | |
3272 Environment* env = compiler->SlowPathEnvironmentFor(instruction_); | |
3273 compiler->pending_deoptimization_env_ = env; | |
3274 } | |
3275 __ Push(locs->in(0).reg()); | 3264 __ Push(locs->in(0).reg()); |
3276 __ Push(locs->in(1).reg()); | 3265 __ Push(locs->in(1).reg()); |
3277 compiler->EmitMegamorphicInstanceCall( | 3266 compiler->EmitMegamorphicInstanceCall( |
3278 *instruction_->call()->ic_data(), instruction_->call()->ArgumentCount(), | 3267 *instruction_->call()->ic_data(), instruction_->call()->ArgumentCount(), |
3279 instruction_->call()->deopt_id(), instruction_->call()->token_pos(), | 3268 instruction_->call()->deopt_id(), instruction_->call()->token_pos(), |
3280 locs, try_index_, | 3269 locs, try_index_, |
3281 /* slow_path_argument_count = */ 2); | 3270 /* slow_path_argument_count = */ 2); |
3282 __ mov(result, Operand(R0)); | 3271 __ mov(result, Operand(R0)); |
3283 compiler->RestoreLiveRegisters(locs); | 3272 compiler->RestoreLiveRegisters(locs); |
3284 compiler->pending_deoptimization_env_ = NULL; | |
3285 if (merged_) { | 3273 if (merged_) { |
3286 __ CompareObject(result, Bool::True()); | 3274 __ CompareObject(result, Bool::True()); |
3287 __ b( | 3275 __ b( |
3288 instruction_->is_negated() ? labels_.false_label : labels_.true_label, | 3276 instruction_->is_negated() ? labels_.false_label : labels_.true_label, |
3289 EQ); | 3277 EQ); |
3290 __ b(instruction_->is_negated() ? labels_.true_label | 3278 __ b(instruction_->is_negated() ? labels_.true_label |
3291 : labels_.false_label); | 3279 : labels_.false_label); |
3292 } else { | 3280 } else { |
3293 __ b(exit_label()); | 3281 __ b(exit_label()); |
3294 } | 3282 } |
(...skipping 3109 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
6404 public: | 6392 public: |
6405 RangeErrorSlowPath(GenericCheckBoundInstr* instruction, intptr_t try_index) | 6393 RangeErrorSlowPath(GenericCheckBoundInstr* instruction, intptr_t try_index) |
6406 : instruction_(instruction), try_index_(try_index) {} | 6394 : instruction_(instruction), try_index_(try_index) {} |
6407 | 6395 |
6408 virtual void EmitNativeCode(FlowGraphCompiler* compiler) { | 6396 virtual void EmitNativeCode(FlowGraphCompiler* compiler) { |
6409 if (Assembler::EmittingComments()) { | 6397 if (Assembler::EmittingComments()) { |
6410 __ Comment("slow path check bound operation"); | 6398 __ Comment("slow path check bound operation"); |
6411 } | 6399 } |
6412 __ Bind(entry_label()); | 6400 __ Bind(entry_label()); |
6413 LocationSummary* locs = instruction_->locs(); | 6401 LocationSummary* locs = instruction_->locs(); |
6414 compiler->SaveLiveRegisters(locs); | |
6415 __ Push(locs->in(0).reg()); | 6402 __ Push(locs->in(0).reg()); |
6416 __ Push(locs->in(1).reg()); | 6403 __ Push(locs->in(1).reg()); |
6417 __ CallRuntime(kRangeErrorRuntimeEntry, 2); | 6404 __ CallRuntime(kRangeErrorRuntimeEntry, 2); |
6418 compiler->AddDescriptor( | 6405 compiler->AddDescriptor( |
6419 RawPcDescriptors::kOther, compiler->assembler()->CodeSize(), | 6406 RawPcDescriptors::kOther, compiler->assembler()->CodeSize(), |
6420 instruction_->deopt_id(), instruction_->token_pos(), try_index_); | 6407 instruction_->deopt_id(), instruction_->token_pos(), try_index_); |
6421 compiler->RecordSafepoint(locs, 2); | 6408 compiler->RecordSafepoint(locs, 2); |
6422 Environment* env = compiler->SlowPathEnvironmentFor(instruction_); | |
6423 compiler->EmitCatchEntryState(env, try_index_); | |
6424 __ bkpt(0); | 6409 __ bkpt(0); |
6425 } | 6410 } |
6426 | 6411 |
6427 private: | 6412 private: |
6428 GenericCheckBoundInstr* instruction_; | 6413 GenericCheckBoundInstr* instruction_; |
6429 intptr_t try_index_; | 6414 intptr_t try_index_; |
6430 }; | 6415 }; |
6431 | 6416 |
6432 | 6417 |
6433 void GenericCheckBoundInstr::EmitNativeCode(FlowGraphCompiler* compiler) { | 6418 void GenericCheckBoundInstr::EmitNativeCode(FlowGraphCompiler* compiler) { |
(...skipping 807 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
7241 compiler->GenerateRuntimeCall(TokenPosition::kNoSource, deopt_id(), | 7226 compiler->GenerateRuntimeCall(TokenPosition::kNoSource, deopt_id(), |
7242 kGrowRegExpStackRuntimeEntry, 1, locs()); | 7227 kGrowRegExpStackRuntimeEntry, 1, locs()); |
7243 __ Drop(1); | 7228 __ Drop(1); |
7244 __ Pop(result); | 7229 __ Pop(result); |
7245 } | 7230 } |
7246 | 7231 |
7247 | 7232 |
7248 } // namespace dart | 7233 } // namespace dart |
7249 | 7234 |
7250 #endif // defined TARGET_ARCH_ARM | 7235 #endif // defined TARGET_ARCH_ARM |
OLD | NEW |