| 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 "lib/error.h" | 10 #include "lib/error.h" |
| (...skipping 1884 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 1895 } | 1895 } |
| 1896 | 1896 |
| 1897 | 1897 |
| 1898 void InstantiateTypeArgumentsInstr::EmitNativeCode( | 1898 void InstantiateTypeArgumentsInstr::EmitNativeCode( |
| 1899 FlowGraphCompiler* compiler) { | 1899 FlowGraphCompiler* compiler) { |
| 1900 Register instantiator_reg = locs()->in(0).reg(); | 1900 Register instantiator_reg = locs()->in(0).reg(); |
| 1901 Register result_reg = locs()->out().reg(); | 1901 Register result_reg = locs()->out().reg(); |
| 1902 | 1902 |
| 1903 // 'instantiator_reg' is the instantiator AbstractTypeArguments object | 1903 // 'instantiator_reg' is the instantiator AbstractTypeArguments object |
| 1904 // (or null). | 1904 // (or null). |
| 1905 if (!type_arguments().IsUninstantiatedIdentity() && | 1905 ASSERT(!type_arguments().IsUninstantiatedIdentity() && |
| 1906 !type_arguments().CanShareInstantiatorTypeArguments( | 1906 !type_arguments().CanShareInstantiatorTypeArguments( |
| 1907 instantiator_class())) { | 1907 instantiator_class())); |
| 1908 // If the instantiator is null and if the type argument vector | 1908 // If the instantiator is null and if the type argument vector |
| 1909 // instantiated from null becomes a vector of dynamic, then use null as | 1909 // instantiated from null becomes a vector of dynamic, then use null as |
| 1910 // the type arguments. | 1910 // the type arguments. |
| 1911 Label type_arguments_instantiated; | 1911 Label type_arguments_instantiated; |
| 1912 const intptr_t len = type_arguments().Length(); | 1912 const intptr_t len = type_arguments().Length(); |
| 1913 if (type_arguments().IsRawInstantiatedRaw(len)) { | 1913 if (type_arguments().IsRawInstantiatedRaw(len)) { |
| 1914 const Immediate& raw_null = | 1914 const Immediate& raw_null = |
| 1915 Immediate(reinterpret_cast<intptr_t>(Object::null())); | 1915 Immediate(reinterpret_cast<intptr_t>(Object::null())); |
| 1916 __ cmpl(instantiator_reg, raw_null); | 1916 __ cmpl(instantiator_reg, raw_null); |
| 1917 __ j(EQUAL, &type_arguments_instantiated, Assembler::kNearJump); | 1917 __ j(EQUAL, &type_arguments_instantiated, Assembler::kNearJump); |
| 1918 } | |
| 1919 // Instantiate non-null type arguments. | |
| 1920 // A runtime call to instantiate the type arguments is required. | |
| 1921 __ PushObject(Object::ZoneHandle()); // Make room for the result. | |
| 1922 __ PushObject(type_arguments()); | |
| 1923 __ pushl(instantiator_reg); // Push instantiator type arguments. | |
| 1924 compiler->GenerateCallRuntime(token_pos(), | |
| 1925 deopt_id(), | |
| 1926 kInstantiateTypeArgumentsRuntimeEntry, | |
| 1927 locs()); | |
| 1928 __ Drop(2); // Drop instantiator and uninstantiated type arguments. | |
| 1929 __ popl(result_reg); // Pop instantiated type arguments. | |
| 1930 __ Bind(&type_arguments_instantiated); | |
| 1931 } | 1918 } |
| 1919 // Instantiate non-null type arguments. |
| 1920 // A runtime call to instantiate the type arguments is required. |
| 1921 __ PushObject(Object::ZoneHandle()); // Make room for the result. |
| 1922 __ PushObject(type_arguments()); |
| 1923 __ pushl(instantiator_reg); // Push instantiator type arguments. |
| 1924 compiler->GenerateCallRuntime(token_pos(), |
| 1925 deopt_id(), |
| 1926 kInstantiateTypeArgumentsRuntimeEntry, |
| 1927 locs()); |
| 1928 __ Drop(2); // Drop instantiator and uninstantiated type arguments. |
| 1929 __ popl(result_reg); // Pop instantiated type arguments. |
| 1930 __ Bind(&type_arguments_instantiated); |
| 1932 ASSERT(instantiator_reg == result_reg); | 1931 ASSERT(instantiator_reg == result_reg); |
| 1933 // 'result_reg': Instantiated type arguments. | |
| 1934 } | 1932 } |
| 1935 | 1933 |
| 1936 | 1934 |
| 1937 LocationSummary* | 1935 LocationSummary* |
| 1938 ExtractConstructorTypeArgumentsInstr::MakeLocationSummary() const { | 1936 ExtractConstructorTypeArgumentsInstr::MakeLocationSummary() const { |
| 1939 const intptr_t kNumInputs = 1; | 1937 const intptr_t kNumInputs = 1; |
| 1940 const intptr_t kNumTemps = 0; | 1938 const intptr_t kNumTemps = 0; |
| 1941 LocationSummary* locs = | 1939 LocationSummary* locs = |
| 1942 new LocationSummary(kNumInputs, kNumTemps, LocationSummary::kNoCall); | 1940 new LocationSummary(kNumInputs, kNumTemps, LocationSummary::kNoCall); |
| 1943 locs->set_in(0, Location::RequiresRegister()); | 1941 locs->set_in(0, Location::RequiresRegister()); |
| (...skipping 2766 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 4710 PcDescriptors::kOther, | 4708 PcDescriptors::kOther, |
| 4711 locs()); | 4709 locs()); |
| 4712 __ Drop(2); // Discard type arguments and receiver. | 4710 __ Drop(2); // Discard type arguments and receiver. |
| 4713 } | 4711 } |
| 4714 | 4712 |
| 4715 } // namespace dart | 4713 } // namespace dart |
| 4716 | 4714 |
| 4717 #undef __ | 4715 #undef __ |
| 4718 | 4716 |
| 4719 #endif // defined TARGET_ARCH_IA32 | 4717 #endif // defined TARGET_ARCH_IA32 |
| OLD | NEW |