V8 Project
v8::internal::compiler::Typer Class Reference

#include <typer.h>

+ Collaboration diagram for v8::internal::compiler::Typer:

Classes

class  NarrowVisitor
 
class  RunVisitor
 
class  Visitor
 
class  WidenVisitor
 

Public Member Functions

 Typer (Zone *zone)
 
void Init (Node *node)
 
void Run (Graph *graph, MaybeHandle< Context > context)
 
void Narrow (Graph *graph, Node *node, MaybeHandle< Context > context)
 
void Widen (Graph *graph, Node *node, MaybeHandle< Context > context)
 
void DecorateGraph (Graph *graph)
 
Zonezone ()
 
Isolateisolate ()
 

Private Attributes

Zonezone_
 
Typenumber_fun0_
 
Typenumber_fun1_
 
Typenumber_fun2_
 
Typeweakint_fun1_
 
Typeimul_fun_
 
Typerandom_fun_
 
Typearray_buffer_fun_
 
Typeint8_array_fun_
 
Typeint16_array_fun_
 
Typeint32_array_fun_
 
Typeuint8_array_fun_
 
Typeuint16_array_fun_
 
Typeuint32_array_fun_
 
Typefloat32_array_fun_
 
Typefloat64_array_fun_
 

Detailed Description

Definition at line 18 of file typer.h.

Constructor & Destructor Documentation

◆ Typer()

v8::internal::compiler::Typer::Typer ( Zone zone)
explicit

Definition at line 17 of file typer.cc.

17  : zone_(zone) {
18  Factory* f = zone->isolate()->factory();
19 
20  Type* number = Type::Number();
21  Type* signed32 = Type::Signed32();
22  Type* unsigned32 = Type::Unsigned32();
23  Type* integral32 = Type::Integral32();
24  Type* object = Type::Object();
25  Type* undefined = Type::Undefined();
26  Type* weakint = Type::Union(
27  Type::Range(f->NewNumber(-V8_INFINITY), f->NewNumber(+V8_INFINITY), zone),
28  Type::Union(Type::NaN(), Type::MinusZero(), zone), zone);
29 
30  number_fun0_ = Type::Function(number, zone);
31  number_fun1_ = Type::Function(number, number, zone);
32  number_fun2_ = Type::Function(number, number, number, zone);
33  weakint_fun1_ = Type::Function(weakint, number, zone);
34  imul_fun_ = Type::Function(signed32, integral32, integral32, zone);
36  Type::UnsignedSmall(), Type::OtherNumber(), zone), zone);
37 
38 
39 #define NATIVE_TYPE(sem, rep) \
40  Type::Intersect(Type::sem(zone), Type::rep(zone), zone)
41  // TODO(rossberg): Use range types for more precision, once we have them.
42  Type* int8 = NATIVE_TYPE(SignedSmall, UntaggedInt8);
43  Type* int16 = NATIVE_TYPE(SignedSmall, UntaggedInt16);
44  Type* int32 = NATIVE_TYPE(Signed32, UntaggedInt32);
45  Type* uint8 = NATIVE_TYPE(UnsignedSmall, UntaggedInt8);
46  Type* uint16 = NATIVE_TYPE(UnsignedSmall, UntaggedInt16);
47  Type* uint32 = NATIVE_TYPE(Unsigned32, UntaggedInt32);
48  Type* float32 = NATIVE_TYPE(Number, UntaggedFloat32);
49  Type* float64 = NATIVE_TYPE(Number, UntaggedFloat64);
50 #undef NATIVE_TYPE
51  Type* buffer = Type::Buffer(zone);
52  Type* int8_array = Type::Array(int8, zone);
53  Type* int16_array = Type::Array(int16, zone);
54  Type* int32_array = Type::Array(int32, zone);
55  Type* uint8_array = Type::Array(uint8, zone);
56  Type* uint16_array = Type::Array(uint16, zone);
57  Type* uint32_array = Type::Array(uint32, zone);
58  Type* float32_array = Type::Array(float32, zone);
59  Type* float64_array = Type::Array(float64, zone);
60  Type* arg1 = Type::Union(unsigned32, object, zone);
61  Type* arg2 = Type::Union(unsigned32, undefined, zone);
62  Type* arg3 = arg2;
63  array_buffer_fun_ = Type::Function(buffer, unsigned32, zone);
64  int8_array_fun_ = Type::Function(int8_array, arg1, arg2, arg3, zone);
65  int16_array_fun_ = Type::Function(int16_array, arg1, arg2, arg3, zone);
66  int32_array_fun_ = Type::Function(int32_array, arg1, arg2, arg3, zone);
67  uint8_array_fun_ = Type::Function(uint8_array, arg1, arg2, arg3, zone);
68  uint16_array_fun_ = Type::Function(uint16_array, arg1, arg2, arg3, zone);
69  uint32_array_fun_ = Type::Function(uint32_array, arg1, arg2, arg3, zone);
70  float32_array_fun_ = Type::Function(float32_array, arg1, arg2, arg3, zone);
71  float64_array_fun_ = Type::Function(float64_array, arg1, arg2, arg3, zone);
72 }
Factory * factory()
Definition: isolate.h:982
static FunctionHandle Function(TypeHandle result, TypeHandle receiver, int arity, Region *region)
Definition: types.h:343
static TypeHandle Array(TypeHandle element, Region *region)
Definition: types.h:340
static TypeHandle Range(i::Handle< i::Object > min, i::Handle< i::Object > max, Region *region)
Definition: types.h:333
static TypeHandle Union(TypeHandle type1, TypeHandle type2, Region *reg)
Definition: types.cc:737
Isolate * isolate() const
Definition: zone.h:68
#define V8_INFINITY
Definition: globals.h:25
TypeImpl< ZoneTypeConfig > Type
kSerializedDataOffset Object
Definition: objects-inl.h:5322
Handle< Primitive > Undefined(Isolate *isolate)
Definition: v8.h:6836
#define NATIVE_TYPE(sem, rep)

