| OLD | NEW |
| 1 // Copyright 2016 the V8 project authors. All rights reserved. | 1 // Copyright 2016 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_CREATE_LOWERING_H_ | 5 #ifndef V8_COMPILER_JS_CREATE_LOWERING_H_ |
| 6 #define V8_COMPILER_JS_CREATE_LOWERING_H_ | 6 #define V8_COMPILER_JS_CREATE_LOWERING_H_ |
| 7 | 7 |
| 8 #include "src/compiler/graph-reducer.h" | 8 #include "src/compiler/graph-reducer.h" |
| 9 | 9 |
| 10 namespace v8 { | 10 namespace v8 { |
| 11 namespace internal { | 11 namespace internal { |
| 12 | 12 |
| 13 // Forward declarations. | 13 // Forward declarations. |
| 14 class AllocationSiteUsageContext; |
| 14 class CompilationDependencies; | 15 class CompilationDependencies; |
| 15 class Factory; | 16 class Factory; |
| 16 | 17 |
| 17 | 18 |
| 18 namespace compiler { | 19 namespace compiler { |
| 19 | 20 |
| 20 // Forward declarations. | 21 // Forward declarations. |
| 21 class CommonOperatorBuilder; | 22 class CommonOperatorBuilder; |
| 22 class JSGraph; | 23 class JSGraph; |
| 23 class JSOperatorBuilder; | 24 class JSOperatorBuilder; |
| 24 class MachineOperatorBuilder; | 25 class MachineOperatorBuilder; |
| 25 class SimplifiedOperatorBuilder; | 26 class SimplifiedOperatorBuilder; |
| 26 | 27 |
| 27 | 28 |
| 28 // Lowers JSCreate-level operators to fast (inline) allocations. | 29 // Lowers JSCreate-level operators to fast (inline) allocations. |
| 29 class JSCreateLowering final : public AdvancedReducer { | 30 class JSCreateLowering final : public AdvancedReducer { |
| 30 public: | 31 public: |
| 31 JSCreateLowering(Editor* editor, CompilationDependencies* dependencies, | 32 JSCreateLowering(Editor* editor, CompilationDependencies* dependencies, |
| 32 JSGraph* jsgraph) | 33 JSGraph* jsgraph, MaybeHandle<LiteralsArray> literals_array, |
| 34 Zone* zone) |
| 33 : AdvancedReducer(editor), | 35 : AdvancedReducer(editor), |
| 34 dependencies_(dependencies), | 36 dependencies_(dependencies), |
| 35 jsgraph_(jsgraph) {} | 37 jsgraph_(jsgraph), |
| 38 literals_array_(literals_array), |
| 39 zone_(zone) {} |
| 36 ~JSCreateLowering() final {} | 40 ~JSCreateLowering() final {} |
| 37 | 41 |
| 38 Reduction Reduce(Node* node) final; | 42 Reduction Reduce(Node* node) final; |
| 39 | 43 |
| 40 private: | 44 private: |
| 41 Reduction ReduceJSCreate(Node* node); | 45 Reduction ReduceJSCreate(Node* node); |
| 42 Reduction ReduceJSCreateArguments(Node* node); | 46 Reduction ReduceJSCreateArguments(Node* node); |
| 43 Reduction ReduceJSCreateArray(Node* node); | 47 Reduction ReduceJSCreateArray(Node* node); |
| 44 Reduction ReduceJSCreateIterResultObject(Node* node); | 48 Reduction ReduceJSCreateIterResultObject(Node* node); |
| 49 Reduction ReduceJSCreateLiteral(Node* node); |
| 45 Reduction ReduceJSCreateFunctionContext(Node* node); | 50 Reduction ReduceJSCreateFunctionContext(Node* node); |
| 46 Reduction ReduceJSCreateWithContext(Node* node); | 51 Reduction ReduceJSCreateWithContext(Node* node); |
| 47 Reduction ReduceJSCreateCatchContext(Node* node); | 52 Reduction ReduceJSCreateCatchContext(Node* node); |
| 48 Reduction ReduceJSCreateBlockContext(Node* node); | 53 Reduction ReduceJSCreateBlockContext(Node* node); |
| 49 Reduction ReduceNewArray(Node* node, Node* length, int capacity, | 54 Reduction ReduceNewArray(Node* node, Node* length, int capacity, |
| 50 Handle<AllocationSite> site); | 55 Handle<AllocationSite> site); |
| 51 | 56 |
| 52 Node* AllocateArguments(Node* effect, Node* control, Node* frame_state); | 57 Node* AllocateArguments(Node* effect, Node* control, Node* frame_state); |
| 53 Node* AllocateRestArguments(Node* effect, Node* control, Node* frame_state, | 58 Node* AllocateRestArguments(Node* effect, Node* control, Node* frame_state, |
| 54 int start_index); | 59 int start_index); |
| 55 Node* AllocateAliasedArguments(Node* effect, Node* control, Node* frame_state, | 60 Node* AllocateAliasedArguments(Node* effect, Node* control, Node* frame_state, |
| 56 Node* context, Handle<SharedFunctionInfo>, | 61 Node* context, Handle<SharedFunctionInfo>, |
| 57 bool* has_aliased_arguments); | 62 bool* has_aliased_arguments); |
| 58 Node* AllocateElements(Node* effect, Node* control, | 63 Node* AllocateElements(Node* effect, Node* control, |
| 59 ElementsKind elements_kind, int capacity, | 64 ElementsKind elements_kind, int capacity, |
| 60 PretenureFlag pretenure); | 65 PretenureFlag pretenure); |
| 66 Node* AllocateFastLiteral(Node* effect, Node* control, |
| 67 Handle<JSObject> boilerplate, |
| 68 AllocationSiteUsageContext* site_context); |
| 69 Node* AllocateFastLiteralElements(Node* effect, Node* control, |
| 70 Handle<JSObject> boilerplate, |
| 71 PretenureFlag pretenure, |
| 72 AllocationSiteUsageContext* site_context); |
| 73 Node* AllocateMutableHeapNumber(double value, Node* effect, Node* control); |
| 74 |
| 75 // Infers the LiteralsArray to use for a given {node}. |
| 76 MaybeHandle<LiteralsArray> GetSpecializationLiterals(Node* node); |
| 61 | 77 |
| 62 Factory* factory() const; | 78 Factory* factory() const; |
| 63 Graph* graph() const; | 79 Graph* graph() const; |
| 64 JSGraph* jsgraph() const { return jsgraph_; } | 80 JSGraph* jsgraph() const { return jsgraph_; } |
| 65 Isolate* isolate() const; | 81 Isolate* isolate() const; |
| 66 JSOperatorBuilder* javascript() const; | 82 JSOperatorBuilder* javascript() const; |
| 67 CommonOperatorBuilder* common() const; | 83 CommonOperatorBuilder* common() const; |
| 68 SimplifiedOperatorBuilder* simplified() const; | 84 SimplifiedOperatorBuilder* simplified() const; |
| 69 MachineOperatorBuilder* machine() const; | 85 MachineOperatorBuilder* machine() const; |
| 70 CompilationDependencies* dependencies() const { return dependencies_; } | 86 CompilationDependencies* dependencies() const { return dependencies_; } |
| 87 Zone* zone() const { return zone_; } |
| 71 | 88 |
| 72 CompilationDependencies* const dependencies_; | 89 CompilationDependencies* const dependencies_; |
| 73 JSGraph* const jsgraph_; | 90 JSGraph* const jsgraph_; |
| 91 MaybeHandle<LiteralsArray> const literals_array_; |
| 92 Zone* const zone_; |
| 74 }; | 93 }; |
| 75 | 94 |
| 76 } // namespace compiler | 95 } // namespace compiler |
| 77 } // namespace internal | 96 } // namespace internal |
| 78 } // namespace v8 | 97 } // namespace v8 |
| 79 | 98 |
| 80 #endif // V8_COMPILER_JS_CREATE_LOWERING_H_ | 99 #endif // V8_COMPILER_JS_CREATE_LOWERING_H_ |
| OLD | NEW |