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/v8.h" | 8 #include "src/v8.h" |
9 | 9 |
10 #include "src/allocation.h" | 10 #include "src/allocation.h" |
| 11 #include "src/code-factory.h" |
11 #include "src/compiler/graph.h" | 12 #include "src/compiler/graph.h" |
12 #include "src/compiler/graph-reducer.h" | 13 #include "src/compiler/graph-reducer.h" |
13 #include "src/compiler/js-graph.h" | 14 #include "src/compiler/js-graph.h" |
14 #include "src/compiler/opcodes.h" | 15 #include "src/compiler/opcodes.h" |
15 #include "src/unique.h" | 16 #include "src/unique.h" |
16 | 17 |
17 namespace v8 { | 18 namespace v8 { |
18 namespace internal { | 19 namespace internal { |
19 | |
20 // Forward declarations. | |
21 class HydrogenCodeStub; | |
22 | |
23 namespace compiler { | 20 namespace compiler { |
24 | 21 |
25 // Forward declarations. | 22 // Forward declarations. |
26 class CommonOperatorBuilder; | 23 class CommonOperatorBuilder; |
27 class MachineOperatorBuilder; | 24 class MachineOperatorBuilder; |
28 class Linkage; | 25 class Linkage; |
29 | 26 |
30 // Lowers JS-level operators to runtime and IC calls in the "generic" case. | 27 // Lowers JS-level operators to runtime and IC calls in the "generic" case. |
31 class JSGenericLowering : public Reducer { | 28 class JSGenericLowering : public Reducer { |
32 public: | 29 public: |
(...skipping 15 matching lines...) Expand all Loading... |
48 Node* CodeConstant(Handle<Code> code); | 45 Node* CodeConstant(Handle<Code> code); |
49 Node* FunctionConstant(Handle<JSFunction> function); | 46 Node* FunctionConstant(Handle<JSFunction> function); |
50 Node* ExternalConstant(ExternalReference ref); | 47 Node* ExternalConstant(ExternalReference ref); |
51 | 48 |
52 // Helpers to patch existing nodes in the graph. | 49 // Helpers to patch existing nodes in the graph. |
53 void PatchOperator(Node* node, const Operator* new_op); | 50 void PatchOperator(Node* node, const Operator* new_op); |
54 void PatchInsertInput(Node* node, int index, Node* input); | 51 void PatchInsertInput(Node* node, int index, Node* input); |
55 | 52 |
56 // Helpers to replace existing nodes with a generic call. | 53 // Helpers to replace existing nodes with a generic call. |
57 void ReplaceWithCompareIC(Node* node, Token::Value token, bool pure); | 54 void ReplaceWithCompareIC(Node* node, Token::Value token, bool pure); |
58 void ReplaceWithStubCall(Node* node, HydrogenCodeStub* stub, | 55 void ReplaceWithStubCall(Node* node, Callable callable, |
59 CallDescriptor::Flags flags); | 56 CallDescriptor::Flags flags); |
60 void ReplaceWithBuiltinCall(Node* node, Builtins::JavaScript id, int args); | 57 void ReplaceWithBuiltinCall(Node* node, Builtins::JavaScript id, int args); |
61 void ReplaceWithRuntimeCall(Node* node, Runtime::FunctionId f, int args = -1); | 58 void ReplaceWithRuntimeCall(Node* node, Runtime::FunctionId f, int args = -1); |
62 | 59 |
63 Zone* zone() const { return graph()->zone(); } | 60 Zone* zone() const { return graph()->zone(); } |
64 Isolate* isolate() const { return zone()->isolate(); } | 61 Isolate* isolate() const { return zone()->isolate(); } |
65 JSGraph* jsgraph() const { return jsgraph_; } | 62 JSGraph* jsgraph() const { return jsgraph_; } |
66 Graph* graph() const { return jsgraph()->graph(); } | 63 Graph* graph() const { return jsgraph()->graph(); } |
67 Linkage* linkage() const { return linkage_; } | 64 Linkage* linkage() const { return linkage_; } |
68 CompilationInfo* info() const { return info_; } | 65 CompilationInfo* info() const { return info_; } |
69 CommonOperatorBuilder* common() const { return jsgraph()->common(); } | 66 CommonOperatorBuilder* common() const { return jsgraph()->common(); } |
70 MachineOperatorBuilder* machine() const { return machine_; } | 67 MachineOperatorBuilder* machine() const { return machine_; } |
71 | 68 |
72 private: | 69 private: |
73 CompilationInfo* info_; | 70 CompilationInfo* info_; |
74 JSGraph* jsgraph_; | 71 JSGraph* jsgraph_; |
75 Linkage* linkage_; | 72 Linkage* linkage_; |
76 MachineOperatorBuilder* machine_; | 73 MachineOperatorBuilder* machine_; |
77 SetOncePointer<Node> centrystub_constant_; | 74 SetOncePointer<Node> centrystub_constant_; |
78 }; | 75 }; |
79 | 76 |
80 } // namespace compiler | 77 } // namespace compiler |
81 } // namespace internal | 78 } // namespace internal |
82 } // namespace v8 | 79 } // namespace v8 |
83 | 80 |
84 #endif // V8_COMPILER_JS_GENERIC_LOWERING_H_ | 81 #endif // V8_COMPILER_JS_GENERIC_LOWERING_H_ |
OLD | NEW |