Commit 386ff6e5 authored by Mike Stanton's avatar Mike Stanton Committed by Commit Bot

[TurboFan] Serializing context information

In TurboFan, context specialization is an optimization that tries to
either replace the load of a value from the context with a constant,
or if that can't be achieved, at least reduce the hops up the
context chain by starting a walk to the required depth from the
first constant context that it can reach.

Currently, this optimization is performed by looking into the
heap during a reducer pass. With fully concurrent TurboFan, we
need to instead gather information about contexts we may want
to perform this optimization on during serialization.

This CL adds functionality to the serializer to recognize and
model operations that affect the context register. We add to the
hinting structure already used by the serializer. There is
a new type of hint: a VirtualContext. This is a tuple consisting
of a handle to a Context, and a distance field that indicates how
far away in a to-be-realized chain this VirtualContext sits from
the context in the handle. For example:

bytecode stream:
...
CreateBlockContext
...

After a block context is created, the accumulator now contains
a VirtualContext Hint with a distance of 1 from any context hints
that we are keeping track of in the current context register.

More details in the design doc here:
https://docs.google.com/document/d/1Y0LKKCEenLWyAZTetoAIpKTZRCxaNdkYV8X1GaCax2A/edit?usp=sharing

Change-Id: I63732ebd106cc138fb1e9789d0676ece63e15d27
Bug: v8:7790
Reviewed-on: https://chromium-review.googlesource.com/c/v8/v8/+/1605941
Commit-Queue: Michael Stanton <mvstanton@chromium.org>
Reviewed-by: 's avatarGeorg Neis <neis@chromium.org>
Reviewed-by: 's avatarMaya Lekova <mslekova@chromium.org>
Cr-Commit-Position: refs/heads/master@{#62370}
parent 5de719d4
......@@ -144,9 +144,10 @@ Reduction JSContextSpecialization::ReduceJSLoadContext(Node* node) {
// Now walk up the concrete context chain for the remaining depth.
ContextRef concrete = maybe_concrete.value();
concrete.SerializeContextChain(); // TODO(neis): Remove later.
for (; depth > 0; --depth) {
concrete = concrete.previous();
concrete = concrete.previous(&depth);
if (depth > 0) {
TRACE_BROKER_MISSING(broker(), "previous value for context " << concrete);
return SimplifyJSLoadContext(node, jsgraph()->Constant(concrete), depth);
}
if (!access.immutable()) {
......@@ -157,8 +158,6 @@ Reduction JSContextSpecialization::ReduceJSLoadContext(Node* node) {
// This will hold the final value, if we can figure it out.
base::Optional<ObjectRef> maybe_value;
concrete.SerializeSlot(static_cast<int>(access.index()));
maybe_value = concrete.get(static_cast<int>(access.index()));
if (maybe_value.has_value() && !maybe_value->IsSmi()) {
// Even though the context slot is immutable, the context might have escaped
......@@ -174,6 +173,9 @@ Reduction JSContextSpecialization::ReduceJSLoadContext(Node* node) {
}
if (!maybe_value.has_value()) {
TRACE_BROKER_MISSING(broker(), "slot value " << access.index()
<< " for context "
<< concrete);
return SimplifyJSLoadContext(node, jsgraph()->Constant(concrete), depth);
}
......@@ -207,9 +209,10 @@ Reduction JSContextSpecialization::ReduceJSStoreContext(Node* node) {
// Now walk up the concrete context chain for the remaining depth.
ContextRef concrete = maybe_concrete.value();
concrete.SerializeContextChain(); // TODO(neis): Remove later.
for (; depth > 0; --depth) {
concrete = concrete.previous();
concrete = concrete.previous(&depth);
if (depth > 0) {
TRACE_BROKER_MISSING(broker(), "previous value for context " << concrete);
return SimplifyJSStoreContext(node, jsgraph()->Constant(concrete), depth);
}
return SimplifyJSStoreContext(node, jsgraph()->Constant(concrete), depth);
......
......@@ -531,7 +531,6 @@ class ContextData : public HeapObjectData {
void SerializeContextChain(JSHeapBroker* broker);
ContextData* previous() const {
CHECK(serialized_context_chain_);
return previous_;
}
......@@ -539,8 +538,10 @@ class ContextData : public HeapObjectData {
ObjectData* GetSlot(int index) {
auto search = slots_.find(index);
CHECK(search != slots_.end());
return search->second;
if (search != slots_.end()) {
return search->second;
}
return nullptr;
}
void SerializeScopeInfo(JSHeapBroker* broker);
......@@ -548,7 +549,6 @@ class ContextData : public HeapObjectData {
private:
ZoneMap<int, ObjectData*> slots_;
bool serialized_context_chain_ = false;
ContextData* previous_ = nullptr;
ScopeInfoData* scope_info_ = nullptr;
};
......@@ -558,15 +558,12 @@ ContextData::ContextData(JSHeapBroker* broker, ObjectData** storage,
: HeapObjectData(broker, storage, object), slots_(broker->zone()) {}
void ContextData::SerializeContextChain(JSHeapBroker* broker) {
if (serialized_context_chain_) return;
serialized_context_chain_ = true;
if (previous_ != nullptr) return;
TraceScope tracer(broker, this, "ContextData::SerializeContextChain");
Handle<Context> context = Handle<Context>::cast(object());
DCHECK_NULL(previous_);
// Context::previous DCHECK-fails when called on the native context.
if (!context->IsNativeContext()) {
TraceScope tracer(broker, this, "ContextData::SerializeContextChain");
previous_ = broker->GetOrCreateData(context->previous())->AsContext();
previous_->SerializeContextChain(broker);
}
......@@ -574,7 +571,7 @@ void ContextData::SerializeContextChain(JSHeapBroker* broker) {
void ContextData::SerializeSlot(JSHeapBroker* broker, int index) {
TraceScope tracer(broker, this, "ContextData::SerializeSlot");
TRACE(broker, "Serializing script context slot " << index);
TRACE(broker, "Serializing context slot " << index);
Handle<Context> context = Handle<Context>::cast(object());
CHECK(index >= 0 && index < context->length());
ObjectData* odata = broker->GetOrCreateData(context->get(index));
......@@ -1896,25 +1893,39 @@ bool ObjectRef::equals(const ObjectRef& other) const {
Isolate* ObjectRef::isolate() const { return broker()->isolate(); }
ContextRef ContextRef::previous() const {
ContextRef ContextRef::previous(size_t* depth) const {
DCHECK_NOT_NULL(depth);
DCHECK_GE(*depth, 0);
if (broker()->mode() == JSHeapBroker::kDisabled) {
AllowHandleAllocation handle_allocation;
AllowHandleDereference handle_dereference;
return ContextRef(broker(),
handle(object()->previous(), broker()->isolate()));
Context current = *object();
while (*depth != 0) {
current = current.previous();
(*depth)--;
}
return ContextRef(broker(), handle(current, broker()->isolate()));
}
ContextData* current = this->data()->AsContext();
while (*depth != 0 && current->previous() != nullptr) {
current = current->previous();
(*depth)--;
}
return ContextRef(broker(), data()->AsContext()->previous());
return ContextRef(broker(), current);
}
// Not needed for TypedLowering.
ObjectRef ContextRef::get(int index) const {
base::Optional<ObjectRef> ContextRef::get(int index) const {
if (broker()->mode() == JSHeapBroker::kDisabled) {
AllowHandleAllocation handle_allocation;
AllowHandleDereference handle_dereference;
Handle<Object> value(object()->get(index), broker()->isolate());
return ObjectRef(broker(), value);
}
return ObjectRef(broker(), data()->AsContext()->GetSlot(index));
ObjectData* optional_slot = data()->AsContext()->GetSlot(index);
if (optional_slot != nullptr) {
return ObjectRef(broker(), optional_slot);
}
return base::nullopt;
}
JSHeapBroker::JSHeapBroker(Isolate* isolate, Zone* broker_zone,
......@@ -2459,6 +2470,11 @@ bool AllocationSiteRef::IsFastLiteral() const {
return data()->AsAllocationSite()->IsFastLiteral();
}
void JSObjectRef::SerializeElements() {
CHECK_EQ(broker()->mode(), JSHeapBroker::kSerializing);
data()->AsJSObject()->SerializeElements(broker());
}
void JSObjectRef::EnsureElementsTenured() {
if (broker()->mode() == JSHeapBroker::kDisabled) {
AllowHandleAllocation allow_handle_allocation;
......@@ -2909,7 +2925,7 @@ MapRef NativeContextRef::GetFunctionMapFromIndex(int index) const {
DCHECK_GE(index, Context::FIRST_FUNCTION_MAP_INDEX);
DCHECK_LE(index, Context::LAST_FUNCTION_MAP_INDEX);
if (broker()->mode() == JSHeapBroker::kDisabled) {
return get(index).AsMap();
return get(index).value().AsMap();
}
return MapRef(broker(), data()->AsNativeContext()->function_maps().at(
index - Context::FIRST_FUNCTION_MAP_INDEX));
......
......@@ -229,6 +229,7 @@ class JSObjectRef : public HeapObjectRef {
ObjectRef RawFastPropertyAt(FieldIndex index) const;
FixedArrayBaseRef elements() const;
void SerializeElements();
void EnsureElementsTenured();
ElementsKind GetElementsKind() const;
......@@ -317,10 +318,14 @@ class ContextRef : public HeapObjectRef {
Handle<Context> object() const;
void SerializeContextChain();
ContextRef previous() const;
// {previous} decrements n by 1 for each previous link successfully
// followed. If depth != 0 on function return, then it only got
// partway to the desired depth.
ContextRef previous(size_t* depth) const;
void SerializeSlot(int index);
ObjectRef get(int index) const;
base::Optional<ObjectRef> get(int index) const;
// We only serialize the ScopeInfo if certain Promise
// builtins are called.
......
......@@ -12,6 +12,7 @@
#include "src/ic/call-optimization.h"
#include "src/interpreter/bytecode-array-iterator.h"
#include "src/objects/code.h"
#include "src/objects/js-array-inl.h"
#include "src/objects/shared-function-info-inl.h"
#include "src/zone/zone.h"
......@@ -21,16 +22,32 @@ namespace compiler {
using BytecodeArrayIterator = interpreter::BytecodeArrayIterator;
FunctionBlueprint::FunctionBlueprint(Handle<SharedFunctionInfo> shared,
Handle<FeedbackVector> feedback_vector,
const Hints& context_hints)
: shared_(shared),
feedback_vector_(feedback_vector),
context_hints_(context_hints) {}
FunctionBlueprint::FunctionBlueprint(Handle<JSFunction> function,
Isolate* isolate, Zone* zone)
: shared_(handle(function->shared(), isolate)),
feedback_vector_(handle(function->feedback_vector(), isolate)),
context_hints_(zone) {
context_hints_.AddConstant(handle(function->context(), isolate));
}
CompilationSubject::CompilationSubject(Handle<JSFunction> closure,
Isolate* isolate)
: blueprint_{handle(closure->shared(), isolate),
handle(closure->feedback_vector(), isolate)},
closure_(closure) {
Isolate* isolate, Zone* zone)
: blueprint_(closure, isolate, zone), closure_(closure) {
CHECK(closure->has_feedback_vector());
}
Hints::Hints(Zone* zone)
: constants_(zone), maps_(zone), function_blueprints_(zone) {}
: virtual_contexts_(zone),
constants_(zone),
maps_(zone),
function_blueprints_(zone) {}
#ifdef ENABLE_SLOW_DCHECKS
namespace {
......@@ -59,6 +76,14 @@ const BlueprintsSet& Hints::function_blueprints() const {
return function_blueprints_;
}
const VirtualContextsSet& Hints::virtual_contexts() const {
return virtual_contexts_;
}
void Hints::AddVirtualContext(VirtualContext virtual_context) {
virtual_contexts_.insert(virtual_context);
}
void Hints::AddConstant(Handle<Object> constant) {
constants_.insert(constant);
}
......@@ -73,16 +98,29 @@ void Hints::Add(const Hints& other) {
for (auto x : other.constants()) AddConstant(x);
for (auto x : other.maps()) AddMap(x);
for (auto x : other.function_blueprints()) AddFunctionBlueprint(x);
for (auto x : other.virtual_contexts()) AddVirtualContext(x);
}
bool Hints::IsEmpty() const {
return constants().empty() && maps().empty() && function_blueprints().empty();
return constants().empty() && maps().empty() &&
function_blueprints().empty() && virtual_contexts().empty();
}
std::ostream& operator<<(std::ostream& out,
const VirtualContext& virtual_context) {
out << "Distance " << virtual_context.distance << " from "
<< Brief(*virtual_context.context) << std::endl;
return out;
}
std::ostream& operator<<(std::ostream& out, const Hints& hints);
std::ostream& operator<<(std::ostream& out,
const FunctionBlueprint& blueprint) {
out << Brief(*blueprint.shared) << std::endl;
out << Brief(*blueprint.feedback_vector) << std::endl;
out << Brief(*blueprint.shared()) << std::endl;
out << Brief(*blueprint.feedback_vector()) << std::endl;
!blueprint.context_hints().IsEmpty() && out << blueprint.context_hints()
<< "):" << std::endl;
return out;
}
......@@ -96,10 +134,14 @@ std::ostream& operator<<(std::ostream& out, const Hints& hints) {
for (FunctionBlueprint const& blueprint : hints.function_blueprints()) {
out << " blueprint " << blueprint << std::endl;
}
for (VirtualContext const& virtual_context : hints.virtual_contexts()) {
out << " virtual context " << virtual_context << std::endl;
}
return out;
}
void Hints::Clear() {
virtual_contexts_.clear();
constants_.clear();
maps_.clear();
function_blueprints_.clear();
......@@ -132,6 +174,8 @@ class SerializerForBackgroundCompilation::Environment : public ZoneObject {
FunctionBlueprint function() const { return function_; }
Hints const& closure_hints() const { return closure_hints_; }
Hints const& current_context_hints() const { return current_context_hints_; }
Hints& current_context_hints() { return current_context_hints_; }
Hints const& return_value_hints() const { return return_value_hints_; }
Hints& return_value_hints() { return return_value_hints_; }
......@@ -139,14 +183,17 @@ class SerializerForBackgroundCompilation::Environment : public ZoneObject {
CHECK_LT(accumulator_index(), ephemeral_hints_.size());
return ephemeral_hints_[accumulator_index()];
}
Hints& register_hints(interpreter::Register reg) {
if (reg.is_function_closure()) return closure_hints_;
if (reg.is_current_context()) return current_context_hints_;
int local_index = RegisterToLocalIndex(reg);
CHECK_LT(local_index, ephemeral_hints_.size());
return ephemeral_hints_[local_index];
}
// Clears all hints except those for the return value and the closure.
// Clears all hints except those for the context, return value, and the
// closure.
void ClearEphemeralHints() {
for (auto& hints : ephemeral_hints_) hints.Clear();
}
......@@ -172,25 +219,27 @@ class SerializerForBackgroundCompilation::Environment : public ZoneObject {
int const register_count_;
Hints closure_hints_;
Hints current_context_hints_;
Hints return_value_hints_;
// ephemeral_hints_ contains hints for the contents of the registers,
// the accumulator and the parameters. The layout is as follows:
// [ parameters | registers | accumulator | context ]
// [ parameters | registers | accumulator ]
// The first parameter is the receiver.
HintsVector ephemeral_hints_;
int accumulator_index() const { return parameter_count() + register_count(); }
int current_context_index() const { return accumulator_index() + 1; }
int ephemeral_hints_size() const { return current_context_index() + 1; }
int ephemeral_hints_size() const { return accumulator_index() + 1; }
};
SerializerForBackgroundCompilation::Environment::Environment(
Zone* zone, CompilationSubject function)
: zone_(zone),
function_(function.blueprint()),
parameter_count_(function_.shared->GetBytecodeArray().parameter_count()),
register_count_(function_.shared->GetBytecodeArray().register_count()),
parameter_count_(
function_.shared()->GetBytecodeArray().parameter_count()),
register_count_(function_.shared()->GetBytecodeArray().register_count()),
closure_hints_(zone),
current_context_hints_(zone),
return_value_hints_(zone),
ephemeral_hints_(ephemeral_hints_size(), Hints(zone), zone) {
Handle<JSFunction> closure;
......@@ -199,6 +248,9 @@ SerializerForBackgroundCompilation::Environment::Environment(
} else {
closure_hints_.AddFunctionBlueprint(function.blueprint());
}
// Consume blueprint context hint information.
current_context_hints().Add(function.blueprint().context_hints());
}
SerializerForBackgroundCompilation::Environment::Environment(
......@@ -220,7 +272,8 @@ SerializerForBackgroundCompilation::Environment::Environment(
}
interpreter::Register new_target_reg =
function_.shared->GetBytecodeArray()
function_.shared()
->GetBytecodeArray()
.incoming_new_target_or_generator_register();
if (new_target_reg.is_valid()) {
DCHECK(register_hints(new_target_reg).IsEmpty());
......@@ -258,6 +311,8 @@ std::ostream& operator<<(
std::ostream& out,
const SerializerForBackgroundCompilation::Environment& env) {
std::ostringstream output_stream;
output_stream << "Function ";
env.function_.shared()->Name().Print(output_stream);
if (env.IsDead()) {
output_stream << "dead\n";
......@@ -272,8 +327,6 @@ std::ostream& operator<<(
output_stream << "Hints for r" << i << ":\n";
} else if (i == env.accumulator_index()) {
output_stream << "Hints for <accumulator>:\n";
} else if (i == env.current_context_index()) {
output_stream << "Hints for <context>:\n";
} else {
UNREACHABLE();
}
......@@ -285,6 +338,9 @@ std::ostream& operator<<(
if (!env.closure_hints().IsEmpty()) {
output_stream << "Hints for <closure>:\n" << env.closure_hints();
}
if (!env.current_context_hints().IsEmpty()) {
output_stream << "Hints for <context>:\n" << env.current_context_hints();
}
if (!env.return_value_hints().IsEmpty()) {
output_stream << "Hints for {return value}:\n" << env.return_value_hints();
}
......@@ -295,8 +351,6 @@ std::ostream& operator<<(
int SerializerForBackgroundCompilation::Environment::RegisterToLocalIndex(
interpreter::Register reg) const {
// TODO(mslekova): We also want to gather hints for the context.
if (reg.is_current_context()) return current_context_index();
if (reg.is_parameter()) {
return reg.ToParameterIndex(parameter_count());
} else {
......@@ -311,7 +365,8 @@ SerializerForBackgroundCompilation::SerializerForBackgroundCompilation(
: broker_(broker),
dependencies_(dependencies),
zone_(zone),
environment_(new (zone) Environment(zone, {closure, broker_->isolate()})),
environment_(new (zone) Environment(
zone, CompilationSubject(closure, broker_->isolate(), zone))),
jump_target_environments_(zone),
flags_(flags) {
JSFunctionRef(broker, closure).Serialize();
......@@ -351,7 +406,7 @@ bool SerializerForBackgroundCompilation::BailoutOnUninitialized(
// OSR entry point. TODO(neis): Support OSR?
return false;
}
FeedbackNexus nexus(environment()->function().feedback_vector, slot);
FeedbackNexus nexus(environment()->function().feedback_vector(), slot);
if (!slot.IsInvalid() && nexus.IsUninitialized()) {
FeedbackSource source(nexus);
if (broker()->HasFeedback(source)) {
......@@ -369,9 +424,9 @@ bool SerializerForBackgroundCompilation::BailoutOnUninitialized(
Hints SerializerForBackgroundCompilation::Run() {
TraceScope tracer(broker(), this, "SerializerForBackgroundCompilation::Run");
SharedFunctionInfoRef shared(broker(), environment()->function().shared);
FeedbackVectorRef feedback_vector(broker(),
environment()->function().feedback_vector);
SharedFunctionInfoRef shared(broker(), environment()->function().shared());
FeedbackVectorRef feedback_vector(
broker(), environment()->function().feedback_vector());
if (shared.IsSerializedForCompilation(feedback_vector)) {
TRACE_BROKER(broker(), "Already ran serializer for SharedFunctionInfo "
<< Brief(*shared.object())
......@@ -425,7 +480,7 @@ class ExceptionHandlerMatcher {
void SerializerForBackgroundCompilation::TraverseBytecode() {
BytecodeArrayRef bytecode_array(
broker(), handle(environment()->function().shared->GetBytecodeArray(),
broker(), handle(environment()->function().shared()->GetBytecodeArray(),
broker()->isolate()));
BytecodeArrayIterator iterator(bytecode_array.object());
ExceptionHandlerMatcher handler_matcher(iterator, bytecode_array.object());
......@@ -537,6 +592,157 @@ void SerializerForBackgroundCompilation::VisitLdaConstant(
iterator->GetConstantForIndexOperand(0, broker()->isolate()));
}
void SerializerForBackgroundCompilation::VisitPushContext(
BytecodeArrayIterator* iterator) {
// Transfer current context hints to the destination register hints.
Hints& current_context_hints = environment()->current_context_hints();
Hints& saved_context_hints =
environment()->register_hints(iterator->GetRegisterOperand(0));
saved_context_hints.Clear();
saved_context_hints.Add(current_context_hints);
// New Context is in the accumulator. Put those hints into the current context
// register hints.
current_context_hints.Clear();
current_context_hints.Add(environment()->accumulator_hints());
}
void SerializerForBackgroundCompilation::VisitPopContext(
BytecodeArrayIterator* iterator) {
// Replace current context hints with hints given in the argument register.
Hints& new_context_hints =
environment()->register_hints(iterator->GetRegisterOperand(0));
environment()->current_context_hints().Clear();
environment()->current_context_hints().Add(new_context_hints);
}
void SerializerForBackgroundCompilation::ProcessImmutableLoad(
ContextRef& context_ref, int slot, ContextProcessingMode mode) {
DCHECK(mode == kSerializeSlot || mode == kSerializeSlotAndAddToAccumulator);
context_ref.SerializeSlot(slot);
// Also, put the object into the constant hints for the accumulator.
if (mode == kSerializeSlotAndAddToAccumulator) {
Handle<Object> slot_value(context_ref.object()->get(slot),
broker()->isolate());
environment()->accumulator_hints().AddConstant(slot_value);
}
}
void SerializerForBackgroundCompilation::ProcessContextAccess(
const Hints& context_hints, int slot, int depth,
ContextProcessingMode mode) {
// This function is for JSContextSpecialization::ReduceJSLoadContext and
// ReduceJSStoreContext. Those reductions attempt to eliminate as many
// loads as possible by making use of constant Context objects. In the
// case of an immutable load, ReduceJSLoadContext even attempts to load
// the value at {slot}, replacing the load with a constant.
for (auto x : context_hints.constants()) {
if (x->IsContext()) {
// Walk this context to the given depth and serialize the slot found.
ContextRef context_ref(broker(), x);
// TODO(mvstanton): Add a depth parameter to SerializeContextChain.
context_ref.SerializeContextChain();
if (mode != kIgnoreSlot) {
size_t remaining_depth = depth;
context_ref = context_ref.previous(&remaining_depth);
if (remaining_depth == 0) {
ProcessImmutableLoad(context_ref, slot, mode);
}
}
}
}
for (auto x : context_hints.virtual_contexts()) {
if (x.distance <= static_cast<unsigned int>(depth)) {
ContextRef context_ref(broker(), x.context);
// TODO(mvstanton): Add a depth parameter to SerializeContextChain.
context_ref.SerializeContextChain();
if (mode != kIgnoreSlot) {
size_t remaining_depth = depth - x.distance;
context_ref = context_ref.previous(&remaining_depth);
if (remaining_depth == 0) {
ProcessImmutableLoad(context_ref, slot, mode);
}
}
}
}
}
void SerializerForBackgroundCompilation::VisitLdaContextSlot(
BytecodeArrayIterator* iterator) {
Hints& context_hints =
environment()->register_hints(iterator->GetRegisterOperand(0));
const int slot = iterator->GetIndexOperand(1);
const int depth = iterator->GetUnsignedImmediateOperand(2);
environment()->accumulator_hints().Clear();
ProcessContextAccess(context_hints, slot, depth, kIgnoreSlot);
}
void SerializerForBackgroundCompilation::VisitLdaCurrentContextSlot(
BytecodeArrayIterator* iterator) {
const int slot = iterator->GetIndexOperand(0);
const int depth = 0;
Hints& context_hints = environment()->current_context_hints();
environment()->accumulator_hints().Clear();
ProcessContextAccess(context_hints, slot, depth, kIgnoreSlot);
}
void SerializerForBackgroundCompilation::VisitLdaImmutableContextSlot(
BytecodeArrayIterator* iterator) {
const int slot = iterator->GetIndexOperand(1);
const int depth = iterator->GetUnsignedImmediateOperand(2);
Hints& context_hints =
environment()->register_hints(iterator->GetRegisterOperand(0));
environment()->accumulator_hints().Clear();
ProcessContextAccess(context_hints, slot, depth,
kSerializeSlotAndAddToAccumulator);
}
void SerializerForBackgroundCompilation::VisitLdaImmutableCurrentContextSlot(
BytecodeArrayIterator* iterator) {
const int slot = iterator->GetIndexOperand(0);
const int depth = 0;
Hints& context_hints = environment()->current_context_hints();
environment()->accumulator_hints().Clear();
ProcessContextAccess(context_hints, slot, depth,
kSerializeSlotAndAddToAccumulator);
}
void SerializerForBackgroundCompilation::VisitLdaModuleVariable(
BytecodeArrayIterator* iterator) {
const int depth = iterator->GetUnsignedImmediateOperand(1);
// TODO(mvstanton): If we have a constant module, should we serialize the
// cell as well? Then we could put the value in the accumulator.
environment()->accumulator_hints().Clear();
ProcessContextAccess(environment()->current_context_hints(),
Context::EXTENSION_INDEX, depth, kSerializeSlot);
}
void SerializerForBackgroundCompilation::VisitStaModuleVariable(
BytecodeArrayIterator* iterator) {
const int depth = iterator->GetUnsignedImmediateOperand(1);
ProcessContextAccess(environment()->current_context_hints(),
Context::EXTENSION_INDEX, depth, kSerializeSlot);
}
void SerializerForBackgroundCompilation::VisitStaContextSlot(
BytecodeArrayIterator* iterator) {
const int slot = iterator->GetIndexOperand(1);
const int depth = iterator->GetUnsignedImmediateOperand(2);
Hints& register_hints =
environment()->register_hints(iterator->GetRegisterOperand(0));
ProcessContextAccess(register_hints, slot, depth, kIgnoreSlot);
}
void SerializerForBackgroundCompilation::VisitStaCurrentContextSlot(
BytecodeArrayIterator* iterator) {
const int slot = iterator->GetIndexOperand(0);
const int depth = 0;
Hints& context_hints = environment()->current_context_hints();
ProcessContextAccess(context_hints, slot, depth, kIgnoreSlot);
}
void SerializerForBackgroundCompilation::VisitLdar(
BytecodeArrayIterator* iterator) {
environment()->accumulator_hints().Clear();
......@@ -559,13 +765,60 @@ void SerializerForBackgroundCompilation::VisitMov(
environment()->register_hints(dst).Add(environment()->register_hints(src));
}
void SerializerForBackgroundCompilation::VisitCreateFunctionContext(
BytecodeArrayIterator* iterator) {
ProcessCreateContext();
}
void SerializerForBackgroundCompilation::VisitCreateBlockContext(
BytecodeArrayIterator* iterator) {
ProcessCreateContext();
}
void SerializerForBackgroundCompilation::VisitCreateEvalContext(
BytecodeArrayIterator* iterator) {
ProcessCreateContext();
}
void SerializerForBackgroundCompilation::VisitCreateWithContext(
BytecodeArrayIterator* iterator) {
ProcessCreateContext();
}
void SerializerForBackgroundCompilation::VisitCreateCatchContext(
BytecodeArrayIterator* iterator) {
ProcessCreateContext();
}
void SerializerForBackgroundCompilation::ProcessCreateContext() {
Hints& accumulator_hints = environment()->accumulator_hints();
accumulator_hints.Clear();
Hints& current_context_hints = environment()->current_context_hints();
// For each constant context, we must create a virtual context from
// it of distance one.
for (auto x : current_context_hints.constants()) {
if (x->IsContext()) {
Handle<Context> as_context(Handle<Context>::cast(x));
accumulator_hints.AddVirtualContext(VirtualContext(1, as_context));
}
}
// For each virtual context, we must create a virtual context from
// it of distance {existing distance} + 1.
for (auto x : current_context_hints.virtual_contexts()) {
accumulator_hints.AddVirtualContext(
VirtualContext(x.distance + 1, x.context));
}
}
void SerializerForBackgroundCompilation::VisitCreateClosure(
BytecodeArrayIterator* iterator) {
Handle<SharedFunctionInfo> shared = Handle<SharedFunctionInfo>::cast(
iterator->GetConstantForIndexOperand(0, broker()->isolate()));
Handle<FeedbackCell> feedback_cell =
environment()->function().feedback_vector->GetClosureFeedbackCell(
environment()->function().feedback_vector()->GetClosureFeedbackCell(
iterator->GetIndexOperand(1));
FeedbackCellRef feedback_cell_ref(broker(), feedback_cell);
Handle<Object> cell_value(feedback_cell->value(), broker()->isolate());
......@@ -573,8 +826,13 @@ void SerializerForBackgroundCompilation::VisitCreateClosure(
environment()->accumulator_hints().Clear();
if (cell_value->IsFeedbackVector()) {
environment()->accumulator_hints().AddFunctionBlueprint(
{shared, Handle<FeedbackVector>::cast(cell_value)});
// Gather the context hints from the current context register hint
// structure.
FunctionBlueprint blueprint(shared,
Handle<FeedbackVector>::cast(cell_value),
environment()->current_context_hints());
environment()->accumulator_hints().AddFunctionBlueprint(blueprint);
}
}
......@@ -685,6 +943,16 @@ void SerializerForBackgroundCompilation::VisitCallWithSpread(
ProcessCallVarArgs(iterator, ConvertReceiverMode::kAny, true);
}
void SerializerForBackgroundCompilation::VisitCallJSRuntime(
BytecodeArrayIterator* iterator) {
environment()->accumulator_hints().Clear();
// BytecodeGraphBuilder::VisitCallJSRuntime needs the {runtime_index}
// slot in the native context to be serialized.
const int runtime_index = iterator->GetNativeContextIndexOperand(0);
broker()->native_context().SerializeSlot(runtime_index);
}
Hints SerializerForBackgroundCompilation::RunChildSerializer(
CompilationSubject function, base::Optional<Hints> new_target,
const HintsVector& arguments, bool with_spread) {
......@@ -700,7 +968,7 @@ Hints SerializerForBackgroundCompilation::RunChildSerializer(
padded.pop_back(); // Remove the spread element.
// Fill the rest with empty hints.
padded.resize(
function.blueprint().shared->GetBytecodeArray().parameter_count(),
function.blueprint().shared()->GetBytecodeArray().parameter_count(),
Hints(zone()));
return RunChildSerializer(function, new_target, padded, false);
}
......@@ -734,7 +1002,7 @@ void SerializerForBackgroundCompilation::ProcessCallOrConstruct(
// Incorporate feedback into hints.
base::Optional<HeapObjectRef> feedback = GetHeapObjectFeedback(
broker(), environment()->function().feedback_vector, slot);
broker(), environment()->function().feedback_vector(), slot);
if (feedback.has_value() && feedback->map().is_callable()) {
if (new_target.has_value()) {
// Construct; feedback is new_target, which often is also the callee.
......@@ -765,11 +1033,12 @@ void SerializerForBackgroundCompilation::ProcessCallOrConstruct(
if (!shared->IsInlineable() || !function->has_feedback_vector()) continue;
environment()->accumulator_hints().Add(RunChildSerializer(
{function, broker()->isolate()}, new_target, arguments, with_spread));
CompilationSubject(function, broker()->isolate(), zone()), new_target,
arguments, with_spread));
}
for (auto hint : callee.function_blueprints()) {
Handle<SharedFunctionInfo> shared = hint.shared;
Handle<SharedFunctionInfo> shared = hint.shared();
if (shared->IsApiFunction()) {
ProcessApiCall(shared, arguments);
......@@ -1009,8 +1278,8 @@ GlobalAccessFeedback const*
SerializerForBackgroundCompilation::ProcessFeedbackForGlobalAccess(
FeedbackSlot slot) {
if (slot.IsInvalid()) return nullptr;
if (environment()->function().feedback_vector.is_null()) return nullptr;
FeedbackSource source(environment()->function().feedback_vector, slot);
if (environment()->function().feedback_vector().is_null()) return nullptr;
FeedbackSource source(environment()->function().feedback_vector(), slot);
if (broker()->HasFeedback(source)) {
return broker()->GetGlobalAccessFeedback(source);
......@@ -1042,14 +1311,31 @@ void SerializerForBackgroundCompilation::VisitLdaGlobalInsideTypeof(
VisitLdaGlobal(iterator);
}
void SerializerForBackgroundCompilation::VisitLdaLookupGlobalSlot(
void SerializerForBackgroundCompilation::ProcessCheckContextExtensions(
int depth) {
// for BytecodeGraphBuilder::CheckContextExtensions.
Hints& context_hints = environment()->current_context_hints();
for (int i = 0; i < depth; i++) {
ProcessContextAccess(context_hints, Context::EXTENSION_INDEX, i,
kSerializeSlot);
}
}
void SerializerForBackgroundCompilation::ProcessLdaLookupGlobalSlot(
BytecodeArrayIterator* iterator) {
ProcessCheckContextExtensions(iterator->GetUnsignedImmediateOperand(2));
// TODO(neis): BytecodeGraphBilder may insert a JSLoadGlobal.
VisitLdaGlobal(iterator);
}
void SerializerForBackgroundCompilation::VisitLdaLookupGlobalSlot(
BytecodeArrayIterator* iterator) {
ProcessLdaLookupGlobalSlot(iterator);
}
void SerializerForBackgroundCompilation::VisitLdaLookupGlobalSlotInsideTypeof(
BytecodeArrayIterator* iterator) {
VisitLdaGlobal(iterator);
ProcessLdaLookupGlobalSlot(iterator);
}
void SerializerForBackgroundCompilation::VisitStaGlobal(
......@@ -1058,6 +1344,26 @@ void SerializerForBackgroundCompilation::VisitStaGlobal(
ProcessFeedbackForGlobalAccess(slot);
}
void SerializerForBackgroundCompilation::ProcessLdaLookupContextSlot(
BytecodeArrayIterator* iterator) {
const int slot_index = iterator->GetIndexOperand(1);
const int depth = iterator->GetUnsignedImmediateOperand(2);
ProcessCheckContextExtensions(depth);
Hints& context_hints = environment()->current_context_hints();
environment()->accumulator_hints().Clear();
ProcessContextAccess(context_hints, slot_index, depth, kIgnoreSlot);
}
void SerializerForBackgroundCompilation::VisitLdaLookupContextSlot(
BytecodeArrayIterator* iterator) {
ProcessLdaLookupContextSlot(iterator);
}
void SerializerForBackgroundCompilation::VisitLdaLookupContextSlotInsideTypeof(
BytecodeArrayIterator* iterator) {
ProcessLdaLookupContextSlot(iterator);
}
namespace {
template <class MapContainer>
MapHandles GetRelevantReceiverMaps(Isolate* isolate, MapContainer const& maps) {
......@@ -1141,9 +1447,9 @@ SerializerForBackgroundCompilation::ProcessFeedbackMapsForNamedAccess(
void SerializerForBackgroundCompilation::ProcessFeedbackForPropertyAccess(
FeedbackSlot slot, AccessMode mode, base::Optional<NameRef> static_name) {
if (slot.IsInvalid()) return;
if (environment()->function().feedback_vector.is_null()) return;
if (environment()->function().feedback_vector().is_null()) return;
FeedbackNexus nexus(environment()->function().feedback_vector, slot);
FeedbackNexus nexus(environment()->function().feedback_vector(), slot);
FeedbackSource source(nexus);
if (broker()->HasFeedback(source)) return;
......
......@@ -31,17 +31,9 @@ class Zone;
namespace compiler {
#define CLEAR_ENVIRONMENT_LIST(V) \
V(CallRuntime) \
V(CallRuntimeForPair) \
V(CreateBlockContext) \
V(CreateEvalContext) \
V(CreateFunctionContext) \
V(Debugger) \
V(PopContext) \
V(PushContext) \
V(ResumeGenerator) \
V(StaContextSlot) \
V(StaCurrentContextSlot) \
V(SuspendGenerator) \
V(SwitchOnGeneratorState)
......@@ -50,74 +42,75 @@ namespace compiler {
V(ReThrow) \
V(Throw)
#define CLEAR_ACCUMULATOR_LIST(V) \
V(Add) \
V(AddSmi) \
V(BitwiseAnd) \
V(BitwiseAndSmi) \
V(BitwiseNot) \
V(BitwiseOr) \
V(BitwiseOrSmi) \
V(BitwiseXor) \
V(BitwiseXorSmi) \
V(CloneObject) \
V(CreateArrayFromIterable) \
V(CreateArrayLiteral) \
V(CreateEmptyArrayLiteral) \
V(CreateEmptyObjectLiteral) \
V(CreateMappedArguments) \
V(CreateObjectLiteral) \
V(CreateRestParameter) \
V(CreateUnmappedArguments) \
V(Dec) \
V(DeletePropertySloppy) \
V(DeletePropertyStrict) \
V(Div) \
V(DivSmi) \
V(Exp) \
V(ExpSmi) \
V(ForInContinue) \
V(ForInEnumerate) \
V(ForInNext) \
V(ForInStep) \
V(GetTemplateObject) \
V(Inc) \
V(LdaContextSlot) \
V(LdaCurrentContextSlot) \
V(LdaImmutableContextSlot) \
V(LdaImmutableCurrentContextSlot) \
V(LogicalNot) \
V(Mod) \
V(ModSmi) \
V(Mul) \
V(MulSmi) \
V(Negate) \
V(SetPendingMessage) \
V(ShiftLeft) \
V(ShiftLeftSmi) \
V(ShiftRight) \
V(ShiftRightLogical) \
V(ShiftRightLogicalSmi) \
V(ShiftRightSmi) \
V(Sub) \
V(SubSmi) \
V(TestEqual) \
V(TestEqualStrict) \
V(TestGreaterThan) \
V(TestGreaterThanOrEqual) \
V(TestInstanceOf) \
V(TestLessThan) \
V(TestLessThanOrEqual) \
V(TestNull) \
V(TestReferenceEqual) \
V(TestTypeOf) \
V(TestUndefined) \
V(TestUndetectable) \
V(ToBooleanLogicalNot) \
V(ToName) \
V(ToNumber) \
V(ToNumeric) \
V(ToString) \
#define CLEAR_ACCUMULATOR_LIST(V) \
V(Add) \
V(AddSmi) \
V(BitwiseAnd) \
V(BitwiseAndSmi) \
V(BitwiseNot) \
V(BitwiseOr) \
V(BitwiseOrSmi) \
V(BitwiseXor) \
V(BitwiseXorSmi) \
V(CallRuntime) \
V(CloneObject) \
V(CreateArrayFromIterable) \
V(CreateArrayLiteral) \
V(CreateEmptyArrayLiteral) \
V(CreateEmptyObjectLiteral) \
V(CreateMappedArguments) \
V(CreateObjectLiteral) \
V(CreateRegExpLiteral) \
V(CreateRestParameter) \
V(CreateUnmappedArguments) \
V(Dec) \
V(DeletePropertySloppy) \
V(DeletePropertyStrict) \
V(Div) \
V(DivSmi) \
V(Exp) \
V(ExpSmi) \
V(ForInContinue) \
V(ForInEnumerate) \
V(ForInNext) \
V(ForInStep) \
V(GetTemplateObject) \
V(Inc) \
V(LdaLookupSlot) \
V(LdaLookupSlotInsideTypeof) \
V(LogicalNot) \
V(Mod) \
V(ModSmi) \
V(Mul) \
V(MulSmi) \
V(Negate) \
V(SetPendingMessage) \
V(ShiftLeft) \
V(ShiftLeftSmi) \
V(ShiftRight) \
V(ShiftRightLogical) \
V(ShiftRightLogicalSmi) \
V(ShiftRightSmi) \
V(StaLookupSlot) \
V(Sub) \
V(SubSmi) \
V(TestEqual) \
V(TestEqualStrict) \
V(TestGreaterThan) \
V(TestGreaterThanOrEqual) \
V(TestInstanceOf) \
V(TestLessThan) \
V(TestLessThanOrEqual) \
V(TestNull) \
V(TestReferenceEqual) \
V(TestTypeOf) \
V(TestUndefined) \
V(TestUndetectable) \
V(ToBooleanLogicalNot) \
V(ToName) \
V(ToNumber) \
V(ToNumeric) \
V(ToString) \
V(TypeOf)
#define UNCONDITIONAL_JUMPS_LIST(V) \
......@@ -147,6 +140,7 @@ namespace compiler {
#define IGNORED_BYTECODE_LIST(V) \
V(CallNoFeedback) \
V(IncBlockCounter) \
V(LdaNamedPropertyNoFeedback) \
V(StackCheck) \
V(StaNamedPropertyNoFeedback) \
......@@ -159,52 +153,70 @@ namespace compiler {
V(Illegal) \
V(Wide)
#define SUPPORTED_BYTECODE_LIST(V) \
V(CallAnyReceiver) \
V(CallProperty) \
V(CallProperty0) \
V(CallProperty1) \
V(CallProperty2) \
V(CallUndefinedReceiver) \
V(CallUndefinedReceiver0) \
V(CallUndefinedReceiver1) \
V(CallUndefinedReceiver2) \
V(CallWithSpread) \
V(Construct) \
V(ConstructWithSpread) \
V(CreateClosure) \
V(GetSuperConstructor) \
V(LdaConstant) \
V(LdaFalse) \
V(LdaGlobal) \
V(LdaGlobalInsideTypeof) \
V(LdaKeyedProperty) \
V(LdaLookupGlobalSlot) \
V(LdaLookupGlobalSlotInsideTypeof) \
V(LdaNamedProperty) \
V(LdaNull) \
V(Ldar) \
V(LdaSmi) \
V(LdaTheHole) \
V(LdaTrue) \
V(LdaUndefined) \
V(LdaZero) \
V(Mov) \
V(Return) \
V(StaGlobal) \
V(StaInArrayLiteral) \
V(StaKeyedProperty) \
V(StaNamedOwnProperty) \
V(StaNamedProperty) \
V(Star) \
V(SwitchOnSmiNoFeedback) \
V(TestIn) \
CLEAR_ACCUMULATOR_LIST(V) \
CLEAR_ENVIRONMENT_LIST(V) \
CONDITIONAL_JUMPS_LIST(V) \
IGNORED_BYTECODE_LIST(V) \
KILL_ENVIRONMENT_LIST(V) \
UNCONDITIONAL_JUMPS_LIST(V) \
#define SUPPORTED_BYTECODE_LIST(V) \
V(CallAnyReceiver) \
V(CallJSRuntime) \
V(CallProperty) \
V(CallProperty0) \
V(CallProperty1) \
V(CallProperty2) \
V(CallUndefinedReceiver) \
V(CallUndefinedReceiver0) \
V(CallUndefinedReceiver1) \
V(CallUndefinedReceiver2) \
V(CallWithSpread) \
V(Construct) \
V(ConstructWithSpread) \
V(CreateBlockContext) \
V(CreateCatchContext) \
V(CreateClosure) \
V(CreateEvalContext) \
V(CreateFunctionContext) \
V(CreateWithContext) \
V(GetSuperConstructor) \
V(LdaConstant) \
V(LdaContextSlot) \
V(LdaCurrentContextSlot) \
V(LdaImmutableContextSlot) \
V(LdaImmutableCurrentContextSlot) \
V(LdaModuleVariable) \
V(LdaFalse) \
V(LdaGlobal) \
V(LdaGlobalInsideTypeof) \
V(LdaKeyedProperty) \
V(LdaLookupContextSlot) \
V(LdaLookupContextSlotInsideTypeof) \
V(LdaLookupGlobalSlot) \
V(LdaLookupGlobalSlotInsideTypeof) \
V(LdaNamedProperty) \
V(LdaNull) \
V(Ldar) \
V(LdaSmi) \
V(LdaTheHole) \
V(LdaTrue) \
V(LdaUndefined) \
V(LdaZero) \
V(Mov) \
V(PopContext) \
V(PushContext) \
V(Return) \
V(StaContextSlot) \
V(StaCurrentContextSlot) \
V(StaGlobal) \
V(StaInArrayLiteral) \
V(StaKeyedProperty) \
V(StaModuleVariable) \
V(StaNamedOwnProperty) \
V(StaNamedProperty) \
V(Star) \
V(SwitchOnSmiNoFeedback) \
V(TestIn) \
CLEAR_ACCUMULATOR_LIST(V) \
CLEAR_ENVIRONMENT_LIST(V) \
CONDITIONAL_JUMPS_LIST(V) \
IGNORED_BYTECODE_LIST(V) \
KILL_ENVIRONMENT_LIST(V) \
UNCONDITIONAL_JUMPS_LIST(V) \
UNREACHABLE_BYTECODE_LIST(V)
class JSHeapBroker;
......@@ -216,35 +228,23 @@ struct HandleComparator {
}
};
struct FunctionBlueprint {
Handle<SharedFunctionInfo> shared;
Handle<FeedbackVector> feedback_vector;
struct VirtualContext {
unsigned int distance;
Handle<Context> context;
bool operator<(const FunctionBlueprint& other) const {
// A feedback vector is never used for more than one SFI, so it can
// be used for strict ordering of blueprints.
DCHECK_IMPLIES(feedback_vector.equals(other.feedback_vector),
shared.equals(other.shared));
return HandleComparator<FeedbackVector>()(feedback_vector,
other.feedback_vector);
VirtualContext(unsigned int distance_in, Handle<Context> context_in)
: distance(distance_in), context(context_in) {
CHECK_GT(distance, 0);
}
bool operator<(const VirtualContext& other) const {
return HandleComparator<Context>()(context, other.context) &&
distance < other.distance;
}
};
class CompilationSubject {
public:
explicit CompilationSubject(FunctionBlueprint blueprint)
: blueprint_(blueprint) {}
CompilationSubject(Handle<JSFunction> closure, Isolate* isolate);
FunctionBlueprint blueprint() const { return blueprint_; }
MaybeHandle<JSFunction> closure() const { return closure_; }
private:
FunctionBlueprint blueprint_;
MaybeHandle<JSFunction> closure_;
};
class FunctionBlueprint;
using ConstantsSet = ZoneSet<Handle<Object>, HandleComparator<Object>>;
using VirtualContextsSet = ZoneSet<VirtualContext>;
using MapsSet = ZoneSet<Handle<Map>, HandleComparator<Map>>;
using BlueprintsSet = ZoneSet<FunctionBlueprint>;
......@@ -255,10 +255,12 @@ class Hints {
const ConstantsSet& constants() const;
const MapsSet& maps() const;
const BlueprintsSet& function_blueprints() const;
const VirtualContextsSet& virtual_contexts() const;
void AddConstant(Handle<Object> constant);
void AddMap(Handle<Map> map);
void AddFunctionBlueprint(FunctionBlueprint function_blueprint);
void AddVirtualContext(VirtualContext virtual_context);
void Add(const Hints& other);
......@@ -271,6 +273,7 @@ class Hints {
#endif
private:
VirtualContextsSet virtual_contexts_;
ConstantsSet constants_;
MapsSet maps_;
BlueprintsSet function_blueprints_;
......@@ -285,6 +288,50 @@ enum class SerializerForBackgroundCompilationFlag : uint8_t {
using SerializerForBackgroundCompilationFlags =
base::Flags<SerializerForBackgroundCompilationFlag>;
class FunctionBlueprint {
public:
FunctionBlueprint(Handle<JSFunction> function, Isolate* isolate, Zone* zone);
FunctionBlueprint(Handle<SharedFunctionInfo> shared,
Handle<FeedbackVector> feedback_vector,
const Hints& context_hints);
Handle<SharedFunctionInfo> shared() const { return shared_; }
Handle<FeedbackVector> feedback_vector() const { return feedback_vector_; }
const Hints& context_hints() const { return context_hints_; }
bool operator<(const FunctionBlueprint& other) const {
// A feedback vector is never used for more than one SFI, so it can
// be used for strict ordering of blueprints.
DCHECK_IMPLIES(feedback_vector_.equals(other.feedback_vector_),
shared_.equals(other.shared_));
return HandleComparator<FeedbackVector>()(feedback_vector_,
other.feedback_vector_);
}
private:
Handle<SharedFunctionInfo> shared_;
Handle<FeedbackVector> feedback_vector_;
Hints context_hints_;
};
class CompilationSubject {
public:
explicit CompilationSubject(FunctionBlueprint blueprint)
: blueprint_(blueprint) {}
// The zone parameter is to correctly initialize the blueprint,
// which contains zone-allocated context information.
CompilationSubject(Handle<JSFunction> closure, Isolate* isolate, Zone* zone);
const FunctionBlueprint& blueprint() const { return blueprint_; }
MaybeHandle<JSFunction> closure() const { return closure_; }
private:
FunctionBlueprint blueprint_;
MaybeHandle<JSFunction> closure_;
};
// The SerializerForBackgroundCompilation makes sure that the relevant function
// data such as bytecode, SharedFunctionInfo and FeedbackVector, used by later
// optimizations in the compiler, is copied to the heap broker.
......@@ -347,6 +394,25 @@ class SerializerForBackgroundCompilation {
base::Optional<NameRef> static_name);
void ProcessMapForNamedPropertyAccess(MapRef const& map, NameRef const& name);
void ProcessCreateContext();
enum ContextProcessingMode {
kIgnoreSlot,
kSerializeSlot,
kSerializeSlotAndAddToAccumulator
};
void ProcessContextAccess(const Hints& context_hints, int slot, int depth,
ContextProcessingMode mode);
void ProcessImmutableLoad(ContextRef& context, int slot,
ContextProcessingMode mode);
void ProcessLdaLookupGlobalSlot(interpreter::BytecodeArrayIterator* iterator);
void ProcessLdaLookupContextSlot(
interpreter::BytecodeArrayIterator* iterator);
// Performs extension lookups for [0, depth) like
// BytecodeGraphBuilder::CheckContextExtensions().
void ProcessCheckContextExtensions(int depth);
Hints RunChildSerializer(CompilationSubject function,
base::Optional<Hints> new_target,
const HintsVector& arguments, bool with_spread);
......
......@@ -264,7 +264,7 @@ TEST(SerializeUnconditionalJump) {
"function f() {"
" function p() {};"
" function q() {};"
" if (a) g(q);"
" if (a) q();"
" else g(p);"
" return p;"
"};"
......
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