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

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

Issue 2035893004: [turbofan] Introduce a dedicated CheckBounds operator. (Closed) Base URL: https://chromium.googlesource.com/v8/v8.git@master
Patch Set: REBASE 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 20d7e4d374da6d146728da65fd5ec522fb37c2ac..50c0851612cbcf1d01e9802ee0db0b43788b4875 100644
--- a/src/compiler/js-native-context-specialization.cc
+++ b/src/compiler/js-native-context-specialization.cc
@@ -634,6 +634,7 @@ Reduction JSNativeContextSpecialization::ReduceElementAccess(
receiver, jsgraph()->HeapConstant(transition_target), context,
frame_state, transition_effect, transition_control);
}
+
this_controls.push_back(transition_control);
this_effects.push_back(transition_effect);
}
@@ -670,30 +671,6 @@ Reduction JSNativeContextSpecialization::ReduceElementAccess(
AssumePrototypesStable(receiver_type, native_context, holder);
}
- // Check that the {index} is actually a Number.
- if (!NumberMatcher(this_index).HasValue()) {
- Node* check =
- graph()->NewNode(simplified()->ObjectIsNumber(), this_index);
- this_control = this_effect =
- graph()->NewNode(common()->DeoptimizeUnless(), check, frame_state,
- this_effect, this_control);
- this_index = graph()->NewNode(simplified()->TypeGuard(Type::Number()),
- this_index, this_control);
- }
-
- // Convert the {index} to an unsigned32 value and check if the result is
- // equal to the original {index}.
- if (!NumberMatcher(this_index).IsInRange(0.0, kMaxUInt32)) {
- Node* this_index32 =
- graph()->NewNode(simplified()->NumberToUint32(), this_index);
- Node* check = graph()->NewNode(simplified()->NumberEqual(), this_index32,
- this_index);
- this_control = this_effect =
- graph()->NewNode(common()->DeoptimizeUnless(), check, frame_state,
- this_effect, this_control);
- this_index = this_index32;
- }
-
// TODO(bmeurer): We currently specialize based on elements kind. We should
// also be able to properly support strings and other JSObjects here.
ElementsKind elements_kind = access_info.elements_kind();
@@ -729,10 +706,8 @@ Reduction JSNativeContextSpecialization::ReduceElementAccess(
this_elements, this_effect, this_control);
// Check that the {index} is in the valid range for the {receiver}.
- Node* check = graph()->NewNode(simplified()->NumberLessThan(), this_index,
- this_length);
- this_control = this_effect =
- graph()->NewNode(common()->DeoptimizeUnless(), check, frame_state,
+ this_index = this_effect =
+ graph()->NewNode(simplified()->CheckBounds(), this_index, this_length,
this_effect, this_control);
// Compute the element access.
« 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