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

Side by Side Diff: runtime/vm/intermediate_language_arm.cc

Issue 154393003: Implement eager instantiation and canonicalization of type arguments at run (Closed) Base URL: http://dart.googlecode.com/svn/branches/bleeding_edge/dart/
Patch Set: Created 6 years, 10 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 1857 matching lines...) Expand 10 before | Expand all | Expand 10 after
1868 ASSERT(locs()->in(kElementTypePos).reg() == R1); 1868 ASSERT(locs()->in(kElementTypePos).reg() == R1);
1869 ASSERT(locs()->in(kLengthPos).reg() == R2); 1869 ASSERT(locs()->in(kLengthPos).reg() == R2);
1870 compiler->GenerateCall(token_pos(), 1870 compiler->GenerateCall(token_pos(),
1871 &StubCode::AllocateArrayLabel(), 1871 &StubCode::AllocateArrayLabel(),
1872 PcDescriptors::kOther, 1872 PcDescriptors::kOther,
1873 locs()); 1873 locs());
1874 ASSERT(locs()->out().reg() == R0); 1874 ASSERT(locs()->out().reg() == R0);
1875 } 1875 }
1876 1876
1877 1877
1878 LocationSummary*
1879 AllocateObjectWithBoundsCheckInstr::MakeLocationSummary(bool opt) const {
1880 return MakeCallSummary();
1881 }
1882
1883
1884 void AllocateObjectWithBoundsCheckInstr::EmitNativeCode(
1885 FlowGraphCompiler* compiler) {
1886 compiler->GenerateRuntimeCall(token_pos(),
1887 deopt_id(),
1888 kAllocateObjectWithBoundsCheckRuntimeEntry,
1889 3,
1890 locs());
1891 __ Drop(3);
1892 ASSERT(locs()->out().reg() == R0);
1893 __ Pop(R0); // Pop new instance.
1894 }
1895
1896
1897 class BoxDoubleSlowPath : public SlowPathCode { 1878 class BoxDoubleSlowPath : public SlowPathCode {
1898 public: 1879 public:
1899 explicit BoxDoubleSlowPath(Instruction* instruction) 1880 explicit BoxDoubleSlowPath(Instruction* instruction)
1900 : instruction_(instruction) { } 1881 : instruction_(instruction) { }
1901 1882
1902 virtual void EmitNativeCode(FlowGraphCompiler* compiler) { 1883 virtual void EmitNativeCode(FlowGraphCompiler* compiler) {
1903 __ Comment("BoxDoubleSlowPath"); 1884 __ Comment("BoxDoubleSlowPath");
1904 __ Bind(entry_label()); 1885 __ Bind(entry_label());
1905 const Class& double_class = compiler->double_class(); 1886 const Class& double_class = compiler->double_class();
1906 const Code& stub = 1887 const Code& stub =
(...skipping 127 matching lines...) Expand 10 before | Expand all | Expand 10 after
2034 locs->set_in(0, Location::RegisterLocation(R0)); 2015 locs->set_in(0, Location::RegisterLocation(R0));
2035 locs->set_out(Location::RegisterLocation(R0)); 2016 locs->set_out(Location::RegisterLocation(R0));
2036 return locs; 2017 return locs;
2037 } 2018 }
2038 2019
2039 2020
2040 void InstantiateTypeInstr::EmitNativeCode(FlowGraphCompiler* compiler) { 2021 void InstantiateTypeInstr::EmitNativeCode(FlowGraphCompiler* compiler) {
2041 Register instantiator_reg = locs()->in(0).reg(); 2022 Register instantiator_reg = locs()->in(0).reg();
2042 Register result_reg = locs()->out().reg(); 2023 Register result_reg = locs()->out().reg();
2043 2024
2044 // 'instantiator_reg' is the instantiator AbstractTypeArguments object 2025 // 'instantiator_reg' is the instantiator TypeArguments object (or null).
2045 // (or null).
2046 // A runtime call to instantiate the type is required. 2026 // A runtime call to instantiate the type is required.
2047 __ PushObject(Object::ZoneHandle()); // Make room for the result. 2027 __ PushObject(Object::ZoneHandle()); // Make room for the result.
2048 __ PushObject(type()); 2028 __ PushObject(type());
2049 __ Push(instantiator_reg); // Push instantiator type arguments. 2029 __ Push(instantiator_reg); // Push instantiator type arguments.
2050 compiler->GenerateRuntimeCall(token_pos(), 2030 compiler->GenerateRuntimeCall(token_pos(),
2051 deopt_id(), 2031 deopt_id(),
2052 kInstantiateTypeRuntimeEntry, 2032 kInstantiateTypeRuntimeEntry,
2053 2, 2033 2,
2054 locs()); 2034 locs());
2055 __ Drop(2); // Drop instantiator and uninstantiated type. 2035 __ Drop(2); // Drop instantiator and uninstantiated type.
(...skipping 12 matching lines...) Expand all
2068 locs->set_out(Location::RegisterLocation(R0)); 2048 locs->set_out(Location::RegisterLocation(R0));
2069 return locs; 2049 return locs;
2070 } 2050 }
2071 2051
2072 2052
2073 void InstantiateTypeArgumentsInstr::EmitNativeCode( 2053 void InstantiateTypeArgumentsInstr::EmitNativeCode(
2074 FlowGraphCompiler* compiler) { 2054 FlowGraphCompiler* compiler) {
2075 Register instantiator_reg = locs()->in(0).reg(); 2055 Register instantiator_reg = locs()->in(0).reg();
2076 Register result_reg = locs()->out().reg(); 2056 Register result_reg = locs()->out().reg();
2077 2057
2078 // 'instantiator_reg' is the instantiator AbstractTypeArguments object 2058 // 'instantiator_reg' is the instantiator TypeArguments object (or null).
2079 // (or null).
2080 ASSERT(!type_arguments().IsUninstantiatedIdentity() && 2059 ASSERT(!type_arguments().IsUninstantiatedIdentity() &&
2081 !type_arguments().CanShareInstantiatorTypeArguments( 2060 !type_arguments().CanShareInstantiatorTypeArguments(
2082 instantiator_class())); 2061 instantiator_class()));
2083 // If the instantiator is null and if the type argument vector 2062 // If the instantiator is null and if the type argument vector
2084 // instantiated from null becomes a vector of dynamic, then use null as 2063 // instantiated from null becomes a vector of dynamic, then use null as
2085 // the type arguments. 2064 // the type arguments.
2086 Label type_arguments_instantiated; 2065 Label type_arguments_instantiated;
2087 const intptr_t len = type_arguments().Length(); 2066 const intptr_t len = type_arguments().Length();
2088 if (type_arguments().IsRawInstantiatedRaw(len)) { 2067 if (type_arguments().IsRawInstantiatedRaw(len)) {
2089 __ LoadImmediate(IP, reinterpret_cast<intptr_t>(Object::null())); 2068 __ LoadImmediate(IP, reinterpret_cast<intptr_t>(Object::null()));
(...skipping 28 matching lines...) Expand all
2118 return locs; 2097 return locs;
2119 } 2098 }
2120 2099
2121 2100
2122 void ExtractConstructorTypeArgumentsInstr::EmitNativeCode( 2101 void ExtractConstructorTypeArgumentsInstr::EmitNativeCode(
2123 FlowGraphCompiler* compiler) { 2102 FlowGraphCompiler* compiler) {
2124 Register instantiator_reg = locs()->in(0).reg(); 2103 Register instantiator_reg = locs()->in(0).reg();
2125 Register result_reg = locs()->out().reg(); 2104 Register result_reg = locs()->out().reg();
2126 ASSERT(instantiator_reg == result_reg); 2105 ASSERT(instantiator_reg == result_reg);
2127 2106
2128 // instantiator_reg is the instantiator type argument vector, i.e. an 2107 // instantiator_reg is the instantiator type argument vector,
2129 // AbstractTypeArguments object (or null). 2108 // i.e. a TypeArguments object (or null).
2130 ASSERT(!type_arguments().IsUninstantiatedIdentity() && 2109 ASSERT(!type_arguments().IsUninstantiatedIdentity() &&
2131 !type_arguments().CanShareInstantiatorTypeArguments( 2110 !type_arguments().CanShareInstantiatorTypeArguments(
2132 instantiator_class())); 2111 instantiator_class()));
2133 // If the instantiator is null and if the type argument vector 2112 // If the instantiator is null and if the type argument vector
2134 // instantiated from null becomes a vector of dynamic, then use null as 2113 // instantiated from null becomes a vector of dynamic, then use null as
2135 // the type arguments. 2114 // the type arguments.
2136 Label type_arguments_instantiated; 2115 Label type_arguments_instantiated;
2137 ASSERT(type_arguments().IsRawInstantiatedRaw(type_arguments().Length())); 2116 ASSERT(type_arguments().IsRawInstantiatedRaw(type_arguments().Length()));
2138 __ CompareImmediate(instantiator_reg, 2117 __ CompareImmediate(instantiator_reg,
2139 reinterpret_cast<intptr_t>(Object::null())); 2118 reinterpret_cast<intptr_t>(Object::null()));
(...skipping 19 matching lines...) Expand all
2159 locs->set_out(Location::SameAsFirstInput()); 2138 locs->set_out(Location::SameAsFirstInput());
2160 return locs; 2139 return locs;
2161 } 2140 }
2162 2141
2163 2142
2164 void ExtractConstructorInstantiatorInstr::EmitNativeCode( 2143 void ExtractConstructorInstantiatorInstr::EmitNativeCode(
2165 FlowGraphCompiler* compiler) { 2144 FlowGraphCompiler* compiler) {
2166 Register instantiator_reg = locs()->in(0).reg(); 2145 Register instantiator_reg = locs()->in(0).reg();
2167 ASSERT(locs()->out().reg() == instantiator_reg); 2146 ASSERT(locs()->out().reg() == instantiator_reg);
2168 2147
2169 // instantiator_reg is the instantiator AbstractTypeArguments object 2148 // instantiator_reg is the instantiator TypeArguments object (or null).
2170 // (or null).
2171 ASSERT(!type_arguments().IsUninstantiatedIdentity() && 2149 ASSERT(!type_arguments().IsUninstantiatedIdentity() &&
2172 !type_arguments().CanShareInstantiatorTypeArguments( 2150 !type_arguments().CanShareInstantiatorTypeArguments(
2173 instantiator_class())); 2151 instantiator_class()));
2174 2152
2175 // If the instantiator is null and if the type argument vector 2153 // If the instantiator is null and if the type argument vector
2176 // instantiated from null becomes a vector of dynamic, then use null as 2154 // instantiated from null becomes a vector of dynamic, then use null as
2177 // the type arguments and do not pass the instantiator. 2155 // the type arguments and do not pass the instantiator.
2178 ASSERT(type_arguments().IsRawInstantiatedRaw(type_arguments().Length())); 2156 ASSERT(type_arguments().IsRawInstantiatedRaw(type_arguments().Length()));
2179 Label instantiator_not_null; 2157 Label instantiator_not_null;
2180 __ CompareImmediate(instantiator_reg, 2158 __ CompareImmediate(instantiator_reg,
(...skipping 2706 matching lines...) Expand 10 before | Expand all | Expand 10 after
4887 compiler->GenerateCall(token_pos(), 4865 compiler->GenerateCall(token_pos(),
4888 &label, 4866 &label,
4889 PcDescriptors::kOther, 4867 PcDescriptors::kOther,
4890 locs()); 4868 locs());
4891 __ Drop(2); // Discard type arguments and receiver. 4869 __ Drop(2); // Discard type arguments and receiver.
4892 } 4870 }
4893 4871
4894 } // namespace dart 4872 } // namespace dart
4895 4873
4896 #endif // defined TARGET_ARCH_ARM 4874 #endif // defined TARGET_ARCH_ARM
OLDNEW

Powered by Google App Engine
This is Rietveld 408576698