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

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

Issue 2704563005: [turbofan] Infer receiver maps from earlier map checks. (Closed)
Patch Set: Created 3 years, 10 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 2015 the V8 project authors. All rights reserved. 1 // Copyright 2015 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-native-context-specialization.h" 5 #include "src/compiler/js-native-context-specialization.h"
6 6
7 #include "src/accessors.h" 7 #include "src/accessors.h"
8 #include "src/code-factory.h" 8 #include "src/code-factory.h"
9 #include "src/compilation-dependencies.h" 9 #include "src/compilation-dependencies.h"
10 #include "src/compiler/access-builder.h" 10 #include "src/compiler/access-builder.h"
(...skipping 2160 matching lines...) Expand 10 before | Expand all | Expand 10 after
2171 if (!effect->op()->HasProperty(Operator::kNoWrite) || 2171 if (!effect->op()->HasProperty(Operator::kNoWrite) ||
2172 effect->op()->EffectInputCount() != 1) { 2172 effect->op()->EffectInputCount() != 1) {
2173 break; 2173 break;
2174 } 2174 }
2175 effect = NodeProperties::GetEffectInput(effect); 2175 effect = NodeProperties::GetEffectInput(effect);
2176 } 2176 }
2177 } 2177 }
2178 } 2178 }
2179 } 2179 }
2180 } 2180 }
2181 // TODO(turbofan): Go hunting for CheckMaps(receiver) in the effect chain? 2181 // Go hunting for a matching CheckMaps(receiver) or StoreField[Map](receiver)
2182 // in the {effect} chain.
2183 // TODO(turbofan): Propagate the information along the control/effect chains
2184 // instead at some point to avoid this potentially inefficient hunting.
2185 while (true) {
2186 if (effect->opcode() == IrOpcode::kCheckMaps) {
2187 ZoneHandleSet<Map> maps = CheckMapsParametersOf(effect->op()).maps();
2188 if (maps.size() == 1u) {
2189 Node* object = NodeProperties::GetValueInput(effect, 0);
2190 if (NodeProperties::IsSame(receiver, object)) return maps[0];
2191 }
2192 } else if (effect->opcode() == IrOpcode::kStoreField) {
2193 FieldAccess const access = FieldAccessOf(effect->op());
2194 if (access.offset == HeapObject::kMapOffset) {
2195 Node* object = NodeProperties::GetValueInput(effect, 0);
2196 Node* value = NodeProperties::GetValueInput(effect, 1);
2197 if (object == receiver) {
2198 HeapObjectMatcher m(value);
2199 if (m.HasValue()) return Handle<Map>::cast(m.Value());
2200 }
2201 break;
2202 }
2203 } else if (!effect->op()->HasProperty(Operator::kNoWrite) ||
2204 effect->op()->EffectInputCount() != 1) {
2205 break;
2206 }
2207 effect = NodeProperties::GetEffectInput(effect);
2208 }
2182 return MaybeHandle<Map>(); 2209 return MaybeHandle<Map>();
2183 } 2210 }
2184 2211
2185 MaybeHandle<Map> JSNativeContextSpecialization::InferReceiverRootMap( 2212 MaybeHandle<Map> JSNativeContextSpecialization::InferReceiverRootMap(
2186 Node* receiver) { 2213 Node* receiver) {
2187 HeapObjectMatcher m(receiver); 2214 HeapObjectMatcher m(receiver);
2188 if (m.HasValue()) { 2215 if (m.HasValue()) {
2189 return handle(m.Value()->map()->FindRootMap(), isolate()); 2216 return handle(m.Value()->map()->FindRootMap(), isolate());
2190 } else if (m.IsJSCreate()) { 2217 } else if (m.IsJSCreate()) {
2191 HeapObjectMatcher mtarget(m.InputAt(0)); 2218 HeapObjectMatcher mtarget(m.InputAt(0));
(...skipping 55 matching lines...) Expand 10 before | Expand all | Expand 10 after
2247 return jsgraph()->javascript(); 2274 return jsgraph()->javascript();
2248 } 2275 }
2249 2276
2250 SimplifiedOperatorBuilder* JSNativeContextSpecialization::simplified() const { 2277 SimplifiedOperatorBuilder* JSNativeContextSpecialization::simplified() const {
2251 return jsgraph()->simplified(); 2278 return jsgraph()->simplified();
2252 } 2279 }
2253 2280
2254 } // namespace compiler 2281 } // namespace compiler
2255 } // namespace internal 2282 } // namespace internal
2256 } // namespace v8 2283 } // 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