References v8::internal::TypeImpl< ZoneTypeConfig >::Array(), array_buffer_fun_, v8::internal::Isolate::factory(), float32_array_fun_, float64_array_fun_, v8::internal::TypeImpl< ZoneTypeConfig >::Function(), imul_fun_, int16_array_fun_, int32_array_fun_, int8_array_fun_, v8::internal::Zone::isolate(), NATIVE_TYPE, number_fun0_, number_fun1_, number_fun2_, v8::internal::Object, random_fun_, v8::internal::TypeImpl< ZoneTypeConfig >::Range(), uint16_array_fun_, uint32_array_fun_, uint8_array_fun_, v8::Undefined(), v8::internal::TypeImpl< ZoneTypeConfig >::Union(), V8_INFINITY, weakint_fun1_, and zone().

+ Here is the call graph for this function:

Member Function Documentation

◆ DecorateGraph()

void v8::internal::compiler::Typer::DecorateGraph ( Graph graph)

Definition at line 908 of file typer.cc.

908  {
909  graph->AddDecorator(new (zone()) TyperDecorator(this));
910 }

References v8::internal::compiler::Graph::AddDecorator(), and zone().

Referenced by v8::internal::compiler::Pipeline::GenerateCode().

+ Here is the call graph for this function:
+ Here is the caller graph for this function:

◆ Init()

void v8::internal::compiler::Typer::Init ( Node *  node)

Definition at line 229 of file typer.cc.

229  {
230  if (OperatorProperties::HasValueOutput(node->op())) {
231  Visitor typing(this, MaybeHandle<Context>());
232  Bounds bounds = typing.TypeNode(node);
233  NodeProperties::SetBounds(node, bounds);
234  }
235 }
static void SetBounds(Node *node, Bounds bounds)
static bool HasValueOutput(const Operator *op)
BoundsImpl< ZoneTypeConfig > Bounds
Definition: types.h:1047

References v8::internal::compiler::OperatorProperties::HasValueOutput(), v8::internal::compiler::NodeProperties::SetBounds(), and v8::internal::compiler::Typer::Visitor::TypeNode().

Referenced by v8::internal::compiler::JSGraph::NewNode().

+ Here is the call graph for this function:
+ Here is the caller graph for this function:

◆ isolate()

Isolate* v8::internal::compiler::Typer::isolate ( )
inline

Definition at line 30 of file typer.h.

30 { return zone_->isolate(); }

References v8::internal::Zone::isolate(), and zone_.

Referenced by v8::internal::compiler::Typer::Visitor::isolate(), and v8::internal::compiler::Typer::Visitor::TypeConstant().

+ Here is the call graph for this function:
+ Here is the caller graph for this function:

◆ Narrow()

void v8::internal::compiler::Typer::Narrow ( Graph graph,
Node *  node,
MaybeHandle< Context context 
)

Definition at line 217 of file typer.cc.

217  {
218  NarrowVisitor typing(this, context);
219  graph->VisitNodeUsesFrom(start, &typing);
220 }

References v8::internal::compiler::Graph::VisitNodeUsesFrom().

