| OLD | NEW |
| 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/code-stubs.h" | 5 #include "src/code-stubs.h" |
| 6 | 6 |
| 7 #include "src/bailout-reason.h" | 7 #include "src/bailout-reason.h" |
| 8 #include "src/crankshaft/hydrogen.h" | 8 #include "src/crankshaft/hydrogen.h" |
| 9 #include "src/crankshaft/lithium.h" | 9 #include "src/crankshaft/lithium.h" |
| 10 #include "src/field-index.h" | 10 #include "src/field-index.h" |
| (...skipping 2139 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 2150 HValue* CodeStubGraphBuilder<LoadDictionaryElementStub>::BuildCodeStub() { | 2150 HValue* CodeStubGraphBuilder<LoadDictionaryElementStub>::BuildCodeStub() { |
| 2151 HValue* receiver = GetParameter(LoadDescriptor::kReceiverIndex); | 2151 HValue* receiver = GetParameter(LoadDescriptor::kReceiverIndex); |
| 2152 HValue* key = GetParameter(LoadDescriptor::kNameIndex); | 2152 HValue* key = GetParameter(LoadDescriptor::kNameIndex); |
| 2153 | 2153 |
| 2154 Add<HCheckSmi>(key); | 2154 Add<HCheckSmi>(key); |
| 2155 | 2155 |
| 2156 HValue* elements = AddLoadElements(receiver); | 2156 HValue* elements = AddLoadElements(receiver); |
| 2157 | 2157 |
| 2158 HValue* hash = BuildElementIndexHash(key); | 2158 HValue* hash = BuildElementIndexHash(key); |
| 2159 | 2159 |
| 2160 return BuildUncheckedDictionaryElementLoad(receiver, elements, key, hash, | 2160 return BuildUncheckedDictionaryElementLoad(receiver, elements, key, hash); |
| 2161 casted_stub()->language_mode()); | |
| 2162 } | 2161 } |
| 2163 | 2162 |
| 2164 | 2163 |
| 2165 Handle<Code> LoadDictionaryElementStub::GenerateCode() { | 2164 Handle<Code> LoadDictionaryElementStub::GenerateCode() { |
| 2166 return DoGenerateCode(this); | 2165 return DoGenerateCode(this); |
| 2167 } | 2166 } |
| 2168 | 2167 |
| 2169 | 2168 |
| 2170 template<> | 2169 template<> |
| 2171 HValue* CodeStubGraphBuilder<RegExpConstructResultStub>::BuildCodeStub() { | 2170 HValue* CodeStubGraphBuilder<RegExpConstructResultStub>::BuildCodeStub() { |
| (...skipping 113 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 2285 } | 2284 } |
| 2286 kind_if.Else(); | 2285 kind_if.Else(); |
| 2287 | 2286 |
| 2288 // The DICTIONARY_ELEMENTS check generates a "kind_if.Then" | 2287 // The DICTIONARY_ELEMENTS check generates a "kind_if.Then" |
| 2289 BuildElementsKindLimitCheck(&kind_if, bit_field2, DICTIONARY_ELEMENTS); | 2288 BuildElementsKindLimitCheck(&kind_if, bit_field2, DICTIONARY_ELEMENTS); |
| 2290 { | 2289 { |
| 2291 HValue* elements = AddLoadElements(receiver); | 2290 HValue* elements = AddLoadElements(receiver); |
| 2292 | 2291 |
| 2293 HValue* hash = BuildElementIndexHash(key); | 2292 HValue* hash = BuildElementIndexHash(key); |
| 2294 | 2293 |
| 2295 Push(BuildUncheckedDictionaryElementLoad(receiver, elements, key, hash, | 2294 Push(BuildUncheckedDictionaryElementLoad(receiver, elements, key, hash)); |
| 2296 casted_stub()->language_mode())); | |
| 2297 } | 2295 } |
| 2298 kind_if.Else(); | 2296 kind_if.Else(); |
| 2299 | 2297 |
| 2300 // The SLOW_SLOPPY_ARGUMENTS_ELEMENTS check generates a "kind_if.Then" | 2298 // The SLOW_SLOPPY_ARGUMENTS_ELEMENTS check generates a "kind_if.Then" |
| 2301 STATIC_ASSERT(FAST_SLOPPY_ARGUMENTS_ELEMENTS < | 2299 STATIC_ASSERT(FAST_SLOPPY_ARGUMENTS_ELEMENTS < |
| 2302 SLOW_SLOPPY_ARGUMENTS_ELEMENTS); | 2300 SLOW_SLOPPY_ARGUMENTS_ELEMENTS); |
| 2303 BuildElementsKindLimitCheck(&kind_if, bit_field2, | 2301 BuildElementsKindLimitCheck(&kind_if, bit_field2, |
| 2304 SLOW_SLOPPY_ARGUMENTS_ELEMENTS); | 2302 SLOW_SLOPPY_ARGUMENTS_ELEMENTS); |
| 2305 // Non-strict elements are not handled. | 2303 // Non-strict elements are not handled. |
| 2306 Add<HDeoptimize>(Deoptimizer::kNonStrictElementsInKeyedLoadGenericStub, | 2304 Add<HDeoptimize>(Deoptimizer::kNonStrictElementsInKeyedLoadGenericStub, |
| (...skipping 23 matching lines...) Expand all Loading... |
| 2330 BuildNonGlobalObjectCheck(receiver); | 2328 BuildNonGlobalObjectCheck(receiver); |
| 2331 | 2329 |
| 2332 HValue* properties = Add<HLoadNamedField>( | 2330 HValue* properties = Add<HLoadNamedField>( |
| 2333 receiver, nullptr, HObjectAccess::ForPropertiesPointer()); | 2331 receiver, nullptr, HObjectAccess::ForPropertiesPointer()); |
| 2334 | 2332 |
| 2335 HValue* hash = | 2333 HValue* hash = |
| 2336 Add<HLoadNamedField>(key, nullptr, HObjectAccess::ForNameHashField()); | 2334 Add<HLoadNamedField>(key, nullptr, HObjectAccess::ForNameHashField()); |
| 2337 | 2335 |
| 2338 hash = AddUncasted<HShr>(hash, Add<HConstant>(Name::kHashShift)); | 2336 hash = AddUncasted<HShr>(hash, Add<HConstant>(Name::kHashShift)); |
| 2339 | 2337 |
| 2340 HValue* value = BuildUncheckedDictionaryElementLoad( | 2338 HValue* value = |
| 2341 receiver, properties, key, hash, casted_stub()->language_mode()); | 2339 BuildUncheckedDictionaryElementLoad(receiver, properties, key, hash); |
| 2342 Push(value); | 2340 Push(value); |
| 2343 } | 2341 } |
| 2344 if_dict_properties.Else(); | 2342 if_dict_properties.Else(); |
| 2345 { | 2343 { |
| 2346 // TODO(dcarney): don't use keyed lookup cache, but convert to use | 2344 // TODO(dcarney): don't use keyed lookup cache, but convert to use |
| 2347 // megamorphic stub cache. | 2345 // megamorphic stub cache. |
| 2348 UNREACHABLE(); | 2346 UNREACHABLE(); |
| 2349 // Key is string, properties are fast mode | 2347 // Key is string, properties are fast mode |
| 2350 HValue* hash = BuildKeyedLookupCacheHash(receiver, key); | 2348 HValue* hash = BuildKeyedLookupCacheHash(receiver, key); |
| 2351 | 2349 |
| (...skipping 56 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 2408 inline_or_runtime.Then(); | 2406 inline_or_runtime.Then(); |
| 2409 { | 2407 { |
| 2410 // Found a cached index, load property inline. | 2408 // Found a cached index, load property inline. |
| 2411 Push(Add<HLoadFieldByIndex>(receiver, Pop())); | 2409 Push(Add<HLoadFieldByIndex>(receiver, Pop())); |
| 2412 } | 2410 } |
| 2413 inline_or_runtime.Else(); | 2411 inline_or_runtime.Else(); |
| 2414 { | 2412 { |
| 2415 // KeyedLookupCache miss; call runtime. | 2413 // KeyedLookupCache miss; call runtime. |
| 2416 Add<HPushArguments>(receiver, key); | 2414 Add<HPushArguments>(receiver, key); |
| 2417 Push(Add<HCallRuntime>( | 2415 Push(Add<HCallRuntime>( |
| 2418 Runtime::FunctionForId(is_strong(casted_stub()->language_mode()) | 2416 Runtime::FunctionForId(Runtime::kKeyedGetProperty), 2)); |
| 2419 ? Runtime::kKeyedGetPropertyStrong | |
| 2420 : Runtime::kKeyedGetProperty), | |
| 2421 2)); | |
| 2422 } | 2417 } |
| 2423 inline_or_runtime.End(); | 2418 inline_or_runtime.End(); |
| 2424 } | 2419 } |
| 2425 if_dict_properties.End(); | 2420 if_dict_properties.End(); |
| 2426 } | 2421 } |
| 2427 index_name_split.End(); | 2422 index_name_split.End(); |
| 2428 | 2423 |
| 2429 return Pop(); | 2424 return Pop(); |
| 2430 } | 2425 } |
| 2431 | 2426 |
| 2432 | 2427 |
| 2433 Handle<Code> KeyedLoadGenericStub::GenerateCode() { | 2428 Handle<Code> KeyedLoadGenericStub::GenerateCode() { |
| 2434 return DoGenerateCode(this); | 2429 return DoGenerateCode(this); |
| 2435 } | 2430 } |
| 2436 | 2431 |
| 2437 } // namespace internal | 2432 } // namespace internal |
| 2438 } // namespace v8 | 2433 } // namespace v8 |
| OLD | NEW |