Commit a150f95a authored by Mike Stanton's avatar Mike Stanton Committed by Commit Bot

[TurboFan] Context creation bytecode brokerization

The BytecodeGraphBuilder still looks at the heap. This CL completely
eliminates heap lookups for:

* CreateBlockContext
* CreateFunctionContext
* CreateEvalContext
* CreateCatchContext
* CreateWithContext

Bug: v8:7790
Change-Id: I8b88215ba14a11955729b33bd0ee57219719666d
Reviewed-on: https://chromium-review.googlesource.com/c/v8/v8/+/1745484
Commit-Queue: Michael Stanton <mvstanton@chromium.org>
Reviewed-by: 's avatarGeorg Neis <neis@chromium.org>
Cr-Commit-Position: refs/heads/master@{#63146}
parent ed72c237
......@@ -1929,52 +1929,56 @@ void BytecodeGraphBuilder::VisitCreateClosure() {
}
void BytecodeGraphBuilder::VisitCreateBlockContext() {
Handle<ScopeInfo> scope_info = Handle<ScopeInfo>::cast(
bytecode_iterator().GetConstantForIndexOperand(0, isolate()));
const Operator* op = javascript()->CreateBlockContext(scope_info);
DisallowHeapAccessIf no_heap_access(FLAG_concurrent_inlining);
ScopeInfoRef scope_info(
broker(), bytecode_iterator().GetConstantForIndexOperand(0, isolate()));
const Operator* op = javascript()->CreateBlockContext(scope_info.object());
Node* context = NewNode(op);
environment()->BindAccumulator(context);
}
void BytecodeGraphBuilder::VisitCreateFunctionContext() {
Handle<ScopeInfo> scope_info = Handle<ScopeInfo>::cast(
bytecode_iterator().GetConstantForIndexOperand(0, isolate()));
DisallowHeapAccessIf no_heap_access(FLAG_concurrent_inlining);
ScopeInfoRef scope_info(
broker(), bytecode_iterator().GetConstantForIndexOperand(0, isolate()));
uint32_t slots = bytecode_iterator().GetUnsignedImmediateOperand(1);
const Operator* op =
javascript()->CreateFunctionContext(scope_info, slots, FUNCTION_SCOPE);
const Operator* op = javascript()->CreateFunctionContext(
scope_info.object(), slots, FUNCTION_SCOPE);
Node* context = NewNode(op);
environment()->BindAccumulator(context);
}
void BytecodeGraphBuilder::VisitCreateEvalContext() {
Handle<ScopeInfo> scope_info = Handle<ScopeInfo>::cast(
bytecode_iterator().GetConstantForIndexOperand(0, isolate()));
DisallowHeapAccessIf no_heap_access(FLAG_concurrent_inlining);
ScopeInfoRef scope_info(
broker(), bytecode_iterator().GetConstantForIndexOperand(0, isolate()));
uint32_t slots = bytecode_iterator().GetUnsignedImmediateOperand(1);
const Operator* op =
javascript()->CreateFunctionContext(scope_info, slots, EVAL_SCOPE);
const Operator* op = javascript()->CreateFunctionContext(scope_info.object(),
slots, EVAL_SCOPE);
Node* context = NewNode(op);
environment()->BindAccumulator(context);
}
void BytecodeGraphBuilder::VisitCreateCatchContext() {
DisallowHeapAccessIf no_heap_access(FLAG_concurrent_inlining);
interpreter::Register reg = bytecode_iterator().GetRegisterOperand(0);
Node* exception = environment()->LookupRegister(reg);
Handle<ScopeInfo> scope_info = Handle<ScopeInfo>::cast(
bytecode_iterator().GetConstantForIndexOperand(1, isolate()));
ScopeInfoRef scope_info(
broker(), bytecode_iterator().GetConstantForIndexOperand(1, isolate()));
const Operator* op = javascript()->CreateCatchContext(scope_info);
const Operator* op = javascript()->CreateCatchContext(scope_info.object());
Node* context = NewNode(op, exception);
environment()->BindAccumulator(context);
}
void BytecodeGraphBuilder::VisitCreateWithContext() {
DisallowHeapAccessIf no_heap_access(FLAG_concurrent_inlining);
Node* object =
environment()->LookupRegister(bytecode_iterator().GetRegisterOperand(0));
Handle<ScopeInfo> scope_info = Handle<ScopeInfo>::cast(
bytecode_iterator().GetConstantForIndexOperand(1, isolate()));
ScopeInfoRef scope_info(
broker(), bytecode_iterator().GetConstantForIndexOperand(1, isolate()));
const Operator* op = javascript()->CreateWithContext(scope_info);
const Operator* op = javascript()->CreateWithContext(scope_info.object());
Node* context = NewNode(op, object);
environment()->BindAccumulator(context);
}
......
......@@ -47,7 +47,9 @@ Reduction JSHeapCopyReducer::Reduce(Node* node) {
break;
}
case IrOpcode::kJSCreateBlockContext: {
ScopeInfoRef(broker(), ScopeInfoOf(node->op()));
if (!FLAG_concurrent_inlining) {
ScopeInfoRef(broker(), ScopeInfoOf(node->op()));
}
break;
}
case IrOpcode::kJSCreateBoundFunction: {
......@@ -57,7 +59,9 @@ Reduction JSHeapCopyReducer::Reduce(Node* node) {
break;
}
case IrOpcode::kJSCreateCatchContext: {
ScopeInfoRef(broker(), ScopeInfoOf(node->op()));
if (!FLAG_concurrent_inlining) {
ScopeInfoRef(broker(), ScopeInfoOf(node->op()));
}
break;
}
case IrOpcode::kJSCreateClosure: {
......@@ -73,9 +77,11 @@ Reduction JSHeapCopyReducer::Reduce(Node* node) {
break;
}
case IrOpcode::kJSCreateFunctionContext: {
CreateFunctionContextParameters const& p =
CreateFunctionContextParametersOf(node->op());
ScopeInfoRef(broker(), p.scope_info());
if (!FLAG_concurrent_inlining) {
CreateFunctionContextParameters const& p =
CreateFunctionContextParametersOf(node->op());
ScopeInfoRef(broker(), p.scope_info());
}
break;
}
case IrOpcode::kJSCreateLiteralArray:
......@@ -90,7 +96,9 @@ Reduction JSHeapCopyReducer::Reduce(Node* node) {
break;
}
case IrOpcode::kJSCreateWithContext: {
ScopeInfoRef(broker(), ScopeInfoOf(node->op()));
if (!FLAG_concurrent_inlining) {
ScopeInfoRef(broker(), ScopeInfoOf(node->op()));
}
break;
}
case IrOpcode::kJSLoadNamed:
......
......@@ -407,7 +407,9 @@ class SerializerForBackgroundCompilation {
MapRef const& receiver_map, NameRef const& name, AccessMode mode,
base::Optional<JSObjectRef> receiver = base::nullopt);
void ProcessCreateContext();
void ProcessCreateContext(interpreter::BytecodeArrayIterator* iterator,
int scopeinfo_operand_index);
enum ContextProcessingMode {
kIgnoreSlot,
kSerializeSlot,
......@@ -1274,30 +1276,36 @@ void SerializerForBackgroundCompilation::VisitMov(
void SerializerForBackgroundCompilation::VisitCreateFunctionContext(
BytecodeArrayIterator* iterator) {
ProcessCreateContext();
ProcessCreateContext(iterator, 0);
}
void SerializerForBackgroundCompilation::VisitCreateBlockContext(
BytecodeArrayIterator* iterator) {
ProcessCreateContext();
ProcessCreateContext(iterator, 0);
}
void SerializerForBackgroundCompilation::VisitCreateEvalContext(
BytecodeArrayIterator* iterator) {
ProcessCreateContext();
ProcessCreateContext(iterator, 0);
}
void SerializerForBackgroundCompilation::VisitCreateWithContext(
BytecodeArrayIterator* iterator) {
ProcessCreateContext();
ProcessCreateContext(iterator, 1);
}
void SerializerForBackgroundCompilation::VisitCreateCatchContext(
BytecodeArrayIterator* iterator) {
ProcessCreateContext();
ProcessCreateContext(iterator, 1);
}
void SerializerForBackgroundCompilation::ProcessCreateContext() {
void SerializerForBackgroundCompilation::ProcessCreateContext(
interpreter::BytecodeArrayIterator* iterator, int scopeinfo_operand_index) {
Handle<ScopeInfo> scope_info =
Handle<ScopeInfo>::cast(iterator->GetConstantForIndexOperand(
scopeinfo_operand_index, broker()->isolate()));
ScopeInfoRef scope_info_ref(broker(), scope_info);
Hints& accumulator_hints = environment()->accumulator_hints();
accumulator_hints.Clear();
Hints& current_context_hints = environment()->current_context_hints();
......
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