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

Side by Side Diff: src/compiler/js-typed-lowering.cc

Issue 1516433005: [contexts] Place the initial JSArray maps on the native context directly. (Closed) Base URL: https://chromium.googlesource.com/v8/v8.git@master
Patch Set: Address comment. Created 5 years 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/arm64/macro-assembler-arm64.cc ('k') | src/contexts.h » ('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/code-factory.h" 5 #include "src/code-factory.h"
6 #include "src/compilation-dependencies.h" 6 #include "src/compilation-dependencies.h"
7 #include "src/compiler/access-builder.h" 7 #include "src/compiler/access-builder.h"
8 #include "src/compiler/js-graph.h" 8 #include "src/compiler/js-graph.h"
9 #include "src/compiler/js-typed-lowering.h" 9 #include "src/compiler/js-typed-lowering.h"
10 #include "src/compiler/linkage.h" 10 #include "src/compiler/linkage.h"
(...skipping 1542 matching lines...) Expand 10 before | Expand all | Expand 10 after
1553 } 1553 }
1554 1554
1555 return NoChange(); 1555 return NoChange();
1556 } 1556 }
1557 1557
1558 1558
1559 Reduction JSTypedLowering::ReduceNewArray(Node* node, Node* length, 1559 Reduction JSTypedLowering::ReduceNewArray(Node* node, Node* length,
1560 int capacity, 1560 int capacity,
1561 Handle<AllocationSite> site) { 1561 Handle<AllocationSite> site) {
1562 DCHECK_EQ(IrOpcode::kJSCreateArray, node->opcode()); 1562 DCHECK_EQ(IrOpcode::kJSCreateArray, node->opcode());
1563 Node* target = NodeProperties::GetValueInput(node, 0);
1564 Type* target_type = NodeProperties::GetType(target);
1565 Node* context = NodeProperties::GetContextInput(node); 1563 Node* context = NodeProperties::GetContextInput(node);
1566 Node* effect = NodeProperties::GetEffectInput(node); 1564 Node* effect = NodeProperties::GetEffectInput(node);
1567 Node* control = NodeProperties::GetControlInput(node); 1565 Node* control = NodeProperties::GetControlInput(node);
1568 1566
1569 // Extract transition and tenuring feedback from the {site} and add 1567 // Extract transition and tenuring feedback from the {site} and add
1570 // appropriate code dependencies on the {site} if deoptimization is 1568 // appropriate code dependencies on the {site} if deoptimization is
1571 // enabled. 1569 // enabled.
1572 PretenureFlag pretenure = site->GetPretenureMode(); 1570 PretenureFlag pretenure = site->GetPretenureMode();
1573 ElementsKind elements_kind = site->GetElementsKind(); 1571 ElementsKind elements_kind = site->GetElementsKind();
1572 DCHECK(IsFastElementsKind(elements_kind));
1574 if (flags() & kDeoptimizationEnabled) { 1573 if (flags() & kDeoptimizationEnabled) {
1575 dependencies()->AssumeTenuringDecision(site); 1574 dependencies()->AssumeTenuringDecision(site);
1576 dependencies()->AssumeTransitionStable(site); 1575 dependencies()->AssumeTransitionStable(site);
1577 } 1576 }
1578 1577
1579 // Retrieve the initial map for the array from the appropriate native context. 1578 // Retrieve the initial map for the array from the appropriate native context.
1580 Node* js_array_map; 1579 Node* native_context = effect = graph()->NewNode(
1581 if (target_type->IsConstant()) { 1580 javascript()->LoadContext(0, Context::NATIVE_CONTEXT_INDEX, true),
1582 Handle<JSFunction> target_function = 1581 context, context, effect);
1583 Handle<JSFunction>::cast(target_type->AsConstant()->Value()); 1582 Node* js_array_map = effect = graph()->NewNode(
1584 Handle<FixedArray> js_array_maps( 1583 javascript()->LoadContext(0, Context::ArrayMapIndex(elements_kind), true),
1585 FixedArray::cast(target_function->native_context()->js_array_maps()), 1584 native_context, native_context, effect);
1586 isolate());
1587 js_array_map = jsgraph()->Constant(
1588 handle(js_array_maps->get(elements_kind), isolate()));
1589 } else {
1590 Node* native_context = effect = graph()->NewNode(
1591 javascript()->LoadContext(0, Context::NATIVE_CONTEXT_INDEX, true),
1592 context, context, effect);
1593 Node* js_array_maps = effect = graph()->NewNode(
1594 javascript()->LoadContext(0, Context::JS_ARRAY_MAPS_INDEX, true),
1595 native_context, native_context, effect);
1596 js_array_map = effect =
1597 graph()->NewNode(simplified()->LoadField(
1598 AccessBuilder::ForFixedArraySlot(elements_kind)),
1599 js_array_maps, effect, control);
1600 }
1601 1585
1602 // Setup elements and properties. 1586 // Setup elements and properties.
1603 Node* elements; 1587 Node* elements;
1604 if (capacity == 0) { 1588 if (capacity == 0) {
1605 elements = jsgraph()->EmptyFixedArrayConstant(); 1589 elements = jsgraph()->EmptyFixedArrayConstant();
1606 } else { 1590 } else {
1607 elements = effect = 1591 elements = effect =
1608 AllocateElements(effect, control, elements_kind, capacity, pretenure); 1592 AllocateElements(effect, control, elements_kind, capacity, pretenure);
1609 } 1593 }
1610 Node* properties = jsgraph()->EmptyFixedArrayConstant(); 1594 Node* properties = jsgraph()->EmptyFixedArrayConstant();
(...skipping 1078 matching lines...) Expand 10 before | Expand all | Expand 10 after
2689 } 2673 }
2690 2674
2691 2675
2692 CompilationDependencies* JSTypedLowering::dependencies() const { 2676 CompilationDependencies* JSTypedLowering::dependencies() const {
2693 return dependencies_; 2677 return dependencies_;
2694 } 2678 }
2695 2679
2696 } // namespace compiler 2680 } // namespace compiler
2697 } // namespace internal 2681 } // namespace internal
2698 } // namespace v8 2682 } // namespace v8
OLDNEW
« no previous file with comments | « src/arm64/macro-assembler-arm64.cc ('k') | src/contexts.h » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698