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

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

Issue 1262583002: Reland of "Remove ExternalArray, derived types, and element kinds" (Closed) Base URL: https://chromium.googlesource.com/v8/v8.git@master
Patch Set: updates 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
1997 KeyedLoadGenericStub* casted_stub() { 1990 KeyedLoadGenericStub* casted_stub() {
1998 return static_cast<KeyedLoadGenericStub*>(stub()); 1991 return static_cast<KeyedLoadGenericStub*>(stub());
1999 } 1992 }
2000 }; 1993 };
2001 1994
2002 1995
2003 void CodeStubGraphBuilder<KeyedLoadGenericStub>::BuildElementsKindLimitCheck( 1996 void CodeStubGraphBuilder<KeyedLoadGenericStub>::BuildElementsKindLimitCheck(
2004 HGraphBuilder::IfBuilder* if_builder, HValue* bit_field2, 1997 HGraphBuilder::IfBuilder* if_builder, HValue* bit_field2,
2005 ElementsKind kind) { 1998 ElementsKind kind) {
2006 ElementsKind next_kind = static_cast<ElementsKind>(kind + 1); 1999 ElementsKind next_kind = static_cast<ElementsKind>(kind + 1);
2007 HValue* kind_limit = Add<HConstant>( 2000 HValue* kind_limit = Add<HConstant>(
2008 static_cast<int>(Map::ElementsKindBits::encode(next_kind))); 2001 static_cast<int>(Map::ElementsKindBits::encode(next_kind)));
2009 2002
2010 if_builder->If<HCompareNumericAndBranch>(bit_field2, kind_limit, Token::LT); 2003 if_builder->If<HCompareNumericAndBranch>(bit_field2, kind_limit, Token::LT);
2011 if_builder->Then(); 2004 if_builder->Then();
2012 } 2005 }
2013 2006
2014 2007
2015 void CodeStubGraphBuilder<KeyedLoadGenericStub>::BuildFastElementLoad( 2008 void CodeStubGraphBuilder<KeyedLoadGenericStub>::BuildFastElementLoad(
2016 HGraphBuilder::IfBuilder* if_builder, HValue* receiver, HValue* key, 2009 HGraphBuilder::IfBuilder* if_builder, HValue* receiver, HValue* key,
2017 HValue* instance_type, HValue* bit_field2, ElementsKind kind) { 2010 HValue* instance_type, HValue* bit_field2, ElementsKind kind) {
2018 DCHECK(!IsExternalArrayElementsKind(kind));
2019
2020 BuildElementsKindLimitCheck(if_builder, bit_field2, kind); 2011 BuildElementsKindLimitCheck(if_builder, bit_field2, kind);
2021 2012
2022 IfBuilder js_array_check(this); 2013 IfBuilder js_array_check(this);
2023 js_array_check.If<HCompareNumericAndBranch>( 2014 js_array_check.If<HCompareNumericAndBranch>(
2024 instance_type, Add<HConstant>(JS_ARRAY_TYPE), Token::EQ); 2015 instance_type, Add<HConstant>(JS_ARRAY_TYPE), Token::EQ);
2025 js_array_check.Then(); 2016 js_array_check.Then();
2026 Push(BuildUncheckedMonomorphicElementAccess(receiver, key, NULL, 2017 Push(BuildUncheckedMonomorphicElementAccess(receiver, key, NULL,
2027 true, kind, 2018 true, kind,
2028 LOAD, NEVER_RETURN_HOLE, 2019 LOAD, NEVER_RETURN_HOLE,
2029 STANDARD_STORE)); 2020 STANDARD_STORE));
2030 js_array_check.Else(); 2021 js_array_check.Else();
2031 Push(BuildUncheckedMonomorphicElementAccess(receiver, key, NULL, 2022 Push(BuildUncheckedMonomorphicElementAccess(receiver, key, NULL,
2032 false, kind, 2023 false, kind,
2033 LOAD, NEVER_RETURN_HOLE, 2024 LOAD, NEVER_RETURN_HOLE,
2034 STANDARD_STORE)); 2025 STANDARD_STORE));
2035 js_array_check.End(); 2026 js_array_check.End();
2036 } 2027 }
2037 2028
2038 2029
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
2053 HValue* CodeStubGraphBuilder<KeyedLoadGenericStub>::BuildCodeStub() { 2030 HValue* CodeStubGraphBuilder<KeyedLoadGenericStub>::BuildCodeStub() {
2054 HValue* receiver = GetParameter(LoadDescriptor::kReceiverIndex); 2031 HValue* receiver = GetParameter(LoadDescriptor::kReceiverIndex);
2055 HValue* key = GetParameter(LoadDescriptor::kNameIndex); 2032 HValue* key = GetParameter(LoadDescriptor::kNameIndex);
2056 // Split into a smi/integer case and unique string case. 2033 // Split into a smi/integer case and unique string case.
2057 HIfContinuation index_name_split_continuation(graph()->CreateBasicBlock(), 2034 HIfContinuation index_name_split_continuation(graph()->CreateBasicBlock(),
2058 graph()->CreateBasicBlock()); 2035 graph()->CreateBasicBlock());
2059 2036
2060 BuildKeyedIndexCheck(key, &index_name_split_continuation); 2037 BuildKeyedIndexCheck(key, &index_name_split_continuation);
2061 2038
2062 IfBuilder index_name_split(this, &index_name_split_continuation); 2039 IfBuilder index_name_split(this, &index_name_split_continuation);
(...skipping 41 matching lines...) Expand 10 before | Expand all | Expand 10 after
2104 // The SLOW_SLOPPY_ARGUMENTS_ELEMENTS check generates a "kind_if.Then" 2081 // The SLOW_SLOPPY_ARGUMENTS_ELEMENTS check generates a "kind_if.Then"
2105 STATIC_ASSERT(FAST_SLOPPY_ARGUMENTS_ELEMENTS < 2082 STATIC_ASSERT(FAST_SLOPPY_ARGUMENTS_ELEMENTS <
2106 SLOW_SLOPPY_ARGUMENTS_ELEMENTS); 2083 SLOW_SLOPPY_ARGUMENTS_ELEMENTS);
2107 BuildElementsKindLimitCheck(&kind_if, bit_field2, 2084 BuildElementsKindLimitCheck(&kind_if, bit_field2,
2108 SLOW_SLOPPY_ARGUMENTS_ELEMENTS); 2085 SLOW_SLOPPY_ARGUMENTS_ELEMENTS);
2109 // Non-strict elements are not handled. 2086 // Non-strict elements are not handled.
2110 Add<HDeoptimize>(Deoptimizer::kNonStrictElementsInKeyedLoadGenericStub, 2087 Add<HDeoptimize>(Deoptimizer::kNonStrictElementsInKeyedLoadGenericStub,
2111 Deoptimizer::EAGER); 2088 Deoptimizer::EAGER);
2112 Push(graph()->GetConstant0()); 2089 Push(graph()->GetConstant0());
2113 2090
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
2150 kind_if.ElseDeopt( 2091 kind_if.ElseDeopt(
2151 Deoptimizer::kElementsKindUnhandledInKeyedLoadGenericStub); 2092 Deoptimizer::kElementsKindUnhandledInKeyedLoadGenericStub);
2152 2093
2153 kind_if.End(); 2094 kind_if.End();
2154 } 2095 }
2155 index_name_split.Else(); 2096 index_name_split.Else();
2156 { 2097 {
2157 // Key is a unique string. 2098 // Key is a unique string.
2158 key = Pop(); 2099 key = Pop();
2159 2100
(...skipping 67 matching lines...) Expand 10 before | Expand all | Expand 10 after
2227 lookup_if->Then(); 2168 lookup_if->Then();
2228 { 2169 {
2229 ExternalReference cache_field_offsets_ref = 2170 ExternalReference cache_field_offsets_ref =
2230 ExternalReference::keyed_lookup_cache_field_offsets(isolate()); 2171 ExternalReference::keyed_lookup_cache_field_offsets(isolate());
2231 HValue* cache_field_offsets = 2172 HValue* cache_field_offsets =
2232 Add<HConstant>(cache_field_offsets_ref); 2173 Add<HConstant>(cache_field_offsets_ref);
2233 HValue* index = AddUncasted<HAdd>(hash, Add<HConstant>(probe)); 2174 HValue* index = AddUncasted<HAdd>(hash, Add<HConstant>(probe));
2234 index->ClearFlag(HValue::kCanOverflow); 2175 index->ClearFlag(HValue::kCanOverflow);
2235 HValue* property_index = 2176 HValue* property_index =
2236 Add<HLoadKeyed>(cache_field_offsets, index, nullptr, 2177 Add<HLoadKeyed>(cache_field_offsets, index, nullptr,
2237 EXTERNAL_INT32_ELEMENTS, NEVER_RETURN_HOLE, 0); 2178 INT32_ELEMENTS, NEVER_RETURN_HOLE, 0);
2238 Push(property_index); 2179 Push(property_index);
2239 } 2180 }
2240 lookup_if->Else(); 2181 lookup_if->Else();
2241 } 2182 }
2242 for (int i = 0; i < KeyedLookupCache::kEntriesPerBucket; ++i) { 2183 for (int i = 0; i < KeyedLookupCache::kEntriesPerBucket; ++i) {
2243 lookup_ifs[i].JoinContinuation(&inline_or_runtime_continuation); 2184 lookup_ifs[i].JoinContinuation(&inline_or_runtime_continuation);
2244 } 2185 }
2245 } 2186 }
2246 2187
2247 IfBuilder inline_or_runtime(this, &inline_or_runtime_continuation); 2188 IfBuilder inline_or_runtime(this, &inline_or_runtime_continuation);
(...skipping 22 matching lines...) Expand all
2270 return Pop(); 2211 return Pop();
2271 } 2212 }
2272 2213
2273 2214
2274 Handle<Code> KeyedLoadGenericStub::GenerateCode() { 2215 Handle<Code> KeyedLoadGenericStub::GenerateCode() {
2275 return DoGenerateCode(this); 2216 return DoGenerateCode(this);
2276 } 2217 }
2277 2218
2278 } // namespace internal 2219 } // namespace internal
2279 } // namespace v8 2220 } // 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