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

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

Issue 2479563003: [compiler] Delete extra map check in StringIterator. (Closed)
Patch Set: Use native_context() in unittest. Created 4 years, 1 month 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 | « src/compiler/js-builtin-reducer.h ('k') | src/compiler/pipeline.cc » ('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/js-builtin-reducer.h" 5 #include "src/compiler/js-builtin-reducer.h"
6 6
7 #include "src/compilation-dependencies.h" 7 #include "src/compilation-dependencies.h"
8 #include "src/compiler/access-builder.h" 8 #include "src/compiler/access-builder.h"
9 #include "src/compiler/js-graph.h" 9 #include "src/compiler/js-graph.h"
10 #include "src/compiler/node-matchers.h" 10 #include "src/compiler/node-matchers.h"
(...skipping 78 matching lines...) Expand 10 before | Expand all | Expand 10 after
89 // Skip first (i.e. callee) and second (i.e. receiver) operand. 89 // Skip first (i.e. callee) and second (i.e. receiver) operand.
90 return NodeProperties::GetValueInput(node_, index + 2); 90 return NodeProperties::GetValueInput(node_, index + 2);
91 } 91 }
92 92
93 private: 93 private:
94 Node* node_; 94 Node* node_;
95 }; 95 };
96 96
97 JSBuiltinReducer::JSBuiltinReducer(Editor* editor, JSGraph* jsgraph, 97 JSBuiltinReducer::JSBuiltinReducer(Editor* editor, JSGraph* jsgraph,
98 Flags flags, 98 Flags flags,
99 CompilationDependencies* dependencies) 99 CompilationDependencies* dependencies,
100 Handle<Context> native_context)
100 : AdvancedReducer(editor), 101 : AdvancedReducer(editor),
101 dependencies_(dependencies), 102 dependencies_(dependencies),
102 flags_(flags), 103 flags_(flags),
103 jsgraph_(jsgraph), 104 jsgraph_(jsgraph),
105 native_context_(native_context),
104 type_cache_(TypeCache::Get()) {} 106 type_cache_(TypeCache::Get()) {}
105 107
106 namespace { 108 namespace {
107 109
108 MaybeHandle<Map> GetMapWitness(Node* node) { 110 MaybeHandle<Map> GetMapWitness(Node* node) {
109 Node* receiver = NodeProperties::GetValueInput(node, 1); 111 Node* receiver = NodeProperties::GetValueInput(node, 1);
110 Node* effect = NodeProperties::GetEffectInput(node); 112 Node* effect = NodeProperties::GetEffectInput(node);
111 // Check if the {node} is dominated by a CheckMaps with a single map 113 // Check if the {node} is dominated by a CheckMaps with a single map
112 // for the {receiver}, and if so use that map for the lowering below. 114 // for the {receiver}, and if so use that map for the lowering below.
113 for (Node* dominator = effect;;) { 115 for (Node* dominator = effect;;) {
(...skipping 912 matching lines...) Expand 10 before | Expand all | Expand 10 after
1026 } 1028 }
1027 } 1029 }
1028 1030
1029 return NoChange(); 1031 return NoChange();
1030 } 1032 }
1031 1033
1032 Reduction JSBuiltinReducer::ReduceStringIterator(Node* node) { 1034 Reduction JSBuiltinReducer::ReduceStringIterator(Node* node) {
1033 if (Node* receiver = GetStringWitness(node)) { 1035 if (Node* receiver = GetStringWitness(node)) {
1034 Node* effect = NodeProperties::GetEffectInput(node); 1036 Node* effect = NodeProperties::GetEffectInput(node);
1035 Node* control = NodeProperties::GetControlInput(node); 1037 Node* control = NodeProperties::GetControlInput(node);
1036 Node* context = NodeProperties::GetContextInput(node);
1037 1038
1038 Node* native_context = effect = graph()->NewNode( 1039 Node* map = jsgraph()->HeapConstant(
1039 javascript()->LoadContext(0, Context::NATIVE_CONTEXT_INDEX, true), 1040 handle(native_context()->string_iterator_map(), isolate()));
1040 context, context, effect);
1041 Node* map = effect = graph()->NewNode(
1042 javascript()->LoadContext(0, Context::STRING_ITERATOR_MAP_INDEX, true),
1043 native_context, native_context, effect);
1044 1041
1045 // allocate new iterator 1042 // allocate new iterator
1046 effect = graph()->NewNode( 1043 effect = graph()->NewNode(
1047 common()->BeginRegion(RegionObservability::kNotObservable), effect); 1044 common()->BeginRegion(RegionObservability::kNotObservable), effect);
1048 Node* value = effect = graph()->NewNode( 1045 Node* value = effect = graph()->NewNode(
1049 simplified()->Allocate(NOT_TENURED), 1046 simplified()->Allocate(NOT_TENURED),
1050 jsgraph()->Int32Constant(JSStringIterator::kSize), effect, control); 1047 jsgraph()->Int32Constant(JSStringIterator::kSize), effect, control);
1051 effect = graph()->NewNode(simplified()->StoreField(AccessBuilder::ForMap()), 1048 effect = graph()->NewNode(simplified()->StoreField(AccessBuilder::ForMap()),
1052 value, map, effect, control); 1049 value, map, effect, control);
1053 effect = graph()->NewNode( 1050 effect = graph()->NewNode(
(...skipping 392 matching lines...) Expand 10 before | Expand all | Expand 10 after
1446 return jsgraph()->simplified(); 1443 return jsgraph()->simplified();
1447 } 1444 }
1448 1445
1449 JSOperatorBuilder* JSBuiltinReducer::javascript() const { 1446 JSOperatorBuilder* JSBuiltinReducer::javascript() const {
1450 return jsgraph()->javascript(); 1447 return jsgraph()->javascript();
1451 } 1448 }
1452 1449
1453 } // namespace compiler 1450 } // namespace compiler
1454 } // namespace internal 1451 } // namespace internal
1455 } // namespace v8 1452 } // namespace v8
OLDNEW
« no previous file with comments | « src/compiler/js-builtin-reducer.h ('k') | src/compiler/pipeline.cc » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698