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

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

Issue 2066223002: [turbofan] Introduce CheckHole and CheckHoleNaN operators. (Closed) Base URL: https://chromium.googlesource.com/v8/v8.git@master
Patch Set: Address comments. Blacklist test Created 4 years, 6 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 side-by-side diff with in-line comments
Download patch
« no previous file with comments | « src/compiler/effect-control-linearizer.cc ('k') | src/compiler/opcodes.h » ('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 8628d56c221ef80fbb96a72cdda41dc0124b4d8e..20d7e4d374da6d146728da65fd5ec522fb37c2ac 100644
--- a/src/compiler/js-native-context-specialization.cc
+++ b/src/compiler/js-native-context-specialization.cc
@@ -652,6 +652,14 @@ Reduction JSNativeContextSpecialization::ReduceElementAccess(
graph()->NewNode(common()->EffectPhi(this_control_count),
this_control_count + 1, &this_effects.front());
}
+
+ // TODO(turbofan): The effect/control linearization will not find a
+ // FrameState after the StoreField or Call that is generated for the
+ // elements kind transition above. This is because those operators
+ // don't have the kNoWrite flag on it, even though they are not
+ // observable by JavaScript.
+ this_effect = graph()->NewNode(common()->Checkpoint(), frame_state,
+ this_effect, this_control);
}
// Certain stores need a prototype chain check because shape changes
@@ -762,42 +770,26 @@ Reduction JSNativeContextSpecialization::ReduceElementAccess(
if (elements_kind == FAST_HOLEY_ELEMENTS ||
elements_kind == FAST_HOLEY_SMI_ELEMENTS) {
// Perform the hole check on the result.
- Node* check =
- graph()->NewNode(simplified()->ReferenceEqual(element_access.type),
- this_value, jsgraph()->TheHoleConstant());
+ CheckTaggedHoleMode mode = CheckTaggedHoleMode::kNeverReturnHole;
// 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(elements_kind)),
graph()->zone());
if (receiver_type->NowIs(initial_holey_array_type) &&
isolate()->IsFastArrayConstructorPrototypeChainIntact()) {
- Node* branch = graph()->NewNode(common()->Branch(BranchHint::kFalse),
- check, this_control);
- Node* if_true = graph()->NewNode(common()->IfTrue(), branch);
- Node* if_false = graph()->NewNode(common()->IfFalse(), branch);
// Add a code dependency on the array protector cell.
AssumePrototypesStable(receiver_type, native_context,
isolate()->initial_object_prototype());
dependencies()->AssumePropertyCell(factory()->array_protector());
// Turn the hole into undefined.
- this_control =
- graph()->NewNode(common()->Merge(2), if_true, if_false);
- this_value = graph()->NewNode(
- common()->Phi(MachineRepresentation::kTagged, 2),
- jsgraph()->UndefinedConstant(), this_value, this_control);
- element_type =
- Type::Union(element_type, Type::Undefined(), graph()->zone());
- } else {
- // Deoptimize in case of the hole.
- this_control = this_effect =
- graph()->NewNode(common()->DeoptimizeIf(), check, frame_state,
- this_effect, this_control);
+ mode = CheckTaggedHoleMode::kConvertHoleToUndefined;
}
- // Rename the result to represent the actual type (not polluted by the
- // hole).
- this_value = graph()->NewNode(simplified()->TypeGuard(element_type),
- this_value, this_control);
+ this_value = this_effect =
+ graph()->NewNode(simplified()->CheckTaggedHole(mode), this_value,
+ this_effect, this_control);
} else if (elements_kind == FAST_HOLEY_DOUBLE_ELEMENTS) {
+ // Perform the hole check on the result.
+ CheckFloat64HoleMode mode = CheckFloat64HoleMode::kNeverReturnHole;
// 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)),
@@ -808,18 +800,12 @@ Reduction JSNativeContextSpecialization::ReduceElementAccess(
AssumePrototypesStable(receiver_type, native_context,
isolate()->initial_object_prototype());
dependencies()->AssumePropertyCell(factory()->array_protector());
- // Turn the hole into undefined.
- this_value = graph()->NewNode(simplified()->NumberConvertHoleNaN(),
- this_value);
- } else {
- // Perform the hole check on the result.
- Node* check =
- graph()->NewNode(simplified()->NumberIsHoleNaN(), this_value);
- // Deoptimize in case of the hole.
- this_control = this_effect =
- graph()->NewNode(common()->DeoptimizeIf(), check, frame_state,
- this_effect, this_control);
+ // Return the signaling NaN hole directly if all uses are truncating.
+ mode = CheckFloat64HoleMode::kAllowReturnHole;
}
+ this_value = this_effect =
+ graph()->NewNode(simplified()->CheckFloat64Hole(mode), this_value,
+ this_effect, this_control);
}
} else {
DCHECK_EQ(AccessMode::kStore, access_mode);
« no previous file with comments | « src/compiler/effect-control-linearizer.cc ('k') | src/compiler/opcodes.h » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698