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

Unified Diff: src/compiler/js-native-context-specialization.cc

Issue 1448343002: [turbofan] Finish support for holey double elements backing stores. (Closed) Base URL: https://chromium.googlesource.com/v8/v8.git@master
Patch Set: Created 5 years, 1 month 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/compiler/access-info.cc ('k') | src/compiler/js-typed-lowering.cc » ('j') | no next file with comments »
Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
Index: src/compiler/js-native-context-specialization.cc
diff --git a/src/compiler/js-native-context-specialization.cc b/src/compiler/js-native-context-specialization.cc
index 60a88be8649a14b3fb43e6b3661c6a081840216a..8c44eaf1752a083de65f0550399fa4f5d3741d27 100644
--- a/src/compiler/js-native-context-specialization.cc
+++ b/src/compiler/js-native-context-specialization.cc
@@ -711,7 +711,7 @@ Reduction JSNativeContextSpecialization::ReduceElementAccess(
Node* if_false = graph()->NewNode(common()->IfFalse(), branch);
// Check if we are allowed to turn the hole into undefined.
Type* initial_holey_array_type = Type::Class(
- handle(isolate()->get_initial_js_array_map(FAST_HOLEY_ELEMENTS)),
+ handle(isolate()->get_initial_js_array_map(elements_kind)),
graph()->zone());
if (receiver_type->NowIs(initial_holey_array_type) &&
isolate()->IsFastArrayConstructorPrototypeChainIntact()) {
@@ -736,6 +736,31 @@ Reduction JSNativeContextSpecialization::ReduceElementAccess(
// hole).
this_value = graph()->NewNode(common()->Guard(element_type), this_value,
this_control);
+ } else if (elements_kind == FAST_HOLEY_DOUBLE_ELEMENTS) {
+ // Perform the hole check on the result.
+ Node* check =
+ graph()->NewNode(simplified()->NumberIsHoleNaN(), this_value);
+ // Check if we are allowed to return the hole directly.
+ Type* initial_holey_array_type = Type::Class(
+ handle(isolate()->get_initial_js_array_map(elements_kind)),
+ graph()->zone());
+ if (receiver_type->NowIs(initial_holey_array_type) &&
+ isolate()->IsFastArrayConstructorPrototypeChainIntact()) {
+ // Add a code dependency on the array protector cell.
+ AssumePrototypesStable(receiver_type,
+ isolate()->initial_object_prototype());
+ dependencies()->AssumePropertyCell(factory()->array_protector());
+ // Turn the hole into undefined.
+ this_value = graph()->NewNode(
+ common()->Select(kMachAnyTagged, BranchHint::kFalse), check,
+ jsgraph()->UndefinedConstant(), this_value);
+ } else {
+ // Deoptimize in case of the hole.
+ Node* branch = graph()->NewNode(common()->Branch(BranchHint::kFalse),
+ check, this_control);
+ this_control = graph()->NewNode(common()->IfFalse(), branch);
+ exit_controls.push_back(graph()->NewNode(common()->IfTrue(), branch));
+ }
}
} else {
DCHECK_EQ(AccessMode::kStore, access_mode);
« no previous file with comments | « src/compiler/access-info.cc ('k') | src/compiler/js-typed-lowering.cc » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698