Commit 5420ae51 authored by cbruni's avatar cbruni Committed by Commit bot

[stubs] Add more helper methods for heap constants

Review-Url: https://codereview.chromium.org/2383473003
Cr-Commit-Position: refs/heads/master@{#39902}
parent ccd71204
...@@ -38,53 +38,23 @@ void CodeStubAssembler::Assert(Node* condition) { ...@@ -38,53 +38,23 @@ void CodeStubAssembler::Assert(Node* condition) {
#endif #endif
} }
Node* CodeStubAssembler::BooleanMapConstant() {
return HeapConstant(isolate()->factory()->boolean_map());
}
Node* CodeStubAssembler::EmptyStringConstant() {
return LoadRoot(Heap::kempty_stringRootIndex);
}
Node* CodeStubAssembler::FixedArrayMapConstant() {
return LoadRoot(Heap::kFixedArrayMapRootIndex);
}
Node* CodeStubAssembler::FixedCowArrayMapConstant() {
return LoadRoot(Heap::kFixedCOWArrayMapRootIndex);
}
Node* CodeStubAssembler::FixedDoubleArrayMapConstant() {
return LoadRoot(Heap::kFixedDoubleArrayMapRootIndex);
}
Node* CodeStubAssembler::HeapNumberMapConstant() {
return LoadRoot(Heap::kHeapNumberMapRootIndex);
}
Node* CodeStubAssembler::NoContextConstant() { Node* CodeStubAssembler::NoContextConstant() {
return SmiConstant(Smi::FromInt(0)); return SmiConstant(Smi::FromInt(0));
} }
Node* CodeStubAssembler::MinusZeroConstant() { #define HEAP_CONSTANT_ACCESSOR(rootName, name) \
return LoadRoot(Heap::kMinusZeroValueRootIndex); Node* CodeStubAssembler::name##Constant() { \
} return LoadRoot(Heap::k##rootName##RootIndex); \
}
Node* CodeStubAssembler::NanConstant() { HEAP_CONSTANT_LIST(HEAP_CONSTANT_ACCESSOR);
return LoadRoot(Heap::kNanValueRootIndex); #undef HEAP_CONSTANT_ACCESSOR
}
Node* CodeStubAssembler::NullConstant() {
return LoadRoot(Heap::kNullValueRootIndex);
}
Node* CodeStubAssembler::UndefinedConstant() {
return LoadRoot(Heap::kUndefinedValueRootIndex);
}
Node* CodeStubAssembler::TheHoleConstant() { #define HEAP_CONSTANT_TEST(rootName, name) \
return LoadRoot(Heap::kTheHoleValueRootIndex); Node* CodeStubAssembler::Is##name(Node* value) { \
} return WordEqual(value, name##Constant()); \
}
HEAP_CONSTANT_LIST(HEAP_CONSTANT_TEST);
#undef HEAP_CONSTANT_TEST
Node* CodeStubAssembler::HashSeed() { Node* CodeStubAssembler::HashSeed() {
return LoadAndUntagToWord32Root(Heap::kHashSeedRootIndex); return LoadAndUntagToWord32Root(Heap::kHashSeedRootIndex);
......
...@@ -25,6 +25,19 @@ enum class UnicodeEncoding { ...@@ -25,6 +25,19 @@ enum class UnicodeEncoding {
UTF32, // full UTF32 code unit / Unicode codepoint UTF32, // full UTF32 code unit / Unicode codepoint
}; };
#define HEAP_CONSTANT_LIST(V) \
V(BooleanMap, BooleanMap) \
V(empty_string, EmptyString) \
V(FixedArrayMap, FixedArrayMap) \
V(FixedCOWArrayMap, FixedCOWArrayMap) \
V(FixedDoubleArrayMap, FixedDoubleArrayMap) \
V(HeapNumberMap, HeapNumberMap) \
V(MinusZeroValue, MinusZero) \
V(NanValue, Nan) \
V(NullValue, Null) \
V(TheHoleValue, TheHole) \
V(UndefinedValue, Undefined)
// Provides JavaScript-specific "macro-assembler" functionality on top of the // Provides JavaScript-specific "macro-assembler" functionality on top of the
// CodeAssembler. By factoring the JavaScript-isms out of the CodeAssembler, // CodeAssembler. By factoring the JavaScript-isms out of the CodeAssembler,
// it's possible to add JavaScript-specific useful CodeAssembler "macros" // it's possible to add JavaScript-specific useful CodeAssembler "macros"
...@@ -76,18 +89,16 @@ class CodeStubAssembler : public compiler::CodeAssembler { ...@@ -76,18 +89,16 @@ class CodeStubAssembler : public compiler::CodeAssembler {
return value; return value;
} }
compiler::Node* BooleanMapConstant();
compiler::Node* EmptyStringConstant();
compiler::Node* FixedArrayMapConstant();
compiler::Node* FixedCowArrayMapConstant();
compiler::Node* FixedDoubleArrayMapConstant();
compiler::Node* HeapNumberMapConstant();
compiler::Node* NoContextConstant(); compiler::Node* NoContextConstant();
compiler::Node* NanConstant(); #define HEAP_CONSTANT_ACCESSOR(rootName, name) compiler::Node* name##Constant();
compiler::Node* NullConstant(); HEAP_CONSTANT_LIST(HEAP_CONSTANT_ACCESSOR)
compiler::Node* MinusZeroConstant(); #undef HEAP_CONSTANT_ACCESSOR
compiler::Node* UndefinedConstant();
compiler::Node* TheHoleConstant(); #define HEAP_CONSTANT_TEST(rootName, name) \
compiler::Node* Is##name(compiler::Node* value);
HEAP_CONSTANT_LIST(HEAP_CONSTANT_TEST)
#undef HEAP_CONSTANT_TEST
compiler::Node* HashSeed(); compiler::Node* HashSeed();
compiler::Node* StaleRegisterConstant(); compiler::Node* StaleRegisterConstant();
......
...@@ -731,9 +731,8 @@ compiler::Node* AddStub::Generate(CodeStubAssembler* assembler, ...@@ -731,9 +731,8 @@ compiler::Node* AddStub::Generate(CodeStubAssembler* assembler,
// Check if the {rhs} is a HeapNumber. // Check if the {rhs} is a HeapNumber.
Label if_rhsisnumber(assembler), Label if_rhsisnumber(assembler),
if_rhsisnotnumber(assembler, Label::kDeferred); if_rhsisnotnumber(assembler, Label::kDeferred);
Node* number_map = assembler->HeapNumberMapConstant(); assembler->Branch(assembler->IsHeapNumberMap(rhs_map), &if_rhsisnumber,
assembler->Branch(assembler->WordEqual(rhs_map, number_map), &if_rhsisnotnumber);
&if_rhsisnumber, &if_rhsisnotnumber);
assembler->Bind(&if_rhsisnumber); assembler->Bind(&if_rhsisnumber);
{ {
...@@ -1097,9 +1096,8 @@ compiler::Node* AddWithFeedbackStub::Generate( ...@@ -1097,9 +1096,8 @@ compiler::Node* AddWithFeedbackStub::Generate(
Node* rhs_map = assembler->LoadMap(rhs); Node* rhs_map = assembler->LoadMap(rhs);
// Check if the {rhs} is a HeapNumber. // Check if the {rhs} is a HeapNumber.
assembler->GotoUnless( assembler->GotoUnless(assembler->IsHeapNumberMap(rhs_map),
assembler->WordEqual(rhs_map, assembler->HeapNumberMapConstant()), &call_add_stub);
&call_add_stub);
var_fadd_lhs.Bind(assembler->SmiToFloat64(lhs)); var_fadd_lhs.Bind(assembler->SmiToFloat64(lhs));
var_fadd_rhs.Bind(assembler->LoadHeapNumberValue(rhs)); var_fadd_rhs.Bind(assembler->LoadHeapNumberValue(rhs));
...@@ -1114,9 +1112,7 @@ compiler::Node* AddWithFeedbackStub::Generate( ...@@ -1114,9 +1112,7 @@ compiler::Node* AddWithFeedbackStub::Generate(
// Check if {lhs} is a HeapNumber. // Check if {lhs} is a HeapNumber.
Label if_lhsisnumber(assembler), if_lhsisnotnumber(assembler); Label if_lhsisnumber(assembler), if_lhsisnotnumber(assembler);
assembler->GotoUnless( assembler->GotoUnless(assembler->IsHeapNumberMap(lhs_map), &call_add_stub);
assembler->WordEqual(lhs_map, assembler->HeapNumberMapConstant()),
&call_add_stub);
// Check if the {rhs} is Smi. // Check if the {rhs} is Smi.
Label if_rhsissmi(assembler), if_rhsisnotsmi(assembler); Label if_rhsissmi(assembler), if_rhsisnotsmi(assembler);
...@@ -1135,8 +1131,7 @@ compiler::Node* AddWithFeedbackStub::Generate( ...@@ -1135,8 +1131,7 @@ compiler::Node* AddWithFeedbackStub::Generate(
Node* rhs_map = assembler->LoadMap(rhs); Node* rhs_map = assembler->LoadMap(rhs);
// Check if the {rhs} is a HeapNumber. // Check if the {rhs} is a HeapNumber.
Node* number_map = assembler->HeapNumberMapConstant(); assembler->GotoUnless(assembler->IsHeapNumberMap(rhs_map),
assembler->GotoUnless(assembler->WordEqual(rhs_map, number_map),
&call_add_stub); &call_add_stub);
var_fadd_lhs.Bind(assembler->LoadHeapNumberValue(lhs)); var_fadd_lhs.Bind(assembler->LoadHeapNumberValue(lhs));
...@@ -1243,9 +1238,8 @@ compiler::Node* SubtractStub::Generate(CodeStubAssembler* assembler, ...@@ -1243,9 +1238,8 @@ compiler::Node* SubtractStub::Generate(CodeStubAssembler* assembler,
// Check if {rhs} is a HeapNumber. // Check if {rhs} is a HeapNumber.
Label if_rhsisnumber(assembler), Label if_rhsisnumber(assembler),
if_rhsisnotnumber(assembler, Label::kDeferred); if_rhsisnotnumber(assembler, Label::kDeferred);
Node* number_map = assembler->HeapNumberMapConstant(); assembler->Branch(assembler->IsHeapNumberMap(rhs_map), &if_rhsisnumber,
assembler->Branch(assembler->WordEqual(rhs_map, number_map), &if_rhsisnotnumber);
&if_rhsisnumber, &if_rhsisnotnumber);
assembler->Bind(&if_rhsisnumber); assembler->Bind(&if_rhsisnumber);
{ {
...@@ -1406,9 +1400,8 @@ compiler::Node* SubtractWithFeedbackStub::Generate( ...@@ -1406,9 +1400,8 @@ compiler::Node* SubtractWithFeedbackStub::Generate(
Node* rhs_map = assembler->LoadMap(rhs); Node* rhs_map = assembler->LoadMap(rhs);
// Check if {rhs} is a HeapNumber. // Check if {rhs} is a HeapNumber.
assembler->GotoUnless( assembler->GotoUnless(assembler->IsHeapNumberMap(rhs_map),
assembler->WordEqual(rhs_map, assembler->HeapNumberMapConstant()), &call_subtract_stub);
&call_subtract_stub);
// Perform a floating point subtraction. // Perform a floating point subtraction.
var_fsub_lhs.Bind(assembler->SmiToFloat64(lhs)); var_fsub_lhs.Bind(assembler->SmiToFloat64(lhs));
...@@ -1423,9 +1416,8 @@ compiler::Node* SubtractWithFeedbackStub::Generate( ...@@ -1423,9 +1416,8 @@ compiler::Node* SubtractWithFeedbackStub::Generate(
Node* lhs_map = assembler->LoadMap(lhs); Node* lhs_map = assembler->LoadMap(lhs);
// Check if the {lhs} is a HeapNumber. // Check if the {lhs} is a HeapNumber.
assembler->GotoUnless( assembler->GotoUnless(assembler->IsHeapNumberMap(lhs_map),
assembler->WordEqual(lhs_map, assembler->HeapNumberMapConstant()), &call_subtract_stub);
&call_subtract_stub);
// Check if the {rhs} is a Smi. // Check if the {rhs} is a Smi.
Label if_rhsissmi(assembler), if_rhsisnotsmi(assembler); Label if_rhsissmi(assembler), if_rhsisnotsmi(assembler);
...@@ -1445,9 +1437,8 @@ compiler::Node* SubtractWithFeedbackStub::Generate( ...@@ -1445,9 +1437,8 @@ compiler::Node* SubtractWithFeedbackStub::Generate(
Node* rhs_map = assembler->LoadMap(rhs); Node* rhs_map = assembler->LoadMap(rhs);
// Check if the {rhs} is a HeapNumber. // Check if the {rhs} is a HeapNumber.
assembler->GotoUnless( assembler->GotoUnless(assembler->IsHeapNumberMap(rhs_map),
assembler->WordEqual(rhs_map, assembler->HeapNumberMapConstant()), &call_subtract_stub);
&call_subtract_stub);
// Perform a floating point subtraction. // Perform a floating point subtraction.
var_fsub_lhs.Bind(assembler->LoadHeapNumberValue(lhs)); var_fsub_lhs.Bind(assembler->LoadHeapNumberValue(lhs));
...@@ -2573,8 +2564,7 @@ compiler::Node* IncStub::Generate(CodeStubAssembler* assembler, ...@@ -2573,8 +2564,7 @@ compiler::Node* IncStub::Generate(CodeStubAssembler* assembler,
Label if_valueisnumber(assembler), Label if_valueisnumber(assembler),
if_valuenotnumber(assembler, Label::kDeferred); if_valuenotnumber(assembler, Label::kDeferred);
Node* value_map = assembler->LoadMap(value); Node* value_map = assembler->LoadMap(value);
Node* number_map = assembler->HeapNumberMapConstant(); assembler->Branch(assembler->IsHeapNumberMap(value_map),
assembler->Branch(assembler->WordEqual(value_map, number_map),
&if_valueisnumber, &if_valuenotnumber); &if_valueisnumber, &if_valuenotnumber);
assembler->Bind(&if_valueisnumber); assembler->Bind(&if_valueisnumber);
...@@ -2677,8 +2667,7 @@ compiler::Node* DecStub::Generate(CodeStubAssembler* assembler, ...@@ -2677,8 +2667,7 @@ compiler::Node* DecStub::Generate(CodeStubAssembler* assembler,
Label if_valueisnumber(assembler), Label if_valueisnumber(assembler),
if_valuenotnumber(assembler, Label::kDeferred); if_valuenotnumber(assembler, Label::kDeferred);
Node* value_map = assembler->LoadMap(value); Node* value_map = assembler->LoadMap(value);
Node* number_map = assembler->HeapNumberMapConstant(); assembler->Branch(assembler->IsHeapNumberMap(value_map),
assembler->Branch(assembler->WordEqual(value_map, number_map),
&if_valueisnumber, &if_valuenotnumber); &if_valueisnumber, &if_valuenotnumber);
assembler->Bind(&if_valueisnumber); assembler->Bind(&if_valueisnumber);
...@@ -2749,9 +2738,7 @@ void ToObjectStub::GenerateAssembly(CodeStubAssembler* assembler) const { ...@@ -2749,9 +2738,7 @@ void ToObjectStub::GenerateAssembly(CodeStubAssembler* assembler) const {
assembler->Bind(&if_notsmi); assembler->Bind(&if_notsmi);
Node* map = assembler->LoadMap(object); Node* map = assembler->LoadMap(object);
assembler->GotoIf( assembler->GotoIf(assembler->IsHeapNumberMap(map), &if_number);
assembler->WordEqual(map, assembler->HeapNumberMapConstant()),
&if_number);
Node* instance_type = assembler->LoadMapInstanceType(map); Node* instance_type = assembler->LoadMapInstanceType(map);
assembler->GotoIf( assembler->GotoIf(
...@@ -2819,9 +2806,7 @@ compiler::Node* TypeofStub::Generate(CodeStubAssembler* assembler, ...@@ -2819,9 +2806,7 @@ compiler::Node* TypeofStub::Generate(CodeStubAssembler* assembler,
Node* map = assembler->LoadMap(value); Node* map = assembler->LoadMap(value);
assembler->GotoIf( assembler->GotoIf(assembler->IsHeapNumberMap(map), &return_number);
assembler->WordEqual(map, assembler->HeapNumberMapConstant()),
&return_number);
Node* instance_type = assembler->LoadMapInstanceType(map); Node* instance_type = assembler->LoadMapInstanceType(map);
...@@ -3048,11 +3033,10 @@ compiler::Node* GenerateAbstractRelationalComparison( ...@@ -3048,11 +3033,10 @@ compiler::Node* GenerateAbstractRelationalComparison(
Node* rhs_map = assembler->LoadMap(rhs); Node* rhs_map = assembler->LoadMap(rhs);
// Check if the {rhs} is a HeapNumber. // Check if the {rhs} is a HeapNumber.
Node* number_map = assembler->HeapNumberMapConstant();
Label if_rhsisnumber(assembler), Label if_rhsisnumber(assembler),
if_rhsisnotnumber(assembler, Label::kDeferred); if_rhsisnotnumber(assembler, Label::kDeferred);
assembler->Branch(assembler->WordEqual(rhs_map, number_map), assembler->Branch(assembler->IsHeapNumberMap(rhs_map), &if_rhsisnumber,
&if_rhsisnumber, &if_rhsisnotnumber); &if_rhsisnotnumber);
assembler->Bind(&if_rhsisnumber); assembler->Bind(&if_rhsisnumber);
{ {
...@@ -3358,10 +3342,9 @@ void GenerateEqual_Same(CodeStubAssembler* assembler, compiler::Node* value, ...@@ -3358,10 +3342,9 @@ void GenerateEqual_Same(CodeStubAssembler* assembler, compiler::Node* value,
Node* value_map = assembler->LoadMap(value); Node* value_map = assembler->LoadMap(value);
// Check if {value} (and therefore {rhs}) is a HeapNumber. // Check if {value} (and therefore {rhs}) is a HeapNumber.
Node* number_map = assembler->HeapNumberMapConstant();
Label if_valueisnumber(assembler), if_valueisnotnumber(assembler); Label if_valueisnumber(assembler), if_valueisnotnumber(assembler);
assembler->Branch(assembler->WordEqual(value_map, number_map), assembler->Branch(assembler->IsHeapNumberMap(value_map), &if_valueisnumber,
&if_valueisnumber, &if_valueisnotnumber); &if_valueisnotnumber);
assembler->Bind(&if_valueisnumber); assembler->Bind(&if_valueisnumber);
{ {
...@@ -3498,9 +3481,8 @@ compiler::Node* GenerateEqual(CodeStubAssembler* assembler, ResultMode mode, ...@@ -3498,9 +3481,8 @@ compiler::Node* GenerateEqual(CodeStubAssembler* assembler, ResultMode mode,
assembler->Bind(&if_rhsisnotstring); assembler->Bind(&if_rhsisnotstring);
{ {
// Check if the {rhs} is a Boolean. // Check if the {rhs} is a Boolean.
Node* boolean_map = assembler->BooleanMapConstant();
Label if_rhsisboolean(assembler), if_rhsisnotboolean(assembler); Label if_rhsisboolean(assembler), if_rhsisnotboolean(assembler);
assembler->Branch(assembler->WordEqual(rhs_map, boolean_map), assembler->Branch(assembler->IsBooleanMap(rhs_map),
&if_rhsisboolean, &if_rhsisnotboolean); &if_rhsisboolean, &if_rhsisnotboolean);
assembler->Bind(&if_rhsisboolean); assembler->Bind(&if_rhsisboolean);
...@@ -3696,8 +3678,7 @@ compiler::Node* GenerateEqual(CodeStubAssembler* assembler, ResultMode mode, ...@@ -3696,8 +3678,7 @@ compiler::Node* GenerateEqual(CodeStubAssembler* assembler, ResultMode mode,
// Check if {rhs} is a Boolean. // Check if {rhs} is a Boolean.
Label if_rhsisboolean(assembler), Label if_rhsisboolean(assembler),
if_rhsisnotboolean(assembler); if_rhsisnotboolean(assembler);
Node* boolean_map = assembler->BooleanMapConstant(); assembler->Branch(assembler->IsBooleanMap(rhs_map),
assembler->Branch(assembler->WordEqual(rhs_map, boolean_map),
&if_rhsisboolean, &if_rhsisnotboolean); &if_rhsisboolean, &if_rhsisnotboolean);
assembler->Bind(&if_rhsisboolean); assembler->Bind(&if_rhsisboolean);
...@@ -4302,9 +4283,7 @@ void StoreGlobalStub::GenerateAssembly(CodeStubAssembler* assembler) const { ...@@ -4302,9 +4283,7 @@ void StoreGlobalStub::GenerateAssembly(CodeStubAssembler* assembler) const {
// This is always valid for all states a cell can be in. // This is always valid for all states a cell can be in.
assembler->GotoIf(assembler->WordNotEqual(cell_contents, value), &miss); assembler->GotoIf(assembler->WordNotEqual(cell_contents, value), &miss);
} else { } else {
assembler->GotoIf( assembler->GotoIf(assembler->IsTheHole(cell_contents), &miss);
assembler->WordEqual(cell_contents, assembler->TheHoleConstant()),
&miss);
// When dealing with constant types, the type may be allowed to change, as // When dealing with constant types, the type may be allowed to change, as
// long as optimized code remains valid. // long as optimized code remains valid.
...@@ -4526,8 +4505,7 @@ void ToLengthStub::GenerateAssembly(CodeStubAssembler* assembler) const { ...@@ -4526,8 +4505,7 @@ void ToLengthStub::GenerateAssembly(CodeStubAssembler* assembler) const {
// Check if {len} is a HeapNumber. // Check if {len} is a HeapNumber.
Label if_lenisheapnumber(assembler), Label if_lenisheapnumber(assembler),
if_lenisnotheapnumber(assembler, Label::kDeferred); if_lenisnotheapnumber(assembler, Label::kDeferred);
assembler->Branch(assembler->WordEqual(assembler->LoadMap(len), assembler->Branch(assembler->IsHeapNumberMap(assembler->LoadMap(len)),
assembler->HeapNumberMapConstant()),
&if_lenisheapnumber, &if_lenisnotheapnumber); &if_lenisheapnumber, &if_lenisnotheapnumber);
assembler->Bind(&if_lenisheapnumber); assembler->Bind(&if_lenisheapnumber);
...@@ -4650,9 +4628,7 @@ compiler::Node* FastCloneShallowObjectStub::GenerateFastPath( ...@@ -4650,9 +4628,7 @@ compiler::Node* FastCloneShallowObjectStub::GenerateFastPath(
literals_array, literals_index, literals_array, literals_index,
LiteralsArray::kFirstLiteralIndex * kPointerSize, LiteralsArray::kFirstLiteralIndex * kPointerSize,
CodeStubAssembler::SMI_PARAMETERS); CodeStubAssembler::SMI_PARAMETERS);
Node* undefined = assembler->UndefinedConstant(); assembler->GotoIf(assembler->IsUndefined(allocation_site), call_runtime);
assembler->GotoIf(assembler->WordEqual(allocation_site, undefined),
call_runtime);
// Calculate the object and allocation size based on the properties count. // Calculate the object and allocation size based on the properties count.
Node* object_size = assembler->IntPtrAdd( Node* object_size = assembler->IntPtrAdd(
...@@ -5291,15 +5267,13 @@ compiler::Node* FastCloneRegExpStub::Generate(CodeStubAssembler* assembler, ...@@ -5291,15 +5267,13 @@ compiler::Node* FastCloneRegExpStub::Generate(CodeStubAssembler* assembler,
Variable result(assembler, MachineRepresentation::kTagged); Variable result(assembler, MachineRepresentation::kTagged);
Node* undefined = assembler->UndefinedConstant();
Node* literals_array = Node* literals_array =
assembler->LoadObjectField(closure, JSFunction::kLiteralsOffset); assembler->LoadObjectField(closure, JSFunction::kLiteralsOffset);
Node* boilerplate = assembler->LoadFixedArrayElement( Node* boilerplate = assembler->LoadFixedArrayElement(
literals_array, literal_index, literals_array, literal_index,
LiteralsArray::kFirstLiteralIndex * kPointerSize, LiteralsArray::kFirstLiteralIndex * kPointerSize,
CodeStubAssembler::SMI_PARAMETERS); CodeStubAssembler::SMI_PARAMETERS);
assembler->GotoIf(assembler->WordEqual(boilerplate, undefined), assembler->GotoIf(assembler->IsUndefined(boilerplate), &call_runtime);
&call_runtime);
{ {
int size = JSRegExp::kSize + JSRegExp::kInObjectFieldCount * kPointerSize; int size = JSRegExp::kSize + JSRegExp::kInObjectFieldCount * kPointerSize;
...@@ -5404,9 +5378,7 @@ compiler::Node* FastCloneShallowArrayStub::Generate( ...@@ -5404,9 +5378,7 @@ compiler::Node* FastCloneShallowArrayStub::Generate(
LiteralsArray::kFirstLiteralIndex * kPointerSize, LiteralsArray::kFirstLiteralIndex * kPointerSize,
CodeStubAssembler::SMI_PARAMETERS); CodeStubAssembler::SMI_PARAMETERS);
Node* undefined = assembler->UndefinedConstant(); assembler->GotoIf(assembler->IsUndefined(allocation_site), call_runtime);
assembler->GotoIf(assembler->WordEqual(allocation_site, undefined),
call_runtime);
allocation_site = assembler->LoadFixedArrayElement( allocation_site = assembler->LoadFixedArrayElement(
literals_array, literal_index, literals_array, literal_index,
LiteralsArray::kFirstLiteralIndex * kPointerSize, LiteralsArray::kFirstLiteralIndex * kPointerSize,
...@@ -5424,21 +5396,15 @@ compiler::Node* FastCloneShallowArrayStub::Generate( ...@@ -5424,21 +5396,15 @@ compiler::Node* FastCloneShallowArrayStub::Generate(
assembler->GotoIf(assembler->SmiEqual(capacity, zero), &zero_capacity); assembler->GotoIf(assembler->SmiEqual(capacity, zero), &zero_capacity);
Node* elements_map = assembler->LoadMap(boilerplate_elements); Node* elements_map = assembler->LoadMap(boilerplate_elements);
assembler->GotoIf( assembler->GotoIf(assembler->IsFixedCOWArrayMap(elements_map), &cow_elements);
assembler->WordEqual(elements_map, assembler->FixedCowArrayMapConstant()),
&cow_elements);
assembler->GotoIf( assembler->GotoIf(assembler->IsFixedArrayMap(elements_map), &fast_elements);
assembler->WordEqual(elements_map, assembler->FixedArrayMapConstant()),
&fast_elements);
{ {
assembler->Comment("fast double elements path"); assembler->Comment("fast double elements path");
if (FLAG_debug_code) { if (FLAG_debug_code) {
Label correct_elements_map(assembler), abort(assembler, Label::kDeferred); Label correct_elements_map(assembler), abort(assembler, Label::kDeferred);
assembler->BranchIf( assembler->BranchIf(assembler->IsFixedDoubleArrayMap(elements_map),
assembler->WordEqual(elements_map, &correct_elements_map, &abort);
assembler->FixedDoubleArrayMapConstant()),
&correct_elements_map, &abort);
assembler->Bind(&abort); assembler->Bind(&abort);
{ {
......
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment