Chromium Code Reviews
chromiumcodereview-hr@appspot.gserviceaccount.com (chromiumcodereview-hr) | Please choose your nickname with Settings | Help | Chromium Project | Gerrit Changes | Sign out
(345)

Side by Side Diff: src/compiler/js-generic-lowering.h

Issue 426233002: Land the Fan (disabled) (Closed) Base URL: https://v8.googlecode.com/svn/branches/bleeding_edge
Patch Set: Created 6 years, 4 months ago
Use n/p to move between diff chunks; N/P to move between comments. Draft comments are only viewable by you.
Jump to:
View unified diff | Download patch | Annotate | Revision Log
OLDNEW
(Empty)
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
3 // found in the LICENSE file.
4
5 #ifndef V8_COMPILER_JS_GENERIC_LOWERING_H_
6 #define V8_COMPILER_JS_GENERIC_LOWERING_H_
7
8 #include "src/v8.h"
9
10 #include "src/allocation.h"
11 #include "src/compiler/graph.h"
12 #include "src/compiler/js-graph.h"
13 #include "src/compiler/lowering-builder.h"
14 #include "src/compiler/opcodes.h"
15 #include "src/unique.h"
16
17 namespace v8 {
18 namespace internal {
19
20 // Forward declarations.
21 class HydrogenCodeStub;
22
23 namespace compiler {
24
25 // Forward declarations.
26 class CommonOperatorBuilder;
27 class MachineOperatorBuilder;
28 class Linkage;
29
30 // Lowers JS-level operators to runtime and IC calls in the "generic" case.
31 class JSGenericLowering : public LoweringBuilder {
32 public:
33 JSGenericLowering(CompilationInfo* info, JSGraph* graph,
34 MachineOperatorBuilder* machine,
35 SourcePositionTable* source_positions);
36 virtual ~JSGenericLowering() {}
37
38 virtual void Lower(Node* node);
39
40 protected:
41 // Dispatched depending on opcode.
42 #define DECLARE_LOWER(x) \
43 Node* Lower##x(Node* node);
44 ALL_OP_LIST(DECLARE_LOWER)
45 #undef DECLARE_LOWER
46
47 // Helpers to create new constant nodes.
48 Node* SmiConstant(int immediate);
49 Node* Int32Constant(int immediate);
50 Node* CodeConstant(Handle<Code> code);
51 Node* FunctionConstant(Handle<JSFunction> function);
52 Node* ExternalConstant(ExternalReference ref);
53
54 // Helpers to patch existing nodes in the graph.
55 void PatchOperator(Node* node, Operator* new_op);
56 void PatchInsertInput(Node* node, int index, Node* input);
57
58 // Helpers to replace existing nodes with a generic call.
59 void ReplaceWithCompareIC(Node* node, Token::Value token, bool pure);
60 void ReplaceWithICStubCall(Node* node, HydrogenCodeStub* stub);
61 void ReplaceWithBuiltinCall(Node* node, Builtins::JavaScript id, int args);
62 void ReplaceWithRuntimeCall(Node* node, Runtime::FunctionId f, int args = -1);
63
64 Zone* zone() const { return graph()->zone(); }
65 Isolate* isolate() const { return zone()->isolate(); }
66 JSGraph* jsgraph() const { return jsgraph_; }
67 Graph* graph() const { return jsgraph()->graph(); }
68 Linkage* linkage() const { return linkage_; }
69 CompilationInfo* info() const { return info_; }
70 CommonOperatorBuilder* common() const { return jsgraph()->common(); }
71 MachineOperatorBuilder* machine() const { return machine_; }
72
73 private:
74 CompilationInfo* info_;
75 JSGraph* jsgraph_;
76 Linkage* linkage_;
77 MachineOperatorBuilder* machine_;
78 SetOncePointer<Node> centrystub_constant_;
79 };
80
81 } } } // namespace v8::internal::compiler
82
83 #endif // V8_COMPILER_JS_GENERIC_LOWERING_H_
OLDNEW

Powered by Google App Engine
This is Rietveld 408576698