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

Unified 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 side-by-side diff with in-line comments
Download patch
« no previous file with comments | « src/arm64/macro-assembler-arm64.cc ('k') | src/contexts.h » ('j') | no next file with comments »
Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
Index: src/compiler/js-typed-lowering.cc
diff --git a/src/compiler/js-typed-lowering.cc b/src/compiler/js-typed-lowering.cc
index 670430609f069e582b02d079b84441a316fd1db7..3ea1675801a3609d762f78232c83722c6879f57e 100644
--- a/src/compiler/js-typed-lowering.cc
+++ b/src/compiler/js-typed-lowering.cc
@@ -1560,8 +1560,6 @@ Reduction JSTypedLowering::ReduceNewArray(Node* node, Node* length,
int capacity,
Handle<AllocationSite> site) {
DCHECK_EQ(IrOpcode::kJSCreateArray, node->opcode());
- Node* target = NodeProperties::GetValueInput(node, 0);
- Type* target_type = NodeProperties::GetType(target);
Node* context = NodeProperties::GetContextInput(node);
Node* effect = NodeProperties::GetEffectInput(node);
Node* control = NodeProperties::GetControlInput(node);
@@ -1571,33 +1569,19 @@ Reduction JSTypedLowering::ReduceNewArray(Node* node, Node* length,
// enabled.
PretenureFlag pretenure = site->GetPretenureMode();
ElementsKind elements_kind = site->GetElementsKind();
+ DCHECK(IsFastElementsKind(elements_kind));
if (flags() & kDeoptimizationEnabled) {
dependencies()->AssumeTenuringDecision(site);
dependencies()->AssumeTransitionStable(site);
}
// Retrieve the initial map for the array from the appropriate native context.
- Node* js_array_map;
- if (target_type->IsConstant()) {
- Handle<JSFunction> target_function =
- Handle<JSFunction>::cast(target_type->AsConstant()->Value());
- Handle<FixedArray> js_array_maps(
- FixedArray::cast(target_function->native_context()->js_array_maps()),
- isolate());
- js_array_map = jsgraph()->Constant(
- handle(js_array_maps->get(elements_kind), isolate()));
- } else {
- Node* native_context = effect = graph()->NewNode(
- javascript()->LoadContext(0, Context::NATIVE_CONTEXT_INDEX, true),
- context, context, effect);
- Node* js_array_maps = effect = graph()->NewNode(
- javascript()->LoadContext(0, Context::JS_ARRAY_MAPS_INDEX, true),
- native_context, native_context, effect);
- js_array_map = effect =
- graph()->NewNode(simplified()->LoadField(
- AccessBuilder::ForFixedArraySlot(elements_kind)),
- js_array_maps, effect, control);
- }
+ Node* native_context = effect = graph()->NewNode(
+ javascript()->LoadContext(0, Context::NATIVE_CONTEXT_INDEX, true),
+ context, context, effect);
+ Node* js_array_map = effect = graph()->NewNode(
+ javascript()->LoadContext(0, Context::ArrayMapIndex(elements_kind), true),
+ native_context, native_context, effect);
// Setup elements and properties.
Node* elements;
« 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