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

Side by Side Diff: src/compiler/js-graph.h

Issue 426233002: Land the Fan (disabled) (Closed) Base URL: https://v8.googlecode.com/svn/branches/bleeding_edge
Patch Set: Review feedback, rebase and "git cl format" 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
« no previous file with comments | « src/compiler/js-generic-lowering.cc ('k') | src/compiler/js-graph.cc » ('j') | no next file with comments »
Toggle Intra-line Diffs ('i') | Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
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_GRAPH_H_
6 #define V8_COMPILER_JS_GRAPH_H_
7
8 #include "src/compiler/common-node-cache.h"
9 #include "src/compiler/common-operator.h"
10 #include "src/compiler/graph.h"
11 #include "src/compiler/js-operator.h"
12 #include "src/compiler/node-properties.h"
13
14 namespace v8 {
15 namespace internal {
16 namespace compiler {
17
18 class Typer;
19
20 // Implements a facade on a Graph, enhancing the graph with JS-specific
21 // notions, including a builder for for JS* operators, canonicalized global
22 // constants, and various helper methods.
23 class JSGraph : public ZoneObject {
24 public:
25 JSGraph(Graph* graph, CommonOperatorBuilder* common, Typer* typer)
26 : graph_(graph),
27 common_(common),
28 javascript_(zone()),
29 typer_(typer),
30 cache_(zone()) {}
31
32 // Canonicalized global constants.
33 Node* UndefinedConstant();
34 Node* TheHoleConstant();
35 Node* TrueConstant();
36 Node* FalseConstant();
37 Node* NullConstant();
38 Node* ZeroConstant();
39 Node* OneConstant();
40 Node* NaNConstant();
41
42 // Creates a HeapConstant node, possibly canonicalized, without inspecting the
43 // object.
44 Node* HeapConstant(PrintableUnique<Object> value);
45
46 // Creates a HeapConstant node, possibly canonicalized, and may access the
47 // heap to inspect the object.
48 Node* HeapConstant(Handle<Object> value);
49
50 // Creates a Constant node of the appropriate type for the given object.
51 // Accesses the heap to inspect the object and determine whether one of the
52 // canonicalized globals or a number constant should be returned.
53 Node* Constant(Handle<Object> value);
54
55 // Creates a NumberConstant node, usually canonicalized.
56 Node* Constant(double value);
57
58 // Creates a NumberConstant node, usually canonicalized.
59 Node* Constant(int32_t value);
60
61 // Creates a Int32Constant node, usually canonicalized.
62 Node* Int32Constant(int32_t value);
63
64 // Creates a Float64Constant node, usually canonicalized.
65 Node* Float64Constant(double value);
66
67 // Creates an ExternalConstant node, usually canonicalized.
68 Node* ExternalConstant(ExternalReference ref);
69
70 Node* SmiConstant(int32_t immediate) {
71 ASSERT(Smi::IsValid(immediate));
72 return Constant(immediate);
73 }
74
75 JSOperatorBuilder* javascript() { return &javascript_; }
76 CommonOperatorBuilder* common() { return common_; }
77 Graph* graph() { return graph_; }
78 Zone* zone() { return graph()->zone(); }
79
80 private:
81 Graph* graph_;
82 CommonOperatorBuilder* common_;
83 JSOperatorBuilder javascript_;
84 Typer* typer_;
85
86 SetOncePointer<Node> undefined_constant_;
87 SetOncePointer<Node> the_hole_constant_;
88 SetOncePointer<Node> true_constant_;
89 SetOncePointer<Node> false_constant_;
90 SetOncePointer<Node> null_constant_;
91 SetOncePointer<Node> zero_constant_;
92 SetOncePointer<Node> one_constant_;
93 SetOncePointer<Node> nan_constant_;
94
95 CommonNodeCache cache_;
96
97 Node* ImmovableHeapConstant(Handle<Object> value);
98 Node* NumberConstant(double value);
99 Node* NewNode(Operator* op);
100
101 Factory* factory() { return zone()->isolate()->factory(); }
102 };
103 } // namespace compiler
104 } // namespace internal
105 } // namespace v8
106
107 #endif
OLDNEW
« no previous file with comments | « src/compiler/js-generic-lowering.cc ('k') | src/compiler/js-graph.cc » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698