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

Unified Diff: src/code-stubs-hydrogen.cc

Issue 2497243002: [stubs] Port builtin for Array.push fast-case from Crankshaft to TF (Closed)
Patch Set: Fix GC mole Created 4 years, 1 month 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/code-stubs.h ('k') | src/ia32/code-stubs-ia32.cc » ('j') | no next file with comments »
Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
Index: src/code-stubs-hydrogen.cc
diff --git a/src/code-stubs-hydrogen.cc b/src/code-stubs-hydrogen.cc
index e080f57a209b04109f8f8477df08beb3e091b17a..0d960dd6198d5b223aa42a524d236e0af5dd88bf 100644
--- a/src/code-stubs-hydrogen.cc
+++ b/src/code-stubs-hydrogen.cc
@@ -376,158 +376,6 @@ HValue* CodeStubGraphBuilderBase::BuildPushElement(HValue* object, HValue* argc,
}
template <>
-HValue* CodeStubGraphBuilder<FastArrayPushStub>::BuildCodeStub() {
- // TODO(verwaest): Fix deoptimizer messages.
- HValue* argc = GetArgumentsLength();
-
- HInstruction* argument_elements = Add<HArgumentsElements>(false, false);
- HInstruction* object = Add<HAccessArgumentsAt>(argument_elements, argc,
- graph()->GetConstantMinus1());
- BuildCheckHeapObject(object);
- HValue* map = Add<HLoadNamedField>(object, nullptr, HObjectAccess::ForMap());
- Add<HCheckInstanceType>(object, HCheckInstanceType::IS_JS_ARRAY);
-
- // Disallow pushing onto prototypes. It might be the JSArray prototype.
- // Disallow pushing onto non-extensible objects.
- {
- HValue* bit_field2 =
- Add<HLoadNamedField>(map, nullptr, HObjectAccess::ForMapBitField2());
- HValue* mask =
- Add<HConstant>(static_cast<int>(Map::IsPrototypeMapBits::kMask) |
- (1 << Map::kIsExtensible));
- HValue* bits = AddUncasted<HBitwise>(Token::BIT_AND, bit_field2, mask);
- IfBuilder check(this);
- check.If<HCompareNumericAndBranch>(
- bits, Add<HConstant>(1 << Map::kIsExtensible), Token::NE);
- check.ThenDeopt(DeoptimizeReason::kFastPathFailed);
- check.End();
- }
-
- // Disallow pushing onto arrays in dictionary named property mode. We need to
- // figure out whether the length property is still writable.
- {
- HValue* bit_field3 =
- Add<HLoadNamedField>(map, nullptr, HObjectAccess::ForMapBitField3());
- HValue* mask = Add<HConstant>(static_cast<int>(Map::DictionaryMap::kMask));
- HValue* bit = AddUncasted<HBitwise>(Token::BIT_AND, bit_field3, mask);
- IfBuilder check(this);
- check.If<HCompareNumericAndBranch>(bit, mask, Token::EQ);
- check.ThenDeopt(DeoptimizeReason::kFastPathFailed);
- check.End();
- }
-
- // Check whether the length property is writable. The length property is the
- // only default named property on arrays. It's nonconfigurable, hence is
- // guaranteed to stay the first property.
- {
- HValue* descriptors =
- Add<HLoadNamedField>(map, nullptr, HObjectAccess::ForMapDescriptors());
- HValue* details = Add<HLoadKeyed>(
- descriptors, Add<HConstant>(DescriptorArray::ToDetailsIndex(0)),
- nullptr, nullptr, FAST_SMI_ELEMENTS);
- HValue* mask =
- Add<HConstant>(READ_ONLY << PropertyDetails::AttributesField::kShift);
- HValue* bit = AddUncasted<HBitwise>(Token::BIT_AND, details, mask);
- IfBuilder readonly(this);
- readonly.If<HCompareNumericAndBranch>(bit, mask, Token::EQ);
- readonly.ThenDeopt(DeoptimizeReason::kFastPathFailed);
- readonly.End();
- }
-
- HValue* null = Add<HLoadRoot>(Heap::kNullValueRootIndex);
- HValue* empty = Add<HLoadRoot>(Heap::kEmptyFixedArrayRootIndex);
- environment()->Push(map);
- LoopBuilder check_prototypes(this);
- check_prototypes.BeginBody(1);
- {
- HValue* parent_map = environment()->Pop();
- HValue* prototype = Add<HLoadNamedField>(parent_map, nullptr,
- HObjectAccess::ForPrototype());
-
- IfBuilder is_null(this);
- is_null.If<HCompareObjectEqAndBranch>(prototype, null);
- is_null.Then();
- check_prototypes.Break();
- is_null.End();
-
- HValue* prototype_map =
- Add<HLoadNamedField>(prototype, nullptr, HObjectAccess::ForMap());
- HValue* instance_type = Add<HLoadNamedField>(
- prototype_map, nullptr, HObjectAccess::ForMapInstanceType());
- IfBuilder check_instance_type(this);
- check_instance_type.If<HCompareNumericAndBranch>(
- instance_type, Add<HConstant>(LAST_CUSTOM_ELEMENTS_RECEIVER),
- Token::LTE);
- check_instance_type.ThenDeopt(DeoptimizeReason::kFastPathFailed);
- check_instance_type.End();
-
- HValue* elements = Add<HLoadNamedField>(
- prototype, nullptr, HObjectAccess::ForElementsPointer());
- IfBuilder no_elements(this);
- no_elements.IfNot<HCompareObjectEqAndBranch>(elements, empty);
- no_elements.ThenDeopt(DeoptimizeReason::kFastPathFailed);
- no_elements.End();
-
- environment()->Push(prototype_map);
- }
- check_prototypes.EndBody();
-
- HValue* bit_field2 =
- Add<HLoadNamedField>(map, nullptr, HObjectAccess::ForMapBitField2());
- HValue* kind = BuildDecodeField<Map::ElementsKindBits>(bit_field2);
-
- // Below we only check the upper bound of the relevant ranges to include both
- // holey and non-holey versions. We check them in order smi, object, double
- // since smi < object < double.
- STATIC_ASSERT(FAST_SMI_ELEMENTS < FAST_HOLEY_SMI_ELEMENTS);
- STATIC_ASSERT(FAST_HOLEY_SMI_ELEMENTS < FAST_HOLEY_ELEMENTS);
- STATIC_ASSERT(FAST_ELEMENTS < FAST_HOLEY_ELEMENTS);
- STATIC_ASSERT(FAST_HOLEY_ELEMENTS < FAST_HOLEY_DOUBLE_ELEMENTS);
- STATIC_ASSERT(FAST_DOUBLE_ELEMENTS < FAST_HOLEY_DOUBLE_ELEMENTS);
- IfBuilder has_smi_elements(this);
- has_smi_elements.If<HCompareNumericAndBranch>(
- kind, Add<HConstant>(FAST_HOLEY_SMI_ELEMENTS), Token::LTE);
- has_smi_elements.Then();
- {
- HValue* new_length = BuildPushElement(object, argc, argument_elements,
- FAST_HOLEY_SMI_ELEMENTS);
- environment()->Push(new_length);
- }
- has_smi_elements.Else();
- {
- IfBuilder has_object_elements(this);
- has_object_elements.If<HCompareNumericAndBranch>(
- kind, Add<HConstant>(FAST_HOLEY_ELEMENTS), Token::LTE);
- has_object_elements.Then();
- {
- HValue* new_length = BuildPushElement(object, argc, argument_elements,
- FAST_HOLEY_ELEMENTS);
- environment()->Push(new_length);
- }
- has_object_elements.Else();
- {
- IfBuilder has_double_elements(this);
- has_double_elements.If<HCompareNumericAndBranch>(
- kind, Add<HConstant>(FAST_HOLEY_DOUBLE_ELEMENTS), Token::LTE);
- has_double_elements.Then();
- {
- HValue* new_length = BuildPushElement(object, argc, argument_elements,
- FAST_HOLEY_DOUBLE_ELEMENTS);
- environment()->Push(new_length);
- }
- has_double_elements.ElseDeopt(DeoptimizeReason::kFastPathFailed);
- has_double_elements.End();
- }
- has_object_elements.End();
- }
- has_smi_elements.End();
-
- return environment()->Pop();
-}
-
-Handle<Code> FastArrayPushStub::GenerateCode() { return DoGenerateCode(this); }
-
-template <>
HValue* CodeStubGraphBuilder<FastFunctionBindStub>::BuildCodeStub() {
// TODO(verwaest): Fix deoptimizer messages.
HValue* argc = GetArgumentsLength();
« no previous file with comments | « src/code-stubs.h ('k') | src/ia32/code-stubs-ia32.cc » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698