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

Side by Side Diff: src/code-stubs-hydrogen.cc

Issue 1257223002: Revert of Remove ExternalArray, derived types, and element kinds (Closed) Base URL: https://chromium.googlesource.com/v8/v8.git@master
Patch Set: Created 5 years, 4 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
« no previous file with comments | « src/code-stubs.cc ('k') | src/compiler/access-builder.h » ('j') | no next file with comments »
Toggle Intra-line Diffs ('i') | Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
OLDNEW
1 // Copyright 2012 the V8 project authors. All rights reserved. 1 // Copyright 2012 the V8 project authors. All rights reserved.
2 // Use of this source code is governed by a BSD-style license that can be 2 // Use of this source code is governed by a BSD-style license that can be
3 // found in the LICENSE file. 3 // found in the LICENSE file.
4 4
5 #include "src/v8.h" 5 #include "src/v8.h"
6 6
7 #include "src/bailout-reason.h" 7 #include "src/bailout-reason.h"
8 #include "src/code-stubs.h" 8 #include "src/code-stubs.h"
9 #include "src/field-index.h" 9 #include "src/field-index.h"
10 #include "src/hydrogen.h" 10 #include "src/hydrogen.h"
(...skipping 1969 matching lines...) Expand 10 before | Expand all | Expand 10 after
1980 HValue* bit_field2, 1980 HValue* bit_field2,
1981 ElementsKind kind); 1981 ElementsKind kind);
1982 1982
1983 void BuildFastElementLoad(HGraphBuilder::IfBuilder* if_builder, 1983 void BuildFastElementLoad(HGraphBuilder::IfBuilder* if_builder,
1984 HValue* receiver, 1984 HValue* receiver,
1985 HValue* key, 1985 HValue* key,
1986 HValue* instance_type, 1986 HValue* instance_type,
1987 HValue* bit_field2, 1987 HValue* bit_field2,
1988 ElementsKind kind); 1988 ElementsKind kind);
1989 1989
1990 void BuildExternalElementLoad(HGraphBuilder::IfBuilder* if_builder,
1991 HValue* receiver,
1992 HValue* key,
1993 HValue* instance_type,
1994 HValue* bit_field2,
1995 ElementsKind kind);
1996
1990 KeyedLoadGenericStub* casted_stub() { 1997 KeyedLoadGenericStub* casted_stub() {
1991 return static_cast<KeyedLoadGenericStub*>(stub()); 1998 return static_cast<KeyedLoadGenericStub*>(stub());
1992 } 1999 }
1993 }; 2000 };
1994 2001
1995 2002
1996 void CodeStubGraphBuilder<KeyedLoadGenericStub>::BuildElementsKindLimitCheck( 2003 void CodeStubGraphBuilder<KeyedLoadGenericStub>::BuildElementsKindLimitCheck(
1997 HGraphBuilder::IfBuilder* if_builder, HValue* bit_field2, 2004 HGraphBuilder::IfBuilder* if_builder, HValue* bit_field2,
1998 ElementsKind kind) { 2005 ElementsKind kind) {
1999 ElementsKind next_kind = static_cast<ElementsKind>(kind + 1); 2006 ElementsKind next_kind = static_cast<ElementsKind>(kind + 1);
2000 HValue* kind_limit = Add<HConstant>( 2007 HValue* kind_limit = Add<HConstant>(
2001 static_cast<int>(Map::ElementsKindBits::encode(next_kind))); 2008 static_cast<int>(Map::ElementsKindBits::encode(next_kind)));
2002 2009
2003 if_builder->If<HCompareNumericAndBranch>(bit_field2, kind_limit, Token::LT); 2010 if_builder->If<HCompareNumericAndBranch>(bit_field2, kind_limit, Token::LT);
2004 if_builder->Then(); 2011 if_builder->Then();
2005 } 2012 }
2006 2013
2007 2014
2008 void CodeStubGraphBuilder<KeyedLoadGenericStub>::BuildFastElementLoad( 2015 void CodeStubGraphBuilder<KeyedLoadGenericStub>::BuildFastElementLoad(
2009 HGraphBuilder::IfBuilder* if_builder, HValue* receiver, HValue* key, 2016 HGraphBuilder::IfBuilder* if_builder, HValue* receiver, HValue* key,
2010 HValue* instance_type, HValue* bit_field2, ElementsKind kind) { 2017 HValue* instance_type, HValue* bit_field2, ElementsKind kind) {
2018 DCHECK(!IsExternalArrayElementsKind(kind));
2019
2011 BuildElementsKindLimitCheck(if_builder, bit_field2, kind); 2020 BuildElementsKindLimitCheck(if_builder, bit_field2, kind);
2012 2021
2013 IfBuilder js_array_check(this); 2022 IfBuilder js_array_check(this);
2014 js_array_check.If<HCompareNumericAndBranch>( 2023 js_array_check.If<HCompareNumericAndBranch>(
2015 instance_type, Add<HConstant>(JS_ARRAY_TYPE), Token::EQ); 2024 instance_type, Add<HConstant>(JS_ARRAY_TYPE), Token::EQ);
2016 js_array_check.Then(); 2025 js_array_check.Then();
2017 Push(BuildUncheckedMonomorphicElementAccess(receiver, key, NULL, 2026 Push(BuildUncheckedMonomorphicElementAccess(receiver, key, NULL,
2018 true, kind, 2027 true, kind,
2019 LOAD, NEVER_RETURN_HOLE, 2028 LOAD, NEVER_RETURN_HOLE,
2020 STANDARD_STORE)); 2029 STANDARD_STORE));
2021 js_array_check.Else(); 2030 js_array_check.Else();
2022 Push(BuildUncheckedMonomorphicElementAccess(receiver, key, NULL, 2031 Push(BuildUncheckedMonomorphicElementAccess(receiver, key, NULL,
2023 false, kind, 2032 false, kind,
2024 LOAD, NEVER_RETURN_HOLE, 2033 LOAD, NEVER_RETURN_HOLE,
2025 STANDARD_STORE)); 2034 STANDARD_STORE));
2026 js_array_check.End(); 2035 js_array_check.End();
2027 } 2036 }
2028 2037
2029 2038
2039 void CodeStubGraphBuilder<KeyedLoadGenericStub>::BuildExternalElementLoad(
2040 HGraphBuilder::IfBuilder* if_builder, HValue* receiver, HValue* key,
2041 HValue* instance_type, HValue* bit_field2, ElementsKind kind) {
2042 DCHECK(IsExternalArrayElementsKind(kind));
2043
2044 BuildElementsKindLimitCheck(if_builder, bit_field2, kind);
2045
2046 Push(BuildUncheckedMonomorphicElementAccess(receiver, key, NULL,
2047 false, kind,
2048 LOAD, NEVER_RETURN_HOLE,
2049 STANDARD_STORE));
2050 }
2051
2052
2030 HValue* CodeStubGraphBuilder<KeyedLoadGenericStub>::BuildCodeStub() { 2053 HValue* CodeStubGraphBuilder<KeyedLoadGenericStub>::BuildCodeStub() {
2031 HValue* receiver = GetParameter(LoadDescriptor::kReceiverIndex); 2054 HValue* receiver = GetParameter(LoadDescriptor::kReceiverIndex);
2032 HValue* key = GetParameter(LoadDescriptor::kNameIndex); 2055 HValue* key = GetParameter(LoadDescriptor::kNameIndex);
2033 // Split into a smi/integer case and unique string case. 2056 // Split into a smi/integer case and unique string case.
2034 HIfContinuation index_name_split_continuation(graph()->CreateBasicBlock(), 2057 HIfContinuation index_name_split_continuation(graph()->CreateBasicBlock(),
2035 graph()->CreateBasicBlock()); 2058 graph()->CreateBasicBlock());
2036 2059
2037 BuildKeyedIndexCheck(key, &index_name_split_continuation); 2060 BuildKeyedIndexCheck(key, &index_name_split_continuation);
2038 2061
2039 IfBuilder index_name_split(this, &index_name_split_continuation); 2062 IfBuilder index_name_split(this, &index_name_split_continuation);
(...skipping 41 matching lines...) Expand 10 before | Expand all | Expand 10 after
2081 // The SLOW_SLOPPY_ARGUMENTS_ELEMENTS check generates a "kind_if.Then" 2104 // The SLOW_SLOPPY_ARGUMENTS_ELEMENTS check generates a "kind_if.Then"
2082 STATIC_ASSERT(FAST_SLOPPY_ARGUMENTS_ELEMENTS < 2105 STATIC_ASSERT(FAST_SLOPPY_ARGUMENTS_ELEMENTS <
2083 SLOW_SLOPPY_ARGUMENTS_ELEMENTS); 2106 SLOW_SLOPPY_ARGUMENTS_ELEMENTS);
2084 BuildElementsKindLimitCheck(&kind_if, bit_field2, 2107 BuildElementsKindLimitCheck(&kind_if, bit_field2,
2085 SLOW_SLOPPY_ARGUMENTS_ELEMENTS); 2108 SLOW_SLOPPY_ARGUMENTS_ELEMENTS);
2086 // Non-strict elements are not handled. 2109 // Non-strict elements are not handled.
2087 Add<HDeoptimize>(Deoptimizer::kNonStrictElementsInKeyedLoadGenericStub, 2110 Add<HDeoptimize>(Deoptimizer::kNonStrictElementsInKeyedLoadGenericStub,
2088 Deoptimizer::EAGER); 2111 Deoptimizer::EAGER);
2089 Push(graph()->GetConstant0()); 2112 Push(graph()->GetConstant0());
2090 2113
2114 kind_if.Else();
2115 BuildExternalElementLoad(&kind_if, receiver, key, instance_type, bit_field2,
2116 EXTERNAL_INT8_ELEMENTS);
2117
2118 kind_if.Else();
2119 BuildExternalElementLoad(&kind_if, receiver, key, instance_type, bit_field2,
2120 EXTERNAL_UINT8_ELEMENTS);
2121
2122 kind_if.Else();
2123 BuildExternalElementLoad(&kind_if, receiver, key, instance_type, bit_field2,
2124 EXTERNAL_INT16_ELEMENTS);
2125
2126 kind_if.Else();
2127 BuildExternalElementLoad(&kind_if, receiver, key, instance_type, bit_field2,
2128 EXTERNAL_UINT16_ELEMENTS);
2129
2130 kind_if.Else();
2131 BuildExternalElementLoad(&kind_if, receiver, key, instance_type, bit_field2,
2132 EXTERNAL_INT32_ELEMENTS);
2133
2134 kind_if.Else();
2135 BuildExternalElementLoad(&kind_if, receiver, key, instance_type, bit_field2,
2136 EXTERNAL_UINT32_ELEMENTS);
2137
2138 kind_if.Else();
2139 BuildExternalElementLoad(&kind_if, receiver, key, instance_type, bit_field2,
2140 EXTERNAL_FLOAT32_ELEMENTS);
2141
2142 kind_if.Else();
2143 BuildExternalElementLoad(&kind_if, receiver, key, instance_type, bit_field2,
2144 EXTERNAL_FLOAT64_ELEMENTS);
2145
2146 kind_if.Else();
2147 BuildExternalElementLoad(&kind_if, receiver, key, instance_type, bit_field2,
2148 EXTERNAL_UINT8_CLAMPED_ELEMENTS);
2149
2091 kind_if.ElseDeopt( 2150 kind_if.ElseDeopt(
2092 Deoptimizer::kElementsKindUnhandledInKeyedLoadGenericStub); 2151 Deoptimizer::kElementsKindUnhandledInKeyedLoadGenericStub);
2093 2152
2094 kind_if.End(); 2153 kind_if.End();
2095 } 2154 }
2096 index_name_split.Else(); 2155 index_name_split.Else();
2097 { 2156 {
2098 // Key is a unique string. 2157 // Key is a unique string.
2099 key = Pop(); 2158 key = Pop();
2100 2159
(...skipping 67 matching lines...) Expand 10 before | Expand all | Expand 10 after
2168 lookup_if->Then(); 2227 lookup_if->Then();
2169 { 2228 {
2170 ExternalReference cache_field_offsets_ref = 2229 ExternalReference cache_field_offsets_ref =
2171 ExternalReference::keyed_lookup_cache_field_offsets(isolate()); 2230 ExternalReference::keyed_lookup_cache_field_offsets(isolate());
2172 HValue* cache_field_offsets = 2231 HValue* cache_field_offsets =
2173 Add<HConstant>(cache_field_offsets_ref); 2232 Add<HConstant>(cache_field_offsets_ref);
2174 HValue* index = AddUncasted<HAdd>(hash, Add<HConstant>(probe)); 2233 HValue* index = AddUncasted<HAdd>(hash, Add<HConstant>(probe));
2175 index->ClearFlag(HValue::kCanOverflow); 2234 index->ClearFlag(HValue::kCanOverflow);
2176 HValue* property_index = 2235 HValue* property_index =
2177 Add<HLoadKeyed>(cache_field_offsets, index, nullptr, 2236 Add<HLoadKeyed>(cache_field_offsets, index, nullptr,
2178 INT32_ELEMENTS, NEVER_RETURN_HOLE, 0); 2237 EXTERNAL_INT32_ELEMENTS, NEVER_RETURN_HOLE, 0);
2179 Push(property_index); 2238 Push(property_index);
2180 } 2239 }
2181 lookup_if->Else(); 2240 lookup_if->Else();
2182 } 2241 }
2183 for (int i = 0; i < KeyedLookupCache::kEntriesPerBucket; ++i) { 2242 for (int i = 0; i < KeyedLookupCache::kEntriesPerBucket; ++i) {
2184 lookup_ifs[i].JoinContinuation(&inline_or_runtime_continuation); 2243 lookup_ifs[i].JoinContinuation(&inline_or_runtime_continuation);
2185 } 2244 }
2186 } 2245 }
2187 2246
2188 IfBuilder inline_or_runtime(this, &inline_or_runtime_continuation); 2247 IfBuilder inline_or_runtime(this, &inline_or_runtime_continuation);
(...skipping 22 matching lines...) Expand all
2211 return Pop(); 2270 return Pop();
2212 } 2271 }
2213 2272
2214 2273
2215 Handle<Code> KeyedLoadGenericStub::GenerateCode() { 2274 Handle<Code> KeyedLoadGenericStub::GenerateCode() {
2216 return DoGenerateCode(this); 2275 return DoGenerateCode(this);
2217 } 2276 }
2218 2277
2219 } // namespace internal 2278 } // namespace internal
2220 } // namespace v8 2279 } // namespace v8
OLDNEW
« no previous file with comments | « src/code-stubs.cc ('k') | src/compiler/access-builder.h » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698