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

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

Issue 26823006: Record a correct deoptimization environment for slow-path code. (Closed) Base URL: https://dart.googlecode.com/svn/branches/bleeding_edge/dart
Patch Set: Use an environment value's representation to decide its size. Created 7 years, 2 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 | Annotate | Revision Log
OLDNEW
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/intermediate_language.h" 8 #include "vm/intermediate_language.h"
9 9
10 #include "vm/dart_entry.h" 10 #include "vm/dart_entry.h"
(...skipping 231 matching lines...) Expand 10 before | Expand all | Expand 10 after
242 LocationSummary* locs, 242 LocationSummary* locs,
243 FlowGraphCompiler* compiler) { 243 FlowGraphCompiler* compiler) {
244 // Check that the type of the value is allowed in conditional context. 244 // Check that the type of the value is allowed in conditional context.
245 // Call the runtime if the object is not bool::true or bool::false. 245 // Call the runtime if the object is not bool::true or bool::false.
246 ASSERT(locs->always_calls()); 246 ASSERT(locs->always_calls());
247 Label done; 247 Label done;
248 __ BranchEqual(reg, Bool::True(), &done); 248 __ BranchEqual(reg, Bool::True(), &done);
249 __ BranchEqual(reg, Bool::False(), &done); 249 __ BranchEqual(reg, Bool::False(), &done);
250 250
251 __ Push(reg); // Push the source object. 251 __ Push(reg); // Push the source object.
252 compiler->GenerateCallRuntime(token_pos, 252 compiler->GenerateRuntimeCall(token_pos,
253 deopt_id, 253 deopt_id,
254 kConditionTypeErrorRuntimeEntry, 254 kConditionTypeErrorRuntimeEntry,
255 1, 255 1,
256 locs); 256 locs);
257 // We should never return here. 257 // We should never return here.
258 __ break_(0); 258 __ break_(0);
259 __ Bind(&done); 259 __ Bind(&done);
260 } 260 }
261 261
262 262
(...skipping 1648 matching lines...) Expand 10 before | Expand all | Expand 10 after
1911 1911
1912 1912
1913 LocationSummary* 1913 LocationSummary*
1914 AllocateObjectWithBoundsCheckInstr::MakeLocationSummary() const { 1914 AllocateObjectWithBoundsCheckInstr::MakeLocationSummary() const {
1915 return MakeCallSummary(); 1915 return MakeCallSummary();
1916 } 1916 }
1917 1917
1918 1918
1919 void AllocateObjectWithBoundsCheckInstr::EmitNativeCode( 1919 void AllocateObjectWithBoundsCheckInstr::EmitNativeCode(
1920 FlowGraphCompiler* compiler) { 1920 FlowGraphCompiler* compiler) {
1921 compiler->GenerateCallRuntime(token_pos(), 1921 compiler->GenerateRuntimeCall(token_pos(),
1922 deopt_id(), 1922 deopt_id(),
1923 kAllocateObjectWithBoundsCheckRuntimeEntry, 1923 kAllocateObjectWithBoundsCheckRuntimeEntry,
1924 3, 1924 3,
1925 locs()); 1925 locs());
1926 __ Drop(3); 1926 __ Drop(3);
1927 ASSERT(locs()->out().reg() == V0); 1927 ASSERT(locs()->out().reg() == V0);
1928 __ Pop(V0); // Pop new instance. 1928 __ Pop(V0); // Pop new instance.
1929 } 1929 }
1930 1930
1931 1931
(...skipping 32 matching lines...) Expand 10 before | Expand all | Expand 10 after
1964 // (or null). 1964 // (or null).
1965 // A runtime call to instantiate the type is required. 1965 // A runtime call to instantiate the type is required.
1966 __ addiu(SP, SP, Immediate(-3 * kWordSize)); 1966 __ addiu(SP, SP, Immediate(-3 * kWordSize));
1967 __ LoadObject(TMP1, Object::ZoneHandle()); 1967 __ LoadObject(TMP1, Object::ZoneHandle());
1968 __ sw(TMP1, Address(SP, 2 * kWordSize)); // Make room for the result. 1968 __ sw(TMP1, Address(SP, 2 * kWordSize)); // Make room for the result.
1969 __ LoadObject(TMP1, type()); 1969 __ LoadObject(TMP1, type());
1970 __ sw(TMP1, Address(SP, 1 * kWordSize)); 1970 __ sw(TMP1, Address(SP, 1 * kWordSize));
1971 // Push instantiator type arguments. 1971 // Push instantiator type arguments.
1972 __ sw(instantiator_reg, Address(SP, 0 * kWordSize)); 1972 __ sw(instantiator_reg, Address(SP, 0 * kWordSize));
1973 1973
1974 compiler->GenerateCallRuntime(token_pos(), 1974 compiler->GenerateRuntimeCall(token_pos(),
1975 deopt_id(), 1975 deopt_id(),
1976 kInstantiateTypeRuntimeEntry, 1976 kInstantiateTypeRuntimeEntry,
1977 2, 1977 2,
1978 locs()); 1978 locs());
1979 // Pop instantiated type. 1979 // Pop instantiated type.
1980 __ lw(result_reg, Address(SP, 2 * kWordSize)); 1980 __ lw(result_reg, Address(SP, 2 * kWordSize));
1981 // Drop instantiator and uninstantiated type. 1981 // Drop instantiator and uninstantiated type.
1982 __ addiu(SP, SP, Immediate(3 * kWordSize)); 1982 __ addiu(SP, SP, Immediate(3 * kWordSize));
1983 ASSERT(instantiator_reg == result_reg); 1983 ASSERT(instantiator_reg == result_reg);
1984 } 1984 }
(...skipping 33 matching lines...) Expand 10 before | Expand all | Expand 10 after
2018 // Instantiate non-null type arguments. 2018 // Instantiate non-null type arguments.
2019 // A runtime call to instantiate the type arguments is required. 2019 // A runtime call to instantiate the type arguments is required.
2020 __ addiu(SP, SP, Immediate(-3 * kWordSize)); 2020 __ addiu(SP, SP, Immediate(-3 * kWordSize));
2021 __ LoadObject(TMP1, Object::ZoneHandle()); 2021 __ LoadObject(TMP1, Object::ZoneHandle());
2022 __ sw(TMP1, Address(SP, 2 * kWordSize)); // Make room for the result. 2022 __ sw(TMP1, Address(SP, 2 * kWordSize)); // Make room for the result.
2023 __ LoadObject(TMP1, type_arguments()); 2023 __ LoadObject(TMP1, type_arguments());
2024 __ sw(TMP1, Address(SP, 1 * kWordSize)); 2024 __ sw(TMP1, Address(SP, 1 * kWordSize));
2025 // Push instantiator type arguments. 2025 // Push instantiator type arguments.
2026 __ sw(instantiator_reg, Address(SP, 0 * kWordSize)); 2026 __ sw(instantiator_reg, Address(SP, 0 * kWordSize));
2027 2027
2028 compiler->GenerateCallRuntime(token_pos(), 2028 compiler->GenerateRuntimeCall(token_pos(),
2029 deopt_id(), 2029 deopt_id(),
2030 kInstantiateTypeArgumentsRuntimeEntry, 2030 kInstantiateTypeArgumentsRuntimeEntry,
2031 2, 2031 2,
2032 locs()); 2032 locs());
2033 // Pop instantiated type arguments. 2033 // Pop instantiated type arguments.
2034 __ lw(result_reg, Address(SP, 2 * kWordSize)); 2034 __ lw(result_reg, Address(SP, 2 * kWordSize));
2035 // Drop instantiator and uninstantiated type arguments. 2035 // Drop instantiator and uninstantiated type arguments.
2036 __ addiu(SP, SP, Immediate(3 * kWordSize)); 2036 __ addiu(SP, SP, Immediate(3 * kWordSize));
2037 __ Bind(&type_arguments_instantiated); 2037 __ Bind(&type_arguments_instantiated);
2038 ASSERT(instantiator_reg == result_reg); 2038 ASSERT(instantiator_reg == result_reg);
(...skipping 122 matching lines...) Expand 10 before | Expand all | Expand 10 after
2161 Register context_value = locs()->in(0).reg(); 2161 Register context_value = locs()->in(0).reg();
2162 Register result = locs()->out().reg(); 2162 Register result = locs()->out().reg();
2163 2163
2164 __ TraceSimMsg("CloneContextInstr"); 2164 __ TraceSimMsg("CloneContextInstr");
2165 2165
2166 __ addiu(SP, SP, Immediate(-2 * kWordSize)); 2166 __ addiu(SP, SP, Immediate(-2 * kWordSize));
2167 __ LoadObject(TMP1, Object::ZoneHandle()); // Make room for the result. 2167 __ LoadObject(TMP1, Object::ZoneHandle()); // Make room for the result.
2168 __ sw(TMP1, Address(SP, 1 * kWordSize)); 2168 __ sw(TMP1, Address(SP, 1 * kWordSize));
2169 __ sw(context_value, Address(SP, 0 * kWordSize)); 2169 __ sw(context_value, Address(SP, 0 * kWordSize));
2170 2170
2171 compiler->GenerateCallRuntime(token_pos(), 2171 compiler->GenerateRuntimeCall(token_pos(),
2172 deopt_id(), 2172 deopt_id(),
2173 kCloneContextRuntimeEntry, 2173 kCloneContextRuntimeEntry,
2174 1, 2174 1,
2175 locs()); 2175 locs());
2176 __ lw(result, Address(SP, 1 * kWordSize)); // Get result (cloned context). 2176 __ lw(result, Address(SP, 1 * kWordSize)); // Get result (cloned context).
2177 __ addiu(SP, SP, Immediate(2 * kWordSize)); 2177 __ addiu(SP, SP, Immediate(2 * kWordSize));
2178 } 2178 }
2179 2179
2180 2180
2181 LocationSummary* CatchBlockEntryInstr::MakeLocationSummary() const { 2181 LocationSummary* CatchBlockEntryInstr::MakeLocationSummary() const {
(...skipping 54 matching lines...) Expand 10 before | Expand all | Expand 10 after
2236 : instruction_(instruction) { } 2236 : instruction_(instruction) { }
2237 2237
2238 virtual void EmitNativeCode(FlowGraphCompiler* compiler) { 2238 virtual void EmitNativeCode(FlowGraphCompiler* compiler) {
2239 __ TraceSimMsg("CheckStackOverflowSlowPath"); 2239 __ TraceSimMsg("CheckStackOverflowSlowPath");
2240 __ Comment("CheckStackOverflowSlowPath"); 2240 __ Comment("CheckStackOverflowSlowPath");
2241 __ Bind(entry_label()); 2241 __ Bind(entry_label());
2242 compiler->SaveLiveRegisters(instruction_->locs()); 2242 compiler->SaveLiveRegisters(instruction_->locs());
2243 // pending_deoptimization_env_ is needed to generate a runtime call that 2243 // pending_deoptimization_env_ is needed to generate a runtime call that
2244 // may throw an exception. 2244 // may throw an exception.
2245 ASSERT(compiler->pending_deoptimization_env_ == NULL); 2245 ASSERT(compiler->pending_deoptimization_env_ == NULL);
2246 compiler->pending_deoptimization_env_ = instruction_->env(); 2246 Environment* env = compiler->SlowPathEnvironmentFor(instruction_);
2247 compiler->GenerateCallRuntime(instruction_->token_pos(), 2247 compiler->pending_deoptimization_env_ = env;
2248 compiler->GenerateRuntimeCall(instruction_->token_pos(),
2248 instruction_->deopt_id(), 2249 instruction_->deopt_id(),
2249 kStackOverflowRuntimeEntry, 2250 kStackOverflowRuntimeEntry,
2250 0, 2251 0,
2251 instruction_->locs()); 2252 instruction_->locs());
2252 2253
2253 if (FLAG_use_osr && !compiler->is_optimizing() && instruction_->in_loop()) { 2254 if (FLAG_use_osr && !compiler->is_optimizing() && instruction_->in_loop()) {
2254 // In unoptimized code, record loop stack checks as possible OSR entries. 2255 // In unoptimized code, record loop stack checks as possible OSR entries.
2255 compiler->AddCurrentDescriptor(PcDescriptors::kOsrEntry, 2256 compiler->AddCurrentDescriptor(PcDescriptors::kOsrEntry,
2256 instruction_->deopt_id(), 2257 instruction_->deopt_id(),
2257 0); // No token position. 2258 0); // No token position.
(...skipping 1473 matching lines...) Expand 10 before | Expand all | Expand 10 after
3731 } 3732 }
3732 3733
3733 3734
3734 LocationSummary* ThrowInstr::MakeLocationSummary() const { 3735 LocationSummary* ThrowInstr::MakeLocationSummary() const {
3735 return new LocationSummary(0, 0, LocationSummary::kCall); 3736 return new LocationSummary(0, 0, LocationSummary::kCall);
3736 } 3737 }
3737 3738
3738 3739
3739 3740
3740 void ThrowInstr::EmitNativeCode(FlowGraphCompiler* compiler) { 3741 void ThrowInstr::EmitNativeCode(FlowGraphCompiler* compiler) {
3741 compiler->GenerateCallRuntime(token_pos(), 3742 compiler->GenerateRuntimeCall(token_pos(),
3742 deopt_id(), 3743 deopt_id(),
3743 kThrowRuntimeEntry, 3744 kThrowRuntimeEntry,
3744 1, 3745 1,
3745 locs()); 3746 locs());
3746 __ break_(0); 3747 __ break_(0);
3747 } 3748 }
3748 3749
3749 3750
3750 LocationSummary* ReThrowInstr::MakeLocationSummary() const { 3751 LocationSummary* ReThrowInstr::MakeLocationSummary() const {
3751 return new LocationSummary(0, 0, LocationSummary::kCall); 3752 return new LocationSummary(0, 0, LocationSummary::kCall);
3752 } 3753 }
3753 3754
3754 3755
3755 void ReThrowInstr::EmitNativeCode(FlowGraphCompiler* compiler) { 3756 void ReThrowInstr::EmitNativeCode(FlowGraphCompiler* compiler) {
3756 compiler->SetNeedsStacktrace(catch_try_index()); 3757 compiler->SetNeedsStacktrace(catch_try_index());
3757 compiler->GenerateCallRuntime(token_pos(), 3758 compiler->GenerateRuntimeCall(token_pos(),
3758 deopt_id(), 3759 deopt_id(),
3759 kReThrowRuntimeEntry, 3760 kReThrowRuntimeEntry,
3760 2, 3761 2,
3761 locs()); 3762 locs());
3762 __ break_(0); 3763 __ break_(0);
3763 } 3764 }
3764 3765
3765 3766
3766 void GraphEntryInstr::EmitNativeCode(FlowGraphCompiler* compiler) { 3767 void GraphEntryInstr::EmitNativeCode(FlowGraphCompiler* compiler) {
3767 if (!compiler->CanFallThroughTo(normal_entry())) { 3768 if (!compiler->CanFallThroughTo(normal_entry())) {
(...skipping 282 matching lines...) Expand 10 before | Expand all | Expand 10 after
4050 compiler->GenerateCall(token_pos(), 4051 compiler->GenerateCall(token_pos(),
4051 &label, 4052 &label,
4052 PcDescriptors::kOther, 4053 PcDescriptors::kOther,
4053 locs()); 4054 locs());
4054 __ Drop(2); // Discard type arguments and receiver. 4055 __ Drop(2); // Discard type arguments and receiver.
4055 } 4056 }
4056 4057
4057 } // namespace dart 4058 } // namespace dart
4058 4059
4059 #endif // defined TARGET_ARCH_MIPS 4060 #endif // defined TARGET_ARCH_MIPS
OLDNEW

Powered by Google App Engine
This is Rietveld 408576698