V8 API Reference, 7.2.502.16 (for Deno 0.2.4)
js-context-specialization.h
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_CONTEXT_SPECIALIZATION_H_
6
#define V8_COMPILER_JS_CONTEXT_SPECIALIZATION_H_
7
8
#include "src/compiler/graph-reducer.h"
9
#include "src/maybe-handles.h"
10
11
namespace
v8
{
12
namespace
internal {
13
namespace
compiler {
14
15
// Forward declarations.
16
class
JSGraph;
17
class
JSOperatorBuilder;
18
19
// Pair of a context and its distance from some point of reference.
20
struct
OuterContext
{
21
OuterContext
() =
default
;
22
OuterContext
(
Handle<Context>
context_,
size_t
distance_)
23
: context(context_), distance(distance_) {}
24
25
Handle<Context>
context;
26
size_t
distance = 0;
27
};
28
29
// Specializes a given JSGraph to a given context, potentially constant folding
30
// some {LoadContext} nodes or strength reducing some {StoreContext} nodes.
31
// Additionally, constant-folds the function parameter if {closure} is given.
32
//
33
// The context can be the incoming function context or any outer context
34
// thereof, as indicated by {outer}'s {distance}.
35
class
JSContextSpecialization
final :
public
AdvancedReducer
{
36
public
:
37
JSContextSpecialization
(
Editor
* editor,
JSGraph
* jsgraph,
38
JSHeapBroker
* broker,
Maybe<OuterContext>
outer,
39
MaybeHandle<JSFunction>
closure)
40
:
AdvancedReducer
(editor),
41
jsgraph_(jsgraph),
42
outer_(outer),
43
closure_(closure),
44
broker_(broker) {}
45
46
const
char
* reducer_name()
const override
{
47
return
"JSContextSpecialization"
;
48
}
49
50
Reduction
Reduce(
Node
* node)
final
;
51
52
private
:
53
Reduction
ReduceParameter(
Node
* node);
54
Reduction
ReduceJSLoadContext(
Node
* node);
55
Reduction
ReduceJSStoreContext(
Node
* node);
56
57
Reduction
SimplifyJSStoreContext(
Node
* node,
Node
* new_context,
58
size_t
new_depth);
59
Reduction
SimplifyJSLoadContext(
Node
* node,
Node
* new_context,
60
size_t
new_depth);
61
62
Isolate
* isolate()
const
;
63
JSGraph
* jsgraph()
const
{
return
jsgraph_; }
64
Maybe<OuterContext>
outer()
const
{
return
outer_; }
65
MaybeHandle<JSFunction>
closure()
const
{
return
closure_; }
66
JSHeapBroker
* broker()
const
{
return
broker_; }
67
68
JSGraph
*
const
jsgraph_;
69
Maybe<OuterContext>
outer_;
70
MaybeHandle<JSFunction>
closure_;
71
JSHeapBroker
*
const
broker_;
72
73
DISALLOW_COPY_AND_ASSIGN(
JSContextSpecialization
);
74
};
75
76
}
// namespace compiler
77
}
// namespace internal
78
}
// namespace v8
79
80
#endif // V8_COMPILER_JS_CONTEXT_SPECIALIZATION_H_
v8::internal::compiler::JSGraph
Definition:
js-graph.h:26
v8::Maybe
Definition:
v8.h:56
v8::internal::compiler::JSContextSpecialization
Definition:
js-context-specialization.h:35
v8
Definition:
libplatform.h:13
v8::internal::Handle
Definition:
accessors.h:19
v8::internal::MaybeHandle
Definition:
globals.h:561
v8::internal::compiler::AdvancedReducer::Editor
Definition:
graph-reducer.h:74
v8::internal::Isolate
Definition:
isolate.h:516
v8::internal::compiler::JSHeapBroker
Definition:
js-heap-broker.h:594
v8::internal::compiler::Node
Definition:
node.h:43
v8::internal::compiler::OuterContext
Definition:
js-context-specialization.h:20
v8::internal::compiler::Reduction
Definition:
graph-reducer.h:30
v8::internal::compiler::AdvancedReducer
Definition:
graph-reducer.h:71
v8
src
compiler
js-context-specialization.h
Generated on Tue Dec 25 2018 14:38:38 by
1.8.14