Commit e7d8e978 authored by Jakob Gruber's avatar Jakob Gruber Committed by V8 LUCI CQ

[compiler] Change all JS operators to hold TinyRefs instead of handles

Bug: v8:7790
Change-Id: Ia5903364a774bd49db1a646b3066b9972deac725
Reviewed-on: https://chromium-review.googlesource.com/c/v8/v8/+/3074465
Commit-Queue: Jakob Gruber <jgruber@chromium.org>
Auto-Submit: Jakob Gruber <jgruber@chromium.org>
Reviewed-by: 's avatarGeorg Neis <neis@chromium.org>
Cr-Commit-Position: refs/heads/master@{#76119}
parent b460a69d
......@@ -1676,8 +1676,7 @@ Node* BytecodeGraphBuilder::BuildLoadGlobal(NameRef name,
TypeofMode typeof_mode) {
FeedbackSource feedback = CreateFeedbackSource(feedback_slot_index);
DCHECK(IsLoadGlobalICKind(broker()->GetFeedbackSlotKind(feedback)));
const Operator* op =
javascript()->LoadGlobal(name.object(), feedback, typeof_mode);
const Operator* op = javascript()->LoadGlobal(name, feedback, typeof_mode);
DCHECK(IrOpcode::IsFeedbackCollectingOpcode(op->opcode()));
return NewNode(op, feedback_vector_node());
}
......@@ -1708,8 +1707,7 @@ void BytecodeGraphBuilder::VisitStaGlobal() {
LanguageMode language_mode =
GetLanguageModeFromSlotKind(broker()->GetFeedbackSlotKind(feedback));
const Operator* op =
javascript()->StoreGlobal(language_mode, name.object(), feedback);
const Operator* op = javascript()->StoreGlobal(language_mode, name, feedback);
DCHECK(IrOpcode::IsFeedbackCollectingOpcode(op->opcode()));
Node* node = NewNode(op, value, feedback_vector_node());
environment()->RecordAfterState(node, Environment::kAttachFrameState);
......@@ -1892,13 +1890,12 @@ base::Optional<ScopeInfoRef> BytecodeGraphBuilder::TryGetScopeInfo() {
Node* context = environment()->Context();
switch (context->opcode()) {
case IrOpcode::kJSCreateFunctionContext:
return MakeRef(
broker(),
CreateFunctionContextParametersOf(context->op()).scope_info());
return CreateFunctionContextParametersOf(context->op())
.scope_info(broker());
case IrOpcode::kJSCreateBlockContext:
case IrOpcode::kJSCreateCatchContext:
case IrOpcode::kJSCreateWithContext:
return MakeRef(broker(), ScopeInfoOf(context->op()));
return ScopeInfoOf(broker(), context->op());
case IrOpcode::kParameter: {
ScopeInfoRef scope_info = shared_info_.scope_info();
if (scope_info.HasOuterScopeInfo()) {
......@@ -2101,7 +2098,7 @@ void BytecodeGraphBuilder::VisitLdaNamedProperty() {
NameRef name = MakeRefForConstantForIndexOperand<Name>(1);
FeedbackSource feedback =
CreateFeedbackSource(bytecode_iterator().GetIndexOperand(2));
const Operator* op = javascript()->LoadNamed(name.object(), feedback);
const Operator* op = javascript()->LoadNamed(name, feedback);
JSTypeHintLowering::LoweringResult lowering =
TryBuildSimplifiedLoadNamed(op, feedback.slot);
......@@ -2127,8 +2124,7 @@ void BytecodeGraphBuilder::VisitLdaNamedPropertyFromSuper() {
FeedbackSource feedback =
CreateFeedbackSource(bytecode_iterator().GetIndexOperand(2));
const Operator* op =
javascript()->LoadNamedFromSuper(name.object(), feedback);
const Operator* op = javascript()->LoadNamedFromSuper(name, feedback);
JSTypeHintLowering::LoweringResult lowering =
TryBuildSimplifiedLoadNamed(op, feedback.slot);
......@@ -2186,12 +2182,12 @@ void BytecodeGraphBuilder::BuildNamedStore(StoreMode store_mode) {
DCHECK_EQ(FeedbackSlotKind::kStoreOwnNamed,
broker()->GetFeedbackSlotKind(feedback));
op = javascript()->StoreNamedOwn(name.object(), feedback);
op = javascript()->StoreNamedOwn(name, feedback);
} else {
DCHECK_EQ(StoreMode::kNormal, store_mode);
LanguageMode language_mode =
GetLanguageModeFromSlotKind(broker()->GetFeedbackSlotKind(feedback));
op = javascript()->StoreNamed(language_mode, name.object(), feedback);
op = javascript()->StoreNamed(language_mode, name, feedback);
}
JSTypeHintLowering::LoweringResult lowering =
......@@ -2289,10 +2285,10 @@ void BytecodeGraphBuilder::VisitCreateClosure() {
bytecode_iterator().GetFlagOperand(2))
? AllocationType::kOld
: AllocationType::kYoung;
Handle<CodeT> compile_lazy = broker()->CanonicalPersistentHandle(
ToCodeT(*BUILTIN_CODE(jsgraph()->isolate(), CompileLazy)));
const Operator* op = javascript()->CreateClosure(shared_info.object(),
compile_lazy, allocation);
CodeTRef compile_lazy = MakeRef(
broker(), ToCodeT(*BUILTIN_CODE(jsgraph()->isolate(), CompileLazy)));
const Operator* op =
javascript()->CreateClosure(shared_info, compile_lazy, allocation);
Node* closure = NewNode(
op, BuildLoadFeedbackCell(bytecode_iterator().GetIndexOperand(1)));
environment()->BindAccumulator(closure);
......@@ -2300,7 +2296,7 @@ void BytecodeGraphBuilder::VisitCreateClosure() {
void BytecodeGraphBuilder::VisitCreateBlockContext() {
ScopeInfoRef scope_info = MakeRefForConstantForIndexOperand<ScopeInfo>(0);
const Operator* op = javascript()->CreateBlockContext(scope_info.object());
const Operator* op = javascript()->CreateBlockContext(scope_info);
Node* context = NewNode(op);
environment()->BindAccumulator(context);
}
......@@ -2308,8 +2304,8 @@ void BytecodeGraphBuilder::VisitCreateBlockContext() {
void BytecodeGraphBuilder::VisitCreateFunctionContext() {
ScopeInfoRef scope_info = MakeRefForConstantForIndexOperand<ScopeInfo>(0);
uint32_t slots = bytecode_iterator().GetUnsignedImmediateOperand(1);
const Operator* op = javascript()->CreateFunctionContext(
scope_info.object(), slots, FUNCTION_SCOPE);
const Operator* op =
javascript()->CreateFunctionContext(scope_info, slots, FUNCTION_SCOPE);
Node* context = NewNode(op);
environment()->BindAccumulator(context);
}
......@@ -2317,8 +2313,8 @@ void BytecodeGraphBuilder::VisitCreateFunctionContext() {
void BytecodeGraphBuilder::VisitCreateEvalContext() {
ScopeInfoRef scope_info = MakeRefForConstantForIndexOperand<ScopeInfo>(0);
uint32_t slots = bytecode_iterator().GetUnsignedImmediateOperand(1);
const Operator* op = javascript()->CreateFunctionContext(scope_info.object(),
slots, EVAL_SCOPE);
const Operator* op =
javascript()->CreateFunctionContext(scope_info, slots, EVAL_SCOPE);
Node* context = NewNode(op);
environment()->BindAccumulator(context);
}
......@@ -2328,7 +2324,7 @@ void BytecodeGraphBuilder::VisitCreateCatchContext() {
Node* exception = environment()->LookupRegister(reg);
ScopeInfoRef scope_info = MakeRefForConstantForIndexOperand<ScopeInfo>(1);
const Operator* op = javascript()->CreateCatchContext(scope_info.object());
const Operator* op = javascript()->CreateCatchContext(scope_info);
Node* context = NewNode(op, exception);
environment()->BindAccumulator(context);
}
......@@ -2338,7 +2334,7 @@ void BytecodeGraphBuilder::VisitCreateWithContext() {
environment()->LookupRegister(bytecode_iterator().GetRegisterOperand(0));
ScopeInfoRef scope_info = MakeRefForConstantForIndexOperand<ScopeInfo>(1);
const Operator* op = javascript()->CreateWithContext(scope_info.object());
const Operator* op = javascript()->CreateWithContext(scope_info);
Node* context = NewNode(op, object);
environment()->BindAccumulator(context);
}
......@@ -2367,8 +2363,8 @@ void BytecodeGraphBuilder::VisitCreateRegExpLiteral() {
FeedbackSource pair = CreateFeedbackSource(slot_id);
int literal_flags = bytecode_iterator().GetFlagOperand(2);
STATIC_ASSERT(JSCreateLiteralRegExpNode::FeedbackVectorIndex() == 0);
const Operator* op = javascript()->CreateLiteralRegExp(
constant_pattern.object(), pair, literal_flags);
const Operator* op =
javascript()->CreateLiteralRegExp(constant_pattern, pair, literal_flags);
DCHECK(IrOpcode::IsFeedbackCollectingOpcode(op->opcode()));
Node* literal = NewNode(op, feedback_vector_node());
environment()->BindAccumulator(literal, Environment::kAttachFrameState);
......@@ -2390,9 +2386,8 @@ void BytecodeGraphBuilder::VisitCreateArrayLiteral() {
int number_of_elements =
array_boilerplate_description.constants_elements_length();
STATIC_ASSERT(JSCreateLiteralArrayNode::FeedbackVectorIndex() == 0);
const Operator* op =
javascript()->CreateLiteralArray(array_boilerplate_description.object(),
pair, literal_flags, number_of_elements);
const Operator* op = javascript()->CreateLiteralArray(
array_boilerplate_description, pair, literal_flags, number_of_elements);
DCHECK(IrOpcode::IsFeedbackCollectingOpcode(op->opcode()));
Node* literal = NewNode(op, feedback_vector_node());
environment()->BindAccumulator(literal, Environment::kAttachFrameState);
......@@ -2424,7 +2419,7 @@ void BytecodeGraphBuilder::VisitCreateObjectLiteral() {
int number_of_properties = constant_properties.size();
STATIC_ASSERT(JSCreateLiteralObjectNode::FeedbackVectorIndex() == 0);
const Operator* op = javascript()->CreateLiteralObject(
constant_properties.object(), pair, literal_flags, number_of_properties);
constant_properties, pair, literal_flags, number_of_properties);
DCHECK(IrOpcode::IsFeedbackCollectingOpcode(op->opcode()));
Node* literal = NewNode(op, feedback_vector_node());
environment()->BindAccumulator(literal, Environment::kAttachFrameState);
......@@ -2456,8 +2451,8 @@ void BytecodeGraphBuilder::VisitGetTemplateObject() {
TemplateObjectDescriptionRef description =
MakeRefForConstantForIndexOperand<TemplateObjectDescription>(0);
STATIC_ASSERT(JSGetTemplateObjectNode::FeedbackVectorIndex() == 0);
const Operator* op = javascript()->GetTemplateObject(
description.object(), shared_info().object(), source);
const Operator* op =
javascript()->GetTemplateObject(description, shared_info(), source);
DCHECK(IrOpcode::IsFeedbackCollectingOpcode(op->opcode()));
Node* template_object = NewNode(op, feedback_vector_node());
environment()->BindAccumulator(template_object);
......
......@@ -212,6 +212,14 @@ class TinyRef {
HEAP_BROKER_OBJECT_LIST(V)
#undef V
#ifdef V8_EXTERNAL_CODE_SPACE
using CodeTRef = CodeDataContainerRef;
using CodeTTinyRef = CodeDataContainerTinyRef;
#else
using CodeTRef = CodeRef;
using CodeTTinyRef = CodeTinyRef;
#endif
class V8_EXPORT_PRIVATE ObjectRef {
public:
ObjectRef(JSHeapBroker* broker, ObjectData* data, bool check_type = true)
......
......@@ -834,7 +834,7 @@ class PromiseBuiltinReducerAssembler : public JSCallReducerAssembler {
int slot_count) {
return AddNode<Context>(graph()->NewNode(
javascript()->CreateFunctionContext(
native_context.scope_info().object(),
native_context.scope_info(),
slot_count - Context::MIN_CONTEXT_SLOTS, FUNCTION_SCOPE),
outer_context, effect(), control()));
}
......@@ -851,11 +851,10 @@ class PromiseBuiltinReducerAssembler : public JSCallReducerAssembler {
isolate()->factory()->many_closures_cell();
Callable const callable =
Builtins::CallableFor(isolate(), shared.builtin_id());
Handle<CodeT> code =
broker_->CanonicalPersistentHandle(ToCodeT(*callable.code()));
CodeTRef code = MakeRef(broker_, ToCodeT(*callable.code()));
return AddNode<JSFunction>(graph()->NewNode(
javascript()->CreateClosure(shared.object(), code),
HeapConstant(feedback_cell), context, effect(), control()));
javascript()->CreateClosure(shared, code), HeapConstant(feedback_cell),
context, effect(), control()));
}
void CallPromiseExecutor(TNode<Object> executor, TNode<JSFunction> resolve,
......@@ -2715,7 +2714,7 @@ Reduction JSCallReducer::ReduceFunctionPrototypeBind(Node* node) {
DCHECK_EQ(cursor, input_count);
Node* value = effect =
graph()->NewNode(javascript()->CreateBoundFunction(
arity_with_bound_this - kBoundThis, map.object()),
arity_with_bound_this - kBoundThis, map),
input_count, inputs);
ReplaceWithValue(node, value, effect, control);
return Replace(value);
......@@ -4395,7 +4394,7 @@ Reduction JSCallReducer::ReduceJSCall(Node* node) {
// Same if the {target} is the result of a CheckClosure operation.
if (target->opcode() == IrOpcode::kJSCreateClosure) {
CreateClosureParameters const& p = JSCreateClosureNode{target}.Parameters();
return ReduceJSCall(node, MakeRef(broker(), p.shared_info()));
return ReduceJSCall(node, p.shared_info(broker()));
} else if (target->opcode() == IrOpcode::kCheckClosure) {
FeedbackCellRef cell = MakeRef(broker(), FeedbackCellOf(target->op()));
if (cell.shared_function_info().has_value()) {
......@@ -6830,9 +6829,8 @@ Node* JSCallReducer::CreateClosureFromBuiltinSharedFunctionInfo(
isolate()->factory()->many_closures_cell();
Callable const callable =
Builtins::CallableFor(isolate(), shared.builtin_id());
Handle<CodeT> code =
broker()->CanonicalPersistentHandle(ToCodeT(*callable.code()));
return graph()->NewNode(javascript()->CreateClosure(shared.object(), code),
CodeTRef code = MakeRef(broker(), ToCodeT(*callable.code()));
return graph()->NewNode(javascript()->CreateClosure(shared, code),
jsgraph()->HeapConstant(feedback_cell), context,
effect, control);
}
......@@ -6884,7 +6882,7 @@ Reduction JSCallReducer::ReducePromisePrototypeFinally(Node* node) {
// Allocate shared context for the closures below.
context = etrue =
graph()->NewNode(javascript()->CreateFunctionContext(
native_context().scope_info().object(),
native_context().scope_info(),
PromiseBuiltins::kPromiseFinallyContextLength -
Context::MIN_CONTEXT_SLOTS,
FUNCTION_SCOPE),
......
......@@ -873,7 +873,7 @@ Reduction JSCreateLowering::ReduceJSCreateBoundFunction(Node* node) {
CreateBoundFunctionParameters const& p =
CreateBoundFunctionParametersOf(node->op());
int const arity = static_cast<int>(p.arity());
MapRef const map = MakeRef(broker(), p.map());
MapRef const map = p.map(broker());
Node* bound_target_function = NodeProperties::GetValueInput(node, 0);
Node* bound_this = NodeProperties::GetValueInput(node, 1);
Node* effect = NodeProperties::GetEffectInput(node);
......@@ -914,9 +914,9 @@ Reduction JSCreateLowering::ReduceJSCreateBoundFunction(Node* node) {
Reduction JSCreateLowering::ReduceJSCreateClosure(Node* node) {
JSCreateClosureNode n(node);
CreateClosureParameters const& p = n.Parameters();
SharedFunctionInfoRef shared = MakeRef(broker(), p.shared_info());
SharedFunctionInfoRef shared = p.shared_info(broker());
FeedbackCellRef feedback_cell = n.GetFeedbackCellRefChecked(broker());
HeapObjectRef code = MakeRef(broker(), p.code());
HeapObjectRef code = p.code(broker());
Effect effect = n.effect();
Control control = n.control();
Node* context = n.context();
......@@ -1198,7 +1198,7 @@ Reduction JSCreateLowering::ReduceJSCreateFunctionContext(Node* node) {
DCHECK_EQ(IrOpcode::kJSCreateFunctionContext, node->opcode());
const CreateFunctionContextParameters& parameters =
CreateFunctionContextParametersOf(node->op());
ScopeInfoRef scope_info = MakeRef(broker(), parameters.scope_info());
ScopeInfoRef scope_info = parameters.scope_info(broker());
int slot_count = parameters.slot_count();
ScopeType scope_type = parameters.scope_type();
......@@ -1238,7 +1238,7 @@ Reduction JSCreateLowering::ReduceJSCreateFunctionContext(Node* node) {
Reduction JSCreateLowering::ReduceJSCreateWithContext(Node* node) {
DCHECK_EQ(IrOpcode::kJSCreateWithContext, node->opcode());
ScopeInfoRef scope_info = MakeRef(broker(), ScopeInfoOf(node->op()));
ScopeInfoRef scope_info = ScopeInfoOf(broker(), node->op());
Node* extension = NodeProperties::GetValueInput(node, 0);
Node* effect = NodeProperties::GetEffectInput(node);
Node* control = NodeProperties::GetControlInput(node);
......@@ -1259,7 +1259,7 @@ Reduction JSCreateLowering::ReduceJSCreateWithContext(Node* node) {
Reduction JSCreateLowering::ReduceJSCreateCatchContext(Node* node) {
DCHECK_EQ(IrOpcode::kJSCreateCatchContext, node->opcode());
ScopeInfoRef scope_info = MakeRef(broker(), ScopeInfoOf(node->op()));
ScopeInfoRef scope_info = ScopeInfoOf(broker(), node->op());
Node* exception = NodeProperties::GetValueInput(node, 0);
Node* effect = NodeProperties::GetEffectInput(node);
Node* control = NodeProperties::GetControlInput(node);
......@@ -1280,7 +1280,7 @@ Reduction JSCreateLowering::ReduceJSCreateCatchContext(Node* node) {
Reduction JSCreateLowering::ReduceJSCreateBlockContext(Node* node) {
DCHECK_EQ(IrOpcode::kJSCreateBlockContext, node->opcode());
ScopeInfoRef scope_info = MakeRef(broker(), ScopeInfoOf(node->op()));
ScopeInfoRef scope_info = ScopeInfoOf(broker(), node->op());
int const context_length = scope_info.ContextLength();
// Use inline allocation for block contexts up to a size limit.
......
......@@ -314,25 +314,23 @@ void JSGenericLowering::LowerJSLoadNamed(Node* node) {
STATIC_ASSERT(n.FeedbackVectorIndex() == 1);
if (!p.feedback().IsValid()) {
n->RemoveInput(n.FeedbackVectorIndex());
node->InsertInput(zone(), 1, jsgraph()->HeapConstant(p.name()));
node->InsertInput(zone(), 1, jsgraph()->Constant(p.name(broker())));
ReplaceWithBuiltinCall(node, Builtin::kGetProperty);
} else if (outer_state->opcode() != IrOpcode::kFrameState) {
n->RemoveInput(n.FeedbackVectorIndex());
node->InsertInput(zone(), 1, jsgraph()->HeapConstant(p.name()));
node->InsertInput(zone(), 1, jsgraph()->Constant(p.name(broker())));
node->InsertInput(zone(), 2,
jsgraph()->TaggedIndexConstant(p.feedback().index()));
ReplaceWithBuiltinCall(
node, ShouldUseMegamorphicLoadBuiltin(
p.feedback(), MakeRef(broker(), p.name()), broker())
ReplaceWithBuiltinCall(node, ShouldUseMegamorphicLoadBuiltin(
p.feedback(), p.name(broker()), broker())
? Builtin::kLoadICTrampoline_Megamorphic
: Builtin::kLoadICTrampoline);
} else {
node->InsertInput(zone(), 1, jsgraph()->HeapConstant(p.name()));
node->InsertInput(zone(), 1, jsgraph()->Constant(p.name(broker())));
node->InsertInput(zone(), 2,
jsgraph()->TaggedIndexConstant(p.feedback().index()));
ReplaceWithBuiltinCall(
node, ShouldUseMegamorphicLoadBuiltin(
p.feedback(), MakeRef(broker(), p.name()), broker())
ReplaceWithBuiltinCall(node, ShouldUseMegamorphicLoadBuiltin(
p.feedback(), p.name(broker()), broker())
? Builtin::kLoadIC_Megamorphic
: Builtin::kLoadIC);
}
......@@ -359,7 +357,7 @@ void JSGenericLowering::LowerJSLoadNamedFromSuper(Node* node) {
// be double-checked that the FeedbackVector parameter will be the
// UndefinedConstant.
DCHECK(p.feedback().IsValid());
node->InsertInput(zone(), 2, jsgraph()->HeapConstant(p.name()));
node->InsertInput(zone(), 2, jsgraph()->Constant(p.name(broker())));
node->InsertInput(zone(), 3,
jsgraph()->TaggedIndexConstant(p.feedback().index()));
ReplaceWithBuiltinCall(node, Builtin::kLoadSuperIC);
......@@ -374,13 +372,13 @@ void JSGenericLowering::LowerJSLoadGlobal(Node* node) {
STATIC_ASSERT(n.FeedbackVectorIndex() == 0);
if (outer_state->opcode() != IrOpcode::kFrameState) {
n->RemoveInput(n.FeedbackVectorIndex());
node->InsertInput(zone(), 0, jsgraph()->HeapConstant(p.name()));
node->InsertInput(zone(), 0, jsgraph()->Constant(p.name(broker())));
node->InsertInput(zone(), 1,
jsgraph()->TaggedIndexConstant(p.feedback().index()));
Callable callable = CodeFactory::LoadGlobalIC(isolate(), p.typeof_mode());
ReplaceWithBuiltinCall(node, callable, flags);
} else {
node->InsertInput(zone(), 0, jsgraph()->HeapConstant(p.name()));
node->InsertInput(zone(), 0, jsgraph()->Constant(p.name(broker())));
node->InsertInput(zone(), 1,
jsgraph()->TaggedIndexConstant(p.feedback().index()));
Callable callable =
......@@ -439,16 +437,16 @@ void JSGenericLowering::LowerJSStoreNamed(Node* node) {
STATIC_ASSERT(n.FeedbackVectorIndex() == 2);
if (!p.feedback().IsValid()) {
n->RemoveInput(n.FeedbackVectorIndex());
node->InsertInput(zone(), 1, jsgraph()->HeapConstant(p.name()));
node->InsertInput(zone(), 1, jsgraph()->Constant(p.name(broker())));
ReplaceWithRuntimeCall(node, Runtime::kSetNamedProperty);
} else if (outer_state->opcode() != IrOpcode::kFrameState) {
n->RemoveInput(n.FeedbackVectorIndex());
node->InsertInput(zone(), 1, jsgraph()->HeapConstant(p.name()));
node->InsertInput(zone(), 1, jsgraph()->Constant(p.name(broker())));
node->InsertInput(zone(), 3,
jsgraph()->TaggedIndexConstant(p.feedback().index()));
ReplaceWithBuiltinCall(node, Builtin::kStoreICTrampoline);
} else {
node->InsertInput(zone(), 1, jsgraph()->HeapConstant(p.name()));
node->InsertInput(zone(), 1, jsgraph()->Constant(p.name(broker())));
node->InsertInput(zone(), 3,
jsgraph()->TaggedIndexConstant(p.feedback().index()));
ReplaceWithBuiltinCall(node, Builtin::kStoreIC);
......@@ -464,13 +462,13 @@ void JSGenericLowering::LowerJSStoreNamedOwn(Node* node) {
STATIC_ASSERT(n.FeedbackVectorIndex() == 2);
if (outer_state->opcode() != IrOpcode::kFrameState) {
n->RemoveInput(n.FeedbackVectorIndex());
node->InsertInput(zone(), 1, jsgraph()->HeapConstant(p.name()));
node->InsertInput(zone(), 1, jsgraph()->Constant(p.name(broker())));
node->InsertInput(zone(), 3,
jsgraph()->TaggedIndexConstant(p.feedback().index()));
Callable callable = CodeFactory::StoreOwnIC(isolate());
ReplaceWithBuiltinCall(node, callable, flags);
} else {
node->InsertInput(zone(), 1, jsgraph()->HeapConstant(p.name()));
node->InsertInput(zone(), 1, jsgraph()->Constant(p.name(broker())));
node->InsertInput(zone(), 3,
jsgraph()->TaggedIndexConstant(p.feedback().index()));
Callable callable = CodeFactory::StoreOwnICInOptimizedCode(isolate());
......@@ -486,12 +484,12 @@ void JSGenericLowering::LowerJSStoreGlobal(Node* node) {
STATIC_ASSERT(n.FeedbackVectorIndex() == 1);
if (outer_state->opcode() != IrOpcode::kFrameState) {
n->RemoveInput(n.FeedbackVectorIndex());
node->InsertInput(zone(), 0, jsgraph()->HeapConstant(p.name()));
node->InsertInput(zone(), 0, jsgraph()->Constant(p.name(broker())));
node->InsertInput(zone(), 2,
jsgraph()->TaggedIndexConstant(p.feedback().index()));
ReplaceWithBuiltinCall(node, Builtin::kStoreGlobalICTrampoline);
} else {
node->InsertInput(zone(), 0, jsgraph()->HeapConstant(p.name()));
node->InsertInput(zone(), 0, jsgraph()->Constant(p.name(broker())));
node->InsertInput(zone(), 2,
jsgraph()->TaggedIndexConstant(p.feedback().index()));
ReplaceWithBuiltinCall(node, Builtin::kStoreGlobalIC);
......@@ -643,9 +641,9 @@ void JSGenericLowering::LowerJSRegExpTest(Node* node) {
void JSGenericLowering::LowerJSCreateClosure(Node* node) {
JSCreateClosureNode n(node);
CreateClosureParameters const& p = n.Parameters();
Handle<SharedFunctionInfo> const shared_info = p.shared_info();
SharedFunctionInfoRef shared_info = p.shared_info(broker());
STATIC_ASSERT(n.FeedbackCellIndex() == 0);
node->InsertInput(zone(), 0, jsgraph()->HeapConstant(shared_info));
node->InsertInput(zone(), 0, jsgraph()->Constant(shared_info));
node->RemoveInput(4); // control
// Use the FastNewClosure builtin only for functions allocated in new space.
......@@ -659,7 +657,7 @@ void JSGenericLowering::LowerJSCreateClosure(Node* node) {
void JSGenericLowering::LowerJSCreateFunctionContext(Node* node) {
const CreateFunctionContextParameters& parameters =
CreateFunctionContextParametersOf(node->op());
Handle<ScopeInfo> scope_info = parameters.scope_info();
ScopeInfoRef scope_info = parameters.scope_info(broker());
int slot_count = parameters.slot_count();
ScopeType scope_type = parameters.scope_type();
CallDescriptor::Flags flags = FrameStateFlagForCall(node);
......@@ -667,11 +665,11 @@ void JSGenericLowering::LowerJSCreateFunctionContext(Node* node) {
if (slot_count <= ConstructorBuiltins::MaximumFunctionContextSlots()) {
Callable callable =
CodeFactory::FastNewFunctionContext(isolate(), scope_type);
node->InsertInput(zone(), 0, jsgraph()->HeapConstant(scope_info));
node->InsertInput(zone(), 0, jsgraph()->Constant(scope_info));
node->InsertInput(zone(), 1, jsgraph()->Int32Constant(slot_count));
ReplaceWithBuiltinCall(node, callable, flags);
} else {
node->InsertInput(zone(), 0, jsgraph()->HeapConstant(scope_info));
node->InsertInput(zone(), 0, jsgraph()->Constant(scope_info));
ReplaceWithRuntimeCall(node, Runtime::kNewFunctionContext);
}
}
......@@ -707,7 +705,7 @@ void JSGenericLowering::LowerJSCreateLiteralArray(Node* node) {
STATIC_ASSERT(n.FeedbackVectorIndex() == 0);
node->InsertInput(zone(), 1,
jsgraph()->TaggedIndexConstant(p.feedback().index()));
node->InsertInput(zone(), 2, jsgraph()->HeapConstant(p.constant()));
node->InsertInput(zone(), 2, jsgraph()->Constant(p.constant(broker())));
node->InsertInput(zone(), 3, jsgraph()->SmiConstant(p.flags()));
// Use the CreateShallowArrayLiteral builtin only for shallow boilerplates
......@@ -723,8 +721,8 @@ void JSGenericLowering::LowerJSCreateLiteralArray(Node* node) {
void JSGenericLowering::LowerJSGetTemplateObject(Node* node) {
JSGetTemplateObjectNode n(node);
GetTemplateObjectParameters const& p = n.Parameters();
SharedFunctionInfoRef shared = MakeRef(broker(), p.shared());
TemplateObjectDescriptionRef description = MakeRef(broker(), p.description());
SharedFunctionInfoRef shared = p.shared(broker());
TemplateObjectDescriptionRef description = p.description(broker());
DCHECK_EQ(node->op()->ControlInputCount(), 1);
node->RemoveInput(NodeProperties::FirstControlIndex(node));
......@@ -758,7 +756,7 @@ void JSGenericLowering::LowerJSCreateLiteralObject(Node* node) {
STATIC_ASSERT(n.FeedbackVectorIndex() == 0);
node->InsertInput(zone(), 1,
jsgraph()->TaggedIndexConstant(p.feedback().index()));
node->InsertInput(zone(), 2, jsgraph()->HeapConstant(p.constant()));
node->InsertInput(zone(), 2, jsgraph()->Constant(p.constant(broker())));
node->InsertInput(zone(), 3, jsgraph()->SmiConstant(p.flags()));
// Use the CreateShallowObjectLiteratal builtin only for shallow boilerplates
......@@ -792,27 +790,27 @@ void JSGenericLowering::LowerJSCreateLiteralRegExp(Node* node) {
STATIC_ASSERT(n.FeedbackVectorIndex() == 0);
node->InsertInput(zone(), 1,
jsgraph()->TaggedIndexConstant(p.feedback().index()));
node->InsertInput(zone(), 2, jsgraph()->HeapConstant(p.constant()));
node->InsertInput(zone(), 2, jsgraph()->Constant(p.constant(broker())));
node->InsertInput(zone(), 3, jsgraph()->SmiConstant(p.flags()));
ReplaceWithBuiltinCall(node, Builtin::kCreateRegExpLiteral);
}
void JSGenericLowering::LowerJSCreateCatchContext(Node* node) {
Handle<ScopeInfo> scope_info = ScopeInfoOf(node->op());
node->InsertInput(zone(), 1, jsgraph()->HeapConstant(scope_info));
ScopeInfoRef scope_info = ScopeInfoOf(broker(), node->op());
node->InsertInput(zone(), 1, jsgraph()->Constant(scope_info));
ReplaceWithRuntimeCall(node, Runtime::kPushCatchContext);
}
void JSGenericLowering::LowerJSCreateWithContext(Node* node) {
Handle<ScopeInfo> scope_info = ScopeInfoOf(node->op());
node->InsertInput(zone(), 1, jsgraph()->HeapConstant(scope_info));
ScopeInfoRef scope_info = ScopeInfoOf(broker(), node->op());
node->InsertInput(zone(), 1, jsgraph()->Constant(scope_info));
ReplaceWithRuntimeCall(node, Runtime::kPushWithContext);
}
void JSGenericLowering::LowerJSCreateBlockContext(Node* node) {
Handle<ScopeInfo> scope_info = ScopeInfoOf(node->op());
node->InsertInput(zone(), 0, jsgraph()->HeapConstant(scope_info));
ScopeInfoRef scope_info = ScopeInfoOf(broker(), node->op());
node->InsertInput(zone(), 0, jsgraph()->Constant(scope_info));
ReplaceWithRuntimeCall(node, Runtime::kPushBlockContext);
}
......
......@@ -46,23 +46,23 @@ Reduction JSHeapCopyReducer::Reduce(Node* node) {
break;
}
case IrOpcode::kJSCreateBlockContext: {
MakeRef(broker(), ScopeInfoOf(node->op()));
USE(ScopeInfoOf(broker(), node->op()));
break;
}
case IrOpcode::kJSCreateBoundFunction: {
CreateBoundFunctionParameters const& p =
CreateBoundFunctionParametersOf(node->op());
MakeRef(broker(), p.map());
p.map(broker());
break;
}
case IrOpcode::kJSCreateCatchContext: {
MakeRef(broker(), ScopeInfoOf(node->op()));
USE(ScopeInfoOf(broker(), node->op()));
break;
}
case IrOpcode::kJSCreateClosure: {
CreateClosureParameters const& p = CreateClosureParametersOf(node->op());
MakeRef(broker(), p.shared_info());
MakeRef(broker(), p.code());
p.shared_info(broker());
p.code(broker());
break;
}
case IrOpcode::kJSCreateEmptyLiteralArray: {
......@@ -119,7 +119,7 @@ Reduction JSHeapCopyReducer::Reduce(Node* node) {
case IrOpcode::kJSCreateFunctionContext: {
CreateFunctionContextParameters const& p =
CreateFunctionContextParametersOf(node->op());
MakeRef(broker(), p.scope_info());
p.scope_info(broker());
break;
}
case IrOpcode::kJSCreateLiteralArray:
......@@ -140,18 +140,18 @@ Reduction JSHeapCopyReducer::Reduce(Node* node) {
case IrOpcode::kJSGetTemplateObject: {
GetTemplateObjectParameters const& p =
GetTemplateObjectParametersOf(node->op());
MakeRef(broker(), p.shared());
MakeRef(broker(), p.description());
p.shared(broker());
p.description(broker());
broker()->GetFeedbackForTemplateObject(p.feedback());
break;
}
case IrOpcode::kJSCreateWithContext: {
MakeRef(broker(), ScopeInfoOf(node->op()));
USE(ScopeInfoOf(broker(), node->op()));
break;
}
case IrOpcode::kJSLoadNamed: {
NamedAccess const& p = NamedAccessOf(node->op());
NameRef name = MakeRef(broker(), p.name());
NameRef name = p.name(broker());
if (p.feedback().IsValid()) {
broker()->GetFeedbackForPropertyAccess(p.feedback(), AccessMode::kLoad,
name);
......@@ -160,7 +160,7 @@ Reduction JSHeapCopyReducer::Reduce(Node* node) {
}
case IrOpcode::kJSLoadNamedFromSuper: {
NamedAccess const& p = NamedAccessOf(node->op());
NameRef name = MakeRef(broker(), p.name());
NameRef name = p.name(broker());
if (p.feedback().IsValid()) {
broker()->GetFeedbackForPropertyAccess(p.feedback(), AccessMode::kLoad,
name);
......@@ -169,7 +169,7 @@ Reduction JSHeapCopyReducer::Reduce(Node* node) {
}
case IrOpcode::kJSStoreNamed: {
NamedAccess const& p = NamedAccessOf(node->op());
MakeRef(broker(), p.name());
p.name(broker());
break;
}
case IrOpcode::kStoreField:
......
......@@ -111,7 +111,7 @@ JSInliningHeuristic::Candidate JSInliningHeuristic::CollectFunctions(
JSCreateClosureNode n(callee);
CreateClosureParameters const& p = n.Parameters();
FeedbackCellRef feedback_cell = n.GetFeedbackCellRefChecked(broker());
SharedFunctionInfoRef shared_info = MakeRef(broker(), p.shared_info());
SharedFunctionInfoRef shared_info = p.shared_info(broker());
out.shared_info = shared_info;
if (feedback_cell.value().has_value() &&
CanConsiderForInlining(broker(), shared_info, *feedback_cell.value())) {
......
......@@ -1002,9 +1002,9 @@ Reduction JSNativeContextSpecialization::ReduceJSLoadGlobal(Node* node) {
ReplaceWithValue(node, value, effect);
return Replace(value);
} else if (feedback.IsPropertyCell()) {
return ReduceGlobalAccess(node, nullptr, nullptr, nullptr,
MakeRef(broker(), p.name()), AccessMode::kLoad,
nullptr, feedback.property_cell());
return ReduceGlobalAccess(node, nullptr, nullptr, nullptr, p.name(broker()),
AccessMode::kLoad, nullptr,
feedback.property_cell());
} else {
DCHECK(feedback.IsMegamorphic());
return NoChange();
......@@ -1033,9 +1033,9 @@ Reduction JSNativeContextSpecialization::ReduceJSStoreGlobal(Node* node) {
ReplaceWithValue(node, value, effect, control);
return Replace(value);
} else if (feedback.IsPropertyCell()) {
return ReduceGlobalAccess(node, nullptr, nullptr, value,
MakeRef(broker(), p.name()), AccessMode::kStore,
nullptr, feedback.property_cell());
return ReduceGlobalAccess(node, nullptr, nullptr, value, p.name(broker()),
AccessMode::kStore, nullptr,
feedback.property_cell());
} else {
DCHECK(feedback.IsMegamorphic());
return NoChange();
......@@ -1441,7 +1441,7 @@ Reduction JSNativeContextSpecialization::ReduceJSLoadNamed(Node* node) {
JSLoadNamedNode n(node);
NamedAccess const& p = n.Parameters();
Node* const receiver = n.object();
NameRef name = MakeRef(broker(), p.name());
NameRef name = p.name(broker());
// Check if we have a constant receiver.
HeapObjectMatcher m(receiver);
......@@ -1481,7 +1481,7 @@ Reduction JSNativeContextSpecialization::ReduceJSLoadNamedFromSuper(
Node* node) {
JSLoadNamedFromSuperNode n(node);
NamedAccess const& p = n.Parameters();
NameRef name = MakeRef(broker(), p.name());
NameRef name = p.name(broker());
if (!p.feedback().IsValid()) return NoChange();
return ReducePropertyAccess(node, nullptr, name, jsgraph()->Dead(),
......@@ -1499,7 +1499,7 @@ Reduction JSNativeContextSpecialization::ReduceJSGetIterator(Node* node) {
Control control = n.control();
// Load iterator property operator
Handle<Name> iterator_symbol = factory()->iterator_symbol();
NameRef iterator_symbol = MakeRef(broker(), factory()->iterator_symbol());
const Operator* load_op =
javascript()->LoadNamed(iterator_symbol, p.loadFeedback());
......@@ -1576,17 +1576,16 @@ Reduction JSNativeContextSpecialization::ReduceJSStoreNamed(Node* node) {
JSStoreNamedNode n(node);
NamedAccess const& p = n.Parameters();
if (!p.feedback().IsValid()) return NoChange();
return ReducePropertyAccess(node, nullptr, MakeRef(broker(), p.name()),
n.value(), FeedbackSource(p.feedback()),
AccessMode::kStore);
return ReducePropertyAccess(node, nullptr, p.name(broker()), n.value(),
FeedbackSource(p.feedback()), AccessMode::kStore);
}
Reduction JSNativeContextSpecialization::ReduceJSStoreNamedOwn(Node* node) {
JSStoreNamedOwnNode n(node);
StoreNamedOwnParameters const& p = n.Parameters();
if (!p.feedback().IsValid()) return NoChange();
return ReducePropertyAccess(node, nullptr, MakeRef(broker(), p.name()),
n.value(), FeedbackSource(p.feedback()),
return ReducePropertyAccess(node, nullptr, p.name(broker()), n.value(),
FeedbackSource(p.feedback()),
AccessMode::kStoreInLiteral);
}
......
......@@ -28,6 +28,12 @@ constexpr Operator::Properties BinopProperties(Operator::Opcode opcode) {
: Operator::kNoProperties;
}
template <class T>
Address AddressOrNull(base::Optional<T> ref) {
if (!ref.has_value()) return kNullAddress;
return ref->object().address();
}
} // namespace
namespace js_node_wrapper_utils {
......@@ -177,15 +183,10 @@ ContextAccess const& ContextAccessOf(Operator const* op) {
return OpParameter<ContextAccess>(op);
}
CreateFunctionContextParameters::CreateFunctionContextParameters(
Handle<ScopeInfo> scope_info, int slot_count, ScopeType scope_type)
: scope_info_(scope_info),
slot_count_(slot_count),
scope_type_(scope_type) {}
bool operator==(CreateFunctionContextParameters const& lhs,
CreateFunctionContextParameters const& rhs) {
return lhs.scope_info().location() == rhs.scope_info().location() &&
return lhs.scope_info_.object().location() ==
rhs.scope_info_.object().location() &&
lhs.slot_count() == rhs.slot_count() &&
lhs.scope_type() == rhs.scope_type();
}
......@@ -196,7 +197,7 @@ bool operator!=(CreateFunctionContextParameters const& lhs,
}
size_t hash_value(CreateFunctionContextParameters const& parameters) {
return base::hash_combine(parameters.scope_info().location(),
return base::hash_combine(parameters.scope_info_.object().location(),
parameters.slot_count(),
static_cast<int>(parameters.scope_type()));
}
......@@ -214,7 +215,7 @@ CreateFunctionContextParameters const& CreateFunctionContextParametersOf(
bool operator==(StoreNamedOwnParameters const& lhs,
StoreNamedOwnParameters const& rhs) {
return lhs.name().location() == rhs.name().location() &&
return lhs.name_.object().location() == rhs.name_.object().location() &&
lhs.feedback() == rhs.feedback();
}
......@@ -224,12 +225,12 @@ bool operator!=(StoreNamedOwnParameters const& lhs,
}
size_t hash_value(StoreNamedOwnParameters const& p) {
return base::hash_combine(p.name().location(),
return base::hash_combine(p.name_.object().location(),
FeedbackSource::Hash()(p.feedback()));
}
std::ostream& operator<<(std::ostream& os, StoreNamedOwnParameters const& p) {
return os << Brief(*p.name());
return os << Brief(*p.name_.object());
}
StoreNamedOwnParameters const& StoreNamedOwnParametersOf(const Operator* op) {
......@@ -264,7 +265,7 @@ FeedbackParameter const& FeedbackParameterOf(const Operator* op) {
}
bool operator==(NamedAccess const& lhs, NamedAccess const& rhs) {
return lhs.name().location() == rhs.name().location() &&
return lhs.name_.object().location() == rhs.name_.object().location() &&
lhs.language_mode() == rhs.language_mode() &&
lhs.feedback() == rhs.feedback();
}
......@@ -276,13 +277,13 @@ bool operator!=(NamedAccess const& lhs, NamedAccess const& rhs) {
size_t hash_value(NamedAccess const& p) {
return base::hash_combine(p.name().location(), p.language_mode(),
return base::hash_combine(p.name_.object().location(), p.language_mode(),
FeedbackSource::Hash()(p.feedback()));
}
std::ostream& operator<<(std::ostream& os, NamedAccess const& p) {
return os << Brief(*p.name()) << ", " << p.language_mode();
return os << Brief(*p.name_.object()) << ", " << p.language_mode();
}
......@@ -326,7 +327,7 @@ size_t hash_value(PropertyAccess const& p) {
bool operator==(LoadGlobalParameters const& lhs,
LoadGlobalParameters const& rhs) {
return lhs.name().location() == rhs.name().location() &&
return lhs.name_.object().location() == rhs.name_.object().location() &&
lhs.feedback() == rhs.feedback() &&
lhs.typeof_mode() == rhs.typeof_mode();
}
......@@ -339,13 +340,14 @@ bool operator!=(LoadGlobalParameters const& lhs,
size_t hash_value(LoadGlobalParameters const& p) {
return base::hash_combine(p.name().location(),
return base::hash_combine(p.name_.object().location(),
static_cast<int>(p.typeof_mode()));
}
std::ostream& operator<<(std::ostream& os, LoadGlobalParameters const& p) {
return os << Brief(*p.name()) << ", " << static_cast<int>(p.typeof_mode());
return os << Brief(*p.name_.object()) << ", "
<< static_cast<int>(p.typeof_mode());
}
......@@ -358,7 +360,7 @@ const LoadGlobalParameters& LoadGlobalParametersOf(const Operator* op) {
bool operator==(StoreGlobalParameters const& lhs,
StoreGlobalParameters const& rhs) {
return lhs.language_mode() == rhs.language_mode() &&
lhs.name().location() == rhs.name().location() &&
lhs.name_.object().location() == rhs.name_.object().location() &&
lhs.feedback() == rhs.feedback();
}
......@@ -370,13 +372,13 @@ bool operator!=(StoreGlobalParameters const& lhs,
size_t hash_value(StoreGlobalParameters const& p) {
return base::hash_combine(p.language_mode(), p.name().location(),
return base::hash_combine(p.language_mode(), p.name_.object().location(),
FeedbackSource::Hash()(p.feedback()));
}
std::ostream& operator<<(std::ostream& os, StoreGlobalParameters const& p) {
return os << p.language_mode() << ", " << Brief(*p.name());
return os << p.language_mode() << ", " << Brief(*p.name_.object());
}
......@@ -391,16 +393,6 @@ CreateArgumentsType const& CreateArgumentsTypeOf(const Operator* op) {
return OpParameter<CreateArgumentsType>(op);
}
namespace {
template <class T>
Address AddressOrNull(base::Optional<T> ref) {
if (!ref.has_value()) return kNullAddress;
return ref->object().address();
}
} // namespace
bool operator==(CreateArrayParameters const& lhs,
CreateArrayParameters const& rhs) {
return lhs.arity() == rhs.arity() &&
......@@ -487,7 +479,7 @@ const CreateCollectionIteratorParameters& CreateCollectionIteratorParametersOf(
bool operator==(CreateBoundFunctionParameters const& lhs,
CreateBoundFunctionParameters const& rhs) {
return lhs.arity() == rhs.arity() &&
lhs.map().location() == rhs.map().location();
lhs.map_.object().location() == rhs.map_.object().location();
}
bool operator!=(CreateBoundFunctionParameters const& lhs,
......@@ -496,13 +488,13 @@ bool operator!=(CreateBoundFunctionParameters const& lhs,
}
size_t hash_value(CreateBoundFunctionParameters const& p) {
return base::hash_combine(p.arity(), p.map().location());
return base::hash_combine(p.arity(), p.map_.object().location());
}
std::ostream& operator<<(std::ostream& os,
CreateBoundFunctionParameters const& p) {
os << p.arity();
if (!p.map().is_null()) os << ", " << Brief(*p.map());
if (!p.map_.object().is_null()) os << ", " << Brief(*p.map_.object());
return os;
}
......@@ -514,8 +506,9 @@ const CreateBoundFunctionParameters& CreateBoundFunctionParametersOf(
bool operator==(GetTemplateObjectParameters const& lhs,
GetTemplateObjectParameters const& rhs) {
return lhs.description().location() == rhs.description().location() &&
lhs.shared().location() == rhs.shared().location() &&
return lhs.description_.object().location() ==
rhs.description_.object().location() &&
lhs.shared_.object().location() == rhs.shared_.object().location() &&
lhs.feedback() == rhs.feedback();
}
......@@ -525,13 +518,15 @@ bool operator!=(GetTemplateObjectParameters const& lhs,
}
size_t hash_value(GetTemplateObjectParameters const& p) {
return base::hash_combine(p.description().location(), p.shared().location(),
return base::hash_combine(p.description_.object().location(),
p.shared_.object().location(),
FeedbackSource::Hash()(p.feedback()));
}
std::ostream& operator<<(std::ostream& os,
GetTemplateObjectParameters const& p) {
return os << Brief(*p.description()) << ", " << Brief(*p.shared());
return os << Brief(*p.description_.object()) << ", "
<< Brief(*p.shared_.object());
}
const GetTemplateObjectParameters& GetTemplateObjectParametersOf(
......@@ -543,8 +538,9 @@ const GetTemplateObjectParameters& GetTemplateObjectParametersOf(
bool operator==(CreateClosureParameters const& lhs,
CreateClosureParameters const& rhs) {
return lhs.allocation() == rhs.allocation() &&
lhs.code().location() == rhs.code().location() &&
lhs.shared_info().location() == rhs.shared_info().location();
lhs.code_.object().location() == rhs.code_.object().location() &&
lhs.shared_info_.object().location() ==
rhs.shared_info_.object().location();
}
......@@ -555,13 +551,14 @@ bool operator!=(CreateClosureParameters const& lhs,
size_t hash_value(CreateClosureParameters const& p) {
return base::hash_combine(p.allocation(), p.shared_info().location());
return base::hash_combine(p.allocation(), p.code_.object().location(),
p.shared_info_.object().location());
}
std::ostream& operator<<(std::ostream& os, CreateClosureParameters const& p) {
return os << p.allocation() << ", " << Brief(*p.shared_info()) << ", "
<< Brief(*p.code());
return os << p.allocation() << ", " << Brief(*p.shared_info_.object()) << ", "
<< Brief(*p.code_.object());
}
......@@ -573,7 +570,8 @@ const CreateClosureParameters& CreateClosureParametersOf(const Operator* op) {
bool operator==(CreateLiteralParameters const& lhs,
CreateLiteralParameters const& rhs) {
return lhs.constant().location() == rhs.constant().location() &&
return lhs.constant_.object().location() ==
rhs.constant_.object().location() &&
lhs.feedback() == rhs.feedback() && lhs.length() == rhs.length() &&
lhs.flags() == rhs.flags();
}
......@@ -586,14 +584,15 @@ bool operator!=(CreateLiteralParameters const& lhs,
size_t hash_value(CreateLiteralParameters const& p) {
return base::hash_combine(p.constant().location(),
return base::hash_combine(p.constant_.object().location(),
FeedbackSource::Hash()(p.feedback()), p.length(),
p.flags());
}
std::ostream& operator<<(std::ostream& os, CreateLiteralParameters const& p) {
return os << Brief(*p.constant()) << ", " << p.length() << ", " << p.flags();
return os << Brief(*p.constant_.object()) << ", " << p.length() << ", "
<< p.flags();
}
......@@ -993,7 +992,7 @@ const Operator* JSOperatorBuilder::ConstructWithSpread(
parameters); // parameter
}
const Operator* JSOperatorBuilder::LoadNamed(Handle<Name> name,
const Operator* JSOperatorBuilder::LoadNamed(const NameRef& name,
const FeedbackSource& feedback) {
static constexpr int kObject = 1;
static constexpr int kFeedbackVector = 1;
......@@ -1007,7 +1006,7 @@ const Operator* JSOperatorBuilder::LoadNamed(Handle<Name> name,
}
const Operator* JSOperatorBuilder::LoadNamedFromSuper(
Handle<Name> name, const FeedbackSource& feedback) {
const NameRef& name, const FeedbackSource& feedback) {
static constexpr int kReceiver = 1;
static constexpr int kHomeObject = 1;
static constexpr int kFeedbackVector = 1;
......@@ -1100,7 +1099,7 @@ int RestoreRegisterIndexOf(const Operator* op) {
}
const Operator* JSOperatorBuilder::StoreNamed(LanguageMode language_mode,
Handle<Name> name,
const NameRef& name,
FeedbackSource const& feedback) {
static constexpr int kObject = 1;
static constexpr int kValue = 1;
......@@ -1125,7 +1124,7 @@ const Operator* JSOperatorBuilder::StoreProperty(
}
const Operator* JSOperatorBuilder::StoreNamedOwn(
Handle<Name> name, FeedbackSource const& feedback) {
const NameRef& name, FeedbackSource const& feedback) {
static constexpr int kObject = 1;
static constexpr int kValue = 1;
static constexpr int kFeedbackVector = 1;
......@@ -1152,7 +1151,7 @@ const Operator* JSOperatorBuilder::CreateGeneratorObject() {
2, 1, 1, 1, 1, 0); // counts
}
const Operator* JSOperatorBuilder::LoadGlobal(const Handle<Name>& name,
const Operator* JSOperatorBuilder::LoadGlobal(const NameRef& name,
const FeedbackSource& feedback,
TypeofMode typeof_mode) {
static constexpr int kFeedbackVector = 1;
......@@ -1166,7 +1165,7 @@ const Operator* JSOperatorBuilder::LoadGlobal(const Handle<Name>& name,
}
const Operator* JSOperatorBuilder::StoreGlobal(LanguageMode language_mode,
const Handle<Name>& name,
const NameRef& name,
const FeedbackSource& feedback) {
static constexpr int kValue = 1;
static constexpr int kFeedbackVector = 1;
......@@ -1285,7 +1284,7 @@ const Operator* JSOperatorBuilder::CreateCollectionIterator(
}
const Operator* JSOperatorBuilder::CreateBoundFunction(size_t arity,
Handle<Map> map) {
const MapRef& map) {
// bound_target_function, bound_this, arg1, ..., argN
int const value_input_count = static_cast<int>(arity) + 2;
CreateBoundFunctionParameters parameters(arity, map);
......@@ -1297,7 +1296,7 @@ const Operator* JSOperatorBuilder::CreateBoundFunction(size_t arity,
}
const Operator* JSOperatorBuilder::CreateClosure(
Handle<SharedFunctionInfo> shared_info, Handle<CodeT> code,
const SharedFunctionInfoRef& shared_info, const CodeTRef& code,
AllocationType allocation) {
static constexpr int kFeedbackCell = 1;
static constexpr int kArity = kFeedbackCell;
......@@ -1310,7 +1309,7 @@ const Operator* JSOperatorBuilder::CreateClosure(
}
const Operator* JSOperatorBuilder::CreateLiteralArray(
Handle<ArrayBoilerplateDescription> description,
const ArrayBoilerplateDescriptionRef& description,
FeedbackSource const& feedback, int literal_flags, int number_of_elements) {
CreateLiteralParameters parameters(description, feedback, number_of_elements,
literal_flags);
......@@ -1344,7 +1343,7 @@ const Operator* JSOperatorBuilder::CreateArrayFromIterable() {
}
const Operator* JSOperatorBuilder::CreateLiteralObject(
Handle<ObjectBoilerplateDescription> constant_properties,
const ObjectBoilerplateDescriptionRef& constant_properties,
FeedbackSource const& feedback, int literal_flags,
int number_of_properties) {
CreateLiteralParameters parameters(constant_properties, feedback,
......@@ -1358,8 +1357,8 @@ const Operator* JSOperatorBuilder::CreateLiteralObject(
}
const Operator* JSOperatorBuilder::GetTemplateObject(
Handle<TemplateObjectDescription> description,
Handle<SharedFunctionInfo> shared, FeedbackSource const& feedback) {
const TemplateObjectDescriptionRef& description,
const SharedFunctionInfoRef& shared, FeedbackSource const& feedback) {
GetTemplateObjectParameters parameters(description, shared, feedback);
return zone()->New<Operator1<GetTemplateObjectParameters>>( // --
IrOpcode::kJSGetTemplateObject, // opcode
......@@ -1398,7 +1397,7 @@ const Operator* JSOperatorBuilder::CreateEmptyLiteralObject() {
}
const Operator* JSOperatorBuilder::CreateLiteralRegExp(
Handle<String> constant_pattern, FeedbackSource const& feedback,
const StringRef& constant_pattern, FeedbackSource const& feedback,
int literal_flags) {
CreateLiteralParameters parameters(constant_pattern, feedback, -1,
literal_flags);
......@@ -1411,7 +1410,7 @@ const Operator* JSOperatorBuilder::CreateLiteralRegExp(
}
const Operator* JSOperatorBuilder::CreateFunctionContext(
Handle<ScopeInfo> scope_info, int slot_count, ScopeType scope_type) {
const ScopeInfoRef& scope_info, int slot_count, ScopeType scope_type) {
CreateFunctionContextParameters parameters(scope_info, slot_count,
scope_type);
return zone()->New<Operator1<CreateFunctionContextParameters>>( // --
......@@ -1422,37 +1421,53 @@ const Operator* JSOperatorBuilder::CreateFunctionContext(
}
const Operator* JSOperatorBuilder::CreateCatchContext(
const Handle<ScopeInfo>& scope_info) {
return zone()->New<Operator1<Handle<ScopeInfo>>>(
const ScopeInfoRef& scope_info) {
return zone()->New<Operator1<ScopeInfoTinyRef>>(
IrOpcode::kJSCreateCatchContext, Operator::kNoProperties, // opcode
"JSCreateCatchContext", // name
1, 1, 1, 1, 1, 2, // counts
scope_info); // parameter
ScopeInfoTinyRef{scope_info}); // parameter
}
const Operator* JSOperatorBuilder::CreateWithContext(
const Handle<ScopeInfo>& scope_info) {
return zone()->New<Operator1<Handle<ScopeInfo>>>(
const ScopeInfoRef& scope_info) {
return zone()->New<Operator1<ScopeInfoTinyRef>>(
IrOpcode::kJSCreateWithContext, Operator::kNoProperties, // opcode
"JSCreateWithContext", // name
1, 1, 1, 1, 1, 2, // counts
scope_info); // parameter
ScopeInfoTinyRef{scope_info}); // parameter
}
const Operator* JSOperatorBuilder::CreateBlockContext(
const Handle<ScopeInfo>& scope_info) {
return zone()->New<Operator1<Handle<ScopeInfo>>>( // --
const ScopeInfoRef& scope_info) {
return zone()->New<Operator1<ScopeInfoTinyRef>>( // --
IrOpcode::kJSCreateBlockContext, Operator::kNoProperties, // opcode
"JSCreateBlockContext", // name
0, 1, 1, 1, 1, 2, // counts
scope_info); // parameter
ScopeInfoTinyRef{scope_info}); // parameter
}
Handle<ScopeInfo> ScopeInfoOf(const Operator* op) {
ScopeInfoRef ScopeInfoOf(JSHeapBroker* broker, const Operator* op) {
DCHECK(IrOpcode::kJSCreateBlockContext == op->opcode() ||
IrOpcode::kJSCreateWithContext == op->opcode() ||
IrOpcode::kJSCreateCatchContext == op->opcode());
return OpParameter<Handle<ScopeInfo>>(op);
return OpParameter<ScopeInfoTinyRef>(op).AsRef(broker);
}
bool operator==(ScopeInfoTinyRef const& lhs, ScopeInfoTinyRef const& rhs) {
return lhs.object().location() == rhs.object().location();
}
bool operator!=(ScopeInfoTinyRef const& lhs, ScopeInfoTinyRef const& rhs) {
return !(lhs == rhs);
}
size_t hash_value(ScopeInfoTinyRef const& ref) {
return reinterpret_cast<size_t>(ref.object().location());
}
std::ostream& operator<<(std::ostream& os, ScopeInfoTinyRef const& ref) {
return os << Brief(*ref.object());
}
#undef CACHED_OP_LIST
......
......@@ -363,28 +363,33 @@ V8_EXPORT_PRIVATE ContextAccess const& ContextAccessOf(Operator const*);
// is used as a parameter by the JSCreateFunctionContext operator.
class CreateFunctionContextParameters final {
public:
CreateFunctionContextParameters(Handle<ScopeInfo> scope_info, int slot_count,
ScopeType scope_type);
CreateFunctionContextParameters(const ScopeInfoRef& scope_info,
int slot_count, ScopeType scope_type)
: scope_info_(scope_info),
slot_count_(slot_count),
scope_type_(scope_type) {}
Handle<ScopeInfo> scope_info() const { return scope_info_; }
ScopeInfoRef scope_info(JSHeapBroker* broker) const {
return scope_info_.AsRef(broker);
}
int slot_count() const { return slot_count_; }
ScopeType scope_type() const { return scope_type_; }
private:
Handle<ScopeInfo> scope_info_;
const ScopeInfoTinyRef scope_info_;
int const slot_count_;
ScopeType const scope_type_;
};
bool operator==(CreateFunctionContextParameters const& lhs,
friend bool operator==(CreateFunctionContextParameters const& lhs,
CreateFunctionContextParameters const& rhs);
bool operator!=(CreateFunctionContextParameters const& lhs,
friend bool operator!=(CreateFunctionContextParameters const& lhs,
CreateFunctionContextParameters const& rhs);
size_t hash_value(CreateFunctionContextParameters const& parameters);
friend size_t hash_value(CreateFunctionContextParameters const& parameters);
std::ostream& operator<<(std::ostream& os,
CreateFunctionContextParameters const& parameters);
friend std::ostream& operator<<(
std::ostream& os, CreateFunctionContextParameters const& parameters);
};
CreateFunctionContextParameters const& CreateFunctionContextParametersOf(
Operator const*);
......@@ -392,23 +397,24 @@ CreateFunctionContextParameters const& CreateFunctionContextParametersOf(
// Defines parameters for JSStoreNamedOwn operator.
class StoreNamedOwnParameters final {
public:
StoreNamedOwnParameters(Handle<Name> name, FeedbackSource const& feedback)
StoreNamedOwnParameters(const NameRef& name, FeedbackSource const& feedback)
: name_(name), feedback_(feedback) {}
Handle<Name> name() const { return name_; }
NameRef name(JSHeapBroker* broker) const { return name_.AsRef(broker); }
FeedbackSource const& feedback() const { return feedback_; }
private:
Handle<Name> const name_;
const NameTinyRef name_;
FeedbackSource const feedback_;
};
bool operator==(StoreNamedOwnParameters const&, StoreNamedOwnParameters const&);
bool operator!=(StoreNamedOwnParameters const&, StoreNamedOwnParameters const&);
size_t hash_value(StoreNamedOwnParameters const&);
std::ostream& operator<<(std::ostream&, StoreNamedOwnParameters const&);
friend bool operator==(StoreNamedOwnParameters const&,
StoreNamedOwnParameters const&);
friend bool operator!=(StoreNamedOwnParameters const&,
StoreNamedOwnParameters const&);
friend size_t hash_value(StoreNamedOwnParameters const&);
friend std::ostream& operator<<(std::ostream&,
StoreNamedOwnParameters const&);
};
const StoreNamedOwnParameters& StoreNamedOwnParametersOf(const Operator* op);
......@@ -439,26 +445,26 @@ const FeedbackParameter& FeedbackParameterOf(const Operator* op);
// used as a parameter by the JSLoadNamed and JSStoreNamed operators.
class NamedAccess final {
public:
NamedAccess(LanguageMode language_mode, Handle<Name> name,
NamedAccess(LanguageMode language_mode, const NameRef& name,
FeedbackSource const& feedback)
: name_(name), feedback_(feedback), language_mode_(language_mode) {}
Handle<Name> name() const { return name_; }
NameRef name(JSHeapBroker* broker) const { return name_.AsRef(broker); }
LanguageMode language_mode() const { return language_mode_; }
FeedbackSource const& feedback() const { return feedback_; }
private:
Handle<Name> const name_;
const NameTinyRef name_;
FeedbackSource const feedback_;
LanguageMode const language_mode_;
};
bool operator==(NamedAccess const&, NamedAccess const&);
bool operator!=(NamedAccess const&, NamedAccess const&);
friend bool operator==(NamedAccess const&, NamedAccess const&);
friend bool operator!=(NamedAccess const&, NamedAccess const&);
size_t hash_value(NamedAccess const&);
friend size_t hash_value(NamedAccess const&);
std::ostream& operator<<(std::ostream&, NamedAccess const&);
friend std::ostream& operator<<(std::ostream&, NamedAccess const&);
};
const NamedAccess& NamedAccessOf(const Operator* op);
......@@ -467,27 +473,29 @@ const NamedAccess& NamedAccessOf(const Operator* op);
// used as a parameter by JSLoadGlobal operator.
class LoadGlobalParameters final {
public:
LoadGlobalParameters(const Handle<Name>& name, const FeedbackSource& feedback,
LoadGlobalParameters(const NameRef& name, const FeedbackSource& feedback,
TypeofMode typeof_mode)
: name_(name), feedback_(feedback), typeof_mode_(typeof_mode) {}
const Handle<Name>& name() const { return name_; }
NameRef name(JSHeapBroker* broker) const { return name_.AsRef(broker); }
TypeofMode typeof_mode() const { return typeof_mode_; }
const FeedbackSource& feedback() const { return feedback_; }
private:
const Handle<Name> name_;
const NameTinyRef name_;
const FeedbackSource feedback_;
const TypeofMode typeof_mode_;
};
bool operator==(LoadGlobalParameters const&, LoadGlobalParameters const&);
bool operator!=(LoadGlobalParameters const&, LoadGlobalParameters const&);
friend bool operator==(LoadGlobalParameters const&,
LoadGlobalParameters const&);
friend bool operator!=(LoadGlobalParameters const&,
LoadGlobalParameters const&);
size_t hash_value(LoadGlobalParameters const&);
friend size_t hash_value(LoadGlobalParameters const&);
std::ostream& operator<<(std::ostream&, LoadGlobalParameters const&);
friend std::ostream& operator<<(std::ostream&, LoadGlobalParameters const&);
};
const LoadGlobalParameters& LoadGlobalParametersOf(const Operator* op);
......@@ -497,26 +505,27 @@ const LoadGlobalParameters& LoadGlobalParametersOf(const Operator* op);
class StoreGlobalParameters final {
public:
StoreGlobalParameters(LanguageMode language_mode,
const FeedbackSource& feedback,
const Handle<Name>& name)
const FeedbackSource& feedback, const NameRef& name)
: language_mode_(language_mode), name_(name), feedback_(feedback) {}
LanguageMode language_mode() const { return language_mode_; }
FeedbackSource const& feedback() const { return feedback_; }
Handle<Name> const& name() const { return name_; }
NameRef name(JSHeapBroker* broker) const { return name_.AsRef(broker); }
private:
LanguageMode const language_mode_;
Handle<Name> const name_;
const NameTinyRef name_;
FeedbackSource const feedback_;
};
bool operator==(StoreGlobalParameters const&, StoreGlobalParameters const&);
bool operator!=(StoreGlobalParameters const&, StoreGlobalParameters const&);
friend bool operator==(StoreGlobalParameters const&,
StoreGlobalParameters const&);
friend bool operator!=(StoreGlobalParameters const&,
StoreGlobalParameters const&);
size_t hash_value(StoreGlobalParameters const&);
friend size_t hash_value(StoreGlobalParameters const&);
std::ostream& operator<<(std::ostream&, StoreGlobalParameters const&);
friend std::ostream& operator<<(std::ostream&, StoreGlobalParameters const&);
};
const StoreGlobalParameters& StoreGlobalParametersOf(const Operator* op);
......@@ -637,25 +646,26 @@ const CreateCollectionIteratorParameters& CreateCollectionIteratorParametersOf(
// This is used as parameter by JSCreateBoundFunction operators.
class CreateBoundFunctionParameters final {
public:
CreateBoundFunctionParameters(size_t arity, Handle<Map> map)
CreateBoundFunctionParameters(size_t arity, const MapRef& map)
: arity_(arity), map_(map) {}
size_t arity() const { return arity_; }
Handle<Map> map() const { return map_; }
MapRef map(JSHeapBroker* broker) const { return map_.AsRef(broker); }
private:
size_t const arity_;
Handle<Map> const map_;
};
const MapTinyRef map_;
bool operator==(CreateBoundFunctionParameters const&,
friend bool operator==(CreateBoundFunctionParameters const&,
CreateBoundFunctionParameters const&);
bool operator!=(CreateBoundFunctionParameters const&,
friend bool operator!=(CreateBoundFunctionParameters const&,
CreateBoundFunctionParameters const&);
size_t hash_value(CreateBoundFunctionParameters const&);
friend size_t hash_value(CreateBoundFunctionParameters const&);
std::ostream& operator<<(std::ostream&, CreateBoundFunctionParameters const&);
friend std::ostream& operator<<(std::ostream&,
CreateBoundFunctionParameters const&);
};
const CreateBoundFunctionParameters& CreateBoundFunctionParametersOf(
const Operator* op);
......@@ -664,54 +674,64 @@ const CreateBoundFunctionParameters& CreateBoundFunctionParametersOf(
// used as a parameter by JSCreateClosure operators.
class CreateClosureParameters final {
public:
CreateClosureParameters(Handle<SharedFunctionInfo> shared_info,
Handle<CodeT> code, AllocationType allocation)
CreateClosureParameters(const SharedFunctionInfoRef& shared_info,
const CodeTRef& code, AllocationType allocation)
: shared_info_(shared_info), code_(code), allocation_(allocation) {}
Handle<SharedFunctionInfo> shared_info() const { return shared_info_; }
Handle<CodeT> code() const { return code_; }
SharedFunctionInfoRef shared_info(JSHeapBroker* broker) const {
return shared_info_.AsRef(broker);
}
CodeTRef code(JSHeapBroker* broker) const { return code_.AsRef(broker); }
AllocationType allocation() const { return allocation_; }
private:
Handle<SharedFunctionInfo> const shared_info_;
Handle<CodeT> const code_;
const SharedFunctionInfoTinyRef shared_info_;
const CodeTTinyRef code_;
AllocationType const allocation_;
};
bool operator==(CreateClosureParameters const&, CreateClosureParameters const&);
bool operator!=(CreateClosureParameters const&, CreateClosureParameters const&);
friend bool operator==(CreateClosureParameters const&,
CreateClosureParameters const&);
friend bool operator!=(CreateClosureParameters const&,
CreateClosureParameters const&);
size_t hash_value(CreateClosureParameters const&);
friend size_t hash_value(CreateClosureParameters const&);
std::ostream& operator<<(std::ostream&, CreateClosureParameters const&);
friend std::ostream& operator<<(std::ostream&,
CreateClosureParameters const&);
};
const CreateClosureParameters& CreateClosureParametersOf(const Operator* op);
class GetTemplateObjectParameters final {
public:
GetTemplateObjectParameters(Handle<TemplateObjectDescription> description,
Handle<SharedFunctionInfo> shared,
GetTemplateObjectParameters(const TemplateObjectDescriptionRef& description,
const SharedFunctionInfoRef& shared,
FeedbackSource const& feedback)
: description_(description), shared_(shared), feedback_(feedback) {}
Handle<TemplateObjectDescription> description() const { return description_; }
Handle<SharedFunctionInfo> shared() const { return shared_; }
TemplateObjectDescriptionRef description(JSHeapBroker* broker) const {
return description_.AsRef(broker);
}
SharedFunctionInfoRef shared(JSHeapBroker* broker) const {
return shared_.AsRef(broker);
}
FeedbackSource const& feedback() const { return feedback_; }
private:
Handle<TemplateObjectDescription> const description_;
Handle<SharedFunctionInfo> const shared_;
const TemplateObjectDescriptionTinyRef description_;
const SharedFunctionInfoTinyRef shared_;
FeedbackSource const feedback_;
};
bool operator==(GetTemplateObjectParameters const&,
friend bool operator==(GetTemplateObjectParameters const&,
GetTemplateObjectParameters const&);
bool operator!=(GetTemplateObjectParameters const&,
friend bool operator!=(GetTemplateObjectParameters const&,
GetTemplateObjectParameters const&);
size_t hash_value(GetTemplateObjectParameters const&);
friend size_t hash_value(GetTemplateObjectParameters const&);
std::ostream& operator<<(std::ostream&, GetTemplateObjectParameters const&);
friend std::ostream& operator<<(std::ostream&,
GetTemplateObjectParameters const&);
};
const GetTemplateObjectParameters& GetTemplateObjectParametersOf(
const Operator* op);
......@@ -721,31 +741,36 @@ const GetTemplateObjectParameters& GetTemplateObjectParametersOf(
// JSCreateLiteralRegExp operators.
class CreateLiteralParameters final {
public:
CreateLiteralParameters(Handle<HeapObject> constant,
CreateLiteralParameters(const HeapObjectRef& constant,
FeedbackSource const& feedback, int length, int flags)
: constant_(constant),
feedback_(feedback),
length_(length),
flags_(flags) {}
Handle<HeapObject> constant() const { return constant_; }
HeapObjectRef constant(JSHeapBroker* broker) const {
return constant_.AsRef(broker);
}
FeedbackSource const& feedback() const { return feedback_; }
int length() const { return length_; }
int flags() const { return flags_; }
private:
Handle<HeapObject> const constant_;
const HeapObjectTinyRef constant_;
FeedbackSource const feedback_;
int const length_;
int const flags_;
};
bool operator==(CreateLiteralParameters const&, CreateLiteralParameters const&);
bool operator!=(CreateLiteralParameters const&, CreateLiteralParameters const&);
friend bool operator==(CreateLiteralParameters const&,
CreateLiteralParameters const&);
friend bool operator!=(CreateLiteralParameters const&,
CreateLiteralParameters const&);
size_t hash_value(CreateLiteralParameters const&);
friend size_t hash_value(CreateLiteralParameters const&);
std::ostream& operator<<(std::ostream&, CreateLiteralParameters const&);
friend std::ostream& operator<<(std::ostream&,
CreateLiteralParameters const&);
};
const CreateLiteralParameters& CreateLiteralParametersOf(const Operator* op);
......@@ -859,7 +884,16 @@ int RegisterCountOf(Operator const* op) V8_WARN_UNUSED_RESULT;
int GeneratorStoreValueCountOf(const Operator* op) V8_WARN_UNUSED_RESULT;
int RestoreRegisterIndexOf(const Operator* op) V8_WARN_UNUSED_RESULT;
Handle<ScopeInfo> ScopeInfoOf(const Operator* op) V8_WARN_UNUSED_RESULT;
ScopeInfoRef ScopeInfoOf(JSHeapBroker* broker,
const Operator* op) V8_WARN_UNUSED_RESULT;
bool operator==(ScopeInfoTinyRef const&, ScopeInfoTinyRef const&);
bool operator!=(ScopeInfoTinyRef const&, ScopeInfoTinyRef const&);
size_t hash_value(ScopeInfoTinyRef const&);
V8_EXPORT_PRIVATE std::ostream& operator<<(std::ostream&,
ScopeInfoTinyRef const&);
// Interface for building JavaScript-level operators, e.g. directly from the
// AST. Most operators have no parameters, thus can be globally shared for all
......@@ -911,9 +945,9 @@ class V8_EXPORT_PRIVATE JSOperatorBuilder final
const Operator* CreateArrayIterator(IterationKind);
const Operator* CreateAsyncFunctionObject(int register_count);
const Operator* CreateCollectionIterator(CollectionKind, IterationKind);
const Operator* CreateBoundFunction(size_t arity, Handle<Map> map);
const Operator* CreateBoundFunction(size_t arity, const MapRef& map);
const Operator* CreateClosure(
Handle<SharedFunctionInfo> shared_info, Handle<CodeT> code,
const SharedFunctionInfoRef& shared_info, const CodeTRef& code,
AllocationType allocation = AllocationType::kYoung);
const Operator* CreateIterResultObject();
const Operator* CreateStringIterator();
......@@ -922,25 +956,25 @@ class V8_EXPORT_PRIVATE JSOperatorBuilder final
const Operator* CreatePromise();
const Operator* CreateTypedArray();
const Operator* CreateLiteralArray(
Handle<ArrayBoilerplateDescription> constant,
const ArrayBoilerplateDescriptionRef& constant,
FeedbackSource const& feedback, int literal_flags,
int number_of_elements);
const Operator* CreateEmptyLiteralArray(FeedbackSource const& feedback);
const Operator* CreateArrayFromIterable();
const Operator* CreateEmptyLiteralObject();
const Operator* CreateLiteralObject(
Handle<ObjectBoilerplateDescription> constant,
const ObjectBoilerplateDescriptionRef& constant,
FeedbackSource const& feedback, int literal_flags,
int number_of_properties);
const Operator* CloneObject(FeedbackSource const& feedback,
int literal_flags);
const Operator* CreateLiteralRegExp(Handle<String> constant_pattern,
const Operator* CreateLiteralRegExp(const StringRef& constant_pattern,
FeedbackSource const& feedback,
int literal_flags);
const Operator* GetTemplateObject(
Handle<TemplateObjectDescription> description,
Handle<SharedFunctionInfo> shared, FeedbackSource const& feedback);
const TemplateObjectDescriptionRef& description,
const SharedFunctionInfoRef& shared, FeedbackSource const& feedback);
const Operator* CallForwardVarargs(size_t arity, uint32_t start_index);
const Operator* Call(
......@@ -981,16 +1015,17 @@ class V8_EXPORT_PRIVATE JSOperatorBuilder final
FeedbackSource const& feedback = FeedbackSource());
const Operator* LoadProperty(FeedbackSource const& feedback);
const Operator* LoadNamed(Handle<Name> name, FeedbackSource const& feedback);
const Operator* LoadNamedFromSuper(Handle<Name> name,
const Operator* LoadNamed(const NameRef& name,
FeedbackSource const& feedback);
const Operator* LoadNamedFromSuper(const NameRef& name,
FeedbackSource const& feedback);
const Operator* StoreProperty(LanguageMode language_mode,
FeedbackSource const& feedback);
const Operator* StoreNamed(LanguageMode language_mode, Handle<Name> name,
const Operator* StoreNamed(LanguageMode language_mode, const NameRef& name,
FeedbackSource const& feedback);
const Operator* StoreNamedOwn(Handle<Name> name,
const Operator* StoreNamedOwn(const NameRef& name,
FeedbackSource const& feedback);
const Operator* StoreDataPropertyInLiteral(const FeedbackSource& feedback);
const Operator* StoreInArrayLiteral(const FeedbackSource& feedback);
......@@ -1003,11 +1038,10 @@ class V8_EXPORT_PRIVATE JSOperatorBuilder final
const Operator* CreateGeneratorObject();
const Operator* LoadGlobal(const Handle<Name>& name,
const Operator* LoadGlobal(const NameRef& name,
const FeedbackSource& feedback,
TypeofMode typeof_mode = TypeofMode::kNotInside);
const Operator* StoreGlobal(LanguageMode language_mode,
const Handle<Name>& name,
const Operator* StoreGlobal(LanguageMode language_mode, const NameRef& name,
const FeedbackSource& feedback);
const Operator* HasContextExtension(size_t depth);
......@@ -1054,11 +1088,11 @@ class V8_EXPORT_PRIVATE JSOperatorBuilder final
const Operator* RejectPromise();
const Operator* ResolvePromise();
const Operator* CreateFunctionContext(Handle<ScopeInfo> scope_info,
const Operator* CreateFunctionContext(const ScopeInfoRef& scope_info,
int slot_count, ScopeType scope_type);
const Operator* CreateCatchContext(const Handle<ScopeInfo>& scope_info);
const Operator* CreateWithContext(const Handle<ScopeInfo>& scope_info);
const Operator* CreateBlockContext(const Handle<ScopeInfo>& scpope_info);
const Operator* CreateCatchContext(const ScopeInfoRef& scope_info);
const Operator* CreateWithContext(const ScopeInfoRef& scope_info);
const Operator* CreateBlockContext(const ScopeInfoRef& scpope_info);
const Operator* ObjectIsArray();
const Operator* ParseInt();
......
......@@ -1173,7 +1173,7 @@ Reduction JSTypedLowering::ReduceJSLoadNamed(Node* node) {
JSLoadNamedNode n(node);
Node* receiver = n.object();
Type receiver_type = NodeProperties::GetType(receiver);
NameRef name = MakeRef(broker(), NamedAccessOf(node->op()).name());
NameRef name = NamedAccessOf(node->op()).name(broker());
NameRef length_str = MakeRef(broker(), factory()->length_string());
// Optimize "length" property of strings.
if (name.equals(length_str) && receiver_type.Is(Type::String())) {
......@@ -1705,7 +1705,7 @@ Reduction JSTypedLowering::ReduceJSCall(Node* node) {
} else if (target->opcode() == IrOpcode::kJSCreateClosure) {
CreateClosureParameters const& ccp =
JSCreateClosureNode{target}.Parameters();
shared = MakeRef(broker(), ccp.shared_info());
shared = ccp.shared_info(broker());
} else if (target->opcode() == IrOpcode::kCheckClosure) {
FeedbackCellRef cell = MakeRef(broker(), FeedbackCellOf(target->op()));
base::Optional<FeedbackVectorRef> feedback_vector = cell.value();
......
......@@ -201,7 +201,7 @@ TEST(ReduceJSLoadContext1) {
Node* start = t.graph()->NewNode(t.common()->Start(0));
t.graph()->SetStart(start);
Handle<ScopeInfo> empty(ScopeInfo::Empty(t.main_isolate()), t.main_isolate());
ScopeInfoRef empty = MakeRef(t.broker(), ScopeInfo::Empty(t.main_isolate()));
const i::compiler::Operator* create_function_context =
t.javascript()->CreateFunctionContext(empty, 42, FUNCTION_SCOPE);
......@@ -271,7 +271,7 @@ TEST(ReduceJSLoadContext2) {
Node* start = t.graph()->NewNode(t.common()->Start(0));
t.graph()->SetStart(start);
Handle<ScopeInfo> empty(ScopeInfo::Empty(t.main_isolate()), t.main_isolate());
ScopeInfoRef empty = MakeRef(t.broker(), ScopeInfo::Empty(t.main_isolate()));
const i::compiler::Operator* create_function_context =
t.javascript()->CreateFunctionContext(empty, 42, FUNCTION_SCOPE);
......@@ -365,8 +365,7 @@ TEST(ReduceJSLoadContext3) {
Node* start = t.graph()->NewNode(t.common()->Start(2));
t.graph()->SetStart(start);
Handle<ScopeInfo> empty(ScopeInfo::Empty(t.main_isolate()),
handle_zone_scope.main_isolate());
ScopeInfoRef empty = MakeRef(t.broker(), ScopeInfo::Empty(t.main_isolate()));
const i::compiler::Operator* create_function_context =
t.javascript()->CreateFunctionContext(empty, 42, FUNCTION_SCOPE);
......@@ -496,7 +495,7 @@ TEST(ReduceJSStoreContext1) {
Node* start = t.graph()->NewNode(t.common()->Start(0));
t.graph()->SetStart(start);
Handle<ScopeInfo> empty(ScopeInfo::Empty(t.main_isolate()), t.main_isolate());
ScopeInfoRef empty = MakeRef(t.broker(), ScopeInfo::Empty(t.main_isolate()));
const i::compiler::Operator* create_function_context =
t.javascript()->CreateFunctionContext(empty, 42, FUNCTION_SCOPE);
......@@ -540,7 +539,7 @@ TEST(ReduceJSStoreContext2) {
Node* start = t.graph()->NewNode(t.common()->Start(0));
t.graph()->SetStart(start);
Handle<ScopeInfo> empty(ScopeInfo::Empty(t.main_isolate()), t.main_isolate());
ScopeInfoRef empty = MakeRef(t.broker(), ScopeInfo::Empty(t.main_isolate()));
const i::compiler::Operator* create_function_context =
t.javascript()->CreateFunctionContext(empty, 42, FUNCTION_SCOPE);
......@@ -606,8 +605,7 @@ TEST(ReduceJSStoreContext3) {
Node* start = t.graph()->NewNode(t.common()->Start(2));
t.graph()->SetStart(start);
Handle<ScopeInfo> empty(ScopeInfo::Empty(t.main_isolate()),
handle_zone_scope.main_isolate());
ScopeInfoRef empty = MakeRef(t.broker(), ScopeInfo::Empty(t.main_isolate()));
const i::compiler::Operator* create_function_context =
t.javascript()->CreateFunctionContext(empty, 42, FUNCTION_SCOPE);
......
......@@ -157,7 +157,7 @@ TEST_F(JSCreateLoweringTest, JSCreateFunctionContextViaInlinedAllocation) {
Node* const control = graph()->start();
Reduction const r = Reduce(graph()->NewNode(
javascript()->CreateFunctionContext(
handle(ScopeInfo::Empty(isolate()), isolate()), 8, FUNCTION_SCOPE),
MakeRef(broker(), ScopeInfo::Empty(isolate())), 8, FUNCTION_SCOPE),
context, effect, control));
ASSERT_TRUE(r.Changed());
EXPECT_THAT(r.replacement(),
......@@ -171,8 +171,8 @@ TEST_F(JSCreateLoweringTest, JSCreateFunctionContextViaInlinedAllocation) {
// JSCreateWithContext
TEST_F(JSCreateLoweringTest, JSCreateWithContext) {
Handle<ScopeInfo> scope_info =
ReadOnlyRoots(isolate()).empty_function_scope_info_handle();
ScopeInfoRef scope_info =
MakeRef(broker(), ReadOnlyRoots(isolate()).empty_function_scope_info());
Node* const object = Parameter(Type::Receiver());
Node* const context = Parameter(Type::Any());
Node* const effect = graph()->start();
......@@ -193,8 +193,8 @@ TEST_F(JSCreateLoweringTest, JSCreateWithContext) {
// JSCreateCatchContext
TEST_F(JSCreateLoweringTest, JSCreateCatchContext) {
Handle<ScopeInfo> scope_info =
ReadOnlyRoots(isolate()).empty_function_scope_info_handle();
ScopeInfoRef scope_info =
MakeRef(broker(), ReadOnlyRoots(isolate()).empty_function_scope_info());
Node* const exception = Parameter(Type::Receiver());
Node* const context = Parameter(Type::Any());
Node* const effect = graph()->start();
......
......@@ -400,7 +400,7 @@ TEST_F(JSTypedLoweringTest, JSStoreContext) {
TEST_F(JSTypedLoweringTest, JSLoadNamedStringLength) {
Handle<Name> name = factory()->length_string();
NameRef name = MakeRef(broker(), factory()->length_string());
Node* const receiver = Parameter(Type::String(), 0);
Node* const feedback = UndefinedConstant();
Node* const context = UndefinedConstant();
......
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