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

Unified Diff: src/compiler/simplified-lowering.cc

Issue 617853002: [turbofan] Add BoundsCheckMode to ElementAccess. (Closed) Base URL: https://v8.googlecode.com/svn/branches/bleeding_edge
Patch Set: Rename Created 6 years, 3 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/js-typed-lowering.cc ('k') | src/compiler/simplified-operator.h » ('j') | no next file with comments »
Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
Index: src/compiler/simplified-lowering.cc
diff --git a/src/compiler/simplified-lowering.cc b/src/compiler/simplified-lowering.cc
index 7ab20f5d24e346f7026205fa6288b8ddaf942545..8a34562bb546a3c3ebba1a7e6ae19e3e51c18438 100644
--- a/src/compiler/simplified-lowering.cc
+++ b/src/compiler/simplified-lowering.cc
@@ -876,12 +876,41 @@ void SimplifiedLowering::DoLoadElement(Node* node) {
void SimplifiedLowering::DoStoreElement(Node* node) {
const ElementAccess& access = ElementAccessOf(node->op());
- WriteBarrierKind kind = ComputeWriteBarrierKind(
- access.base_is_tagged, access.machine_type, access.type);
- node->set_op(
- machine()->Store(StoreRepresentation(access.machine_type, kind)));
- node->ReplaceInput(1, ComputeIndex(access, node->InputAt(1)));
- node->RemoveInput(2);
+ const Operator* op = machine()->Store(StoreRepresentation(
+ access.machine_type,
+ ComputeWriteBarrierKind(access.base_is_tagged, access.machine_type,
+ access.type)));
+ Node* key = node->InputAt(1);
+ Node* index = ComputeIndex(access, key);
+ if (access.bounds_check == kNoBoundsCheck) {
+ node->set_op(op);
+ node->ReplaceInput(1, index);
+ node->RemoveInput(2);
+ } else {
+ DCHECK_EQ(kTypedArrayBoundsCheck, access.bounds_check);
+
+ Node* base = node->InputAt(0);
+ Node* length = node->InputAt(2);
+ Node* value = node->InputAt(3);
+ Node* effect = node->InputAt(4);
+ Node* control = node->InputAt(5);
+
+ Node* check = graph()->NewNode(machine()->Uint32LessThan(), key, length);
+ Node* branch = graph()->NewNode(common()->Branch(), check, control);
+
+ Node* if_true = graph()->NewNode(common()->IfTrue(), branch);
+ Node* store = graph()->NewNode(op, base, index, value, effect, if_true);
+
+ Node* if_false = graph()->NewNode(common()->IfFalse(), branch);
+
+ Node* merge = graph()->NewNode(common()->Merge(2), if_true, if_false);
+
+ node->set_op(common()->EffectPhi(2));
+ node->ReplaceInput(0, store);
+ node->ReplaceInput(1, effect);
+ node->ReplaceInput(2, merge);
+ node->TrimInputCount(3);
+ }
}
« no previous file with comments | « src/compiler/js-typed-lowering.cc ('k') | src/compiler/simplified-operator.h » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698