| 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 "lib/error.h" | 10 #include "lib/error.h" |
| (...skipping 1867 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 1878 } | 1878 } |
| 1879 | 1879 |
| 1880 | 1880 |
| 1881 void InstantiateTypeArgumentsInstr::EmitNativeCode( | 1881 void InstantiateTypeArgumentsInstr::EmitNativeCode( |
| 1882 FlowGraphCompiler* compiler) { | 1882 FlowGraphCompiler* compiler) { |
| 1883 Register instantiator_reg = locs()->in(0).reg(); | 1883 Register instantiator_reg = locs()->in(0).reg(); |
| 1884 Register result_reg = locs()->out().reg(); | 1884 Register result_reg = locs()->out().reg(); |
| 1885 | 1885 |
| 1886 // 'instantiator_reg' is the instantiator AbstractTypeArguments object | 1886 // 'instantiator_reg' is the instantiator AbstractTypeArguments object |
| 1887 // (or null). | 1887 // (or null). |
| 1888 if (!type_arguments().IsUninstantiatedIdentity() && | 1888 ASSERT(!type_arguments().IsUninstantiatedIdentity() && |
| 1889 !type_arguments().CanShareInstantiatorTypeArguments( | 1889 !type_arguments().CanShareInstantiatorTypeArguments( |
| 1890 instantiator_class())) { | 1890 instantiator_class())); |
| 1891 // If the instantiator is null and if the type argument vector | 1891 // If the instantiator is null and if the type argument vector |
| 1892 // instantiated from null becomes a vector of dynamic, then use null as | 1892 // instantiated from null becomes a vector of dynamic, then use null as |
| 1893 // the type arguments. | 1893 // the type arguments. |
| 1894 Label type_arguments_instantiated; | 1894 Label type_arguments_instantiated; |
| 1895 const intptr_t len = type_arguments().Length(); | 1895 const intptr_t len = type_arguments().Length(); |
| 1896 if (type_arguments().IsRawInstantiatedRaw(len)) { | 1896 if (type_arguments().IsRawInstantiatedRaw(len)) { |
| 1897 const Immediate& raw_null = | 1897 const Immediate& raw_null = |
| 1898 Immediate(reinterpret_cast<intptr_t>(Object::null())); | 1898 Immediate(reinterpret_cast<intptr_t>(Object::null())); |
| 1899 __ cmpq(instantiator_reg, raw_null); | 1899 __ cmpq(instantiator_reg, raw_null); |
| 1900 __ j(EQUAL, &type_arguments_instantiated, Assembler::kNearJump); | 1900 __ j(EQUAL, &type_arguments_instantiated, Assembler::kNearJump); |
| 1901 } | |
| 1902 // Instantiate non-null type arguments. | |
| 1903 // A runtime call to instantiate the type arguments is required. | |
| 1904 __ PushObject(Object::ZoneHandle()); // Make room for the result. | |
| 1905 __ PushObject(type_arguments()); | |
| 1906 __ pushq(instantiator_reg); // Push instantiator type arguments. | |
| 1907 compiler->GenerateCallRuntime(token_pos(), | |
| 1908 deopt_id(), | |
| 1909 kInstantiateTypeArgumentsRuntimeEntry, | |
| 1910 locs()); | |
| 1911 __ Drop(2); // Drop instantiator and uninstantiated type arguments. | |
| 1912 __ popq(result_reg); // Pop instantiated type arguments. | |
| 1913 __ Bind(&type_arguments_instantiated); | |
| 1914 } | 1901 } |
| 1902 // Instantiate non-null type arguments. |
| 1903 // A runtime call to instantiate the type arguments is required. |
| 1904 __ PushObject(Object::ZoneHandle()); // Make room for the result. |
| 1905 __ PushObject(type_arguments()); |
| 1906 __ pushq(instantiator_reg); // Push instantiator type arguments. |
| 1907 compiler->GenerateCallRuntime(token_pos(), |
| 1908 deopt_id(), |
| 1909 kInstantiateTypeArgumentsRuntimeEntry, |
| 1910 locs()); |
| 1911 __ Drop(2); // Drop instantiator and uninstantiated type arguments. |
| 1912 __ popq(result_reg); // Pop instantiated type arguments. |
| 1913 __ Bind(&type_arguments_instantiated); |
| 1915 ASSERT(instantiator_reg == result_reg); | 1914 ASSERT(instantiator_reg == result_reg); |
| 1916 // 'result_reg': Instantiated type arguments. | |
| 1917 } | 1915 } |
| 1918 | 1916 |
| 1919 | 1917 |
| 1920 LocationSummary* | 1918 LocationSummary* |
| 1921 ExtractConstructorTypeArgumentsInstr::MakeLocationSummary() const { | 1919 ExtractConstructorTypeArgumentsInstr::MakeLocationSummary() const { |
| 1922 const intptr_t kNumInputs = 1; | 1920 const intptr_t kNumInputs = 1; |
| 1923 const intptr_t kNumTemps = 0; | 1921 const intptr_t kNumTemps = 0; |
| 1924 LocationSummary* locs = | 1922 LocationSummary* locs = |
| 1925 new LocationSummary(kNumInputs, kNumTemps, LocationSummary::kNoCall); | 1923 new LocationSummary(kNumInputs, kNumTemps, LocationSummary::kNoCall); |
| 1926 locs->set_in(0, Location::RequiresRegister()); | 1924 locs->set_in(0, Location::RequiresRegister()); |
| (...skipping 2427 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 4354 PcDescriptors::kOther, | 4352 PcDescriptors::kOther, |
| 4355 locs()); | 4353 locs()); |
| 4356 __ Drop(2); // Discard type arguments and receiver. | 4354 __ Drop(2); // Discard type arguments and receiver. |
| 4357 } | 4355 } |
| 4358 | 4356 |
| 4359 } // namespace dart | 4357 } // namespace dart |
| 4360 | 4358 |
| 4361 #undef __ | 4359 #undef __ |
| 4362 | 4360 |
| 4363 #endif // defined TARGET_ARCH_X64 | 4361 #endif // defined TARGET_ARCH_X64 |
| OLD | NEW |