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

Side by Side Diff: src/compiler/js-global-specialization.h

Issue 1387393002: [turbofan] Add initial support for global specialization. (Closed) Base URL: https://chromium.googlesource.com/v8/v8.git@AstGraphBuilder
Patch Set: Fix typo. Created 5 years, 2 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
« no previous file with comments | « src/compiler/js-context-specialization.cc ('k') | src/compiler/js-global-specialization.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 2015 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_GLOBAL_SPECIALIZATION_H_
6 #define V8_COMPILER_JS_GLOBAL_SPECIALIZATION_H_
7
8 #include "src/base/flags.h"
9 #include "src/compiler/graph-reducer.h"
10 #include "src/compiler/simplified-operator.h"
11
12 namespace v8 {
13 namespace internal {
14
15 // Forward declarations.
16 class CompilationDependencies;
17
18
19 namespace compiler {
20
21 // Forward declarations.
22 class JSGraph;
23 class JSOperatorBuilder;
24
25
26 // Specializes a given JSGraph to a given GlobalObject, potentially constant
27 // folding some {LoadGlobal} nodes or strength reducing some {StoreGlobal}
28 // nodes.
29 class JSGlobalSpecialization final : public AdvancedReducer {
30 public:
31 // Flags that control the mode of operation.
32 enum Flag {
33 kNoFlags = 0u,
34 kDeoptimizationEnabled = 1u << 0,
35 kTypingEnabled = 1u << 1
36 };
37 typedef base::Flags<Flag> Flags;
38
39 JSGlobalSpecialization(Editor* editor, JSGraph* jsgraph, Flags flags,
40 Handle<GlobalObject> global_object,
41 CompilationDependencies* dependencies);
42
43 Reduction Reduce(Node* node) final;
44
45 private:
46 Reduction ReduceJSLoadGlobal(Node* node);
47 Reduction ReduceJSStoreGlobal(Node* node);
48 Reduction ReduceLoadFromPropertyCell(Node* node,
49 Handle<PropertyCell> property_cell);
50 Reduction ReduceStoreToPropertyCell(Node* node,
51 Handle<PropertyCell> property_cell);
52
53 Reduction Replace(Node* node, Node* value, Node* effect = nullptr,
54 Node* control = nullptr) {
55 ReplaceWithValue(node, value, effect, control);
56 return Changed(value);
57 }
58 Reduction Replace(Node* node, Handle<Object> value);
59
60 Graph* graph() const;
61 JSGraph* jsgraph() const { return jsgraph_; }
62 Isolate* isolate() const;
63 JSOperatorBuilder* javascript() const;
64 SimplifiedOperatorBuilder* simplified() { return &simplified_; }
65 Flags flags() const { return flags_; }
66 Handle<GlobalObject> global_object() const { return global_object_; }
67 CompilationDependencies* dependencies() const { return dependencies_; }
68
69 JSGraph* const jsgraph_;
70 Flags const flags_;
71 Handle<GlobalObject> global_object_;
72 CompilationDependencies* const dependencies_;
73 SimplifiedOperatorBuilder simplified_;
74
75 DISALLOW_COPY_AND_ASSIGN(JSGlobalSpecialization);
76 };
77
78 } // namespace compiler
79 } // namespace internal
80 } // namespace v8
81
82 #endif // V8_COMPILER_JS_GLOBAL_SPECIALIZATION_H_
OLDNEW
« no previous file with comments | « src/compiler/js-context-specialization.cc ('k') | src/compiler/js-global-specialization.cc » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698