Commit be41df96 authored by Georg Neis's avatar Georg Neis Committed by Commit Bot

[turbofan] Rename "js_heap_broker" to "broker".

There's no ambiguity and the shorter name makes things easier to read.

Bug: v8:7790
Change-Id: Ibcf3fd7f38a91e26a83cd335fad0ec80a5fe9be1
Reviewed-on: https://chromium-review.googlesource.com/c/1278392
Commit-Queue: Georg Neis <neis@chromium.org>
Reviewed-by: 's avatarJaroslav Sevcik <jarin@chromium.org>
Reviewed-by: 's avatarMaya Lekova <mslekova@chromium.org>
Cr-Commit-Position: refs/heads/master@{#56623}
parent 63f92a9f
......@@ -245,10 +245,10 @@ Handle<Cell> PropertyAccessInfo::export_cell() const {
return Handle<Cell>::cast(constant_);
}
AccessInfoFactory::AccessInfoFactory(JSHeapBroker* js_heap_broker,
AccessInfoFactory::AccessInfoFactory(JSHeapBroker* broker,
CompilationDependencies* dependencies,
Handle<Context> native_context, Zone* zone)
: js_heap_broker_(js_heap_broker),
: broker_(broker),
dependencies_(dependencies),
native_context_(native_context),
isolate_(native_context->GetIsolate()),
......@@ -404,12 +404,12 @@ bool AccessInfoFactory::ComputePropertyAccessInfo(
// The field type was cleared by the GC, so we don't know anything
// about the contents now.
} else if (descriptors_field_type->IsClass()) {
MapRef map_ref(js_heap_broker(), map);
MapRef map_ref(broker(), map);
map_ref.SerializeOwnDescriptors(); // TODO(neis): Remove later.
dependencies()->DependOnFieldType(map_ref, number);
// Remember the field map, and try to infer a useful type.
Handle<Map> map(descriptors_field_type->AsClass(), isolate());
field_type = Type::For(MapRef(js_heap_broker(), map));
field_type = Type::For(MapRef(broker(), map));
field_map = MaybeHandle<Map>(map);
}
}
......@@ -709,17 +709,17 @@ bool AccessInfoFactory::LookupTransition(Handle<Map> map, Handle<Name> name,
// Store is not safe if the field type was cleared.
return false;
} else if (descriptors_field_type->IsClass()) {
MapRef transition_map_ref(js_heap_broker(), transition_map);
MapRef transition_map_ref(broker(), transition_map);
transition_map_ref
.SerializeOwnDescriptors(); // TODO(neis): Remove later.
dependencies()->DependOnFieldType(transition_map_ref, number);
// Remember the field map, and try to infer a useful type.
Handle<Map> map(descriptors_field_type->AsClass(), isolate());
field_type = Type::For(MapRef(js_heap_broker(), map));
field_type = Type::For(MapRef(broker(), map));
field_map = MaybeHandle<Map>(map);
}
}
dependencies()->DependOnTransition(MapRef(js_heap_broker(), transition_map));
dependencies()->DependOnTransition(MapRef(broker(), transition_map));
// Transitioning stores are never stores to constant fields.
*access_info = PropertyAccessInfo::DataField(
PropertyConstness::kMutable, MapHandles{map}, field_index,
......
......@@ -143,8 +143,7 @@ class PropertyAccessInfo final {
// Factory class for {ElementAccessInfo}s and {PropertyAccessInfo}s.
class AccessInfoFactory final {
public:
AccessInfoFactory(JSHeapBroker* js_heap_broker,
CompilationDependencies* dependencies,
AccessInfoFactory(JSHeapBroker* broker, CompilationDependencies* dependencies,
Handle<Context> native_context, Zone* zone);
......@@ -172,13 +171,13 @@ class AccessInfoFactory final {
PropertyAccessInfo* access_info);
CompilationDependencies* dependencies() const { return dependencies_; }
JSHeapBroker* js_heap_broker() const { return js_heap_broker_; }
JSHeapBroker* broker() const { return broker_; }
Factory* factory() const;
Isolate* isolate() const { return isolate_; }
Handle<Context> native_context() const { return native_context_; }
Zone* zone() const { return zone_; }
JSHeapBroker* const js_heap_broker_;
JSHeapBroker* const broker_;
CompilationDependencies* const dependencies_;
Handle<Context> const native_context_;
Isolate* const isolate_;
......
......@@ -38,13 +38,13 @@ Decision DecideCondition(JSHeapBroker* broker, Node* const cond) {
} // namespace
CommonOperatorReducer::CommonOperatorReducer(Editor* editor, Graph* graph,
JSHeapBroker* js_heap_broker,
JSHeapBroker* broker,
CommonOperatorBuilder* common,
MachineOperatorBuilder* machine,
Zone* temp_zone)
: AdvancedReducer(editor),
graph_(graph),
js_heap_broker_(js_heap_broker),
broker_(broker),
common_(common),
machine_(machine),
dead_(graph->NewNode(common->Dead())),
......@@ -89,10 +89,8 @@ Reduction CommonOperatorReducer::ReduceBranch(Node* node) {
// not (i.e. true being returned in the false case and vice versa).
if (cond->opcode() == IrOpcode::kBooleanNot ||
(cond->opcode() == IrOpcode::kSelect &&
DecideCondition(js_heap_broker(), cond->InputAt(1)) ==
Decision::kFalse &&
DecideCondition(js_heap_broker(), cond->InputAt(2)) ==
Decision::kTrue)) {
DecideCondition(broker(), cond->InputAt(1)) == Decision::kFalse &&
DecideCondition(broker(), cond->InputAt(2)) == Decision::kTrue)) {
for (Node* const use : node->uses()) {
switch (use->opcode()) {
case IrOpcode::kIfTrue:
......@@ -114,7 +112,7 @@ Reduction CommonOperatorReducer::ReduceBranch(Node* node) {
node, common()->Branch(NegateBranchHint(BranchHintOf(node->op()))));
return Changed(node);
}
Decision const decision = DecideCondition(js_heap_broker(), cond);
Decision const decision = DecideCondition(broker(), cond);
if (decision == Decision::kUnknown) return NoChange();
Node* const control = node->InputAt(1);
for (Node* const use : node->uses()) {
......@@ -154,7 +152,7 @@ Reduction CommonOperatorReducer::ReduceDeoptimizeConditional(Node* node) {
: common()->DeoptimizeUnless(p.kind(), p.reason(), p.feedback()));
return Changed(node);
}
Decision const decision = DecideCondition(js_heap_broker(), condition);
Decision const decision = DecideCondition(broker(), condition);
if (decision == Decision::kUnknown) return NoChange();
if (condition_is_true == (decision == Decision::kTrue)) {
ReplaceWithValue(node, dead(), effect, control);
......@@ -387,7 +385,7 @@ Reduction CommonOperatorReducer::ReduceSelect(Node* node) {
Node* const vtrue = node->InputAt(1);
Node* const vfalse = node->InputAt(2);
if (vtrue == vfalse) return Replace(vtrue);
switch (DecideCondition(js_heap_broker(), cond)) {
switch (DecideCondition(broker(), cond)) {
case Decision::kTrue:
return Replace(vtrue);
case Decision::kFalse:
......
......@@ -24,8 +24,7 @@ class Operator;
class V8_EXPORT_PRIVATE CommonOperatorReducer final
: public NON_EXPORTED_BASE(AdvancedReducer) {
public:
CommonOperatorReducer(Editor* editor, Graph* graph,
JSHeapBroker* js_heap_broker,
CommonOperatorReducer(Editor* editor, Graph* graph, JSHeapBroker* broker,
CommonOperatorBuilder* common,
MachineOperatorBuilder* machine, Zone* temp_zone);
~CommonOperatorReducer() final = default;
......@@ -48,13 +47,13 @@ class V8_EXPORT_PRIVATE CommonOperatorReducer final
Reduction Change(Node* node, Operator const* op, Node* a, Node* b);
Graph* graph() const { return graph_; }
JSHeapBroker* js_heap_broker() const { return js_heap_broker_; }
JSHeapBroker* broker() const { return broker_; }
CommonOperatorBuilder* common() const { return common_; }
MachineOperatorBuilder* machine() const { return machine_; }
Node* dead() const { return dead_; }
Graph* const graph_;
JSHeapBroker* const js_heap_broker_;
JSHeapBroker* const broker_;
CommonOperatorBuilder* const common_;
MachineOperatorBuilder* const machine_;
Node* const dead_;
......
......@@ -12,10 +12,8 @@ namespace internal {
namespace compiler {
ConstantFoldingReducer::ConstantFoldingReducer(Editor* editor, JSGraph* jsgraph,
JSHeapBroker* js_heap_broker)
: AdvancedReducer(editor),
jsgraph_(jsgraph),
js_heap_broker_(js_heap_broker) {}
JSHeapBroker* broker)
: AdvancedReducer(editor), jsgraph_(jsgraph), broker_(broker) {}
ConstantFoldingReducer::~ConstantFoldingReducer() = default;
......@@ -40,7 +38,7 @@ Reduction ConstantFoldingReducer::Reduce(Node* node) {
replacement = jsgraph()->Constant(upper.AsHeapConstant()->Ref());
} else if (upper.Is(Type::MinusZero())) {
Factory* factory = jsgraph()->isolate()->factory();
ObjectRef minus_zero(js_heap_broker(), factory->minus_zero_value());
ObjectRef minus_zero(broker(), factory->minus_zero_value());
replacement = jsgraph()->Constant(minus_zero);
} else if (upper.Is(Type::NaN())) {
replacement = jsgraph()->NaNConstant();
......
......@@ -18,7 +18,7 @@ class V8_EXPORT_PRIVATE ConstantFoldingReducer final
: public NON_EXPORTED_BASE(AdvancedReducer) {
public:
ConstantFoldingReducer(Editor* editor, JSGraph* jsgraph,
JSHeapBroker* js_heap_broker);
JSHeapBroker* broker);
~ConstantFoldingReducer() final;
const char* reducer_name() const override { return "ConstantFoldingReducer"; }
......@@ -27,10 +27,10 @@ class V8_EXPORT_PRIVATE ConstantFoldingReducer final
private:
JSGraph* jsgraph() const { return jsgraph_; }
JSHeapBroker* js_heap_broker() const { return js_heap_broker_; }
JSHeapBroker* broker() const { return broker_; }
JSGraph* const jsgraph_;
JSHeapBroker* const js_heap_broker_;
JSHeapBroker* const broker_;
DISALLOW_COPY_AND_ASSIGN(ConstantFoldingReducer);
};
......
This diff is collapsed.
......@@ -38,12 +38,12 @@ class V8_EXPORT_PRIVATE JSCallReducer final : public AdvancedReducer {
enum Flag { kNoFlags = 0u, kBailoutOnUninitialized = 1u << 0 };
typedef base::Flags<Flag> Flags;
JSCallReducer(Editor* editor, JSGraph* jsgraph, JSHeapBroker* js_heap_broker,
JSCallReducer(Editor* editor, JSGraph* jsgraph, JSHeapBroker* broker,
Flags flags, Handle<Context> native_context,
CompilationDependencies* dependencies)
: AdvancedReducer(editor),
jsgraph_(jsgraph),
js_heap_broker_(js_heap_broker),
broker_(broker),
flags_(flags),
native_context_(native_context),
dependencies_(dependencies) {}
......@@ -233,7 +233,7 @@ class V8_EXPORT_PRIVATE JSCallReducer final : public AdvancedReducer {
Graph* graph() const;
JSGraph* jsgraph() const { return jsgraph_; }
JSHeapBroker* js_heap_broker() const { return js_heap_broker_; }
JSHeapBroker* broker() const { return broker_; }
Isolate* isolate() const;
Factory* factory() const;
Handle<Context> native_context() const { return native_context_; }
......@@ -245,7 +245,7 @@ class V8_EXPORT_PRIVATE JSCallReducer final : public AdvancedReducer {
CompilationDependencies* dependencies() const { return dependencies_; }
JSGraph* const jsgraph_;
JSHeapBroker* const js_heap_broker_;
JSHeapBroker* const broker_;
Flags const flags_;
Handle<Context> const native_context_;
CompilationDependencies* const dependencies_;
......
......@@ -135,7 +135,7 @@ Reduction JSContextSpecialization::ReduceJSLoadContext(Node* node) {
Node* context = NodeProperties::GetOuterContext(node, &depth);
base::Optional<ContextRef> maybe_concrete =
GetSpecializationContext(js_heap_broker(), context, &depth, outer());
GetSpecializationContext(broker(), context, &depth, outer());
if (!maybe_concrete.has_value()) {
// We do not have a concrete context object, so we can only partially reduce
// the load by folding-in the outer context node.
......@@ -197,7 +197,7 @@ Reduction JSContextSpecialization::ReduceJSStoreContext(Node* node) {
Node* context = NodeProperties::GetOuterContext(node, &depth);
base::Optional<ContextRef> maybe_concrete =
GetSpecializationContext(js_heap_broker(), context, &depth, outer());
GetSpecializationContext(broker(), context, &depth, outer());
if (!maybe_concrete.has_value()) {
// We do not have a concrete context object, so we can only partially reduce
// the load by folding-in the outer context node.
......
......@@ -34,14 +34,13 @@ struct OuterContext {
class JSContextSpecialization final : public AdvancedReducer {
public:
JSContextSpecialization(Editor* editor, JSGraph* jsgraph,
JSHeapBroker* js_heap_broker,
Maybe<OuterContext> outer,
JSHeapBroker* broker, Maybe<OuterContext> outer,
MaybeHandle<JSFunction> closure)
: AdvancedReducer(editor),
jsgraph_(jsgraph),
outer_(outer),
closure_(closure),
js_heap_broker_(js_heap_broker) {}
broker_(broker) {}
const char* reducer_name() const override {
return "JSContextSpecialization";
......@@ -63,12 +62,12 @@ class JSContextSpecialization final : public AdvancedReducer {
JSGraph* jsgraph() const { return jsgraph_; }
Maybe<OuterContext> outer() const { return outer_; }
MaybeHandle<JSFunction> closure() const { return closure_; }
JSHeapBroker* js_heap_broker() const { return js_heap_broker_; }
JSHeapBroker* broker() const { return broker_; }
JSGraph* const jsgraph_;
Maybe<OuterContext> outer_;
MaybeHandle<JSFunction> closure_;
JSHeapBroker* const js_heap_broker_;
JSHeapBroker* const broker_;
DISALLOW_COPY_AND_ASSIGN(JSContextSpecialization);
};
......
......@@ -173,7 +173,7 @@ Reduction JSCreateLowering::ReduceJSCreateArguments(Node* node) {
Node* const outer_state = frame_state->InputAt(kFrameStateOuterStateInput);
Node* const control = graph()->start();
FrameStateInfo state_info = FrameStateInfoOf(frame_state->op());
SharedFunctionInfoRef shared(js_heap_broker(),
SharedFunctionInfoRef shared(broker(),
state_info.shared_info().ToHandleChecked());
// Use the ArgumentsAccessStub for materializing both mapped and unmapped
......@@ -635,7 +635,7 @@ Reduction JSCreateLowering::ReduceJSCreateArray(Node* node) {
{
Handle<AllocationSite> site;
if (p.site().ToHandle(&site)) {
site_ref = AllocationSiteRef(js_heap_broker(), site);
site_ref = AllocationSiteRef(broker(), site);
}
}
PretenureFlag pretenure = NOT_TENURED;
......@@ -896,7 +896,7 @@ Reduction JSCreateLowering::ReduceJSCreateBoundFunction(Node* node) {
CreateBoundFunctionParameters const& p =
CreateBoundFunctionParametersOf(node->op());
int const arity = static_cast<int>(p.arity());
MapRef const map(js_heap_broker(), p.map());
MapRef const map(broker(), p.map());
Node* bound_target_function = NodeProperties::GetValueInput(node, 0);
Node* bound_this = NodeProperties::GetValueInput(node, 1);
Node* effect = NodeProperties::GetEffectInput(node);
......@@ -934,9 +934,9 @@ Reduction JSCreateLowering::ReduceJSCreateBoundFunction(Node* node) {
Reduction JSCreateLowering::ReduceJSCreateClosure(Node* node) {
DCHECK_EQ(IrOpcode::kJSCreateClosure, node->opcode());
CreateClosureParameters const& p = CreateClosureParametersOf(node->op());
SharedFunctionInfoRef shared(js_heap_broker(), p.shared_info());
HeapObjectRef feedback_cell(js_heap_broker(), p.feedback_cell());
HeapObjectRef code(js_heap_broker(), p.code());
SharedFunctionInfoRef shared(broker(), p.shared_info());
HeapObjectRef feedback_cell(broker(), p.feedback_cell());
HeapObjectRef code(broker(), p.code());
Node* effect = NodeProperties::GetEffectInput(node);
Node* control = NodeProperties::GetControlInput(node);
Node* context = NodeProperties::GetContextInput(node);
......@@ -945,7 +945,7 @@ Reduction JSCreateLowering::ReduceJSCreateClosure(Node* node) {
// seen more than one instantiation, this simplifies the generated code and
// also serves as a heuristic of which allocation sites benefit from it.
if (!feedback_cell.map().equals(
MapRef(js_heap_broker(), factory()->many_closures_cell_map()))) {
MapRef(broker(), factory()->many_closures_cell_map()))) {
return NoChange();
}
......@@ -1104,7 +1104,7 @@ Reduction JSCreateLowering::ReduceJSCreateLiteralArrayOrObject(Node* node) {
Node* effect = NodeProperties::GetEffectInput(node);
Node* control = NodeProperties::GetControlInput(node);
FeedbackVectorRef feedback_vector(js_heap_broker(), p.feedback().vector());
FeedbackVectorRef feedback_vector(broker(), p.feedback().vector());
ObjectRef feedback = feedback_vector.get(p.feedback().slot());
if (feedback.IsAllocationSite()) {
AllocationSiteRef site = feedback.AsAllocationSite();
......@@ -1127,7 +1127,7 @@ Reduction JSCreateLowering::ReduceJSCreateLiteralArrayOrObject(Node* node) {
Reduction JSCreateLowering::ReduceJSCreateEmptyLiteralArray(Node* node) {
DCHECK_EQ(IrOpcode::kJSCreateEmptyLiteralArray, node->opcode());
FeedbackParameter const& p = FeedbackParameterOf(node->op());
FeedbackVectorRef fv(js_heap_broker(), p.feedback().vector());
FeedbackVectorRef fv(broker(), p.feedback().vector());
ObjectRef feedback = fv.get(p.feedback().slot());
if (feedback.IsAllocationSite()) {
AllocationSiteRef site = feedback.AsAllocationSite();
......@@ -1184,7 +1184,7 @@ Reduction JSCreateLowering::ReduceJSCreateLiteralRegExp(Node* node) {
Node* effect = NodeProperties::GetEffectInput(node);
Node* control = NodeProperties::GetControlInput(node);
FeedbackVectorRef feedback_vector(js_heap_broker(), p.feedback().vector());
FeedbackVectorRef feedback_vector(broker(), p.feedback().vector());
ObjectRef feedback = feedback_vector.get(p.feedback().slot());
if (feedback.IsJSRegExp()) {
JSRegExpRef boilerplate = feedback.AsJSRegExp();
......@@ -1199,7 +1199,7 @@ Reduction JSCreateLowering::ReduceJSCreateFunctionContext(Node* node) {
DCHECK_EQ(IrOpcode::kJSCreateFunctionContext, node->opcode());
const CreateFunctionContextParameters& parameters =
CreateFunctionContextParametersOf(node->op());
ScopeInfoRef scope_info(js_heap_broker(), parameters.scope_info());
ScopeInfoRef scope_info(broker(), parameters.scope_info());
int slot_count = parameters.slot_count();
ScopeType scope_type = parameters.scope_type();
......@@ -1244,7 +1244,7 @@ Reduction JSCreateLowering::ReduceJSCreateFunctionContext(Node* node) {
Reduction JSCreateLowering::ReduceJSCreateWithContext(Node* node) {
DCHECK_EQ(IrOpcode::kJSCreateWithContext, node->opcode());
ScopeInfoRef scope_info(js_heap_broker(), ScopeInfoOf(node->op()));
ScopeInfoRef scope_info(broker(), ScopeInfoOf(node->op()));
Node* extension = NodeProperties::GetValueInput(node, 0);
Node* effect = NodeProperties::GetEffectInput(node);
Node* control = NodeProperties::GetControlInput(node);
......@@ -1265,7 +1265,7 @@ Reduction JSCreateLowering::ReduceJSCreateWithContext(Node* node) {
Reduction JSCreateLowering::ReduceJSCreateCatchContext(Node* node) {
DCHECK_EQ(IrOpcode::kJSCreateCatchContext, node->opcode());
ScopeInfoRef scope_info(js_heap_broker(), ScopeInfoOf(node->op()));
ScopeInfoRef scope_info(broker(), ScopeInfoOf(node->op()));
Node* exception = NodeProperties::GetValueInput(node, 0);
Node* effect = NodeProperties::GetEffectInput(node);
Node* control = NodeProperties::GetControlInput(node);
......@@ -1290,7 +1290,7 @@ Reduction JSCreateLowering::ReduceJSCreateCatchContext(Node* node) {
Reduction JSCreateLowering::ReduceJSCreateBlockContext(Node* node) {
DCHECK_EQ(IrOpcode::kJSCreateBlockContext, node->opcode());
ScopeInfoRef scope_info(js_heap_broker(), ScopeInfoOf(node->op()));
ScopeInfoRef scope_info(broker(), ScopeInfoOf(node->op()));
int const context_length = scope_info.ContextLength();
// Use inline allocation for block contexts up to a size limit.
......@@ -1348,8 +1348,7 @@ Reduction JSCreateLowering::ReduceJSCreateObject(Node* node) {
if (!prototype_type.IsHeapConstant()) return NoChange();
HeapObjectRef prototype_const = prototype_type.AsHeapConstant()->Ref();
auto maybe_instance_map =
GetObjectCreateMap(js_heap_broker(), prototype_const);
auto maybe_instance_map = GetObjectCreateMap(broker(), prototype_const);
if (!maybe_instance_map) return NoChange();
MapRef instance_map = maybe_instance_map.value();
......@@ -1826,7 +1825,7 @@ SimplifiedOperatorBuilder* JSCreateLowering::simplified() const {
}
NativeContextRef JSCreateLowering::native_context() const {
return js_heap_broker()->native_context();
return broker()->native_context();
}
} // namespace compiler
......
......@@ -33,11 +33,11 @@ class V8_EXPORT_PRIVATE JSCreateLowering final
: public NON_EXPORTED_BASE(AdvancedReducer) {
public:
JSCreateLowering(Editor* editor, CompilationDependencies* dependencies,
JSGraph* jsgraph, JSHeapBroker* js_heap_broker, Zone* zone)
JSGraph* jsgraph, JSHeapBroker* broker, Zone* zone)
: AdvancedReducer(editor),
dependencies_(dependencies),
jsgraph_(jsgraph),
js_heap_broker_(js_heap_broker),
broker_(broker),
zone_(zone) {}
~JSCreateLowering() final = default;
......@@ -117,12 +117,12 @@ class V8_EXPORT_PRIVATE JSCreateLowering final
CommonOperatorBuilder* common() const;
SimplifiedOperatorBuilder* simplified() const;
CompilationDependencies* dependencies() const { return dependencies_; }
JSHeapBroker* js_heap_broker() const { return js_heap_broker_; }
JSHeapBroker* broker() const { return broker_; }
Zone* zone() const { return zone_; }
CompilationDependencies* const dependencies_;
JSGraph* const jsgraph_;
JSHeapBroker* const js_heap_broker_;
JSHeapBroker* const broker_;
Zone* const zone_;
};
......
......@@ -564,12 +564,11 @@ class V8_EXPORT_PRIVATE JSHeapBroker : public NON_EXPORTED_BASE(ZoneObject) {
static const size_t kInitialRefsBucketCount = 1024; // must be power of 2
};
#define ASSIGN_RETURN_NO_CHANGE_IF_DATA_MISSING(something_var, \
optionally_something) \
auto optionally_something_ = optionally_something; \
if (!optionally_something_) \
return NoChangeBecauseOfMissingData(js_heap_broker(), __FUNCTION__, \
__LINE__); \
#define ASSIGN_RETURN_NO_CHANGE_IF_DATA_MISSING(something_var, \
optionally_something) \
auto optionally_something_ = optionally_something; \
if (!optionally_something_) \
return NoChangeBecauseOfMissingData(broker(), __FUNCTION__, __LINE__); \
something_var = *optionally_something_;
class Reduction;
......
......@@ -606,8 +606,7 @@ Reduction JSInliner::ReduceJSCall(Node* node) {
if (node->opcode() == IrOpcode::kJSCall &&
is_sloppy(shared_info->language_mode()) && !shared_info->native()) {
Node* effect = NodeProperties::GetEffectInput(node);
if (NodeProperties::CanBePrimitive(js_heap_broker(), call.receiver(),
effect)) {
if (NodeProperties::CanBePrimitive(broker(), call.receiver(), effect)) {
CallParameters const& p = CallParametersOf(node->op());
Node* global_proxy = jsgraph()->HeapConstant(
handle(info_->native_context()->global_proxy(), isolate()));
......
......@@ -24,13 +24,13 @@ class SourcePositionTable;
class JSInliner final : public AdvancedReducer {
public:
JSInliner(Editor* editor, Zone* local_zone, OptimizedCompilationInfo* info,
JSGraph* jsgraph, JSHeapBroker* js_heap_broker,
JSGraph* jsgraph, JSHeapBroker* broker,
SourcePositionTable* source_positions)
: AdvancedReducer(editor),
local_zone_(local_zone),
info_(info),
jsgraph_(jsgraph),
js_heap_broker_(js_heap_broker),
broker_(broker),
source_positions_(source_positions) {}
const char* reducer_name() const override { return "JSInliner"; }
......@@ -50,14 +50,14 @@ class JSInliner final : public AdvancedReducer {
Graph* graph() const;
JSGraph* jsgraph() const { return jsgraph_; }
// TODO(neis): Make heap broker a component of JSGraph?
JSHeapBroker* js_heap_broker() const { return js_heap_broker_; }
JSHeapBroker* broker() const { return broker_; }
Isolate* isolate() const { return jsgraph_->isolate(); }
Handle<Context> native_context() const;
Zone* const local_zone_;
OptimizedCompilationInfo* info_;
JSGraph* const jsgraph_;
JSHeapBroker* const js_heap_broker_;
JSHeapBroker* const broker_;
SourcePositionTable* const source_positions_;
bool DetermineCallTarget(Node* node,
......
......@@ -51,7 +51,7 @@ class V8_EXPORT_PRIVATE JSNativeContextSpecialization final
typedef base::Flags<Flag> Flags;
JSNativeContextSpecialization(Editor* editor, JSGraph* jsgraph,
JSHeapBroker* js_heap_broker, Flags flags,
JSHeapBroker* broker, Flags flags,
Handle<Context> native_context,
CompilationDependencies* dependencies,
Zone* zone, Zone* shared_zone);
......@@ -229,7 +229,7 @@ class V8_EXPORT_PRIVATE JSNativeContextSpecialization final
Graph* graph() const;
JSGraph* jsgraph() const { return jsgraph_; }
JSHeapBroker* js_heap_broker() const { return js_heap_broker_; }
JSHeapBroker* broker() const { return broker_; }
Isolate* isolate() const;
Factory* factory() const;
CommonOperatorBuilder* common() const;
......@@ -238,15 +238,13 @@ class V8_EXPORT_PRIVATE JSNativeContextSpecialization final
Flags flags() const { return flags_; }
Handle<JSGlobalObject> global_object() const { return global_object_; }
Handle<JSGlobalProxy> global_proxy() const { return global_proxy_; }
NativeContextRef native_context() const {
return js_heap_broker()->native_context();
}
NativeContextRef native_context() const { return broker()->native_context(); }
CompilationDependencies* dependencies() const { return dependencies_; }
Zone* zone() const { return zone_; }
Zone* shared_zone() const { return shared_zone_; }
JSGraph* const jsgraph_;
JSHeapBroker* const js_heap_broker_;
JSHeapBroker* const broker_;
Flags const flags_;
Handle<JSGlobalObject> global_object_;
Handle<JSGlobalProxy> global_proxy_;
......
......@@ -94,7 +94,7 @@ class JSBinopReduction final {
if (BothInputsAre(Type::String()) ||
BinaryOperationHintOf(node_->op()) == BinaryOperationHint::kString) {
HeapObjectBinopMatcher m(node_);
JSHeapBroker* broker = lowering_->js_heap_broker();
JSHeapBroker* broker = lowering_->broker();
if (m.right().HasValue() && m.right().Ref(broker).IsString()) {
StringRef right_string = m.right().Ref(broker).AsString();
if (right_string.length() >= ConsString::kMinLength) return true;
......@@ -414,12 +414,12 @@ class JSBinopReduction final {
// - relax effects from generic but not-side-effecting operations
JSTypedLowering::JSTypedLowering(Editor* editor, JSGraph* jsgraph,
JSHeapBroker* js_heap_broker, Zone* zone)
JSHeapBroker* broker, Zone* zone)
: AdvancedReducer(editor),
jsgraph_(jsgraph),
js_heap_broker_(js_heap_broker),
empty_string_type_(Type::HeapConstant(
js_heap_broker, factory()->empty_string(), graph()->zone())),
broker_(broker),
empty_string_type_(Type::HeapConstant(broker, factory()->empty_string(),
graph()->zone())),
pointer_comparable_type_(
Type::Union(Type::Oddball(),
Type::Union(Type::SymbolOrReceiver(), empty_string_type_,
......@@ -933,8 +933,8 @@ Reduction JSTypedLowering::ReduceJSToNumberInput(Node* input) {
if (input_type.Is(Type::String())) {
HeapObjectMatcher m(input);
if (m.HasValue() && m.Ref(js_heap_broker()).IsString()) {
StringRef input_value = m.Ref(js_heap_broker()).AsString();
if (m.HasValue() && m.Ref(broker()).IsString()) {
StringRef input_value = m.Ref(broker()).AsString();
double number;
ASSIGN_RETURN_NO_CHANGE_IF_DATA_MISSING(number, input_value.ToNumber());
return Replace(jsgraph()->Constant(number));
......@@ -1107,8 +1107,8 @@ Reduction JSTypedLowering::ReduceJSLoadNamed(Node* node) {
DCHECK_EQ(IrOpcode::kJSLoadNamed, node->opcode());
Node* receiver = NodeProperties::GetValueInput(node, 0);
Type receiver_type = NodeProperties::GetType(receiver);
NameRef name(js_heap_broker(), NamedAccessOf(node->op()).name());
NameRef length_str(js_heap_broker(), factory()->length_string());
NameRef name(broker(), NamedAccessOf(node->op()).name());
NameRef length_str(broker(), factory()->length_string());
// Optimize "length" property of strings.
if (name.equals(length_str) && receiver_type.Is(Type::String())) {
Node* value = graph()->NewNode(simplified()->StringLength(), receiver);
......@@ -1541,7 +1541,7 @@ Reduction JSTypedLowering::ReduceJSConstruct(Node* node) {
// Patch {node} to an indirect call via the {function}s construct stub.
bool use_builtin_construct_stub = shared.construct_as_builtin();
CodeRef code(js_heap_broker(),
CodeRef code(broker(),
use_builtin_construct_stub
? BUILTIN_CODE(isolate(), JSBuiltinsConstructStub)
: BUILTIN_CODE(isolate(), JSConstructStubGeneric));
......
......@@ -31,8 +31,8 @@ enum Signedness { kSigned, kUnsigned };
class V8_EXPORT_PRIVATE JSTypedLowering final
: public NON_EXPORTED_BASE(AdvancedReducer) {
public:
JSTypedLowering(Editor* editor, JSGraph* jsgraph,
JSHeapBroker* js_heap_broker, Zone* zone);
JSTypedLowering(Editor* editor, JSGraph* jsgraph, JSHeapBroker* broker,
Zone* zone);
~JSTypedLowering() final = default;
const char* reducer_name() const override { return "JSTypedLowering"; }
......@@ -94,14 +94,14 @@ class V8_EXPORT_PRIVATE JSTypedLowering final
Factory* factory() const;
Graph* graph() const;
JSGraph* jsgraph() const { return jsgraph_; }
JSHeapBroker* js_heap_broker() const { return js_heap_broker_; }
JSHeapBroker* broker() const { return broker_; }
Isolate* isolate() const;
JSOperatorBuilder* javascript() const;
CommonOperatorBuilder* common() const;
SimplifiedOperatorBuilder* simplified() const;
JSGraph* jsgraph_;
JSHeapBroker* js_heap_broker_;
JSHeapBroker* broker_;
Type empty_string_type_;
Type pointer_comparable_type_;
TypeCache const& type_cache_;
......
......@@ -16,26 +16,24 @@ namespace v8 {
namespace internal {
namespace compiler {
OperationTyper::OperationTyper(JSHeapBroker* js_heap_broker, Zone* zone)
OperationTyper::OperationTyper(JSHeapBroker* broker, Zone* zone)
: zone_(zone), cache_(TypeCache::Get()) {
Factory* factory = js_heap_broker->isolate()->factory();
Factory* factory = broker->isolate()->factory();
infinity_ = Type::NewConstant(V8_INFINITY, zone);
minus_infinity_ = Type::NewConstant(-V8_INFINITY, zone);
Type truncating_to_zero = Type::MinusZeroOrNaN();
DCHECK(!truncating_to_zero.Maybe(Type::Integral32()));
singleton_empty_string_ =
Type::HeapConstant(js_heap_broker, factory->empty_string(), zone);
Type::HeapConstant(broker, factory->empty_string(), zone);
singleton_NaN_string_ =
Type::HeapConstant(js_heap_broker, factory->NaN_string(), zone);
Type::HeapConstant(broker, factory->NaN_string(), zone);
singleton_zero_string_ =
Type::HeapConstant(js_heap_broker, factory->zero_string(), zone);
singleton_false_ =
Type::HeapConstant(js_heap_broker, factory->false_value(), zone);
singleton_true_ =
Type::HeapConstant(js_heap_broker, factory->true_value(), zone);
Type::HeapConstant(broker, factory->zero_string(), zone);
singleton_false_ = Type::HeapConstant(broker, factory->false_value(), zone);
singleton_true_ = Type::HeapConstant(broker, factory->true_value(), zone);
singleton_the_hole_ =
Type::HeapConstant(js_heap_broker, factory->the_hole_value(), zone);
Type::HeapConstant(broker, factory->the_hole_value(), zone);
signed32ish_ = Type::Union(Type::Signed32(), truncating_to_zero, zone);
unsigned32ish_ = Type::Union(Type::Unsigned32(), truncating_to_zero, zone);
......
......@@ -27,7 +27,7 @@ class TypeCache;
class V8_EXPORT_PRIVATE OperationTyper {
public:
OperationTyper(JSHeapBroker* js_heap_broker, Zone* zone);
OperationTyper(JSHeapBroker* broker, Zone* zone);
// Typing Phi.
Type Merge(Type left, Type right);
......
This diff is collapsed.
......@@ -137,8 +137,7 @@ void PropertyAccessBuilder::BuildCheckMaps(
if (receiver_map->is_stable()) {
for (Handle<Map> map : receiver_maps) {
if (map.is_identical_to(receiver_map)) {
dependencies()->DependOnStableMap(
MapRef(js_heap_broker(), receiver_map));
dependencies()->DependOnStableMap(MapRef(broker(), receiver_map));
return;
}
}
......@@ -207,7 +206,7 @@ Node* PropertyAccessBuilder::TryBuildLoadConstantDataField(
// the field.
DCHECK(access_info.IsDataConstantField());
DCHECK(!it.is_dictionary_holder());
MapRef map(js_heap_broker(),
MapRef map(broker(),
handle(it.GetHolder<HeapObject>()->map(), isolate()));
map.SerializeOwnDescriptors(); // TODO(neis): Remove later.
dependencies()->DependOnFieldType(map, it.GetFieldDescriptorIndex());
......@@ -270,7 +269,7 @@ Node* PropertyAccessBuilder::BuildLoadDataField(
Handle<Map> field_map;
if (access_info.field_map().ToHandle(&field_map)) {
if (field_map->is_stable()) {
dependencies()->DependOnStableMap(MapRef(js_heap_broker(), field_map));
dependencies()->DependOnStableMap(MapRef(broker(), field_map));
field_access.map = field_map;
}
}
......
......@@ -26,11 +26,9 @@ class SimplifiedOperatorBuilder;
class PropertyAccessBuilder {
public:
PropertyAccessBuilder(JSGraph* jsgraph, JSHeapBroker* js_heap_broker,
PropertyAccessBuilder(JSGraph* jsgraph, JSHeapBroker* broker,
CompilationDependencies* dependencies)
: jsgraph_(jsgraph),
js_heap_broker_(js_heap_broker),
dependencies_(dependencies) {}
: jsgraph_(jsgraph), broker_(broker), dependencies_(dependencies) {}
// Builds the appropriate string check if the maps are only string
// maps.
......@@ -54,7 +52,7 @@ class PropertyAccessBuilder {
private:
JSGraph* jsgraph() const { return jsgraph_; }
JSHeapBroker* js_heap_broker() const { return js_heap_broker_; }
JSHeapBroker* broker() const { return broker_; }
CompilationDependencies* dependencies() const { return dependencies_; }
Graph* graph() const;
Isolate* isolate() const;
......@@ -69,7 +67,7 @@ class PropertyAccessBuilder {
Node* ResolveHolder(PropertyAccessInfo const& access_info, Node* receiver);
JSGraph* jsgraph_;
JSHeapBroker* js_heap_broker_;
JSHeapBroker* broker_;
CompilationDependencies* dependencies_;
};
......
......@@ -287,8 +287,8 @@ class RepresentationSelector {
bool weakened_ = false;
};
RepresentationSelector(JSGraph* jsgraph, JSHeapBroker* js_heap_broker,
Zone* zone, RepresentationChanger* changer,
RepresentationSelector(JSGraph* jsgraph, JSHeapBroker* broker, Zone* zone,
RepresentationChanger* changer,
SourcePositionTable* source_positions,
NodeOriginTable* node_origins)
: jsgraph_(jsgraph),
......@@ -307,7 +307,7 @@ class RepresentationSelector {
source_positions_(source_positions),
node_origins_(node_origins),
type_cache_(TypeCache::Get()),
op_typer_(js_heap_broker, graph_zone()) {
op_typer_(broker, graph_zone()) {
}
// Forward propagation of types from type feedback.
......@@ -3408,13 +3408,13 @@ class RepresentationSelector {
Zone* graph_zone() { return jsgraph_->zone(); }
};
SimplifiedLowering::SimplifiedLowering(JSGraph* jsgraph,
JSHeapBroker* js_heap_broker, Zone* zone,
SimplifiedLowering::SimplifiedLowering(JSGraph* jsgraph, JSHeapBroker* broker,
Zone* zone,
SourcePositionTable* source_positions,
NodeOriginTable* node_origins,
PoisoningMitigationLevel poisoning_level)
: jsgraph_(jsgraph),
js_heap_broker_(js_heap_broker),
broker_(broker),
zone_(zone),
type_cache_(TypeCache::Get()),
source_positions_(source_positions),
......@@ -3423,7 +3423,7 @@ SimplifiedLowering::SimplifiedLowering(JSGraph* jsgraph,
void SimplifiedLowering::LowerAllNodes() {
RepresentationChanger changer(jsgraph(), jsgraph()->isolate());
RepresentationSelector selector(jsgraph(), js_heap_broker_, zone_, &changer,
RepresentationSelector selector(jsgraph(), broker_, zone_, &changer,
source_positions_, node_origins_);
selector.Run(this);
}
......
......@@ -23,7 +23,7 @@ class TypeCache;
class V8_EXPORT_PRIVATE SimplifiedLowering final {
public:
SimplifiedLowering(JSGraph* jsgraph, JSHeapBroker* js_heap_broker, Zone* zone,
SimplifiedLowering(JSGraph* jsgraph, JSHeapBroker* broker, Zone* zone,
SourcePositionTable* source_position,
NodeOriginTable* node_origins,
PoisoningMitigationLevel poisoning_level);
......@@ -48,7 +48,7 @@ class V8_EXPORT_PRIVATE SimplifiedLowering final {
private:
JSGraph* const jsgraph_;
JSHeapBroker* js_heap_broker_;
JSHeapBroker* broker_;
Zone* const zone_;
TypeCache const& type_cache_;
SetOncePointer<Node> to_number_code_;
......
......@@ -32,11 +32,10 @@ Decision DecideObjectIsSmi(Node* const input) {
} // namespace
SimplifiedOperatorReducer::SimplifiedOperatorReducer(
Editor* editor, JSGraph* jsgraph, JSHeapBroker* js_heap_broker)
: AdvancedReducer(editor),
jsgraph_(jsgraph),
js_heap_broker_(js_heap_broker) {}
SimplifiedOperatorReducer::SimplifiedOperatorReducer(Editor* editor,
JSGraph* jsgraph,
JSHeapBroker* broker)
: AdvancedReducer(editor), jsgraph_(jsgraph), broker_(broker) {}
SimplifiedOperatorReducer::~SimplifiedOperatorReducer() = default;
......@@ -62,7 +61,7 @@ Reduction SimplifiedOperatorReducer::Reduce(Node* node) {
case IrOpcode::kChangeTaggedToBit: {
HeapObjectMatcher m(node->InputAt(0));
if (m.HasValue()) {
return ReplaceInt32(m.Ref(js_heap_broker()).BooleanValue());
return ReplaceInt32(m.Ref(broker()).BooleanValue());
}
if (m.IsChangeBitToTagged()) return Replace(m.InputAt(0));
break;
......
......@@ -27,7 +27,7 @@ class V8_EXPORT_PRIVATE SimplifiedOperatorReducer final
: public NON_EXPORTED_BASE(AdvancedReducer) {
public:
SimplifiedOperatorReducer(Editor* editor, JSGraph* jsgraph,
JSHeapBroker* js_heap_broker);
JSHeapBroker* broker);
~SimplifiedOperatorReducer() final;
const char* reducer_name() const override {
......@@ -56,10 +56,10 @@ class V8_EXPORT_PRIVATE SimplifiedOperatorReducer final
SimplifiedOperatorBuilder* simplified() const;
JSGraph* jsgraph() const { return jsgraph_; }
JSHeapBroker* js_heap_broker() const { return js_heap_broker_; }
JSHeapBroker* broker() const { return broker_; }
JSGraph* const jsgraph_;
JSHeapBroker* const js_heap_broker_;
JSHeapBroker* const broker_;
DISALLOW_COPY_AND_ASSIGN(SimplifiedOperatorReducer);
};
......
......@@ -12,10 +12,8 @@ namespace internal {
namespace compiler {
TypeNarrowingReducer::TypeNarrowingReducer(Editor* editor, JSGraph* jsgraph,
JSHeapBroker* js_heap_broker)
: AdvancedReducer(editor),
jsgraph_(jsgraph),
op_typer_(js_heap_broker, zone()) {}
JSHeapBroker* broker)
: AdvancedReducer(editor), jsgraph_(jsgraph), op_typer_(broker, zone()) {}
TypeNarrowingReducer::~TypeNarrowingReducer() = default;
......
......@@ -19,8 +19,7 @@ class JSGraph;
class V8_EXPORT_PRIVATE TypeNarrowingReducer final
: public NON_EXPORTED_BASE(AdvancedReducer) {
public:
TypeNarrowingReducer(Editor* editor, JSGraph* jsgraph,
JSHeapBroker* js_heap_broker);
TypeNarrowingReducer(Editor* editor, JSGraph* jsgraph, JSHeapBroker* broker);
~TypeNarrowingReducer() final;
const char* reducer_name() const override { return "TypeNarrowingReducer"; }
......
......@@ -20,15 +20,14 @@ namespace compiler {
TypedOptimization::TypedOptimization(Editor* editor,
CompilationDependencies* dependencies,
JSGraph* jsgraph,
JSHeapBroker* js_heap_broker)
JSGraph* jsgraph, JSHeapBroker* broker)
: AdvancedReducer(editor),
dependencies_(dependencies),
jsgraph_(jsgraph),
js_heap_broker_(js_heap_broker),
true_type_(Type::HeapConstant(js_heap_broker, factory()->true_value(),
graph()->zone())),
false_type_(Type::HeapConstant(js_heap_broker, factory()->false_value(),
broker_(broker),
true_type_(
Type::HeapConstant(broker, factory()->true_value(), graph()->zone())),
false_type_(Type::HeapConstant(broker, factory()->false_value(),
graph()->zone())),
type_cache_(TypeCache::Get()) {}
......@@ -93,7 +92,7 @@ Reduction TypedOptimization::Reduce(Node* node) {
namespace {
base::Optional<MapRef> GetStableMapFromObjectType(JSHeapBroker* js_heap_broker,
base::Optional<MapRef> GetStableMapFromObjectType(JSHeapBroker* broker,
Type object_type) {
if (object_type.IsHeapConstant()) {
HeapObjectRef object = object_type.AsHeapConstant()->Ref();
......@@ -149,7 +148,7 @@ Reduction TypedOptimization::ReduceCheckMaps(Node* node) {
Type const object_type = NodeProperties::GetType(object);
Node* const effect = NodeProperties::GetEffectInput(node);
base::Optional<MapRef> object_map =
GetStableMapFromObjectType(js_heap_broker(), object_type);
GetStableMapFromObjectType(broker(), object_type);
if (object_map.has_value()) {
for (int i = 1; i < node->op()->ValueInputCount(); ++i) {
Node* const map = NodeProperties::GetValueInput(node, i);
......@@ -220,7 +219,7 @@ Reduction TypedOptimization::ReduceLoadField(Node* node) {
// (2) deoptimization is enabled and we can add a code dependency on the
// stability of map (to guard the Constant type information).
base::Optional<MapRef> object_map =
GetStableMapFromObjectType(js_heap_broker(), object_type);
GetStableMapFromObjectType(broker(), object_type);
if (object_map.has_value()) {
dependencies()->DependOnStableMap(*object_map);
Node* const value = jsgraph()->Constant(*object_map);
......@@ -474,8 +473,8 @@ Reduction TypedOptimization::ReduceStringLength(Node* node) {
case IrOpcode::kHeapConstant: {
// Constant-fold the String::length of the {input}.
HeapObjectMatcher m(input);
if (m.Ref(js_heap_broker()).IsString()) {
uint32_t const length = m.Ref(js_heap_broker()).AsString().length();
if (m.Ref(broker()).IsString()) {
uint32_t const length = m.Ref(broker()).AsString().length();
Node* value = jsgraph()->Constant(length);
return Replace(value);
}
......@@ -593,28 +592,28 @@ Reduction TypedOptimization::ReduceTypeOf(Node* node) {
Factory* const f = factory();
if (type.Is(Type::Boolean())) {
return Replace(
jsgraph()->Constant(ObjectRef(js_heap_broker(), f->boolean_string())));
jsgraph()->Constant(ObjectRef(broker(), f->boolean_string())));
} else if (type.Is(Type::Number())) {
return Replace(
jsgraph()->Constant(ObjectRef(js_heap_broker(), f->number_string())));
jsgraph()->Constant(ObjectRef(broker(), f->number_string())));
} else if (type.Is(Type::String())) {
return Replace(
jsgraph()->Constant(ObjectRef(js_heap_broker(), f->string_string())));
jsgraph()->Constant(ObjectRef(broker(), f->string_string())));
} else if (type.Is(Type::BigInt())) {
return Replace(
jsgraph()->Constant(ObjectRef(js_heap_broker(), f->bigint_string())));
jsgraph()->Constant(ObjectRef(broker(), f->bigint_string())));
} else if (type.Is(Type::Symbol())) {
return Replace(
jsgraph()->Constant(ObjectRef(js_heap_broker(), f->symbol_string())));
jsgraph()->Constant(ObjectRef(broker(), f->symbol_string())));
} else if (type.Is(Type::OtherUndetectableOrUndefined())) {
return Replace(jsgraph()->Constant(
ObjectRef(js_heap_broker(), f->undefined_string())));
return Replace(
jsgraph()->Constant(ObjectRef(broker(), f->undefined_string())));
} else if (type.Is(Type::NonCallableOrNull())) {
return Replace(
jsgraph()->Constant(ObjectRef(js_heap_broker(), f->object_string())));
jsgraph()->Constant(ObjectRef(broker(), f->object_string())));
} else if (type.Is(Type::Function())) {
return Replace(
jsgraph()->Constant(ObjectRef(js_heap_broker(), f->function_string())));
jsgraph()->Constant(ObjectRef(broker(), f->function_string())));
}
return NoChange();
}
......
......@@ -28,7 +28,7 @@ class V8_EXPORT_PRIVATE TypedOptimization final
: public NON_EXPORTED_BASE(AdvancedReducer) {
public:
TypedOptimization(Editor* editor, CompilationDependencies* dependencies,
JSGraph* jsgraph, JSHeapBroker* js_heap_broker);
JSGraph* jsgraph, JSHeapBroker* broker);
~TypedOptimization() override;
const char* reducer_name() const override { return "TypedOptimization"; }
......@@ -73,11 +73,11 @@ class V8_EXPORT_PRIVATE TypedOptimization final
CompilationDependencies* dependencies() const { return dependencies_; }
JSGraph* jsgraph() const { return jsgraph_; }
JSHeapBroker* js_heap_broker() const { return js_heap_broker_; }
JSHeapBroker* broker() const { return broker_; }
CompilationDependencies* const dependencies_;
JSGraph* const jsgraph_;
JSHeapBroker* js_heap_broker_;
JSHeapBroker* broker_;
Type const true_type_;
Type const false_type_;
TypeCache const& type_cache_;
......
......@@ -34,13 +34,13 @@ class Typer::Decorator final : public GraphDecorator {
Typer* const typer_;
};
Typer::Typer(JSHeapBroker* js_heap_broker, Flags flags, Graph* graph)
Typer::Typer(JSHeapBroker* broker, Flags flags, Graph* graph)
: flags_(flags),
graph_(graph),
decorator_(nullptr),
cache_(TypeCache::Get()),
js_heap_broker_(js_heap_broker),
operation_typer_(js_heap_broker, zone()) {
broker_(broker),
operation_typer_(broker, zone()) {
singleton_false_ = operation_typer_.singleton_false();
singleton_true_ = operation_typer_.singleton_true();
......@@ -2215,7 +2215,7 @@ Type Typer::Visitor::TypeRuntimeAbort(Node* node) { UNREACHABLE(); }
// Heap constants.
Type Typer::Visitor::TypeConstant(Handle<Object> value) {
return Type::NewConstant(typer_->js_heap_broker(), value, zone());
return Type::NewConstant(typer_->broker(), value, zone());
}
} // namespace compiler
......
......@@ -25,7 +25,7 @@ class V8_EXPORT_PRIVATE Typer {
};
typedef base::Flags<Flag> Flags;
Typer(JSHeapBroker* js_heap_broker, Flags flags, Graph* graph);
Typer(JSHeapBroker* broker, Flags flags, Graph* graph);
~Typer();
void Run();
......@@ -41,13 +41,13 @@ class V8_EXPORT_PRIVATE Typer {
Graph* graph() const { return graph_; }
Zone* zone() const { return graph()->zone(); }
OperationTyper* operation_typer() { return &operation_typer_; }
JSHeapBroker* js_heap_broker() const { return js_heap_broker_; }
JSHeapBroker* broker() const { return broker_; }
Flags const flags_;
Graph* const graph_;
Decorator* decorator_;
TypeCache const& cache_;
JSHeapBroker* js_heap_broker_;
JSHeapBroker* broker_;
OperationTyper operation_typer_;
Type singleton_false_;
......
......@@ -839,9 +839,9 @@ Type Type::NewConstant(double value, Zone* zone) {
return OtherNumberConstant(value, zone);
}
Type Type::NewConstant(JSHeapBroker* js_heap_broker, Handle<i::Object> value,
Type Type::NewConstant(JSHeapBroker* broker, Handle<i::Object> value,
Zone* zone) {
ObjectRef ref(js_heap_broker, value);
ObjectRef ref(broker, value);
if (ref.IsSmi()) {
return NewConstant(static_cast<double>(ref.AsSmi()), zone);
}
......@@ -1079,10 +1079,10 @@ Type Type::OtherNumberConstant(double value, Zone* zone) {
}
// static
Type Type::HeapConstant(JSHeapBroker* js_heap_broker, Handle<i::Object> value,
Type Type::HeapConstant(JSHeapBroker* broker, Handle<i::Object> value,
Zone* zone) {
return FromTypeBase(
HeapConstantType::New(HeapObjectRef(js_heap_broker, value), zone));
HeapConstantType::New(HeapObjectRef(broker, value), zone));
}
// static
......
......@@ -369,8 +369,8 @@ class V8_EXPORT_PRIVATE Type {
static Type UnsignedSmall() { return NewBitset(BitsetType::UnsignedSmall()); }
static Type OtherNumberConstant(double value, Zone* zone);
static Type HeapConstant(JSHeapBroker* js_heap_broker,
Handle<i::Object> value, Zone* zone);
static Type HeapConstant(JSHeapBroker* broker, Handle<i::Object> value,
Zone* zone);
static Type HeapConstant(const HeapObjectRef& value, Zone* zone);
static Type Range(double min, double max, Zone* zone);
static Type Range(RangeType::Limits lims, Zone* zone);
......@@ -378,7 +378,7 @@ class V8_EXPORT_PRIVATE Type {
static Type Union(int length, Zone* zone);
// NewConstant is a factory that returns Constant, Range or Number.
static Type NewConstant(JSHeapBroker* js_heap_broker, Handle<i::Object> value,
static Type NewConstant(JSHeapBroker* broker, Handle<i::Object> value,
Zone* zone);
static Type NewConstant(double value, Zone* zone);
......
......@@ -63,7 +63,7 @@ class ConstantFoldingReducerTest : public TypedGraphTest {
public:
ConstantFoldingReducerTest()
: TypedGraphTest(3),
js_heap_broker_(isolate(), zone()),
broker_(isolate(), zone()),
simplified_(zone()),
deps_(isolate(), zone()) {}
~ConstantFoldingReducerTest() override = default;
......@@ -76,23 +76,23 @@ class ConstantFoldingReducerTest : public TypedGraphTest {
&machine);
// TODO(titzer): mock the GraphReducer here for better unit testing.
GraphReducer graph_reducer(zone(), graph());
ConstantFoldingReducer reducer(&graph_reducer, &jsgraph, js_heap_broker());
ConstantFoldingReducer reducer(&graph_reducer, &jsgraph, broker());
return reducer.Reduce(node);
}
SimplifiedOperatorBuilder* simplified() { return &simplified_; }
JSHeapBroker* js_heap_broker() { return &js_heap_broker_; }
JSHeapBroker* broker() { return &broker_; }
private:
JSHeapBroker js_heap_broker_;
JSHeapBroker broker_;
SimplifiedOperatorBuilder simplified_;
CompilationDependencies deps_;
};
TEST_F(ConstantFoldingReducerTest, ParameterWithMinusZero) {
{
Reduction r = Reduce(Parameter(Type::NewConstant(
js_heap_broker(), factory()->minus_zero_value(), zone())));
Reduction r = Reduce(Parameter(
Type::NewConstant(broker(), factory()->minus_zero_value(), zone())));
ASSERT_TRUE(r.Changed());
EXPECT_THAT(r.replacement(), IsNumberConstant(-0.0));
}
......@@ -104,8 +104,7 @@ TEST_F(ConstantFoldingReducerTest, ParameterWithMinusZero) {
{
Reduction r = Reduce(Parameter(Type::Union(
Type::MinusZero(),
Type::NewConstant(js_heap_broker(), factory()->NewNumber(0), zone()),
zone())));
Type::NewConstant(broker(), factory()->NewNumber(0), zone()), zone())));
EXPECT_FALSE(r.Changed());
}
}
......@@ -113,8 +112,7 @@ TEST_F(ConstantFoldingReducerTest, ParameterWithMinusZero) {
TEST_F(ConstantFoldingReducerTest, ParameterWithNull) {
Handle<HeapObject> null = factory()->null_value();
{
Reduction r =
Reduce(Parameter(Type::NewConstant(js_heap_broker(), null, zone())));
Reduction r = Reduce(Parameter(Type::NewConstant(broker(), null, zone())));
ASSERT_TRUE(r.Changed());
EXPECT_THAT(r.replacement(), IsHeapConstant(null));
}
......@@ -131,14 +129,14 @@ TEST_F(ConstantFoldingReducerTest, ParameterWithNaN) {
std::numeric_limits<double>::signaling_NaN()};
TRACED_FOREACH(double, nan, kNaNs) {
Handle<Object> constant = factory()->NewNumber(nan);
Reduction r = Reduce(
Parameter(Type::NewConstant(js_heap_broker(), constant, zone())));
Reduction r =
Reduce(Parameter(Type::NewConstant(broker(), constant, zone())));
ASSERT_TRUE(r.Changed());
EXPECT_THAT(r.replacement(), IsNumberConstant(IsNaN()));
}
{
Reduction r = Reduce(Parameter(
Type::NewConstant(js_heap_broker(), factory()->nan_value(), zone())));
Reduction r = Reduce(
Parameter(Type::NewConstant(broker(), factory()->nan_value(), zone())));
ASSERT_TRUE(r.Changed());
EXPECT_THAT(r.replacement(), IsNumberConstant(IsNaN()));
}
......@@ -152,8 +150,8 @@ TEST_F(ConstantFoldingReducerTest, ParameterWithNaN) {
TEST_F(ConstantFoldingReducerTest, ParameterWithPlainNumber) {
TRACED_FOREACH(double, value, kFloat64Values) {
Handle<Object> constant = factory()->NewNumber(value);
Reduction r = Reduce(
Parameter(Type::NewConstant(js_heap_broker(), constant, zone())));
Reduction r =
Reduce(Parameter(Type::NewConstant(broker(), constant, zone())));
ASSERT_TRUE(r.Changed());
EXPECT_THAT(r.replacement(), IsNumberConstant(value));
}
......@@ -172,8 +170,8 @@ TEST_F(ConstantFoldingReducerTest, ParameterWithUndefined) {
EXPECT_THAT(r.replacement(), IsHeapConstant(undefined));
}
{
Reduction r = Reduce(
Parameter(Type::NewConstant(js_heap_broker(), undefined, zone())));
Reduction r =
Reduce(Parameter(Type::NewConstant(broker(), undefined, zone())));
ASSERT_TRUE(r.Changed());
EXPECT_THAT(r.replacement(), IsHeapConstant(undefined));
}
......@@ -194,10 +192,10 @@ TEST_F(ConstantFoldingReducerTest, ToBooleanWithFalsish) {
Type::Undefined(),
Type::Union(
Type::Undetectable(),
Type::Union(Type::NewConstant(
js_heap_broker(),
factory()->false_value(), zone()),
Type::Range(0.0, 0.0, zone()), zone()),
Type::Union(
Type::NewConstant(
broker(), factory()->false_value(), zone()),
Type::Range(0.0, 0.0, zone()), zone()),
zone()),
zone()),
zone()),
......@@ -212,7 +210,7 @@ TEST_F(ConstantFoldingReducerTest, ToBooleanWithFalsish) {
TEST_F(ConstantFoldingReducerTest, ToBooleanWithTruish) {
Node* input = Parameter(
Type::Union(
Type::NewConstant(js_heap_broker(), factory()->true_value(), zone()),
Type::NewConstant(broker(), factory()->true_value(), zone()),
Type::Union(Type::DetectableReceiver(), Type::Symbol(), zone()),
zone()),
0);
......
......@@ -20,12 +20,12 @@ GraphTest::GraphTest(int num_parameters)
canonical_(isolate()),
common_(zone()),
graph_(zone()),
js_heap_broker_(isolate(), zone()),
broker_(isolate(), zone()),
source_positions_(&graph_),
node_origins_(&graph_) {
graph()->SetStart(graph()->NewNode(common()->Start(num_parameters)));
graph()->SetEnd(graph()->NewNode(common()->End(1), graph()->start()));
js_heap_broker()->SetNativeContextRef();
broker()->SetNativeContextRef();
}
......@@ -69,7 +69,7 @@ Node* GraphTest::NumberConstant(volatile double value) {
Node* GraphTest::HeapConstant(const Handle<HeapObject>& value) {
Node* node = graph()->NewNode(common()->HeapConstant(value));
Type type = Type::NewConstant(js_heap_broker(), value, zone());
Type type = Type::NewConstant(broker(), value, zone());
NodeProperties::SetType(node, type);
return node;
}
......@@ -119,8 +119,7 @@ Matcher<Node*> GraphTest::IsUndefinedConstant() {
}
TypedGraphTest::TypedGraphTest(int num_parameters)
: GraphTest(num_parameters),
typer_(js_heap_broker(), Typer::kNoFlags, graph()) {}
: GraphTest(num_parameters), typer_(broker(), Typer::kNoFlags, graph()) {}
TypedGraphTest::~TypedGraphTest() = default;
......
......@@ -62,13 +62,13 @@ class GraphTest : public virtual TestWithNativeContext,
Graph* graph() { return &graph_; }
SourcePositionTable* source_positions() { return &source_positions_; }
NodeOriginTable* node_origins() { return &node_origins_; }
JSHeapBroker* js_heap_broker() { return &js_heap_broker_; }
JSHeapBroker* broker() { return &broker_; }
private:
CanonicalHandleScope canonical_;
CommonOperatorBuilder common_;
Graph graph_;
JSHeapBroker js_heap_broker_;
JSHeapBroker broker_;
SourcePositionTable source_positions_;
NodeOriginTable node_origins_;
};
......
......@@ -23,7 +23,7 @@ class JSCallReducerTest : public TypedGraphTest {
JSCallReducerTest()
: TypedGraphTest(3), javascript_(zone()), deps_(isolate(), zone()) {
if (FLAG_concurrent_typed_lowering) {
js_heap_broker()->SerializeStandardObjects();
broker()->SerializeStandardObjects();
}
}
~JSCallReducerTest() override = default;
......@@ -37,7 +37,7 @@ class JSCallReducerTest : public TypedGraphTest {
// TODO(titzer): mock the GraphReducer here for better unit testing.
GraphReducer graph_reducer(zone(), graph());
JSCallReducer reducer(&graph_reducer, &jsgraph, js_heap_broker(),
JSCallReducer reducer(&graph_reducer, &jsgraph, broker(),
JSCallReducer::kNoFlags, native_context(), &deps_);
return reducer.Reduce(node);
}
......
......@@ -45,7 +45,7 @@ class JSCreateLoweringTest : public TypedGraphTest {
&machine);
// TODO(titzer): mock the GraphReducer here for better unit testing.
GraphReducer graph_reducer(zone(), graph());
JSCreateLowering reducer(&graph_reducer, &deps_, &jsgraph, js_heap_broker(),
JSCreateLowering reducer(&graph_reducer, &deps_, &jsgraph, broker(),
zone());
return reducer.Reduce(node);
}
......@@ -75,8 +75,8 @@ class JSCreateLoweringTest : public TypedGraphTest {
TEST_F(JSCreateLoweringTest, JSCreate) {
Handle<JSFunction> function = isolate()->object_function();
Node* const target = Parameter(
Type::HeapConstant(js_heap_broker(), function, graph()->zone()));
Node* const target =
Parameter(Type::HeapConstant(broker(), function, graph()->zone()));
Node* const context = Parameter(Type::Any());
Node* const effect = graph()->start();
Node* const control = graph()->start();
......
......@@ -34,14 +34,14 @@ TEST_F(JSNativeContextSpecializationTest, GetMaxStringLengthOfString) {
Node* const str_node = graph()->NewNode(
common()->HeapConstant(factory()->InternalizeUtf8String("str")));
EXPECT_EQ(JSNativeContextSpecialization::GetMaxStringLength(js_heap_broker(),
str_node),
str_len);
EXPECT_EQ(
JSNativeContextSpecialization::GetMaxStringLength(broker(), str_node),
str_len);
Node* const num_node = graph()->NewNode(common()->NumberConstant(10.0 / 3));
EXPECT_EQ(JSNativeContextSpecialization::GetMaxStringLength(js_heap_broker(),
num_node),
num_len);
EXPECT_EQ(
JSNativeContextSpecialization::GetMaxStringLength(broker(), num_node),
num_len);
}
} // namespace js_native_context_specialization_unittest
......
......@@ -48,7 +48,7 @@ class JSTypedLoweringTest : public TypedGraphTest {
&machine);
// TODO(titzer): mock the GraphReducer here for better unit testing.
GraphReducer graph_reducer(zone(), graph());
JSTypedLowering reducer(&graph_reducer, &jsgraph, js_heap_broker(), zone());
JSTypedLowering reducer(&graph_reducer, &jsgraph, broker(), zone());
return reducer.Reduce(node);
}
......
......@@ -651,7 +651,7 @@ TEST_F(RedundancyEliminationTest, CheckedUint64ToTaggedSigned) {
TEST_F(RedundancyEliminationTest,
SpeculativeNumberEqualWithCheckBoundsBetterType) {
Typer typer(js_heap_broker(), Typer::kNoFlags, graph());
Typer typer(broker(), Typer::kNoFlags, graph());
TRACED_FOREACH(VectorSlotPair, feedback1, vector_slot_pairs()) {
TRACED_FOREACH(VectorSlotPair, feedback2, vector_slot_pairs()) {
Node* lhs = Parameter(Type::Any(), 0);
......@@ -687,7 +687,7 @@ TEST_F(RedundancyEliminationTest,
TEST_F(RedundancyEliminationTest,
SpeculativeNumberEqualWithCheckBoundsSameType) {
Typer typer(js_heap_broker(), Typer::kNoFlags, graph());
Typer typer(broker(), Typer::kNoFlags, graph());
TRACED_FOREACH(VectorSlotPair, feedback1, vector_slot_pairs()) {
TRACED_FOREACH(VectorSlotPair, feedback2, vector_slot_pairs()) {
Node* lhs = Parameter(Type::UnsignedSmall(), 0);
......@@ -726,7 +726,7 @@ TEST_F(RedundancyEliminationTest,
TEST_F(RedundancyEliminationTest,
SpeculativeNumberLessThanWithCheckBoundsBetterType) {
Typer typer(js_heap_broker(), Typer::kNoFlags, graph());
Typer typer(broker(), Typer::kNoFlags, graph());
TRACED_FOREACH(VectorSlotPair, feedback1, vector_slot_pairs()) {
TRACED_FOREACH(VectorSlotPair, feedback2, vector_slot_pairs()) {
Node* lhs = Parameter(Type::Any(), 0);
......@@ -762,7 +762,7 @@ TEST_F(RedundancyEliminationTest,
TEST_F(RedundancyEliminationTest,
SpeculativeNumberLessThanWithCheckBoundsSameType) {
Typer typer(js_heap_broker(), Typer::kNoFlags, graph());
Typer typer(broker(), Typer::kNoFlags, graph());
TRACED_FOREACH(VectorSlotPair, feedback1, vector_slot_pairs()) {
TRACED_FOREACH(VectorSlotPair, feedback2, vector_slot_pairs()) {
Node* lhs = Parameter(Type::UnsignedSmall(), 0);
......@@ -801,7 +801,7 @@ TEST_F(RedundancyEliminationTest,
TEST_F(RedundancyEliminationTest,
SpeculativeNumberLessThanOrEqualWithCheckBoundsBetterType) {
Typer typer(js_heap_broker(), Typer::kNoFlags, graph());
Typer typer(broker(), Typer::kNoFlags, graph());
TRACED_FOREACH(VectorSlotPair, feedback1, vector_slot_pairs()) {
TRACED_FOREACH(VectorSlotPair, feedback2, vector_slot_pairs()) {
Node* lhs = Parameter(Type::Any(), 0);
......@@ -837,7 +837,7 @@ TEST_F(RedundancyEliminationTest,
TEST_F(RedundancyEliminationTest,
SpeculativeNumberLessThanOrEqualWithCheckBoundsSameType) {
Typer typer(js_heap_broker(), Typer::kNoFlags, graph());
Typer typer(broker(), Typer::kNoFlags, graph());
TRACED_FOREACH(VectorSlotPair, feedback1, vector_slot_pairs()) {
TRACED_FOREACH(VectorSlotPair, feedback2, vector_slot_pairs()) {
Node* lhs = Parameter(Type::UnsignedSmall(), 0);
......@@ -876,7 +876,7 @@ TEST_F(RedundancyEliminationTest,
TEST_F(RedundancyEliminationTest,
SpeculativeNumberAddWithCheckBoundsBetterType) {
Typer typer(js_heap_broker(), Typer::kNoFlags, graph());
Typer typer(broker(), Typer::kNoFlags, graph());
TRACED_FOREACH(VectorSlotPair, feedback, vector_slot_pairs()) {
TRACED_FOREACH(NumberOperationHint, hint, kNumberOperationHints) {
Node* lhs = Parameter(Type::Any(), 0);
......@@ -902,7 +902,7 @@ TEST_F(RedundancyEliminationTest,
}
TEST_F(RedundancyEliminationTest, SpeculativeNumberAddWithCheckBoundsSameType) {
Typer typer(js_heap_broker(), Typer::kNoFlags, graph());
Typer typer(broker(), Typer::kNoFlags, graph());
TRACED_FOREACH(VectorSlotPair, feedback, vector_slot_pairs()) {
TRACED_FOREACH(NumberOperationHint, hint, kNumberOperationHints) {
Node* lhs = Parameter(Type::Range(42.0, 42.0, zone()), 0);
......@@ -932,7 +932,7 @@ TEST_F(RedundancyEliminationTest, SpeculativeNumberAddWithCheckBoundsSameType) {
TEST_F(RedundancyEliminationTest,
SpeculativeNumberSubtractWithCheckBoundsBetterType) {
Typer typer(js_heap_broker(), Typer::kNoFlags, graph());
Typer typer(broker(), Typer::kNoFlags, graph());
TRACED_FOREACH(VectorSlotPair, feedback, vector_slot_pairs()) {
TRACED_FOREACH(NumberOperationHint, hint, kNumberOperationHints) {
Node* lhs = Parameter(Type::Any(), 0);
......@@ -960,7 +960,7 @@ TEST_F(RedundancyEliminationTest,
TEST_F(RedundancyEliminationTest,
SpeculativeNumberSubtractWithCheckBoundsSameType) {
Typer typer(js_heap_broker(), Typer::kNoFlags, graph());
Typer typer(broker(), Typer::kNoFlags, graph());
TRACED_FOREACH(VectorSlotPair, feedback, vector_slot_pairs()) {
TRACED_FOREACH(NumberOperationHint, hint, kNumberOperationHints) {
Node* lhs = Parameter(Type::Range(42.0, 42.0, zone()), 0);
......@@ -991,7 +991,7 @@ TEST_F(RedundancyEliminationTest,
TEST_F(RedundancyEliminationTest,
SpeculativeSafeIntegerAddWithCheckBoundsBetterType) {
Typer typer(js_heap_broker(), Typer::kNoFlags, graph());
Typer typer(broker(), Typer::kNoFlags, graph());
TRACED_FOREACH(VectorSlotPair, feedback, vector_slot_pairs()) {
TRACED_FOREACH(NumberOperationHint, hint, kNumberOperationHints) {
Node* lhs = Parameter(Type::Any(), 0);
......@@ -1019,7 +1019,7 @@ TEST_F(RedundancyEliminationTest,
TEST_F(RedundancyEliminationTest,
SpeculativeSafeIntegerAddWithCheckBoundsSameType) {
Typer typer(js_heap_broker(), Typer::kNoFlags, graph());
Typer typer(broker(), Typer::kNoFlags, graph());
TRACED_FOREACH(VectorSlotPair, feedback, vector_slot_pairs()) {
TRACED_FOREACH(NumberOperationHint, hint, kNumberOperationHints) {
Node* lhs = Parameter(Type::Range(42.0, 42.0, zone()), 0);
......@@ -1050,7 +1050,7 @@ TEST_F(RedundancyEliminationTest,
TEST_F(RedundancyEliminationTest,
SpeculativeSafeIntegerSubtractWithCheckBoundsBetterType) {
Typer typer(js_heap_broker(), Typer::kNoFlags, graph());
Typer typer(broker(), Typer::kNoFlags, graph());
TRACED_FOREACH(VectorSlotPair, feedback, vector_slot_pairs()) {
TRACED_FOREACH(NumberOperationHint, hint, kNumberOperationHints) {
Node* lhs = Parameter(Type::Any(), 0);
......@@ -1078,7 +1078,7 @@ TEST_F(RedundancyEliminationTest,
TEST_F(RedundancyEliminationTest,
SpeculativeSafeIntegerSubtractWithCheckBoundsSameType) {
Typer typer(js_heap_broker(), Typer::kNoFlags, graph());
Typer typer(broker(), Typer::kNoFlags, graph());
TRACED_FOREACH(VectorSlotPair, feedback, vector_slot_pairs()) {
TRACED_FOREACH(NumberOperationHint, hint, kNumberOperationHints) {
Node* lhs = Parameter(Type::Range(42.0, 42.0, zone()), 0);
......@@ -1109,7 +1109,7 @@ TEST_F(RedundancyEliminationTest,
TEST_F(RedundancyEliminationTest,
SpeculativeToNumberWithCheckBoundsBetterType) {
Typer typer(js_heap_broker(), Typer::kNoFlags, graph());
Typer typer(broker(), Typer::kNoFlags, graph());
TRACED_FOREACH(VectorSlotPair, feedback1, vector_slot_pairs()) {
TRACED_FOREACH(VectorSlotPair, feedback2, vector_slot_pairs()) {
TRACED_FOREACH(NumberOperationHint, hint, kNumberOperationHints) {
......@@ -1137,7 +1137,7 @@ TEST_F(RedundancyEliminationTest,
}
TEST_F(RedundancyEliminationTest, SpeculativeToNumberWithCheckBoundsSameType) {
Typer typer(js_heap_broker(), Typer::kNoFlags, graph());
Typer typer(broker(), Typer::kNoFlags, graph());
TRACED_FOREACH(VectorSlotPair, feedback1, vector_slot_pairs()) {
TRACED_FOREACH(VectorSlotPair, feedback2, vector_slot_pairs()) {
TRACED_FOREACH(NumberOperationHint, hint, kNumberOperationHints) {
......
......@@ -42,12 +42,12 @@ class SimplifiedLoweringTest : public GraphTest {
{
// Simplified lowering needs to run w/o the typer decorator so make sure
// the object is not live at the same time.
Typer typer(js_heap_broker(), Typer::kNoFlags, graph());
Typer typer(broker(), Typer::kNoFlags, graph());
typer.Run();
}
SimplifiedLowering lowering(jsgraph(), js_heap_broker(), zone(),
source_positions(), node_origins(),
SimplifiedLowering lowering(jsgraph(), broker(), zone(), source_positions(),
node_origins(),
PoisoningMitigationLevel::kDontPoison);
lowering.LowerAllNodes();
}
......
......@@ -29,14 +29,13 @@ class SimplifiedOperatorReducerTest : public GraphTest {
protected:
Reduction Reduce(Node* node) {
JSHeapBroker js_heap_broker(isolate(), zone());
JSHeapBroker broker(isolate(), zone());
MachineOperatorBuilder machine(zone());
JSOperatorBuilder javascript(zone());
JSGraph jsgraph(isolate(), graph(), common(), &javascript, simplified(),
&machine);
GraphReducer graph_reducer(zone(), graph());
SimplifiedOperatorReducer reducer(&graph_reducer, &jsgraph,
&js_heap_broker);
SimplifiedOperatorReducer reducer(&graph_reducer, &jsgraph, &broker);
return reducer.Reduce(node);
}
......
......@@ -38,8 +38,7 @@ class TypedOptimizationTest : public TypedGraphTest {
&machine);
// TODO(titzer): mock the GraphReducer here for better unit testing.
GraphReducer graph_reducer(zone(), graph());
TypedOptimization reducer(&graph_reducer, &deps_, &jsgraph,
js_heap_broker());
TypedOptimization reducer(&graph_reducer, &deps_, &jsgraph, broker());
return reducer.Reduce(node);
}
......
......@@ -22,8 +22,8 @@ class TyperTest : public TypedGraphTest {
public:
TyperTest()
: TypedGraphTest(3),
js_heap_broker_(isolate(), zone()),
operation_typer_(&js_heap_broker_, zone()),
broker_(isolate(), zone()),
operation_typer_(&broker_, zone()),
types_(zone(), isolate(), random_number_generator()),
javascript_(zone()),
simplified_(zone()) {
......@@ -56,7 +56,7 @@ class TyperTest : public TypedGraphTest {
const int kRepetitions = 50;
JSHeapBroker js_heap_broker_;
JSHeapBroker broker_;
OperationTyper operation_typer_;
Types types_;
JSOperatorBuilder javascript_;
......@@ -176,8 +176,8 @@ class TyperTest : public TypedGraphTest {
for (int x2 = rmin; x2 < rmin + width; x2++) {
double result_value = opfun(x1, x2);
Type result_type = Type::NewConstant(
&js_heap_broker_,
isolate()->factory()->NewNumber(result_value), zone());
&broker_, isolate()->factory()->NewNumber(result_value),
zone());
EXPECT_TRUE(result_type.Is(expected_type));
}
}
......@@ -198,23 +198,21 @@ class TyperTest : public TypedGraphTest {
double x2 = RandomInt(r2.AsRange());
double result_value = opfun(x1, x2);
Type result_type = Type::NewConstant(
&js_heap_broker_, isolate()->factory()->NewNumber(result_value),
zone());
&broker_, isolate()->factory()->NewNumber(result_value), zone());
EXPECT_TRUE(result_type.Is(expected_type));
}
}
// Test extreme cases.
double x1 = +1e-308;
double x2 = -1e-308;
Type r1 = Type::NewConstant(&js_heap_broker_,
isolate()->factory()->NewNumber(x1), zone());
Type r2 = Type::NewConstant(&js_heap_broker_,
isolate()->factory()->NewNumber(x2), zone());
Type r1 = Type::NewConstant(&broker_, isolate()->factory()->NewNumber(x1),
zone());
Type r2 = Type::NewConstant(&broker_, isolate()->factory()->NewNumber(x2),
zone());
Type expected_type = TypeBinaryOp(op, r1, r2);
double result_value = opfun(x1, x2);
Type result_type = Type::NewConstant(
&js_heap_broker_, isolate()->factory()->NewNumber(result_value),
zone());
&broker_, isolate()->factory()->NewNumber(result_value), zone());
EXPECT_TRUE(result_type.Is(expected_type));
}
......@@ -229,7 +227,7 @@ class TyperTest : public TypedGraphTest {
double x2 = RandomInt(r2.AsRange());
bool result_value = opfun(x1, x2);
Type result_type = Type::NewConstant(
&js_heap_broker_,
&broker_,
result_value ? isolate()->factory()->true_value()
: isolate()->factory()->false_value(),
zone());
......@@ -249,8 +247,7 @@ class TyperTest : public TypedGraphTest {
int32_t x2 = static_cast<int32_t>(RandomInt(r2.AsRange()));
double result_value = opfun(x1, x2);
Type result_type = Type::NewConstant(
&js_heap_broker_, isolate()->factory()->NewNumber(result_value),
zone());
&broker_, isolate()->factory()->NewNumber(result_value), zone());
EXPECT_TRUE(result_type.Is(expected_type));
}
}
......
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