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

[turbofan] Properly assign types to Array/String iterators.

When inlining allocations for Array and String iterators, make sure the
allocations have proper types on it (rather than just Type::Any). This
allows us to escape analyze the iterators in a couple of more cases,
i.e. in this very simple case:

  function f(a) {
    const it = a[Symbol.iterator]();
    return it.next().value;
  }

R=jarin@chromium.org
BUG=v8:4586,v8:5448

Review-Url: https://codereview.chromium.org/2640743003
Cr-Commit-Position: refs/heads/master@{#42449}
parent a45fa2d8
...@@ -307,6 +307,7 @@ Reduction JSBuiltinReducer::ReduceArrayIterator(Handle<Map> receiver_map, ...@@ -307,6 +307,7 @@ Reduction JSBuiltinReducer::ReduceArrayIterator(Handle<Map> receiver_map,
Node* value = effect = graph()->NewNode( Node* value = effect = graph()->NewNode(
simplified()->Allocate(NOT_TENURED), simplified()->Allocate(NOT_TENURED),
jsgraph()->Constant(JSArrayIterator::kSize), effect, control); jsgraph()->Constant(JSArrayIterator::kSize), effect, control);
NodeProperties::SetType(value, Type::OtherObject());
effect = graph()->NewNode(simplified()->StoreField(AccessBuilder::ForMap()), effect = graph()->NewNode(simplified()->StoreField(AccessBuilder::ForMap()),
value, jsgraph()->Constant(map), effect, control); value, jsgraph()->Constant(map), effect, control);
effect = graph()->NewNode( effect = graph()->NewNode(
...@@ -1743,6 +1744,7 @@ Reduction JSBuiltinReducer::ReduceStringIterator(Node* node) { ...@@ -1743,6 +1744,7 @@ Reduction JSBuiltinReducer::ReduceStringIterator(Node* node) {
Node* value = effect = graph()->NewNode( Node* value = effect = graph()->NewNode(
simplified()->Allocate(NOT_TENURED), simplified()->Allocate(NOT_TENURED),
jsgraph()->Constant(JSStringIterator::kSize), effect, control); jsgraph()->Constant(JSStringIterator::kSize), effect, control);
NodeProperties::SetType(value, Type::OtherObject());
effect = graph()->NewNode(simplified()->StoreField(AccessBuilder::ForMap()), effect = graph()->NewNode(simplified()->StoreField(AccessBuilder::ForMap()),
value, map, effect, control); value, map, effect, control);
effect = graph()->NewNode( effect = graph()->NewNode(
......
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