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",
......
This diff is collapsed.
......@@ -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