OLD | NEW |
1 // Copyright 2014 the V8 project authors. All rights reserved. | 1 // Copyright 2014 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_GENERIC_LOWERING_H_ | 5 #ifndef V8_COMPILER_JS_GENERIC_LOWERING_H_ |
6 #define V8_COMPILER_JS_GENERIC_LOWERING_H_ | 6 #define V8_COMPILER_JS_GENERIC_LOWERING_H_ |
7 | 7 |
8 #include "src/allocation.h" | 8 #include "src/allocation.h" |
9 #include "src/code-factory.h" | 9 #include "src/code-factory.h" |
10 #include "src/compiler/graph.h" | 10 #include "src/compiler/graph.h" |
(...skipping 19 matching lines...) Expand all Loading... |
30 ~JSGenericLowering() FINAL {} | 30 ~JSGenericLowering() FINAL {} |
31 | 31 |
32 Reduction Reduce(Node* node) FINAL; | 32 Reduction Reduce(Node* node) FINAL; |
33 | 33 |
34 protected: | 34 protected: |
35 #define DECLARE_LOWER(x) void Lower##x(Node* node); | 35 #define DECLARE_LOWER(x) void Lower##x(Node* node); |
36 // Dispatched depending on opcode. | 36 // Dispatched depending on opcode. |
37 JS_OP_LIST(DECLARE_LOWER) | 37 JS_OP_LIST(DECLARE_LOWER) |
38 #undef DECLARE_LOWER | 38 #undef DECLARE_LOWER |
39 | 39 |
40 // Helpers to patch existing nodes in the graph. | |
41 void PatchOperator(Node* node, const Operator* new_op); | |
42 void PatchInsertInput(Node* node, int index, Node* input); | |
43 | |
44 // Helpers to replace existing nodes with a generic call. | 40 // Helpers to replace existing nodes with a generic call. |
45 void ReplaceWithCompareIC(Node* node, Token::Value token); | 41 void ReplaceWithCompareIC(Node* node, Token::Value token); |
46 void ReplaceWithStubCall(Node* node, Callable c, CallDescriptor::Flags flags); | 42 void ReplaceWithStubCall(Node* node, Callable c, CallDescriptor::Flags flags); |
47 void ReplaceWithBuiltinCall(Node* node, Builtins::JavaScript id, int args); | 43 void ReplaceWithBuiltinCall(Node* node, Builtins::JavaScript id, int args); |
48 void ReplaceWithRuntimeCall(Node* node, Runtime::FunctionId f, int args = -1); | 44 void ReplaceWithRuntimeCall(Node* node, Runtime::FunctionId f, int args = -1); |
49 | 45 |
50 // Helper for optimization of JSCallFunction. | 46 // Helper for optimization of JSCallFunction. |
51 bool TryLowerDirectJSCall(Node* node); | 47 bool TryLowerDirectJSCall(Node* node); |
52 | 48 |
53 Zone* zone() const { return graph()->zone(); } | 49 Zone* zone() const { return graph()->zone(); } |
54 Isolate* isolate() const { return jsgraph()->isolate(); } | 50 Isolate* isolate() const { return jsgraph()->isolate(); } |
55 JSGraph* jsgraph() const { return jsgraph_; } | 51 JSGraph* jsgraph() const { return jsgraph_; } |
56 Graph* graph() const { return jsgraph()->graph(); } | 52 Graph* graph() const { return jsgraph()->graph(); } |
57 CommonOperatorBuilder* common() const { return jsgraph()->common(); } | 53 CommonOperatorBuilder* common() const { return jsgraph()->common(); } |
58 MachineOperatorBuilder* machine() const { return jsgraph()->machine(); } | 54 MachineOperatorBuilder* machine() const { return jsgraph()->machine(); } |
59 | 55 |
60 private: | 56 private: |
61 bool is_typing_enabled_; | 57 bool is_typing_enabled_; |
62 JSGraph* jsgraph_; | 58 JSGraph* jsgraph_; |
63 }; | 59 }; |
64 | 60 |
65 } // namespace compiler | 61 } // namespace compiler |
66 } // namespace internal | 62 } // namespace internal |
67 } // namespace v8 | 63 } // namespace v8 |
68 | 64 |
69 #endif // V8_COMPILER_JS_GENERIC_LOWERING_H_ | 65 #endif // V8_COMPILER_JS_GENERIC_LOWERING_H_ |
OLD | NEW |