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

Side by Side 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, 2 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 unified diff | Download patch | Annotate | Revision Log
« no previous file with comments | « src/compiler/js-typed-lowering.cc ('k') | src/compiler/simplified-operator.h » ('j') | no next file with comments »
Toggle Intra-line Diffs ('i') | Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
OLDNEW
1 // Copyright 2014 the V8 project authors. All rights reserved. 1 // Copyright 2014 the V8 project authors. All rights reserved.
2 // Use of this source code is governed by a BSD-style license that can be 2 // Use of this source code is governed by a BSD-style license that can be
3 // found in the LICENSE file. 3 // found in the LICENSE file.
4 4
5 #include "src/compiler/simplified-lowering.h" 5 #include "src/compiler/simplified-lowering.h"
6 6
7 #include "src/base/bits.h" 7 #include "src/base/bits.h"
8 #include "src/code-factory.h" 8 #include "src/code-factory.h"
9 #include "src/compiler/common-operator.h" 9 #include "src/compiler/common-operator.h"
10 #include "src/compiler/graph-inl.h" 10 #include "src/compiler/graph-inl.h"
(...skipping 858 matching lines...) Expand 10 before | Expand all | Expand 10 after
869 void SimplifiedLowering::DoLoadElement(Node* node) { 869 void SimplifiedLowering::DoLoadElement(Node* node) {
870 const ElementAccess& access = ElementAccessOf(node->op()); 870 const ElementAccess& access = ElementAccessOf(node->op());
871 node->set_op(machine()->Load(access.machine_type)); 871 node->set_op(machine()->Load(access.machine_type));
872 node->ReplaceInput(1, ComputeIndex(access, node->InputAt(1))); 872 node->ReplaceInput(1, ComputeIndex(access, node->InputAt(1)));
873 node->RemoveInput(2); 873 node->RemoveInput(2);
874 } 874 }
875 875
876 876
877 void SimplifiedLowering::DoStoreElement(Node* node) { 877 void SimplifiedLowering::DoStoreElement(Node* node) {
878 const ElementAccess& access = ElementAccessOf(node->op()); 878 const ElementAccess& access = ElementAccessOf(node->op());
879 WriteBarrierKind kind = ComputeWriteBarrierKind( 879 const Operator* op = machine()->Store(StoreRepresentation(
880 access.base_is_tagged, access.machine_type, access.type); 880 access.machine_type,
881 node->set_op( 881 ComputeWriteBarrierKind(access.base_is_tagged, access.machine_type,
882 machine()->Store(StoreRepresentation(access.machine_type, kind))); 882 access.type)));
883 node->ReplaceInput(1, ComputeIndex(access, node->InputAt(1))); 883 Node* key = node->InputAt(1);
884 node->RemoveInput(2); 884 Node* index = ComputeIndex(access, key);
885 if (access.bounds_check == kNoBoundsCheck) {
886 node->set_op(op);
887 node->ReplaceInput(1, index);
888 node->RemoveInput(2);
889 } else {
890 DCHECK_EQ(kTypedArrayBoundsCheck, access.bounds_check);
891
892 Node* base = node->InputAt(0);
893 Node* length = node->InputAt(2);
894 Node* value = node->InputAt(3);
895 Node* effect = node->InputAt(4);
896 Node* control = node->InputAt(5);
897
898 Node* check = graph()->NewNode(machine()->Uint32LessThan(), key, length);
899 Node* branch = graph()->NewNode(common()->Branch(), check, control);
900
901 Node* if_true = graph()->NewNode(common()->IfTrue(), branch);
902 Node* store = graph()->NewNode(op, base, index, value, effect, if_true);
903
904 Node* if_false = graph()->NewNode(common()->IfFalse(), branch);
905
906 Node* merge = graph()->NewNode(common()->Merge(2), if_true, if_false);
907
908 node->set_op(common()->EffectPhi(2));
909 node->ReplaceInput(0, store);
910 node->ReplaceInput(1, effect);
911 node->ReplaceInput(2, merge);
912 node->TrimInputCount(3);
913 }
885 } 914 }
886 915
887 916
888 void SimplifiedLowering::DoStringAdd(Node* node) { 917 void SimplifiedLowering::DoStringAdd(Node* node) {
889 Callable callable = CodeFactory::StringAdd( 918 Callable callable = CodeFactory::StringAdd(
890 zone()->isolate(), STRING_ADD_CHECK_NONE, NOT_TENURED); 919 zone()->isolate(), STRING_ADD_CHECK_NONE, NOT_TENURED);
891 CallDescriptor::Flags flags = CallDescriptor::kNoFlags; 920 CallDescriptor::Flags flags = CallDescriptor::kNoFlags;
892 CallDescriptor* desc = 921 CallDescriptor* desc =
893 Linkage::GetStubCallDescriptor(callable.descriptor(), 0, flags, zone()); 922 Linkage::GetStubCallDescriptor(callable.descriptor(), 0, flags, zone());
894 node->set_op(common()->Call(desc)); 923 node->set_op(common()->Call(desc));
(...skipping 40 matching lines...) Expand 10 before | Expand all | Expand 10 after
935 void SimplifiedLowering::DoStringLessThanOrEqual(Node* node) { 964 void SimplifiedLowering::DoStringLessThanOrEqual(Node* node) {
936 node->set_op(machine()->IntLessThanOrEqual()); 965 node->set_op(machine()->IntLessThanOrEqual());
937 node->ReplaceInput(0, StringComparison(node, true)); 966 node->ReplaceInput(0, StringComparison(node, true));
938 node->ReplaceInput(1, jsgraph()->SmiConstant(EQUAL)); 967 node->ReplaceInput(1, jsgraph()->SmiConstant(EQUAL));
939 } 968 }
940 969
941 970
942 } // namespace compiler 971 } // namespace compiler
943 } // namespace internal 972 } // namespace internal
944 } // namespace v8 973 } // namespace v8
OLDNEW
« 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