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

Side by Side Diff: src/compiler/js-builtin-reducer.cc

Issue 2652893011: [turbofan] Instance types don't change, so no need to watch for side effects. (Closed)
Patch Set: Created 3 years, 11 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
« no previous file with comments | « no previous file | no next file » | 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/js-builtin-reducer.h" 5 #include "src/compiler/js-builtin-reducer.h"
6 6
7 #include "src/base/bits.h" 7 #include "src/base/bits.h"
8 #include "src/compilation-dependencies.h" 8 #include "src/compilation-dependencies.h"
9 #include "src/compiler/access-builder.h" 9 #include "src/compiler/access-builder.h"
10 #include "src/compiler/js-graph.h" 10 #include "src/compiler/js-graph.h"
(...skipping 893 matching lines...) Expand 10 before | Expand all | Expand 10 after
904 if (dominator->opcode() == IrOpcode::kCheckMaps && 904 if (dominator->opcode() == IrOpcode::kCheckMaps &&
905 NodeProperties::IsSame(dominator->InputAt(0), receiver)) { 905 NodeProperties::IsSame(dominator->InputAt(0), receiver)) {
906 ZoneHandleSet<Map> const& maps = 906 ZoneHandleSet<Map> const& maps =
907 CheckMapsParametersOf(dominator->op()).maps(); 907 CheckMapsParametersOf(dominator->op()).maps();
908 // Check if all maps have the given {instance_type}. 908 // Check if all maps have the given {instance_type}.
909 for (size_t i = 0; i < maps.size(); ++i) { 909 for (size_t i = 0; i < maps.size(); ++i) {
910 if (maps[i]->instance_type() != instance_type) return false; 910 if (maps[i]->instance_type() != instance_type) return false;
911 } 911 }
912 return true; 912 return true;
913 } 913 }
914 switch (dominator->opcode()) { 914 // The instance type doesn't change, so we don't need to pay
915 case IrOpcode::kStoreField: { 915 // attention to potentially side-effecting nodes here.
Michael Starzinger 2017/01/26 12:45:38 As discussed offline: The instance type of strings
Benedikt Meurer 2017/01/26 12:48:08 Done.
916 FieldAccess const& access = FieldAccessOf(dominator->op()); 916 DCHECK_EQ(1, dominator->op()->EffectOutputCount());
917 if (access.base_is_tagged == kTaggedBase && 917 if (dominator->op()->EffectInputCount() != 1) {
918 access.offset == HeapObject::kMapOffset) { 918 // Didn't find any appropriate CheckMaps node.
919 return false; 919 return false;
920 }
921 break;
922 }
923 case IrOpcode::kStoreElement:
924 case IrOpcode::kStoreTypedElement:
925 break;
926 default: {
927 DCHECK_EQ(1, dominator->op()->EffectOutputCount());
928 if (dominator->op()->EffectInputCount() != 1 ||
929 !dominator->op()->HasProperty(Operator::kNoWrite)) {
930 // Didn't find any appropriate CheckMaps node.
931 return false;
932 }
933 break;
934 }
935 } 920 }
936 dominator = NodeProperties::GetEffectInput(dominator); 921 dominator = NodeProperties::GetEffectInput(dominator);
937 } 922 }
938 } 923 }
939 924
940 } // namespace 925 } // namespace
941 926
942 // ES6 section 20.3.3.1 Date.now ( ) 927 // ES6 section 20.3.3.1 Date.now ( )
943 Reduction JSBuiltinReducer::ReduceDateNow(Node* node) { 928 Reduction JSBuiltinReducer::ReduceDateNow(Node* node) {
944 NodeProperties::RemoveValueInputs(node); 929 NodeProperties::RemoveValueInputs(node);
(...skipping 1225 matching lines...) Expand 10 before | Expand all | Expand 10 after
2170 return jsgraph()->simplified(); 2155 return jsgraph()->simplified();
2171 } 2156 }
2172 2157
2173 JSOperatorBuilder* JSBuiltinReducer::javascript() const { 2158 JSOperatorBuilder* JSBuiltinReducer::javascript() const {
2174 return jsgraph()->javascript(); 2159 return jsgraph()->javascript();
2175 } 2160 }
2176 2161
2177 } // namespace compiler 2162 } // namespace compiler
2178 } // namespace internal 2163 } // namespace internal
2179 } // namespace v8 2164 } // namespace v8
OLDNEW
« no previous file with comments | « no previous file | no next file » | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698