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

Side by Side Diff: runtime/vm/intermediate_language_arm.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_ARM. 5 #include "vm/globals.h" // Needed here to get TARGET_ARCH_ARM.
6 #if defined(TARGET_ARCH_ARM) 6 #if defined(TARGET_ARCH_ARM)
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 228 matching lines...) Expand 10 before | Expand all | Expand 10 after
239 // Check that the type of the value is allowed in conditional context. 239 // Check that the type of the value is allowed in conditional context.
240 // Call the runtime if the object is not bool::true or bool::false. 240 // Call the runtime if the object is not bool::true or bool::false.
241 ASSERT(locs->always_calls()); 241 ASSERT(locs->always_calls());
242 Label done; 242 Label done;
243 __ CompareObject(reg, Bool::True()); 243 __ CompareObject(reg, Bool::True());
244 __ b(&done, EQ); 244 __ b(&done, EQ);
245 __ CompareObject(reg, Bool::False()); 245 __ CompareObject(reg, Bool::False());
246 __ b(&done, EQ); 246 __ b(&done, EQ);
247 247
248 __ Push(reg); // Push the source object. 248 __ Push(reg); // Push the source object.
249 compiler->GenerateCallRuntime(token_pos, 249 compiler->GenerateRuntimeCall(token_pos,
250 deopt_id, 250 deopt_id,
251 kConditionTypeErrorRuntimeEntry, 251 kConditionTypeErrorRuntimeEntry,
252 1, 252 1,
253 locs); 253 locs);
254 // We should never return here. 254 // We should never return here.
255 __ bkpt(0); 255 __ bkpt(0);
256 __ Bind(&done); 256 __ Bind(&done);
257 } 257 }
258 258
259 259
(...skipping 1583 matching lines...) Expand 10 before | Expand all | Expand 10 after
1843 1843
1844 1844
1845 LocationSummary* 1845 LocationSummary*
1846 AllocateObjectWithBoundsCheckInstr::MakeLocationSummary() const { 1846 AllocateObjectWithBoundsCheckInstr::MakeLocationSummary() const {
1847 return MakeCallSummary(); 1847 return MakeCallSummary();
1848 } 1848 }
1849 1849
1850 1850
1851 void AllocateObjectWithBoundsCheckInstr::EmitNativeCode( 1851 void AllocateObjectWithBoundsCheckInstr::EmitNativeCode(
1852 FlowGraphCompiler* compiler) { 1852 FlowGraphCompiler* compiler) {
1853 compiler->GenerateCallRuntime(token_pos(), 1853 compiler->GenerateRuntimeCall(token_pos(),
1854 deopt_id(), 1854 deopt_id(),
1855 kAllocateObjectWithBoundsCheckRuntimeEntry, 1855 kAllocateObjectWithBoundsCheckRuntimeEntry,
1856 3, 1856 3,
1857 locs()); 1857 locs());
1858 __ Drop(3); 1858 __ Drop(3);
1859 ASSERT(locs()->out().reg() == R0); 1859 ASSERT(locs()->out().reg() == R0);
1860 __ Pop(R0); // Pop new instance. 1860 __ Pop(R0); // Pop new instance.
1861 } 1861 }
1862 1862
1863 1863
(...skipping 27 matching lines...) Expand all
1891 void InstantiateTypeInstr::EmitNativeCode(FlowGraphCompiler* compiler) { 1891 void InstantiateTypeInstr::EmitNativeCode(FlowGraphCompiler* compiler) {
1892 Register instantiator_reg = locs()->in(0).reg(); 1892 Register instantiator_reg = locs()->in(0).reg();
1893 Register result_reg = locs()->out().reg(); 1893 Register result_reg = locs()->out().reg();
1894 1894
1895 // 'instantiator_reg' is the instantiator AbstractTypeArguments object 1895 // 'instantiator_reg' is the instantiator AbstractTypeArguments object
1896 // (or null). 1896 // (or null).
1897 // A runtime call to instantiate the type is required. 1897 // A runtime call to instantiate the type is required.
1898 __ PushObject(Object::ZoneHandle()); // Make room for the result. 1898 __ PushObject(Object::ZoneHandle()); // Make room for the result.
1899 __ PushObject(type()); 1899 __ PushObject(type());
1900 __ Push(instantiator_reg); // Push instantiator type arguments. 1900 __ Push(instantiator_reg); // Push instantiator type arguments.
1901 compiler->GenerateCallRuntime(token_pos(), 1901 compiler->GenerateRuntimeCall(token_pos(),
1902 deopt_id(), 1902 deopt_id(),
1903 kInstantiateTypeRuntimeEntry, 1903 kInstantiateTypeRuntimeEntry,
1904 2, 1904 2,
1905 locs()); 1905 locs());
1906 __ Drop(2); // Drop instantiator and uninstantiated type. 1906 __ Drop(2); // Drop instantiator and uninstantiated type.
1907 __ Pop(result_reg); // Pop instantiated type. 1907 __ Pop(result_reg); // Pop instantiated type.
1908 ASSERT(instantiator_reg == result_reg); 1908 ASSERT(instantiator_reg == result_reg);
1909 } 1909 }
1910 1910
1911 1911
(...skipping 26 matching lines...) Expand all
1938 if (type_arguments().IsRawInstantiatedRaw(len)) { 1938 if (type_arguments().IsRawInstantiatedRaw(len)) {
1939 __ LoadImmediate(IP, reinterpret_cast<intptr_t>(Object::null())); 1939 __ LoadImmediate(IP, reinterpret_cast<intptr_t>(Object::null()));
1940 __ cmp(instantiator_reg, ShifterOperand(IP)); 1940 __ cmp(instantiator_reg, ShifterOperand(IP));
1941 __ b(&type_arguments_instantiated, EQ); 1941 __ b(&type_arguments_instantiated, EQ);
1942 } 1942 }
1943 // Instantiate non-null type arguments. 1943 // Instantiate non-null type arguments.
1944 // A runtime call to instantiate the type arguments is required. 1944 // A runtime call to instantiate the type arguments is required.
1945 __ PushObject(Object::ZoneHandle()); // Make room for the result. 1945 __ PushObject(Object::ZoneHandle()); // Make room for the result.
1946 __ PushObject(type_arguments()); 1946 __ PushObject(type_arguments());
1947 __ Push(instantiator_reg); // Push instantiator type arguments. 1947 __ Push(instantiator_reg); // Push instantiator type arguments.
1948 compiler->GenerateCallRuntime(token_pos(), 1948 compiler->GenerateRuntimeCall(token_pos(),
1949 deopt_id(), 1949 deopt_id(),
1950 kInstantiateTypeArgumentsRuntimeEntry, 1950 kInstantiateTypeArgumentsRuntimeEntry,
1951 2, 1951 2,
1952 locs()); 1952 locs());
1953 __ Drop(2); // Drop instantiator and uninstantiated type arguments. 1953 __ Drop(2); // Drop instantiator and uninstantiated type arguments.
1954 __ Pop(result_reg); // Pop instantiated type arguments. 1954 __ Pop(result_reg); // Pop instantiated type arguments.
1955 __ Bind(&type_arguments_instantiated); 1955 __ Bind(&type_arguments_instantiated);
1956 ASSERT(instantiator_reg == result_reg); 1956 ASSERT(instantiator_reg == result_reg);
1957 } 1957 }
1958 1958
(...skipping 115 matching lines...) Expand 10 before | Expand all | Expand 10 after
2074 return locs; 2074 return locs;
2075 } 2075 }
2076 2076
2077 2077
2078 void CloneContextInstr::EmitNativeCode(FlowGraphCompiler* compiler) { 2078 void CloneContextInstr::EmitNativeCode(FlowGraphCompiler* compiler) {
2079 Register context_value = locs()->in(0).reg(); 2079 Register context_value = locs()->in(0).reg();
2080 Register result = locs()->out().reg(); 2080 Register result = locs()->out().reg();
2081 2081
2082 __ PushObject(Object::ZoneHandle()); // Make room for the result. 2082 __ PushObject(Object::ZoneHandle()); // Make room for the result.
2083 __ Push(context_value); 2083 __ Push(context_value);
2084 compiler->GenerateCallRuntime(token_pos(), 2084 compiler->GenerateRuntimeCall(token_pos(),
2085 deopt_id(), 2085 deopt_id(),
2086 kCloneContextRuntimeEntry, 2086 kCloneContextRuntimeEntry,
2087 1, 2087 1,
2088 locs()); 2088 locs());
2089 __ Drop(1); // Remove argument. 2089 __ Drop(1); // Remove argument.
2090 __ Pop(result); // Get result (cloned context). 2090 __ Pop(result); // Get result (cloned context).
2091 } 2091 }
2092 2092
2093 2093
2094 LocationSummary* CatchBlockEntryInstr::MakeLocationSummary() const { 2094 LocationSummary* CatchBlockEntryInstr::MakeLocationSummary() const {
(...skipping 50 matching lines...) Expand 10 before | Expand all | Expand 10 after
2145 explicit CheckStackOverflowSlowPath(CheckStackOverflowInstr* instruction) 2145 explicit CheckStackOverflowSlowPath(CheckStackOverflowInstr* instruction)
2146 : instruction_(instruction) { } 2146 : instruction_(instruction) { }
2147 2147
2148 virtual void EmitNativeCode(FlowGraphCompiler* compiler) { 2148 virtual void EmitNativeCode(FlowGraphCompiler* compiler) {
2149 __ Comment("CheckStackOverflowSlowPath"); 2149 __ Comment("CheckStackOverflowSlowPath");
2150 __ Bind(entry_label()); 2150 __ Bind(entry_label());
2151 compiler->SaveLiveRegisters(instruction_->locs()); 2151 compiler->SaveLiveRegisters(instruction_->locs());
2152 // pending_deoptimization_env_ is needed to generate a runtime call that 2152 // pending_deoptimization_env_ is needed to generate a runtime call that
2153 // may throw an exception. 2153 // may throw an exception.
2154 ASSERT(compiler->pending_deoptimization_env_ == NULL); 2154 ASSERT(compiler->pending_deoptimization_env_ == NULL);
2155 compiler->pending_deoptimization_env_ = instruction_->env(); 2155 Environment* env = compiler->SlowPathEnvironmentFor(instruction_);
2156 compiler->GenerateCallRuntime(instruction_->token_pos(), 2156 compiler->pending_deoptimization_env_ = env;
2157 compiler->GenerateRuntimeCall(instruction_->token_pos(),
2157 instruction_->deopt_id(), 2158 instruction_->deopt_id(),
2158 kStackOverflowRuntimeEntry, 2159 kStackOverflowRuntimeEntry,
2159 0, 2160 0,
2160 instruction_->locs()); 2161 instruction_->locs());
2161 2162
2162 if (FLAG_use_osr && !compiler->is_optimizing() && instruction_->in_loop()) { 2163 if (FLAG_use_osr && !compiler->is_optimizing() && instruction_->in_loop()) {
2163 // In unoptimized code, record loop stack checks as possible OSR entries. 2164 // In unoptimized code, record loop stack checks as possible OSR entries.
2164 compiler->AddCurrentDescriptor(PcDescriptors::kOsrEntry, 2165 compiler->AddCurrentDescriptor(PcDescriptors::kOsrEntry,
2165 instruction_->deopt_id(), 2166 instruction_->deopt_id(),
2166 0); // No token position. 2167 0); // No token position.
(...skipping 2173 matching lines...) Expand 10 before | Expand all | Expand 10 after
4340 UNIMPLEMENTED(); 4341 UNIMPLEMENTED();
4341 } 4342 }
4342 4343
4343 4344
4344 LocationSummary* ThrowInstr::MakeLocationSummary() const { 4345 LocationSummary* ThrowInstr::MakeLocationSummary() const {
4345 return new LocationSummary(0, 0, LocationSummary::kCall); 4346 return new LocationSummary(0, 0, LocationSummary::kCall);
4346 } 4347 }
4347 4348
4348 4349
4349 void ThrowInstr::EmitNativeCode(FlowGraphCompiler* compiler) { 4350 void ThrowInstr::EmitNativeCode(FlowGraphCompiler* compiler) {
4350 compiler->GenerateCallRuntime(token_pos(), 4351 compiler->GenerateRuntimeCall(token_pos(),
4351 deopt_id(), 4352 deopt_id(),
4352 kThrowRuntimeEntry, 4353 kThrowRuntimeEntry,
4353 1, 4354 1,
4354 locs()); 4355 locs());
4355 __ bkpt(0); 4356 __ bkpt(0);
4356 } 4357 }
4357 4358
4358 4359
4359 LocationSummary* ReThrowInstr::MakeLocationSummary() const { 4360 LocationSummary* ReThrowInstr::MakeLocationSummary() const {
4360 return new LocationSummary(0, 0, LocationSummary::kCall); 4361 return new LocationSummary(0, 0, LocationSummary::kCall);
4361 } 4362 }
4362 4363
4363 4364
4364 void ReThrowInstr::EmitNativeCode(FlowGraphCompiler* compiler) { 4365 void ReThrowInstr::EmitNativeCode(FlowGraphCompiler* compiler) {
4365 compiler->SetNeedsStacktrace(catch_try_index()); 4366 compiler->SetNeedsStacktrace(catch_try_index());
4366 compiler->GenerateCallRuntime(token_pos(), 4367 compiler->GenerateRuntimeCall(token_pos(),
4367 deopt_id(), 4368 deopt_id(),
4368 kReThrowRuntimeEntry, 4369 kReThrowRuntimeEntry,
4369 2, 4370 2,
4370 locs()); 4371 locs());
4371 __ bkpt(0); 4372 __ bkpt(0);
4372 } 4373 }
4373 4374
4374 4375
4375 void GraphEntryInstr::EmitNativeCode(FlowGraphCompiler* compiler) { 4376 void GraphEntryInstr::EmitNativeCode(FlowGraphCompiler* compiler) {
4376 if (!compiler->CanFallThroughTo(normal_entry())) { 4377 if (!compiler->CanFallThroughTo(normal_entry())) {
(...skipping 246 matching lines...) Expand 10 before | Expand all | Expand 10 after
4623 compiler->GenerateCall(token_pos(), 4624 compiler->GenerateCall(token_pos(),
4624 &label, 4625 &label,
4625 PcDescriptors::kOther, 4626 PcDescriptors::kOther,
4626 locs()); 4627 locs());
4627 __ Drop(2); // Discard type arguments and receiver. 4628 __ Drop(2); // Discard type arguments and receiver.
4628 } 4629 }
4629 4630
4630 } // namespace dart 4631 } // namespace dart
4631 4632
4632 #endif // defined TARGET_ARCH_ARM 4633 #endif // defined TARGET_ARCH_ARM
OLDNEW

Powered by Google App Engine
This is Rietveld 408576698