| OLD | NEW |
| 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_IA32. | 5 #include "vm/globals.h" // Needed here to get TARGET_ARCH_IA32. |
| 6 #if defined(TARGET_ARCH_IA32) | 6 #if defined(TARGET_ARCH_IA32) |
| 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 176 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 187 // Check that the type of the value is allowed in conditional context. | 187 // Check that the type of the value is allowed in conditional context. |
| 188 // Call the runtime if the object is not bool::true or bool::false. | 188 // Call the runtime if the object is not bool::true or bool::false. |
| 189 ASSERT(locs->always_calls()); | 189 ASSERT(locs->always_calls()); |
| 190 Label done; | 190 Label done; |
| 191 __ CompareObject(reg, Bool::True()); | 191 __ CompareObject(reg, Bool::True()); |
| 192 __ j(EQUAL, &done, Assembler::kNearJump); | 192 __ j(EQUAL, &done, Assembler::kNearJump); |
| 193 __ CompareObject(reg, Bool::False()); | 193 __ CompareObject(reg, Bool::False()); |
| 194 __ j(EQUAL, &done, Assembler::kNearJump); | 194 __ j(EQUAL, &done, Assembler::kNearJump); |
| 195 | 195 |
| 196 __ pushl(reg); // Push the source object. | 196 __ pushl(reg); // Push the source object. |
| 197 compiler->GenerateCallRuntime(token_pos, | 197 compiler->GenerateRuntimeCall(token_pos, |
| 198 deopt_id, | 198 deopt_id, |
| 199 kConditionTypeErrorRuntimeEntry, | 199 kConditionTypeErrorRuntimeEntry, |
| 200 1, | 200 1, |
| 201 locs); | 201 locs); |
| 202 // We should never return here. | 202 // We should never return here. |
| 203 __ int3(); | 203 __ int3(); |
| 204 __ Bind(&done); | 204 __ Bind(&done); |
| 205 } | 205 } |
| 206 | 206 |
| 207 | 207 |
| (...skipping 1718 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 1926 | 1926 |
| 1927 | 1927 |
| 1928 LocationSummary* | 1928 LocationSummary* |
| 1929 AllocateObjectWithBoundsCheckInstr::MakeLocationSummary() const { | 1929 AllocateObjectWithBoundsCheckInstr::MakeLocationSummary() const { |
| 1930 return MakeCallSummary(); | 1930 return MakeCallSummary(); |
| 1931 } | 1931 } |
| 1932 | 1932 |
| 1933 | 1933 |
| 1934 void AllocateObjectWithBoundsCheckInstr::EmitNativeCode( | 1934 void AllocateObjectWithBoundsCheckInstr::EmitNativeCode( |
| 1935 FlowGraphCompiler* compiler) { | 1935 FlowGraphCompiler* compiler) { |
| 1936 compiler->GenerateCallRuntime(token_pos(), | 1936 compiler->GenerateRuntimeCall(token_pos(), |
| 1937 deopt_id(), | 1937 deopt_id(), |
| 1938 kAllocateObjectWithBoundsCheckRuntimeEntry, | 1938 kAllocateObjectWithBoundsCheckRuntimeEntry, |
| 1939 3, | 1939 3, |
| 1940 locs()); | 1940 locs()); |
| 1941 __ Drop(3); | 1941 __ Drop(3); |
| 1942 ASSERT(locs()->out().reg() == EAX); | 1942 ASSERT(locs()->out().reg() == EAX); |
| 1943 __ popl(EAX); // Pop new instance. | 1943 __ popl(EAX); // Pop new instance. |
| 1944 } | 1944 } |
| 1945 | 1945 |
| 1946 | 1946 |
| (...skipping 26 matching lines...) Expand all Loading... |
| 1973 void InstantiateTypeInstr::EmitNativeCode(FlowGraphCompiler* compiler) { | 1973 void InstantiateTypeInstr::EmitNativeCode(FlowGraphCompiler* compiler) { |
| 1974 Register instantiator_reg = locs()->in(0).reg(); | 1974 Register instantiator_reg = locs()->in(0).reg(); |
| 1975 Register result_reg = locs()->out().reg(); | 1975 Register result_reg = locs()->out().reg(); |
| 1976 | 1976 |
| 1977 // 'instantiator_reg' is the instantiator AbstractTypeArguments object | 1977 // 'instantiator_reg' is the instantiator AbstractTypeArguments object |
| 1978 // (or null). | 1978 // (or null). |
| 1979 // A runtime call to instantiate the type is required. | 1979 // A runtime call to instantiate the type is required. |
| 1980 __ PushObject(Object::ZoneHandle()); // Make room for the result. | 1980 __ PushObject(Object::ZoneHandle()); // Make room for the result. |
| 1981 __ PushObject(type()); | 1981 __ PushObject(type()); |
| 1982 __ pushl(instantiator_reg); // Push instantiator type arguments. | 1982 __ pushl(instantiator_reg); // Push instantiator type arguments. |
| 1983 compiler->GenerateCallRuntime(token_pos(), | 1983 compiler->GenerateRuntimeCall(token_pos(), |
| 1984 deopt_id(), | 1984 deopt_id(), |
| 1985 kInstantiateTypeRuntimeEntry, | 1985 kInstantiateTypeRuntimeEntry, |
| 1986 2, | 1986 2, |
| 1987 locs()); | 1987 locs()); |
| 1988 __ Drop(2); // Drop instantiator and uninstantiated type. | 1988 __ Drop(2); // Drop instantiator and uninstantiated type. |
| 1989 __ popl(result_reg); // Pop instantiated type. | 1989 __ popl(result_reg); // Pop instantiated type. |
| 1990 ASSERT(instantiator_reg == result_reg); | 1990 ASSERT(instantiator_reg == result_reg); |
| 1991 } | 1991 } |
| 1992 | 1992 |
| 1993 | 1993 |
| (...skipping 27 matching lines...) Expand all Loading... |
| 2021 const Immediate& raw_null = | 2021 const Immediate& raw_null = |
| 2022 Immediate(reinterpret_cast<intptr_t>(Object::null())); | 2022 Immediate(reinterpret_cast<intptr_t>(Object::null())); |
| 2023 __ cmpl(instantiator_reg, raw_null); | 2023 __ cmpl(instantiator_reg, raw_null); |
| 2024 __ j(EQUAL, &type_arguments_instantiated, Assembler::kNearJump); | 2024 __ j(EQUAL, &type_arguments_instantiated, Assembler::kNearJump); |
| 2025 } | 2025 } |
| 2026 // Instantiate non-null type arguments. | 2026 // Instantiate non-null type arguments. |
| 2027 // A runtime call to instantiate the type arguments is required. | 2027 // A runtime call to instantiate the type arguments is required. |
| 2028 __ PushObject(Object::ZoneHandle()); // Make room for the result. | 2028 __ PushObject(Object::ZoneHandle()); // Make room for the result. |
| 2029 __ PushObject(type_arguments()); | 2029 __ PushObject(type_arguments()); |
| 2030 __ pushl(instantiator_reg); // Push instantiator type arguments. | 2030 __ pushl(instantiator_reg); // Push instantiator type arguments. |
| 2031 compiler->GenerateCallRuntime(token_pos(), | 2031 compiler->GenerateRuntimeCall(token_pos(), |
| 2032 deopt_id(), | 2032 deopt_id(), |
| 2033 kInstantiateTypeArgumentsRuntimeEntry, | 2033 kInstantiateTypeArgumentsRuntimeEntry, |
| 2034 2, | 2034 2, |
| 2035 locs()); | 2035 locs()); |
| 2036 __ Drop(2); // Drop instantiator and uninstantiated type arguments. | 2036 __ Drop(2); // Drop instantiator and uninstantiated type arguments. |
| 2037 __ popl(result_reg); // Pop instantiated type arguments. | 2037 __ popl(result_reg); // Pop instantiated type arguments. |
| 2038 __ Bind(&type_arguments_instantiated); | 2038 __ Bind(&type_arguments_instantiated); |
| 2039 ASSERT(instantiator_reg == result_reg); | 2039 ASSERT(instantiator_reg == result_reg); |
| 2040 } | 2040 } |
| 2041 | 2041 |
| (...skipping 117 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 2159 return locs; | 2159 return locs; |
| 2160 } | 2160 } |
| 2161 | 2161 |
| 2162 | 2162 |
| 2163 void CloneContextInstr::EmitNativeCode(FlowGraphCompiler* compiler) { | 2163 void CloneContextInstr::EmitNativeCode(FlowGraphCompiler* compiler) { |
| 2164 Register context_value = locs()->in(0).reg(); | 2164 Register context_value = locs()->in(0).reg(); |
| 2165 Register result = locs()->out().reg(); | 2165 Register result = locs()->out().reg(); |
| 2166 | 2166 |
| 2167 __ PushObject(Object::ZoneHandle()); // Make room for the result. | 2167 __ PushObject(Object::ZoneHandle()); // Make room for the result. |
| 2168 __ pushl(context_value); | 2168 __ pushl(context_value); |
| 2169 compiler->GenerateCallRuntime(token_pos(), | 2169 compiler->GenerateRuntimeCall(token_pos(), |
| 2170 deopt_id(), | 2170 deopt_id(), |
| 2171 kCloneContextRuntimeEntry, | 2171 kCloneContextRuntimeEntry, |
| 2172 1, | 2172 1, |
| 2173 locs()); | 2173 locs()); |
| 2174 __ popl(result); // Remove argument. | 2174 __ popl(result); // Remove argument. |
| 2175 __ popl(result); // Get result (cloned context). | 2175 __ popl(result); // Get result (cloned context). |
| 2176 } | 2176 } |
| 2177 | 2177 |
| 2178 | 2178 |
| 2179 LocationSummary* CatchBlockEntryInstr::MakeLocationSummary() const { | 2179 LocationSummary* CatchBlockEntryInstr::MakeLocationSummary() const { |
| (...skipping 45 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 2225 explicit CheckStackOverflowSlowPath(CheckStackOverflowInstr* instruction) | 2225 explicit CheckStackOverflowSlowPath(CheckStackOverflowInstr* instruction) |
| 2226 : instruction_(instruction) { } | 2226 : instruction_(instruction) { } |
| 2227 | 2227 |
| 2228 virtual void EmitNativeCode(FlowGraphCompiler* compiler) { | 2228 virtual void EmitNativeCode(FlowGraphCompiler* compiler) { |
| 2229 __ Comment("CheckStackOverflowSlowPath"); | 2229 __ Comment("CheckStackOverflowSlowPath"); |
| 2230 __ Bind(entry_label()); | 2230 __ Bind(entry_label()); |
| 2231 compiler->SaveLiveRegisters(instruction_->locs()); | 2231 compiler->SaveLiveRegisters(instruction_->locs()); |
| 2232 // pending_deoptimization_env_ is needed to generate a runtime call that | 2232 // pending_deoptimization_env_ is needed to generate a runtime call that |
| 2233 // may throw an exception. | 2233 // may throw an exception. |
| 2234 ASSERT(compiler->pending_deoptimization_env_ == NULL); | 2234 ASSERT(compiler->pending_deoptimization_env_ == NULL); |
| 2235 compiler->pending_deoptimization_env_ = instruction_->env(); | 2235 Environment* env = compiler->SlowPathEnvironmentFor(instruction_); |
| 2236 compiler->GenerateCallRuntime(instruction_->token_pos(), | 2236 compiler->pending_deoptimization_env_ = env; |
| 2237 compiler->GenerateRuntimeCall(instruction_->token_pos(), |
| 2237 instruction_->deopt_id(), | 2238 instruction_->deopt_id(), |
| 2238 kStackOverflowRuntimeEntry, | 2239 kStackOverflowRuntimeEntry, |
| 2239 0, | 2240 0, |
| 2240 instruction_->locs()); | 2241 instruction_->locs()); |
| 2241 | 2242 |
| 2242 if (FLAG_use_osr && !compiler->is_optimizing() && instruction_->in_loop()) { | 2243 if (FLAG_use_osr && !compiler->is_optimizing() && instruction_->in_loop()) { |
| 2243 // In unoptimized code, record loop stack checks as possible OSR entries. | 2244 // In unoptimized code, record loop stack checks as possible OSR entries. |
| 2244 compiler->AddCurrentDescriptor(PcDescriptors::kOsrEntry, | 2245 compiler->AddCurrentDescriptor(PcDescriptors::kOsrEntry, |
| 2245 instruction_->deopt_id(), | 2246 instruction_->deopt_id(), |
| 2246 0); // No token position. | 2247 0); // No token position. |
| (...skipping 2424 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 4671 } | 4672 } |
| 4672 | 4673 |
| 4673 | 4674 |
| 4674 LocationSummary* ThrowInstr::MakeLocationSummary() const { | 4675 LocationSummary* ThrowInstr::MakeLocationSummary() const { |
| 4675 return new LocationSummary(0, 0, LocationSummary::kCall); | 4676 return new LocationSummary(0, 0, LocationSummary::kCall); |
| 4676 } | 4677 } |
| 4677 | 4678 |
| 4678 | 4679 |
| 4679 | 4680 |
| 4680 void ThrowInstr::EmitNativeCode(FlowGraphCompiler* compiler) { | 4681 void ThrowInstr::EmitNativeCode(FlowGraphCompiler* compiler) { |
| 4681 compiler->GenerateCallRuntime(token_pos(), | 4682 compiler->GenerateRuntimeCall(token_pos(), |
| 4682 deopt_id(), | 4683 deopt_id(), |
| 4683 kThrowRuntimeEntry, | 4684 kThrowRuntimeEntry, |
| 4684 1, | 4685 1, |
| 4685 locs()); | 4686 locs()); |
| 4686 __ int3(); | 4687 __ int3(); |
| 4687 } | 4688 } |
| 4688 | 4689 |
| 4689 | 4690 |
| 4690 LocationSummary* ReThrowInstr::MakeLocationSummary() const { | 4691 LocationSummary* ReThrowInstr::MakeLocationSummary() const { |
| 4691 return new LocationSummary(0, 0, LocationSummary::kCall); | 4692 return new LocationSummary(0, 0, LocationSummary::kCall); |
| 4692 } | 4693 } |
| 4693 | 4694 |
| 4694 | 4695 |
| 4695 void ReThrowInstr::EmitNativeCode(FlowGraphCompiler* compiler) { | 4696 void ReThrowInstr::EmitNativeCode(FlowGraphCompiler* compiler) { |
| 4696 compiler->SetNeedsStacktrace(catch_try_index()); | 4697 compiler->SetNeedsStacktrace(catch_try_index()); |
| 4697 compiler->GenerateCallRuntime(token_pos(), | 4698 compiler->GenerateRuntimeCall(token_pos(), |
| 4698 deopt_id(), | 4699 deopt_id(), |
| 4699 kReThrowRuntimeEntry, | 4700 kReThrowRuntimeEntry, |
| 4700 2, | 4701 2, |
| 4701 locs()); | 4702 locs()); |
| 4702 __ int3(); | 4703 __ int3(); |
| 4703 } | 4704 } |
| 4704 | 4705 |
| 4705 | 4706 |
| 4706 void GraphEntryInstr::EmitNativeCode(FlowGraphCompiler* compiler) { | 4707 void GraphEntryInstr::EmitNativeCode(FlowGraphCompiler* compiler) { |
| 4707 if (!compiler->CanFallThroughTo(normal_entry())) { | 4708 if (!compiler->CanFallThroughTo(normal_entry())) { |
| (...skipping 442 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 5150 PcDescriptors::kOther, | 5151 PcDescriptors::kOther, |
| 5151 locs()); | 5152 locs()); |
| 5152 __ Drop(2); // Discard type arguments and receiver. | 5153 __ Drop(2); // Discard type arguments and receiver. |
| 5153 } | 5154 } |
| 5154 | 5155 |
| 5155 } // namespace dart | 5156 } // namespace dart |
| 5156 | 5157 |
| 5157 #undef __ | 5158 #undef __ |
| 5158 | 5159 |
| 5159 #endif // defined TARGET_ARCH_IA32 | 5160 #endif // defined TARGET_ARCH_IA32 |
| OLD | NEW |