Chromium Code Reviews| 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 |
| 20 // Forward declarations. | 21 // Forward declarations. |
| 21 class HydrogenCodeStub; | 22 class HydrogenCodeStub; |
|
Michael Starzinger
2014/09/11 12:26:54
We can now drop this forward declare. Yay!
| |
| 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 { |
| (...skipping 16 matching lines...) Expand all Loading... | |
| 48 Node* CodeConstant(Handle<Code> code); | 49 Node* CodeConstant(Handle<Code> code); |
| 49 Node* FunctionConstant(Handle<JSFunction> function); | 50 Node* FunctionConstant(Handle<JSFunction> function); |
| 50 Node* ExternalConstant(ExternalReference ref); | 51 Node* ExternalConstant(ExternalReference ref); |
| 51 | 52 |
| 52 // Helpers to patch existing nodes in the graph. | 53 // Helpers to patch existing nodes in the graph. |
| 53 void PatchOperator(Node* node, const Operator* new_op); | 54 void PatchOperator(Node* node, const Operator* new_op); |
| 54 void PatchInsertInput(Node* node, int index, Node* input); | 55 void PatchInsertInput(Node* node, int index, Node* input); |
| 55 | 56 |
| 56 // Helpers to replace existing nodes with a generic call. | 57 // Helpers to replace existing nodes with a generic call. |
| 57 void ReplaceWithCompareIC(Node* node, Token::Value token, bool pure); | 58 void ReplaceWithCompareIC(Node* node, Token::Value token, bool pure); |
| 58 void ReplaceWithStubCall(Node* node, HydrogenCodeStub* stub, | 59 void ReplaceWithStubCall(Node* node, Callable callable, |
| 59 CallDescriptor::Flags flags); | 60 CallDescriptor::Flags flags); |
| 60 void ReplaceWithBuiltinCall(Node* node, Builtins::JavaScript id, int args); | 61 void ReplaceWithBuiltinCall(Node* node, Builtins::JavaScript id, int args); |
| 61 void ReplaceWithRuntimeCall(Node* node, Runtime::FunctionId f, int args = -1); | 62 void ReplaceWithRuntimeCall(Node* node, Runtime::FunctionId f, int args = -1); |
| 62 | 63 |
| 63 Zone* zone() const { return graph()->zone(); } | 64 Zone* zone() const { return graph()->zone(); } |
| 64 Isolate* isolate() const { return zone()->isolate(); } | 65 Isolate* isolate() const { return zone()->isolate(); } |
| 65 JSGraph* jsgraph() const { return jsgraph_; } | 66 JSGraph* jsgraph() const { return jsgraph_; } |
| 66 Graph* graph() const { return jsgraph()->graph(); } | 67 Graph* graph() const { return jsgraph()->graph(); } |
| 67 Linkage* linkage() const { return linkage_; } | 68 Linkage* linkage() const { return linkage_; } |
| 68 CompilationInfo* info() const { return info_; } | 69 CompilationInfo* info() const { return info_; } |
| 69 CommonOperatorBuilder* common() const { return jsgraph()->common(); } | 70 CommonOperatorBuilder* common() const { return jsgraph()->common(); } |
| 70 MachineOperatorBuilder* machine() const { return machine_; } | 71 MachineOperatorBuilder* machine() const { return machine_; } |
| 71 | 72 |
| 72 private: | 73 private: |
| 73 CompilationInfo* info_; | 74 CompilationInfo* info_; |
| 74 JSGraph* jsgraph_; | 75 JSGraph* jsgraph_; |
| 75 Linkage* linkage_; | 76 Linkage* linkage_; |
| 76 MachineOperatorBuilder* machine_; | 77 MachineOperatorBuilder* machine_; |
| 77 SetOncePointer<Node> centrystub_constant_; | 78 SetOncePointer<Node> centrystub_constant_; |
| 78 }; | 79 }; |
| 79 | 80 |
| 80 } // namespace compiler | 81 } // namespace compiler |
| 81 } // namespace internal | 82 } // namespace internal |
| 82 } // namespace v8 | 83 } // namespace v8 |
| 83 | 84 |
| 84 #endif // V8_COMPILER_JS_GENERIC_LOWERING_H_ | 85 #endif // V8_COMPILER_JS_GENERIC_LOWERING_H_ |
| OLD | NEW |