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

Unified Diff: src/crankshaft/hydrogen.cc

Issue 2844993002: [cleanup] Drop some dead code from Crankshaft. (Closed)
Patch Set: Created 3 years, 8 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') | no next file » | 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 f3e151bba73568f3ae12fa2d9d80ce81a4dc90f8..78e0718c8d93250766fa79468d393b80b7620dfb 100644
--- a/src/crankshaft/hydrogen.cc
+++ b/src/crankshaft/hydrogen.cc
@@ -1592,172 +1592,6 @@ HValue* HGraphBuilder::BuildCopyElementsOnWrite(HValue* object,
return environment()->Pop();
}
-HValue* HGraphBuilder::BuildElementIndexHash(HValue* index) {
- int32_t seed_value = static_cast<uint32_t>(isolate()->heap()->HashSeed());
- HValue* seed = Add<HConstant>(seed_value);
- HValue* hash = AddUncasted<HBitwise>(Token::BIT_XOR, index, seed);
-
- // hash = ~hash + (hash << 15);
- HValue* shifted_hash = AddUncasted<HShl>(hash, Add<HConstant>(15));
- HValue* not_hash = AddUncasted<HBitwise>(Token::BIT_XOR, hash,
- graph()->GetConstantMinus1());
- hash = AddUncasted<HAdd>(shifted_hash, not_hash);
-
- // hash = hash ^ (hash >> 12);
- shifted_hash = AddUncasted<HShr>(hash, Add<HConstant>(12));
- hash = AddUncasted<HBitwise>(Token::BIT_XOR, hash, shifted_hash);
-
- // hash = hash + (hash << 2);
- shifted_hash = AddUncasted<HShl>(hash, Add<HConstant>(2));
- hash = AddUncasted<HAdd>(hash, shifted_hash);
-
- // hash = hash ^ (hash >> 4);
- shifted_hash = AddUncasted<HShr>(hash, Add<HConstant>(4));
- hash = AddUncasted<HBitwise>(Token::BIT_XOR, hash, shifted_hash);
-
- // hash = hash * 2057;
- hash = AddUncasted<HMul>(hash, Add<HConstant>(2057));
- hash->ClearFlag(HValue::kCanOverflow);
-
- // hash = hash ^ (hash >> 16);
- shifted_hash = AddUncasted<HShr>(hash, Add<HConstant>(16));
- return AddUncasted<HBitwise>(Token::BIT_XOR, hash, shifted_hash);
-}
-
-HValue* HGraphBuilder::BuildUncheckedDictionaryElementLoad(HValue* receiver,
- HValue* elements,
- HValue* key,
- HValue* hash) {
- HValue* capacity =
- Add<HLoadKeyed>(elements, Add<HConstant>(NameDictionary::kCapacityIndex),
- nullptr, nullptr, FAST_ELEMENTS);
-
- HValue* mask = AddUncasted<HSub>(capacity, graph()->GetConstant1());
- mask->ChangeRepresentation(Representation::Integer32());
- mask->ClearFlag(HValue::kCanOverflow);
-
- HValue* entry = hash;
- HValue* count = graph()->GetConstant1();
- Push(entry);
- Push(count);
-
- HIfContinuation return_or_loop_continuation(graph()->CreateBasicBlock(),
- graph()->CreateBasicBlock());
- HIfContinuation found_key_match_continuation(graph()->CreateBasicBlock(),
- graph()->CreateBasicBlock());
- LoopBuilder probe_loop(this);
- probe_loop.BeginBody(2); // Drop entry, count from last environment to
- // appease live range building without simulates.
-
- count = Pop();
- entry = Pop();
- entry = AddUncasted<HBitwise>(Token::BIT_AND, entry, mask);
- int entry_size = SeededNumberDictionary::kEntrySize;
- HValue* base_index = AddUncasted<HMul>(entry, Add<HConstant>(entry_size));
- base_index->ClearFlag(HValue::kCanOverflow);
- int start_offset = SeededNumberDictionary::kElementsStartIndex;
- HValue* key_index =
- AddUncasted<HAdd>(base_index, Add<HConstant>(start_offset));
- key_index->ClearFlag(HValue::kCanOverflow);
-
- HValue* candidate_key =
- Add<HLoadKeyed>(elements, key_index, nullptr, nullptr, FAST_ELEMENTS);
- IfBuilder if_undefined(this);
- if_undefined.If<HCompareObjectEqAndBranch>(candidate_key,
- graph()->GetConstantUndefined());
- if_undefined.Then();
- {
- // element == undefined means "not found". Call the runtime.
- // TODO(jkummerow): walk the prototype chain instead.
- Add<HPushArguments>(receiver, key);
- Push(Add<HCallRuntime>(Runtime::FunctionForId(Runtime::kKeyedGetProperty),
- 2));
- }
- if_undefined.Else();
- {
- IfBuilder if_match(this);
- if_match.If<HCompareObjectEqAndBranch>(candidate_key, key);
- if_match.Then();
- if_match.Else();
-
- // Update non-internalized string in the dictionary with internalized key?
- IfBuilder if_update_with_internalized(this);
- HValue* smi_check =
- if_update_with_internalized.IfNot<HIsSmiAndBranch>(candidate_key);
- if_update_with_internalized.And();
- HValue* map = AddLoadMap(candidate_key, smi_check);
- HValue* instance_type =
- Add<HLoadNamedField>(map, nullptr, HObjectAccess::ForMapInstanceType());
- HValue* not_internalized_bit = AddUncasted<HBitwise>(
- Token::BIT_AND, instance_type,
- Add<HConstant>(static_cast<int>(kIsNotInternalizedMask)));
- if_update_with_internalized.If<HCompareNumericAndBranch>(
- not_internalized_bit, graph()->GetConstant0(), Token::NE);
- if_update_with_internalized.And();
- if_update_with_internalized.IfNot<HCompareObjectEqAndBranch>(
- candidate_key, graph()->GetConstantHole());
- if_update_with_internalized.AndIf<HStringCompareAndBranch>(candidate_key,
- key, Token::EQ);
- if_update_with_internalized.Then();
- // Replace a key that is a non-internalized string by the equivalent
- // internalized string for faster further lookups.
- Add<HStoreKeyed>(elements, key_index, key, nullptr, FAST_ELEMENTS);
- if_update_with_internalized.Else();
-
- if_update_with_internalized.JoinContinuation(&found_key_match_continuation);
- if_match.JoinContinuation(&found_key_match_continuation);
-
- IfBuilder found_key_match(this, &found_key_match_continuation);
- found_key_match.Then();
- // Key at current probe matches. Relevant bits in the |details| field must
- // be zero, otherwise the dictionary element requires special handling.
- HValue* details_index =
- AddUncasted<HAdd>(base_index, Add<HConstant>(start_offset + 2));
- details_index->ClearFlag(HValue::kCanOverflow);
- HValue* details = Add<HLoadKeyed>(elements, details_index, nullptr, nullptr,
- FAST_ELEMENTS);
- int details_mask = PropertyDetails::KindField::kMask;
- details = AddUncasted<HBitwise>(Token::BIT_AND, details,
- Add<HConstant>(details_mask));
- IfBuilder details_compare(this);
- details_compare.If<HCompareNumericAndBranch>(details, New<HConstant>(kData),
- Token::EQ);
- details_compare.Then();
- HValue* result_index =
- AddUncasted<HAdd>(base_index, Add<HConstant>(start_offset + 1));
- result_index->ClearFlag(HValue::kCanOverflow);
- Push(Add<HLoadKeyed>(elements, result_index, nullptr, nullptr,
- FAST_ELEMENTS));
- details_compare.Else();
- Add<HPushArguments>(receiver, key);
- Push(Add<HCallRuntime>(Runtime::FunctionForId(Runtime::kKeyedGetProperty),
- 2));
- details_compare.End();
-
- found_key_match.Else();
- found_key_match.JoinContinuation(&return_or_loop_continuation);
- }
- if_undefined.JoinContinuation(&return_or_loop_continuation);
-
- IfBuilder return_or_loop(this, &return_or_loop_continuation);
- return_or_loop.Then();
- probe_loop.Break();
-
- return_or_loop.Else();
- entry = AddUncasted<HAdd>(entry, count);
- entry->ClearFlag(HValue::kCanOverflow);
- count = AddUncasted<HAdd>(count, graph()->GetConstant1());
- count->ClearFlag(HValue::kCanOverflow);
- Push(entry);
- Push(count);
-
- probe_loop.EndBody();
-
- return_or_loop.End();
-
- return Pop();
-}
-
HValue* HGraphBuilder::BuildCreateIterResultObject(HValue* value,
HValue* done) {
NoObservableSideEffectsScope scope(this);
@@ -2969,74 +2803,6 @@ HInstruction* HGraphBuilder::BuildGetNativeContext() {
HObjectAccess::ForContextSlot(Context::NATIVE_CONTEXT_INDEX));
}
-
-HInstruction* HGraphBuilder::BuildGetNativeContext(HValue* closure) {
- // Get the global object, then the native context
- HInstruction* context = Add<HLoadNamedField>(
- closure, nullptr, HObjectAccess::ForFunctionContextPointer());
- return Add<HLoadNamedField>(
- context, nullptr,
- HObjectAccess::ForContextSlot(Context::NATIVE_CONTEXT_INDEX));
-}
-
-
-HValue* HGraphBuilder::BuildGetParentContext(HValue* depth, int depth_value) {
- HValue* script_context = context();
- if (depth != NULL) {
- HValue* zero = graph()->GetConstant0();
-
- Push(script_context);
- Push(depth);
-
- LoopBuilder loop(this);
- loop.BeginBody(2); // Drop script_context and depth from last environment
- // to appease live range building without simulates.
- depth = Pop();
- script_context = Pop();
-
- script_context = Add<HLoadNamedField>(
- script_context, nullptr,
- HObjectAccess::ForContextSlot(Context::PREVIOUS_INDEX));
- depth = AddUncasted<HSub>(depth, graph()->GetConstant1());
- depth->ClearFlag(HValue::kCanOverflow);
-
- IfBuilder if_break(this);
- if_break.If<HCompareNumericAndBranch, HValue*>(depth, zero, Token::EQ);
- if_break.Then();
- {
- Push(script_context); // The result.
- loop.Break();
- }
- if_break.Else();
- {
- Push(script_context);
- Push(depth);
- }
- loop.EndBody();
- if_break.End();
-
- script_context = Pop();
- } else if (depth_value > 0) {
- // Unroll the above loop.
- for (int i = 0; i < depth_value; i++) {
- script_context = Add<HLoadNamedField>(
- script_context, nullptr,
- HObjectAccess::ForContextSlot(Context::PREVIOUS_INDEX));
- }
- }
- return script_context;
-}
-
-
-HInstruction* HGraphBuilder::BuildGetArrayFunction() {
- HInstruction* native_context = BuildGetNativeContext();
- HInstruction* index =
- Add<HConstant>(static_cast<int32_t>(Context::ARRAY_FUNCTION_INDEX));
- return Add<HLoadKeyed>(native_context, index, nullptr, nullptr,
- FAST_ELEMENTS);
-}
-
-
HValue* HGraphBuilder::BuildArrayBufferViewFieldAccessor(HValue* object,
HValue* checked_object,
FieldIndex index) {
@@ -3066,12 +2832,6 @@ HValue* HGraphBuilder::BuildArrayBufferViewFieldAccessor(HValue* object,
return Pop();
}
-HValue* HGraphBuilder::AddLoadJSBuiltin(int context_index) {
- HValue* native_context = BuildGetNativeContext();
- HObjectAccess function_access = HObjectAccess::ForContextSlot(context_index);
- return Add<HLoadNamedField>(native_context, nullptr, function_access);
-}
-
HOptimizedGraphBuilder::HOptimizedGraphBuilder(CompilationInfo* info,
bool track_positions)
: HGraphBuilder(info, CallInterfaceDescriptor(), track_positions),
« no previous file with comments | « src/crankshaft/hydrogen.h ('k') | no next file » | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698