Commit 87aab49a authored by jarin's avatar jarin Committed by Commit bot

[turbofan] Remove the --turbo-allocate flag.

The CL also fixes various small bugs in context allocation.

Review URL: https://codereview.chromium.org/1404293002

Cr-Commit-Position: refs/heads/master@{#31311}
parent 3c1f62ad
......@@ -1256,13 +1256,18 @@ Reduction JSTypedLowering::ReduceJSCreateLiteralObject(Node* node) {
Reduction JSTypedLowering::ReduceJSCreateFunctionContext(Node* node) {
DCHECK_EQ(IrOpcode::kJSCreateFunctionContext, node->opcode());
int slot_count = OpParameter<int>(node->op());
Node* const closure = NodeProperties::GetValueInput(node, 0);
// The closure can be NumberConstant(0) if the closure is global code
// (rather than a function). We exclude that case here.
// TODO(jarin) Find a better way to check that the closure is a function.
// Use inline allocation for function contexts up to a size limit.
if (FLAG_turbo_allocate && slot_count < kFunctionContextAllocationLimit) {
if (slot_count < kFunctionContextAllocationLimit &&
closure->opcode() != IrOpcode::kNumberConstant) {
// JSCreateFunctionContext[slot_count < limit]](fun)
Node* const effect = NodeProperties::GetEffectInput(node);
Node* const control = NodeProperties::GetControlInput(node);
Node* const closure = NodeProperties::GetValueInput(node, 0);
Node* const context = NodeProperties::GetContextInput(node);
Node* const extension = jsgraph()->ZeroConstant();
Node* const load = graph()->NewNode(
......@@ -1278,7 +1283,7 @@ Reduction JSTypedLowering::ReduceJSCreateFunctionContext(Node* node) {
a.Store(AccessBuilder::ForContextSlot(Context::EXTENSION_INDEX), extension);
a.Store(AccessBuilder::ForContextSlot(Context::GLOBAL_OBJECT_INDEX), load);
for (int i = Context::MIN_CONTEXT_SLOTS; i < context_length; ++i) {
a.Store(AccessBuilder::ForContextSlot(i), jsgraph()->TheHoleConstant());
a.Store(AccessBuilder::ForContextSlot(i), jsgraph()->UndefinedConstant());
}
RelaxControls(node);
a.Finish(node);
......@@ -1306,14 +1311,19 @@ Reduction JSTypedLowering::ReduceJSCreateFunctionContext(Node* node) {
Reduction JSTypedLowering::ReduceJSCreateWithContext(Node* node) {
DCHECK_EQ(IrOpcode::kJSCreateWithContext, node->opcode());
Node* const input = NodeProperties::GetValueInput(node, 0);
Node* const closure = NodeProperties::GetValueInput(node, 1);
Type* input_type = NodeProperties::GetType(input);
// The closure can be NumberConstant(0) if the closure is global code
// (rather than a function). We exclude that case here.
// TODO(jarin) Find a better way to check that the closure is a function.
// Use inline allocation for with contexts for regular objects.
if (FLAG_turbo_allocate && input_type->Is(Type::Receiver())) {
if (input_type->Is(Type::Receiver()) &&
closure->opcode() != IrOpcode::kNumberConstant) {
// JSCreateWithContext(o:receiver, fun)
Node* const effect = NodeProperties::GetEffectInput(node);
Node* const control = NodeProperties::GetControlInput(node);
Node* const closure = NodeProperties::GetValueInput(node, 1);
Node* const context = NodeProperties::GetContextInput(node);
Node* const load = graph()->NewNode(
simplified()->LoadField(
......@@ -1339,13 +1349,18 @@ Reduction JSTypedLowering::ReduceJSCreateBlockContext(Node* node) {
DCHECK_EQ(IrOpcode::kJSCreateBlockContext, node->opcode());
Handle<ScopeInfo> scope_info = OpParameter<Handle<ScopeInfo>>(node);
int context_length = scope_info->ContextLength();
Node* const closure = NodeProperties::GetValueInput(node, 0);
// The closure can be NumberConstant(0) if the closure is global code
// (rather than a function). We exclude that case here.
// TODO(jarin) Find a better way to check that the closure is a function.
// Use inline allocation for block contexts up to a size limit.
if (FLAG_turbo_allocate && context_length < kBlockContextAllocationLimit) {
if (context_length < kBlockContextAllocationLimit &&
closure->opcode() != IrOpcode::kNumberConstant) {
// JSCreateBlockContext[scope[length < limit]](fun)
Node* const effect = NodeProperties::GetEffectInput(node);
Node* const control = NodeProperties::GetControlInput(node);
Node* const closure = NodeProperties::GetValueInput(node, 1);
Node* const context = NodeProperties::GetContextInput(node);
Node* const extension = jsgraph()->Constant(scope_info);
Node* const load = graph()->NewNode(
......
......@@ -430,7 +430,6 @@ DEFINE_BOOL(turbo_stats, false, "print TurboFan statistics")
DEFINE_BOOL(turbo_splitting, true, "split nodes during scheduling in TurboFan")
DEFINE_BOOL(turbo_types, true, "use typed lowering in TurboFan")
DEFINE_BOOL(turbo_type_feedback, false, "use type feedback in TurboFan")
DEFINE_BOOL(turbo_allocate, false, "enable inline allocations in TurboFan")
DEFINE_BOOL(turbo_source_positions, false,
"track source code positions when building TurboFan IR")
DEFINE_IMPLICATION(trace_turbo, turbo_source_positions)
......
......@@ -1056,7 +1056,6 @@ TEST_F(JSTypedLoweringTest, JSCreateLiteralObject) {
TEST_F(JSTypedLoweringTest, JSCreateFunctionContextViaInlinedAllocation) {
if (!FLAG_turbo_allocate) return;
Node* const closure = Parameter(Type::Any());
Node* const context = Parameter(Type::Any());
Node* const effect = graph()->start();
......@@ -1094,7 +1093,6 @@ TEST_F(JSTypedLoweringTest, JSCreateFunctionContextViaStub) {
TEST_F(JSTypedLoweringTest, JSCreateWithContext) {
if (!FLAG_turbo_allocate) return;
Node* const object = Parameter(Type::Receiver());
Node* const closure = Parameter(Type::Any());
Node* const context = Parameter(Type::Any());
......
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