| 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_CALL_REDUCER_H_ | 5 #ifndef V8_COMPILER_JS_CALL_REDUCER_H_ |
| 6 #define V8_COMPILER_JS_CALL_REDUCER_H_ | 6 #define V8_COMPILER_JS_CALL_REDUCER_H_ |
| 7 | 7 |
| 8 #include "src/base/flags.h" | 8 #include "src/base/flags.h" |
| 9 #include "src/builtins/builtins.h" |
| 9 #include "src/compiler/graph-reducer.h" | 10 #include "src/compiler/graph-reducer.h" |
| 10 | 11 |
| 11 namespace v8 { | 12 namespace v8 { |
| 12 namespace internal { | 13 namespace internal { |
| 13 | 14 |
| 14 // Forward declarations. | 15 // Forward declarations. |
| 15 class CompilationDependencies; | 16 class CompilationDependencies; |
| 16 class Factory; | 17 class Factory; |
| 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; |
| 25 class MachineOperatorBuilder; |
| 24 class SimplifiedOperatorBuilder; | 26 class SimplifiedOperatorBuilder; |
| 25 | 27 |
| 26 // Performs strength reduction on {JSConstruct} and {JSCall} nodes, | 28 // Performs strength reduction on {JSConstruct} and {JSCall} nodes, |
| 27 // which might allow inlining or other optimizations to be performed afterwards. | 29 // which might allow inlining or other optimizations to be performed afterwards. |
| 28 class JSCallReducer final : public AdvancedReducer { | 30 class JSCallReducer final : public AdvancedReducer { |
| 29 public: | 31 public: |
| 30 JSCallReducer(Editor* editor, JSGraph* jsgraph, | 32 JSCallReducer(Editor* editor, JSGraph* jsgraph, Zone* local_zone, |
| 31 Handle<Context> native_context, | 33 Handle<Context> native_context, |
| 32 CompilationDependencies* dependencies) | 34 CompilationDependencies* dependencies) |
| 33 : AdvancedReducer(editor), | 35 : AdvancedReducer(editor), |
| 36 local_zone_(local_zone), |
| 34 jsgraph_(jsgraph), | 37 jsgraph_(jsgraph), |
| 35 native_context_(native_context), | 38 native_context_(native_context), |
| 36 dependencies_(dependencies) {} | 39 dependencies_(dependencies) {} |
| 37 | 40 |
| 38 Reduction Reduce(Node* node) final; | 41 Reduction Reduce(Node* node) final; |
| 39 | 42 |
| 40 private: | 43 private: |
| 41 Reduction ReduceArrayConstructor(Node* node); | 44 Reduction ReduceArrayConstructor(Node* node); |
| 42 Reduction ReduceBooleanConstructor(Node* node); | 45 Reduction ReduceBooleanConstructor(Node* node); |
| 43 Reduction ReduceCallApiFunction( | 46 Reduction ReduceCallApiFunction( |
| 44 Node* node, Handle<FunctionTemplateInfo> function_template_info); | 47 Node* node, Handle<FunctionTemplateInfo> function_template_info); |
| 45 Reduction ReduceNumberConstructor(Node* node); | 48 Reduction ReduceNumberConstructor(Node* node); |
| 46 Reduction ReduceFunctionPrototypeApply(Node* node); | 49 Reduction ReduceFunctionPrototypeApply(Node* node); |
| 47 Reduction ReduceFunctionPrototypeCall(Node* node); | 50 Reduction ReduceFunctionPrototypeCall(Node* node); |
| 48 Reduction ReduceFunctionPrototypeHasInstance(Node* node); | 51 Reduction ReduceFunctionPrototypeHasInstance(Node* node); |
| 49 Reduction ReduceObjectGetPrototype(Node* node, Node* object); | 52 Reduction ReduceObjectGetPrototype(Node* node, Node* object); |
| 50 Reduction ReduceObjectGetPrototypeOf(Node* node); | 53 Reduction ReduceObjectGetPrototypeOf(Node* node); |
| 51 Reduction ReduceObjectPrototypeGetProto(Node* node); | 54 Reduction ReduceObjectPrototypeGetProto(Node* node); |
| 52 Reduction ReduceReflectGetPrototypeOf(Node* node); | 55 Reduction ReduceReflectGetPrototypeOf(Node* node); |
| 56 Reduction ReduceArrayForEach(Handle<SharedFunctionInfo> shared, Node* node); |
| 53 Reduction ReduceSpreadCall(Node* node, int arity); | 57 Reduction ReduceSpreadCall(Node* node, int arity); |
| 54 Reduction ReduceJSConstruct(Node* node); | 58 Reduction ReduceJSConstruct(Node* node); |
| 55 Reduction ReduceJSConstructWithSpread(Node* node); | 59 Reduction ReduceJSConstructWithSpread(Node* node); |
| 56 Reduction ReduceJSCall(Node* node); | 60 Reduction ReduceJSCall(Node* node); |
| 57 Reduction ReduceJSCallWithSpread(Node* node); | 61 Reduction ReduceJSCallWithSpread(Node* node); |
| 58 | 62 |
| 63 enum CheckpointMode { CREATE_CHECKPOINT, DONT_CREATE_CHECKPOINT }; |
| 64 |
| 65 std::pair<Node*, Node*> CreateJavaScriptBuiltinContinuationFrameState( |
| 66 Handle<SharedFunctionInfo> shared, Builtins::Name name, Node* target, |
| 67 Node* context, Node** parameters, int parameter_count, Node* effect, |
| 68 Node* control, Node* outer_frame_state, CheckpointMode mode); |
| 69 |
| 70 Zone* const local_zone_; |
| 59 Graph* graph() const; | 71 Graph* graph() const; |
| 60 JSGraph* jsgraph() const { return jsgraph_; } | 72 JSGraph* jsgraph() const { return jsgraph_; } |
| 61 Isolate* isolate() const; | 73 Isolate* isolate() const; |
| 62 Factory* factory() const; | 74 Factory* factory() const; |
| 63 Handle<Context> native_context() const { return native_context_; } | 75 Handle<Context> native_context() const { return native_context_; } |
| 64 Handle<JSGlobalProxy> global_proxy() const; | 76 Handle<JSGlobalProxy> global_proxy() const; |
| 65 CommonOperatorBuilder* common() const; | 77 CommonOperatorBuilder* common() const; |
| 66 JSOperatorBuilder* javascript() const; | 78 JSOperatorBuilder* javascript() const; |
| 67 SimplifiedOperatorBuilder* simplified() const; | 79 SimplifiedOperatorBuilder* simplified() const; |
| 68 CompilationDependencies* dependencies() const { return dependencies_; } | 80 CompilationDependencies* dependencies() const { return dependencies_; } |
| 69 | 81 |
| 70 JSGraph* const jsgraph_; | 82 JSGraph* const jsgraph_; |
| 71 Handle<Context> const native_context_; | 83 Handle<Context> const native_context_; |
| 72 CompilationDependencies* const dependencies_; | 84 CompilationDependencies* const dependencies_; |
| 73 }; | 85 }; |
| 74 | 86 |
| 75 } // namespace compiler | 87 } // namespace compiler |
| 76 } // namespace internal | 88 } // namespace internal |
| 77 } // namespace v8 | 89 } // namespace v8 |
| 78 | 90 |
| 79 #endif // V8_COMPILER_JS_CALL_REDUCER_H_ | 91 #endif // V8_COMPILER_JS_CALL_REDUCER_H_ |
| OLD | NEW |