+ Here is the call graph for this function:

◆ Run()

void v8::internal::compiler::Typer::Run ( Graph graph,
MaybeHandle< Context context 
)

Definition at line 207 of file typer.cc.

207  {
208  RunVisitor typing(this, context);
209  graph->VisitNodeInputsFromEnd(&typing);
210  // Find least fixpoint.
211  for (NodeSetIter i = typing.redo.begin(); i != typing.redo.end(); ++i) {
212  Widen(graph, *i, context);
213  }
214 }
void Widen(Graph *graph, Node *node, MaybeHandle< Context > context)
Definition: typer.cc:223
NodeSet::iterator NodeSetIter
Definition: node.h:69

References v8::internal::compiler::Typer::RunVisitor::redo, v8::internal::compiler::Graph::VisitNodeInputsFromEnd(), and Widen().

Referenced by v8::internal::compiler::Pipeline::GenerateCode().

+ Here is the call graph for this function:
+ Here is the caller graph for this function:

◆ Widen()

void v8::internal::compiler::Typer::Widen ( Graph graph,
Node *  node,
MaybeHandle< Context context 
)

Definition at line 223 of file typer.cc.

223  {
224  WidenVisitor typing(this, context);
225  graph->VisitNodeUsesFrom(start, &typing);
226 }

References v8::internal::compiler::Graph::VisitNodeUsesFrom().

Referenced by Run().

+ Here is the call graph for this function:
+ Here is the caller graph for this function:

◆ zone()

Zone* v8::internal::compiler::Typer::zone ( )
inline

Definition at line 29 of file typer.h.

29 { return zone_; }

References zone_.

Referenced by DecorateGraph(), v8::internal::compiler::Typer::Visitor::TypeConstant(), Typer(), and v8::internal::compiler::Typer::Visitor::zone().

+ Here is the caller graph for this function:

Member Data Documentation

◆ array_buffer_fun_

Type* v8::internal::compiler::Typer::array_buffer_fun_
private

Definition at line 45 of file typer.h.

Referenced by Typer().

◆ float32_array_fun_

Type* v8::internal::compiler::Typer::float32_array_fun_
private

Definition at line 52 of file typer.h.

Referenced by Typer().

◆ float64_array_fun_

Type* v8::internal::compiler::Typer::float64_array_fun_
private

Definition at line 53 of file typer.h.

Referenced by Typer().

◆ imul_fun_

Type* v8::internal::compiler::Typer::imul_fun_
private

Definition at line 43 of file typer.h.

Referenced by Typer().

◆ int16_array_fun_

Type* v8::internal::compiler::Typer::int16_array_fun_
private

Definition at line 47 of file typer.h.

Referenced by Typer().

◆ int32_array_fun_

Type* v8::internal::compiler::Typer::int32_array_fun_
private

Definition at line 48 of file typer.h.

Referenced by Typer().

◆ int8_array_fun_

Type* v8::internal::compiler::Typer::int8_array_fun_
private

Definition at line 46 of file typer.h.

Referenced by Typer().

◆ number_fun0_

Type* v8::internal::compiler::Typer::number_fun0_
private

Definition at line 39 of file typer.h.

Referenced by Typer().

◆ number_fun1_

Type* v8::internal::compiler::Typer::number_fun1_
private

Definition at line 40 of file typer.h.

Referenced by Typer().

◆ number_fun2_

Type* v8::internal::compiler::Typer::number_fun2_
private

Definition at line 41 of file typer.h.

Referenced by Typer().

◆ random_fun_

Type* v8::internal::compiler::Typer::random_fun_
private

Definition at line 44 of file typer.h.

Referenced by Typer().

◆ uint16_array_fun_

Type* v8::internal::compiler::Typer::uint16_array_fun_
private

Definition at line 50 of file typer.h.

Referenced by Typer().

◆ uint32_array_fun_

Type* v8::internal::compiler::Typer::uint32_array_fun_
private

Definition at line 51 of file typer.h.

Referenced by Typer().

◆ uint8_array_fun_

Type* v8::internal::compiler::Typer::uint8_array_fun_
private

Definition at line 49 of file typer.h.

Referenced by Typer().

◆ weakint_fun1_

Type* v8::internal::compiler::Typer::weakint_fun1_
private

Definition at line 42 of file typer.h.

Referenced by Typer().

◆ zone_

Zone* v8::internal::compiler::Typer::zone_
private

Definition at line 38 of file typer.h.

Referenced by isolate(), and zone().


The documentation for this class was generated from the following files: