Chromium Code Reviews
chromiumcodereview-hr@appspot.gserviceaccount.com (chromiumcodereview-hr) | Please choose your nickname with Settings | Help | Chromium Project | Gerrit Changes | Sign out
(345)

Side by Side Diff: runtime/vm/intermediate_language_arm64.cc

Issue 2734323003: Re-landing of "replace TrySync with Metadata". (Closed)
Patch Set: Address review comments Created 3 years, 9 months ago
Use n/p to move between diff chunks; N/P to move between comments. Draft comments are only viewable by you.
Jump to:
View unified diff | Download patch
« no previous file with comments | « runtime/vm/intermediate_language_arm.cc ('k') | runtime/vm/intermediate_language_ia32.cc » ('j') | no next file with comments »
Toggle Intra-line Diffs ('i') | Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
OLDNEW
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/compiler.h" 10 #include "vm/compiler.h"
(...skipping 219 matching lines...) Expand 10 before | Expand all | Expand 10 after
230 ASSERT(locs()->in(0).reg() == R0); 230 ASSERT(locs()->in(0).reg() == R0);
231 __ LoadFieldFromOffset(CODE_REG, R0, Function::code_offset()); 231 __ LoadFieldFromOffset(CODE_REG, R0, Function::code_offset());
232 __ LoadFieldFromOffset(R2, R0, Function::entry_point_offset()); 232 __ LoadFieldFromOffset(R2, R0, Function::entry_point_offset());
233 233
234 // R2: instructions. 234 // R2: instructions.
235 // R5: Smi 0 (no IC data; the lazy-compile stub expects a GC-safe value). 235 // R5: Smi 0 (no IC data; the lazy-compile stub expects a GC-safe value).
236 __ LoadImmediate(R5, 0); 236 __ LoadImmediate(R5, 0);
237 //?? 237 //??
238 __ blr(R2); 238 __ blr(R2);
239 compiler->RecordSafepoint(locs()); 239 compiler->RecordSafepoint(locs());
240 compiler->EmitCatchEntryState();
240 // Marks either the continuation point in unoptimized code or the 241 // Marks either the continuation point in unoptimized code or the
241 // deoptimization point in optimized code, after call. 242 // deoptimization point in optimized code, after call.
242 const intptr_t deopt_id_after = Thread::ToDeoptAfter(deopt_id()); 243 const intptr_t deopt_id_after = Thread::ToDeoptAfter(deopt_id());
243 if (compiler->is_optimizing()) { 244 if (compiler->is_optimizing()) {
244 compiler->AddDeoptIndexAtCall(deopt_id_after); 245 compiler->AddDeoptIndexAtCall(deopt_id_after);
245 } 246 }
246 // Add deoptimization continuation point after the call and before the 247 // Add deoptimization continuation point after the call and before the
247 // arguments are removed. 248 // arguments are removed.
248 // In optimized code this descriptor is needed for exception handling. 249 // In optimized code this descriptor is needed for exception handling.
249 compiler->AddCurrentDescriptor(RawPcDescriptors::kDeopt, deopt_id_after, 250 compiler->AddCurrentDescriptor(RawPcDescriptors::kDeopt, deopt_id_after,
(...skipping 1949 matching lines...) Expand 10 before | Expand all | Expand 10 after
2199 kAllocateArrayRuntimeEntry, 2, locs()); 2200 kAllocateArrayRuntimeEntry, 2, locs());
2200 __ Drop(2); 2201 __ Drop(2);
2201 __ Pop(kResultReg); 2202 __ Pop(kResultReg);
2202 __ Bind(&done); 2203 __ Bind(&done);
2203 return; 2204 return;
2204 } 2205 }
2205 } 2206 }
2206 const Code& stub = Code::ZoneHandle(compiler->zone(), 2207 const Code& stub = Code::ZoneHandle(compiler->zone(),
2207 StubCode::AllocateArray_entry()->code()); 2208 StubCode::AllocateArray_entry()->code());
2208 compiler->AddStubCallTarget(stub); 2209 compiler->AddStubCallTarget(stub);
2209 compiler->GenerateCall(token_pos(), *StubCode::AllocateArray_entry(), 2210 compiler->GenerateCallWithDeopt(token_pos(), deopt_id(),
2210 RawPcDescriptors::kOther, locs()); 2211 *StubCode::AllocateArray_entry(),
2212 RawPcDescriptors::kOther, locs());
2211 ASSERT(locs()->out(0).reg() == kResultReg); 2213 ASSERT(locs()->out(0).reg() == kResultReg);
2212 } 2214 }
2213 2215
2214 2216
2215 LocationSummary* LoadFieldInstr::MakeLocationSummary(Zone* zone, 2217 LocationSummary* LoadFieldInstr::MakeLocationSummary(Zone* zone,
2216 bool opt) const { 2218 bool opt) const {
2217 const intptr_t kNumInputs = 1; 2219 const intptr_t kNumInputs = 1;
2218 const intptr_t kNumTemps = 2220 const intptr_t kNumTemps =
2219 (IsUnboxedLoad() && opt) ? 1 : ((IsPotentialUnboxedLoad()) ? 1 : 0); 2221 (IsUnboxedLoad() && opt) ? 1 : ((IsPotentialUnboxedLoad()) ? 1 : 0);
2220 LocationSummary* locs = new (zone) LocationSummary( 2222 LocationSummary* locs = new (zone) LocationSummary(
(...skipping 599 matching lines...) Expand 10 before | Expand all | Expand 10 after
2820 virtual void EmitNativeCode(FlowGraphCompiler* compiler) { 2822 virtual void EmitNativeCode(FlowGraphCompiler* compiler) {
2821 if (Assembler::EmittingComments()) { 2823 if (Assembler::EmittingComments()) {
2822 __ Comment("slow path smi operation"); 2824 __ Comment("slow path smi operation");
2823 } 2825 }
2824 __ Bind(entry_label()); 2826 __ Bind(entry_label());
2825 LocationSummary* locs = instruction_->locs(); 2827 LocationSummary* locs = instruction_->locs();
2826 Register result = locs->out(0).reg(); 2828 Register result = locs->out(0).reg();
2827 locs->live_registers()->Remove(Location::RegisterLocation(result)); 2829 locs->live_registers()->Remove(Location::RegisterLocation(result));
2828 2830
2829 compiler->SaveLiveRegisters(locs); 2831 compiler->SaveLiveRegisters(locs);
2832 if (instruction_->env() != NULL) {
2833 Environment* env = compiler->SlowPathEnvironmentFor(instruction_);
2834 compiler->pending_deoptimization_env_ = env;
2835 }
2830 __ Push(locs->in(0).reg()); 2836 __ Push(locs->in(0).reg());
2831 __ Push(locs->in(1).reg()); 2837 __ Push(locs->in(1).reg());
2832 compiler->EmitMegamorphicInstanceCall( 2838 compiler->EmitMegamorphicInstanceCall(
2833 *instruction_->call()->ic_data(), instruction_->call()->ArgumentCount(), 2839 *instruction_->call()->ic_data(), instruction_->call()->ArgumentCount(),
2834 instruction_->call()->deopt_id(), instruction_->call()->token_pos(), 2840 instruction_->call()->deopt_id(), instruction_->call()->token_pos(),
2835 locs, try_index_, 2841 locs, try_index_,
2836 /* slow_path_argument_count = */ 2); 2842 /* slow_path_argument_count = */ 2);
2837 __ mov(result, R0); 2843 __ mov(result, R0);
2838 compiler->RestoreLiveRegisters(locs); 2844 compiler->RestoreLiveRegisters(locs);
2839 __ b(exit_label()); 2845 __ b(exit_label());
2846 compiler->pending_deoptimization_env_ = NULL;
2840 } 2847 }
2841 2848
2842 private: 2849 private:
2843 CheckedSmiOpInstr* instruction_; 2850 CheckedSmiOpInstr* instruction_;
2844 intptr_t try_index_; 2851 intptr_t try_index_;
2845 }; 2852 };
2846 2853
2847 2854
2848 LocationSummary* CheckedSmiOpInstr::MakeLocationSummary(Zone* zone, 2855 LocationSummary* CheckedSmiOpInstr::MakeLocationSummary(Zone* zone,
2849 bool opt) const { 2856 bool opt) const {
(...skipping 107 matching lines...) Expand 10 before | Expand all | Expand 10 after
2957 virtual void EmitNativeCode(FlowGraphCompiler* compiler) { 2964 virtual void EmitNativeCode(FlowGraphCompiler* compiler) {
2958 if (Assembler::EmittingComments()) { 2965 if (Assembler::EmittingComments()) {
2959 __ Comment("slow path smi operation"); 2966 __ Comment("slow path smi operation");
2960 } 2967 }
2961 __ Bind(entry_label()); 2968 __ Bind(entry_label());
2962 LocationSummary* locs = instruction_->locs(); 2969 LocationSummary* locs = instruction_->locs();
2963 Register result = merged_ ? locs->temp(0).reg() : locs->out(0).reg(); 2970 Register result = merged_ ? locs->temp(0).reg() : locs->out(0).reg();
2964 locs->live_registers()->Remove(Location::RegisterLocation(result)); 2971 locs->live_registers()->Remove(Location::RegisterLocation(result));
2965 2972
2966 compiler->SaveLiveRegisters(locs); 2973 compiler->SaveLiveRegisters(locs);
2974 if (instruction_->env() != NULL) {
2975 Environment* env = compiler->SlowPathEnvironmentFor(instruction_);
2976 compiler->pending_deoptimization_env_ = env;
2977 }
2967 __ Push(locs->in(0).reg()); 2978 __ Push(locs->in(0).reg());
2968 __ Push(locs->in(1).reg()); 2979 __ Push(locs->in(1).reg());
2969 compiler->EmitMegamorphicInstanceCall( 2980 compiler->EmitMegamorphicInstanceCall(
2970 *instruction_->call()->ic_data(), instruction_->call()->ArgumentCount(), 2981 *instruction_->call()->ic_data(), instruction_->call()->ArgumentCount(),
2971 instruction_->call()->deopt_id(), instruction_->call()->token_pos(), 2982 instruction_->call()->deopt_id(), instruction_->call()->token_pos(),
2972 locs, try_index_, 2983 locs, try_index_,
2973 /* slow_path_argument_count = */ 2); 2984 /* slow_path_argument_count = */ 2);
2974 __ mov(result, R0); 2985 __ mov(result, R0);
2975 compiler->RestoreLiveRegisters(locs); 2986 compiler->RestoreLiveRegisters(locs);
2987 compiler->pending_deoptimization_env_ = NULL;
2976 if (merged_) { 2988 if (merged_) {
2977 __ CompareObject(result, Bool::True()); 2989 __ CompareObject(result, Bool::True());
2978 __ b( 2990 __ b(
2979 instruction_->is_negated() ? labels_.false_label : labels_.true_label, 2991 instruction_->is_negated() ? labels_.false_label : labels_.true_label,
2980 EQ); 2992 EQ);
2981 __ b(instruction_->is_negated() ? labels_.true_label 2993 __ b(instruction_->is_negated() ? labels_.true_label
2982 : labels_.false_label); 2994 : labels_.false_label);
2983 } else { 2995 } else {
2984 __ b(exit_label()); 2996 __ b(exit_label());
2985 } 2997 }
(...skipping 2553 matching lines...) Expand 10 before | Expand all | Expand 10 after
5539 public: 5551 public:
5540 RangeErrorSlowPath(GenericCheckBoundInstr* instruction, intptr_t try_index) 5552 RangeErrorSlowPath(GenericCheckBoundInstr* instruction, intptr_t try_index)
5541 : instruction_(instruction), try_index_(try_index) {} 5553 : instruction_(instruction), try_index_(try_index) {}
5542 5554
5543 virtual void EmitNativeCode(FlowGraphCompiler* compiler) { 5555 virtual void EmitNativeCode(FlowGraphCompiler* compiler) {
5544 if (Assembler::EmittingComments()) { 5556 if (Assembler::EmittingComments()) {
5545 __ Comment("slow path check bound operation"); 5557 __ Comment("slow path check bound operation");
5546 } 5558 }
5547 __ Bind(entry_label()); 5559 __ Bind(entry_label());
5548 LocationSummary* locs = instruction_->locs(); 5560 LocationSummary* locs = instruction_->locs();
5561 compiler->SaveLiveRegisters(locs);
5549 __ Push(locs->in(0).reg()); 5562 __ Push(locs->in(0).reg());
5550 __ Push(locs->in(1).reg()); 5563 __ Push(locs->in(1).reg());
5551 __ CallRuntime(kRangeErrorRuntimeEntry, 2); 5564 __ CallRuntime(kRangeErrorRuntimeEntry, 2);
5552 compiler->AddDescriptor( 5565 compiler->AddDescriptor(
5553 RawPcDescriptors::kOther, compiler->assembler()->CodeSize(), 5566 RawPcDescriptors::kOther, compiler->assembler()->CodeSize(),
5554 instruction_->deopt_id(), instruction_->token_pos(), try_index_); 5567 instruction_->deopt_id(), instruction_->token_pos(), try_index_);
5555 compiler->RecordSafepoint(locs, 2); 5568 compiler->RecordSafepoint(locs, 2);
5569 Environment* env = compiler->SlowPathEnvironmentFor(instruction_);
5570 compiler->EmitCatchEntryState(env, try_index_);
5556 __ brk(0); 5571 __ brk(0);
5557 } 5572 }
5558 5573
5559 private: 5574 private:
5560 GenericCheckBoundInstr* instruction_; 5575 GenericCheckBoundInstr* instruction_;
5561 intptr_t try_index_; 5576 intptr_t try_index_;
5562 }; 5577 };
5563 5578
5564 5579
5565 void GenericCheckBoundInstr::EmitNativeCode(FlowGraphCompiler* compiler) { 5580 void GenericCheckBoundInstr::EmitNativeCode(FlowGraphCompiler* compiler) {
(...skipping 453 matching lines...) Expand 10 before | Expand all | Expand 10 after
6019 compiler->GenerateRuntimeCall(TokenPosition::kNoSource, deopt_id(), 6034 compiler->GenerateRuntimeCall(TokenPosition::kNoSource, deopt_id(),
6020 kGrowRegExpStackRuntimeEntry, 1, locs()); 6035 kGrowRegExpStackRuntimeEntry, 1, locs());
6021 __ Drop(1); 6036 __ Drop(1);
6022 __ Pop(result); 6037 __ Pop(result);
6023 } 6038 }
6024 6039
6025 6040
6026 } // namespace dart 6041 } // namespace dart
6027 6042
6028 #endif // defined TARGET_ARCH_ARM64 6043 #endif // defined TARGET_ARCH_ARM64
OLDNEW
« no previous file with comments | « runtime/vm/intermediate_language_arm.cc ('k') | runtime/vm/intermediate_language_ia32.cc » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698