Commit 8d2376a1 authored by Ross McIlroy's avatar Ross McIlroy Committed by Commit Bot

[CSA][cleanup] Tnodify builtins-internal-gen

Also Tnodifies TryPrototypeChainLookup.

Bug: v8:9810
Change-Id: I4950ad3bbcfcf3528589d343282517ee0b57e65f
Reviewed-on: https://chromium-review.googlesource.com/c/v8/v8/+/1906375Reviewed-by: 's avatarSantiago Aboy Solanes <solanes@chromium.org>
Commit-Queue: Ross McIlroy <rmcilroy@chromium.org>
Cr-Commit-Position: refs/heads/master@{#64881}
parent 6e90f2f2
......@@ -2067,6 +2067,7 @@ v8_source_set("v8_base_without_compiler") {
"src/codegen/string-constants.h",
"src/codegen/tick-counter.cc",
"src/codegen/tick-counter.h",
"src/codegen/tnode.cc",
"src/codegen/tnode.h",
"src/codegen/turbo-assembler.cc",
"src/codegen/turbo-assembler.h",
......
......@@ -41,9 +41,8 @@ TF_BUILTIN(CopyFastSmiOrObjectElements, CodeStubAssembler) {
}
TF_BUILTIN(GrowFastDoubleElements, CodeStubAssembler) {
Node* object = Parameter(Descriptor::kObject);
Node* key = Parameter(Descriptor::kKey);
Node* context = Parameter(Descriptor::kContext);
TNode<JSObject> object = CAST(Parameter(Descriptor::kObject));
TNode<Number> key = CAST(Parameter(Descriptor::kKey));
Label runtime(this, Label::kDeferred);
TNode<FixedArrayBase> elements = LoadElements(object);
......@@ -52,13 +51,13 @@ TF_BUILTIN(GrowFastDoubleElements, CodeStubAssembler) {
Return(elements);
BIND(&runtime);
TailCallRuntime(Runtime::kGrowArrayElements, context, object, key);
TailCallRuntime(Runtime::kGrowArrayElements, NoContextConstant(), object,
key);
}
TF_BUILTIN(GrowFastSmiOrObjectElements, CodeStubAssembler) {
Node* object = Parameter(Descriptor::kObject);
Node* key = Parameter(Descriptor::kKey);
Node* context = Parameter(Descriptor::kContext);
TNode<JSObject> object = CAST(Parameter(Descriptor::kObject));
TNode<Number> key = CAST(Parameter(Descriptor::kKey));
Label runtime(this, Label::kDeferred);
TNode<FixedArrayBase> elements = LoadElements(object);
......@@ -67,11 +66,12 @@ TF_BUILTIN(GrowFastSmiOrObjectElements, CodeStubAssembler) {
Return(elements);
BIND(&runtime);
TailCallRuntime(Runtime::kGrowArrayElements, context, object, key);
TailCallRuntime(Runtime::kGrowArrayElements, NoContextConstant(), object,
key);
}
TF_BUILTIN(NewArgumentsElements, CodeStubAssembler) {
Node* frame = Parameter(Descriptor::kFrame);
TNode<IntPtrT> frame = UncheckedCast<IntPtrT>(Parameter(Descriptor::kFrame));
TNode<IntPtrT> length = SmiToIntPtr(Parameter(Descriptor::kLength));
TNode<IntPtrT> mapped_count =
SmiToIntPtr(Parameter(Descriptor::kMappedCount));
......@@ -211,10 +211,10 @@ class RecordWriteCodeStubAssembler : public CodeStubAssembler {
explicit RecordWriteCodeStubAssembler(compiler::CodeAssemblerState* state)
: CodeStubAssembler(state) {}
Node* IsMarking() {
TNode<BoolT> IsMarking() {
TNode<ExternalReference> is_marking_addr = ExternalConstant(
ExternalReference::heap_is_marking_flag_address(this->isolate()));
return Load(MachineType::Uint8(), is_marking_addr);
return Word32NotEqual(Load<Uint8T>(is_marking_addr), Int32Constant(0));
}
TNode<BoolT> IsPageFlagSet(TNode<IntPtrT> object, int mask) {
......@@ -228,34 +228,34 @@ class RecordWriteCodeStubAssembler : public CodeStubAssembler {
TNode<BoolT> IsWhite(TNode<IntPtrT> object) {
DCHECK_EQ(strcmp(Marking::kWhiteBitPattern, "00"), 0);
Node* cell;
Node* mask;
TNode<IntPtrT> cell;
TNode<IntPtrT> mask;
GetMarkBit(object, &cell, &mask);
mask = TruncateIntPtrToInt32(mask);
TNode<Int32T> mask32 = TruncateIntPtrToInt32(mask);
// Non-white has 1 for the first bit, so we only need to check for the first
// bit.
return Word32Equal(Word32And(Load(MachineType::Int32(), cell), mask),
Int32Constant(0));
return Word32Equal(Word32And(Load<Int32T>(cell), mask32), Int32Constant(0));
}
void GetMarkBit(TNode<IntPtrT> object, Node** cell, Node** mask) {
void GetMarkBit(TNode<IntPtrT> object, TNode<IntPtrT>* cell,
TNode<IntPtrT>* mask) {
TNode<IntPtrT> page = PageFromAddress(object);
Node* bitmap = Load(MachineType::Pointer(), page,
IntPtrConstant(MemoryChunk::kMarkBitmapOffset));
TNode<IntPtrT> bitmap =
Load<IntPtrT>(page, IntPtrConstant(MemoryChunk::kMarkBitmapOffset));
{
// Temp variable to calculate cell offset in bitmap.
Node* r0;
TNode<WordT> r0;
int shift = Bitmap::kBitsPerCellLog2 + kTaggedSizeLog2 -
Bitmap::kBytesPerCellLog2;
r0 = WordShr(object, IntPtrConstant(shift));
r0 = WordAnd(r0, IntPtrConstant((kPageAlignmentMask >> shift) &
~(Bitmap::kBytesPerCell - 1)));
*cell = IntPtrAdd(bitmap, r0);
*cell = IntPtrAdd(bitmap, Signed(r0));
}
{
// Temp variable to calculate bit offset in cell.
Node* r1;
TNode<WordT> r1;
r1 = WordShr(object, IntPtrConstant(kTaggedSizeLog2));
r1 = WordAnd(r1, IntPtrConstant((1 << Bitmap::kBitsPerCellLog2) - 1));
// It seems that LSB(e.g. cl) is automatically used, so no manual masking
......@@ -265,73 +265,78 @@ class RecordWriteCodeStubAssembler : public CodeStubAssembler {
}
}
Node* ShouldSkipFPRegs(SloppyTNode<Object> mode) {
TNode<BoolT> ShouldSkipFPRegs(SloppyTNode<Smi> mode) {
return TaggedEqual(mode, SmiConstant(kDontSaveFPRegs));
}
Node* ShouldEmitRememberSet(SloppyTNode<Object> remembered_set) {
TNode<BoolT> ShouldEmitRememberSet(SloppyTNode<Smi> remembered_set) {
return TaggedEqual(remembered_set, SmiConstant(EMIT_REMEMBERED_SET));
}
template <typename Ret, typename Arg0, typename Arg1>
void CallCFunction2WithCallerSavedRegistersMode(
MachineType return_type, MachineType arg0_type, MachineType arg1_type,
Node* function, Node* arg0, Node* arg1, Node* mode, Label* next) {
TNode<ExternalReference> function, TNode<Arg0> arg0, TNode<Arg1> arg1,
TNode<Smi> mode, Label* next) {
Label dont_save_fp(this), save_fp(this);
Branch(ShouldSkipFPRegs(mode), &dont_save_fp, &save_fp);
BIND(&dont_save_fp);
{
CallCFunctionWithCallerSavedRegisters(
function, return_type, kDontSaveFPRegs,
std::make_pair(arg0_type, arg0), std::make_pair(arg1_type, arg1));
function, MachineTypeOf<Ret>::value, kDontSaveFPRegs,
std::make_pair(MachineTypeOf<Arg0>::value, arg0),
std::make_pair(MachineTypeOf<Arg1>::value, arg1));
Goto(next);
}
BIND(&save_fp);
{
CallCFunctionWithCallerSavedRegisters(function, return_type, kSaveFPRegs,
std::make_pair(arg0_type, arg0),
std::make_pair(arg1_type, arg1));
CallCFunctionWithCallerSavedRegisters(
function, MachineTypeOf<Ret>::value, kSaveFPRegs,
std::make_pair(MachineTypeOf<Arg0>::value, arg0),
std::make_pair(MachineTypeOf<Arg1>::value, arg1));
Goto(next);
}
}
template <typename Ret, typename Arg0, typename Arg1, typename Arg2>
void CallCFunction3WithCallerSavedRegistersMode(
MachineType return_type, MachineType arg0_type, MachineType arg1_type,
MachineType arg2_type, Node* function, Node* arg0, Node* arg1, Node* arg2,
Node* mode, Label* next) {
TNode<ExternalReference> function, TNode<Arg0> arg0, TNode<Arg1> arg1,
TNode<Arg2> arg2, TNode<Smi> mode, Label* next) {
Label dont_save_fp(this), save_fp(this);
Branch(ShouldSkipFPRegs(mode), &dont_save_fp, &save_fp);
BIND(&dont_save_fp);
{
CallCFunctionWithCallerSavedRegisters(
function, return_type, kDontSaveFPRegs,
std::make_pair(arg0_type, arg0), std::make_pair(arg1_type, arg1),
std::make_pair(arg2_type, arg2));
function, MachineTypeOf<Ret>::value, kDontSaveFPRegs,
std::make_pair(MachineTypeOf<Arg0>::value, arg0),
std::make_pair(MachineTypeOf<Arg1>::value, arg1),
std::make_pair(MachineTypeOf<Arg2>::value, arg2));
Goto(next);
}
BIND(&save_fp);
{
CallCFunctionWithCallerSavedRegisters(
function, return_type, kSaveFPRegs, std::make_pair(arg0_type, arg0),
std::make_pair(arg1_type, arg1), std::make_pair(arg2_type, arg2));
function, MachineTypeOf<Ret>::value, kSaveFPRegs,
std::make_pair(MachineTypeOf<Arg0>::value, arg0),
std::make_pair(MachineTypeOf<Arg1>::value, arg1),
std::make_pair(MachineTypeOf<Arg2>::value, arg2));
Goto(next);
}
}
void InsertIntoRememberedSetAndGotoSlow(TNode<IntPtrT> object,
TNode<IntPtrT> slot, Node* mode,
TNode<IntPtrT> slot, TNode<Smi> mode,
Label* next) {
TNode<IntPtrT> page = PageFromAddress(object);
TNode<ExternalReference> function =
ExternalConstant(ExternalReference::insert_remembered_set_function());
CallCFunction2WithCallerSavedRegistersMode(
MachineType::Int32(), MachineType::Pointer(), MachineType::Pointer(),
CallCFunction2WithCallerSavedRegistersMode<Int32T, IntPtrT, IntPtrT>(
function, page, slot, mode, next);
}
void InsertIntoRememberedSetAndGoto(TNode<IntPtrT> object,
TNode<IntPtrT> slot, Node* mode,
TNode<IntPtrT> slot, TNode<Smi> mode,
Label* next) {
Label slow_path(this);
TNode<IntPtrT> page = PageFromAddress(object);
......@@ -401,7 +406,8 @@ TF_BUILTIN(RecordWrite, RecordWriteCodeStubAssembler) {
Label incremental_wb(this);
Label exit(this);
Node* remembered_set = Parameter(Descriptor::kRememberedSet);
TNode<Smi> remembered_set =
UncheckedCast<Smi>(Parameter(Descriptor::kRememberedSet));
Branch(ShouldEmitRememberSet(remembered_set), &generational_wb,
&incremental_wb);
......@@ -440,7 +446,7 @@ TF_BUILTIN(RecordWrite, RecordWriteCodeStubAssembler) {
BIND(&store_buffer_exit);
{
Node* fp_mode = Parameter(Descriptor::kFPMode);
TNode<Smi> fp_mode = UncheckedCast<Smi>(Parameter(Descriptor::kFPMode));
TNode<IntPtrT> object =
BitcastTaggedToWord(Parameter(Descriptor::kObject));
InsertIntoRememberedSetAndGoto(object, slot, fp_mode, &exit);
......@@ -448,7 +454,7 @@ TF_BUILTIN(RecordWrite, RecordWriteCodeStubAssembler) {
BIND(&store_buffer_incremental_wb);
{
Node* fp_mode = Parameter(Descriptor::kFPMode);
TNode<Smi> fp_mode = UncheckedCast<Smi>(Parameter(Descriptor::kFPMode));
TNode<IntPtrT> object =
BitcastTaggedToWord(Parameter(Descriptor::kObject));
InsertIntoRememberedSetAndGoto(object, slot, fp_mode, &incremental_wb);
......@@ -483,13 +489,12 @@ TF_BUILTIN(RecordWrite, RecordWriteCodeStubAssembler) {
ExternalReference::incremental_marking_record_write_function());
TNode<ExternalReference> isolate_constant =
ExternalConstant(ExternalReference::isolate_address(isolate()));
Node* fp_mode = Parameter(Descriptor::kFPMode);
TNode<Smi> fp_mode = UncheckedCast<Smi>(Parameter(Descriptor::kFPMode));
TNode<IntPtrT> object =
BitcastTaggedToWord(Parameter(Descriptor::kObject));
CallCFunction3WithCallerSavedRegistersMode(
MachineType::Int32(), MachineType::Pointer(), MachineType::Pointer(),
MachineType::Pointer(), function, object, slot, isolate_constant,
fp_mode, &exit);
CallCFunction3WithCallerSavedRegistersMode<Int32T, IntPtrT, IntPtrT,
ExternalReference>(
function, object, slot, isolate_constant, fp_mode, &exit);
}
}
......@@ -505,13 +510,13 @@ TF_BUILTIN(EphemeronKeyBarrier, RecordWriteCodeStubAssembler) {
ExternalReference::ephemeron_key_write_barrier_function());
TNode<ExternalReference> isolate_constant =
ExternalConstant(ExternalReference::isolate_address(isolate()));
Node* address = Parameter(Descriptor::kSlotAddress);
TNode<IntPtrT> address =
UncheckedCast<IntPtrT>(Parameter(Descriptor::kSlotAddress));
TNode<IntPtrT> object = BitcastTaggedToWord(Parameter(Descriptor::kObject));
Node* fp_mode = Parameter(Descriptor::kFPMode);
CallCFunction3WithCallerSavedRegistersMode(
MachineType::Int32(), MachineType::Pointer(), MachineType::Pointer(),
MachineType::Pointer(), function, object, address, isolate_constant,
fp_mode, &exit);
TNode<Smi> fp_mode = UncheckedCast<Smi>(Parameter(Descriptor::kFPMode));
CallCFunction3WithCallerSavedRegistersMode<Int32T, IntPtrT, IntPtrT,
ExternalReference>(
function, object, address, isolate_constant, fp_mode, &exit);
BIND(&exit);
IncrementCounter(isolate()->counters()->write_barriers(), 1);
......@@ -776,11 +781,9 @@ TF_BUILTIN(ForInEnumerate, CodeStubAssembler) {
}
TF_BUILTIN(ForInFilter, CodeStubAssembler) {
Node* key = Parameter(Descriptor::kKey);
Node* object = Parameter(Descriptor::kObject);
Node* context = Parameter(Descriptor::kContext);
CSA_ASSERT(this, IsString(key));
TNode<String> key = CAST(Parameter(Descriptor::kKey));
TNode<HeapObject> object = CAST(Parameter(Descriptor::kObject));
TNode<Context> context = CAST(Parameter(Descriptor::kContext));
Label if_true(this), if_false(this);
TNode<Oddball> result = HasProperty(context, object, key, kForInHasProperty);
......@@ -794,8 +797,8 @@ TF_BUILTIN(ForInFilter, CodeStubAssembler) {
}
TF_BUILTIN(SameValue, CodeStubAssembler) {
Node* lhs = Parameter(Descriptor::kLeft);
Node* rhs = Parameter(Descriptor::kRight);
TNode<Object> lhs = CAST(Parameter(Descriptor::kLeft));
TNode<Object> rhs = CAST(Parameter(Descriptor::kRight));
Label if_true(this), if_false(this);
BranchIfSameValue(lhs, rhs, &if_true, &if_false);
......@@ -808,8 +811,8 @@ TF_BUILTIN(SameValue, CodeStubAssembler) {
}
TF_BUILTIN(SameValueNumbersOnly, CodeStubAssembler) {
Node* lhs = Parameter(Descriptor::kLeft);
Node* rhs = Parameter(Descriptor::kRight);
TNode<Object> lhs = CAST(Parameter(Descriptor::kLeft));
TNode<Object> rhs = CAST(Parameter(Descriptor::kRight));
Label if_true(this), if_false(this);
BranchIfSameValue(lhs, rhs, &if_true, &if_false, SameValueMode::kNumbersOnly);
......@@ -984,19 +987,19 @@ void Builtins::Generate_MemMove(MacroAssembler* masm) {
// ES6 [[Get]] operation.
TF_BUILTIN(GetProperty, CodeStubAssembler) {
Node* object = Parameter(Descriptor::kObject);
Node* key = Parameter(Descriptor::kKey);
Node* context = Parameter(Descriptor::kContext);
TNode<Object> object = CAST(Parameter(Descriptor::kObject));
TNode<Object> key = CAST(Parameter(Descriptor::kKey));
TNode<Context> context = CAST(Parameter(Descriptor::kContext));
// TODO(duongn): consider tailcalling to GetPropertyWithReceiver(object,
// object, key, OnNonExistent::kReturnUndefined).
Label if_notfound(this), if_proxy(this, Label::kDeferred),
if_slow(this, Label::kDeferred);
CodeStubAssembler::LookupInHolder lookup_property_in_holder =
[=](Node* receiver, Node* holder, Node* holder_map,
Node* holder_instance_type, Node* unique_name, Label* next_holder,
Label* if_bailout) {
VARIABLE(var_value, MachineRepresentation::kTagged);
CodeStubAssembler::LookupPropertyInHolder lookup_property_in_holder =
[=](TNode<HeapObject> receiver, TNode<HeapObject> holder,
TNode<Map> holder_map, TNode<Int32T> holder_instance_type,
TNode<Name> unique_name, Label* next_holder, Label* if_bailout) {
TVARIABLE(Object, var_value);
Label if_found(this);
TryGetOwnProperty(context, receiver, holder, holder_map,
holder_instance_type, unique_name, &if_found,
......@@ -1005,10 +1008,10 @@ TF_BUILTIN(GetProperty, CodeStubAssembler) {
Return(var_value.value());
};
CodeStubAssembler::LookupInHolder lookup_element_in_holder =
[=](Node* receiver, Node* holder, Node* holder_map,
Node* holder_instance_type, Node* index, Label* next_holder,
Label* if_bailout) {
CodeStubAssembler::LookupElementInHolder lookup_element_in_holder =
[=](TNode<HeapObject> receiver, TNode<HeapObject> holder,
TNode<Map> holder_map, TNode<Int32T> holder_instance_type,
TNode<IntPtrT> index, Label* next_holder, Label* if_bailout) {
// Not supported yet.
Use(next_holder);
Goto(if_bailout);
......@@ -1039,19 +1042,19 @@ TF_BUILTIN(GetProperty, CodeStubAssembler) {
// ES6 [[Get]] operation with Receiver.
TF_BUILTIN(GetPropertyWithReceiver, CodeStubAssembler) {
Node* object = Parameter(Descriptor::kObject);
Node* key = Parameter(Descriptor::kKey);
Node* context = Parameter(Descriptor::kContext);
Node* receiver = Parameter(Descriptor::kReceiver);
TNode<Object> object = CAST(Parameter(Descriptor::kObject));
TNode<Object> key = CAST(Parameter(Descriptor::kKey));
TNode<Context> context = CAST(Parameter(Descriptor::kContext));
TNode<Object> receiver = CAST(Parameter(Descriptor::kReceiver));
TNode<Object> on_non_existent = CAST(Parameter(Descriptor::kOnNonExistent));
Label if_notfound(this), if_proxy(this, Label::kDeferred),
if_slow(this, Label::kDeferred);
CodeStubAssembler::LookupInHolder lookup_property_in_holder =
[=](Node* receiver, Node* holder, Node* holder_map,
Node* holder_instance_type, Node* unique_name, Label* next_holder,
Label* if_bailout) {
VARIABLE(var_value, MachineRepresentation::kTagged);
CodeStubAssembler::LookupPropertyInHolder lookup_property_in_holder =
[=](TNode<HeapObject> receiver, TNode<HeapObject> holder,
TNode<Map> holder_map, TNode<Int32T> holder_instance_type,
TNode<Name> unique_name, Label* next_holder, Label* if_bailout) {
TVARIABLE(Object, var_value);
Label if_found(this);
TryGetOwnProperty(context, receiver, holder, holder_map,
holder_instance_type, unique_name, &if_found,
......@@ -1060,10 +1063,10 @@ TF_BUILTIN(GetPropertyWithReceiver, CodeStubAssembler) {
Return(var_value.value());
};
CodeStubAssembler::LookupInHolder lookup_element_in_holder =
[=](Node* receiver, Node* holder, Node* holder_map,
Node* holder_instance_type, Node* index, Label* next_holder,
Label* if_bailout) {
CodeStubAssembler::LookupElementInHolder lookup_element_in_holder =
[=](TNode<HeapObject> receiver, TNode<HeapObject> holder,
TNode<Map> holder_map, TNode<Int32T> holder_instance_type,
TNode<IntPtrT> index, Label* next_holder, Label* if_bailout) {
// Not supported yet.
Use(next_holder);
Goto(if_bailout);
......
......@@ -262,10 +262,10 @@ TNode<JSArray> ObjectEntriesValuesBuiltinsAssembler::FastGetOwnValuesOrEntries(
TVARIABLE(IntPtrT, var_result_index, IntPtrConstant(0));
TVARIABLE(IntPtrT, var_descriptor_number, IntPtrConstant(0));
VariableList vars({&var_descriptor_number, &var_result_index}, zone());
// Let desc be ? O.[[GetOwnProperty]](key).
TNode<DescriptorArray> descriptors = LoadMapDescriptors(map);
Label loop(this, vars), after_loop(this), next_descriptor(this);
Label loop(this, {&var_descriptor_number, &var_result_index}),
after_loop(this), next_descriptor(this);
Branch(IntPtrEqual(var_descriptor_number.value(), object_enum_length),
&after_loop, &loop);
......
......@@ -9298,13 +9298,13 @@ void CodeStubAssembler::BranchIfMaybeSpecialIndex(TNode<String> name_string,
}
void CodeStubAssembler::TryPrototypeChainLookup(
Node* receiver, Node* object, Node* key,
const LookupInHolder& lookup_property_in_holder,
const LookupInHolder& lookup_element_in_holder, Label* if_end,
TNode<Object> receiver, TNode<Object> object_arg, TNode<Object> key,
const LookupPropertyInHolder& lookup_property_in_holder,
const LookupElementInHolder& lookup_element_in_holder, Label* if_end,
Label* if_bailout, Label* if_proxy) {
// Ensure receiver is JSReceiver, otherwise bailout.
GotoIf(TaggedIsSmi(receiver), if_bailout);
CSA_ASSERT(this, TaggedIsNotSmi(object));
TNode<HeapObject> object = CAST(object_arg);
TNode<Map> map = LoadMap(object);
TNode<Uint16T> instance_type = LoadMapInstanceType(map);
......@@ -9328,7 +9328,7 @@ void CodeStubAssembler::TryPrototypeChainLookup(
BIND(&if_iskeyunique);
{
TVARIABLE(HeapObject, var_holder, CAST(object));
TVARIABLE(HeapObject, var_holder, object);
TVARIABLE(Map, var_holder_map, map);
TVARIABLE(Int32T, var_holder_instance_type, instance_type);
......@@ -9340,7 +9340,7 @@ void CodeStubAssembler::TryPrototypeChainLookup(
TNode<Int32T> holder_instance_type = var_holder_instance_type.value();
Label next_proto(this), check_integer_indexed_exotic(this);
lookup_property_in_holder(receiver, var_holder.value(), holder_map,
lookup_property_in_holder(CAST(receiver), var_holder.value(), holder_map,
holder_instance_type, var_unique.value(),
&check_integer_indexed_exotic, if_bailout);
......@@ -9371,7 +9371,7 @@ void CodeStubAssembler::TryPrototypeChainLookup(
}
BIND(&if_keyisindex);
{
TVARIABLE(HeapObject, var_holder, CAST(object));
TVARIABLE(HeapObject, var_holder, object);
TVARIABLE(Map, var_holder_map, map);
TVARIABLE(Int32T, var_holder_instance_type, instance_type);
......@@ -9380,7 +9380,7 @@ void CodeStubAssembler::TryPrototypeChainLookup(
BIND(&loop);
{
Label next_proto(this);
lookup_element_in_holder(receiver, var_holder.value(),
lookup_element_in_holder(CAST(receiver), var_holder.value(),
var_holder_map.value(),
var_holder_instance_type.value(),
var_index.value(), &next_proto, if_bailout);
......@@ -12135,19 +12135,20 @@ TNode<Oddball> CodeStubAssembler::HasProperty(SloppyTNode<Context> context,
Label call_runtime(this, Label::kDeferred), return_true(this),
return_false(this), end(this), if_proxy(this, Label::kDeferred);
CodeStubAssembler::LookupInHolder lookup_property_in_holder =
[this, &return_true](Node* receiver, Node* holder, Node* holder_map,
Node* holder_instance_type, Node* unique_name,
Label* next_holder, Label* if_bailout) {
CodeStubAssembler::LookupPropertyInHolder lookup_property_in_holder =
[this, &return_true](
TNode<HeapObject> receiver, TNode<HeapObject> holder,
TNode<Map> holder_map, TNode<Int32T> holder_instance_type,
TNode<Name> unique_name, Label* next_holder, Label* if_bailout) {
TryHasOwnProperty(holder, holder_map, holder_instance_type, unique_name,
&return_true, next_holder, if_bailout);
};
CodeStubAssembler::LookupInHolder lookup_element_in_holder =
CodeStubAssembler::LookupElementInHolder lookup_element_in_holder =
[this, &return_true, &return_false](
Node* receiver, Node* holder, Node* holder_map,
Node* holder_instance_type, Node* index, Label* next_holder,
Label* if_bailout) {
TNode<HeapObject> receiver, TNode<HeapObject> holder,
TNode<Map> holder_map, TNode<Int32T> holder_instance_type,
TNode<IntPtrT> index, Label* next_holder, Label* if_bailout) {
TryLookupElement(holder, holder_map, holder_instance_type, index,
&return_true, &return_false, next_holder, if_bailout);
};
......
......@@ -3112,13 +3112,6 @@ class V8_EXPORT_PRIVATE CodeStubAssembler
Label* if_absent, Label* if_not_found,
Label* if_bailout);
// This is a type of a lookup in holder generator function. In case of a
// property lookup the {key} is guaranteed to be an unique name and in case of
// element lookup the key is an Int32 index.
using LookupInHolder = std::function<void(
Node* receiver, Node* holder, Node* map, Node* instance_type, Node* key,
Label* next_holder, Label* if_bailout)>;
// For integer indexed exotic cases, check if the given string cannot be a
// special index. If we are not sure that the given string is not a special
// index with a simple check, return False. Note that "False" return value
......@@ -3128,6 +3121,20 @@ class V8_EXPORT_PRIVATE CodeStubAssembler
Label* if_maybe_special_index,
Label* if_not_special_index);
// This is a type of a lookup property in holder generator function. The {key}
// is guaranteed to be an unique name.
using LookupPropertyInHolder = std::function<void(
TNode<HeapObject> receiver, TNode<HeapObject> holder, TNode<Map> map,
TNode<Int32T> instance_type, TNode<Name> key, Label* next_holder,
Label* if_bailout)>;
// This is a type of a lookup element in holder generator function. The {key}
// is an Int32 index.
using LookupElementInHolder = std::function<void(
TNode<HeapObject> receiver, TNode<HeapObject> holder, TNode<Map> map,
TNode<Int32T> instance_type, TNode<IntPtrT> key, Label* next_holder,
Label* if_bailout)>;
// Generic property prototype chain lookup generator.
// For properties it generates lookup using given {lookup_property_in_holder}
// and for elements it uses {lookup_element_in_holder}.
......@@ -3135,11 +3142,11 @@ class V8_EXPORT_PRIVATE CodeStubAssembler
// If it can't handle the case {receiver}/{key} case then the control goes
// to {if_bailout}.
// If {if_proxy} is nullptr, proxies go to if_bailout.
void TryPrototypeChainLookup(Node* receiver, Node* object, Node* key,
const LookupInHolder& lookup_property_in_holder,
const LookupInHolder& lookup_element_in_holder,
Label* if_end, Label* if_bailout,
Label* if_proxy);
void TryPrototypeChainLookup(
TNode<Object> receiver, TNode<Object> object, TNode<Object> key,
const LookupPropertyInHolder& lookup_property_in_holder,
const LookupElementInHolder& lookup_element_in_holder, Label* if_end,
Label* if_bailout, Label* if_proxy);
// Instanceof helpers.
// Returns true if {object} has {prototype} somewhere in it's prototype
......
// Copyright 2019 the V8 project authors. All rights reserved.
// Use of this source code is governed by a BSD-style license that can be
// found in the LICENSE file.
#include "src/codegen/tnode.h"
namespace v8 {
namespace internal {
constexpr MachineType MachineTypeOf<ExternalReference>::value;
} // namespace internal
} // namespace v8
......@@ -137,6 +137,10 @@ struct MachineTypeOf<HeapObjectSubtype,
HeapObject, HeapObjectSubtype>::value>::type> {
static constexpr MachineType value = MachineType::TaggedPointer();
};
template <>
struct MachineTypeOf<ExternalReference> {
static constexpr MachineType value = MachineType::Pointer();
};
template <class HeapObjectSubtype>
constexpr MachineType MachineTypeOf<
......
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