| 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/compiler/graph.h" | 11 #include "src/compiler/graph.h" |
| 12 #include "src/compiler/graph-reducer.h" | 12 #include "src/compiler/graph-reducer.h" |
| 13 #include "src/compiler/js-context-specialization.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 |
| 20 // Forward declarations. | 21 // Forward declarations. |
| 21 class HydrogenCodeStub; | 22 class HydrogenCodeStub; |
| 22 | 23 |
| 23 namespace compiler { | 24 namespace compiler { |
| 24 | 25 |
| 25 // Forward declarations. | 26 // Forward declarations. |
| 26 class CommonOperatorBuilder; | 27 class CommonOperatorBuilder; |
| 27 class MachineOperatorBuilder; | 28 class MachineOperatorBuilder; |
| 28 class Linkage; | 29 class Linkage; |
| 29 | 30 |
| 30 // Lowers JS-level operators to runtime and IC calls in the "generic" case. | 31 // Lowers JS-level operators to runtime and IC calls in the "generic" case. |
| 31 class JSGenericLowering : public Reducer { | 32 class JSGenericLowering : public Reducer { |
| 32 public: | 33 public: |
| 33 JSGenericLowering(CompilationInfo* info, JSGraph* graph, | 34 JSGenericLowering(JSGraph* graph, JSContextSpecializer* spec, |
| 34 MachineOperatorBuilder* machine); | 35 Linkage* linkage, MachineOperatorBuilder* machine); |
| 35 virtual ~JSGenericLowering() {} | 36 virtual ~JSGenericLowering() {} |
| 36 | 37 |
| 37 virtual Reduction Reduce(Node* node); | 38 virtual Reduction Reduce(Node* node); |
| 38 | 39 |
| 39 protected: | 40 protected: |
| 40 // Dispatched depending on opcode. | 41 // Dispatched depending on opcode. |
| 41 #define DECLARE_LOWER(x) Node* Lower##x(Node* node); | 42 #define DECLARE_LOWER(x) Node* Lower##x(Node* node); |
| 42 ALL_OP_LIST(DECLARE_LOWER) | 43 ALL_OP_LIST(DECLARE_LOWER) |
| 43 #undef DECLARE_LOWER | 44 #undef DECLARE_LOWER |
| 44 | 45 |
| (...skipping 12 matching lines...) Expand all Loading... |
| 57 void ReplaceWithCompareIC(Node* node, Token::Value token, bool pure); | 58 void ReplaceWithCompareIC(Node* node, Token::Value token, bool pure); |
| 58 void ReplaceWithICStubCall(Node* node, HydrogenCodeStub* stub); | 59 void ReplaceWithICStubCall(Node* node, HydrogenCodeStub* stub); |
| 59 void ReplaceWithBuiltinCall(Node* node, Builtins::JavaScript id, int args); | 60 void ReplaceWithBuiltinCall(Node* node, Builtins::JavaScript id, int args); |
| 60 void ReplaceWithRuntimeCall(Node* node, Runtime::FunctionId f, int args = -1); | 61 void ReplaceWithRuntimeCall(Node* node, Runtime::FunctionId f, int args = -1); |
| 61 | 62 |
| 62 Zone* zone() const { return graph()->zone(); } | 63 Zone* zone() const { return graph()->zone(); } |
| 63 Isolate* isolate() const { return zone()->isolate(); } | 64 Isolate* isolate() const { return zone()->isolate(); } |
| 64 JSGraph* jsgraph() const { return jsgraph_; } | 65 JSGraph* jsgraph() const { return jsgraph_; } |
| 65 Graph* graph() const { return jsgraph()->graph(); } | 66 Graph* graph() const { return jsgraph()->graph(); } |
| 66 Linkage* linkage() const { return linkage_; } | 67 Linkage* linkage() const { return linkage_; } |
| 67 CompilationInfo* info() const { return info_; } | |
| 68 CommonOperatorBuilder* common() const { return jsgraph()->common(); } | 68 CommonOperatorBuilder* common() const { return jsgraph()->common(); } |
| 69 MachineOperatorBuilder* machine() const { return machine_; } | 69 MachineOperatorBuilder* machine() const { return machine_; } |
| 70 | 70 |
| 71 private: | 71 private: |
| 72 CompilationInfo* info_; | |
| 73 JSGraph* jsgraph_; | 72 JSGraph* jsgraph_; |
| 73 JSContextSpecializer* spec_; |
| 74 Linkage* linkage_; | 74 Linkage* linkage_; |
| 75 MachineOperatorBuilder* machine_; | 75 MachineOperatorBuilder* machine_; |
| 76 SetOncePointer<Node> centrystub_constant_; | 76 SetOncePointer<Node> centrystub_constant_; |
| 77 }; | 77 }; |
| 78 } | 78 } |
| 79 } | 79 } |
| 80 } // namespace v8::internal::compiler | 80 } // namespace v8::internal::compiler |
| 81 | 81 |
| 82 #endif // V8_COMPILER_JS_GENERIC_LOWERING_H_ | 82 #endif // V8_COMPILER_JS_GENERIC_LOWERING_H_ |
| OLD | NEW |