OLD | NEW |
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 2249 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
2260 } | 2260 } |
2261 } | 2261 } |
2262 return true; | 2262 return true; |
2263 } | 2263 } |
2264 return false; | 2264 return false; |
2265 } | 2265 } |
2266 | 2266 |
2267 bool JSNativeContextSpecialization::InferReceiverMaps( | 2267 bool JSNativeContextSpecialization::InferReceiverMaps( |
2268 Node* receiver, Node* effect, MapHandleList* receiver_maps) { | 2268 Node* receiver, Node* effect, MapHandleList* receiver_maps) { |
2269 ZoneHandleSet<Map> maps; | 2269 ZoneHandleSet<Map> maps; |
2270 if (NodeProperties::InferReceiverMaps(receiver, effect, &maps)) { | 2270 NodeProperties::InferReceiverMapsResult result = |
| 2271 NodeProperties::InferReceiverMaps(receiver, effect, &maps); |
| 2272 if (result == NodeProperties::kReliableReceiverMaps) { |
2271 for (size_t i = 0; i < maps.size(); ++i) { | 2273 for (size_t i = 0; i < maps.size(); ++i) { |
2272 receiver_maps->Add(maps[i]); | 2274 receiver_maps->Add(maps[i]); |
2273 } | 2275 } |
| 2276 return true; |
| 2277 } else if (result == NodeProperties::kUnreliableReceiverMaps) { |
| 2278 // For untrusted receiver maps, we can still use the information |
| 2279 // if the maps are stable. |
| 2280 for (size_t i = 0; i < maps.size(); ++i) { |
| 2281 if (!maps[i]->is_stable()) return false; |
| 2282 } |
| 2283 for (size_t i = 0; i < maps.size(); ++i) { |
| 2284 receiver_maps->Add(maps[i]); |
| 2285 } |
2274 return true; | 2286 return true; |
2275 } | 2287 } |
2276 return false; | 2288 return false; |
2277 } | 2289 } |
2278 | 2290 |
2279 MaybeHandle<Map> JSNativeContextSpecialization::InferReceiverRootMap( | 2291 MaybeHandle<Map> JSNativeContextSpecialization::InferReceiverRootMap( |
2280 Node* receiver) { | 2292 Node* receiver) { |
2281 HeapObjectMatcher m(receiver); | 2293 HeapObjectMatcher m(receiver); |
2282 if (m.HasValue()) { | 2294 if (m.HasValue()) { |
2283 return handle(m.Value()->map()->FindRootMap(), isolate()); | 2295 return handle(m.Value()->map()->FindRootMap(), isolate()); |
(...skipping 57 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
2341 return jsgraph()->javascript(); | 2353 return jsgraph()->javascript(); |
2342 } | 2354 } |
2343 | 2355 |
2344 SimplifiedOperatorBuilder* JSNativeContextSpecialization::simplified() const { | 2356 SimplifiedOperatorBuilder* JSNativeContextSpecialization::simplified() const { |
2345 return jsgraph()->simplified(); | 2357 return jsgraph()->simplified(); |
2346 } | 2358 } |
2347 | 2359 |
2348 } // namespace compiler | 2360 } // namespace compiler |
2349 } // namespace internal | 2361 } // namespace internal |
2350 } // namespace v8 | 2362 } // namespace v8 |
OLD | NEW |