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

Unified Diff: src/crankshaft/hydrogen.cc

Issue 2424433002: [ic] Delete old KeyedLoadIC code (Closed)
Patch Set: fix failing test Created 4 years, 2 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 side-by-side diff with in-line comments
Download patch
« no previous file with comments | « src/crankshaft/hydrogen.h ('k') | src/deoptimize-reason.h » ('j') | no next file with comments »
Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
Index: src/crankshaft/hydrogen.cc
diff --git a/src/crankshaft/hydrogen.cc b/src/crankshaft/hydrogen.cc
index 43ee8b977f50202066ecda70c3f8190926280aa3..d62aa5f00123539640f579595b700d4fdb779e9e 100644
--- a/src/crankshaft/hydrogen.cc
+++ b/src/crankshaft/hydrogen.cc
@@ -1647,190 +1647,6 @@ HValue* HGraphBuilder::BuildCopyElementsOnWrite(HValue* object,
return environment()->Pop();
}
-
-void HGraphBuilder::BuildJSObjectCheck(HValue* receiver,
- int bit_field_mask) {
- // Check that the object isn't a smi.
- Add<HCheckHeapObject>(receiver);
-
- // Get the map of the receiver.
- HValue* map =
- Add<HLoadNamedField>(receiver, nullptr, HObjectAccess::ForMap());
-
- // Check the instance type and if an access check is needed, this can be
- // done with a single load, since both bytes are adjacent in the map.
- HObjectAccess access(HObjectAccess::ForMapInstanceTypeAndBitField());
- HValue* instance_type_and_bit_field =
- Add<HLoadNamedField>(map, nullptr, access);
-
- HValue* mask = Add<HConstant>(0x00FF | (bit_field_mask << 8));
- HValue* and_result = AddUncasted<HBitwise>(Token::BIT_AND,
- instance_type_and_bit_field,
- mask);
- HValue* sub_result = AddUncasted<HSub>(and_result,
- Add<HConstant>(JS_OBJECT_TYPE));
- Add<HBoundsCheck>(sub_result,
- Add<HConstant>(LAST_JS_OBJECT_TYPE + 1 - JS_OBJECT_TYPE));
-}
-
-
-void HGraphBuilder::BuildKeyedIndexCheck(HValue* key,
- HIfContinuation* join_continuation) {
- // The sometimes unintuitively backward ordering of the ifs below is
- // convoluted, but necessary. All of the paths must guarantee that the
- // if-true of the continuation returns a smi element index and the if-false of
- // the continuation returns either a symbol or a unique string key. All other
- // object types cause a deopt to fall back to the runtime.
-
- IfBuilder key_smi_if(this);
- key_smi_if.If<HIsSmiAndBranch>(key);
- key_smi_if.Then();
- {
- Push(key); // Nothing to do, just continue to true of continuation.
- }
- key_smi_if.Else();
- {
- HValue* map = Add<HLoadNamedField>(key, nullptr, HObjectAccess::ForMap());
- HValue* instance_type =
- Add<HLoadNamedField>(map, nullptr, HObjectAccess::ForMapInstanceType());
-
- // Non-unique string, check for a string with a hash code that is actually
- // an index.
- STATIC_ASSERT(LAST_UNIQUE_NAME_TYPE == FIRST_NONSTRING_TYPE);
- IfBuilder not_string_or_name_if(this);
- not_string_or_name_if.If<HCompareNumericAndBranch>(
- instance_type,
- Add<HConstant>(LAST_UNIQUE_NAME_TYPE),
- Token::GT);
-
- not_string_or_name_if.Then();
- {
- // Non-smi, non-Name, non-String: Try to convert to smi in case of
- // HeapNumber.
- // TODO(danno): This could call some variant of ToString
- Push(AddUncasted<HForceRepresentation>(key, Representation::Smi()));
- }
- not_string_or_name_if.Else();
- {
- // String or Name: check explicitly for Name, they can short-circuit
- // directly to unique non-index key path.
- IfBuilder not_symbol_if(this);
- not_symbol_if.If<HCompareNumericAndBranch>(
- instance_type,
- Add<HConstant>(SYMBOL_TYPE),
- Token::NE);
-
- not_symbol_if.Then();
- {
- // String: check whether the String is a String of an index. If it is,
- // extract the index value from the hash.
- HValue* hash = Add<HLoadNamedField>(key, nullptr,
- HObjectAccess::ForNameHashField());
- HValue* not_index_mask = Add<HConstant>(static_cast<int>(
- String::kContainsCachedArrayIndexMask));
-
- HValue* not_index_test = AddUncasted<HBitwise>(
- Token::BIT_AND, hash, not_index_mask);
-
- IfBuilder string_index_if(this);
- string_index_if.If<HCompareNumericAndBranch>(not_index_test,
- graph()->GetConstant0(),
- Token::EQ);
- string_index_if.Then();
- {
- // String with index in hash: extract string and merge to index path.
- Push(BuildDecodeField<String::ArrayIndexValueBits>(hash));
- }
- string_index_if.Else();
- {
- // Key is a non-index String, check for uniqueness/internalization.
- // If it's not internalized yet, internalize it now.
- HValue* not_internalized_bit = AddUncasted<HBitwise>(
- Token::BIT_AND,
- instance_type,
- Add<HConstant>(static_cast<int>(kIsNotInternalizedMask)));
-
- IfBuilder internalized(this);
- internalized.If<HCompareNumericAndBranch>(not_internalized_bit,
- graph()->GetConstant0(),
- Token::EQ);
- internalized.Then();
- Push(key);
-
- internalized.Else();
- Add<HPushArguments>(key);
- HValue* intern_key = Add<HCallRuntime>(
- Runtime::FunctionForId(Runtime::kInternalizeString), 1);
- Push(intern_key);
-
- internalized.End();
- // Key guaranteed to be a unique string
- }
- string_index_if.JoinContinuation(join_continuation);
- }
- not_symbol_if.Else();
- {
- Push(key); // Key is symbol
- }
- not_symbol_if.JoinContinuation(join_continuation);
- }
- not_string_or_name_if.JoinContinuation(join_continuation);
- }
- key_smi_if.JoinContinuation(join_continuation);
-}
-
-
-void HGraphBuilder::BuildNonGlobalObjectCheck(HValue* receiver) {
- // Get the the instance type of the receiver, and make sure that it is
- // not one of the global object types.
- HValue* map =
- Add<HLoadNamedField>(receiver, nullptr, HObjectAccess::ForMap());
- HValue* instance_type =
- Add<HLoadNamedField>(map, nullptr, HObjectAccess::ForMapInstanceType());
- HValue* global_type = Add<HConstant>(JS_GLOBAL_OBJECT_TYPE);
-
- IfBuilder if_global_object(this);
- if_global_object.If<HCompareNumericAndBranch>(instance_type, global_type,
- Token::EQ);
- if_global_object.ThenDeopt(DeoptimizeReason::kReceiverWasAGlobalObject);
- if_global_object.End();
-}
-
-
-void HGraphBuilder::BuildTestForDictionaryProperties(
- HValue* object,
- HIfContinuation* continuation) {
- HValue* properties = Add<HLoadNamedField>(
- object, nullptr, HObjectAccess::ForPropertiesPointer());
- HValue* properties_map =
- Add<HLoadNamedField>(properties, nullptr, HObjectAccess::ForMap());
- HValue* hash_map = Add<HLoadRoot>(Heap::kHashTableMapRootIndex);
- IfBuilder builder(this);
- builder.If<HCompareObjectEqAndBranch>(properties_map, hash_map);
- builder.CaptureContinuation(continuation);
-}
-
-
-HValue* HGraphBuilder::BuildKeyedLookupCacheHash(HValue* object,
- HValue* key) {
- // Load the map of the receiver, compute the keyed lookup cache hash
- // based on 32 bits of the map pointer and the string hash.
- HValue* object_map =
- Add<HLoadNamedField>(object, nullptr, HObjectAccess::ForMapAsInteger32());
- HValue* shifted_map = AddUncasted<HShr>(
- object_map, Add<HConstant>(KeyedLookupCache::kMapHashShift));
- HValue* string_hash =
- Add<HLoadNamedField>(key, nullptr, HObjectAccess::ForStringHashField());
- HValue* shifted_hash = AddUncasted<HShr>(
- string_hash, Add<HConstant>(String::kHashShift));
- HValue* xor_result = AddUncasted<HBitwise>(Token::BIT_XOR, shifted_map,
- shifted_hash);
- int mask = (KeyedLookupCache::kCapacityMask & KeyedLookupCache::kHashMask);
- return AddUncasted<HBitwise>(Token::BIT_AND, xor_result,
- Add<HConstant>(mask));
-}
-
-
HValue* HGraphBuilder::BuildElementIndexHash(HValue* index) {
int32_t seed_value = static_cast<uint32_t>(isolate()->heap()->HashSeed());
HValue* seed = Add<HConstant>(seed_value);
@@ -1997,7 +1813,6 @@ HValue* HGraphBuilder::BuildUncheckedDictionaryElementLoad(HValue* receiver,
return Pop();
}
-
HValue* HGraphBuilder::BuildCreateIterResultObject(HValue* value,
HValue* done) {
NoObservableSideEffectsScope scope(this);
« no previous file with comments | « src/crankshaft/hydrogen.h ('k') | src/deoptimize-reason.h » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698