| 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_X64. | 5 #include "vm/globals.h" // Needed here to get TARGET_ARCH_X64. |
| 6 #if defined(TARGET_ARCH_X64) | 6 #if defined(TARGET_ARCH_X64) |
| 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 329 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 340 // Check that the type of the value is allowed in conditional context. | 340 // Check that the type of the value is allowed in conditional context. |
| 341 // Call the runtime if the object is not bool::true or bool::false. | 341 // Call the runtime if the object is not bool::true or bool::false. |
| 342 ASSERT(locs->always_calls()); | 342 ASSERT(locs->always_calls()); |
| 343 Label done; | 343 Label done; |
| 344 __ CompareObject(reg, Bool::True(), PP); | 344 __ CompareObject(reg, Bool::True(), PP); |
| 345 __ j(EQUAL, &done, Assembler::kNearJump); | 345 __ j(EQUAL, &done, Assembler::kNearJump); |
| 346 __ CompareObject(reg, Bool::False(), PP); | 346 __ CompareObject(reg, Bool::False(), PP); |
| 347 __ j(EQUAL, &done, Assembler::kNearJump); | 347 __ j(EQUAL, &done, Assembler::kNearJump); |
| 348 | 348 |
| 349 __ pushq(reg); // Push the source object. | 349 __ pushq(reg); // Push the source object. |
| 350 compiler->GenerateCallRuntime(token_pos, | 350 compiler->GenerateRuntimeCall(token_pos, |
| 351 deopt_id, | 351 deopt_id, |
| 352 kConditionTypeErrorRuntimeEntry, | 352 kConditionTypeErrorRuntimeEntry, |
| 353 1, | 353 1, |
| 354 locs); | 354 locs); |
| 355 // We should never return here. | 355 // We should never return here. |
| 356 __ int3(); | 356 __ int3(); |
| 357 __ Bind(&done); | 357 __ Bind(&done); |
| 358 } | 358 } |
| 359 | 359 |
| 360 | 360 |
| (...skipping 1504 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 1865 | 1865 |
| 1866 | 1866 |
| 1867 LocationSummary* | 1867 LocationSummary* |
| 1868 AllocateObjectWithBoundsCheckInstr::MakeLocationSummary() const { | 1868 AllocateObjectWithBoundsCheckInstr::MakeLocationSummary() const { |
| 1869 return MakeCallSummary(); | 1869 return MakeCallSummary(); |
| 1870 } | 1870 } |
| 1871 | 1871 |
| 1872 | 1872 |
| 1873 void AllocateObjectWithBoundsCheckInstr::EmitNativeCode( | 1873 void AllocateObjectWithBoundsCheckInstr::EmitNativeCode( |
| 1874 FlowGraphCompiler* compiler) { | 1874 FlowGraphCompiler* compiler) { |
| 1875 compiler->GenerateCallRuntime(token_pos(), | 1875 compiler->GenerateRuntimeCall(token_pos(), |
| 1876 deopt_id(), | 1876 deopt_id(), |
| 1877 kAllocateObjectWithBoundsCheckRuntimeEntry, | 1877 kAllocateObjectWithBoundsCheckRuntimeEntry, |
| 1878 3, | 1878 3, |
| 1879 locs()); | 1879 locs()); |
| 1880 __ Drop(3); | 1880 __ Drop(3); |
| 1881 ASSERT(locs()->out().reg() == RAX); | 1881 ASSERT(locs()->out().reg() == RAX); |
| 1882 __ popq(RAX); // Pop new instance. | 1882 __ popq(RAX); // Pop new instance. |
| 1883 } | 1883 } |
| 1884 | 1884 |
| 1885 | 1885 |
| (...skipping 26 matching lines...) Expand all Loading... |
| 1912 void InstantiateTypeInstr::EmitNativeCode(FlowGraphCompiler* compiler) { | 1912 void InstantiateTypeInstr::EmitNativeCode(FlowGraphCompiler* compiler) { |
| 1913 Register instantiator_reg = locs()->in(0).reg(); | 1913 Register instantiator_reg = locs()->in(0).reg(); |
| 1914 Register result_reg = locs()->out().reg(); | 1914 Register result_reg = locs()->out().reg(); |
| 1915 | 1915 |
| 1916 // 'instantiator_reg' is the instantiator AbstractTypeArguments object | 1916 // 'instantiator_reg' is the instantiator AbstractTypeArguments object |
| 1917 // (or null). | 1917 // (or null). |
| 1918 // A runtime call to instantiate the type is required. | 1918 // A runtime call to instantiate the type is required. |
| 1919 __ PushObject(Object::ZoneHandle(), PP); // Make room for the result. | 1919 __ PushObject(Object::ZoneHandle(), PP); // Make room for the result. |
| 1920 __ PushObject(type(), PP); | 1920 __ PushObject(type(), PP); |
| 1921 __ pushq(instantiator_reg); // Push instantiator type arguments. | 1921 __ pushq(instantiator_reg); // Push instantiator type arguments. |
| 1922 compiler->GenerateCallRuntime(token_pos(), | 1922 compiler->GenerateRuntimeCall(token_pos(), |
| 1923 deopt_id(), | 1923 deopt_id(), |
| 1924 kInstantiateTypeRuntimeEntry, | 1924 kInstantiateTypeRuntimeEntry, |
| 1925 2, | 1925 2, |
| 1926 locs()); | 1926 locs()); |
| 1927 __ Drop(2); // Drop instantiator and uninstantiated type. | 1927 __ Drop(2); // Drop instantiator and uninstantiated type. |
| 1928 __ popq(result_reg); // Pop instantiated type. | 1928 __ popq(result_reg); // Pop instantiated type. |
| 1929 ASSERT(instantiator_reg == result_reg); | 1929 ASSERT(instantiator_reg == result_reg); |
| 1930 } | 1930 } |
| 1931 | 1931 |
| 1932 | 1932 |
| (...skipping 25 matching lines...) Expand all Loading... |
| 1958 const intptr_t len = type_arguments().Length(); | 1958 const intptr_t len = type_arguments().Length(); |
| 1959 if (type_arguments().IsRawInstantiatedRaw(len)) { | 1959 if (type_arguments().IsRawInstantiatedRaw(len)) { |
| 1960 __ CompareObject(instantiator_reg, Object::null_object(), PP); | 1960 __ CompareObject(instantiator_reg, Object::null_object(), PP); |
| 1961 __ j(EQUAL, &type_arguments_instantiated, Assembler::kNearJump); | 1961 __ j(EQUAL, &type_arguments_instantiated, Assembler::kNearJump); |
| 1962 } | 1962 } |
| 1963 // Instantiate non-null type arguments. | 1963 // Instantiate non-null type arguments. |
| 1964 // A runtime call to instantiate the type arguments is required. | 1964 // A runtime call to instantiate the type arguments is required. |
| 1965 __ PushObject(Object::ZoneHandle(), PP); // Make room for the result. | 1965 __ PushObject(Object::ZoneHandle(), PP); // Make room for the result. |
| 1966 __ PushObject(type_arguments(), PP); | 1966 __ PushObject(type_arguments(), PP); |
| 1967 __ pushq(instantiator_reg); // Push instantiator type arguments. | 1967 __ pushq(instantiator_reg); // Push instantiator type arguments. |
| 1968 compiler->GenerateCallRuntime(token_pos(), | 1968 compiler->GenerateRuntimeCall(token_pos(), |
| 1969 deopt_id(), | 1969 deopt_id(), |
| 1970 kInstantiateTypeArgumentsRuntimeEntry, | 1970 kInstantiateTypeArgumentsRuntimeEntry, |
| 1971 2, | 1971 2, |
| 1972 locs()); | 1972 locs()); |
| 1973 __ Drop(2); // Drop instantiator and uninstantiated type arguments. | 1973 __ Drop(2); // Drop instantiator and uninstantiated type arguments. |
| 1974 __ popq(result_reg); // Pop instantiated type arguments. | 1974 __ popq(result_reg); // Pop instantiated type arguments. |
| 1975 __ Bind(&type_arguments_instantiated); | 1975 __ Bind(&type_arguments_instantiated); |
| 1976 ASSERT(instantiator_reg == result_reg); | 1976 ASSERT(instantiator_reg == result_reg); |
| 1977 } | 1977 } |
| 1978 | 1978 |
| (...skipping 115 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 2094 return locs; | 2094 return locs; |
| 2095 } | 2095 } |
| 2096 | 2096 |
| 2097 | 2097 |
| 2098 void CloneContextInstr::EmitNativeCode(FlowGraphCompiler* compiler) { | 2098 void CloneContextInstr::EmitNativeCode(FlowGraphCompiler* compiler) { |
| 2099 Register context_value = locs()->in(0).reg(); | 2099 Register context_value = locs()->in(0).reg(); |
| 2100 Register result = locs()->out().reg(); | 2100 Register result = locs()->out().reg(); |
| 2101 | 2101 |
| 2102 __ PushObject(Object::ZoneHandle(), PP); // Make room for the result. | 2102 __ PushObject(Object::ZoneHandle(), PP); // Make room for the result. |
| 2103 __ pushq(context_value); | 2103 __ pushq(context_value); |
| 2104 compiler->GenerateCallRuntime(token_pos(), | 2104 compiler->GenerateRuntimeCall(token_pos(), |
| 2105 deopt_id(), | 2105 deopt_id(), |
| 2106 kCloneContextRuntimeEntry, | 2106 kCloneContextRuntimeEntry, |
| 2107 1, | 2107 1, |
| 2108 locs()); | 2108 locs()); |
| 2109 __ popq(result); // Remove argument. | 2109 __ popq(result); // Remove argument. |
| 2110 __ popq(result); // Get result (cloned context). | 2110 __ popq(result); // Get result (cloned context). |
| 2111 } | 2111 } |
| 2112 | 2112 |
| 2113 | 2113 |
| 2114 LocationSummary* CatchBlockEntryInstr::MakeLocationSummary() const { | 2114 LocationSummary* CatchBlockEntryInstr::MakeLocationSummary() const { |
| (...skipping 50 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 2165 explicit CheckStackOverflowSlowPath(CheckStackOverflowInstr* instruction) | 2165 explicit CheckStackOverflowSlowPath(CheckStackOverflowInstr* instruction) |
| 2166 : instruction_(instruction) { } | 2166 : instruction_(instruction) { } |
| 2167 | 2167 |
| 2168 virtual void EmitNativeCode(FlowGraphCompiler* compiler) { | 2168 virtual void EmitNativeCode(FlowGraphCompiler* compiler) { |
| 2169 __ Comment("CheckStackOverflowSlowPath"); | 2169 __ Comment("CheckStackOverflowSlowPath"); |
| 2170 __ Bind(entry_label()); | 2170 __ Bind(entry_label()); |
| 2171 compiler->SaveLiveRegisters(instruction_->locs()); | 2171 compiler->SaveLiveRegisters(instruction_->locs()); |
| 2172 // pending_deoptimization_env_ is needed to generate a runtime call that | 2172 // pending_deoptimization_env_ is needed to generate a runtime call that |
| 2173 // may throw an exception. | 2173 // may throw an exception. |
| 2174 ASSERT(compiler->pending_deoptimization_env_ == NULL); | 2174 ASSERT(compiler->pending_deoptimization_env_ == NULL); |
| 2175 compiler->pending_deoptimization_env_ = instruction_->env(); | 2175 Environment* env = compiler->SlowPathEnvironmentFor(instruction_); |
| 2176 compiler->GenerateCallRuntime(instruction_->token_pos(), | 2176 compiler->pending_deoptimization_env_ = env; |
| 2177 compiler->GenerateRuntimeCall(instruction_->token_pos(), |
| 2177 instruction_->deopt_id(), | 2178 instruction_->deopt_id(), |
| 2178 kStackOverflowRuntimeEntry, | 2179 kStackOverflowRuntimeEntry, |
| 2179 0, | 2180 0, |
| 2180 instruction_->locs()); | 2181 instruction_->locs()); |
| 2181 | 2182 |
| 2182 if (FLAG_use_osr && !compiler->is_optimizing() && instruction_->in_loop()) { | 2183 if (FLAG_use_osr && !compiler->is_optimizing() && instruction_->in_loop()) { |
| 2183 // In unoptimized code, record loop stack checks as possible OSR entries. | 2184 // In unoptimized code, record loop stack checks as possible OSR entries. |
| 2184 compiler->AddCurrentDescriptor(PcDescriptors::kOsrEntry, | 2185 compiler->AddCurrentDescriptor(PcDescriptors::kOsrEntry, |
| 2185 instruction_->deopt_id(), | 2186 instruction_->deopt_id(), |
| 2186 0); // No token position. | 2187 0); // No token position. |
| (...skipping 2270 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 4457 UNIMPLEMENTED(); | 4458 UNIMPLEMENTED(); |
| 4458 } | 4459 } |
| 4459 | 4460 |
| 4460 | 4461 |
| 4461 LocationSummary* ThrowInstr::MakeLocationSummary() const { | 4462 LocationSummary* ThrowInstr::MakeLocationSummary() const { |
| 4462 return new LocationSummary(0, 0, LocationSummary::kCall); | 4463 return new LocationSummary(0, 0, LocationSummary::kCall); |
| 4463 } | 4464 } |
| 4464 | 4465 |
| 4465 | 4466 |
| 4466 void ThrowInstr::EmitNativeCode(FlowGraphCompiler* compiler) { | 4467 void ThrowInstr::EmitNativeCode(FlowGraphCompiler* compiler) { |
| 4467 compiler->GenerateCallRuntime(token_pos(), | 4468 compiler->GenerateRuntimeCall(token_pos(), |
| 4468 deopt_id(), | 4469 deopt_id(), |
| 4469 kThrowRuntimeEntry, | 4470 kThrowRuntimeEntry, |
| 4470 1, | 4471 1, |
| 4471 locs()); | 4472 locs()); |
| 4472 __ int3(); | 4473 __ int3(); |
| 4473 } | 4474 } |
| 4474 | 4475 |
| 4475 | 4476 |
| 4476 LocationSummary* ReThrowInstr::MakeLocationSummary() const { | 4477 LocationSummary* ReThrowInstr::MakeLocationSummary() const { |
| 4477 return new LocationSummary(0, 0, LocationSummary::kCall); | 4478 return new LocationSummary(0, 0, LocationSummary::kCall); |
| 4478 } | 4479 } |
| 4479 | 4480 |
| 4480 | 4481 |
| 4481 void ReThrowInstr::EmitNativeCode(FlowGraphCompiler* compiler) { | 4482 void ReThrowInstr::EmitNativeCode(FlowGraphCompiler* compiler) { |
| 4482 compiler->SetNeedsStacktrace(catch_try_index()); | 4483 compiler->SetNeedsStacktrace(catch_try_index()); |
| 4483 compiler->GenerateCallRuntime(token_pos(), | 4484 compiler->GenerateRuntimeCall(token_pos(), |
| 4484 deopt_id(), | 4485 deopt_id(), |
| 4485 kReThrowRuntimeEntry, | 4486 kReThrowRuntimeEntry, |
| 4486 2, | 4487 2, |
| 4487 locs()); | 4488 locs()); |
| 4488 __ int3(); | 4489 __ int3(); |
| 4489 } | 4490 } |
| 4490 | 4491 |
| 4491 | 4492 |
| 4492 void GraphEntryInstr::EmitNativeCode(FlowGraphCompiler* compiler) { | 4493 void GraphEntryInstr::EmitNativeCode(FlowGraphCompiler* compiler) { |
| 4493 if (!compiler->CanFallThroughTo(normal_entry())) { | 4494 if (!compiler->CanFallThroughTo(normal_entry())) { |
| (...skipping 285 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 4779 PcDescriptors::kOther, | 4780 PcDescriptors::kOther, |
| 4780 locs()); | 4781 locs()); |
| 4781 __ Drop(2); // Discard type arguments and receiver. | 4782 __ Drop(2); // Discard type arguments and receiver. |
| 4782 } | 4783 } |
| 4783 | 4784 |
| 4784 } // namespace dart | 4785 } // namespace dart |
| 4785 | 4786 |
| 4786 #undef __ | 4787 #undef __ |
| 4787 | 4788 |
| 4788 #endif // defined TARGET_ARCH_X64 | 4789 #endif // defined TARGET_ARCH_X64 |
| OLD | NEW |