| 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 552 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 563 | 563 |
| 564 // Not much we can do if deoptimization support is disabled. | 564 // Not much we can do if deoptimization support is disabled. |
| 565 if (!(flags() & kDeoptimizationEnabled)) return NoChange(); | 565 if (!(flags() & kDeoptimizationEnabled)) return NoChange(); |
| 566 | 566 |
| 567 // Check if we have an access o.x or o.x=v where o is the current | 567 // Check if we have an access o.x or o.x=v where o is the current |
| 568 // native contexts' global proxy, and turn that into a direct access | 568 // native contexts' global proxy, and turn that into a direct access |
| 569 // to the current native contexts' global object instead. | 569 // to the current native contexts' global object instead. |
| 570 if (receiver_maps.length() == 1) { | 570 if (receiver_maps.length() == 1) { |
| 571 Handle<Map> receiver_map = receiver_maps.first(); | 571 Handle<Map> receiver_map = receiver_maps.first(); |
| 572 if (receiver_map->IsJSGlobalProxyMap()) { | 572 if (receiver_map->IsJSGlobalProxyMap()) { |
| 573 Context* receiver_context = | 573 Object* maybe_constructor = receiver_map->GetConstructor(); |
| 574 JSFunction::cast(receiver_map->GetConstructor())->native_context(); | 574 // Detached global proxies have |null| as their constructor. |
| 575 if (receiver_context == *native_context()) { | 575 if (maybe_constructor->IsJSFunction() && |
| 576 JSFunction::cast(maybe_constructor)->native_context() == |
| 577 *native_context()) { |
| 576 return ReduceGlobalAccess(node, receiver, value, name, access_mode, | 578 return ReduceGlobalAccess(node, receiver, value, name, access_mode, |
| 577 index); | 579 index); |
| 578 } | 580 } |
| 579 } | 581 } |
| 580 } | 582 } |
| 581 | 583 |
| 582 // Compute property access infos for the receiver maps. | 584 // Compute property access infos for the receiver maps. |
| 583 AccessInfoFactory access_info_factory(dependencies(), native_context(), | 585 AccessInfoFactory access_info_factory(dependencies(), native_context(), |
| 584 graph()->zone()); | 586 graph()->zone()); |
| 585 ZoneVector<PropertyAccessInfo> access_infos(zone()); | 587 ZoneVector<PropertyAccessInfo> access_infos(zone()); |
| (...skipping 1742 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 2328 return jsgraph()->javascript(); | 2330 return jsgraph()->javascript(); |
| 2329 } | 2331 } |
| 2330 | 2332 |
| 2331 SimplifiedOperatorBuilder* JSNativeContextSpecialization::simplified() const { | 2333 SimplifiedOperatorBuilder* JSNativeContextSpecialization::simplified() const { |
| 2332 return jsgraph()->simplified(); | 2334 return jsgraph()->simplified(); |
| 2333 } | 2335 } |
| 2334 | 2336 |
| 2335 } // namespace compiler | 2337 } // namespace compiler |
| 2336 } // namespace internal | 2338 } // namespace internal |
| 2337 } // namespace v8 | 2339 } // namespace v8 |
| OLD | NEW |