| 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 439 matching lines...) Expand 10 before | Expand all | Expand 10 after  Loading... | 
| 450 | 450 | 
| 451   // Try to lower the named access based on the {receiver_maps}. | 451   // Try to lower the named access based on the {receiver_maps}. | 
| 452   return ReduceNamedAccess(node, value, receiver_maps, name, access_mode, | 452   return ReduceNamedAccess(node, value, receiver_maps, name, access_mode, | 
| 453                            language_mode); | 453                            language_mode); | 
| 454 } | 454 } | 
| 455 | 455 | 
| 456 | 456 | 
| 457 Reduction JSNativeContextSpecialization::ReduceJSLoadNamed(Node* node) { | 457 Reduction JSNativeContextSpecialization::ReduceJSLoadNamed(Node* node) { | 
| 458   DCHECK_EQ(IrOpcode::kJSLoadNamed, node->opcode()); | 458   DCHECK_EQ(IrOpcode::kJSLoadNamed, node->opcode()); | 
| 459   NamedAccess const& p = NamedAccessOf(node->op()); | 459   NamedAccess const& p = NamedAccessOf(node->op()); | 
|  | 460   Node* const receiver = NodeProperties::GetValueInput(node, 0); | 
| 460   Node* const value = jsgraph()->Dead(); | 461   Node* const value = jsgraph()->Dead(); | 
| 461 | 462 | 
|  | 463   // Check if we have a constant receiver. | 
|  | 464   HeapObjectMatcher m(receiver); | 
|  | 465   if (m.HasValue()) { | 
|  | 466     // Optimize "prototype" property of functions. | 
|  | 467     if (m.Value()->IsJSFunction() && | 
|  | 468         p.name().is_identical_to(factory()->prototype_string())) { | 
|  | 469       Handle<JSFunction> function = Handle<JSFunction>::cast(m.Value()); | 
|  | 470       if (function->has_initial_map()) { | 
|  | 471         // We need to add a code dependency on the initial map of the | 
|  | 472         // {function} in order to be notified about changes to the | 
|  | 473         // "prototype" of {function}, so it doesn't make sense to | 
|  | 474         // continue unless deoptimization is enabled. | 
|  | 475         if ((flags() & kDeoptimizationEnabled)) { | 
|  | 476           Handle<Map> initial_map(function->initial_map(), isolate()); | 
|  | 477           dependencies()->AssumeInitialMapCantChange(initial_map); | 
|  | 478           Handle<Object> prototype(initial_map->prototype(), isolate()); | 
|  | 479           Node* value = jsgraph()->Constant(prototype); | 
|  | 480           ReplaceWithValue(node, value); | 
|  | 481           return Replace(value); | 
|  | 482         } | 
|  | 483       } | 
|  | 484     } | 
|  | 485   } | 
|  | 486 | 
| 462   // Extract receiver maps from the LOAD_IC using the LoadICNexus. | 487   // Extract receiver maps from the LOAD_IC using the LoadICNexus. | 
| 463   if (!p.feedback().IsValid()) return NoChange(); | 488   if (!p.feedback().IsValid()) return NoChange(); | 
| 464   LoadICNexus nexus(p.feedback().vector(), p.feedback().slot()); | 489   LoadICNexus nexus(p.feedback().vector(), p.feedback().slot()); | 
| 465 | 490 | 
| 466   // Try to lower the named access based on the {receiver_maps}. | 491   // Try to lower the named access based on the {receiver_maps}. | 
| 467   return ReduceNamedAccess(node, value, nexus, p.name(), AccessMode::kLoad, | 492   return ReduceNamedAccess(node, value, nexus, p.name(), AccessMode::kLoad, | 
| 468                            p.language_mode()); | 493                            p.language_mode()); | 
| 469 } | 494 } | 
| 470 | 495 | 
| 471 | 496 | 
| (...skipping 560 matching lines...) Expand 10 before | Expand all | Expand 10 after  Loading... | 
| 1032 } | 1057 } | 
| 1033 | 1058 | 
| 1034 | 1059 | 
| 1035 SimplifiedOperatorBuilder* JSNativeContextSpecialization::simplified() const { | 1060 SimplifiedOperatorBuilder* JSNativeContextSpecialization::simplified() const { | 
| 1036   return jsgraph()->simplified(); | 1061   return jsgraph()->simplified(); | 
| 1037 } | 1062 } | 
| 1038 | 1063 | 
| 1039 }  // namespace compiler | 1064 }  // namespace compiler | 
| 1040 }  // namespace internal | 1065 }  // namespace internal | 
| 1041 }  // namespace v8 | 1066 }  // namespace v8 | 
| OLD | NEW | 
|---|