Commit 34d51668 authored by Georg Neis's avatar Georg Neis Committed by Commit Bot

[turbofan] Eliminate some broker arguments

If we assume that kMaxHintsSize is at least 1, we can reduce the
clutter of broker arguments somewhat.

Bug: v8:7790
Change-Id: I6c6607f694e420ef50a07202d0c98cbff7471af9
Reviewed-on: https://chromium-review.googlesource.com/c/v8/v8/+/2011084
Auto-Submit: Georg Neis <neis@chromium.org>
Commit-Queue: Maya Lekova <mslekova@chromium.org>
Reviewed-by: 's avatarMaya Lekova <mslekova@chromium.org>
Cr-Commit-Position: refs/heads/master@{#65880}
parent f506c609
...@@ -271,8 +271,7 @@ struct VirtualBoundFunction { ...@@ -271,8 +271,7 @@ struct VirtualBoundFunction {
// Hints about the context in which a closure will be created from them. // Hints about the context in which a closure will be created from them.
class VirtualClosure { class VirtualClosure {
public: public:
VirtualClosure(Handle<JSFunction> function, Isolate* isolate, Zone* zone, VirtualClosure(Handle<JSFunction> function, Isolate* isolate, Zone* zone);
JSHeapBroker* broker);
VirtualClosure(Handle<SharedFunctionInfo> shared, VirtualClosure(Handle<SharedFunctionInfo> shared,
Handle<FeedbackVector> feedback_vector, Handle<FeedbackVector> feedback_vector,
...@@ -336,8 +335,7 @@ class CompilationSubject { ...@@ -336,8 +335,7 @@ class CompilationSubject {
// The zone parameter is to correctly initialize the virtual closure, // The zone parameter is to correctly initialize the virtual closure,
// which contains zone-allocated context information. // which contains zone-allocated context information.
CompilationSubject(Handle<JSFunction> closure, Isolate* isolate, Zone* zone, CompilationSubject(Handle<JSFunction> closure, Isolate* isolate, Zone* zone);
JSHeapBroker* broker);
const VirtualClosure& virtual_closure() const { return virtual_closure_; } const VirtualClosure& virtual_closure() const { return virtual_closure_; }
MaybeHandle<JSFunction> closure() const { return closure_; } MaybeHandle<JSFunction> closure() const { return closure_; }
...@@ -369,13 +367,12 @@ class Callee { ...@@ -369,13 +367,12 @@ class Callee {
jsfunction_.ToHandleChecked()->has_feedback_vector(); jsfunction_.ToHandleChecked()->has_feedback_vector();
} }
CompilationSubject ToCompilationSubject(Isolate* isolate, Zone* zone, CompilationSubject ToCompilationSubject(Isolate* isolate, Zone* zone) const {
JSHeapBroker* broker) const {
CHECK(HasFeedbackVector()); CHECK(HasFeedbackVector());
return virtual_closure_.has_value() return virtual_closure_.has_value()
? CompilationSubject(*virtual_closure_) ? CompilationSubject(*virtual_closure_)
: CompilationSubject(jsfunction_.ToHandleChecked(), isolate, : CompilationSubject(jsfunction_.ToHandleChecked(), isolate,
zone, broker); zone);
} }
private: private:
...@@ -604,19 +601,18 @@ VirtualClosure::VirtualClosure(Handle<SharedFunctionInfo> shared, ...@@ -604,19 +601,18 @@ VirtualClosure::VirtualClosure(Handle<SharedFunctionInfo> shared,
} }
VirtualClosure::VirtualClosure(Handle<JSFunction> function, Isolate* isolate, VirtualClosure::VirtualClosure(Handle<JSFunction> function, Isolate* isolate,
Zone* zone, JSHeapBroker* broker) Zone* zone)
: shared_(handle(function->shared(), isolate)), : shared_(handle(function->shared(), isolate)),
feedback_vector_(function->feedback_vector(), isolate), feedback_vector_(function->feedback_vector(), isolate),
context_hints_(Hints::SingleConstant(handle(function->context(), isolate), context_hints_(
zone, broker)) { Hints::SingleConstant(handle(function->context(), isolate), zone)) {
// The checked invariant rules out recursion and thus avoids complexity. // The checked invariant rules out recursion and thus avoids complexity.
CHECK(context_hints_.virtual_closures().IsEmpty()); CHECK(context_hints_.virtual_closures().IsEmpty());
} }
CompilationSubject::CompilationSubject(Handle<JSFunction> closure, CompilationSubject::CompilationSubject(Handle<JSFunction> closure,
Isolate* isolate, Zone* zone, Isolate* isolate, Zone* zone)
JSHeapBroker* broker) : virtual_closure_(closure, isolate, zone), closure_(closure) {
: virtual_closure_(closure, isolate, zone, broker), closure_(closure) {
CHECK(closure->has_feedback_vector()); CHECK(closure->has_feedback_vector());
} }
...@@ -654,16 +650,15 @@ bool Hints::Includes(Hints const& other) const { ...@@ -654,16 +650,15 @@ bool Hints::Includes(Hints const& other) const {
} }
#endif #endif
Hints Hints::SingleConstant(Handle<Object> constant, Zone* zone, Hints Hints::SingleConstant(Handle<Object> constant, Zone* zone) {
JSHeapBroker* broker) {
Hints result; Hints result;
result.AddConstant(constant, zone, broker); result.AddConstant(constant, zone, nullptr);
return result; return result;
} }
Hints Hints::SingleMap(Handle<Map> map, Zone* zone, JSHeapBroker* broker) { Hints Hints::SingleMap(Handle<Map> map, Zone* zone) {
Hints result; Hints result;
result.AddMap(map, zone, broker); result.AddMap(map, zone, nullptr);
return result; return result;
} }
...@@ -847,10 +842,10 @@ void Hints::Reset(Hints* other, Zone* zone) { ...@@ -847,10 +842,10 @@ void Hints::Reset(Hints* other, Zone* zone) {
class SerializerForBackgroundCompilation::Environment : public ZoneObject { class SerializerForBackgroundCompilation::Environment : public ZoneObject {
public: public:
Environment(Zone* zone, CompilationSubject function, JSHeapBroker* broker); Environment(Zone* zone, CompilationSubject function);
Environment(Zone* zone, Isolate* isolate, CompilationSubject function, Environment(Zone* zone, Isolate* isolate, CompilationSubject function,
base::Optional<Hints> new_target, const HintsVector& arguments, base::Optional<Hints> new_target, const HintsVector& arguments,
MissingArgumentsPolicy padding, JSHeapBroker* broker); MissingArgumentsPolicy padding);
bool IsDead() const { return !alive_; } bool IsDead() const { return !alive_; }
...@@ -889,7 +884,7 @@ class SerializerForBackgroundCompilation::Environment : public ZoneObject { ...@@ -889,7 +884,7 @@ class SerializerForBackgroundCompilation::Environment : public ZoneObject {
}; };
SerializerForBackgroundCompilation::Environment::Environment( SerializerForBackgroundCompilation::Environment::Environment(
Zone* zone, CompilationSubject function, JSHeapBroker* broker) Zone* zone, CompilationSubject function)
: parameters_hints_(function.virtual_closure() : parameters_hints_(function.virtual_closure()
.shared() .shared()
->GetBytecodeArray() ->GetBytecodeArray()
...@@ -907,8 +902,8 @@ SerializerForBackgroundCompilation::Environment::Environment( ...@@ -907,8 +902,8 @@ SerializerForBackgroundCompilation::Environment::Environment(
SerializerForBackgroundCompilation::Environment::Environment( SerializerForBackgroundCompilation::Environment::Environment(
Zone* zone, Isolate* isolate, CompilationSubject function, Zone* zone, Isolate* isolate, CompilationSubject function,
base::Optional<Hints> new_target, const HintsVector& arguments, base::Optional<Hints> new_target, const HintsVector& arguments,
MissingArgumentsPolicy padding, JSHeapBroker* broker) MissingArgumentsPolicy padding)
: Environment(zone, function, broker) { : Environment(zone, function) {
// Set the hints for the actually passed arguments, at most up to // Set the hints for the actually passed arguments, at most up to
// the parameter_count. // the parameter_count.
for (size_t i = 0; i < std::min(arguments.size(), parameters_hints_.size()); for (size_t i = 0; i < std::min(arguments.size(), parameters_hints_.size());
...@@ -917,8 +912,8 @@ SerializerForBackgroundCompilation::Environment::Environment( ...@@ -917,8 +912,8 @@ SerializerForBackgroundCompilation::Environment::Environment(
} }
if (padding == kMissingArgumentsAreUndefined) { if (padding == kMissingArgumentsAreUndefined) {
Hints const undefined_hint = Hints::SingleConstant( Hints const undefined_hint =
isolate->factory()->undefined_value(), zone, broker); Hints::SingleConstant(isolate->factory()->undefined_value(), zone);
for (size_t i = arguments.size(); i < parameters_hints_.size(); ++i) { for (size_t i = arguments.size(); i < parameters_hints_.size(); ++i) {
parameters_hints_[i] = undefined_hint; parameters_hints_[i] = undefined_hint;
} }
...@@ -986,39 +981,24 @@ void SerializerForBackgroundCompilation::Environment::Merge( ...@@ -986,39 +981,24 @@ void SerializerForBackgroundCompilation::Environment::Merge(
bool Hints::Union(Hints const& other) { bool Hints::Union(Hints const& other) {
CHECK(IsAllocated()); CHECK(IsAllocated());
bool result = true; if (impl_->constants_.Size() + other.constants().Size() > kMaxHintsSize ||
impl_->maps_.Size() + other.maps().Size() > kMaxHintsSize ||
impl_->virtual_closures_.Size() + other.virtual_closures().Size() >
kMaxHintsSize ||
impl_->virtual_contexts_.Size() + other.virtual_contexts().Size() >
kMaxHintsSize ||
impl_->virtual_bound_functions_.Size() +
other.virtual_bound_functions().Size() >
kMaxHintsSize) {
return false;
}
Zone* zone = impl_->zone_; Zone* zone = impl_->zone_;
if (impl_->constants_.Size() + other.constants().Size() <= kMaxHintsSize) {
impl_->constants_.Union(other.constants(), zone); impl_->constants_.Union(other.constants(), zone);
} else {
result = false;
}
if (impl_->maps_.Size() + other.maps().Size() <= kMaxHintsSize) {
impl_->maps_.Union(other.maps(), zone); impl_->maps_.Union(other.maps(), zone);
} else {
result = false;
}
if (impl_->virtual_closures_.Size() + other.virtual_closures().Size() <=
kMaxHintsSize) {
impl_->virtual_closures_.Union(other.virtual_closures(), zone); impl_->virtual_closures_.Union(other.virtual_closures(), zone);
} else {
result = false;
}
if (impl_->virtual_contexts_.Size() + other.virtual_contexts().Size() <=
kMaxHintsSize) {
impl_->virtual_contexts_.Union(other.virtual_contexts(), zone); impl_->virtual_contexts_.Union(other.virtual_contexts(), zone);
} else { impl_->virtual_bound_functions_.Union(other.virtual_bound_functions(), zone);
result = false; return true;
}
if (impl_->virtual_bound_functions_.Size() +
other.virtual_bound_functions().Size() <=
kMaxHintsSize) {
impl_->virtual_bound_functions_.Union(other.virtual_bound_functions(),
zone);
} else {
result = false;
}
return result;
} }
void Hints::Merge(Hints const& other, Zone* zone, JSHeapBroker* broker) { void Hints::Merge(Hints const& other, Zone* zone, JSHeapBroker* broker) {
...@@ -1084,13 +1064,11 @@ SerializerForBackgroundCompilation::SerializerForBackgroundCompilation( ...@@ -1084,13 +1064,11 @@ SerializerForBackgroundCompilation::SerializerForBackgroundCompilation(
dependencies_(dependencies), dependencies_(dependencies),
zone_scope_(zone_stats, ZONE_NAME), zone_scope_(zone_stats, ZONE_NAME),
flags_(flags), flags_(flags),
function_(closure, broker->isolate(), zone(), broker), function_(closure, broker->isolate(), zone()),
osr_offset_(osr_offset), osr_offset_(osr_offset),
jump_target_environments_(zone()), jump_target_environments_(zone()),
environment_(new (zone()) Environment( environment_(new (zone()) Environment(
zone(), zone(), CompilationSubject(closure, broker_->isolate(), zone()))),
CompilationSubject(closure, broker_->isolate(), zone(), broker_),
broker_)),
arguments_(zone()) { arguments_(zone()) {
closure_hints_.AddConstant(closure, zone(), broker_); closure_hints_.AddConstant(closure, zone(), broker_);
JSFunctionRef(broker, closure).Serialize(); JSFunctionRef(broker, closure).Serialize();
...@@ -1114,7 +1092,7 @@ SerializerForBackgroundCompilation::SerializerForBackgroundCompilation( ...@@ -1114,7 +1092,7 @@ SerializerForBackgroundCompilation::SerializerForBackgroundCompilation(
jump_target_environments_(zone()), jump_target_environments_(zone()),
environment_(new (zone()) environment_(new (zone())
Environment(zone(), broker_->isolate(), function, Environment(zone(), broker_->isolate(), function,
new_target, arguments, padding, broker)), new_target, arguments, padding)),
arguments_(arguments), arguments_(arguments),
nesting_level_(nesting_level) { nesting_level_(nesting_level) {
Handle<JSFunction> closure; Handle<JSFunction> closure;
...@@ -1402,51 +1380,50 @@ void SerializerForBackgroundCompilation::VisitGetTemplateObject( ...@@ -1402,51 +1380,50 @@ void SerializerForBackgroundCompilation::VisitGetTemplateObject(
JSArrayRef template_object = shared.GetTemplateObject( JSArrayRef template_object = shared.GetTemplateObject(
description, source, SerializationPolicy::kSerializeIfNeeded); description, source, SerializationPolicy::kSerializeIfNeeded);
environment()->accumulator_hints() = environment()->accumulator_hints() =
Hints::SingleConstant(template_object.object(), zone(), broker()); Hints::SingleConstant(template_object.object(), zone());
} }
void SerializerForBackgroundCompilation::VisitLdaTrue( void SerializerForBackgroundCompilation::VisitLdaTrue(
BytecodeArrayIterator* iterator) { BytecodeArrayIterator* iterator) {
environment()->accumulator_hints() = Hints::SingleConstant( environment()->accumulator_hints() = Hints::SingleConstant(
broker()->isolate()->factory()->true_value(), zone(), broker()); broker()->isolate()->factory()->true_value(), zone());
} }
void SerializerForBackgroundCompilation::VisitLdaFalse( void SerializerForBackgroundCompilation::VisitLdaFalse(
BytecodeArrayIterator* iterator) { BytecodeArrayIterator* iterator) {
environment()->accumulator_hints() = Hints::SingleConstant( environment()->accumulator_hints() = Hints::SingleConstant(
broker()->isolate()->factory()->false_value(), zone(), broker()); broker()->isolate()->factory()->false_value(), zone());
} }
void SerializerForBackgroundCompilation::VisitLdaTheHole( void SerializerForBackgroundCompilation::VisitLdaTheHole(
BytecodeArrayIterator* iterator) { BytecodeArrayIterator* iterator) {
environment()->accumulator_hints() = Hints::SingleConstant( environment()->accumulator_hints() = Hints::SingleConstant(
broker()->isolate()->factory()->the_hole_value(), zone(), broker()); broker()->isolate()->factory()->the_hole_value(), zone());
} }
void SerializerForBackgroundCompilation::VisitLdaUndefined( void SerializerForBackgroundCompilation::VisitLdaUndefined(
BytecodeArrayIterator* iterator) { BytecodeArrayIterator* iterator) {
environment()->accumulator_hints() = Hints::SingleConstant( environment()->accumulator_hints() = Hints::SingleConstant(
broker()->isolate()->factory()->undefined_value(), zone(), broker()); broker()->isolate()->factory()->undefined_value(), zone());
} }
void SerializerForBackgroundCompilation::VisitLdaNull( void SerializerForBackgroundCompilation::VisitLdaNull(
BytecodeArrayIterator* iterator) { BytecodeArrayIterator* iterator) {
environment()->accumulator_hints() = Hints::SingleConstant( environment()->accumulator_hints() = Hints::SingleConstant(
broker()->isolate()->factory()->null_value(), zone(), broker()); broker()->isolate()->factory()->null_value(), zone());
} }
void SerializerForBackgroundCompilation::VisitLdaZero( void SerializerForBackgroundCompilation::VisitLdaZero(
BytecodeArrayIterator* iterator) { BytecodeArrayIterator* iterator) {
environment()->accumulator_hints() = Hints::SingleConstant( environment()->accumulator_hints() = Hints::SingleConstant(
handle(Smi::FromInt(0), broker()->isolate()), zone(), broker()); handle(Smi::FromInt(0), broker()->isolate()), zone());
} }
void SerializerForBackgroundCompilation::VisitLdaSmi( void SerializerForBackgroundCompilation::VisitLdaSmi(
BytecodeArrayIterator* iterator) { BytecodeArrayIterator* iterator) {
Handle<Smi> smi(Smi::FromInt(iterator->GetImmediateOperand(0)), Handle<Smi> smi(Smi::FromInt(iterator->GetImmediateOperand(0)),
broker()->isolate()); broker()->isolate());
environment()->accumulator_hints() = environment()->accumulator_hints() = Hints::SingleConstant(smi, zone());
Hints::SingleConstant(smi, zone(), broker());
} }
void SerializerForBackgroundCompilation::VisitInvokeIntrinsic( void SerializerForBackgroundCompilation::VisitInvokeIntrinsic(
...@@ -1537,7 +1514,7 @@ void SerializerForBackgroundCompilation::VisitLdaConstant( ...@@ -1537,7 +1514,7 @@ void SerializerForBackgroundCompilation::VisitLdaConstant(
ObjectRef object( ObjectRef object(
broker(), iterator->GetConstantForIndexOperand(0, broker()->isolate())); broker(), iterator->GetConstantForIndexOperand(0, broker()->isolate()));
environment()->accumulator_hints() = environment()->accumulator_hints() =
Hints::SingleConstant(object.object(), zone(), broker()); Hints::SingleConstant(object.object(), zone());
} }
void SerializerForBackgroundCompilation::VisitPushContext( void SerializerForBackgroundCompilation::VisitPushContext(
...@@ -1860,7 +1837,7 @@ void SerializerForBackgroundCompilation::VisitCallUndefinedReceiver0( ...@@ -1860,7 +1837,7 @@ void SerializerForBackgroundCompilation::VisitCallUndefinedReceiver0(
FeedbackSlot slot = iterator->GetSlotOperand(1); FeedbackSlot slot = iterator->GetSlotOperand(1);
Hints const receiver = Hints::SingleConstant( Hints const receiver = Hints::SingleConstant(
broker()->isolate()->factory()->undefined_value(), zone(), broker()); broker()->isolate()->factory()->undefined_value(), zone());
HintsVector parameters({receiver}, zone()); HintsVector parameters({receiver}, zone());
ProcessCallOrConstruct(callee, base::nullopt, &parameters, slot, ProcessCallOrConstruct(callee, base::nullopt, &parameters, slot,
...@@ -1906,7 +1883,7 @@ void SerializerForBackgroundCompilation::VisitCallUndefinedReceiver1( ...@@ -1906,7 +1883,7 @@ void SerializerForBackgroundCompilation::VisitCallUndefinedReceiver1(
FeedbackSlot slot = iterator->GetSlotOperand(2); FeedbackSlot slot = iterator->GetSlotOperand(2);
Hints receiver = Hints::SingleConstant( Hints receiver = Hints::SingleConstant(
broker()->isolate()->factory()->undefined_value(), zone(), broker()); broker()->isolate()->factory()->undefined_value(), zone());
HintsVector args = PrepareArgumentsHints(&receiver, arg0); HintsVector args = PrepareArgumentsHints(&receiver, arg0);
ProcessCallOrConstruct(callee, base::nullopt, &args, slot, ProcessCallOrConstruct(callee, base::nullopt, &args, slot,
...@@ -1921,7 +1898,7 @@ void SerializerForBackgroundCompilation::VisitCallUndefinedReceiver2( ...@@ -1921,7 +1898,7 @@ void SerializerForBackgroundCompilation::VisitCallUndefinedReceiver2(
FeedbackSlot slot = iterator->GetSlotOperand(3); FeedbackSlot slot = iterator->GetSlotOperand(3);
Hints receiver = Hints::SingleConstant( Hints receiver = Hints::SingleConstant(
broker()->isolate()->factory()->undefined_value(), zone(), broker()); broker()->isolate()->factory()->undefined_value(), zone());
HintsVector args = PrepareArgumentsHints(&receiver, arg0, arg1); HintsVector args = PrepareArgumentsHints(&receiver, arg0, arg1);
ProcessCallOrConstruct(callee, base::nullopt, &args, slot, ProcessCallOrConstruct(callee, base::nullopt, &args, slot,
...@@ -2014,8 +1991,7 @@ void SerializerForBackgroundCompilation::VisitCallJSRuntime( ...@@ -2014,8 +1991,7 @@ void SerializerForBackgroundCompilation::VisitCallJSRuntime(
->target_native_context() ->target_native_context()
.get(runtime_index, SerializationPolicy::kSerializeIfNeeded) .get(runtime_index, SerializationPolicy::kSerializeIfNeeded)
.value(); .value();
Hints const callee = Hints const callee = Hints::SingleConstant(constant.object(), zone());
Hints::SingleConstant(constant.object(), zone(), broker());
interpreter::Register first_reg = iterator->GetRegisterOperand(1); interpreter::Register first_reg = iterator->GetRegisterOperand(1);
int reg_count = static_cast<int>(iterator->GetRegisterCountOperand(2)); int reg_count = static_cast<int>(iterator->GetRegisterCountOperand(2));
ProcessCallVarArgs(ConvertReceiverMode::kNullOrUndefined, callee, first_reg, ProcessCallVarArgs(ConvertReceiverMode::kNullOrUndefined, callee, first_reg,
...@@ -2052,7 +2028,7 @@ void SerializerForBackgroundCompilation::ProcessCalleeForCallOrConstruct( ...@@ -2052,7 +2028,7 @@ void SerializerForBackgroundCompilation::ProcessCalleeForCallOrConstruct(
shared->GetInlineability() == SharedFunctionInfo::kIsInlineable && shared->GetInlineability() == SharedFunctionInfo::kIsInlineable &&
callee.HasFeedbackVector()) { callee.HasFeedbackVector()) {
CompilationSubject subject = CompilationSubject subject =
callee.ToCompilationSubject(broker()->isolate(), zone(), broker()); callee.ToCompilationSubject(broker()->isolate(), zone());
result_hints->Add( result_hints->Add(
RunChildSerializer(subject, new_target, arguments, padding), zone(), RunChildSerializer(subject, new_target, arguments, padding), zone(),
broker()); broker());
...@@ -2075,12 +2051,11 @@ JSReceiverRef UnrollBoundFunction(JSBoundFunctionRef const& bound_function, ...@@ -2075,12 +2051,11 @@ JSReceiverRef UnrollBoundFunction(JSBoundFunctionRef const& bound_function,
for (int i = target.AsJSBoundFunction().bound_arguments().length() - 1; for (int i = target.AsJSBoundFunction().bound_arguments().length() - 1;
i >= 0; --i) { i >= 0; --i) {
Hints const arg = Hints::SingleConstant( Hints const arg = Hints::SingleConstant(
target.AsJSBoundFunction().bound_arguments().get(i).object(), zone, target.AsJSBoundFunction().bound_arguments().get(i).object(), zone);
broker);
reversed_bound_arguments.push_back(arg); reversed_bound_arguments.push_back(arg);
} }
Hints const arg = Hints::SingleConstant( Hints const arg = Hints::SingleConstant(
target.AsJSBoundFunction().bound_this().object(), zone, broker); target.AsJSBoundFunction().bound_this().object(), zone);
reversed_bound_arguments.push_back(arg); reversed_bound_arguments.push_back(arg);
} }
...@@ -2234,10 +2209,9 @@ void SerializerForBackgroundCompilation::ProcessCallVarArgs( ...@@ -2234,10 +2209,9 @@ void SerializerForBackgroundCompilation::ProcessCallVarArgs(
// The receiver is either given in the first register or it is implicitly // The receiver is either given in the first register or it is implicitly
// the {undefined} value. // the {undefined} value.
if (receiver_mode == ConvertReceiverMode::kNullOrUndefined) { if (receiver_mode == ConvertReceiverMode::kNullOrUndefined) {
args.insert( args.insert(args.begin(),
args.begin(), Hints::SingleConstant(
Hints::SingleConstant(broker()->isolate()->factory()->undefined_value(), broker()->isolate()->factory()->undefined_value(), zone()));
zone(), broker()));
} }
ProcessCallOrConstruct(callee, base::nullopt, &args, slot, padding); ProcessCallOrConstruct(callee, base::nullopt, &args, slot, padding);
} }
...@@ -2324,8 +2298,7 @@ void SerializerForBackgroundCompilation::ProcessBuiltinCall( ...@@ -2324,8 +2298,7 @@ void SerializerForBackgroundCompilation::ProcessBuiltinCall(
ProcessHintsForObjectCreate(arguments[1]); ProcessHintsForObjectCreate(arguments[1]);
} else { } else {
ProcessHintsForObjectCreate(Hints::SingleConstant( ProcessHintsForObjectCreate(Hints::SingleConstant(
broker()->isolate()->factory()->undefined_value(), zone(), broker()->isolate()->factory()->undefined_value(), zone()));
broker()));
} }
break; break;
} }
...@@ -2364,8 +2337,8 @@ void SerializerForBackgroundCompilation::ProcessBuiltinCall( ...@@ -2364,8 +2337,8 @@ void SerializerForBackgroundCompilation::ProcessBuiltinCall(
arguments.size() >= 2 arguments.size() >= 2
? arguments[1] ? arguments[1]
: Hints::SingleConstant( : Hints::SingleConstant(
broker()->isolate()->factory()->undefined_value(), zone(), broker()->isolate()->factory()->undefined_value(),
broker()); zone());
ProcessHintsForPromiseResolve(resolution_hints); ProcessHintsForPromiseResolve(resolution_hints);
} }
break; break;
...@@ -2393,8 +2366,7 @@ void SerializerForBackgroundCompilation::ProcessBuiltinCall( ...@@ -2393,8 +2366,7 @@ void SerializerForBackgroundCompilation::ProcessBuiltinCall(
new_arguments.push_back( new_arguments.push_back(
arguments.size() < 3 arguments.size() < 3
? Hints::SingleConstant( ? Hints::SingleConstant(
broker()->isolate()->factory()->undefined_value(), zone(), broker()->isolate()->factory()->undefined_value(), zone())
broker())
: arguments[2]); // T : arguments[2]); // T
new_arguments.push_back(Hints()); // kValue new_arguments.push_back(Hints()); // kValue
new_arguments.push_back(Hints()); // k new_arguments.push_back(Hints()); // k
...@@ -2419,8 +2391,7 @@ void SerializerForBackgroundCompilation::ProcessBuiltinCall( ...@@ -2419,8 +2391,7 @@ void SerializerForBackgroundCompilation::ProcessBuiltinCall(
// "Call(callbackfn, undefined, « accumulator, kValue, k, O »)" // "Call(callbackfn, undefined, « accumulator, kValue, k, O »)"
HintsVector new_arguments(zone()); HintsVector new_arguments(zone());
new_arguments.push_back(Hints::SingleConstant( new_arguments.push_back(Hints::SingleConstant(
broker()->isolate()->factory()->undefined_value(), zone(), broker()->isolate()->factory()->undefined_value(), zone()));
broker()));
new_arguments.push_back(Hints()); // accumulator new_arguments.push_back(Hints()); // accumulator
new_arguments.push_back(Hints()); // kValue new_arguments.push_back(Hints()); // kValue
new_arguments.push_back(Hints()); // k new_arguments.push_back(Hints()); // k
...@@ -2444,8 +2415,8 @@ void SerializerForBackgroundCompilation::ProcessBuiltinCall( ...@@ -2444,8 +2415,8 @@ void SerializerForBackgroundCompilation::ProcessBuiltinCall(
arguments.size() >= 2 arguments.size() >= 2
? arguments[1] ? arguments[1]
: Hints::SingleConstant( : Hints::SingleConstant(
broker()->isolate()->factory()->undefined_value(), zone(), broker()->isolate()->factory()->undefined_value(),
broker()); zone());
HintsVector new_arguments({new_receiver}, zone()); HintsVector new_arguments({new_receiver}, zone());
for (auto constant : arguments[0].constants()) { for (auto constant : arguments[0].constants()) {
ProcessCalleeForCallOrConstruct( ProcessCalleeForCallOrConstruct(
...@@ -2465,8 +2436,7 @@ void SerializerForBackgroundCompilation::ProcessBuiltinCall( ...@@ -2465,8 +2436,7 @@ void SerializerForBackgroundCompilation::ProcessBuiltinCall(
// resolvingFunctions.[[Reject]] »)" // resolvingFunctions.[[Reject]] »)"
HintsVector new_arguments( HintsVector new_arguments(
{Hints::SingleConstant( {Hints::SingleConstant(
broker()->isolate()->factory()->undefined_value(), zone(), broker()->isolate()->factory()->undefined_value(), zone())},
broker())},
zone()); zone());
for (auto constant : arguments[0].constants()) { for (auto constant : arguments[0].constants()) {
ProcessCalleeForCallOrConstruct( ProcessCalleeForCallOrConstruct(
...@@ -2537,8 +2507,7 @@ void SerializerForBackgroundCompilation::ProcessBuiltinCall( ...@@ -2537,8 +2507,7 @@ void SerializerForBackgroundCompilation::ProcessBuiltinCall(
ProcessHintsForObjectGetPrototype(arguments[1]); ProcessHintsForObjectGetPrototype(arguments[1]);
} else { } else {
Hints const undefined_hint = Hints::SingleConstant( Hints const undefined_hint = Hints::SingleConstant(
broker()->isolate()->factory()->undefined_value(), zone(), broker()->isolate()->factory()->undefined_value(), zone());
broker());
ProcessHintsForObjectGetPrototype(undefined_hint); ProcessHintsForObjectGetPrototype(undefined_hint);
} }
break; break;
...@@ -2988,8 +2957,8 @@ SerializerForBackgroundCompilation::ProcessMapForNamedPropertyAccess( ...@@ -2988,8 +2957,8 @@ SerializerForBackgroundCompilation::ProcessMapForNamedPropertyAccess(
JSFunctionRef function(broker(), access_info.constant()); JSFunctionRef function(broker(), access_info.constant());
// For JSCallReducer and JSInlining(Heuristic). // For JSCallReducer and JSInlining(Heuristic).
HintsVector arguments( HintsVector arguments({Hints::SingleMap(receiver_map.object(), zone())},
{Hints::SingleMap(receiver_map.object(), zone(), broker())}, zone()); zone());
// In the case of a setter any added result hints won't make sense, but // In the case of a setter any added result hints won't make sense, but
// they will be ignored anyways by Process*PropertyAccess due to the // they will be ignored anyways by Process*PropertyAccess due to the
// access mode not being kLoad. // access mode not being kLoad.
......
...@@ -130,9 +130,8 @@ class JSHeapBroker; ...@@ -130,9 +130,8 @@ class JSHeapBroker;
class Hints { class Hints {
public: public:
Hints() = default; // Empty. Hints() = default; // Empty.
static Hints SingleConstant(Handle<Object> constant, Zone* zone, static Hints SingleConstant(Handle<Object> constant, Zone* zone);
JSHeapBroker* broker); static Hints SingleMap(Handle<Map> map, Zone* zone);
static Hints SingleMap(Handle<Map> map, Zone* zone, JSHeapBroker* broker);
// For inspection only. // For inspection only.
ConstantsSet constants() const; ConstantsSet constants() const;
...@@ -188,6 +187,7 @@ class Hints { ...@@ -188,6 +187,7 @@ class Hints {
bool Union(Hints const& other); bool Union(Hints const& other);
static const size_t kMaxHintsSize = 50; static const size_t kMaxHintsSize = 50;
static_assert(kMaxHintsSize >= 1, "must allow for at least one hint");
}; };
using HintsVector = ZoneVector<Hints>; using HintsVector = ZoneVector<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