Chromium Code Reviews
chromiumcodereview-hr@appspot.gserviceaccount.com (chromiumcodereview-hr) | Please choose your nickname with Settings | Help | Chromium Project | Gerrit Changes | Sign out
(1)

Side by Side Diff: src/compiler/js-builtin-reducer.cc

Issue 2797993006: [turbofan] Add type to the allocation operator. (Closed)
Patch Set: Remove caching Created 3 years, 8 months ago
Use n/p to move between diff chunks; N/P to move between comments. Draft comments are only viewable by you.
Jump to:
View unified diff | Download patch
« no previous file with comments | « src/compiler/graph-assembler.cc ('k') | src/compiler/js-create-lowering.cc » ('j') | no next file with comments »
Toggle Intra-line Diffs ('i') | Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
OLDNEW
1 // Copyright 2014 the V8 project authors. All rights reserved. 1 // Copyright 2014 the V8 project authors. All rights reserved.
2 // Use of this source code is governed by a BSD-style license that can be 2 // Use of this source code is governed by a BSD-style license that can be
3 // found in the LICENSE file. 3 // found in the LICENSE file.
4 4
5 #include "src/compiler/js-builtin-reducer.h" 5 #include "src/compiler/js-builtin-reducer.h"
6 6
7 #include "src/base/bits.h" 7 #include "src/base/bits.h"
8 #include "src/code-factory.h" 8 #include "src/code-factory.h"
9 #include "src/compilation-dependencies.h" 9 #include "src/compilation-dependencies.h"
10 #include "src/compiler/access-builder.h" 10 #include "src/compiler/access-builder.h"
(...skipping 277 matching lines...) Expand 10 before | Expand all | Expand 10 after
288 288
289 DCHECK_GE(map_index, Context::TYPED_ARRAY_KEY_ITERATOR_MAP_INDEX); 289 DCHECK_GE(map_index, Context::TYPED_ARRAY_KEY_ITERATOR_MAP_INDEX);
290 DCHECK_LE(map_index, Context::GENERIC_ARRAY_VALUE_ITERATOR_MAP_INDEX); 290 DCHECK_LE(map_index, Context::GENERIC_ARRAY_VALUE_ITERATOR_MAP_INDEX);
291 291
292 Handle<Map> map(Map::cast(native_context()->get(map_index)), isolate()); 292 Handle<Map> map(Map::cast(native_context()->get(map_index)), isolate());
293 293
294 // allocate new iterator 294 // allocate new iterator
295 effect = graph()->NewNode( 295 effect = graph()->NewNode(
296 common()->BeginRegion(RegionObservability::kNotObservable), effect); 296 common()->BeginRegion(RegionObservability::kNotObservable), effect);
297 Node* value = effect = graph()->NewNode( 297 Node* value = effect = graph()->NewNode(
298 simplified()->Allocate(NOT_TENURED), 298 simplified()->Allocate(Type::OtherObject(), NOT_TENURED),
299 jsgraph()->Constant(JSArrayIterator::kSize), effect, control); 299 jsgraph()->Constant(JSArrayIterator::kSize), effect, control);
300 NodeProperties::SetType(value, Type::OtherObject());
301 effect = graph()->NewNode(simplified()->StoreField(AccessBuilder::ForMap()), 300 effect = graph()->NewNode(simplified()->StoreField(AccessBuilder::ForMap()),
302 value, jsgraph()->Constant(map), effect, control); 301 value, jsgraph()->Constant(map), effect, control);
303 effect = graph()->NewNode( 302 effect = graph()->NewNode(
304 simplified()->StoreField(AccessBuilder::ForJSObjectProperties()), value, 303 simplified()->StoreField(AccessBuilder::ForJSObjectProperties()), value,
305 jsgraph()->EmptyFixedArrayConstant(), effect, control); 304 jsgraph()->EmptyFixedArrayConstant(), effect, control);
306 effect = graph()->NewNode( 305 effect = graph()->NewNode(
307 simplified()->StoreField(AccessBuilder::ForJSObjectElements()), value, 306 simplified()->StoreField(AccessBuilder::ForJSObjectElements()), value,
308 jsgraph()->EmptyFixedArrayConstant(), effect, control); 307 jsgraph()->EmptyFixedArrayConstant(), effect, control);
309 308
310 // attach the iterator to this object 309 // attach the iterator to this object
(...skipping 1264 matching lines...) Expand 10 before | Expand all | Expand 10 after
1575 int capacity = 1574 int capacity =
1576 NameDictionary::ComputeCapacity(NameDictionary::kInitialCapacity); 1575 NameDictionary::ComputeCapacity(NameDictionary::kInitialCapacity);
1577 DCHECK(base::bits::IsPowerOfTwo32(capacity)); 1576 DCHECK(base::bits::IsPowerOfTwo32(capacity));
1578 int length = NameDictionary::EntryToIndex(capacity); 1577 int length = NameDictionary::EntryToIndex(capacity);
1579 int size = NameDictionary::SizeFor(length); 1578 int size = NameDictionary::SizeFor(length);
1580 1579
1581 effect = graph()->NewNode( 1580 effect = graph()->NewNode(
1582 common()->BeginRegion(RegionObservability::kNotObservable), effect); 1581 common()->BeginRegion(RegionObservability::kNotObservable), effect);
1583 1582
1584 Node* value = effect = 1583 Node* value = effect =
1585 graph()->NewNode(simplified()->Allocate(NOT_TENURED), 1584 graph()->NewNode(simplified()->Allocate(Type::Any(), NOT_TENURED),
1586 jsgraph()->Constant(size), effect, control); 1585 jsgraph()->Constant(size), effect, control);
1587 effect = 1586 effect =
1588 graph()->NewNode(simplified()->StoreField(AccessBuilder::ForMap()), 1587 graph()->NewNode(simplified()->StoreField(AccessBuilder::ForMap()),
1589 value, jsgraph()->HeapConstant(map), effect, control); 1588 value, jsgraph()->HeapConstant(map), effect, control);
1590 1589
1591 // Initialize FixedArray fields. 1590 // Initialize FixedArray fields.
1592 effect = graph()->NewNode( 1591 effect = graph()->NewNode(
1593 simplified()->StoreField(AccessBuilder::ForFixedArrayLength()), value, 1592 simplified()->StoreField(AccessBuilder::ForFixedArrayLength()), value,
1594 jsgraph()->SmiConstant(length), effect, control); 1593 jsgraph()->SmiConstant(length), effect, control);
1595 // Initialize HashTable fields. 1594 // Initialize HashTable fields.
(...skipping 32 matching lines...) Expand 10 before | Expand all | Expand 10 after
1628 1627
1629 int const instance_size = instance_map->instance_size(); 1628 int const instance_size = instance_map->instance_size();
1630 if (instance_size > kMaxRegularHeapObjectSize) return NoChange(); 1629 if (instance_size > kMaxRegularHeapObjectSize) return NoChange();
1631 dependencies()->AssumeInitialMapCantChange(instance_map); 1630 dependencies()->AssumeInitialMapCantChange(instance_map);
1632 1631
1633 // Emit code to allocate the JSObject instance for the given 1632 // Emit code to allocate the JSObject instance for the given
1634 // {instance_map}. 1633 // {instance_map}.
1635 effect = graph()->NewNode( 1634 effect = graph()->NewNode(
1636 common()->BeginRegion(RegionObservability::kNotObservable), effect); 1635 common()->BeginRegion(RegionObservability::kNotObservable), effect);
1637 Node* value = effect = 1636 Node* value = effect =
1638 graph()->NewNode(simplified()->Allocate(NOT_TENURED), 1637 graph()->NewNode(simplified()->Allocate(Type::Any(), NOT_TENURED),
1639 jsgraph()->Constant(instance_size), effect, control); 1638 jsgraph()->Constant(instance_size), effect, control);
1640 effect = 1639 effect =
1641 graph()->NewNode(simplified()->StoreField(AccessBuilder::ForMap()), value, 1640 graph()->NewNode(simplified()->StoreField(AccessBuilder::ForMap()), value,
1642 jsgraph()->HeapConstant(instance_map), effect, control); 1641 jsgraph()->HeapConstant(instance_map), effect, control);
1643 effect = graph()->NewNode( 1642 effect = graph()->NewNode(
1644 simplified()->StoreField(AccessBuilder::ForJSObjectProperties()), value, 1643 simplified()->StoreField(AccessBuilder::ForJSObjectProperties()), value,
1645 properties, effect, control); 1644 properties, effect, control);
1646 effect = graph()->NewNode( 1645 effect = graph()->NewNode(
1647 simplified()->StoreField(AccessBuilder::ForJSObjectElements()), value, 1646 simplified()->StoreField(AccessBuilder::ForJSObjectElements()), value,
1648 jsgraph()->EmptyFixedArrayConstant(), effect, control); 1647 jsgraph()->EmptyFixedArrayConstant(), effect, control);
(...skipping 222 matching lines...) Expand 10 before | Expand all | Expand 10 after
1871 Node* effect = NodeProperties::GetEffectInput(node); 1870 Node* effect = NodeProperties::GetEffectInput(node);
1872 Node* control = NodeProperties::GetControlInput(node); 1871 Node* control = NodeProperties::GetControlInput(node);
1873 1872
1874 Node* map = jsgraph()->HeapConstant( 1873 Node* map = jsgraph()->HeapConstant(
1875 handle(native_context()->string_iterator_map(), isolate())); 1874 handle(native_context()->string_iterator_map(), isolate()));
1876 1875
1877 // allocate new iterator 1876 // allocate new iterator
1878 effect = graph()->NewNode( 1877 effect = graph()->NewNode(
1879 common()->BeginRegion(RegionObservability::kNotObservable), effect); 1878 common()->BeginRegion(RegionObservability::kNotObservable), effect);
1880 Node* value = effect = graph()->NewNode( 1879 Node* value = effect = graph()->NewNode(
1881 simplified()->Allocate(NOT_TENURED), 1880 simplified()->Allocate(Type::OtherObject(), NOT_TENURED),
1882 jsgraph()->Constant(JSStringIterator::kSize), effect, control); 1881 jsgraph()->Constant(JSStringIterator::kSize), effect, control);
1883 NodeProperties::SetType(value, Type::OtherObject());
1884 effect = graph()->NewNode(simplified()->StoreField(AccessBuilder::ForMap()), 1882 effect = graph()->NewNode(simplified()->StoreField(AccessBuilder::ForMap()),
1885 value, map, effect, control); 1883 value, map, effect, control);
1886 effect = graph()->NewNode( 1884 effect = graph()->NewNode(
1887 simplified()->StoreField(AccessBuilder::ForJSObjectProperties()), value, 1885 simplified()->StoreField(AccessBuilder::ForJSObjectProperties()), value,
1888 jsgraph()->EmptyFixedArrayConstant(), effect, control); 1886 jsgraph()->EmptyFixedArrayConstant(), effect, control);
1889 effect = graph()->NewNode( 1887 effect = graph()->NewNode(
1890 simplified()->StoreField(AccessBuilder::ForJSObjectElements()), value, 1888 simplified()->StoreField(AccessBuilder::ForJSObjectElements()), value,
1891 jsgraph()->EmptyFixedArrayConstant(), effect, control); 1889 jsgraph()->EmptyFixedArrayConstant(), effect, control);
1892 1890
1893 // attach the iterator to this string 1891 // attach the iterator to this string
(...skipping 418 matching lines...) Expand 10 before | Expand all | Expand 10 after
2312 return jsgraph()->simplified(); 2310 return jsgraph()->simplified();
2313 } 2311 }
2314 2312
2315 JSOperatorBuilder* JSBuiltinReducer::javascript() const { 2313 JSOperatorBuilder* JSBuiltinReducer::javascript() const {
2316 return jsgraph()->javascript(); 2314 return jsgraph()->javascript();
2317 } 2315 }
2318 2316
2319 } // namespace compiler 2317 } // namespace compiler
2320 } // namespace internal 2318 } // namespace internal
2321 } // namespace v8 2319 } // namespace v8
OLDNEW
« no previous file with comments | « src/compiler/graph-assembler.cc ('k') | src/compiler/js-create-lowering.cc » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698