| 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 #ifndef V8_COMPILER_JS_NATIVE_CONTEXT_SPECIALIZATION_H_ | 5 #ifndef V8_COMPILER_JS_NATIVE_CONTEXT_SPECIALIZATION_H_ |
| 6 #define V8_COMPILER_JS_NATIVE_CONTEXT_SPECIALIZATION_H_ | 6 #define V8_COMPILER_JS_NATIVE_CONTEXT_SPECIALIZATION_H_ |
| 7 | 7 |
| 8 #include "src/base/flags.h" | 8 #include "src/base/flags.h" |
| 9 #include "src/compiler/graph-reducer.h" | 9 #include "src/compiler/graph-reducer.h" |
| 10 | 10 |
| (...skipping 20 matching lines...) Expand all Loading... |
| 31 | 31 |
| 32 // Specializes a given JSGraph to a given native context, potentially constant | 32 // Specializes a given JSGraph to a given native context, potentially constant |
| 33 // folding some {LoadGlobal} nodes or strength reducing some {StoreGlobal} | 33 // folding some {LoadGlobal} nodes or strength reducing some {StoreGlobal} |
| 34 // nodes. And also specializes {LoadNamed} and {StoreNamed} nodes according | 34 // nodes. And also specializes {LoadNamed} and {StoreNamed} nodes according |
| 35 // to type feedback (if available). | 35 // to type feedback (if available). |
| 36 class JSNativeContextSpecialization final : public AdvancedReducer { | 36 class JSNativeContextSpecialization final : public AdvancedReducer { |
| 37 public: | 37 public: |
| 38 // Flags that control the mode of operation. | 38 // Flags that control the mode of operation. |
| 39 enum Flag { | 39 enum Flag { |
| 40 kNoFlags = 0u, | 40 kNoFlags = 0u, |
| 41 kDeoptimizationEnabled = 1u << 0, | 41 kBailoutOnUninitialized = 1u << 0, |
| 42 kDeoptimizationEnabled = 1u << 1, |
| 42 }; | 43 }; |
| 43 typedef base::Flags<Flag> Flags; | 44 typedef base::Flags<Flag> Flags; |
| 44 | 45 |
| 45 JSNativeContextSpecialization(Editor* editor, JSGraph* jsgraph, Flags flags, | 46 JSNativeContextSpecialization(Editor* editor, JSGraph* jsgraph, Flags flags, |
| 46 MaybeHandle<Context> native_context, | 47 MaybeHandle<Context> native_context, |
| 47 CompilationDependencies* dependencies, | 48 CompilationDependencies* dependencies, |
| 48 Zone* zone); | 49 Zone* zone); |
| 49 | 50 |
| 50 Reduction Reduce(Node* node) final; | 51 Reduction Reduce(Node* node) final; |
| 51 | 52 |
| 52 private: | 53 private: |
| 53 Reduction ReduceJSLoadContext(Node* node); | 54 Reduction ReduceJSLoadContext(Node* node); |
| 54 Reduction ReduceJSLoadNamed(Node* node); | 55 Reduction ReduceJSLoadNamed(Node* node); |
| 55 Reduction ReduceJSStoreNamed(Node* node); | 56 Reduction ReduceJSStoreNamed(Node* node); |
| 56 Reduction ReduceJSLoadProperty(Node* node); | 57 Reduction ReduceJSLoadProperty(Node* node); |
| 57 Reduction ReduceJSStoreProperty(Node* node); | 58 Reduction ReduceJSStoreProperty(Node* node); |
| 58 | 59 |
| 59 Reduction ReduceElementAccess(Node* node, Node* index, Node* value, | 60 Reduction ReduceElementAccess(Node* node, Node* index, Node* value, |
| 60 MapHandleList const& receiver_maps, | 61 MapHandleList const& receiver_maps, |
| 61 AccessMode access_mode, | 62 AccessMode access_mode, |
| 62 LanguageMode language_mode, | 63 LanguageMode language_mode, |
| 63 KeyedAccessStoreMode store_mode); | 64 KeyedAccessStoreMode store_mode); |
| 64 Reduction ReduceKeyedAccess(Node* node, Node* index, Node* value, | 65 Reduction ReduceKeyedAccess(Node* node, Node* index, Node* value, |
| 65 FeedbackNexus const& nexus, | 66 FeedbackNexus const& nexus, |
| 66 AccessMode access_mode, | 67 AccessMode access_mode, |
| 67 LanguageMode language_mode, | 68 LanguageMode language_mode, |
| 68 KeyedAccessStoreMode store_mode); | 69 KeyedAccessStoreMode store_mode); |
| 69 Reduction ReduceNamedAccess(Node* node, Node* value, | 70 Reduction ReduceNamedAccess(Node* node, Node* value, |
| 71 FeedbackNexus const& nexus, Handle<Name> name, |
| 72 AccessMode access_mode, |
| 73 LanguageMode language_mode); |
| 74 Reduction ReduceNamedAccess(Node* node, Node* value, |
| 70 MapHandleList const& receiver_maps, | 75 MapHandleList const& receiver_maps, |
| 71 Handle<Name> name, AccessMode access_mode, | 76 Handle<Name> name, AccessMode access_mode, |
| 72 LanguageMode language_mode, | 77 LanguageMode language_mode, |
| 73 Node* index = nullptr); | 78 Node* index = nullptr); |
| 74 | 79 |
| 80 Reduction ReduceSoftDeoptimize(Node* node); |
| 81 |
| 75 // Adds stability dependencies on all prototypes of every class in | 82 // Adds stability dependencies on all prototypes of every class in |
| 76 // {receiver_type} up to (and including) the {holder}. | 83 // {receiver_type} up to (and including) the {holder}. |
| 77 void AssumePrototypesStable(Type* receiver_type, | 84 void AssumePrototypesStable(Type* receiver_type, |
| 78 Handle<Context> native_context, | 85 Handle<Context> native_context, |
| 79 Handle<JSObject> holder); | 86 Handle<JSObject> holder); |
| 80 | 87 |
| 81 // Assuming that {if_projection} is either IfTrue or IfFalse, adds a hint on | 88 // Assuming that {if_projection} is either IfTrue or IfFalse, adds a hint on |
| 82 // the dominating Branch that {if_projection} is the unlikely (deferred) case. | 89 // the dominating Branch that {if_projection} is the unlikely (deferred) case. |
| 83 void MarkAsDeferred(Node* if_projection); | 90 void MarkAsDeferred(Node* if_projection); |
| 84 | 91 |
| (...skipping 23 matching lines...) Expand all Loading... |
| 108 DISALLOW_COPY_AND_ASSIGN(JSNativeContextSpecialization); | 115 DISALLOW_COPY_AND_ASSIGN(JSNativeContextSpecialization); |
| 109 }; | 116 }; |
| 110 | 117 |
| 111 DEFINE_OPERATORS_FOR_FLAGS(JSNativeContextSpecialization::Flags) | 118 DEFINE_OPERATORS_FOR_FLAGS(JSNativeContextSpecialization::Flags) |
| 112 | 119 |
| 113 } // namespace compiler | 120 } // namespace compiler |
| 114 } // namespace internal | 121 } // namespace internal |
| 115 } // namespace v8 | 122 } // namespace v8 |
| 116 | 123 |
| 117 #endif // V8_COMPILER_JS_NATIVE_CONTEXT_SPECIALIZATION_H_ | 124 #endif // V8_COMPILER_JS_NATIVE_CONTEXT_SPECIALIZATION_H_ |
| OLD | NEW |