Commit e0b4b1b6 authored by bmeurer's avatar bmeurer Committed by Commit bot

[turbofan] Manually smash the type on literal allocation.

Currently JSCreateLowering drops the type information for object
literals, when inlining the JSCreateLiteralArray/Object nodes,
which means we will not eliminate a couple of checks after the
lowering.

R=jarin@chromium.org

Review-Url: https://codereview.chromium.org/2423913002
Cr-Commit-Position: refs/heads/master@{#40344}
parent 9768ff47
...@@ -36,12 +36,16 @@ class AllocationBuilder final { ...@@ -36,12 +36,16 @@ class AllocationBuilder final {
control_(control) {} control_(control) {}
// Primitive allocation of static size. // Primitive allocation of static size.
void Allocate(int size, PretenureFlag pretenure = NOT_TENURED) { void Allocate(int size, PretenureFlag pretenure = NOT_TENURED,
Type* type = Type::Any()) {
effect_ = graph()->NewNode( effect_ = graph()->NewNode(
common()->BeginRegion(RegionObservability::kNotObservable), effect_); common()->BeginRegion(RegionObservability::kNotObservable), effect_);
allocation_ = allocation_ =
graph()->NewNode(simplified()->Allocate(pretenure), graph()->NewNode(simplified()->Allocate(pretenure),
jsgraph()->Constant(size), effect_, control_); jsgraph()->Constant(size), effect_, control_);
// TODO(turbofan): Maybe we should put the Type* onto the Allocate operator
// at some point, or maybe we should have a completely differnt story.
NodeProperties::SetType(allocation_, type);
effect_ = allocation_; effect_ = allocation_;
} }
...@@ -65,7 +69,7 @@ class AllocationBuilder final { ...@@ -65,7 +69,7 @@ class AllocationBuilder final {
int size = (map->instance_type() == FIXED_ARRAY_TYPE) int size = (map->instance_type() == FIXED_ARRAY_TYPE)
? FixedArray::SizeFor(length) ? FixedArray::SizeFor(length)
: FixedDoubleArray::SizeFor(length); : FixedDoubleArray::SizeFor(length);
Allocate(size, pretenure); Allocate(size, pretenure, Type::OtherInternal());
Store(AccessBuilder::ForMap(), map); Store(AccessBuilder::ForMap(), map);
Store(AccessBuilder::ForFixedArrayLength(), jsgraph()->Constant(length)); Store(AccessBuilder::ForFixedArrayLength(), jsgraph()->Constant(length));
} }
...@@ -1109,7 +1113,8 @@ Node* JSCreateLowering::AllocateFastLiteral( ...@@ -1109,7 +1113,8 @@ Node* JSCreateLowering::AllocateFastLiteral(
// Actually allocate and initialize the object. // Actually allocate and initialize the object.
AllocationBuilder builder(jsgraph(), effect, control); AllocationBuilder builder(jsgraph(), effect, control);
builder.Allocate(boilerplate_map->instance_size(), pretenure); builder.Allocate(boilerplate_map->instance_size(), pretenure,
Type::OtherObject());
builder.Store(AccessBuilder::ForMap(), boilerplate_map); builder.Store(AccessBuilder::ForMap(), boilerplate_map);
builder.Store(AccessBuilder::ForJSObjectProperties(), properties); builder.Store(AccessBuilder::ForJSObjectProperties(), properties);
builder.Store(AccessBuilder::ForJSObjectElements(), elements); builder.Store(AccessBuilder::ForJSObjectElements(), elements);
......
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