Commit c28bee0f authored by jkummerow's avatar jkummerow Committed by Commit bot

Reland of [cleanup] CodeStubAssembler: s/compiler::Node/Node/

Reducing visual clutter.

No changes since previous attempt; this was only reverted because it blocked another revert.
Original review: https://codereview.chromium.org/2519093002/

TBR=ishell@chromium.org

Review-Url: https://codereview.chromium.org/2526803002
Cr-Commit-Position: refs/heads/master@{#41235}
parent e108f90d
...@@ -884,13 +884,12 @@ void CodeStubAssembler::BranchIfToBooleanIsTrue(Node* value, Label* if_true, ...@@ -884,13 +884,12 @@ void CodeStubAssembler::BranchIfToBooleanIsTrue(Node* value, Label* if_true,
} }
} }
compiler::Node* CodeStubAssembler::LoadFromFrame(int offset, MachineType rep) { Node* CodeStubAssembler::LoadFromFrame(int offset, MachineType rep) {
Node* frame_pointer = LoadFramePointer(); Node* frame_pointer = LoadFramePointer();
return Load(rep, frame_pointer, IntPtrConstant(offset)); return Load(rep, frame_pointer, IntPtrConstant(offset));
} }
compiler::Node* CodeStubAssembler::LoadFromParentFrame(int offset, Node* CodeStubAssembler::LoadFromParentFrame(int offset, MachineType rep) {
MachineType rep) {
Node* frame_pointer = LoadParentFramePointer(); Node* frame_pointer = LoadParentFramePointer();
return Load(rep, frame_pointer, IntPtrConstant(offset)); return Load(rep, frame_pointer, IntPtrConstant(offset));
} }
...@@ -2076,11 +2075,12 @@ void CodeStubAssembler::CopyFixedArrayElements( ...@@ -2076,11 +2075,12 @@ void CodeStubAssembler::CopyFixedArrayElements(
Comment("] CopyFixedArrayElements"); Comment("] CopyFixedArrayElements");
} }
void CodeStubAssembler::CopyStringCharacters( void CodeStubAssembler::CopyStringCharacters(Node* from_string, Node* to_string,
compiler::Node* from_string, compiler::Node* to_string, Node* from_index, Node* to_index,
compiler::Node* from_index, compiler::Node* to_index, Node* character_count,
compiler::Node* character_count, String::Encoding from_encoding, String::Encoding from_encoding,
String::Encoding to_encoding, ParameterMode mode) { String::Encoding to_encoding,
ParameterMode mode) {
bool from_one_byte = from_encoding == String::ONE_BYTE_ENCODING; bool from_one_byte = from_encoding == String::ONE_BYTE_ENCODING;
bool to_one_byte = to_encoding == String::ONE_BYTE_ENCODING; bool to_one_byte = to_encoding == String::ONE_BYTE_ENCODING;
DCHECK_IMPLIES(to_one_byte, from_one_byte); DCHECK_IMPLIES(to_one_byte, from_one_byte);
...@@ -2239,9 +2239,9 @@ Node* CodeStubAssembler::GrowElementsCapacity( ...@@ -2239,9 +2239,9 @@ Node* CodeStubAssembler::GrowElementsCapacity(
return new_elements; return new_elements;
} }
void CodeStubAssembler::InitializeAllocationMemento( void CodeStubAssembler::InitializeAllocationMemento(Node* base_allocation,
compiler::Node* base_allocation, int base_allocation_size, int base_allocation_size,
compiler::Node* allocation_site) { Node* allocation_site) {
StoreObjectFieldNoWriteBarrier( StoreObjectFieldNoWriteBarrier(
base_allocation, AllocationMemento::kMapOffset + base_allocation_size, base_allocation, AllocationMemento::kMapOffset + base_allocation_size,
HeapConstant(Handle<Map>(isolate()->heap()->allocation_memento_map()))); HeapConstant(Handle<Map>(isolate()->heap()->allocation_memento_map())));
...@@ -3442,7 +3442,7 @@ Node* CodeStubAssembler::StringIndexOfChar(Node* context, Node* string, ...@@ -3442,7 +3442,7 @@ Node* CodeStubAssembler::StringIndexOfChar(Node* context, Node* string,
return var_result.value(); return var_result.value();
} }
Node* CodeStubAssembler::StringFromCodePoint(compiler::Node* codepoint, Node* CodeStubAssembler::StringFromCodePoint(Node* codepoint,
UnicodeEncoding encoding) { UnicodeEncoding encoding) {
Variable var_result(this, MachineRepresentation::kTagged); Variable var_result(this, MachineRepresentation::kTagged);
var_result.Bind(EmptyStringConstant()); var_result.Bind(EmptyStringConstant());
...@@ -3520,8 +3520,7 @@ Node* CodeStubAssembler::StringToNumber(Node* context, Node* input) { ...@@ -3520,8 +3520,7 @@ Node* CodeStubAssembler::StringToNumber(Node* context, Node* input) {
return var_result.value(); return var_result.value();
} }
Node* CodeStubAssembler::NumberToString(compiler::Node* context, Node* CodeStubAssembler::NumberToString(Node* context, Node* argument) {
compiler::Node* argument) {
Variable result(this, MachineRepresentation::kTagged); Variable result(this, MachineRepresentation::kTagged);
Label runtime(this, Label::kDeferred); Label runtime(this, Label::kDeferred);
Label smi(this); Label smi(this);
...@@ -3600,9 +3599,6 @@ Node* CodeStubAssembler::NumberToString(compiler::Node* context, ...@@ -3600,9 +3599,6 @@ Node* CodeStubAssembler::NumberToString(compiler::Node* context,
} }
Node* CodeStubAssembler::ToName(Node* context, Node* value) { Node* CodeStubAssembler::ToName(Node* context, Node* value) {
typedef CodeStubAssembler::Label Label;
typedef CodeStubAssembler::Variable Variable;
Label end(this); Label end(this);
Variable var_result(this, MachineRepresentation::kTagged); Variable var_result(this, MachineRepresentation::kTagged);
...@@ -4447,11 +4443,10 @@ void CodeStubAssembler::TryLookupProperty( ...@@ -4447,11 +4443,10 @@ void CodeStubAssembler::TryLookupProperty(
} }
} }
void CodeStubAssembler::TryHasOwnProperty(compiler::Node* object, void CodeStubAssembler::TryHasOwnProperty(Node* object, Node* map,
compiler::Node* map, Node* instance_type,
compiler::Node* instance_type, Node* unique_name, Label* if_found,
compiler::Node* unique_name, Label* if_not_found,
Label* if_found, Label* if_not_found,
Label* if_bailout) { Label* if_bailout) {
Comment("TryHasOwnProperty"); Comment("TryHasOwnProperty");
Variable var_meta_storage(this, MachineRepresentation::kTagged); Variable var_meta_storage(this, MachineRepresentation::kTagged);
...@@ -5083,10 +5078,10 @@ Node* CodeStubAssembler::OrdinaryHasInstance(Node* context, Node* callable, ...@@ -5083,10 +5078,10 @@ Node* CodeStubAssembler::OrdinaryHasInstance(Node* context, Node* callable,
return var_result.value(); return var_result.value();
} }
compiler::Node* CodeStubAssembler::ElementOffsetFromIndex(Node* index_node, Node* CodeStubAssembler::ElementOffsetFromIndex(Node* index_node,
ElementsKind kind, ElementsKind kind,
ParameterMode mode, ParameterMode mode,
int base_size) { int base_size) {
int element_size_shift = ElementsKindToShiftSize(kind); int element_size_shift = ElementsKindToShiftSize(kind);
int element_size = 1 << element_size_shift; int element_size = 1 << element_size_shift;
int const kSmiShiftBits = kSmiShiftSize + kSmiTagSize; int const kSmiShiftBits = kSmiShiftSize + kSmiTagSize;
...@@ -5122,16 +5117,16 @@ compiler::Node* CodeStubAssembler::ElementOffsetFromIndex(Node* index_node, ...@@ -5122,16 +5117,16 @@ compiler::Node* CodeStubAssembler::ElementOffsetFromIndex(Node* index_node,
return IntPtrAddFoldConstants(IntPtrConstant(base_size), shifted_index); return IntPtrAddFoldConstants(IntPtrConstant(base_size), shifted_index);
} }
compiler::Node* CodeStubAssembler::LoadTypeFeedbackVectorForStub() { Node* CodeStubAssembler::LoadTypeFeedbackVectorForStub() {
Node* function = Node* function =
LoadFromParentFrame(JavaScriptFrameConstants::kFunctionOffset); LoadFromParentFrame(JavaScriptFrameConstants::kFunctionOffset);
Node* literals = LoadObjectField(function, JSFunction::kLiteralsOffset); Node* literals = LoadObjectField(function, JSFunction::kLiteralsOffset);
return LoadObjectField(literals, LiteralsArray::kFeedbackVectorOffset); return LoadObjectField(literals, LiteralsArray::kFeedbackVectorOffset);
} }
void CodeStubAssembler::UpdateFeedback(compiler::Node* feedback, void CodeStubAssembler::UpdateFeedback(Node* feedback,
compiler::Node* type_feedback_vector, Node* type_feedback_vector,
compiler::Node* slot_id) { Node* slot_id) {
// This method is used for binary op and compare feedback. These // This method is used for binary op and compare feedback. These
// vector nodes are initialized with a smi 0, so we can simply OR // vector nodes are initialized with a smi 0, so we can simply OR
// our new feedback in place. // our new feedback in place.
...@@ -5144,7 +5139,7 @@ void CodeStubAssembler::UpdateFeedback(compiler::Node* feedback, ...@@ -5144,7 +5139,7 @@ void CodeStubAssembler::UpdateFeedback(compiler::Node* feedback,
SKIP_WRITE_BARRIER); SKIP_WRITE_BARRIER);
} }
compiler::Node* CodeStubAssembler::LoadReceiverMap(compiler::Node* receiver) { Node* CodeStubAssembler::LoadReceiverMap(Node* receiver) {
Variable var_receiver_map(this, MachineRepresentation::kTagged); Variable var_receiver_map(this, MachineRepresentation::kTagged);
Label load_smi_map(this, Label::kDeferred), load_receiver_map(this), Label load_smi_map(this, Label::kDeferred), load_receiver_map(this),
if_result(this); if_result(this);
...@@ -5188,7 +5183,7 @@ Node* CodeStubAssembler::TryToIntptr(Node* key, Label* miss) { ...@@ -5188,7 +5183,7 @@ Node* CodeStubAssembler::TryToIntptr(Node* key, Label* miss) {
return var_intptr_key.value(); return var_intptr_key.value();
} }
void CodeStubAssembler::ExtendPropertiesBackingStore(compiler::Node* object) { void CodeStubAssembler::ExtendPropertiesBackingStore(Node* object) {
Node* properties = LoadProperties(object); Node* properties = LoadProperties(object);
Node* length = LoadFixedArrayBaseLength(properties); Node* length = LoadFixedArrayBaseLength(properties);
...@@ -5642,9 +5637,11 @@ Node* CodeStubAssembler::CopyElementsOnWrite(Node* object, Node* elements, ...@@ -5642,9 +5637,11 @@ Node* CodeStubAssembler::CopyElementsOnWrite(Node* object, Node* elements,
return new_elements_var.value(); return new_elements_var.value();
} }
void CodeStubAssembler::TransitionElementsKind( void CodeStubAssembler::TransitionElementsKind(Node* object, Node* map,
compiler::Node* object, compiler::Node* map, ElementsKind from_kind, ElementsKind from_kind,
ElementsKind to_kind, bool is_jsarray, Label* bailout) { ElementsKind to_kind,
bool is_jsarray,
Label* bailout) {
DCHECK(!IsFastHoleyElementsKind(from_kind) || DCHECK(!IsFastHoleyElementsKind(from_kind) ||
IsFastHoleyElementsKind(to_kind)); IsFastHoleyElementsKind(to_kind));
if (AllocationSite::GetMode(from_kind, to_kind) == TRACK_ALLOCATION_SITE) { if (AllocationSite::GetMode(from_kind, to_kind) == TRACK_ALLOCATION_SITE) {
...@@ -5907,11 +5904,10 @@ void CodeStubAssembler::BuildFastLoop( ...@@ -5907,11 +5904,10 @@ void CodeStubAssembler::BuildFastLoop(
} }
void CodeStubAssembler::BuildFastFixedArrayForEach( void CodeStubAssembler::BuildFastFixedArrayForEach(
compiler::Node* fixed_array, ElementsKind kind, Node* fixed_array, ElementsKind kind, Node* first_element_inclusive,
compiler::Node* first_element_inclusive, Node* last_element_exclusive,
compiler::Node* last_element_exclusive, std::function<void(CodeStubAssembler* assembler, Node* fixed_array,
std::function<void(CodeStubAssembler* assembler, Node* offset)>
compiler::Node* fixed_array, compiler::Node* offset)>
body, body,
ParameterMode mode, ForEachDirection direction) { ParameterMode mode, ForEachDirection direction) {
STATIC_ASSERT(FixedArray::kHeaderSize == FixedDoubleArray::kHeaderSize); STATIC_ASSERT(FixedArray::kHeaderSize == FixedDoubleArray::kHeaderSize);
...@@ -5964,10 +5960,8 @@ void CodeStubAssembler::BuildFastFixedArrayForEach( ...@@ -5964,10 +5960,8 @@ void CodeStubAssembler::BuildFastFixedArrayForEach(
} }
void CodeStubAssembler::BranchIfNumericRelationalComparison( void CodeStubAssembler::BranchIfNumericRelationalComparison(
RelationalComparisonMode mode, compiler::Node* lhs, compiler::Node* rhs, RelationalComparisonMode mode, Node* lhs, Node* rhs, Label* if_true,
Label* if_true, Label* if_false) { Label* if_false) {
typedef compiler::Node Node;
Label end(this); Label end(this);
Variable result(this, MachineRepresentation::kTagged); Variable result(this, MachineRepresentation::kTagged);
...@@ -6069,19 +6063,16 @@ void CodeStubAssembler::BranchIfNumericRelationalComparison( ...@@ -6069,19 +6063,16 @@ void CodeStubAssembler::BranchIfNumericRelationalComparison(
} }
} }
void CodeStubAssembler::GotoUnlessNumberLessThan(compiler::Node* lhs, void CodeStubAssembler::GotoUnlessNumberLessThan(Node* lhs, Node* rhs,
compiler::Node* rhs,
Label* if_false) { Label* if_false) {
Label if_true(this); Label if_true(this);
BranchIfNumericRelationalComparison(kLessThan, lhs, rhs, &if_true, if_false); BranchIfNumericRelationalComparison(kLessThan, lhs, rhs, &if_true, if_false);
Bind(&if_true); Bind(&if_true);
} }
compiler::Node* CodeStubAssembler::RelationalComparison( Node* CodeStubAssembler::RelationalComparison(RelationalComparisonMode mode,
RelationalComparisonMode mode, compiler::Node* lhs, compiler::Node* rhs, Node* lhs, Node* rhs,
compiler::Node* context) { Node* context) {
typedef compiler::Node Node;
Label return_true(this), return_false(this), end(this); Label return_true(this), return_false(this), end(this);
Variable result(this, MachineRepresentation::kTagged); Variable result(this, MachineRepresentation::kTagged);
...@@ -6402,7 +6393,7 @@ compiler::Node* CodeStubAssembler::RelationalComparison( ...@@ -6402,7 +6393,7 @@ compiler::Node* CodeStubAssembler::RelationalComparison(
namespace { namespace {
void GenerateEqual_Same(CodeStubAssembler* assembler, compiler::Node* value, void GenerateEqual_Same(CodeStubAssembler* assembler, Node* value,
CodeStubAssembler::Label* if_equal, CodeStubAssembler::Label* if_equal,
CodeStubAssembler::Label* if_notequal) { CodeStubAssembler::Label* if_notequal) {
// In case of abstract or strict equality checks, we need additional checks // In case of abstract or strict equality checks, we need additional checks
...@@ -6412,7 +6403,6 @@ void GenerateEqual_Same(CodeStubAssembler* assembler, compiler::Node* value, ...@@ -6412,7 +6403,6 @@ void GenerateEqual_Same(CodeStubAssembler* assembler, compiler::Node* value,
// seems to be what is tested in the current SIMD.js testsuite. // seems to be what is tested in the current SIMD.js testsuite.
typedef CodeStubAssembler::Label Label; typedef CodeStubAssembler::Label Label;
typedef compiler::Node Node;
// Check if {value} is a Smi or a HeapObject. // Check if {value} is a Smi or a HeapObject.
Label if_valueissmi(assembler), if_valueisnotsmi(assembler); Label if_valueissmi(assembler), if_valueisnotsmi(assembler);
...@@ -6447,9 +6437,9 @@ void GenerateEqual_Same(CodeStubAssembler* assembler, compiler::Node* value, ...@@ -6447,9 +6437,9 @@ void GenerateEqual_Same(CodeStubAssembler* assembler, compiler::Node* value,
} }
void GenerateEqual_Simd128Value_HeapObject( void GenerateEqual_Simd128Value_HeapObject(
CodeStubAssembler* assembler, compiler::Node* lhs, compiler::Node* lhs_map, CodeStubAssembler* assembler, Node* lhs, Node* lhs_map, Node* rhs,
compiler::Node* rhs, compiler::Node* rhs_map, Node* rhs_map, CodeStubAssembler::Label* if_equal,
CodeStubAssembler::Label* if_equal, CodeStubAssembler::Label* if_notequal) { CodeStubAssembler::Label* if_notequal) {
assembler->BranchIfSimd128Equal(lhs, lhs_map, rhs, rhs_map, if_equal, assembler->BranchIfSimd128Equal(lhs, lhs_map, rhs, rhs_map, if_equal,
if_notequal); if_notequal);
} }
...@@ -6457,14 +6447,12 @@ void GenerateEqual_Simd128Value_HeapObject( ...@@ -6457,14 +6447,12 @@ void GenerateEqual_Simd128Value_HeapObject(
} // namespace } // namespace
// ES6 section 7.2.12 Abstract Equality Comparison // ES6 section 7.2.12 Abstract Equality Comparison
compiler::Node* CodeStubAssembler::Equal(ResultMode mode, compiler::Node* lhs, Node* CodeStubAssembler::Equal(ResultMode mode, Node* lhs, Node* rhs,
compiler::Node* rhs, Node* context) {
compiler::Node* context) {
// This is a slightly optimized version of Object::Equals represented as // This is a slightly optimized version of Object::Equals represented as
// scheduled TurboFan graph utilizing the CodeStubAssembler. Whenever you // scheduled TurboFan graph utilizing the CodeStubAssembler. Whenever you
// change something functionality wise in here, remember to update the // change something functionality wise in here, remember to update the
// Object::Equals method as well. // Object::Equals method as well.
typedef compiler::Node Node;
Label if_equal(this), if_notequal(this), Label if_equal(this), if_notequal(this),
do_rhsstringtonumber(this, Label::kDeferred), end(this); do_rhsstringtonumber(this, Label::kDeferred), end(this);
...@@ -6958,10 +6946,8 @@ compiler::Node* CodeStubAssembler::Equal(ResultMode mode, compiler::Node* lhs, ...@@ -6958,10 +6946,8 @@ compiler::Node* CodeStubAssembler::Equal(ResultMode mode, compiler::Node* lhs,
return result.value(); return result.value();
} }
compiler::Node* CodeStubAssembler::StrictEqual(ResultMode mode, Node* CodeStubAssembler::StrictEqual(ResultMode mode, Node* lhs, Node* rhs,
compiler::Node* lhs, Node* context) {
compiler::Node* rhs,
compiler::Node* context) {
// Here's pseudo-code for the algorithm below in case of kDontNegateResult // Here's pseudo-code for the algorithm below in case of kDontNegateResult
// mode; for kNegateResult mode we properly negate the result. // mode; for kNegateResult mode we properly negate the result.
// //
...@@ -7010,8 +6996,6 @@ compiler::Node* CodeStubAssembler::StrictEqual(ResultMode mode, ...@@ -7010,8 +6996,6 @@ compiler::Node* CodeStubAssembler::StrictEqual(ResultMode mode,
// } // }
// } // }
typedef compiler::Node Node;
Label if_equal(this), if_notequal(this), end(this); Label if_equal(this), if_notequal(this), end(this);
Variable result(this, MachineRepresentation::kTagged); Variable result(this, MachineRepresentation::kTagged);
...@@ -7213,9 +7197,7 @@ compiler::Node* CodeStubAssembler::StrictEqual(ResultMode mode, ...@@ -7213,9 +7197,7 @@ compiler::Node* CodeStubAssembler::StrictEqual(ResultMode mode,
// ECMA#sec-samevalue // ECMA#sec-samevalue
// This algorithm differs from the Strict Equality Comparison Algorithm in its // This algorithm differs from the Strict Equality Comparison Algorithm in its
// treatment of signed zeroes and NaNs. // treatment of signed zeroes and NaNs.
compiler::Node* CodeStubAssembler::SameValue(compiler::Node* lhs, Node* CodeStubAssembler::SameValue(Node* lhs, Node* rhs, Node* context) {
compiler::Node* rhs,
compiler::Node* context) {
Variable var_result(this, MachineType::PointerRepresentation()); Variable var_result(this, MachineType::PointerRepresentation());
Label strict_equal(this), out(this); Label strict_equal(this), out(this);
...@@ -7299,9 +7281,7 @@ compiler::Node* CodeStubAssembler::SameValue(compiler::Node* lhs, ...@@ -7299,9 +7281,7 @@ compiler::Node* CodeStubAssembler::SameValue(compiler::Node* lhs,
return var_result.value(); return var_result.value();
} }
compiler::Node* CodeStubAssembler::ForInFilter(compiler::Node* key, Node* CodeStubAssembler::ForInFilter(Node* key, Node* object, Node* context) {
compiler::Node* object,
compiler::Node* context) {
Label return_undefined(this, Label::kDeferred), return_to_name(this), Label return_undefined(this, Label::kDeferred), return_to_name(this),
end(this); end(this);
...@@ -7329,13 +7309,9 @@ compiler::Node* CodeStubAssembler::ForInFilter(compiler::Node* key, ...@@ -7329,13 +7309,9 @@ compiler::Node* CodeStubAssembler::ForInFilter(compiler::Node* key,
return var_result.value(); return var_result.value();
} }
compiler::Node* CodeStubAssembler::HasProperty( Node* CodeStubAssembler::HasProperty(
compiler::Node* object, compiler::Node* key, compiler::Node* context, Node* object, Node* key, Node* context,
Runtime::FunctionId fallback_runtime_function_id) { Runtime::FunctionId fallback_runtime_function_id) {
typedef compiler::Node Node;
typedef CodeStubAssembler::Label Label;
typedef CodeStubAssembler::Variable Variable;
Label call_runtime(this, Label::kDeferred), return_true(this), Label call_runtime(this, Label::kDeferred), return_true(this),
return_false(this), end(this); return_false(this), end(this);
...@@ -7383,8 +7359,7 @@ compiler::Node* CodeStubAssembler::HasProperty( ...@@ -7383,8 +7359,7 @@ compiler::Node* CodeStubAssembler::HasProperty(
return result.value(); return result.value();
} }
compiler::Node* CodeStubAssembler::Typeof(compiler::Node* value, Node* CodeStubAssembler::Typeof(Node* value, Node* context) {
compiler::Node* context) {
Variable result_var(this, MachineRepresentation::kTagged); Variable result_var(this, MachineRepresentation::kTagged);
Label return_number(this, Label::kDeferred), if_oddball(this), Label return_number(this, Label::kDeferred), if_oddball(this),
...@@ -7477,9 +7452,8 @@ compiler::Node* CodeStubAssembler::Typeof(compiler::Node* value, ...@@ -7477,9 +7452,8 @@ compiler::Node* CodeStubAssembler::Typeof(compiler::Node* value,
return result_var.value(); return result_var.value();
} }
compiler::Node* CodeStubAssembler::InstanceOf(compiler::Node* object, Node* CodeStubAssembler::InstanceOf(Node* object, Node* callable,
compiler::Node* callable, Node* context) {
compiler::Node* context) {
Label return_runtime(this, Label::kDeferred), end(this); Label return_runtime(this, Label::kDeferred), end(this);
Variable result(this, MachineRepresentation::kTagged); Variable result(this, MachineRepresentation::kTagged);
...@@ -7509,7 +7483,7 @@ compiler::Node* CodeStubAssembler::InstanceOf(compiler::Node* object, ...@@ -7509,7 +7483,7 @@ compiler::Node* CodeStubAssembler::InstanceOf(compiler::Node* object,
return result.value(); return result.value();
} }
compiler::Node* CodeStubAssembler::NumberInc(compiler::Node* value) { Node* CodeStubAssembler::NumberInc(Node* value) {
Variable var_result(this, MachineRepresentation::kTagged), Variable var_result(this, MachineRepresentation::kTagged),
var_finc_value(this, MachineRepresentation::kFloat64); var_finc_value(this, MachineRepresentation::kFloat64);
Label if_issmi(this), if_isnotsmi(this), do_finc(this), end(this); Label if_issmi(this), if_isnotsmi(this), do_finc(this), end(this);
...@@ -7561,9 +7535,9 @@ compiler::Node* CodeStubAssembler::NumberInc(compiler::Node* value) { ...@@ -7561,9 +7535,9 @@ compiler::Node* CodeStubAssembler::NumberInc(compiler::Node* value) {
return var_result.value(); return var_result.value();
} }
compiler::Node* CodeStubAssembler::CreateArrayIterator( Node* CodeStubAssembler::CreateArrayIterator(Node* array, Node* array_map,
compiler::Node* array, compiler::Node* array_map, Node* array_type, Node* context,
compiler::Node* array_type, compiler::Node* context, IterationKind mode) { IterationKind mode) {
int kBaseMapIndex = 0; int kBaseMapIndex = 0;
switch (mode) { switch (mode) {
case IterationKind::kKeys: case IterationKind::kKeys:
...@@ -7749,8 +7723,8 @@ compiler::Node* CodeStubAssembler::CreateArrayIterator( ...@@ -7749,8 +7723,8 @@ compiler::Node* CodeStubAssembler::CreateArrayIterator(
return var_result.value(); return var_result.value();
} }
compiler::Node* CodeStubAssembler::AllocateJSArrayIterator( Node* CodeStubAssembler::AllocateJSArrayIterator(Node* array, Node* array_map,
compiler::Node* array, compiler::Node* array_map, compiler::Node* map) { Node* map) {
Node* iterator = Allocate(JSArrayIterator::kSize); Node* iterator = Allocate(JSArrayIterator::kSize);
StoreMapNoWriteBarrier(iterator, map); StoreMapNoWriteBarrier(iterator, map);
StoreObjectFieldRoot(iterator, JSArrayIterator::kPropertiesOffset, StoreObjectFieldRoot(iterator, JSArrayIterator::kPropertiesOffset,
...@@ -7766,7 +7740,7 @@ compiler::Node* CodeStubAssembler::AllocateJSArrayIterator( ...@@ -7766,7 +7740,7 @@ compiler::Node* CodeStubAssembler::AllocateJSArrayIterator(
return iterator; return iterator;
} }
compiler::Node* CodeStubAssembler::IsDetachedBuffer(compiler::Node* buffer) { Node* CodeStubAssembler::IsDetachedBuffer(Node* buffer) {
CSA_ASSERT(this, HasInstanceType(buffer, JS_ARRAY_BUFFER_TYPE)); CSA_ASSERT(this, HasInstanceType(buffer, JS_ARRAY_BUFFER_TYPE));
Node* buffer_bit_field = LoadObjectField( Node* buffer_bit_field = LoadObjectField(
...@@ -7777,14 +7751,13 @@ compiler::Node* CodeStubAssembler::IsDetachedBuffer(compiler::Node* buffer) { ...@@ -7777,14 +7751,13 @@ compiler::Node* CodeStubAssembler::IsDetachedBuffer(compiler::Node* buffer) {
Int32Constant(0)); Int32Constant(0));
} }
CodeStubArguments::CodeStubArguments(CodeStubAssembler* assembler, CodeStubArguments::CodeStubArguments(CodeStubAssembler* assembler, Node* argc,
compiler::Node* argc,
CodeStubAssembler::ParameterMode mode) CodeStubAssembler::ParameterMode mode)
: assembler_(assembler), : assembler_(assembler),
argc_(argc), argc_(argc),
arguments_(nullptr), arguments_(nullptr),
fp_(assembler->LoadFramePointer()) { fp_(assembler->LoadFramePointer()) {
compiler::Node* offset = assembler->ElementOffsetFromIndex( Node* offset = assembler->ElementOffsetFromIndex(
argc_, FAST_ELEMENTS, mode, argc_, FAST_ELEMENTS, mode,
(StandardFrameConstants::kFixedSlotCountAboveFp - 1) * kPointerSize); (StandardFrameConstants::kFixedSlotCountAboveFp - 1) * kPointerSize);
arguments_ = assembler_->IntPtrAddFoldConstants(fp_, offset); arguments_ = assembler_->IntPtrAddFoldConstants(fp_, offset);
...@@ -7795,14 +7768,13 @@ CodeStubArguments::CodeStubArguments(CodeStubAssembler* assembler, ...@@ -7795,14 +7768,13 @@ CodeStubArguments::CodeStubArguments(CodeStubAssembler* assembler,
} }
} }
compiler::Node* CodeStubArguments::GetReceiver() { Node* CodeStubArguments::GetReceiver() {
return assembler_->Load(MachineType::AnyTagged(), arguments_, return assembler_->Load(MachineType::AnyTagged(), arguments_,
assembler_->IntPtrConstant(kPointerSize)); assembler_->IntPtrConstant(kPointerSize));
} }
compiler::Node* CodeStubArguments::AtIndex( Node* CodeStubArguments::AtIndex(Node* index,
compiler::Node* index, CodeStubAssembler::ParameterMode mode) { CodeStubAssembler::ParameterMode mode) {
typedef compiler::Node Node;
Node* negated_index = assembler_->IntPtrSubFoldConstants( Node* negated_index = assembler_->IntPtrSubFoldConstants(
assembler_->IntPtrOrSmiConstant(0, mode), index); assembler_->IntPtrOrSmiConstant(0, mode), index);
Node* offset = Node* offset =
...@@ -7810,13 +7782,13 @@ compiler::Node* CodeStubArguments::AtIndex( ...@@ -7810,13 +7782,13 @@ compiler::Node* CodeStubArguments::AtIndex(
return assembler_->Load(MachineType::AnyTagged(), arguments_, offset); return assembler_->Load(MachineType::AnyTagged(), arguments_, offset);
} }
compiler::Node* CodeStubArguments::AtIndex(int index) { Node* CodeStubArguments::AtIndex(int index) {
return AtIndex(assembler_->IntPtrConstant(index)); return AtIndex(assembler_->IntPtrConstant(index));
} }
void CodeStubArguments::ForEach(const CodeStubAssembler::VariableList& vars, void CodeStubArguments::ForEach(const CodeStubAssembler::VariableList& vars,
CodeStubArguments::ForEachBodyFunction body, CodeStubArguments::ForEachBodyFunction body,
compiler::Node* first, compiler::Node* last, Node* first, Node* last,
CodeStubAssembler::ParameterMode mode) { CodeStubAssembler::ParameterMode mode) {
assembler_->Comment("CodeStubArguments::ForEach"); assembler_->Comment("CodeStubArguments::ForEach");
DCHECK_IMPLIES(first == nullptr || last == nullptr, DCHECK_IMPLIES(first == nullptr || last == nullptr,
...@@ -7827,35 +7799,33 @@ void CodeStubArguments::ForEach(const CodeStubAssembler::VariableList& vars, ...@@ -7827,35 +7799,33 @@ void CodeStubArguments::ForEach(const CodeStubAssembler::VariableList& vars,
if (last == nullptr) { if (last == nullptr) {
last = argc_; last = argc_;
} }
compiler::Node* start = assembler_->IntPtrSubFoldConstants( Node* start = assembler_->IntPtrSubFoldConstants(
arguments_, arguments_,
assembler_->ElementOffsetFromIndex(first, FAST_ELEMENTS, mode)); assembler_->ElementOffsetFromIndex(first, FAST_ELEMENTS, mode));
compiler::Node* end = assembler_->IntPtrSubFoldConstants( Node* end = assembler_->IntPtrSubFoldConstants(
arguments_, arguments_,
assembler_->ElementOffsetFromIndex(last, FAST_ELEMENTS, mode)); assembler_->ElementOffsetFromIndex(last, FAST_ELEMENTS, mode));
assembler_->BuildFastLoop( assembler_->BuildFastLoop(
vars, MachineType::PointerRepresentation(), start, end, vars, MachineType::PointerRepresentation(), start, end,
[body](CodeStubAssembler* assembler, compiler::Node* current) { [body](CodeStubAssembler* assembler, Node* current) {
Node* arg = assembler->Load(MachineType::AnyTagged(), current); Node* arg = assembler->Load(MachineType::AnyTagged(), current);
body(assembler, arg); body(assembler, arg);
}, },
-kPointerSize, CodeStubAssembler::IndexAdvanceMode::kPost); -kPointerSize, CodeStubAssembler::IndexAdvanceMode::kPost);
} }
void CodeStubArguments::PopAndReturn(compiler::Node* value) { void CodeStubArguments::PopAndReturn(Node* value) {
assembler_->PopAndReturn( assembler_->PopAndReturn(
assembler_->IntPtrAddFoldConstants(argc_, assembler_->IntPtrConstant(1)), assembler_->IntPtrAddFoldConstants(argc_, assembler_->IntPtrConstant(1)),
value); value);
} }
compiler::Node* CodeStubAssembler::IsFastElementsKind( Node* CodeStubAssembler::IsFastElementsKind(Node* elements_kind) {
compiler::Node* elements_kind) {
return Uint32LessThanOrEqual(elements_kind, return Uint32LessThanOrEqual(elements_kind,
Int32Constant(LAST_FAST_ELEMENTS_KIND)); Int32Constant(LAST_FAST_ELEMENTS_KIND));
} }
compiler::Node* CodeStubAssembler::IsHoleyFastElementsKind( Node* CodeStubAssembler::IsHoleyFastElementsKind(Node* elements_kind) {
compiler::Node* elements_kind) {
CSA_ASSERT(this, IsFastElementsKind(elements_kind)); CSA_ASSERT(this, IsFastElementsKind(elements_kind));
STATIC_ASSERT(FAST_HOLEY_SMI_ELEMENTS == (FAST_SMI_ELEMENTS | 1)); STATIC_ASSERT(FAST_HOLEY_SMI_ELEMENTS == (FAST_SMI_ELEMENTS | 1));
......
...@@ -47,6 +47,8 @@ enum class PrimitiveType { kBoolean, kNumber, kString, kSymbol }; ...@@ -47,6 +47,8 @@ enum class PrimitiveType { kBoolean, kNumber, kString, kSymbol };
// from a compiler directory OWNER). // from a compiler directory OWNER).
class V8_EXPORT_PRIVATE CodeStubAssembler : public compiler::CodeAssembler { class V8_EXPORT_PRIVATE CodeStubAssembler : public compiler::CodeAssembler {
public: public:
typedef compiler::Node Node;
CodeStubAssembler(compiler::CodeAssemblerState* state) CodeStubAssembler(compiler::CodeAssemblerState* state)
: compiler::CodeAssembler(state) {} : compiler::CodeAssembler(state) {}
...@@ -72,242 +74,225 @@ class V8_EXPORT_PRIVATE CodeStubAssembler : public compiler::CodeAssembler { ...@@ -72,242 +74,225 @@ class V8_EXPORT_PRIVATE CodeStubAssembler : public compiler::CodeAssembler {
return Is64() ? INTPTR_PARAMETERS : SMI_PARAMETERS; return Is64() ? INTPTR_PARAMETERS : SMI_PARAMETERS;
} }
compiler::Node* UntagParameter(compiler::Node* value, ParameterMode mode) { Node* UntagParameter(Node* value, ParameterMode mode) {
if (mode != SMI_PARAMETERS) value = SmiUntag(value); if (mode != SMI_PARAMETERS) value = SmiUntag(value);
return value; return value;
} }
compiler::Node* TagParameter(compiler::Node* value, ParameterMode mode) { Node* TagParameter(Node* value, ParameterMode mode) {
if (mode != SMI_PARAMETERS) value = SmiTag(value); if (mode != SMI_PARAMETERS) value = SmiTag(value);
return value; return value;
} }
compiler::Node* NoContextConstant(); Node* NoContextConstant();
#define HEAP_CONSTANT_ACCESSOR(rootName, name) compiler::Node* name##Constant(); #define HEAP_CONSTANT_ACCESSOR(rootName, name) Node* name##Constant();
HEAP_CONSTANT_LIST(HEAP_CONSTANT_ACCESSOR) HEAP_CONSTANT_LIST(HEAP_CONSTANT_ACCESSOR)
#undef HEAP_CONSTANT_ACCESSOR #undef HEAP_CONSTANT_ACCESSOR
#define HEAP_CONSTANT_TEST(rootName, name) \ #define HEAP_CONSTANT_TEST(rootName, name) Node* Is##name(Node* value);
compiler::Node* Is##name(compiler::Node* value);
HEAP_CONSTANT_LIST(HEAP_CONSTANT_TEST) HEAP_CONSTANT_LIST(HEAP_CONSTANT_TEST)
#undef HEAP_CONSTANT_TEST #undef HEAP_CONSTANT_TEST
compiler::Node* HashSeed(); Node* HashSeed();
compiler::Node* StaleRegisterConstant(); Node* StaleRegisterConstant();
compiler::Node* IntPtrOrSmiConstant(int value, ParameterMode mode); Node* IntPtrOrSmiConstant(int value, ParameterMode mode);
compiler::Node* IntPtrAddFoldConstants(compiler::Node* left, Node* IntPtrAddFoldConstants(Node* left, Node* right);
compiler::Node* right); Node* IntPtrSubFoldConstants(Node* left, Node* right);
compiler::Node* IntPtrSubFoldConstants(compiler::Node* left,
compiler::Node* right);
// Round the 32bits payload of the provided word up to the next power of two. // Round the 32bits payload of the provided word up to the next power of two.
compiler::Node* IntPtrRoundUpToPowerOfTwo32(compiler::Node* value); Node* IntPtrRoundUpToPowerOfTwo32(Node* value);
compiler::Node* IntPtrMax(compiler::Node* left, compiler::Node* right); Node* IntPtrMax(Node* left, Node* right);
// Float64 operations. // Float64 operations.
compiler::Node* Float64Ceil(compiler::Node* x); Node* Float64Ceil(Node* x);
compiler::Node* Float64Floor(compiler::Node* x); Node* Float64Floor(Node* x);
compiler::Node* Float64Round(compiler::Node* x); Node* Float64Round(Node* x);
compiler::Node* Float64Trunc(compiler::Node* x); Node* Float64Trunc(Node* x);
// Tag a Word as a Smi value. // Tag a Word as a Smi value.
compiler::Node* SmiTag(compiler::Node* value); Node* SmiTag(Node* value);
// Untag a Smi value as a Word. // Untag a Smi value as a Word.
compiler::Node* SmiUntag(compiler::Node* value); Node* SmiUntag(Node* value);
// Smi conversions. // Smi conversions.
compiler::Node* SmiToFloat64(compiler::Node* value); Node* SmiToFloat64(Node* value);
compiler::Node* SmiFromWord(compiler::Node* value) { return SmiTag(value); } Node* SmiFromWord(Node* value) { return SmiTag(value); }
compiler::Node* SmiFromWord32(compiler::Node* value); Node* SmiFromWord32(Node* value);
compiler::Node* SmiToWord(compiler::Node* value) { return SmiUntag(value); } Node* SmiToWord(Node* value) { return SmiUntag(value); }
compiler::Node* SmiToWord32(compiler::Node* value); Node* SmiToWord32(Node* value);
// Smi operations. // Smi operations.
compiler::Node* SmiAdd(compiler::Node* a, compiler::Node* b); Node* SmiAdd(Node* a, Node* b);
compiler::Node* SmiSub(compiler::Node* a, compiler::Node* b); Node* SmiSub(Node* a, Node* b);
compiler::Node* SmiEqual(compiler::Node* a, compiler::Node* b); Node* SmiEqual(Node* a, Node* b);
compiler::Node* SmiAbove(compiler::Node* a, compiler::Node* b); Node* SmiAbove(Node* a, Node* b);
compiler::Node* SmiAboveOrEqual(compiler::Node* a, compiler::Node* b); Node* SmiAboveOrEqual(Node* a, Node* b);
compiler::Node* SmiBelow(compiler::Node* a, compiler::Node* b); Node* SmiBelow(Node* a, Node* b);
compiler::Node* SmiLessThan(compiler::Node* a, compiler::Node* b); Node* SmiLessThan(Node* a, Node* b);
compiler::Node* SmiLessThanOrEqual(compiler::Node* a, compiler::Node* b); Node* SmiLessThanOrEqual(Node* a, Node* b);
compiler::Node* SmiMax(compiler::Node* a, compiler::Node* b); Node* SmiMax(Node* a, Node* b);
compiler::Node* SmiMin(compiler::Node* a, compiler::Node* b); Node* SmiMin(Node* a, Node* b);
// Computes a % b for Smi inputs a and b; result is not necessarily a Smi. // Computes a % b for Smi inputs a and b; result is not necessarily a Smi.
compiler::Node* SmiMod(compiler::Node* a, compiler::Node* b); Node* SmiMod(Node* a, Node* b);
// Computes a * b for Smi inputs a and b; result is not necessarily a Smi. // Computes a * b for Smi inputs a and b; result is not necessarily a Smi.
compiler::Node* SmiMul(compiler::Node* a, compiler::Node* b); Node* SmiMul(Node* a, Node* b);
compiler::Node* SmiOr(compiler::Node* a, compiler::Node* b) { Node* SmiOr(Node* a, Node* b) {
return BitcastWordToTaggedSigned( return BitcastWordToTaggedSigned(
WordOr(BitcastTaggedToWord(a), BitcastTaggedToWord(b))); WordOr(BitcastTaggedToWord(a), BitcastTaggedToWord(b)));
} }
// Smi | HeapNumber operations. // Smi | HeapNumber operations.
compiler::Node* NumberInc(compiler::Node* value); Node* NumberInc(Node* value);
// Allocate an object of the given size. // Allocate an object of the given size.
compiler::Node* Allocate(compiler::Node* size, AllocationFlags flags = kNone); Node* Allocate(Node* size, AllocationFlags flags = kNone);
compiler::Node* Allocate(int size, AllocationFlags flags = kNone); Node* Allocate(int size, AllocationFlags flags = kNone);
compiler::Node* InnerAllocate(compiler::Node* previous, int offset); Node* InnerAllocate(Node* previous, int offset);
compiler::Node* InnerAllocate(compiler::Node* previous, Node* InnerAllocate(Node* previous, Node* offset);
compiler::Node* offset); Node* IsRegularHeapObjectSize(Node* size);
compiler::Node* IsRegularHeapObjectSize(compiler::Node* size);
typedef std::function<Node*()> ConditionBody;
typedef std::function<compiler::Node*()> ConditionBody;
void Assert(ConditionBody condition_body, const char* string = nullptr, void Assert(ConditionBody condition_body, const char* string = nullptr,
const char* file = nullptr, int line = 0); const char* file = nullptr, int line = 0);
// Check a value for smi-ness // Check a value for smi-ness
compiler::Node* TaggedIsSmi(compiler::Node* a); Node* TaggedIsSmi(Node* a);
// Check that the value is a non-negative smi. // Check that the value is a non-negative smi.
compiler::Node* WordIsPositiveSmi(compiler::Node* a); Node* WordIsPositiveSmi(Node* a);
// Check that a word has a word-aligned address. // Check that a word has a word-aligned address.
compiler::Node* WordIsWordAligned(compiler::Node* word); Node* WordIsWordAligned(Node* word);
compiler::Node* WordIsPowerOfTwo(compiler::Node* value); Node* WordIsPowerOfTwo(Node* value);
void BranchIfSmiEqual(compiler::Node* a, compiler::Node* b, Label* if_true, void BranchIfSmiEqual(Node* a, Node* b, Label* if_true, Label* if_false) {
Label* if_false) {
Branch(SmiEqual(a, b), if_true, if_false); Branch(SmiEqual(a, b), if_true, if_false);
} }
void BranchIfSmiLessThan(compiler::Node* a, compiler::Node* b, Label* if_true, void BranchIfSmiLessThan(Node* a, Node* b, Label* if_true, Label* if_false) {
Label* if_false) {
Branch(SmiLessThan(a, b), if_true, if_false); Branch(SmiLessThan(a, b), if_true, if_false);
} }
void BranchIfSmiLessThanOrEqual(compiler::Node* a, compiler::Node* b, void BranchIfSmiLessThanOrEqual(Node* a, Node* b, Label* if_true,
Label* if_true, Label* if_false) { Label* if_false) {
Branch(SmiLessThanOrEqual(a, b), if_true, if_false); Branch(SmiLessThanOrEqual(a, b), if_true, if_false);
} }
void BranchIfFloat64IsNaN(compiler::Node* value, Label* if_true, void BranchIfFloat64IsNaN(Node* value, Label* if_true, Label* if_false) {
Label* if_false) {
Branch(Float64Equal(value, value), if_false, if_true); Branch(Float64Equal(value, value), if_false, if_true);
} }
// Branches to {if_true} if ToBoolean applied to {value} yields true, // Branches to {if_true} if ToBoolean applied to {value} yields true,
// otherwise goes to {if_false}. // otherwise goes to {if_false}.
void BranchIfToBooleanIsTrue(compiler::Node* value, Label* if_true, void BranchIfToBooleanIsTrue(Node* value, Label* if_true, Label* if_false);
Label* if_false);
void BranchIfSimd128Equal(compiler::Node* lhs, compiler::Node* lhs_map, void BranchIfSimd128Equal(Node* lhs, Node* lhs_map, Node* rhs, Node* rhs_map,
compiler::Node* rhs, compiler::Node* rhs_map,
Label* if_equal, Label* if_notequal); Label* if_equal, Label* if_notequal);
void BranchIfSimd128Equal(compiler::Node* lhs, compiler::Node* rhs, void BranchIfSimd128Equal(Node* lhs, Node* rhs, Label* if_equal,
Label* if_equal, Label* if_notequal) { Label* if_notequal) {
BranchIfSimd128Equal(lhs, LoadMap(lhs), rhs, LoadMap(rhs), if_equal, BranchIfSimd128Equal(lhs, LoadMap(lhs), rhs, LoadMap(rhs), if_equal,
if_notequal); if_notequal);
} }
void BranchIfJSReceiver(compiler::Node* object, Label* if_true, void BranchIfJSReceiver(Node* object, Label* if_true, Label* if_false);
Label* if_false); void BranchIfJSObject(Node* object, Label* if_true, Label* if_false);
void BranchIfJSObject(compiler::Node* object, Label* if_true, void BranchIfFastJSArray(Node* object, Node* context, Label* if_true,
Label* if_false); Label* if_false);
void BranchIfFastJSArray(compiler::Node* object, compiler::Node* context,
Label* if_true, Label* if_false);
// Load value from current frame by given offset in bytes. // Load value from current frame by given offset in bytes.
compiler::Node* LoadFromFrame(int offset, Node* LoadFromFrame(int offset, MachineType rep = MachineType::AnyTagged());
MachineType rep = MachineType::AnyTagged());
// Load value from current parent frame by given offset in bytes. // Load value from current parent frame by given offset in bytes.
compiler::Node* LoadFromParentFrame( Node* LoadFromParentFrame(int offset,
int offset, MachineType rep = MachineType::AnyTagged()); MachineType rep = MachineType::AnyTagged());
// Load an object pointer from a buffer that isn't in the heap. // Load an object pointer from a buffer that isn't in the heap.
compiler::Node* LoadBufferObject(compiler::Node* buffer, int offset, Node* LoadBufferObject(Node* buffer, int offset,
MachineType rep = MachineType::AnyTagged()); MachineType rep = MachineType::AnyTagged());
// Load a field from an object on the heap. // Load a field from an object on the heap.
compiler::Node* LoadObjectField(compiler::Node* object, int offset, Node* LoadObjectField(Node* object, int offset,
MachineType rep = MachineType::AnyTagged()); MachineType rep = MachineType::AnyTagged());
compiler::Node* LoadObjectField(compiler::Node* object, Node* LoadObjectField(Node* object, Node* offset,
compiler::Node* offset, MachineType rep = MachineType::AnyTagged());
MachineType rep = MachineType::AnyTagged());
// Load a SMI field and untag it. // Load a SMI field and untag it.
compiler::Node* LoadAndUntagObjectField(compiler::Node* object, int offset); Node* LoadAndUntagObjectField(Node* object, int offset);
// Load a SMI field, untag it, and convert to Word32. // Load a SMI field, untag it, and convert to Word32.
compiler::Node* LoadAndUntagToWord32ObjectField(compiler::Node* object, Node* LoadAndUntagToWord32ObjectField(Node* object, int offset);
int offset);
// Load a SMI and untag it. // Load a SMI and untag it.
compiler::Node* LoadAndUntagSmi(compiler::Node* base, int index); Node* LoadAndUntagSmi(Node* base, int index);
// Load a SMI root, untag it, and convert to Word32. // Load a SMI root, untag it, and convert to Word32.
compiler::Node* LoadAndUntagToWord32Root(Heap::RootListIndex root_index); Node* LoadAndUntagToWord32Root(Heap::RootListIndex root_index);
// Load the floating point value of a HeapNumber. // Load the floating point value of a HeapNumber.
compiler::Node* LoadHeapNumberValue(compiler::Node* object); Node* LoadHeapNumberValue(Node* object);
// Load the Map of an HeapObject. // Load the Map of an HeapObject.
compiler::Node* LoadMap(compiler::Node* object); Node* LoadMap(Node* object);
// Load the instance type of an HeapObject. // Load the instance type of an HeapObject.
compiler::Node* LoadInstanceType(compiler::Node* object); Node* LoadInstanceType(Node* object);
// Compare the instance the type of the object against the provided one. // Compare the instance the type of the object against the provided one.
compiler::Node* HasInstanceType(compiler::Node* object, InstanceType type); Node* HasInstanceType(Node* object, InstanceType type);
// Load the properties backing store of a JSObject. // Load the properties backing store of a JSObject.
compiler::Node* LoadProperties(compiler::Node* object); Node* LoadProperties(Node* object);
// Load the elements backing store of a JSObject. // Load the elements backing store of a JSObject.
compiler::Node* LoadElements(compiler::Node* object); Node* LoadElements(Node* object);
// Load the length of a JSArray instance. // Load the length of a JSArray instance.
compiler::Node* LoadJSArrayLength(compiler::Node* array); Node* LoadJSArrayLength(Node* array);
// Load the length of a fixed array base instance. // Load the length of a fixed array base instance.
compiler::Node* LoadFixedArrayBaseLength(compiler::Node* array); Node* LoadFixedArrayBaseLength(Node* array);
// Load the length of a fixed array base instance. // Load the length of a fixed array base instance.
compiler::Node* LoadAndUntagFixedArrayBaseLength(compiler::Node* array); Node* LoadAndUntagFixedArrayBaseLength(Node* array);
// Load the bit field of a Map. // Load the bit field of a Map.
compiler::Node* LoadMapBitField(compiler::Node* map); Node* LoadMapBitField(Node* map);
// Load bit field 2 of a map. // Load bit field 2 of a map.
compiler::Node* LoadMapBitField2(compiler::Node* map); Node* LoadMapBitField2(Node* map);
// Load bit field 3 of a map. // Load bit field 3 of a map.
compiler::Node* LoadMapBitField3(compiler::Node* map); Node* LoadMapBitField3(Node* map);
// Load the instance type of a map. // Load the instance type of a map.
compiler::Node* LoadMapInstanceType(compiler::Node* map); Node* LoadMapInstanceType(Node* map);
// Load the ElementsKind of a map. // Load the ElementsKind of a map.
compiler::Node* LoadMapElementsKind(compiler::Node* map); Node* LoadMapElementsKind(Node* map);
// Load the instance descriptors of a map. // Load the instance descriptors of a map.
compiler::Node* LoadMapDescriptors(compiler::Node* map); Node* LoadMapDescriptors(Node* map);
// Load the prototype of a map. // Load the prototype of a map.
compiler::Node* LoadMapPrototype(compiler::Node* map); Node* LoadMapPrototype(Node* map);
// Load the prototype info of a map. The result has to be checked if it is a // Load the prototype info of a map. The result has to be checked if it is a
// prototype info object or not. // prototype info object or not.
compiler::Node* LoadMapPrototypeInfo(compiler::Node* map, Node* LoadMapPrototypeInfo(Node* map, Label* if_has_no_proto_info);
Label* if_has_no_proto_info);
// Load the instance size of a Map. // Load the instance size of a Map.
compiler::Node* LoadMapInstanceSize(compiler::Node* map); Node* LoadMapInstanceSize(Node* map);
// Load the inobject properties count of a Map (valid only for JSObjects). // Load the inobject properties count of a Map (valid only for JSObjects).
compiler::Node* LoadMapInobjectProperties(compiler::Node* map); Node* LoadMapInobjectProperties(Node* map);
// Load the constructor function index of a Map (only for primitive maps). // Load the constructor function index of a Map (only for primitive maps).
compiler::Node* LoadMapConstructorFunctionIndex(compiler::Node* map); Node* LoadMapConstructorFunctionIndex(Node* map);
// Load the constructor of a Map (equivalent to Map::GetConstructor()). // Load the constructor of a Map (equivalent to Map::GetConstructor()).
compiler::Node* LoadMapConstructor(compiler::Node* map); Node* LoadMapConstructor(Node* map);
// Check if the map is set for slow properties. // Check if the map is set for slow properties.
compiler::Node* IsDictionaryMap(compiler::Node* map); Node* IsDictionaryMap(Node* map);
// Load the hash field of a name as an uint32 value. // Load the hash field of a name as an uint32 value.
compiler::Node* LoadNameHashField(compiler::Node* name); Node* LoadNameHashField(Node* name);
// Load the hash value of a name as an uint32 value. // Load the hash value of a name as an uint32 value.
// If {if_hash_not_computed} label is specified then it also checks if // If {if_hash_not_computed} label is specified then it also checks if
// hash is actually computed. // hash is actually computed.
compiler::Node* LoadNameHash(compiler::Node* name, Node* LoadNameHash(Node* name, Label* if_hash_not_computed = nullptr);
Label* if_hash_not_computed = nullptr);
// Load length field of a String object. // Load length field of a String object.
compiler::Node* LoadStringLength(compiler::Node* object); Node* LoadStringLength(Node* object);
// Load value field of a JSValue object. // Load value field of a JSValue object.
compiler::Node* LoadJSValueValue(compiler::Node* object); Node* LoadJSValueValue(Node* object);
// Load value field of a WeakCell object. // Load value field of a WeakCell object.
compiler::Node* LoadWeakCellValueUnchecked(compiler::Node* weak_cell); Node* LoadWeakCellValueUnchecked(Node* weak_cell);
compiler::Node* LoadWeakCellValue(compiler::Node* weak_cell, Node* LoadWeakCellValue(Node* weak_cell, Label* if_cleared = nullptr);
Label* if_cleared = nullptr);
// Load an array element from a FixedArray. // Load an array element from a FixedArray.
compiler::Node* LoadFixedArrayElement( Node* LoadFixedArrayElement(
compiler::Node* object, compiler::Node* index, int additional_offset = 0, Node* object, Node* index, int additional_offset = 0,
ParameterMode parameter_mode = INTEGER_PARAMETERS); ParameterMode parameter_mode = INTEGER_PARAMETERS);
// Load an array element from a FixedArray, untag it and return it as Word32. // Load an array element from a FixedArray, untag it and return it as Word32.
compiler::Node* LoadAndUntagToWord32FixedArrayElement( Node* LoadAndUntagToWord32FixedArrayElement(
compiler::Node* object, compiler::Node* index, int additional_offset = 0, Node* object, Node* index, int additional_offset = 0,
ParameterMode parameter_mode = INTEGER_PARAMETERS); ParameterMode parameter_mode = INTEGER_PARAMETERS);
// Load an array element from a FixedDoubleArray. // Load an array element from a FixedDoubleArray.
compiler::Node* LoadFixedDoubleArrayElement( Node* LoadFixedDoubleArrayElement(
compiler::Node* object, compiler::Node* index, MachineType machine_type, Node* object, Node* index, MachineType machine_type,
int additional_offset = 0, int additional_offset = 0,
ParameterMode parameter_mode = INTEGER_PARAMETERS, ParameterMode parameter_mode = INTEGER_PARAMETERS,
Label* if_hole = nullptr); Label* if_hole = nullptr);
...@@ -315,191 +300,152 @@ class V8_EXPORT_PRIVATE CodeStubAssembler : public compiler::CodeAssembler { ...@@ -315,191 +300,152 @@ class V8_EXPORT_PRIVATE CodeStubAssembler : public compiler::CodeAssembler {
// Load Float64 value by |base| + |offset| address. If the value is a double // Load Float64 value by |base| + |offset| address. If the value is a double
// hole then jump to |if_hole|. If |machine_type| is None then only the hole // hole then jump to |if_hole|. If |machine_type| is None then only the hole
// check is generated. // check is generated.
compiler::Node* LoadDoubleWithHoleCheck( Node* LoadDoubleWithHoleCheck(
compiler::Node* base, compiler::Node* offset, Label* if_hole, Node* base, Node* offset, Label* if_hole,
MachineType machine_type = MachineType::Float64()); MachineType machine_type = MachineType::Float64());
compiler::Node* LoadFixedTypedArrayElement( Node* LoadFixedTypedArrayElement(
compiler::Node* data_pointer, compiler::Node* index_node, Node* data_pointer, Node* index_node, ElementsKind elements_kind,
ElementsKind elements_kind,
ParameterMode parameter_mode = INTEGER_PARAMETERS); ParameterMode parameter_mode = INTEGER_PARAMETERS);
// Context manipulation // Context manipulation
compiler::Node* LoadContextElement(compiler::Node* context, int slot_index); Node* LoadContextElement(Node* context, int slot_index);
compiler::Node* LoadContextElement(compiler::Node* context, Node* LoadContextElement(Node* context, Node* slot_index);
compiler::Node* slot_index); Node* StoreContextElement(Node* context, int slot_index, Node* value);
compiler::Node* StoreContextElement(compiler::Node* context, int slot_index, Node* StoreContextElement(Node* context, Node* slot_index, Node* value);
compiler::Node* value); Node* LoadNativeContext(Node* context);
compiler::Node* StoreContextElement(compiler::Node* context,
compiler::Node* slot_index, Node* LoadJSArrayElementsMap(ElementsKind kind, Node* native_context);
compiler::Node* value);
compiler::Node* LoadNativeContext(compiler::Node* context);
compiler::Node* LoadJSArrayElementsMap(ElementsKind kind,
compiler::Node* native_context);
// Store the floating point value of a HeapNumber. // Store the floating point value of a HeapNumber.
compiler::Node* StoreHeapNumberValue(compiler::Node* object, Node* StoreHeapNumberValue(Node* object, Node* value);
compiler::Node* value);
// Store a field to an object on the heap. // Store a field to an object on the heap.
compiler::Node* StoreObjectField( Node* StoreObjectField(Node* object, int offset, Node* value);
compiler::Node* object, int offset, compiler::Node* value); Node* StoreObjectField(Node* object, Node* offset, Node* value);
compiler::Node* StoreObjectField(compiler::Node* object, Node* StoreObjectFieldNoWriteBarrier(
compiler::Node* offset, Node* object, int offset, Node* value,
compiler::Node* value);
compiler::Node* StoreObjectFieldNoWriteBarrier(
compiler::Node* object, int offset, compiler::Node* value,
MachineRepresentation rep = MachineRepresentation::kTagged); MachineRepresentation rep = MachineRepresentation::kTagged);
compiler::Node* StoreObjectFieldNoWriteBarrier( Node* StoreObjectFieldNoWriteBarrier(
compiler::Node* object, compiler::Node* offset, compiler::Node* value, Node* object, Node* offset, Node* value,
MachineRepresentation rep = MachineRepresentation::kTagged); MachineRepresentation rep = MachineRepresentation::kTagged);
// Store the Map of an HeapObject. // Store the Map of an HeapObject.
compiler::Node* StoreMapNoWriteBarrier(compiler::Node* object, Node* StoreMapNoWriteBarrier(Node* object, Node* map);
compiler::Node* map); Node* StoreObjectFieldRoot(Node* object, int offset,
compiler::Node* StoreObjectFieldRoot(compiler::Node* object, int offset, Heap::RootListIndex root);
Heap::RootListIndex root);
// Store an array element to a FixedArray. // Store an array element to a FixedArray.
compiler::Node* StoreFixedArrayElement( Node* StoreFixedArrayElement(
compiler::Node* object, int index, compiler::Node* value, Node* object, int index, Node* value,
WriteBarrierMode barrier_mode = UPDATE_WRITE_BARRIER) { WriteBarrierMode barrier_mode = UPDATE_WRITE_BARRIER) {
return StoreFixedArrayElement(object, IntPtrConstant(index), value, return StoreFixedArrayElement(object, IntPtrConstant(index), value,
barrier_mode, 0, INTPTR_PARAMETERS); barrier_mode, 0, INTPTR_PARAMETERS);
} }
compiler::Node* StoreFixedArrayElement( Node* StoreFixedArrayElement(
compiler::Node* object, compiler::Node* index, compiler::Node* value, Node* object, Node* index, Node* value,
WriteBarrierMode barrier_mode = UPDATE_WRITE_BARRIER, WriteBarrierMode barrier_mode = UPDATE_WRITE_BARRIER,
int additional_offset = 0, int additional_offset = 0,
ParameterMode parameter_mode = INTEGER_PARAMETERS); ParameterMode parameter_mode = INTEGER_PARAMETERS);
compiler::Node* StoreFixedDoubleArrayElement( Node* StoreFixedDoubleArrayElement(
compiler::Node* object, compiler::Node* index, compiler::Node* value, Node* object, Node* index, Node* value,
ParameterMode parameter_mode = INTEGER_PARAMETERS); ParameterMode parameter_mode = INTEGER_PARAMETERS);
void StoreFieldsNoWriteBarrier(compiler::Node* start_address, void StoreFieldsNoWriteBarrier(Node* start_address, Node* end_address,
compiler::Node* end_address, Node* value);
compiler::Node* value);
// Allocate a HeapNumber without initializing its value. // Allocate a HeapNumber without initializing its value.
compiler::Node* AllocateHeapNumber(MutableMode mode = IMMUTABLE); Node* AllocateHeapNumber(MutableMode mode = IMMUTABLE);
// Allocate a HeapNumber with a specific value. // Allocate a HeapNumber with a specific value.
compiler::Node* AllocateHeapNumberWithValue(compiler::Node* value, Node* AllocateHeapNumberWithValue(Node* value, MutableMode mode = IMMUTABLE);
MutableMode mode = IMMUTABLE);
// Allocate a SeqOneByteString with the given length. // Allocate a SeqOneByteString with the given length.
compiler::Node* AllocateSeqOneByteString(int length, Node* AllocateSeqOneByteString(int length, AllocationFlags flags = kNone);
AllocationFlags flags = kNone); Node* AllocateSeqOneByteString(Node* context, Node* length,
compiler::Node* AllocateSeqOneByteString( ParameterMode mode = INTPTR_PARAMETERS,
compiler::Node* context, compiler::Node* length, AllocationFlags flags = kNone);
ParameterMode mode = INTPTR_PARAMETERS, AllocationFlags flags = kNone);
// Allocate a SeqTwoByteString with the given length. // Allocate a SeqTwoByteString with the given length.
compiler::Node* AllocateSeqTwoByteString(int length, Node* AllocateSeqTwoByteString(int length, AllocationFlags flags = kNone);
AllocationFlags flags = kNone); Node* AllocateSeqTwoByteString(Node* context, Node* length,
compiler::Node* AllocateSeqTwoByteString( ParameterMode mode = INTPTR_PARAMETERS,
compiler::Node* context, compiler::Node* length, AllocationFlags flags = kNone);
ParameterMode mode = INTPTR_PARAMETERS, AllocationFlags flags = kNone);
// Allocate a SlicedOneByteString with the given length, parent and offset. // Allocate a SlicedOneByteString with the given length, parent and offset.
// |length| and |offset| are expected to be tagged. // |length| and |offset| are expected to be tagged.
compiler::Node* AllocateSlicedOneByteString(compiler::Node* length, Node* AllocateSlicedOneByteString(Node* length, Node* parent, Node* offset);
compiler::Node* parent,
compiler::Node* offset);
// Allocate a SlicedTwoByteString with the given length, parent and offset. // Allocate a SlicedTwoByteString with the given length, parent and offset.
// |length| and |offset| are expected to be tagged. // |length| and |offset| are expected to be tagged.
compiler::Node* AllocateSlicedTwoByteString(compiler::Node* length, Node* AllocateSlicedTwoByteString(Node* length, Node* parent, Node* offset);
compiler::Node* parent,
compiler::Node* offset);
// Allocate a one-byte ConsString with the given length, first and second // Allocate a one-byte ConsString with the given length, first and second
// parts. |length| is expected to be tagged, and |first| and |second| are // parts. |length| is expected to be tagged, and |first| and |second| are
// expected to be one-byte strings. // expected to be one-byte strings.
compiler::Node* AllocateOneByteConsString(compiler::Node* length, Node* AllocateOneByteConsString(Node* length, Node* first, Node* second,
compiler::Node* first, AllocationFlags flags = kNone);
compiler::Node* second,
AllocationFlags flags = kNone);
// Allocate a two-byte ConsString with the given length, first and second // Allocate a two-byte ConsString with the given length, first and second
// parts. |length| is expected to be tagged, and |first| and |second| are // parts. |length| is expected to be tagged, and |first| and |second| are
// expected to be two-byte strings. // expected to be two-byte strings.
compiler::Node* AllocateTwoByteConsString(compiler::Node* length, Node* AllocateTwoByteConsString(Node* length, Node* first, Node* second,
compiler::Node* first, AllocationFlags flags = kNone);
compiler::Node* second,
AllocationFlags flags = kNone);
// Allocate an appropriate one- or two-byte ConsString with the first and // Allocate an appropriate one- or two-byte ConsString with the first and
// second parts specified by |first| and |second|. // second parts specified by |first| and |second|.
compiler::Node* NewConsString(compiler::Node* context, compiler::Node* length, Node* NewConsString(Node* context, Node* length, Node* left, Node* right,
compiler::Node* left, compiler::Node* right, AllocationFlags flags = kNone);
AllocationFlags flags = kNone);
// Allocate a RegExpResult with the given length (the number of captures, // Allocate a RegExpResult with the given length (the number of captures,
// including the match itself), index (the index where the match starts), // including the match itself), index (the index where the match starts),
// and input string. |length| and |index| are expected to be tagged, and // and input string. |length| and |index| are expected to be tagged, and
// |input| must be a string. // |input| must be a string.
compiler::Node* AllocateRegExpResult(compiler::Node* context, Node* AllocateRegExpResult(Node* context, Node* length, Node* index,
compiler::Node* length, Node* input);
compiler::Node* index,
compiler::Node* input);
compiler::Node* AllocateNameDictionary(int capacity); Node* AllocateNameDictionary(int capacity);
compiler::Node* AllocateNameDictionary(compiler::Node* capacity); Node* AllocateNameDictionary(Node* capacity);
compiler::Node* AllocateJSObjectFromMap(compiler::Node* map, Node* AllocateJSObjectFromMap(Node* map, Node* properties = nullptr,
compiler::Node* properties = nullptr, Node* elements = nullptr);
compiler::Node* elements = nullptr);
void InitializeJSObjectFromMap(compiler::Node* object, compiler::Node* map, void InitializeJSObjectFromMap(Node* object, Node* map, Node* size,
compiler::Node* size, Node* properties = nullptr,
compiler::Node* properties = nullptr, Node* elements = nullptr);
compiler::Node* elements = nullptr);
void InitializeJSObjectBody(compiler::Node* object, compiler::Node* map, void InitializeJSObjectBody(Node* object, Node* map, Node* size,
compiler::Node* size,
int start_offset = JSObject::kHeaderSize); int start_offset = JSObject::kHeaderSize);
// Allocate a JSArray without elements and initialize the header fields. // Allocate a JSArray without elements and initialize the header fields.
compiler::Node* AllocateUninitializedJSArrayWithoutElements( Node* AllocateUninitializedJSArrayWithoutElements(ElementsKind kind,
ElementsKind kind, compiler::Node* array_map, compiler::Node* length, Node* array_map,
compiler::Node* allocation_site); Node* length,
Node* allocation_site);
// Allocate and return a JSArray with initialized header fields and its // Allocate and return a JSArray with initialized header fields and its
// uninitialized elements. // uninitialized elements.
// The ParameterMode argument is only used for the capacity parameter. // The ParameterMode argument is only used for the capacity parameter.
std::pair<compiler::Node*, compiler::Node*> std::pair<Node*, Node*> AllocateUninitializedJSArrayWithElements(
AllocateUninitializedJSArrayWithElements( ElementsKind kind, Node* array_map, Node* length, Node* allocation_site,
ElementsKind kind, compiler::Node* array_map, compiler::Node* length, Node* capacity, ParameterMode capacity_mode = INTEGER_PARAMETERS);
compiler::Node* allocation_site, compiler::Node* capacity,
ParameterMode capacity_mode = INTEGER_PARAMETERS);
// Allocate a JSArray and fill elements with the hole. // Allocate a JSArray and fill elements with the hole.
// The ParameterMode argument is only used for the capacity parameter. // The ParameterMode argument is only used for the capacity parameter.
compiler::Node* AllocateJSArray( Node* AllocateJSArray(ElementsKind kind, Node* array_map, Node* capacity,
ElementsKind kind, compiler::Node* array_map, compiler::Node* capacity, Node* length, Node* allocation_site = nullptr,
compiler::Node* length, compiler::Node* allocation_site = nullptr, ParameterMode capacity_mode = INTEGER_PARAMETERS);
ParameterMode capacity_mode = INTEGER_PARAMETERS);
compiler::Node* AllocateFixedArray(ElementsKind kind, Node* AllocateFixedArray(ElementsKind kind, Node* capacity,
compiler::Node* capacity, ParameterMode mode = INTEGER_PARAMETERS,
ParameterMode mode = INTEGER_PARAMETERS, AllocationFlags flags = kNone);
AllocationFlags flags = kNone);
// Perform CreateArrayIterator (ES6 #sec-createarrayiterator). // Perform CreateArrayIterator (ES6 #sec-createarrayiterator).
compiler::Node* CreateArrayIterator(compiler::Node* array, Node* CreateArrayIterator(Node* array, Node* array_map, Node* array_type,
compiler::Node* array_map, Node* context, IterationKind mode);
compiler::Node* array_type,
compiler::Node* context, Node* AllocateJSArrayIterator(Node* array, Node* array_map, Node* map);
IterationKind mode);
void FillFixedArrayWithValue(ElementsKind kind, Node* array, Node* from_index,
compiler::Node* AllocateJSArrayIterator(compiler::Node* array, Node* to_index,
compiler::Node* array_map,
compiler::Node* map);
void FillFixedArrayWithValue(ElementsKind kind, compiler::Node* array,
compiler::Node* from_index,
compiler::Node* to_index,
Heap::RootListIndex value_root_index, Heap::RootListIndex value_root_index,
ParameterMode mode = INTEGER_PARAMETERS); ParameterMode mode = INTEGER_PARAMETERS);
// Copies all elements from |from_array| of |length| size to // Copies all elements from |from_array| of |length| size to
// |to_array| of the same size respecting the elements kind. // |to_array| of the same size respecting the elements kind.
void CopyFixedArrayElements( void CopyFixedArrayElements(
ElementsKind kind, compiler::Node* from_array, compiler::Node* to_array, ElementsKind kind, Node* from_array, Node* to_array, Node* length,
compiler::Node* length,
WriteBarrierMode barrier_mode = UPDATE_WRITE_BARRIER, WriteBarrierMode barrier_mode = UPDATE_WRITE_BARRIER,
ParameterMode mode = INTEGER_PARAMETERS) { ParameterMode mode = INTEGER_PARAMETERS) {
CopyFixedArrayElements(kind, from_array, kind, to_array, length, length, CopyFixedArrayElements(kind, from_array, kind, to_array, length, length,
...@@ -509,9 +455,8 @@ class V8_EXPORT_PRIVATE CodeStubAssembler : public compiler::CodeAssembler { ...@@ -509,9 +455,8 @@ class V8_EXPORT_PRIVATE CodeStubAssembler : public compiler::CodeAssembler {
// Copies |element_count| elements from |from_array| to |to_array| of // Copies |element_count| elements from |from_array| to |to_array| of
// |capacity| size respecting both array's elements kinds. // |capacity| size respecting both array's elements kinds.
void CopyFixedArrayElements( void CopyFixedArrayElements(
ElementsKind from_kind, compiler::Node* from_array, ElementsKind to_kind, ElementsKind from_kind, Node* from_array, ElementsKind to_kind,
compiler::Node* to_array, compiler::Node* element_count, Node* to_array, Node* element_count, Node* capacity,
compiler::Node* capacity,
WriteBarrierMode barrier_mode = UPDATE_WRITE_BARRIER, WriteBarrierMode barrier_mode = UPDATE_WRITE_BARRIER,
ParameterMode mode = INTEGER_PARAMETERS); ParameterMode mode = INTEGER_PARAMETERS);
...@@ -523,11 +468,9 @@ class V8_EXPORT_PRIVATE CodeStubAssembler : public compiler::CodeAssembler { ...@@ -523,11 +468,9 @@ class V8_EXPORT_PRIVATE CodeStubAssembler : public compiler::CodeAssembler {
// intptr_ts depending on |mode| s.t. 0 <= |from_index| <= |from_index| + // intptr_ts depending on |mode| s.t. 0 <= |from_index| <= |from_index| +
// |character_count| <= from_string.length and 0 <= |to_index| <= |to_index| + // |character_count| <= from_string.length and 0 <= |to_index| <= |to_index| +
// |character_count| <= to_string.length. // |character_count| <= to_string.length.
void CopyStringCharacters(compiler::Node* from_string, void CopyStringCharacters(Node* from_string, Node* to_string,
compiler::Node* to_string, Node* from_index, Node* to_index,
compiler::Node* from_index, Node* character_count,
compiler::Node* to_index,
compiler::Node* character_count,
String::Encoding from_encoding, String::Encoding from_encoding,
String::Encoding to_encoding, ParameterMode mode); String::Encoding to_encoding, ParameterMode mode);
...@@ -535,154 +478,131 @@ class V8_EXPORT_PRIVATE CodeStubAssembler : public compiler::CodeAssembler { ...@@ -535,154 +478,131 @@ class V8_EXPORT_PRIVATE CodeStubAssembler : public compiler::CodeAssembler {
// (NOTE: not index!), does a hole check if |if_hole| is provided and // (NOTE: not index!), does a hole check if |if_hole| is provided and
// converts the value so that it becomes ready for storing to array of // converts the value so that it becomes ready for storing to array of
// |to_kind| elements. // |to_kind| elements.
compiler::Node* LoadElementAndPrepareForStore(compiler::Node* array, Node* LoadElementAndPrepareForStore(Node* array, Node* offset,
compiler::Node* offset, ElementsKind from_kind,
ElementsKind from_kind, ElementsKind to_kind, Label* if_hole);
ElementsKind to_kind,
Label* if_hole);
compiler::Node* CalculateNewElementsCapacity( Node* CalculateNewElementsCapacity(Node* old_capacity,
compiler::Node* old_capacity, ParameterMode mode = INTEGER_PARAMETERS); ParameterMode mode = INTEGER_PARAMETERS);
// Tries to grow the |elements| array of given |object| to store the |key| // Tries to grow the |elements| array of given |object| to store the |key|
// or bails out if the growing gap is too big. Returns new elements. // or bails out if the growing gap is too big. Returns new elements.
compiler::Node* TryGrowElementsCapacity(compiler::Node* object, Node* TryGrowElementsCapacity(Node* object, Node* elements, ElementsKind kind,
compiler::Node* elements, Node* key, Label* bailout);
ElementsKind kind,
compiler::Node* key, Label* bailout);
// Tries to grow the |capacity|-length |elements| array of given |object| // Tries to grow the |capacity|-length |elements| array of given |object|
// to store the |key| or bails out if the growing gap is too big. Returns // to store the |key| or bails out if the growing gap is too big. Returns
// new elements. // new elements.
compiler::Node* TryGrowElementsCapacity(compiler::Node* object, Node* TryGrowElementsCapacity(Node* object, Node* elements, ElementsKind kind,
compiler::Node* elements, Node* key, Node* capacity, ParameterMode mode,
ElementsKind kind, Label* bailout);
compiler::Node* key,
compiler::Node* capacity,
ParameterMode mode, Label* bailout);
// Grows elements capacity of given object. Returns new elements. // Grows elements capacity of given object. Returns new elements.
compiler::Node* GrowElementsCapacity( Node* GrowElementsCapacity(Node* object, Node* elements,
compiler::Node* object, compiler::Node* elements, ElementsKind from_kind, ElementsKind from_kind, ElementsKind to_kind,
ElementsKind to_kind, compiler::Node* capacity, Node* capacity, Node* new_capacity,
compiler::Node* new_capacity, ParameterMode mode, Label* bailout); ParameterMode mode, Label* bailout);
// Allocation site manipulation // Allocation site manipulation
void InitializeAllocationMemento(compiler::Node* base_allocation, void InitializeAllocationMemento(Node* base_allocation,
int base_allocation_size, int base_allocation_size,
compiler::Node* allocation_site); Node* allocation_site);
compiler::Node* TryTaggedToFloat64(compiler::Node* value, Node* TryTaggedToFloat64(Node* value, Label* if_valueisnotnumber);
Label* if_valueisnotnumber); Node* TruncateTaggedToFloat64(Node* context, Node* value);
compiler::Node* TruncateTaggedToFloat64(compiler::Node* context, Node* TruncateTaggedToWord32(Node* context, Node* value);
compiler::Node* value);
compiler::Node* TruncateTaggedToWord32(compiler::Node* context,
compiler::Node* value);
// Truncate the floating point value of a HeapNumber to an Int32. // Truncate the floating point value of a HeapNumber to an Int32.
compiler::Node* TruncateHeapNumberValueToWord32(compiler::Node* object); Node* TruncateHeapNumberValueToWord32(Node* object);
// Conversions. // Conversions.
compiler::Node* ChangeFloat64ToTagged(compiler::Node* value); Node* ChangeFloat64ToTagged(Node* value);
compiler::Node* ChangeInt32ToTagged(compiler::Node* value); Node* ChangeInt32ToTagged(Node* value);
compiler::Node* ChangeUint32ToTagged(compiler::Node* value); Node* ChangeUint32ToTagged(Node* value);
// Type conversions. // Type conversions.
// Throws a TypeError for {method_name} if {value} is not coercible to Object, // Throws a TypeError for {method_name} if {value} is not coercible to Object,
// or returns the {value} converted to a String otherwise. // or returns the {value} converted to a String otherwise.
compiler::Node* ToThisString(compiler::Node* context, compiler::Node* value, Node* ToThisString(Node* context, Node* value, char const* method_name);
char const* method_name);
// Throws a TypeError for {method_name} if {value} is neither of the given // Throws a TypeError for {method_name} if {value} is neither of the given
// {primitive_type} nor a JSValue wrapping a value of {primitive_type}, or // {primitive_type} nor a JSValue wrapping a value of {primitive_type}, or
// returns the {value} (or wrapped value) otherwise. // returns the {value} (or wrapped value) otherwise.
compiler::Node* ToThisValue(compiler::Node* context, compiler::Node* value, Node* ToThisValue(Node* context, Node* value, PrimitiveType primitive_type,
PrimitiveType primitive_type, char const* method_name);
char const* method_name);
// Throws a TypeError for {method_name} if {value} is not of the given // Throws a TypeError for {method_name} if {value} is not of the given
// instance type. Returns {value}'s map. // instance type. Returns {value}'s map.
compiler::Node* ThrowIfNotInstanceType(compiler::Node* context, Node* ThrowIfNotInstanceType(Node* context, Node* value,
compiler::Node* value, InstanceType instance_type,
InstanceType instance_type, char const* method_name);
char const* method_name);
// Type checks. // Type checks.
// Check whether the map is for an object with special properties, such as a // Check whether the map is for an object with special properties, such as a
// JSProxy or an object with interceptors. // JSProxy or an object with interceptors.
compiler::Node* IsSpecialReceiverMap(compiler::Node* map); Node* IsSpecialReceiverMap(Node* map);
compiler::Node* IsSpecialReceiverInstanceType(compiler::Node* instance_type); Node* IsSpecialReceiverInstanceType(Node* instance_type);
compiler::Node* IsStringInstanceType(compiler::Node* instance_type); Node* IsStringInstanceType(Node* instance_type);
compiler::Node* IsString(compiler::Node* object); Node* IsString(Node* object);
compiler::Node* IsJSObject(compiler::Node* object); Node* IsJSObject(Node* object);
compiler::Node* IsJSGlobalProxy(compiler::Node* object); Node* IsJSGlobalProxy(Node* object);
compiler::Node* IsJSReceiverInstanceType(compiler::Node* instance_type); Node* IsJSReceiverInstanceType(Node* instance_type);
compiler::Node* IsJSReceiver(compiler::Node* object); Node* IsJSReceiver(Node* object);
compiler::Node* IsMap(compiler::Node* object); Node* IsMap(Node* object);
compiler::Node* IsCallableMap(compiler::Node* map); Node* IsCallableMap(Node* map);
compiler::Node* IsName(compiler::Node* object); Node* IsName(Node* object);
compiler::Node* IsJSValue(compiler::Node* object); Node* IsJSValue(Node* object);
compiler::Node* IsJSArray(compiler::Node* object); Node* IsJSArray(Node* object);
compiler::Node* IsNativeContext(compiler::Node* object); Node* IsNativeContext(Node* object);
compiler::Node* IsWeakCell(compiler::Node* object); Node* IsWeakCell(Node* object);
compiler::Node* IsFixedDoubleArray(compiler::Node* object); Node* IsFixedDoubleArray(Node* object);
compiler::Node* IsHashTable(compiler::Node* object); Node* IsHashTable(Node* object);
compiler::Node* IsDictionary(compiler::Node* object); Node* IsDictionary(Node* object);
compiler::Node* IsUnseededNumberDictionary(compiler::Node* object); Node* IsUnseededNumberDictionary(Node* object);
// ElementsKind helpers: // ElementsKind helpers:
compiler::Node* IsFastElementsKind(compiler::Node* elements_kind); Node* IsFastElementsKind(Node* elements_kind);
compiler::Node* IsHoleyFastElementsKind(compiler::Node* elements_kind); Node* IsHoleyFastElementsKind(Node* elements_kind);
// String helpers. // String helpers.
// Load a character from a String (might flatten a ConsString). // Load a character from a String (might flatten a ConsString).
compiler::Node* StringCharCodeAt(compiler::Node* string, Node* StringCharCodeAt(Node* string, Node* smi_index);
compiler::Node* smi_index);
// Return the single character string with only {code}. // Return the single character string with only {code}.
compiler::Node* StringFromCharCode(compiler::Node* code); Node* StringFromCharCode(Node* code);
// Return a new string object which holds a substring containing the range // Return a new string object which holds a substring containing the range
// [from,to[ of string. |from| and |to| are expected to be tagged. // [from,to[ of string. |from| and |to| are expected to be tagged.
compiler::Node* SubString(compiler::Node* context, compiler::Node* string, Node* SubString(Node* context, Node* string, Node* from, Node* to);
compiler::Node* from, compiler::Node* to);
// Return a new string object produced by concatenating |first| with |second|. // Return a new string object produced by concatenating |first| with |second|.
compiler::Node* StringAdd(compiler::Node* context, compiler::Node* first, Node* StringAdd(Node* context, Node* first, Node* second,
compiler::Node* second, AllocationFlags flags = kNone);
AllocationFlags flags = kNone);
// Return the first index >= {from} at which {needle_char} was found in // Return the first index >= {from} at which {needle_char} was found in
// {string}, or -1 if such an index does not exist. The returned value is // {string}, or -1 if such an index does not exist. The returned value is
// a Smi, {string} is expected to be a String, {needle_char} is an intptr, // a Smi, {string} is expected to be a String, {needle_char} is an intptr,
// and {from} is expected to be tagged. // and {from} is expected to be tagged.
compiler::Node* StringIndexOfChar(compiler::Node* context, Node* StringIndexOfChar(Node* context, Node* string, Node* needle_char,
compiler::Node* string, Node* from);
compiler::Node* needle_char,
compiler::Node* from);
compiler::Node* StringFromCodePoint(compiler::Node* codepoint, Node* StringFromCodePoint(Node* codepoint, UnicodeEncoding encoding);
UnicodeEncoding encoding);
// Type conversion helpers. // Type conversion helpers.
// Convert a String to a Number. // Convert a String to a Number.
compiler::Node* StringToNumber(compiler::Node* context, Node* StringToNumber(Node* context, Node* input);
compiler::Node* input); Node* NumberToString(Node* context, Node* input);
compiler::Node* NumberToString(compiler::Node* context,
compiler::Node* input);
// Convert an object to a name. // Convert an object to a name.
compiler::Node* ToName(compiler::Node* context, compiler::Node* input); Node* ToName(Node* context, Node* input);
// Convert a Non-Number object to a Number. // Convert a Non-Number object to a Number.
compiler::Node* NonNumberToNumber(compiler::Node* context, Node* NonNumberToNumber(Node* context, Node* input);
compiler::Node* input);
// Convert any object to a Number. // Convert any object to a Number.
compiler::Node* ToNumber(compiler::Node* context, compiler::Node* input); Node* ToNumber(Node* context, Node* input);
// Convert any object to a String. // Convert any object to a String.
compiler::Node* ToString(compiler::Node* context, compiler::Node* input); Node* ToString(Node* context, Node* input);
// Convert any object to a Primitive. // Convert any object to a Primitive.
compiler::Node* JSReceiverToPrimitive(compiler::Node* context, Node* JSReceiverToPrimitive(Node* context, Node* input);
compiler::Node* input);
// Convert a String to a flat String. // Convert a String to a flat String.
compiler::Node* FlattenString(compiler::Node* string); Node* FlattenString(Node* string);
enum ToIntegerTruncationMode { enum ToIntegerTruncationMode {
kNoTruncation, kNoTruncation,
...@@ -690,53 +610,51 @@ class V8_EXPORT_PRIVATE CodeStubAssembler : public compiler::CodeAssembler { ...@@ -690,53 +610,51 @@ class V8_EXPORT_PRIVATE CodeStubAssembler : public compiler::CodeAssembler {
}; };
// Convert any object to an Integer. // Convert any object to an Integer.
compiler::Node* ToInteger(compiler::Node* context, compiler::Node* input, Node* ToInteger(Node* context, Node* input,
ToIntegerTruncationMode mode = kNoTruncation); ToIntegerTruncationMode mode = kNoTruncation);
// Returns a node that contains a decoded (unsigned!) value of a bit // Returns a node that contains a decoded (unsigned!) value of a bit
// field |T| in |word32|. Returns result as an uint32 node. // field |T| in |word32|. Returns result as an uint32 node.
template <typename T> template <typename T>
compiler::Node* DecodeWord32(compiler::Node* word32) { Node* DecodeWord32(Node* word32) {
return DecodeWord32(word32, T::kShift, T::kMask); return DecodeWord32(word32, T::kShift, T::kMask);
} }
// Returns a node that contains a decoded (unsigned!) value of a bit // Returns a node that contains a decoded (unsigned!) value of a bit
// field |T| in |word|. Returns result as a word-size node. // field |T| in |word|. Returns result as a word-size node.
template <typename T> template <typename T>
compiler::Node* DecodeWord(compiler::Node* word) { Node* DecodeWord(Node* word) {
return DecodeWord(word, T::kShift, T::kMask); return DecodeWord(word, T::kShift, T::kMask);
} }
// Returns a node that contains a decoded (unsigned!) value of a bit // Returns a node that contains a decoded (unsigned!) value of a bit
// field |T| in |word32|. Returns result as a word-size node. // field |T| in |word32|. Returns result as a word-size node.
template <typename T> template <typename T>
compiler::Node* DecodeWordFromWord32(compiler::Node* word32) { Node* DecodeWordFromWord32(Node* word32) {
return DecodeWord<T>(ChangeUint32ToWord(word32)); return DecodeWord<T>(ChangeUint32ToWord(word32));
} }
// Decodes an unsigned (!) value from |word32| to an uint32 node. // Decodes an unsigned (!) value from |word32| to an uint32 node.
compiler::Node* DecodeWord32(compiler::Node* word32, uint32_t shift, Node* DecodeWord32(Node* word32, uint32_t shift, uint32_t mask);
uint32_t mask);
// Decodes an unsigned (!) value from |word| to a word-size node. // Decodes an unsigned (!) value from |word| to a word-size node.
compiler::Node* DecodeWord(compiler::Node* word, uint32_t shift, Node* DecodeWord(Node* word, uint32_t shift, uint32_t mask);
uint32_t mask);
// Returns true if any of the |T|'s bits in given |word32| are set. // Returns true if any of the |T|'s bits in given |word32| are set.
template <typename T> template <typename T>
compiler::Node* IsSetWord32(compiler::Node* word32) { Node* IsSetWord32(Node* word32) {
return IsSetWord32(word32, T::kMask); return IsSetWord32(word32, T::kMask);
} }
// Returns true if any of the mask's bits in given |word32| are set. // Returns true if any of the mask's bits in given |word32| are set.
compiler::Node* IsSetWord32(compiler::Node* word32, uint32_t mask) { Node* IsSetWord32(Node* word32, uint32_t mask) {
return Word32NotEqual(Word32And(word32, Int32Constant(mask)), return Word32NotEqual(Word32And(word32, Int32Constant(mask)),
Int32Constant(0)); Int32Constant(0));
} }
// Returns true if any of the |T|'s bits in given |word| are set. // Returns true if any of the |T|'s bits in given |word| are set.
template <typename T> template <typename T>
compiler::Node* IsSetWord(compiler::Node* word) { Node* IsSetWord(Node* word) {
return WordNotEqual(WordAnd(word, IntPtrConstant(T::kMask)), return WordNotEqual(WordAnd(word, IntPtrConstant(T::kMask)),
IntPtrConstant(0)); IntPtrConstant(0));
} }
...@@ -751,36 +669,34 @@ class V8_EXPORT_PRIVATE CodeStubAssembler : public compiler::CodeAssembler { ...@@ -751,36 +669,34 @@ class V8_EXPORT_PRIVATE CodeStubAssembler : public compiler::CodeAssembler {
void Use(Label* label); void Use(Label* label);
// Various building blocks for stubs doing property lookups. // Various building blocks for stubs doing property lookups.
void TryToName(compiler::Node* key, Label* if_keyisindex, Variable* var_index, void TryToName(Node* key, Label* if_keyisindex, Variable* var_index,
Label* if_keyisunique, Label* if_bailout); Label* if_keyisunique, Label* if_bailout);
// Calculates array index for given dictionary entry and entry field. // Calculates array index for given dictionary entry and entry field.
// See Dictionary::EntryToIndex(). // See Dictionary::EntryToIndex().
template <typename Dictionary> template <typename Dictionary>
compiler::Node* EntryToIndex(compiler::Node* entry, int field_index); Node* EntryToIndex(Node* entry, int field_index);
template <typename Dictionary> template <typename Dictionary>
compiler::Node* EntryToIndex(compiler::Node* entry) { Node* EntryToIndex(Node* entry) {
return EntryToIndex<Dictionary>(entry, Dictionary::kEntryKeyIndex); return EntryToIndex<Dictionary>(entry, Dictionary::kEntryKeyIndex);
} }
// Calculate a valid size for the a hash table. // Calculate a valid size for the a hash table.
compiler::Node* HashTableComputeCapacity(compiler::Node* at_least_space_for); Node* HashTableComputeCapacity(Node* at_least_space_for);
template <class Dictionary> template <class Dictionary>
compiler::Node* GetNumberOfElements(compiler::Node* dictionary); Node* GetNumberOfElements(Node* dictionary);
template <class Dictionary> template <class Dictionary>
void SetNumberOfElements(compiler::Node* dictionary, void SetNumberOfElements(Node* dictionary, Node* num_elements_smi);
compiler::Node* num_elements_smi);
template <class Dictionary> template <class Dictionary>
compiler::Node* GetCapacity(compiler::Node* dictionary); Node* GetCapacity(Node* dictionary);
template <class Dictionary> template <class Dictionary>
compiler::Node* GetNextEnumerationIndex(compiler::Node* dictionary); Node* GetNextEnumerationIndex(Node* dictionary);
template <class Dictionary> template <class Dictionary>
void SetNextEnumerationIndex(compiler::Node* dictionary, void SetNextEnumerationIndex(Node* dictionary, Node* next_enum_index_smi);
compiler::Node* next_enum_index_smi);
// Looks up an entry in a NameDictionaryBase successor. If the entry is found // Looks up an entry in a NameDictionaryBase successor. If the entry is found
// control goes to {if_found} and {var_name_index} contains an index of the // control goes to {if_found} and {var_name_index} contains an index of the
...@@ -789,60 +705,51 @@ class V8_EXPORT_PRIVATE CodeStubAssembler : public compiler::CodeAssembler { ...@@ -789,60 +705,51 @@ class V8_EXPORT_PRIVATE CodeStubAssembler : public compiler::CodeAssembler {
static const int kInlinedDictionaryProbes = 4; static const int kInlinedDictionaryProbes = 4;
enum LookupMode { kFindExisting, kFindInsertionIndex }; enum LookupMode { kFindExisting, kFindInsertionIndex };
template <typename Dictionary> template <typename Dictionary>
void NameDictionaryLookup(compiler::Node* dictionary, void NameDictionaryLookup(Node* dictionary, Node* unique_name,
compiler::Node* unique_name, Label* if_found, Label* if_found, Variable* var_name_index,
Variable* var_name_index, Label* if_not_found, Label* if_not_found,
int inlined_probes = kInlinedDictionaryProbes, int inlined_probes = kInlinedDictionaryProbes,
LookupMode mode = kFindExisting); LookupMode mode = kFindExisting);
compiler::Node* ComputeIntegerHash(compiler::Node* key, compiler::Node* seed); Node* ComputeIntegerHash(Node* key, Node* seed);
template <typename Dictionary> template <typename Dictionary>
void NumberDictionaryLookup(compiler::Node* dictionary, void NumberDictionaryLookup(Node* dictionary, Node* intptr_index,
compiler::Node* intptr_index, Label* if_found, Label* if_found, Variable* var_entry,
Variable* var_entry, Label* if_not_found); Label* if_not_found);
template <class Dictionary> template <class Dictionary>
void FindInsertionEntry(compiler::Node* dictionary, compiler::Node* key, void FindInsertionEntry(Node* dictionary, Node* key, Variable* var_key_index);
Variable* var_key_index);
template <class Dictionary> template <class Dictionary>
void InsertEntry(compiler::Node* dictionary, compiler::Node* key, void InsertEntry(Node* dictionary, Node* key, Node* value, Node* index,
compiler::Node* value, compiler::Node* index, Node* enum_index);
compiler::Node* enum_index);
template <class Dictionary> template <class Dictionary>
void Add(compiler::Node* dictionary, compiler::Node* key, void Add(Node* dictionary, Node* key, Node* value, Label* bailout);
compiler::Node* value, Label* bailout);
// Tries to check if {object} has own {unique_name} property. // Tries to check if {object} has own {unique_name} property.
void TryHasOwnProperty(compiler::Node* object, compiler::Node* map, void TryHasOwnProperty(Node* object, Node* map, Node* instance_type,
compiler::Node* instance_type, Node* unique_name, Label* if_found,
compiler::Node* unique_name, Label* if_found,
Label* if_not_found, Label* if_bailout); Label* if_not_found, Label* if_bailout);
// Tries to get {object}'s own {unique_name} property value. If the property // Tries to get {object}'s own {unique_name} property value. If the property
// is an accessor then it also calls a getter. If the property is a double // is an accessor then it also calls a getter. If the property is a double
// field it re-wraps value in an immutable heap number. // field it re-wraps value in an immutable heap number.
void TryGetOwnProperty(compiler::Node* context, compiler::Node* receiver, void TryGetOwnProperty(Node* context, Node* receiver, Node* object, Node* map,
compiler::Node* object, compiler::Node* map, Node* instance_type, Node* unique_name,
compiler::Node* instance_type, Label* if_found, Variable* var_value,
compiler::Node* unique_name, Label* if_found, Label* if_not_found, Label* if_bailout);
Variable* var_value, Label* if_not_found,
Label* if_bailout); void LoadPropertyFromFastObject(Node* object, Node* map, Node* descriptors,
Node* name_index, Variable* var_details,
void LoadPropertyFromFastObject(compiler::Node* object, compiler::Node* map, Variable* var_value);
compiler::Node* descriptors,
compiler::Node* name_index, void LoadPropertyFromNameDictionary(Node* dictionary, Node* entry,
Variable* var_details, Variable* var_value);
void LoadPropertyFromNameDictionary(compiler::Node* dictionary,
compiler::Node* entry,
Variable* var_details, Variable* var_details,
Variable* var_value); Variable* var_value);
void LoadPropertyFromGlobalDictionary(compiler::Node* dictionary, void LoadPropertyFromGlobalDictionary(Node* dictionary, Node* entry,
compiler::Node* entry,
Variable* var_details, Variable* var_details,
Variable* var_value, Label* if_deleted); Variable* var_value, Label* if_deleted);
...@@ -858,24 +765,21 @@ class V8_EXPORT_PRIVATE CodeStubAssembler : public compiler::CodeAssembler { ...@@ -858,24 +765,21 @@ class V8_EXPORT_PRIVATE CodeStubAssembler : public compiler::CodeAssembler {
// //
// Note: this code does not check if the global dictionary points to deleted // Note: this code does not check if the global dictionary points to deleted
// entry! This has to be done by the caller. // entry! This has to be done by the caller.
void TryLookupProperty(compiler::Node* object, compiler::Node* map, void TryLookupProperty(Node* object, Node* map, Node* instance_type,
compiler::Node* instance_type, Node* unique_name, Label* if_found_fast,
compiler::Node* unique_name, Label* if_found_fast,
Label* if_found_dict, Label* if_found_global, Label* if_found_dict, Label* if_found_global,
Variable* var_meta_storage, Variable* var_name_index, Variable* var_meta_storage, Variable* var_name_index,
Label* if_not_found, Label* if_bailout); Label* if_not_found, Label* if_bailout);
void TryLookupElement(compiler::Node* object, compiler::Node* map, void TryLookupElement(Node* object, Node* map, Node* instance_type,
compiler::Node* instance_type, Node* intptr_index, Label* if_found,
compiler::Node* intptr_index, Label* if_found,
Label* if_not_found, Label* if_bailout); Label* if_not_found, Label* if_bailout);
// This is a type of a lookup in holder generator function. In case of a // This is a type of a lookup in holder generator function. In case of a
// property lookup the {key} is guaranteed to be a unique name and in case of // property lookup the {key} is guaranteed to be a unique name and in case of
// element lookup the key is an Int32 index. // element lookup the key is an Int32 index.
typedef std::function<void(compiler::Node* receiver, compiler::Node* holder, typedef std::function<void(Node* receiver, Node* holder, Node* map,
compiler::Node* map, compiler::Node* instance_type, Node* instance_type, Node* key, Label* next_holder,
compiler::Node* key, Label* next_holder,
Label* if_bailout)> Label* if_bailout)>
LookupInHolder; LookupInHolder;
...@@ -885,124 +789,105 @@ class V8_EXPORT_PRIVATE CodeStubAssembler : public compiler::CodeAssembler { ...@@ -885,124 +789,105 @@ class V8_EXPORT_PRIVATE CodeStubAssembler : public compiler::CodeAssembler {
// Upon reaching the end of prototype chain the control goes to {if_end}. // Upon reaching the end of prototype chain the control goes to {if_end}.
// If it can't handle the case {receiver}/{key} case then the control goes // If it can't handle the case {receiver}/{key} case then the control goes
// to {if_bailout}. // to {if_bailout}.
void TryPrototypeChainLookup(compiler::Node* receiver, compiler::Node* key, void TryPrototypeChainLookup(Node* receiver, Node* key,
LookupInHolder& lookup_property_in_holder, LookupInHolder& lookup_property_in_holder,
LookupInHolder& lookup_element_in_holder, LookupInHolder& lookup_element_in_holder,
Label* if_end, Label* if_bailout); Label* if_end, Label* if_bailout);
// Instanceof helpers. // Instanceof helpers.
// ES6 section 7.3.19 OrdinaryHasInstance (C, O) // ES6 section 7.3.19 OrdinaryHasInstance (C, O)
compiler::Node* OrdinaryHasInstance(compiler::Node* context, Node* OrdinaryHasInstance(Node* context, Node* callable, Node* object);
compiler::Node* callable,
compiler::Node* object);
// Load type feedback vector from the stub caller's frame. // Load type feedback vector from the stub caller's frame.
compiler::Node* LoadTypeFeedbackVectorForStub(); Node* LoadTypeFeedbackVectorForStub();
// Update the type feedback vector. // Update the type feedback vector.
void UpdateFeedback(compiler::Node* feedback, void UpdateFeedback(Node* feedback, Node* type_feedback_vector,
compiler::Node* type_feedback_vector, Node* slot_id);
compiler::Node* slot_id);
compiler::Node* LoadReceiverMap(compiler::Node* receiver); Node* LoadReceiverMap(Node* receiver);
// Extends properties backing store by JSObject::kFieldsAdded elements. // Extends properties backing store by JSObject::kFieldsAdded elements.
void ExtendPropertiesBackingStore(compiler::Node* object); void ExtendPropertiesBackingStore(Node* object);
compiler::Node* PrepareValueForWrite(compiler::Node* value, Node* PrepareValueForWrite(Node* value, Representation representation,
Representation representation, Label* bailout);
Label* bailout);
void StoreNamedField(compiler::Node* object, FieldIndex index, void StoreNamedField(Node* object, FieldIndex index,
Representation representation, compiler::Node* value, Representation representation, Node* value,
bool transition_to_field); bool transition_to_field);
void StoreNamedField(compiler::Node* object, compiler::Node* offset, void StoreNamedField(Node* object, Node* offset, bool is_inobject,
bool is_inobject, Representation representation, Representation representation, Node* value,
compiler::Node* value, bool transition_to_field); bool transition_to_field);
// Emits keyed sloppy arguments load. Returns either the loaded value. // Emits keyed sloppy arguments load. Returns either the loaded value.
compiler::Node* LoadKeyedSloppyArguments(compiler::Node* receiver, Node* LoadKeyedSloppyArguments(Node* receiver, Node* key, Label* bailout) {
compiler::Node* key,
Label* bailout) {
return EmitKeyedSloppyArguments(receiver, key, nullptr, bailout); return EmitKeyedSloppyArguments(receiver, key, nullptr, bailout);
} }
// Emits keyed sloppy arguments store. // Emits keyed sloppy arguments store.
void StoreKeyedSloppyArguments(compiler::Node* receiver, compiler::Node* key, void StoreKeyedSloppyArguments(Node* receiver, Node* key, Node* value,
compiler::Node* value, Label* bailout) { Label* bailout) {
DCHECK_NOT_NULL(value); DCHECK_NOT_NULL(value);
EmitKeyedSloppyArguments(receiver, key, value, bailout); EmitKeyedSloppyArguments(receiver, key, value, bailout);
} }
// Loads script context from the script context table. // Loads script context from the script context table.
compiler::Node* LoadScriptContext(compiler::Node* context, int context_index); Node* LoadScriptContext(Node* context, int context_index);
compiler::Node* ClampedToUint8(compiler::Node* int32_value); Node* ClampedToUint8(Node* int32_value);
// Store value to an elements array with given elements kind. // Store value to an elements array with given elements kind.
void StoreElement(compiler::Node* elements, ElementsKind kind, void StoreElement(Node* elements, ElementsKind kind, Node* index, Node* value,
compiler::Node* index, compiler::Node* value,
ParameterMode mode); ParameterMode mode);
void EmitElementStore(compiler::Node* object, compiler::Node* key, void EmitElementStore(Node* object, Node* key, Node* value, bool is_jsarray,
compiler::Node* value, bool is_jsarray,
ElementsKind elements_kind, ElementsKind elements_kind,
KeyedAccessStoreMode store_mode, Label* bailout); KeyedAccessStoreMode store_mode, Label* bailout);
compiler::Node* CheckForCapacityGrow(compiler::Node* object, Node* CheckForCapacityGrow(Node* object, Node* elements, ElementsKind kind,
compiler::Node* elements, Node* length, Node* key, ParameterMode mode,
ElementsKind kind, bool is_js_array, Label* bailout);
compiler::Node* length,
compiler::Node* key, ParameterMode mode,
bool is_js_array, Label* bailout);
compiler::Node* CopyElementsOnWrite(compiler::Node* object, Node* CopyElementsOnWrite(Node* object, Node* elements, ElementsKind kind,
compiler::Node* elements, Node* length, ParameterMode mode, Label* bailout);
ElementsKind kind, compiler::Node* length,
ParameterMode mode, Label* bailout);
void TransitionElementsKind(compiler::Node* object, compiler::Node* map, void TransitionElementsKind(Node* object, Node* map, ElementsKind from_kind,
ElementsKind from_kind, ElementsKind to_kind, ElementsKind to_kind, bool is_jsarray,
bool is_jsarray, Label* bailout); Label* bailout);
void TrapAllocationMemento(compiler::Node* object, Label* memento_found); void TrapAllocationMemento(Node* object, Label* memento_found);
compiler::Node* PageFromAddress(compiler::Node* address); Node* PageFromAddress(Node* address);
// Get the enumerable length from |map| and return the result as a Smi. // Get the enumerable length from |map| and return the result as a Smi.
compiler::Node* EnumLength(compiler::Node* map); Node* EnumLength(Node* map);
// Check the cache validity for |receiver|. Branch to |use_cache| if // Check the cache validity for |receiver|. Branch to |use_cache| if
// the cache is valid, otherwise branch to |use_runtime|. // the cache is valid, otherwise branch to |use_runtime|.
void CheckEnumCache(compiler::Node* receiver, void CheckEnumCache(Node* receiver, CodeStubAssembler::Label* use_cache,
CodeStubAssembler::Label* use_cache,
CodeStubAssembler::Label* use_runtime); CodeStubAssembler::Label* use_runtime);
// Create a new weak cell with a specified value and install it into a // Create a new weak cell with a specified value and install it into a
// feedback vector. // feedback vector.
compiler::Node* CreateWeakCellInFeedbackVector( Node* CreateWeakCellInFeedbackVector(Node* feedback_vector, Node* slot,
compiler::Node* feedback_vector, compiler::Node* slot, Node* value);
compiler::Node* value);
// Create a new AllocationSite and install it into a feedback vector. // Create a new AllocationSite and install it into a feedback vector.
compiler::Node* CreateAllocationSiteInFeedbackVector( Node* CreateAllocationSiteInFeedbackVector(Node* feedback_vector, Node* slot);
compiler::Node* feedback_vector, compiler::Node* slot);
enum class IndexAdvanceMode { kPre, kPost }; enum class IndexAdvanceMode { kPre, kPost };
void BuildFastLoop( void BuildFastLoop(
const VariableList& var_list, MachineRepresentation index_rep, const VariableList& var_list, MachineRepresentation index_rep,
compiler::Node* start_index, compiler::Node* end_index, Node* start_index, Node* end_index,
std::function<void(CodeStubAssembler* assembler, compiler::Node* index)> std::function<void(CodeStubAssembler* assembler, Node* index)> body,
body,
int increment, IndexAdvanceMode mode = IndexAdvanceMode::kPre); int increment, IndexAdvanceMode mode = IndexAdvanceMode::kPre);
void BuildFastLoop( void BuildFastLoop(
MachineRepresentation index_rep, compiler::Node* start_index, MachineRepresentation index_rep, Node* start_index, Node* end_index,
compiler::Node* end_index, std::function<void(CodeStubAssembler* assembler, Node* index)> body,
std::function<void(CodeStubAssembler* assembler, compiler::Node* index)>
body,
int increment, IndexAdvanceMode mode = IndexAdvanceMode::kPre) { int increment, IndexAdvanceMode mode = IndexAdvanceMode::kPre) {
BuildFastLoop(VariableList(0, zone()), index_rep, start_index, end_index, BuildFastLoop(VariableList(0, zone()), index_rep, start_index, end_index,
body, increment, mode); body, increment, mode);
...@@ -1011,24 +896,21 @@ class V8_EXPORT_PRIVATE CodeStubAssembler : public compiler::CodeAssembler { ...@@ -1011,24 +896,21 @@ class V8_EXPORT_PRIVATE CodeStubAssembler : public compiler::CodeAssembler {
enum class ForEachDirection { kForward, kReverse }; enum class ForEachDirection { kForward, kReverse };
void BuildFastFixedArrayForEach( void BuildFastFixedArrayForEach(
compiler::Node* fixed_array, ElementsKind kind, Node* fixed_array, ElementsKind kind, Node* first_element_inclusive,
compiler::Node* first_element_inclusive, Node* last_element_exclusive,
compiler::Node* last_element_exclusive, std::function<void(CodeStubAssembler* assembler, Node* fixed_array,
std::function<void(CodeStubAssembler* assembler, Node* offset)>
compiler::Node* fixed_array, compiler::Node* offset)>
body, body,
ParameterMode mode = INTPTR_PARAMETERS, ParameterMode mode = INTPTR_PARAMETERS,
ForEachDirection direction = ForEachDirection::kReverse); ForEachDirection direction = ForEachDirection::kReverse);
compiler::Node* GetArrayAllocationSize(compiler::Node* element_count, Node* GetArrayAllocationSize(Node* element_count, ElementsKind kind,
ElementsKind kind, ParameterMode mode, ParameterMode mode, int header_size) {
int header_size) {
return ElementOffsetFromIndex(element_count, kind, mode, header_size); return ElementOffsetFromIndex(element_count, kind, mode, header_size);
} }
compiler::Node* GetFixedArrayAllocationSize(compiler::Node* element_count, Node* GetFixedArrayAllocationSize(Node* element_count, ElementsKind kind,
ElementsKind kind, ParameterMode mode) {
ParameterMode mode) {
return GetArrayAllocationSize(element_count, kind, mode, return GetArrayAllocationSize(element_count, kind, mode,
FixedArray::kHeaderSize); FixedArray::kHeaderSize);
} }
...@@ -1040,160 +922,133 @@ class V8_EXPORT_PRIVATE CodeStubAssembler : public compiler::CodeAssembler { ...@@ -1040,160 +922,133 @@ class V8_EXPORT_PRIVATE CodeStubAssembler : public compiler::CodeAssembler {
kGreaterThanOrEqual kGreaterThanOrEqual
}; };
compiler::Node* RelationalComparison(RelationalComparisonMode mode, Node* RelationalComparison(RelationalComparisonMode mode, Node* lhs,
compiler::Node* lhs, compiler::Node* rhs, Node* rhs, Node* context);
compiler::Node* context);
void BranchIfNumericRelationalComparison(RelationalComparisonMode mode, void BranchIfNumericRelationalComparison(RelationalComparisonMode mode,
compiler::Node* lhs, Node* lhs, Node* rhs, Label* if_true,
compiler::Node* rhs, Label* if_true,
Label* if_false); Label* if_false);
void GotoUnlessNumberLessThan(compiler::Node* lhs, compiler::Node* rhs, void GotoUnlessNumberLessThan(Node* lhs, Node* rhs, Label* if_false);
Label* if_false);
enum ResultMode { kDontNegateResult, kNegateResult }; enum ResultMode { kDontNegateResult, kNegateResult };
compiler::Node* Equal(ResultMode mode, compiler::Node* lhs, Node* Equal(ResultMode mode, Node* lhs, Node* rhs, Node* context);
compiler::Node* rhs, compiler::Node* context);
compiler::Node* StrictEqual(ResultMode mode, compiler::Node* lhs, Node* StrictEqual(ResultMode mode, Node* lhs, Node* rhs, Node* context);
compiler::Node* rhs, compiler::Node* context);
// ECMA#sec-samevalue // ECMA#sec-samevalue
// Similar to StrictEqual except that NaNs are treated as equal and minus zero // Similar to StrictEqual except that NaNs are treated as equal and minus zero
// differs from positive zero. // differs from positive zero.
// Unlike Equal and StrictEqual, returns a value suitable for use in Branch // Unlike Equal and StrictEqual, returns a value suitable for use in Branch
// instructions, e.g. Branch(SameValue(...), &label). // instructions, e.g. Branch(SameValue(...), &label).
compiler::Node* SameValue(compiler::Node* lhs, compiler::Node* rhs, Node* SameValue(Node* lhs, Node* rhs, Node* context);
compiler::Node* context);
compiler::Node* HasProperty( Node* HasProperty(
compiler::Node* object, compiler::Node* key, compiler::Node* context, Node* object, Node* key, Node* context,
Runtime::FunctionId fallback_runtime_function_id = Runtime::kHasProperty); Runtime::FunctionId fallback_runtime_function_id = Runtime::kHasProperty);
compiler::Node* ForInFilter(compiler::Node* key, compiler::Node* object, Node* ForInFilter(Node* key, Node* object, Node* context);
compiler::Node* context);
compiler::Node* Typeof(compiler::Node* value, compiler::Node* context); Node* Typeof(Node* value, Node* context);
compiler::Node* InstanceOf(compiler::Node* object, compiler::Node* callable, Node* InstanceOf(Node* object, Node* callable, Node* context);
compiler::Node* context);
// Debug helpers // Debug helpers
compiler::Node* IsDebugActive(); Node* IsDebugActive();
// TypedArray/ArrayBuffer helpers // TypedArray/ArrayBuffer helpers
compiler::Node* IsDetachedBuffer(compiler::Node* buffer); Node* IsDetachedBuffer(Node* buffer);
compiler::Node* ElementOffsetFromIndex(compiler::Node* index, Node* ElementOffsetFromIndex(Node* index, ElementsKind kind,
ElementsKind kind, ParameterMode mode, ParameterMode mode, int base_size = 0);
int base_size = 0);
protected: protected:
void DescriptorLookupLinear(compiler::Node* unique_name, void DescriptorLookupLinear(Node* unique_name, Node* descriptors, Node* nof,
compiler::Node* descriptors, compiler::Node* nof,
Label* if_found, Variable* var_name_index, Label* if_found, Variable* var_name_index,
Label* if_not_found); Label* if_not_found);
compiler::Node* CallGetterIfAccessor(compiler::Node* value, Node* CallGetterIfAccessor(Node* value, Node* details, Node* context,
compiler::Node* details, Node* receiver, Label* if_bailout);
compiler::Node* context,
compiler::Node* receiver,
Label* if_bailout);
compiler::Node* TryToIntptr(compiler::Node* key, Label* miss); Node* TryToIntptr(Node* key, Label* miss);
void BranchIfPrototypesHaveNoElements(compiler::Node* receiver_map, void BranchIfPrototypesHaveNoElements(Node* receiver_map,
Label* definitely_no_elements, Label* definitely_no_elements,
Label* possibly_elements); Label* possibly_elements);
private: private:
friend class CodeStubArguments; friend class CodeStubArguments;
compiler::Node* AllocateRawAligned(compiler::Node* size_in_bytes, Node* AllocateRawAligned(Node* size_in_bytes, AllocationFlags flags,
AllocationFlags flags, Node* top_address, Node* limit_address);
compiler::Node* top_address, Node* AllocateRawUnaligned(Node* size_in_bytes, AllocationFlags flags,
compiler::Node* limit_address); Node* top_adddress, Node* limit_address);
compiler::Node* AllocateRawUnaligned(compiler::Node* size_in_bytes,
AllocationFlags flags,
compiler::Node* top_adddress,
compiler::Node* limit_address);
// Allocate and return a JSArray of given total size in bytes with header // Allocate and return a JSArray of given total size in bytes with header
// fields initialized. // fields initialized.
compiler::Node* AllocateUninitializedJSArray(ElementsKind kind, Node* AllocateUninitializedJSArray(ElementsKind kind, Node* array_map,
compiler::Node* array_map, Node* length, Node* allocation_site,
compiler::Node* length, Node* size_in_bytes);
compiler::Node* allocation_site,
compiler::Node* size_in_bytes);
compiler::Node* SmiShiftBitsConstant(); Node* SmiShiftBitsConstant();
// Emits keyed sloppy arguments load if the |value| is nullptr or store // Emits keyed sloppy arguments load if the |value| is nullptr or store
// otherwise. Returns either the loaded value or |value|. // otherwise. Returns either the loaded value or |value|.
compiler::Node* EmitKeyedSloppyArguments(compiler::Node* receiver, Node* EmitKeyedSloppyArguments(Node* receiver, Node* key, Node* value,
compiler::Node* key, Label* bailout);
compiler::Node* value,
Label* bailout); Node* AllocateSlicedString(Heap::RootListIndex map_root_index, Node* length,
Node* parent, Node* offset);
compiler::Node* AllocateSlicedString(Heap::RootListIndex map_root_index,
compiler::Node* length, Node* AllocateConsString(Heap::RootListIndex map_root_index, Node* length,
compiler::Node* parent, Node* first, Node* second, AllocationFlags flags);
compiler::Node* offset);
compiler::Node* AllocateConsString(Heap::RootListIndex map_root_index,
compiler::Node* length,
compiler::Node* first,
compiler::Node* second,
AllocationFlags flags);
static const int kElementLoopUnrollThreshold = 8; static const int kElementLoopUnrollThreshold = 8;
}; };
class CodeStubArguments { class CodeStubArguments {
public: public:
typedef compiler::Node Node;
// |argc| specifies the number of arguments passed to the builtin excluding // |argc| specifies the number of arguments passed to the builtin excluding
// the receiver. // the receiver.
CodeStubArguments(CodeStubAssembler* assembler, compiler::Node* argc, CodeStubArguments(CodeStubAssembler* assembler, Node* argc,
CodeStubAssembler::ParameterMode mode = CodeStubAssembler::ParameterMode mode =
CodeStubAssembler::INTPTR_PARAMETERS); CodeStubAssembler::INTPTR_PARAMETERS);
compiler::Node* GetReceiver(); Node* GetReceiver();
// |index| is zero-based and does not include the receiver // |index| is zero-based and does not include the receiver
compiler::Node* AtIndex(compiler::Node* index, Node* AtIndex(Node* index, CodeStubAssembler::ParameterMode mode =
CodeStubAssembler::ParameterMode mode = CodeStubAssembler::INTPTR_PARAMETERS);
CodeStubAssembler::INTPTR_PARAMETERS);
compiler::Node* AtIndex(int index); Node* AtIndex(int index);
typedef std::function<void(CodeStubAssembler* assembler, compiler::Node* arg)> typedef std::function<void(CodeStubAssembler* assembler, Node* arg)>
ForEachBodyFunction; ForEachBodyFunction;
// Iteration doesn't include the receiver. |first| and |last| are zero-based. // Iteration doesn't include the receiver. |first| and |last| are zero-based.
void ForEach(ForEachBodyFunction body, compiler::Node* first = nullptr, void ForEach(ForEachBodyFunction body, Node* first = nullptr,
compiler::Node* last = nullptr, Node* last = nullptr, CodeStubAssembler::ParameterMode mode =
CodeStubAssembler::ParameterMode mode = CodeStubAssembler::INTPTR_PARAMETERS) {
CodeStubAssembler::INTPTR_PARAMETERS) {
CodeStubAssembler::VariableList list(0, assembler_->zone()); CodeStubAssembler::VariableList list(0, assembler_->zone());
ForEach(list, body, first, last); ForEach(list, body, first, last);
} }
// Iteration doesn't include the receiver. |first| and |last| are zero-based. // Iteration doesn't include the receiver. |first| and |last| are zero-based.
void ForEach(const CodeStubAssembler::VariableList& vars, void ForEach(const CodeStubAssembler::VariableList& vars,
ForEachBodyFunction body, compiler::Node* first = nullptr, ForEachBodyFunction body, Node* first = nullptr,
compiler::Node* last = nullptr, Node* last = nullptr, CodeStubAssembler::ParameterMode mode =
CodeStubAssembler::ParameterMode mode = CodeStubAssembler::INTPTR_PARAMETERS);
CodeStubAssembler::INTPTR_PARAMETERS);
void PopAndReturn(compiler::Node* value); void PopAndReturn(Node* value);
private: private:
compiler::Node* GetArguments(); Node* GetArguments();
CodeStubAssembler* assembler_; CodeStubAssembler* assembler_;
compiler::Node* argc_; Node* argc_;
compiler::Node* arguments_; Node* arguments_;
compiler::Node* fp_; Node* fp_;
}; };
#ifdef DEBUG #ifdef DEBUG
......
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