class CodeGenerator: public AstVisitor {
public:
- explicit CodeGenerator(Isolate* isolate) {
- InitializeAstVisitor(isolate);
+ explicit CodeGenerator(Zone* zone) {
+ InitializeAstVisitor(zone);
}
static bool MakeCode(CompilationInfo* info);
#define __ ACCESS_MASM(masm())
-Register StubCompiler::CheckPrototypes(Handle<Type> type,
+Register StubCompiler::CheckPrototypes(Handle<HeapType> type,
Register object_reg,
Handle<JSObject> holder,
Register holder_reg,
Register LoadStubCompiler::CallbackHandlerFrontend(
- Handle<Type> type,
+ Handle<HeapType> type,
Register object_reg,
Handle<JSObject> holder,
Handle<Name> name,
}
-Handle<Code> LoadStubCompiler::CompileLoadNonexistent(Handle<Type> type,
+Handle<Code> LoadStubCompiler::CompileLoadNonexistent(Handle<HeapType> type,
Handle<JSObject> last,
Handle<Name> name) {
NonexistentHandlerFrontend(type, last, name);
Handle<Code> LoadStubCompiler::CompileLoadGlobal(
- Handle<Type> type,
+ Handle<HeapType> type,
Handle<GlobalObject> global,
Handle<PropertyCell> cell,
Handle<Name> name,
int number_of_handled_maps = 0;
__ ldr(map_reg, FieldMemOperand(receiver(), HeapObject::kMapOffset));
for (int current = 0; current < receiver_count; ++current) {
- Handle<Type> type = types->at(current);
+ Handle<HeapType> type = types->at(current);
Handle<Map> map = IC::TypeToMap(*type, isolate());
if (!map->is_deprecated()) {
number_of_handled_maps++;
__ mov(ip, Operand(map));
__ cmp(map_reg, ip);
- if (type->Is(Type::Number())) {
+ if (type->Is(HeapType::Number())) {
ASSERT(!number_case.is_unused());
__ bind(&number_case);
}
}
-VariableProxy::VariableProxy(Isolate* isolate, Variable* var, int position)
- : Expression(isolate, position),
+VariableProxy::VariableProxy(Zone* zone, Variable* var, int position)
+ : Expression(zone, position),
name_(var->name()),
var_(NULL), // Will be set by the call to BindTo.
is_this_(var->is_this()),
}
-VariableProxy::VariableProxy(Isolate* isolate,
+VariableProxy::VariableProxy(Zone* zone,
Handle<String> name,
bool is_this,
Interface* interface,
int position)
- : Expression(isolate, position),
+ : Expression(zone, position),
name_(name),
var_(NULL),
is_this_(is_this),
}
-Assignment::Assignment(Isolate* isolate,
+Assignment::Assignment(Zone* zone,
Token::Value op,
Expression* target,
Expression* value,
int pos)
- : Expression(isolate, pos),
+ : Expression(zone, pos),
op_(op),
target_(target),
value_(value),
binary_operation_(NULL),
- assignment_id_(GetNextId(isolate)),
+ assignment_id_(GetNextId(zone)),
is_uninitialized_(false),
is_pre_monomorphic_(false),
store_mode_(STANDARD_STORE) { }
}
-ObjectLiteralProperty::ObjectLiteralProperty(Literal* key,
- Expression* value,
- Isolate* isolate) {
+ObjectLiteralProperty::ObjectLiteralProperty(
+ Zone* zone, Literal* key, Expression* value) {
emit_store_ = true;
key_ = key;
value_ = value;
Object* k = *key->value();
if (k->IsInternalizedString() &&
- isolate->heap()->proto_string()->Equals(String::cast(k))) {
+ zone->isolate()->heap()->proto_string()->Equals(String::cast(k))) {
kind_ = PROTOTYPE;
} else if (value_->AsMaterializedLiteral() != NULL) {
kind_ = MATERIALIZED_LITERAL;
}
-ObjectLiteralProperty::ObjectLiteralProperty(bool is_getter,
- FunctionLiteral* value) {
+ObjectLiteralProperty::ObjectLiteralProperty(
+ Zone* zone, bool is_getter, FunctionLiteral* value) {
emit_store_ = true;
value_ = value;
kind_ = is_getter ? GETTER : SETTER;
}
-CaseClause::CaseClause(Isolate* isolate,
+CaseClause::CaseClause(Zone* zone,
Expression* label,
ZoneList<Statement*>* statements,
int pos)
- : Expression(isolate, pos),
+ : Expression(zone, pos),
label_(label),
statements_(statements),
- compare_type_(Type::None(isolate)),
- compare_id_(AstNode::GetNextId(isolate)),
- entry_id_(AstNode::GetNextId(isolate)) {
+ compare_type_(Type::None(zone)),
+ compare_id_(AstNode::GetNextId(zone)),
+ entry_id_(AstNode::GetNextId(zone)) {
}
virtual MaterializedLiteral* AsMaterializedLiteral() { return NULL; }
protected:
- static int GetNextId(Isolate* isolate) {
- return ReserveIdRange(isolate, 1);
+ static int GetNextId(Zone* zone) {
+ return ReserveIdRange(zone, 1);
}
- static int ReserveIdRange(Isolate* isolate, int n) {
- int tmp = isolate->ast_node_id();
- isolate->set_ast_node_id(tmp + n);
+ static int ReserveIdRange(Zone* zone, int n) {
+ int tmp = zone->isolate()->ast_node_id();
+ zone->isolate()->set_ast_node_id(tmp + n);
return tmp;
}
class Statement : public AstNode {
public:
- explicit Statement(int position) : AstNode(position) {}
+ explicit Statement(Zone* zone, int position) : AstNode(position) {}
bool IsEmpty() { return AsEmptyStatement() != NULL; }
virtual bool IsJump() const { return false; }
TypeFeedbackId test_id() const { return test_id_; }
protected:
- Expression(Isolate* isolate, int pos)
+ Expression(Zone* zone, int pos)
: AstNode(pos),
- bounds_(Bounds::Unbounded(isolate)),
- id_(GetNextId(isolate)),
- test_id_(GetNextId(isolate)) {}
+ bounds_(Bounds::Unbounded(zone)),
+ id_(GetNextId(zone)),
+ test_id_(GetNextId(zone)) {}
void set_to_boolean_types(byte types) { to_boolean_types_ = types; }
private:
protected:
BreakableStatement(
- Isolate* isolate, ZoneStringList* labels,
+ Zone* zone, ZoneStringList* labels,
BreakableType breakable_type, int position)
- : Statement(position),
+ : Statement(zone, position),
labels_(labels),
breakable_type_(breakable_type),
- entry_id_(GetNextId(isolate)),
- exit_id_(GetNextId(isolate)) {
+ entry_id_(GetNextId(zone)),
+ exit_id_(GetNextId(zone)) {
ASSERT(labels == NULL || labels->length() > 0);
}
void set_scope(Scope* scope) { scope_ = scope; }
protected:
- Block(Isolate* isolate,
+ Block(Zone* zone,
ZoneStringList* labels,
int capacity,
bool is_initializer_block,
- int pos,
- Zone* zone)
- : BreakableStatement(isolate, labels, TARGET_FOR_NAMED_ONLY, pos),
+ int pos)
+ : BreakableStatement(zone, labels, TARGET_FOR_NAMED_ONLY, pos),
statements_(capacity, zone),
is_initializer_block_(is_initializer_block),
scope_(NULL) {
virtual bool IsInlineable() const;
protected:
- Declaration(VariableProxy* proxy,
+ Declaration(Zone* zone,
+ VariableProxy* proxy,
VariableMode mode,
Scope* scope,
int pos)
}
protected:
- VariableDeclaration(VariableProxy* proxy,
+ VariableDeclaration(Zone* zone,
+ VariableProxy* proxy,
VariableMode mode,
Scope* scope,
int pos)
- : Declaration(proxy, mode, scope, pos) {
+ : Declaration(zone, proxy, mode, scope, pos) {
}
};
virtual bool IsInlineable() const V8_OVERRIDE;
protected:
- FunctionDeclaration(VariableProxy* proxy,
+ FunctionDeclaration(Zone* zone,
+ VariableProxy* proxy,
VariableMode mode,
FunctionLiteral* fun,
Scope* scope,
int pos)
- : Declaration(proxy, mode, scope, pos),
+ : Declaration(zone, proxy, mode, scope, pos),
fun_(fun) {
// At the moment there are no "const functions" in JavaScript...
ASSERT(mode == VAR || mode == LET);
}
protected:
- ModuleDeclaration(VariableProxy* proxy,
+ ModuleDeclaration(Zone* zone,
+ VariableProxy* proxy,
Module* module,
Scope* scope,
int pos)
- : Declaration(proxy, MODULE, scope, pos),
+ : Declaration(zone, proxy, MODULE, scope, pos),
module_(module) {
}
}
protected:
- ImportDeclaration(VariableProxy* proxy,
+ ImportDeclaration(Zone* zone,
+ VariableProxy* proxy,
Module* module,
Scope* scope,
int pos)
- : Declaration(proxy, LET, scope, pos),
+ : Declaration(zone, proxy, LET, scope, pos),
module_(module) {
}
}
protected:
- ExportDeclaration(VariableProxy* proxy, Scope* scope, int pos)
- : Declaration(proxy, LET, scope, pos) {}
+ ExportDeclaration(Zone* zone, VariableProxy* proxy, Scope* scope, int pos)
+ : Declaration(zone, proxy, LET, scope, pos) {}
};
: AstNode(pos),
interface_(Interface::NewModule(zone)),
body_(NULL) {}
- Module(Interface* interface, int pos, Block* body = NULL)
+ Module(Zone* zone, Interface* interface, int pos, Block* body = NULL)
: AstNode(pos),
interface_(interface),
body_(body) {}
DECLARE_NODE_TYPE(ModuleLiteral)
protected:
- ModuleLiteral(Block* body, Interface* interface, int pos)
- : Module(interface, pos, body) {}
+ ModuleLiteral(Zone* zone, Block* body, Interface* interface, int pos)
+ : Module(zone, interface, pos, body) {}
};
VariableProxy* proxy() const { return proxy_; }
protected:
- inline ModuleVariable(VariableProxy* proxy, int pos);
+ inline ModuleVariable(Zone* zone, VariableProxy* proxy, int pos);
private:
VariableProxy* proxy_;
Handle<String> name() const { return name_; }
protected:
- ModulePath(Module* module, Handle<String> name, Zone* zone, int pos)
+ ModulePath(Zone* zone, Module* module, Handle<String> name, int pos)
: Module(zone, pos),
module_(module),
name_(name) {
Handle<String> url() const { return url_; }
protected:
- ModuleUrl(Handle<String> url, Zone* zone, int pos)
+ ModuleUrl(Zone* zone, Handle<String> url, int pos)
: Module(zone, pos), url_(url) {
}
Block* body() const { return body_; }
protected:
- ModuleStatement(VariableProxy* proxy, Block* body, int pos)
- : Statement(pos),
+ ModuleStatement(Zone* zone, VariableProxy* proxy, Block* body, int pos)
+ : Statement(zone, pos),
proxy_(proxy),
body_(body) {
}
Label* continue_target() { return &continue_target_; }
protected:
- IterationStatement(Isolate* isolate, ZoneStringList* labels, int pos)
- : BreakableStatement(isolate, labels, TARGET_FOR_ANONYMOUS, pos),
+ IterationStatement(Zone* zone, ZoneStringList* labels, int pos)
+ : BreakableStatement(zone, labels, TARGET_FOR_ANONYMOUS, pos),
body_(NULL),
- osr_entry_id_(GetNextId(isolate)) {
+ osr_entry_id_(GetNextId(zone)) {
}
void Initialize(Statement* body) {
BailoutId BackEdgeId() const { return back_edge_id_; }
protected:
- DoWhileStatement(Isolate* isolate, ZoneStringList* labels, int pos)
- : IterationStatement(isolate, labels, pos),
+ DoWhileStatement(Zone* zone, ZoneStringList* labels, int pos)
+ : IterationStatement(zone, labels, pos),
cond_(NULL),
- continue_id_(GetNextId(isolate)),
- back_edge_id_(GetNextId(isolate)) {
+ continue_id_(GetNextId(zone)),
+ back_edge_id_(GetNextId(zone)) {
}
private:
BailoutId BodyId() const { return body_id_; }
protected:
- WhileStatement(Isolate* isolate, ZoneStringList* labels, int pos)
- : IterationStatement(isolate, labels, pos),
+ WhileStatement(Zone* zone, ZoneStringList* labels, int pos)
+ : IterationStatement(zone, labels, pos),
cond_(NULL),
may_have_function_literal_(true),
- body_id_(GetNextId(isolate)) {
+ body_id_(GetNextId(zone)) {
}
private:
void set_loop_variable(Variable* var) { loop_variable_ = var; }
protected:
- ForStatement(Isolate* isolate, ZoneStringList* labels, int pos)
- : IterationStatement(isolate, labels, pos),
+ ForStatement(Zone* zone, ZoneStringList* labels, int pos)
+ : IterationStatement(zone, labels, pos),
init_(NULL),
cond_(NULL),
next_(NULL),
may_have_function_literal_(true),
loop_variable_(NULL),
- continue_id_(GetNextId(isolate)),
- body_id_(GetNextId(isolate)) {
+ continue_id_(GetNextId(zone)),
+ body_id_(GetNextId(zone)) {
}
private:
Expression* subject() const { return subject_; }
protected:
- ForEachStatement(Isolate* isolate, ZoneStringList* labels, int pos)
- : IterationStatement(isolate, labels, pos),
+ ForEachStatement(Zone* zone, ZoneStringList* labels, int pos)
+ : IterationStatement(zone, labels, pos),
each_(NULL),
subject_(NULL) {
}
virtual BailoutId StackCheckId() const V8_OVERRIDE { return body_id_; }
protected:
- ForInStatement(Isolate* isolate, ZoneStringList* labels, int pos)
- : ForEachStatement(isolate, labels, pos),
+ ForInStatement(Zone* zone, ZoneStringList* labels, int pos)
+ : ForEachStatement(zone, labels, pos),
for_in_type_(SLOW_FOR_IN),
- body_id_(GetNextId(isolate)),
- prepare_id_(GetNextId(isolate)) {
+ body_id_(GetNextId(zone)),
+ prepare_id_(GetNextId(zone)) {
}
ForInType for_in_type_;
BailoutId BackEdgeId() const { return back_edge_id_; }
protected:
- ForOfStatement(Isolate* isolate, ZoneStringList* labels, int pos)
- : ForEachStatement(isolate, labels, pos),
+ ForOfStatement(Zone* zone, ZoneStringList* labels, int pos)
+ : ForEachStatement(zone, labels, pos),
assign_iterator_(NULL),
next_result_(NULL),
result_done_(NULL),
assign_each_(NULL),
- back_edge_id_(GetNextId(isolate)) {
+ back_edge_id_(GetNextId(zone)) {
}
Expression* assign_iterator_;
virtual bool IsJump() const V8_OVERRIDE { return expression_->IsThrow(); }
protected:
- ExpressionStatement(Expression* expression, int pos)
- : Statement(pos), expression_(expression) { }
+ ExpressionStatement(Zone* zone, Expression* expression, int pos)
+ : Statement(zone, pos), expression_(expression) { }
private:
Expression* expression_;
virtual bool IsJump() const V8_FINAL V8_OVERRIDE { return true; }
protected:
- explicit JumpStatement(int pos) : Statement(pos) {}
+ explicit JumpStatement(Zone* zone, int pos) : Statement(zone, pos) {}
};
IterationStatement* target() const { return target_; }
protected:
- explicit ContinueStatement(IterationStatement* target, int pos)
- : JumpStatement(pos), target_(target) { }
+ explicit ContinueStatement(Zone* zone, IterationStatement* target, int pos)
+ : JumpStatement(zone, pos), target_(target) { }
private:
IterationStatement* target_;
BreakableStatement* target() const { return target_; }
protected:
- explicit BreakStatement(BreakableStatement* target, int pos)
- : JumpStatement(pos), target_(target) { }
+ explicit BreakStatement(Zone* zone, BreakableStatement* target, int pos)
+ : JumpStatement(zone, pos), target_(target) { }
private:
BreakableStatement* target_;
Expression* expression() const { return expression_; }
protected:
- explicit ReturnStatement(Expression* expression, int pos)
- : JumpStatement(pos), expression_(expression) { }
+ explicit ReturnStatement(Zone* zone, Expression* expression, int pos)
+ : JumpStatement(zone, pos), expression_(expression) { }
private:
Expression* expression_;
protected:
WithStatement(
- Scope* scope, Expression* expression, Statement* statement, int pos)
- : Statement(pos),
+ Zone* zone, Scope* scope,
+ Expression* expression, Statement* statement, int pos)
+ : Statement(zone, pos),
scope_(scope),
expression_(expression),
statement_(statement) { }
// Type feedback information.
TypeFeedbackId CompareId() { return compare_id_; }
- Handle<Type> compare_type() { return compare_type_; }
- void set_compare_type(Handle<Type> type) { compare_type_ = type; }
+ Type* compare_type() { return compare_type_; }
+ void set_compare_type(Type* type) { compare_type_ = type; }
private:
- CaseClause(Isolate* isolate,
+ CaseClause(Zone* zone,
Expression* label,
ZoneList<Statement*>* statements,
int pos);
Expression* label_;
Label body_target_;
ZoneList<Statement*>* statements_;
- Handle<Type> compare_type_;
+ Type* compare_type_;
const TypeFeedbackId compare_id_;
const BailoutId entry_id_;
ZoneList<CaseClause*>* cases() const { return cases_; }
protected:
- SwitchStatement(Isolate* isolate, ZoneStringList* labels, int pos)
- : BreakableStatement(isolate, labels, TARGET_FOR_ANONYMOUS, pos),
+ SwitchStatement(Zone* zone, ZoneStringList* labels, int pos)
+ : BreakableStatement(zone, labels, TARGET_FOR_ANONYMOUS, pos),
tag_(NULL),
cases_(NULL) { }
BailoutId ElseId() const { return else_id_; }
protected:
- IfStatement(Isolate* isolate,
+ IfStatement(Zone* zone,
Expression* condition,
Statement* then_statement,
Statement* else_statement,
int pos)
- : Statement(pos),
+ : Statement(zone, pos),
condition_(condition),
then_statement_(then_statement),
else_statement_(else_statement),
- if_id_(GetNextId(isolate)),
- then_id_(GetNextId(isolate)),
- else_id_(GetNextId(isolate)) {
+ if_id_(GetNextId(zone)),
+ then_id_(GetNextId(zone)),
+ else_id_(GetNextId(zone)) {
}
private:
ZoneList<Label*>* escaping_targets() const { return escaping_targets_; }
protected:
- TryStatement(int index, Block* try_block, int pos)
- : Statement(pos),
+ TryStatement(Zone* zone, int index, Block* try_block, int pos)
+ : Statement(zone, pos),
index_(index),
try_block_(try_block),
escaping_targets_(NULL) { }
Block* catch_block() const { return catch_block_; }
protected:
- TryCatchStatement(int index,
+ TryCatchStatement(Zone* zone,
+ int index,
Block* try_block,
Scope* scope,
Variable* variable,
Block* catch_block,
int pos)
- : TryStatement(index, try_block, pos),
+ : TryStatement(zone, index, try_block, pos),
scope_(scope),
variable_(variable),
catch_block_(catch_block) {
protected:
TryFinallyStatement(
- int index, Block* try_block, Block* finally_block, int pos)
- : TryStatement(index, try_block, pos),
+ Zone* zone, int index, Block* try_block, Block* finally_block, int pos)
+ : TryStatement(zone, index, try_block, pos),
finally_block_(finally_block) { }
private:
DECLARE_NODE_TYPE(DebuggerStatement)
protected:
- explicit DebuggerStatement(int pos): Statement(pos) {}
+ explicit DebuggerStatement(Zone* zone, int pos): Statement(zone, pos) {}
};
DECLARE_NODE_TYPE(EmptyStatement)
protected:
- explicit EmptyStatement(int pos): Statement(pos) {}
+ explicit EmptyStatement(Zone* zone, int pos): Statement(zone, pos) {}
};
TypeFeedbackId LiteralFeedbackId() const { return reuse(id()); }
protected:
- Literal(
- Isolate* isolate, Handle<Object> value, int position)
- : Expression(isolate, position),
+ Literal(Zone* zone, Handle<Object> value, int position)
+ : Expression(zone, position),
value_(value),
- isolate_(isolate) { }
+ isolate_(zone->isolate()) { }
private:
Handle<String> ToString();
}
protected:
- MaterializedLiteral(Isolate* isolate,
+ MaterializedLiteral(Zone* zone,
int literal_index,
int pos)
- : Expression(isolate, pos),
+ : Expression(zone, pos),
literal_index_(literal_index),
is_simple_(false),
depth_(0) {}
PROTOTYPE // Property is __proto__.
};
- ObjectLiteralProperty(Literal* key, Expression* value, Isolate* isolate);
+ ObjectLiteralProperty(Zone* zone, Literal* key, Expression* value);
Literal* key() { return key_; }
Expression* value() { return value_; }
protected:
template<class> friend class AstNodeFactory;
- ObjectLiteralProperty(bool is_getter, FunctionLiteral* value);
+ ObjectLiteralProperty(Zone* zone, bool is_getter, FunctionLiteral* value);
void set_key(Literal* key) { key_ = key; }
private:
};
protected:
- ObjectLiteral(Isolate* isolate,
+ ObjectLiteral(Zone* zone,
ZoneList<Property*>* properties,
int literal_index,
int boilerplate_properties,
bool has_function,
int pos)
- : MaterializedLiteral(isolate, literal_index, pos),
+ : MaterializedLiteral(zone, literal_index, pos),
properties_(properties),
boilerplate_properties_(boilerplate_properties),
fast_elements_(false),
Handle<String> flags() const { return flags_; }
protected:
- RegExpLiteral(Isolate* isolate,
+ RegExpLiteral(Zone* zone,
Handle<String> pattern,
Handle<String> flags,
int literal_index,
int pos)
- : MaterializedLiteral(isolate, literal_index, pos),
+ : MaterializedLiteral(zone, literal_index, pos),
pattern_(pattern),
flags_(flags) {
set_depth(1);
};
protected:
- ArrayLiteral(Isolate* isolate,
+ ArrayLiteral(Zone* zone,
ZoneList<Expression*>* values,
int literal_index,
int pos)
- : MaterializedLiteral(isolate, literal_index, pos),
+ : MaterializedLiteral(zone, literal_index, pos),
values_(values),
- first_element_id_(ReserveIdRange(isolate, values->length())) {}
+ first_element_id_(ReserveIdRange(zone, values->length())) {}
private:
Handle<FixedArray> constant_elements_;
void BindTo(Variable* var);
protected:
- VariableProxy(Isolate* isolate, Variable* var, int position);
+ VariableProxy(Zone* zone, Variable* var, int position);
- VariableProxy(Isolate* isolate,
+ VariableProxy(Zone* zone,
Handle<String> name,
bool is_this,
Interface* interface,
TypeFeedbackId PropertyFeedbackId() { return reuse(id()); }
protected:
- Property(Isolate* isolate,
+ Property(Zone* zone,
Expression* obj,
Expression* key,
int pos)
- : Expression(isolate, pos),
+ : Expression(zone, pos),
obj_(obj),
key_(key),
- load_id_(GetNextId(isolate)),
+ load_id_(GetNextId(zone)),
is_pre_monomorphic_(false),
is_uninitialized_(false),
is_string_access_(false),
#endif
protected:
- Call(Isolate* isolate,
+ Call(Zone* zone,
Expression* expression,
ZoneList<Expression*>* arguments,
int pos)
- : Expression(isolate, pos),
+ : Expression(zone, pos),
expression_(expression),
arguments_(arguments),
is_monomorphic_(false),
keyed_array_call_is_holey_(true),
check_type_(RECEIVER_MAP_CHECK),
- return_id_(GetNextId(isolate)) { }
+ return_id_(GetNextId(zone)) { }
private:
Expression* expression_;
BailoutId ReturnId() const { return return_id_; }
protected:
- CallNew(Isolate* isolate,
+ CallNew(Zone* zone,
Expression* expression,
ZoneList<Expression*>* arguments,
int pos)
- : Expression(isolate, pos),
+ : Expression(zone, pos),
expression_(expression),
arguments_(arguments),
is_monomorphic_(false),
elements_kind_(GetInitialFastElementsKind()),
- return_id_(GetNextId(isolate)) { }
+ return_id_(GetNextId(zone)) { }
private:
Expression* expression_;
TypeFeedbackId CallRuntimeFeedbackId() const { return reuse(id()); }
protected:
- CallRuntime(Isolate* isolate,
+ CallRuntime(Zone* zone,
Handle<String> name,
const Runtime::Function* function,
ZoneList<Expression*>* arguments,
int pos)
- : Expression(isolate, pos),
+ : Expression(zone, pos),
name_(name),
function_(function),
arguments_(arguments) { }
TypeFeedbackOracle* oracle) V8_OVERRIDE;
protected:
- UnaryOperation(Isolate* isolate,
+ UnaryOperation(Zone* zone,
Token::Value op,
Expression* expression,
int pos)
- : Expression(isolate, pos),
+ : Expression(zone, pos),
op_(op),
expression_(expression),
- materialize_true_id_(GetNextId(isolate)),
- materialize_false_id_(GetNextId(isolate)) {
+ materialize_true_id_(GetNextId(zone)),
+ materialize_false_id_(GetNextId(zone)) {
ASSERT(Token::IsUnaryOp(op));
}
TypeFeedbackOracle* oracle) V8_OVERRIDE;
protected:
- BinaryOperation(Isolate* isolate,
+ BinaryOperation(Zone* zone,
Token::Value op,
Expression* left,
Expression* right,
int pos)
- : Expression(isolate, pos),
+ : Expression(zone, pos),
op_(op),
left_(left),
right_(right),
- right_id_(GetNextId(isolate)) {
+ right_id_(GetNextId(zone)) {
ASSERT(Token::IsBinaryOp(op));
}
virtual KeyedAccessStoreMode GetStoreMode() V8_OVERRIDE {
return store_mode_;
}
- Handle<Type> type() const { return type_; }
+ Type* type() const { return type_; }
void set_store_mode(KeyedAccessStoreMode mode) { store_mode_ = mode; }
- void set_type(Handle<Type> type) { type_ = type; }
+ void set_type(Type* type) { type_ = type; }
BailoutId AssignmentId() const { return assignment_id_; }
TypeFeedbackId CountStoreFeedbackId() const { return reuse(id()); }
protected:
- CountOperation(Isolate* isolate,
+ CountOperation(Zone* zone,
Token::Value op,
bool is_prefix,
Expression* expr,
int pos)
- : Expression(isolate, pos),
+ : Expression(zone, pos),
op_(op),
is_prefix_(is_prefix),
store_mode_(STANDARD_STORE),
expression_(expr),
- assignment_id_(GetNextId(isolate)),
- count_id_(GetNextId(isolate)) {}
+ assignment_id_(GetNextId(zone)),
+ count_id_(GetNextId(zone)) {}
private:
Token::Value op_;
bool is_prefix_ : 1;
KeyedAccessStoreMode store_mode_ : 5; // Windows treats as signed,
// must have extra bit.
- Handle<Type> type_;
+ Type* type_;
Expression* expression_;
const BailoutId assignment_id_;
// Type feedback information.
TypeFeedbackId CompareOperationFeedbackId() const { return reuse(id()); }
- Handle<Type> combined_type() const { return combined_type_; }
- void set_combined_type(Handle<Type> type) { combined_type_ = type; }
+ Type* combined_type() const { return combined_type_; }
+ void set_combined_type(Type* type) { combined_type_ = type; }
// Match special cases.
bool IsLiteralCompareTypeof(Expression** expr, Handle<String>* check);
bool IsLiteralCompareNull(Expression** expr);
protected:
- CompareOperation(Isolate* isolate,
+ CompareOperation(Zone* zone,
Token::Value op,
Expression* left,
Expression* right,
int pos)
- : Expression(isolate, pos),
+ : Expression(zone, pos),
op_(op),
left_(left),
right_(right),
- combined_type_(Type::None(isolate)) {
+ combined_type_(Type::None(zone)) {
ASSERT(Token::IsCompareOp(op));
}
Expression* left_;
Expression* right_;
- Handle<Type> combined_type_;
+ Type* combined_type_;
};
BailoutId ElseId() const { return else_id_; }
protected:
- Conditional(Isolate* isolate,
+ Conditional(Zone* zone,
Expression* condition,
Expression* then_expression,
Expression* else_expression,
int position)
- : Expression(isolate, position),
+ : Expression(zone, position),
condition_(condition),
then_expression_(then_expression),
else_expression_(else_expression),
- then_id_(GetNextId(isolate)),
- else_id_(GetNextId(isolate)) { }
+ then_id_(GetNextId(zone)),
+ else_id_(GetNextId(zone)) { }
private:
Expression* condition_;
void set_store_mode(KeyedAccessStoreMode mode) { store_mode_ = mode; }
protected:
- Assignment(Isolate* isolate,
+ Assignment(Zone* zone,
Token::Value op,
Expression* target,
Expression* value,
int pos);
template<class Visitor>
- void Init(Isolate* isolate, AstNodeFactory<Visitor>* factory) {
+ void Init(Zone* zone, AstNodeFactory<Visitor>* factory) {
ASSERT(Token::IsAssignmentOp(op_));
if (is_compound()) {
binary_operation_ = factory->NewBinaryOperation(
}
protected:
- Yield(Isolate* isolate,
+ Yield(Zone* zone,
Expression* generator_object,
Expression* expression,
Kind yield_kind,
int pos)
- : Expression(isolate, pos),
+ : Expression(zone, pos),
generator_object_(generator_object),
expression_(expression),
yield_kind_(yield_kind),
Expression* exception() const { return exception_; }
protected:
- Throw(Isolate* isolate, Expression* exception, int pos)
- : Expression(isolate, pos), exception_(exception) {}
+ Throw(Zone* zone, Expression* exception, int pos)
+ : Expression(zone, pos), exception_(exception) {}
private:
Expression* exception_;
}
protected:
- FunctionLiteral(Isolate* isolate,
+ FunctionLiteral(Zone* zone,
Handle<String> name,
Scope* scope,
ZoneList<Statement*>* body,
IsParenthesizedFlag is_parenthesized,
IsGeneratorFlag is_generator,
int position)
- : Expression(isolate, position),
+ : Expression(zone, position),
name_(name),
scope_(scope),
body_(body),
- inferred_name_(isolate->factory()->empty_string()),
+ inferred_name_(zone->isolate()->factory()->empty_string()),
dont_optimize_reason_(kNoReason),
materialized_literal_count_(materialized_literal_count),
expected_property_count_(expected_property_count),
protected:
NativeFunctionLiteral(
- Isolate* isolate, Handle<String> name, v8::Extension* extension, int pos)
- : Expression(isolate, pos), name_(name), extension_(extension) {}
+ Zone* zone, Handle<String> name, v8::Extension* extension, int pos)
+ : Expression(zone, pos), name_(name), extension_(extension) {}
private:
Handle<String> name_;
DECLARE_NODE_TYPE(ThisFunction)
protected:
- explicit ThisFunction(Isolate* isolate, int pos): Expression(isolate, pos) {}
+ explicit ThisFunction(Zone* zone, int pos): Expression(zone, pos) {}
};
#undef DECLARE_NODE_TYPE
// ----------------------------------------------------------------------------
// Out-of-line inline constructors (to side-step cyclic dependencies).
-inline ModuleVariable::ModuleVariable(VariableProxy* proxy, int pos)
- : Module(proxy->interface(), pos),
+inline ModuleVariable::ModuleVariable(Zone* zone, VariableProxy* proxy, int pos)
+ : Module(zone, proxy->interface(), pos),
proxy_(proxy) {
}
#define DEFINE_AST_VISITOR_SUBCLASS_MEMBERS() \
public: \
- virtual void Visit(AstNode* node) V8_FINAL V8_OVERRIDE { \
+ virtual void Visit(AstNode* node) V8_FINAL V8_OVERRIDE { \
if (!CheckStackOverflow()) node->Accept(this); \
} \
\
\
bool CheckStackOverflow() { \
if (stack_overflow_) return true; \
- StackLimitCheck check(isolate_); \
+ StackLimitCheck check(zone_->isolate()); \
if (!check.HasOverflowed()) return false; \
return (stack_overflow_ = true); \
} \
\
private: \
- void InitializeAstVisitor(Isolate* isolate) { \
- isolate_ = isolate; \
+ void InitializeAstVisitor(Zone* zone) { \
+ zone_ = zone; \
stack_overflow_ = false; \
} \
- Isolate* isolate() { return isolate_; } \
+ Zone* zone() { return zone_; } \
+ Isolate* isolate() { return zone_->isolate(); } \
\
- Isolate* isolate_; \
+ Zone* zone_; \
bool stack_overflow_
template<class Visitor>
class AstNodeFactory V8_FINAL BASE_EMBEDDED {
public:
- AstNodeFactory(Isolate* isolate, Zone* zone)
- : isolate_(isolate),
- zone_(zone) { }
+ explicit AstNodeFactory(Zone* zone) : zone_(zone) { }
Visitor* visitor() { return &visitor_; }
Scope* scope,
int pos) {
VariableDeclaration* decl =
- new(zone_) VariableDeclaration(proxy, mode, scope, pos);
+ new(zone_) VariableDeclaration(zone_, proxy, mode, scope, pos);
VISIT_AND_RETURN(VariableDeclaration, decl)
}
Scope* scope,
int pos) {
FunctionDeclaration* decl =
- new(zone_) FunctionDeclaration(proxy, mode, fun, scope, pos);
+ new(zone_) FunctionDeclaration(zone_, proxy, mode, fun, scope, pos);
VISIT_AND_RETURN(FunctionDeclaration, decl)
}
Scope* scope,
int pos) {
ModuleDeclaration* decl =
- new(zone_) ModuleDeclaration(proxy, module, scope, pos);
+ new(zone_) ModuleDeclaration(zone_, proxy, module, scope, pos);
VISIT_AND_RETURN(ModuleDeclaration, decl)
}
Scope* scope,
int pos) {
ImportDeclaration* decl =
- new(zone_) ImportDeclaration(proxy, module, scope, pos);
+ new(zone_) ImportDeclaration(zone_, proxy, module, scope, pos);
VISIT_AND_RETURN(ImportDeclaration, decl)
}
Scope* scope,
int pos) {
ExportDeclaration* decl =
- new(zone_) ExportDeclaration(proxy, scope, pos);
+ new(zone_) ExportDeclaration(zone_, proxy, scope, pos);
VISIT_AND_RETURN(ExportDeclaration, decl)
}
ModuleLiteral* NewModuleLiteral(Block* body, Interface* interface, int pos) {
- ModuleLiteral* module = new(zone_) ModuleLiteral(body, interface, pos);
+ ModuleLiteral* module =
+ new(zone_) ModuleLiteral(zone_, body, interface, pos);
VISIT_AND_RETURN(ModuleLiteral, module)
}
ModuleVariable* NewModuleVariable(VariableProxy* proxy, int pos) {
- ModuleVariable* module = new(zone_) ModuleVariable(proxy, pos);
+ ModuleVariable* module = new(zone_) ModuleVariable(zone_, proxy, pos);
VISIT_AND_RETURN(ModuleVariable, module)
}
ModulePath* NewModulePath(Module* origin, Handle<String> name, int pos) {
- ModulePath* module = new(zone_) ModulePath(origin, name, zone_, pos);
+ ModulePath* module = new(zone_) ModulePath(zone_, origin, name, pos);
VISIT_AND_RETURN(ModulePath, module)
}
ModuleUrl* NewModuleUrl(Handle<String> url, int pos) {
- ModuleUrl* module = new(zone_) ModuleUrl(url, zone_, pos);
+ ModuleUrl* module = new(zone_) ModuleUrl(zone_, url, pos);
VISIT_AND_RETURN(ModuleUrl, module)
}
bool is_initializer_block,
int pos) {
Block* block = new(zone_) Block(
- isolate_, labels, capacity, is_initializer_block, pos, zone_);
+ zone_, labels, capacity, is_initializer_block, pos);
VISIT_AND_RETURN(Block, block)
}
#define STATEMENT_WITH_LABELS(NodeType) \
NodeType* New##NodeType(ZoneStringList* labels, int pos) { \
- NodeType* stmt = new(zone_) NodeType(isolate_, labels, pos); \
+ NodeType* stmt = new(zone_) NodeType(zone_, labels, pos); \
VISIT_AND_RETURN(NodeType, stmt); \
}
STATEMENT_WITH_LABELS(DoWhileStatement)
int pos) {
switch (visit_mode) {
case ForEachStatement::ENUMERATE: {
- ForInStatement* stmt = new(zone_) ForInStatement(isolate_, labels, pos);
+ ForInStatement* stmt = new(zone_) ForInStatement(zone_, labels, pos);
VISIT_AND_RETURN(ForInStatement, stmt);
}
case ForEachStatement::ITERATE: {
- ForOfStatement* stmt = new(zone_) ForOfStatement(isolate_, labels, pos);
+ ForOfStatement* stmt = new(zone_) ForOfStatement(zone_, labels, pos);
VISIT_AND_RETURN(ForOfStatement, stmt);
}
}
ModuleStatement* NewModuleStatement(
VariableProxy* proxy, Block* body, int pos) {
- ModuleStatement* stmt = new(zone_) ModuleStatement(proxy, body, pos);
+ ModuleStatement* stmt = new(zone_) ModuleStatement(zone_, proxy, body, pos);
VISIT_AND_RETURN(ModuleStatement, stmt)
}
ExpressionStatement* NewExpressionStatement(Expression* expression, int pos) {
- ExpressionStatement* stmt = new(zone_) ExpressionStatement(expression, pos);
+ ExpressionStatement* stmt =
+ new(zone_) ExpressionStatement(zone_, expression, pos);
VISIT_AND_RETURN(ExpressionStatement, stmt)
}
ContinueStatement* NewContinueStatement(IterationStatement* target, int pos) {
- ContinueStatement* stmt = new(zone_) ContinueStatement(target, pos);
+ ContinueStatement* stmt = new(zone_) ContinueStatement(zone_, target, pos);
VISIT_AND_RETURN(ContinueStatement, stmt)
}
BreakStatement* NewBreakStatement(BreakableStatement* target, int pos) {
- BreakStatement* stmt = new(zone_) BreakStatement(target, pos);
+ BreakStatement* stmt = new(zone_) BreakStatement(zone_, target, pos);
VISIT_AND_RETURN(BreakStatement, stmt)
}
ReturnStatement* NewReturnStatement(Expression* expression, int pos) {
- ReturnStatement* stmt = new(zone_) ReturnStatement(expression, pos);
+ ReturnStatement* stmt = new(zone_) ReturnStatement(zone_, expression, pos);
VISIT_AND_RETURN(ReturnStatement, stmt)
}
Statement* statement,
int pos) {
WithStatement* stmt = new(zone_) WithStatement(
- scope, expression, statement, pos);
+ zone_, scope, expression, statement, pos);
VISIT_AND_RETURN(WithStatement, stmt)
}
Statement* else_statement,
int pos) {
IfStatement* stmt = new(zone_) IfStatement(
- isolate_, condition, then_statement, else_statement, pos);
+ zone_, condition, then_statement, else_statement, pos);
VISIT_AND_RETURN(IfStatement, stmt)
}
Block* catch_block,
int pos) {
TryCatchStatement* stmt = new(zone_) TryCatchStatement(
- index, try_block, scope, variable, catch_block, pos);
+ zone_, index, try_block, scope, variable, catch_block, pos);
VISIT_AND_RETURN(TryCatchStatement, stmt)
}
Block* try_block,
Block* finally_block,
int pos) {
- TryFinallyStatement* stmt =
- new(zone_) TryFinallyStatement(index, try_block, finally_block, pos);
+ TryFinallyStatement* stmt = new(zone_) TryFinallyStatement(
+ zone_, index, try_block, finally_block, pos);
VISIT_AND_RETURN(TryFinallyStatement, stmt)
}
DebuggerStatement* NewDebuggerStatement(int pos) {
- DebuggerStatement* stmt = new(zone_) DebuggerStatement(pos);
+ DebuggerStatement* stmt = new(zone_) DebuggerStatement(zone_, pos);
VISIT_AND_RETURN(DebuggerStatement, stmt)
}
EmptyStatement* NewEmptyStatement(int pos) {
- return new(zone_) EmptyStatement(pos);
+ return new(zone_) EmptyStatement(zone_, pos);
}
CaseClause* NewCaseClause(
Expression* label, ZoneList<Statement*>* statements, int pos) {
CaseClause* clause =
- new(zone_) CaseClause(isolate_, label, statements, pos);
+ new(zone_) CaseClause(zone_, label, statements, pos);
VISIT_AND_RETURN(CaseClause, clause)
}
Literal* NewLiteral(Handle<Object> handle, int pos) {
- Literal* lit = new(zone_) Literal(isolate_, handle, pos);
+ Literal* lit = new(zone_) Literal(zone_, handle, pos);
VISIT_AND_RETURN(Literal, lit)
}
Literal* NewNumberLiteral(double number, int pos) {
- return NewLiteral(isolate_->factory()->NewNumber(number, TENURED), pos);
+ return NewLiteral(
+ zone_->isolate()->factory()->NewNumber(number, TENURED), pos);
}
ObjectLiteral* NewObjectLiteral(
bool has_function,
int pos) {
ObjectLiteral* lit = new(zone_) ObjectLiteral(
- isolate_, properties, literal_index, boilerplate_properties,
+ zone_, properties, literal_index, boilerplate_properties,
has_function, pos);
VISIT_AND_RETURN(ObjectLiteral, lit)
}
+ ObjectLiteral::Property* NewObjectLiteralProperty(Literal* key,
+ Expression* value) {
+ return new(zone_) ObjectLiteral::Property(zone_, key, value);
+ }
+
ObjectLiteral::Property* NewObjectLiteralProperty(bool is_getter,
FunctionLiteral* value,
int pos) {
ObjectLiteral::Property* prop =
- new(zone_) ObjectLiteral::Property(is_getter, value);
+ new(zone_) ObjectLiteral::Property(zone_, is_getter, value);
prop->set_key(NewLiteral(value->name(), pos));
return prop; // Not an AST node, will not be visited.
}
int literal_index,
int pos) {
RegExpLiteral* lit =
- new(zone_) RegExpLiteral(isolate_, pattern, flags, literal_index, pos);
+ new(zone_) RegExpLiteral(zone_, pattern, flags, literal_index, pos);
VISIT_AND_RETURN(RegExpLiteral, lit);
}
int literal_index,
int pos) {
ArrayLiteral* lit = new(zone_) ArrayLiteral(
- isolate_, values, literal_index, pos);
+ zone_, values, literal_index, pos);
VISIT_AND_RETURN(ArrayLiteral, lit)
}
VariableProxy* NewVariableProxy(Variable* var,
int pos = RelocInfo::kNoPosition) {
- VariableProxy* proxy = new(zone_) VariableProxy(isolate_, var, pos);
+ VariableProxy* proxy = new(zone_) VariableProxy(zone_, var, pos);
VISIT_AND_RETURN(VariableProxy, proxy)
}
Interface* interface = Interface::NewValue(),
int position = RelocInfo::kNoPosition) {
VariableProxy* proxy =
- new(zone_) VariableProxy(isolate_, name, is_this, interface, position);
+ new(zone_) VariableProxy(zone_, name, is_this, interface, position);
VISIT_AND_RETURN(VariableProxy, proxy)
}
Property* NewProperty(Expression* obj, Expression* key, int pos) {
- Property* prop = new(zone_) Property(isolate_, obj, key, pos);
+ Property* prop = new(zone_) Property(zone_, obj, key, pos);
VISIT_AND_RETURN(Property, prop)
}
Call* NewCall(Expression* expression,
ZoneList<Expression*>* arguments,
int pos) {
- Call* call = new(zone_) Call(isolate_, expression, arguments, pos);
+ Call* call = new(zone_) Call(zone_, expression, arguments, pos);
VISIT_AND_RETURN(Call, call)
}
CallNew* NewCallNew(Expression* expression,
ZoneList<Expression*>* arguments,
int pos) {
- CallNew* call = new(zone_) CallNew(isolate_, expression, arguments, pos);
+ CallNew* call = new(zone_) CallNew(zone_, expression, arguments, pos);
VISIT_AND_RETURN(CallNew, call)
}
ZoneList<Expression*>* arguments,
int pos) {
CallRuntime* call =
- new(zone_) CallRuntime(isolate_, name, function, arguments, pos);
+ new(zone_) CallRuntime(zone_, name, function, arguments, pos);
VISIT_AND_RETURN(CallRuntime, call)
}
Expression* expression,
int pos) {
UnaryOperation* node =
- new(zone_) UnaryOperation(isolate_, op, expression, pos);
+ new(zone_) UnaryOperation(zone_, op, expression, pos);
VISIT_AND_RETURN(UnaryOperation, node)
}
Expression* right,
int pos) {
BinaryOperation* node =
- new(zone_) BinaryOperation(isolate_, op, left, right, pos);
+ new(zone_) BinaryOperation(zone_, op, left, right, pos);
VISIT_AND_RETURN(BinaryOperation, node)
}
Expression* expr,
int pos) {
CountOperation* node =
- new(zone_) CountOperation(isolate_, op, is_prefix, expr, pos);
+ new(zone_) CountOperation(zone_, op, is_prefix, expr, pos);
VISIT_AND_RETURN(CountOperation, node)
}
Expression* right,
int pos) {
CompareOperation* node =
- new(zone_) CompareOperation(isolate_, op, left, right, pos);
+ new(zone_) CompareOperation(zone_, op, left, right, pos);
VISIT_AND_RETURN(CompareOperation, node)
}
Expression* else_expression,
int position) {
Conditional* cond = new(zone_) Conditional(
- isolate_, condition, then_expression, else_expression, position);
+ zone_, condition, then_expression, else_expression, position);
VISIT_AND_RETURN(Conditional, cond)
}
Expression* value,
int pos) {
Assignment* assign =
- new(zone_) Assignment(isolate_, op, target, value, pos);
- assign->Init(isolate_, this);
+ new(zone_) Assignment(zone_, op, target, value, pos);
+ assign->Init(zone_, this);
VISIT_AND_RETURN(Assignment, assign)
}
Yield::Kind yield_kind,
int pos) {
Yield* yield = new(zone_) Yield(
- isolate_, generator_object, expression, yield_kind, pos);
+ zone_, generator_object, expression, yield_kind, pos);
VISIT_AND_RETURN(Yield, yield)
}
Throw* NewThrow(Expression* exception, int pos) {
- Throw* t = new(zone_) Throw(isolate_, exception, pos);
+ Throw* t = new(zone_) Throw(zone_, exception, pos);
VISIT_AND_RETURN(Throw, t)
}
FunctionLiteral::IsGeneratorFlag is_generator,
int position) {
FunctionLiteral* lit = new(zone_) FunctionLiteral(
- isolate_, name, scope, body,
+ zone_, name, scope, body,
materialized_literal_count, expected_property_count, handler_count,
parameter_count, function_type, has_duplicate_parameters, is_function,
is_parenthesized, is_generator, position);
NativeFunctionLiteral* NewNativeFunctionLiteral(
Handle<String> name, v8::Extension* extension, int pos) {
NativeFunctionLiteral* lit =
- new(zone_) NativeFunctionLiteral(isolate_, name, extension, pos);
+ new(zone_) NativeFunctionLiteral(zone_, name, extension, pos);
VISIT_AND_RETURN(NativeFunctionLiteral, lit)
}
ThisFunction* NewThisFunction(int pos) {
- ThisFunction* fun = new(zone_) ThisFunction(isolate_, pos);
+ ThisFunction* fun = new(zone_) ThisFunction(zone_, pos);
VISIT_AND_RETURN(ThisFunction, fun)
}
#undef VISIT_AND_RETURN
private:
- Isolate* isolate_;
Zone* zone_;
Visitor visitor_;
};
HValue* CodeStubGraphBuilder<NumberToStringStub>::BuildCodeStub() {
info()->MarkAsSavesCallerDoubles();
HValue* number = GetParameter(NumberToStringStub::kNumber);
- return BuildNumberToString(number, Type::Number(isolate()));
+ return BuildNumberToString(number, Type::Number(zone()));
}
CompareNilICStub* stub = casted_stub();
HIfContinuation continuation;
Handle<Map> sentinel_map(isolate->heap()->meta_map());
- Handle<Type> type = stub->GetType(isolate, sentinel_map);
+ Type* type = stub->GetType(zone(), sentinel_map);
BuildCompareNil(GetParameter(0), type, &continuation);
IfBuilder if_nil(this, &continuation);
if_nil.Then();
HValue* left = GetParameter(BinaryOpICStub::kLeft);
HValue* right = GetParameter(BinaryOpICStub::kRight);
- Handle<Type> left_type = state.GetLeftType(isolate());
- Handle<Type> right_type = state.GetRightType(isolate());
- Handle<Type> result_type = state.GetResultType(isolate());
+ Type* left_type = state.GetLeftType(zone());
+ Type* right_type = state.GetRightType(zone());
+ Type* result_type = state.GetResultType(zone());
ASSERT(!left_type->Is(Type::None()) && !right_type->Is(Type::None()) &&
(state.HasSideEffects() || !result_type->Is(Type::None())));
{
Push(BuildBinaryOperation(
state.op(), left, right,
- Type::String(isolate()), right_type,
+ Type::String(zone()), right_type,
result_type, state.fixed_right_arg(),
allocation_mode));
}
{
Push(BuildBinaryOperation(
state.op(), left, right,
- left_type, Type::String(isolate()),
+ left_type, Type::String(zone()),
result_type, state.fixed_right_arg(),
allocation_mode));
}
HValue* left = GetParameter(BinaryOpWithAllocationSiteStub::kLeft);
HValue* right = GetParameter(BinaryOpWithAllocationSiteStub::kRight);
- Handle<Type> left_type = state.GetLeftType(isolate());
- Handle<Type> right_type = state.GetRightType(isolate());
- Handle<Type> result_type = state.GetResultType(isolate());
+ Type* left_type = state.GetLeftType(zone());
+ Type* right_type = state.GetRightType(zone());
+ Type* result_type = state.GetResultType(zone());
HAllocationMode allocation_mode(allocation_site);
return BuildBinaryOperation(state.op(), left, right,
}
-Handle<Type> CompareNilICStub::GetType(
- Isolate* isolate,
- Handle<Map> map) {
+Type* CompareNilICStub::GetType(Zone* zone, Handle<Map> map) {
if (state_.Contains(CompareNilICStub::GENERIC)) {
- return Type::Any(isolate);
+ return Type::Any(zone);
}
- Handle<Type> result = Type::None(isolate);
+ Type* result = Type::None(zone);
if (state_.Contains(CompareNilICStub::UNDEFINED)) {
- result = Type::Union(result, Type::Undefined(isolate), isolate);
+ result = Type::Union(result, Type::Undefined(zone), zone);
}
if (state_.Contains(CompareNilICStub::NULL_TYPE)) {
- result = Type::Union(result, Type::Null(isolate), isolate);
+ result = Type::Union(result, Type::Null(zone), zone);
}
if (state_.Contains(CompareNilICStub::MONOMORPHIC_MAP)) {
- Handle<Type> type = map.is_null()
- ? Type::Detectable(isolate) : Type::Class(map, isolate);
- result = Type::Union(result, type, isolate);
+ Type* type =
+ map.is_null() ? Type::Detectable(zone) : Type::Class(map, zone);
+ result = Type::Union(result, type, zone);
}
return result;
}
-Handle<Type> CompareNilICStub::GetInputType(
- Isolate* isolate,
- Handle<Map> map) {
- Handle<Type> output_type = GetType(isolate, map);
- Handle<Type> nil_type = nil_value_ == kNullValue
- ? Type::Null(isolate) : Type::Undefined(isolate);
- return Type::Union(output_type, nil_type, isolate);
+Type* CompareNilICStub::GetInputType(Zone* zone, Handle<Map> map) {
+ Type* output_type = GetType(zone, map);
+ Type* nil_type =
+ nil_value_ == kNullValue ? Type::Null(zone) : Type::Undefined(zone);
+ return Type::Union(output_type, nil_type, zone);
}
class CompareNilICStub : public HydrogenCodeStub {
public:
- Handle<Type> GetType(Isolate* isolate, Handle<Map> map = Handle<Map>());
- Handle<Type> GetInputType(Isolate* isolate, Handle<Map> map);
+ Type* GetType(Zone* zone, Handle<Map> map = Handle<Map>());
+ Type* GetInputType(Zone* zone, Handle<Map> map);
explicit CompareNilICStub(NilValue nil) : nil_value_(nil) { }
#ifdef DEBUG
if (!info->IsStub() && print_source) {
PrintF("--- Source from AST ---\n%s\n",
- PrettyPrinter(info->isolate()).PrintProgram(info->function()));
+ PrettyPrinter(info->zone()).PrintProgram(info->function()));
}
if (!info->IsStub() && print_ast) {
PrintF("--- AST ---\n%s\n",
- AstPrinter(info->isolate()).PrintProgram(info->function()));
+ AstPrinter(info->zone()).PrintProgram(info->function()));
}
#endif // DEBUG
}
Effect(Bounds b, Modality m = DEFINITE) : modality(m), bounds(b) {}
// The unknown effect.
- static Effect Unknown(Isolate* isolate) {
- return Effect(Bounds::Unbounded(isolate), POSSIBLE);
+ static Effect Unknown(Zone* zone) {
+ return Effect(Bounds::Unbounded(zone), POSSIBLE);
}
- static Effect Forget(Isolate* isolate) {
- return Effect(Bounds::Unbounded(isolate), DEFINITE);
+ static Effect Forget(Zone* zone) {
+ return Effect(Bounds::Unbounded(zone), DEFINITE);
}
// Sequential composition, as in 'e1; e2'.
- static Effect Seq(Effect e1, Effect e2, Isolate* isolate) {
+ static Effect Seq(Effect e1, Effect e2, Zone* zone) {
if (e2.modality == DEFINITE) return e2;
- return Effect(Bounds::Either(e1.bounds, e2.bounds, isolate), e1.modality);
+ return Effect(Bounds::Either(e1.bounds, e2.bounds, zone), e1.modality);
}
// Alternative composition, as in 'cond ? e1 : e2'.
- static Effect Alt(Effect e1, Effect e2, Isolate* isolate) {
+ static Effect Alt(Effect e1, Effect e2, Zone* zone) {
return Effect(
- Bounds::Either(e1.bounds, e2.bounds, isolate),
+ Bounds::Either(e1.bounds, e2.bounds, zone),
e1.modality == POSSIBLE ? POSSIBLE : e2.modality);
}
};
Effect Lookup(Var var) {
Locator locator;
return this->Find(var, &locator)
- ? locator.value() : Effect::Unknown(Base::isolate());
+ ? locator.value() : Effect::Unknown(Base::zone());
}
Bounds LookupBounds(Var var) {
Effect effect = Lookup(var);
return effect.modality == Effect::DEFINITE
- ? effect.bounds : Bounds::Unbounded(Base::isolate());
+ ? effect.bounds : Bounds::Unbounded(Base::zone());
}
// Sequential composition.
void Seq(Var var, Effect effect) {
Locator locator;
if (!this->Insert(var, &locator)) {
- effect = Effect::Seq(locator.value(), effect, Base::isolate());
+ effect = Effect::Seq(locator.value(), effect, Base::zone());
}
locator.set_value(effect);
}
void Alt(Var var, Effect effect) {
Locator locator;
if (!this->Insert(var, &locator)) {
- effect = Effect::Alt(locator.value(), effect, Base::isolate());
+ effect = Effect::Alt(locator.value(), effect, Base::zone());
}
locator.set_value(effect);
}
// Invalidation.
void Forget() {
Overrider override = {
- Effect::Forget(Base::isolate()), Effects(Base::zone()) };
+ Effect::Forget(Base::zone()), Effects(Base::zone()) };
this->ForEach(&override);
Seq(override.effects);
}
EffectsMixin<Var, NestedEffectsBase<Var, kNoVar>, Effects<Var, kNoVar> >;
Zone* zone() { return map_->allocator().zone(); }
- Isolate* isolate() { return zone()->isolate(); }
struct SplayTreeConfig {
typedef Var Key;
typedef typename EffectsBase<Var, kNoVar>::Locator Locator;
Zone* zone() { return node_->zone; }
- Isolate* isolate() { return zone()->isolate(); }
void push() { node_ = new(node_->zone) Node(node_->zone, node_); }
void pop() { node_ = node_->previous; }
!Snapshot::HaveASnapshotToStartFrom();
masm_->set_emit_debug_code(generate_debug_code_);
masm_->set_predictable_code_size(true);
- InitializeAstVisitor(info_->isolate());
+ InitializeAstVisitor(info_->zone());
}
} else {
// Check if the statement will be breakable without adding a debug break
// slot.
- BreakableStatementChecker checker(isolate());
+ BreakableStatementChecker checker(zone());
checker.Check(stmt);
// Record the statement position right here if the statement is not
// breakable. For breakable statements the actual recording of the
} else {
// Check if the expression will be breakable without adding a debug break
// slot.
- BreakableStatementChecker checker(isolate());
+ BreakableStatementChecker checker(zone());
checker.Check(expr);
// Record a statement position right here if the expression is not
// breakable. For breakable expressions the actual recording of the
// debugger to piggybag on.
class BreakableStatementChecker: public AstVisitor {
public:
- explicit BreakableStatementChecker(Isolate* isolate) : is_breakable_(false) {
- InitializeAstVisitor(isolate);
+ explicit BreakableStatementChecker(Zone* zone) : is_breakable_(false) {
+ InitializeAstVisitor(zone);
}
void Check(Statement* stmt);
type_feedback_cells_(info->HasDeoptimizationSupport()
? info->function()->ast_node_count() : 0,
info->zone()),
- ic_total_count_(0),
- zone_(info->zone()) {
+ ic_total_count_(0) {
Initialize();
}
return NULL;
}
- Zone* zone() const { return zone_; }
-
static const int kMaxBackEdgeWeight = 127;
// Platform-specific code size multiplier.
Handle<FixedArray> handler_table_;
Handle<Cell> profiling_counter_;
bool generate_debug_code_;
- Zone* zone_;
friend class NestedStatement;
cell->set_dependent_code(DependentCode::cast(empty_fixed_array()),
SKIP_WRITE_BARRIER);
cell->set_value(the_hole_value());
- cell->set_type(Type::None());
+ cell->set_type(HeapType::None());
return result;
}
}
-HValue* HGraphBuilder::BuildNumberToString(HValue* object,
- Handle<Type> type) {
+HValue* HGraphBuilder::BuildNumberToString(HValue* object, Type* type) {
NoObservableSideEffectsScope scope(this);
// Convert constant numbers at compile time.
void HGraphBuilder::BuildCompareNil(
HValue* value,
- Handle<Type> type,
+ Type* type,
HIfContinuation* continuation) {
IfBuilder if_nil(this);
bool some_case_handled = false;
// constructor for the initial state relies on function_state_ == NULL
// to know it's the initial state.
function_state_= &initial_function_state_;
- InitializeAstVisitor(info->isolate());
+ InitializeAstVisitor(info->zone());
if (FLAG_emit_opt_code_positions) {
SetSourcePosition(info->shared_info()->start_position());
}
CHECK_ALIVE(VisitForValue(stmt->tag()));
Add<HSimulate>(stmt->EntryId());
HValue* tag_value = Top();
- Handle<Type> tag_type = stmt->tag()->bounds().lower;
+ Type* tag_type = stmt->tag()->bounds().lower;
// 1. Build all the tests, with dangling true branches
BailoutId default_id = BailoutId::None();
CHECK_ALIVE(VisitForValue(clause->label()));
HValue* label_value = Pop();
- Handle<Type> label_type = clause->label()->bounds().lower;
- Handle<Type> combined_type = clause->compare_type();
+ Type* label_type = clause->label()->bounds().lower;
+ Type* combined_type = clause->compare_type();
HControlInstruction* compare = BuildCompareInstruction(
Token::EQ_STRICT, tag_value, label_value, tag_type, label_type,
combined_type, stmt->tag()->position(), clause->label()->position(),
bool returns_original_input,
CountOperation* expr) {
// The input to the count operation is on top of the expression stack.
- Handle<Type> info = expr->type();
- Representation rep = Representation::FromType(info);
+ Representation rep = Representation::FromType(expr->type());
if (rep.IsNone() || rep.IsTagged()) {
rep = Representation::Smi();
}
HValue* HGraphBuilder::EnforceNumberType(HValue* number,
- Handle<Type> expected) {
+ Type* expected) {
if (expected->Is(Type::Smi())) {
return AddUncasted<HForceRepresentation>(number, Representation::Smi());
}
}
-HValue* HGraphBuilder::TruncateToNumber(HValue* value, Handle<Type>* expected) {
+HValue* HGraphBuilder::TruncateToNumber(HValue* value, Type** expected) {
if (value->IsConstant()) {
HConstant* constant = HConstant::cast(value);
Maybe<HConstant*> number = constant->CopyToTruncatedNumber(zone());
if (number.has_value) {
- *expected = Type::Number(isolate());
+ *expected = Type::Number(zone());
return AddInstruction(number.value);
}
}
// pushes with a NoObservableSideEffectsScope.
NoObservableSideEffectsScope no_effects(this);
- Handle<Type> expected_type = *expected;
+ Type* expected_type = *expected;
// Separate the number type from the rest.
- Handle<Type> expected_obj = Type::Intersect(
- expected_type, Type::NonNumber(isolate()), isolate());
- Handle<Type> expected_number = Type::Intersect(
- expected_type, Type::Number(isolate()), isolate());
+ Type* expected_obj =
+ Type::Intersect(expected_type, Type::NonNumber(zone()), zone());
+ Type* expected_number =
+ Type::Intersect(expected_type, Type::Number(zone()), zone());
// We expect to get a number.
// (We need to check first, since Type::None->Is(Type::Any()) == true.
if (expected_obj->Is(Type::None())) {
- ASSERT(!expected_number->Is(Type::None()));
+ ASSERT(!expected_number->Is(Type::None(zone())));
return value;
}
- if (expected_obj->Is(Type::Undefined())) {
+ if (expected_obj->Is(Type::Undefined(zone()))) {
// This is already done by HChange.
- *expected = Type::Union(
- expected_number, Type::Double(isolate()), isolate());
+ *expected = Type::Union(expected_number, Type::Double(zone()), zone());
return value;
}
BinaryOperation* expr,
HValue* left,
HValue* right) {
- Handle<Type> left_type = expr->left()->bounds().lower;
- Handle<Type> right_type = expr->right()->bounds().lower;
- Handle<Type> result_type = expr->bounds().lower;
+ Type* left_type = expr->left()->bounds().lower;
+ Type* right_type = expr->right()->bounds().lower;
+ Type* result_type = expr->bounds().lower;
Maybe<int> fixed_right_arg = expr->fixed_right_arg();
Handle<AllocationSite> allocation_site = expr->allocation_site();
Token::Value op,
HValue* left,
HValue* right,
- Handle<Type> left_type,
- Handle<Type> right_type,
- Handle<Type> result_type,
+ Type* left_type,
+ Type* right_type,
+ Type* result_type,
Maybe<int> fixed_right_arg,
HAllocationMode allocation_mode) {
Deoptimizer::SOFT);
// TODO(rossberg): we should be able to get rid of non-continuous
// defaults.
- left_type = Type::Any(isolate());
+ left_type = Type::Any(zone());
} else {
if (!maybe_string_add) left = TruncateToNumber(left, &left_type);
left_rep = Representation::FromType(left_type);
if (right_type->Is(Type::None())) {
Add<HDeoptimize>("Insufficient type feedback for RHS of binary operation",
Deoptimizer::SOFT);
- right_type = Type::Any(isolate());
+ right_type = Type::Any(zone());
} else {
if (!maybe_string_add) right = TruncateToNumber(right, &right_type);
right_rep = Representation::FromType(right_type);
return ast_context()->ReturnControl(instr, expr->id());
}
- Handle<Type> left_type = expr->left()->bounds().lower;
- Handle<Type> right_type = expr->right()->bounds().lower;
- Handle<Type> combined_type = expr->combined_type();
+ Type* left_type = expr->left()->bounds().lower;
+ Type* right_type = expr->right()->bounds().lower;
+ Type* combined_type = expr->combined_type();
CHECK_ALIVE(VisitForValue(expr->left()));
CHECK_ALIVE(VisitForValue(expr->right()));
Token::Value op,
HValue* left,
HValue* right,
- Handle<Type> left_type,
- Handle<Type> right_type,
- Handle<Type> combined_type,
+ Type* left_type,
+ Type* right_type,
+ Type* combined_type,
int left_position,
int right_position,
BailoutId bailout_id) {
Add<HDeoptimize>("Insufficient type feedback for combined type "
"of binary operation",
Deoptimizer::SOFT);
- combined_type = left_type = right_type = Type::Any(isolate());
+ combined_type = left_type = right_type = Type::Any(zone());
}
Representation left_rep = Representation::FromType(left_type);
return ast_context()->ReturnControl(instr, expr->id());
} else {
ASSERT_EQ(Token::EQ, expr->op());
- Handle<Type> type = expr->combined_type()->Is(Type::None())
- ? Type::Any(isolate_) : expr->combined_type();
+ Type* type = expr->combined_type()->Is(Type::None())
+ ? Type::Any(zone()) : expr->combined_type();
HIfContinuation continuation;
BuildCompareNil(value, type, &continuation);
return ast_context()->ReturnContinuation(&continuation, expr->id());
ASSERT_EQ(1, call->arguments()->length());
CHECK_ALIVE(VisitForValue(call->arguments()->at(0)));
HValue* number = Pop();
- HValue* result = BuildNumberToString(number, Type::Any(isolate()));
+ HValue* result = BuildNumberToString(number, Type::Any(zone()));
return ast_context()->ReturnValue(result);
}
ElementsKind to_kind,
bool is_jsarray);
- HValue* BuildNumberToString(HValue* object, Handle<Type> type);
+ HValue* BuildNumberToString(HValue* object, Type* type);
HValue* BuildUncheckedDictionaryElementLoad(HValue* receiver,
HValue* key);
HValue* BuildBinaryOperation(Token::Value op,
HValue* left,
HValue* right,
- Handle<Type> left_type,
- Handle<Type> right_type,
- Handle<Type> result_type,
+ Type* left_type,
+ Type* right_type,
+ Type* result_type,
Maybe<int> fixed_right_arg,
HAllocationMode allocation_mode);
HValue* AddLoadJSBuiltin(Builtins::JavaScript builtin);
- HValue* EnforceNumberType(HValue* number, Handle<Type> expected);
- HValue* TruncateToNumber(HValue* value, Handle<Type>* expected);
+ HValue* EnforceNumberType(HValue* number, Type* expected);
+ HValue* TruncateToNumber(HValue* value, Type** expected);
void FinishExitWithHardDeoptimization(const char* reason,
HBasicBlock* continuation);
void BuildCompareNil(
HValue* value,
- Handle<Type> type,
+ Type* type,
HIfContinuation* continuation);
void BuildCreateAllocationMemento(HValue* previous_object,
HControlInstruction* BuildCompareInstruction(Token::Value op,
HValue* left,
HValue* right,
- Handle<Type> left_type,
- Handle<Type> right_type,
- Handle<Type> combined_type,
+ Type* left_type,
+ Type* right_type,
+ Type* combined_type,
int left_position,
int right_position,
BailoutId bailout_id);
#define __ ACCESS_MASM(masm())
-Register StubCompiler::CheckPrototypes(Handle<Type> type,
+Register StubCompiler::CheckPrototypes(Handle<HeapType> type,
Register object_reg,
Handle<JSObject> holder,
Register holder_reg,
Register LoadStubCompiler::CallbackHandlerFrontend(
- Handle<Type> type,
+ Handle<HeapType> type,
Register object_reg,
Handle<JSObject> holder,
Handle<Name> name,
}
-Handle<Code> LoadStubCompiler::CompileLoadNonexistent(Handle<Type> type,
+Handle<Code> LoadStubCompiler::CompileLoadNonexistent(Handle<HeapType> type,
Handle<JSObject> last,
Handle<Name> name) {
NonexistentHandlerFrontend(type, last, name);
Handle<Code> LoadStubCompiler::CompileLoadGlobal(
- Handle<Type> type,
+ Handle<HeapType> type,
Handle<GlobalObject> global,
Handle<PropertyCell> cell,
Handle<Name> name,
int receiver_count = types->length();
int number_of_handled_maps = 0;
for (int current = 0; current < receiver_count; ++current) {
- Handle<Type> type = types->at(current);
+ Handle<HeapType> type = types->at(current);
Handle<Map> map = IC::TypeToMap(*type, isolate());
if (!map->is_deprecated()) {
number_of_handled_maps++;
__ cmp(map_reg, map);
- if (type->Is(Type::Number())) {
+ if (type->Is(HeapType::Number())) {
ASSERT(!number_case.is_unused());
__ bind(&number_case);
}
HeapObject* IC::GetCodeCacheHolder(Isolate* isolate,
- Object* object,
- InlineCacheHolderFlag holder) {
+ Object* object,
+ InlineCacheHolderFlag holder) {
if (object->IsSmi()) holder = PROTOTYPE_MAP;
Object* map_owner = holder == OWN_MAP
? object : object->GetPrototype(isolate);
}
-InlineCacheHolderFlag IC::GetCodeCacheFlag(Type* type) {
- if (type->Is(Type::Boolean()) ||
- type->Is(Type::Number()) ||
- type->Is(Type::String()) ||
- type->Is(Type::Symbol())) {
+InlineCacheHolderFlag IC::GetCodeCacheFlag(HeapType* type) {
+ if (type->Is(HeapType::Boolean()) ||
+ type->Is(HeapType::Number()) ||
+ type->Is(HeapType::String()) ||
+ type->Is(HeapType::Symbol())) {
return PROTOTYPE_MAP;
}
return OWN_MAP;
Handle<Map> IC::GetCodeCacheHolder(InlineCacheHolderFlag flag,
- Type* type,
+ HeapType* type,
Isolate* isolate) {
if (flag == PROTOTYPE_MAP) {
Context* context = isolate->context()->native_context();
JSFunction* constructor;
- if (type->Is(Type::Boolean())) {
+ if (type->Is(HeapType::Boolean())) {
constructor = context->boolean_function();
- } else if (type->Is(Type::Number())) {
+ } else if (type->Is(HeapType::Number())) {
constructor = context->number_function();
- } else if (type->Is(Type::String())) {
+ } else if (type->Is(HeapType::String())) {
constructor = context->string_function();
} else {
- ASSERT(type->Is(Type::Symbol()));
+ ASSERT(type->Is(HeapType::Symbol()));
constructor = context->symbol_function();
}
return handle(JSObject::cast(constructor->instance_prototype())->map());
}
-bool IC::UpdatePolymorphicIC(Handle<Type> type,
+bool IC::UpdatePolymorphicIC(Handle<HeapType> type,
Handle<String> name,
Handle<Code> code) {
if (!code->is_handler()) return false;
number_of_valid_types = number_of_types;
for (int i = 0; i < number_of_types; i++) {
- Handle<Type> current_type = types.at(i);
+ Handle<HeapType> current_type = types.at(i);
// Filter out deprecated maps to ensure their instances get migrated.
if (current_type->IsClass() && current_type->AsClass()->is_deprecated()) {
number_of_valid_types--;
}
-Handle<Type> IC::CurrentTypeOf(Handle<Object> object, Isolate* isolate) {
+Handle<HeapType> IC::CurrentTypeOf(Handle<Object> object, Isolate* isolate) {
return object->IsJSGlobalObject()
- ? Type::Constant(Handle<JSGlobalObject>::cast(object), isolate)
- : Type::OfCurrently(object, isolate);
+ ? HeapType::Constant(Handle<JSGlobalObject>::cast(object), isolate)
+ : HeapType::OfCurrently(object, isolate);
}
-Handle<Map> IC::TypeToMap(Type* type, Isolate* isolate) {
- if (type->Is(Type::Number())) return isolate->factory()->heap_number_map();
- if (type->Is(Type::Boolean())) return isolate->factory()->oddball_map();
+Handle<Map> IC::TypeToMap(HeapType* type, Isolate* isolate) {
+ if (type->Is(HeapType::Number()))
+ return isolate->factory()->heap_number_map();
+ if (type->Is(HeapType::Boolean())) return isolate->factory()->oddball_map();
if (type->IsConstant()) {
return handle(Handle<JSGlobalObject>::cast(type->AsConstant())->map());
}
}
-Handle<Type> IC::MapToType(Handle<Map> map) {
+Handle<HeapType> IC::MapToType(Handle<Map> map) {
Isolate* isolate = map->GetIsolate();
- if (map->instance_type() == HEAP_NUMBER_TYPE) return Type::Number(isolate);
- // The only oddballs that can be recorded in ICs are booleans.
- if (map->instance_type() == ODDBALL_TYPE) return Type::Boolean(isolate);
- return Type::Class(map, isolate);
+ if (map->instance_type() == HEAP_NUMBER_TYPE) {
+ return HeapType::Number(isolate);
+ } else if (map->instance_type() == ODDBALL_TYPE) {
+ // The only oddballs that can be recorded in ICs are booleans.
+ return HeapType::Boolean(isolate);
+ } else {
+ return HeapType::Class(map, isolate);
+ }
}
-void IC::UpdateMonomorphicIC(Handle<Type> type,
+void IC::UpdateMonomorphicIC(Handle<HeapType> type,
Handle<Code> handler,
Handle<String> name) {
if (!handler->is_handler()) return set_target(*handler);
}
-bool IC::IsTransitionOfMonomorphicTarget(Handle<Type> type) {
+bool IC::IsTransitionOfMonomorphicTarget(Handle<HeapType> type) {
if (!type->IsClass()) return false;
Map* receiver_map = *type->AsClass();
Map* current_map = target()->FindFirstMap();
}
-void IC::PatchCache(Handle<Type> type,
+void IC::PatchCache(Handle<HeapType> type,
Handle<String> name,
Handle<Code> code) {
switch (state()) {
return;
}
- Handle<Type> type = CurrentTypeOf(object, isolate());
+ Handle<HeapType> type = CurrentTypeOf(object, isolate());
Handle<Code> code;
if (!lookup->IsCacheable()) {
// Bail out if the result is not cacheable.
}
-void IC::UpdateMegamorphicCache(Type* type, Name* name, Code* code) {
+void IC::UpdateMegamorphicCache(HeapType* type, Name* name, Code* code) {
// Cache code holding map should be consistent with
// GenerateMonomorphicCacheProbe.
Map* map = *TypeToMap(type, isolate());
return SimpleFieldLoad(length_index);
}
- Handle<Type> type = CurrentTypeOf(object, isolate());
+ Handle<HeapType> type = CurrentTypeOf(object, isolate());
Handle<JSObject> holder(lookup->holder());
LoadStubCompiler compiler(isolate(), kNoExtraICState, cache_holder, kind());
// global object.
Handle<GlobalObject> global = Handle<GlobalObject>::cast(receiver);
Handle<PropertyCell> cell(global->GetPropertyCell(lookup), isolate());
- Handle<Type> union_type = PropertyCell::UpdatedType(cell, value);
+ Handle<HeapType> union_type = PropertyCell::UpdatedType(cell, value);
StoreGlobalStub stub(union_type->IsConstant());
Handle<Code> code = stub.GetCodeCopyFromTemplate(
}
-Handle<Type> BinaryOpIC::State::GetResultType(Isolate* isolate) const {
+Type* BinaryOpIC::State::GetResultType(Zone* zone) const {
Kind result_kind = result_kind_;
if (HasSideEffects()) {
result_kind = NONE;
} else if (result_kind == GENERIC && op_ == Token::ADD) {
- return Type::Union(Type::Number(isolate), Type::String(isolate), isolate);
+ return Type::Union(Type::Number(zone), Type::String(zone), zone);
} else if (result_kind == NUMBER && op_ == Token::SHR) {
- return Type::Unsigned32(isolate);
+ return Type::Unsigned32(zone);
}
ASSERT_NE(GENERIC, result_kind);
- return KindToType(result_kind, isolate);
+ return KindToType(result_kind, zone);
}
// static
-Handle<Type> BinaryOpIC::State::KindToType(Kind kind, Isolate* isolate) {
+Type* BinaryOpIC::State::KindToType(Kind kind, Zone* zone) {
switch (kind) {
- case NONE: return Type::None(isolate);
- case SMI: return Type::Smi(isolate);
- case INT32: return Type::Signed32(isolate);
- case NUMBER: return Type::Number(isolate);
- case STRING: return Type::String(isolate);
- case GENERIC: return Type::Any(isolate);
+ case NONE: return Type::None(zone);
+ case SMI: return Type::Smi(zone);
+ case INT32: return Type::Signed32(zone);
+ case NUMBER: return Type::Number(zone);
+ case STRING: return Type::String(zone);
+ case GENERIC: return Type::Any(zone);
}
UNREACHABLE();
- return Handle<Type>();
+ return NULL;
}
}
-Handle<Type> CompareIC::StateToType(
- Isolate* isolate,
+Type* CompareIC::StateToType(
+ Zone* zone,
CompareIC::State state,
Handle<Map> map) {
switch (state) {
- case CompareIC::UNINITIALIZED: return Type::None(isolate);
- case CompareIC::SMI: return Type::Smi(isolate);
- case CompareIC::NUMBER: return Type::Number(isolate);
- case CompareIC::STRING: return Type::String(isolate);
- case CompareIC::INTERNALIZED_STRING:
- return Type::InternalizedString(isolate);
- case CompareIC::UNIQUE_NAME: return Type::UniqueName(isolate);
- case CompareIC::OBJECT: return Type::Receiver(isolate);
+ case CompareIC::UNINITIALIZED: return Type::None(zone);
+ case CompareIC::SMI: return Type::Smi(zone);
+ case CompareIC::NUMBER: return Type::Number(zone);
+ case CompareIC::STRING: return Type::String(zone);
+ case CompareIC::INTERNALIZED_STRING: return Type::InternalizedString(zone);
+ case CompareIC::UNIQUE_NAME: return Type::UniqueName(zone);
+ case CompareIC::OBJECT: return Type::Receiver(zone);
case CompareIC::KNOWN_OBJECT:
- return map.is_null()
- ? Type::Receiver(isolate) : Type::Class(map, isolate);
- case CompareIC::GENERIC: return Type::Any(isolate);
+ return map.is_null() ? Type::Receiver(zone) : Type::Class(map, zone);
+ case CompareIC::GENERIC: return Type::Any(zone);
}
UNREACHABLE();
- return Handle<Type>();
+ return NULL;
}
void CompareIC::StubInfoToType(int stub_minor_key,
- Handle<Type>* left_type,
- Handle<Type>* right_type,
- Handle<Type>* overall_type,
+ Type** left_type,
+ Type** right_type,
+ Type** overall_type,
Handle<Map> map,
- Isolate* isolate) {
+ Zone* zone) {
State left_state, right_state, handler_state;
ICCompareStub::DecodeMinorKey(stub_minor_key, &left_state, &right_state,
&handler_state, NULL);
- *left_type = StateToType(isolate, left_state);
- *right_type = StateToType(isolate, right_state);
- *overall_type = StateToType(isolate, handler_state, map);
+ *left_type = StateToType(zone, left_state);
+ *right_type = StateToType(zone, right_state);
+ *overall_type = StateToType(zone, handler_state, map);
}
Object* object,
InlineCacheHolderFlag holder);
- static inline InlineCacheHolderFlag GetCodeCacheFlag(Type* type);
+ static inline InlineCacheHolderFlag GetCodeCacheFlag(HeapType* type);
static inline Handle<Map> GetCodeCacheHolder(InlineCacheHolderFlag flag,
- Type* type,
+ HeapType* type,
Isolate* isolate);
static bool IsCleared(Code* code) {
// - The heap_number_map is used as a marker which includes heap numbers as
// well as smis.
// - The oddball map is only used for booleans.
- static Handle<Map> TypeToMap(Type* type, Isolate* isolate);
- static Handle<Type> MapToType(Handle<Map> type);
- static Handle<Type> CurrentTypeOf(Handle<Object> object, Isolate* isolate);
+ static Handle<Map> TypeToMap(HeapType* type, Isolate* isolate);
+ static Handle<HeapType> MapToType(Handle<Map> map);
+ static Handle<HeapType> CurrentTypeOf(
+ Handle<Object> object, Isolate* isolate);
protected:
// Get the call-site target; used for determining the state.
return Handle<Code>::null();
}
- void UpdateMonomorphicIC(Handle<Type> type,
+ void UpdateMonomorphicIC(Handle<HeapType> type,
Handle<Code> handler,
Handle<String> name);
- bool UpdatePolymorphicIC(Handle<Type> type,
+ bool UpdatePolymorphicIC(Handle<HeapType> type,
Handle<String> name,
Handle<Code> code);
- virtual void UpdateMegamorphicCache(Type* type, Name* name, Code* code);
+ virtual void UpdateMegamorphicCache(HeapType* type, Name* name, Code* code);
void CopyICToMegamorphicCache(Handle<String> name);
- bool IsTransitionOfMonomorphicTarget(Handle<Type> type);
- void PatchCache(Handle<Type> type,
+ bool IsTransitionOfMonomorphicTarget(Handle<HeapType> type);
+ void PatchCache(Handle<HeapType> type,
Handle<String> name,
Handle<Code> code);
virtual Code::Kind kind() const {
return isolate()->builtins()->KeyedLoadIC_Slow();
}
- virtual void UpdateMegamorphicCache(Type* type, Name* name, Code* code) { }
+ virtual void UpdateMegamorphicCache(HeapType* type, Name* name, Code* code) {}
private:
// Stub accessors.
protected:
virtual Code::Kind kind() const { return Code::KEYED_STORE_IC; }
- virtual void UpdateMegamorphicCache(Type* type, Name* name, Code* code) { }
+ virtual void UpdateMegamorphicCache(HeapType* type, Name* name, Code* code) {}
virtual Handle<Code> pre_monomorphic_stub() {
return pre_monomorphic_stub(isolate(), strict_mode());
OverwriteMode mode() const { return mode_; }
Maybe<int> fixed_right_arg() const { return fixed_right_arg_; }
- Handle<Type> GetLeftType(Isolate* isolate) const {
- return KindToType(left_kind_, isolate);
+ Type* GetLeftType(Zone* zone) const {
+ return KindToType(left_kind_, zone);
}
- Handle<Type> GetRightType(Isolate* isolate) const {
- return KindToType(right_kind_, isolate);
+ Type* GetRightType(Zone* zone) const {
+ return KindToType(right_kind_, zone);
}
- Handle<Type> GetResultType(Isolate* isolate) const;
+ Type* GetResultType(Zone* zone) const;
void Print(StringStream* stream) const;
Kind UpdateKind(Handle<Object> object, Kind kind) const;
static const char* KindToString(Kind kind);
- static Handle<Type> KindToType(Kind kind, Isolate* isolate);
+ static Type* KindToType(Kind kind, Zone* zone);
static bool KindMaybeSmi(Kind kind) {
return (kind >= SMI && kind <= NUMBER) || kind == GENERIC;
}
static State NewInputState(State old_state, Handle<Object> value);
- static Handle<Type> StateToType(Isolate* isolate,
- State state,
- Handle<Map> map = Handle<Map>());
+ static Type* StateToType(Zone* zone,
+ State state,
+ Handle<Map> map = Handle<Map>());
static void StubInfoToType(int stub_minor_key,
- Handle<Type>* left_type,
- Handle<Type>* right_type,
- Handle<Type>* overall_type,
+ Type** left_type,
+ Type** right_type,
+ Type** overall_type,
Handle<Map> map,
- Isolate* isolate);
+ Zone* zone);
CompareIC(Isolate* isolate, Token::Value op)
: IC(EXTRA_CALL_FRAME, isolate), op_(op) { }
class Map;
template<class> class TypeImpl;
struct HeapTypeConfig;
-typedef TypeImpl<HeapTypeConfig> Type;
+typedef TypeImpl<HeapTypeConfig> HeapType;
class Code;
template<typename T> class Handle;
typedef List<Map*> MapList;
typedef List<Code*> CodeList;
typedef List<Handle<Map> > MapHandleList;
-typedef List<Handle<Type> > TypeHandleList;
+typedef List<Handle<HeapType> > TypeHandleList;
typedef List<Handle<Code> > CodeHandleList;
// Perform binary search for an element in an already sorted
}
-Type* PropertyCell::type() {
- return static_cast<Type*>(type_raw());
+HeapType* PropertyCell::type() {
+ return static_cast<HeapType*>(type_raw());
}
-void PropertyCell::set_type(Type* type, WriteBarrierMode ignored) {
+void PropertyCell::set_type(HeapType* type, WriteBarrierMode ignored) {
ASSERT(IsPropertyCell());
set_type_raw(type, ignored);
}
-Handle<Type> PropertyCell::UpdatedType(Handle<PropertyCell> cell,
- Handle<Object> value) {
+Handle<HeapType> PropertyCell::UpdatedType(Handle<PropertyCell> cell,
+ Handle<Object> value) {
Isolate* isolate = cell->GetIsolate();
- Handle<Type> old_type(cell->type(), isolate);
+ Handle<HeapType> old_type(cell->type(), isolate);
// TODO(2803): Do not track ConsString as constant because they cannot be
// embedded into code.
- Handle<Type> new_type = value->IsConsString() || value->IsTheHole()
- ? Type::Any(isolate) : Type::Constant(value, isolate);
+ Handle<HeapType> new_type = value->IsConsString() || value->IsTheHole()
+ ? HeapType::Any(isolate) : HeapType::Constant(value, isolate);
if (new_type->Is(old_type)) {
return old_type;
cell->dependent_code()->DeoptimizeDependentCodeGroup(
isolate, DependentCode::kPropertyCellChangedGroup);
- if (old_type->Is(Type::None()) || old_type->Is(Type::Undefined())) {
+ if (old_type->Is(HeapType::None()) || old_type->Is(HeapType::Undefined())) {
return new_type;
}
- return Type::Any(isolate);
+ return HeapType::Any(isolate);
}
void PropertyCell::SetValueInferType(Handle<PropertyCell> cell,
Handle<Object> value) {
cell->set_value(*value);
- if (!Type::Any()->Is(cell->type())) {
- Handle<Type> new_type = UpdatedType(cell, value);
+ if (!HeapType::Any()->Is(cell->type())) {
+ Handle<HeapType> new_type = UpdatedType(cell, value);
cell->set_type(*new_type);
}
}
class GlobalObject;
class ObjectVisitor;
class StringStream;
-// We cannot just say "class Type;" if it is created from a template... =8-?
+// We cannot just say "class HeapType;" if it is created from a template... =8-?
template<class> class TypeImpl;
struct HeapTypeConfig;
-typedef TypeImpl<HeapTypeConfig> Type;
+typedef TypeImpl<HeapTypeConfig> HeapType;
// A template-ized version of the IsXXX functions.
class PropertyCell: public Cell {
public:
// [type]: type of the global property.
- Type* type();
- void set_type(Type* value, WriteBarrierMode mode = UPDATE_WRITE_BARRIER);
+ HeapType* type();
+ void set_type(HeapType* value, WriteBarrierMode mode = UPDATE_WRITE_BARRIER);
// [dependent_code]: dependent code that depends on the type of the global
// property.
// Computes the new type of the cell's contents for the given value, but
// without actually modifying the 'type' field.
- static Handle<Type> UpdatedType(Handle<PropertyCell> cell,
- Handle<Object> value);
+ static Handle<HeapType> UpdatedType(Handle<PropertyCell> cell,
+ Handle<Object> value);
void AddDependentCompilationInfo(CompilationInfo* info);
};
-Parser::FunctionState::FunctionState(Parser* parser,
- Scope* scope,
- Isolate* isolate)
+Parser::FunctionState::FunctionState(Parser* parser, Scope* scope)
: next_materialized_literal_index_(JSFunction::kLiteralsPrefixSize),
next_handler_index_(0),
expected_property_count_(0),
parser_(parser),
outer_function_state_(parser->current_function_state_),
outer_scope_(parser->top_scope_),
- saved_ast_node_id_(isolate->ast_node_id()),
- factory_(isolate, parser->zone()) {
+ saved_ast_node_id_(parser->zone()->isolate()->ast_node_id()),
+ factory_(parser->zone()) {
parser->top_scope_ = scope;
parser->current_function_state_ = this;
- isolate->set_ast_node_id(BailoutId::FirstUsable().ToInt());
+ parser->zone()->isolate()->set_ast_node_id(BailoutId::FirstUsable().ToInt());
}
ParsingModeScope parsing_mode(this, mode);
// Enters 'scope'.
- FunctionState function_state(this, scope, isolate());
+ FunctionState function_state(this, scope);
top_scope_->SetLanguageMode(info->language_mode());
ZoneList<Statement*>* body = new(zone()) ZoneList<Statement*>(16, zone());
zone());
}
original_scope_ = scope;
- FunctionState function_state(this, scope, isolate());
+ FunctionState function_state(this, scope);
ASSERT(scope->language_mode() != STRICT_MODE || !info()->is_classic_mode());
ASSERT(scope->language_mode() != EXTENDED_MODE ||
info()->is_extended_mode());
Expression* value = ParseAssignmentExpression(true, CHECK_OK);
ObjectLiteral::Property* property =
- new(zone()) ObjectLiteral::Property(key, value, isolate());
+ factory()->NewObjectLiteralProperty(key, value);
// Mark top-level object literals that contain function literals and
// pretenure the literal so it can be added as a constant function
AstProperties ast_properties;
BailoutReason dont_optimize_reason = kNoReason;
// Parse function body.
- { FunctionState function_state(this, scope, isolate());
+ { FunctionState function_state(this, scope);
top_scope_->SetScopeName(function_name);
if (is_generator) {
class FunctionState BASE_EMBEDDED {
public:
- FunctionState(Parser* parser,
- Scope* scope,
- Isolate* isolate);
+ FunctionState(Parser* parser, Scope* scope);
~FunctionState();
int NextMaterializedLiteralIndex() {
#ifdef DEBUG
-PrettyPrinter::PrettyPrinter(Isolate* isolate) {
+PrettyPrinter::PrettyPrinter(Zone* zone) {
output_ = NULL;
size_ = 0;
pos_ = 0;
- InitializeAstVisitor(isolate);
+ InitializeAstVisitor(zone);
}
}
-void PrettyPrinter::PrintOut(Isolate* isolate, AstNode* node) {
- PrettyPrinter printer(isolate);
+void PrettyPrinter::PrintOut(Zone* zone, AstNode* node) {
+ PrettyPrinter printer(zone);
PrintF("%s", printer.Print(node));
}
//-----------------------------------------------------------------------------
-AstPrinter::AstPrinter(Isolate* isolate) : PrettyPrinter(isolate), indent_(0) {
+AstPrinter::AstPrinter(Zone* zone) : PrettyPrinter(zone), indent_(0) {
}
class PrettyPrinter: public AstVisitor {
public:
- explicit PrettyPrinter(Isolate* isolate);
+ explicit PrettyPrinter(Zone* zone);
virtual ~PrettyPrinter();
// The following routines print a node into a string.
void Print(const char* format, ...);
// Print a node to stdout.
- static void PrintOut(Isolate* isolate, AstNode* node);
+ static void PrintOut(Zone* zone, AstNode* node);
// Individual nodes
#define DECLARE_VISIT(type) virtual void Visit##type(type* node);
// Prints the AST structure
class AstPrinter: public PrettyPrinter {
public:
- explicit AstPrinter(Isolate* isolate);
+ explicit AstPrinter(Zone* zone);
virtual ~AstPrinter();
const char* PrintProgram(FunctionLiteral* program);
class Smi;
template<class> class TypeImpl;
-struct HeapTypeConfig;
-typedef TypeImpl<HeapTypeConfig> Type;
+struct ZoneTypeConfig;
+typedef TypeImpl<ZoneTypeConfig> Type;
class TypeInfo;
// Type of properties.
static Representation FromKind(Kind kind) { return Representation(kind); }
- static Representation FromType(Handle<Type> type);
+ static Representation FromType(Type* type);
bool Equals(const Representation& other) const {
return kind_ == other.kind_;
result_assigned_(false),
is_set_(false),
in_try_(false),
- factory_(zone->isolate(), zone) {
- InitializeAstVisitor(zone->isolate());
+ factory_(zone) {
+ InitializeAstVisitor(zone);
}
virtual ~Processor() { }
// Allocate the variables.
{
- AstNodeFactory<AstNullVisitor> ast_node_factory(info->isolate(),
- info->zone());
+ AstNodeFactory<AstNullVisitor> ast_node_factory(info->zone());
if (!top->AllocateVariables(info, &ast_node_factory)) return false;
}
Handle<Code> StubCache::ComputeMonomorphicIC(
Handle<Name> name,
- Handle<Type> type,
+ Handle<HeapType> type,
Handle<Code> handler,
ExtraICState extra_ic_state) {
Code::Kind kind = handler->handler_kind();
// There are multiple string maps that all use the same prototype. That
// prototype cannot hold multiple handlers, one for each of the string maps,
// for a single name. Hence, turn off caching of the IC.
- bool can_be_cached = !type->Is(Type::String());
+ bool can_be_cached = !type->Is(HeapType::String());
if (can_be_cached) {
stub_holder = IC::GetCodeCacheHolder(flag, *type, isolate());
ic = FindIC(name, stub_holder, kind, extra_ic_state, flag);
Handle<Code> StubCache::ComputeLoadNonexistent(Handle<Name> name,
- Handle<Type> type) {
+ Handle<HeapType> type) {
InlineCacheHolderFlag flag = IC::GetCodeCacheFlag(*type);
Handle<Map> stub_holder = IC::GetCodeCacheHolder(flag, *type, isolate());
// If no dictionary mode objects are present in the prototype chain, the load
TypeHandleList types(receiver_maps->length());
for (int i = 0; i < receiver_maps->length(); i++) {
- types.Add(Type::Class(receiver_maps->at(i), isolate()));
+ types.Add(HeapType::Class(receiver_maps->at(i), isolate()));
}
CodeHandleList handlers(receiver_maps->length());
KeyedLoadStubCompiler compiler(isolate_);
Register LoadStubCompiler::HandlerFrontendHeader(
- Handle<Type> type,
+ Handle<HeapType> type,
Register object_reg,
Handle<JSObject> holder,
Handle<Name> name,
Label* miss) {
PrototypeCheckType check_type = CHECK_ALL_MAPS;
int function_index = -1;
- if (type->Is(Type::String())) {
+ if (type->Is(HeapType::String())) {
function_index = Context::STRING_FUNCTION_INDEX;
- } else if (type->Is(Type::Symbol())) {
+ } else if (type->Is(HeapType::Symbol())) {
function_index = Context::SYMBOL_FUNCTION_INDEX;
- } else if (type->Is(Type::Number())) {
+ } else if (type->Is(HeapType::Number())) {
function_index = Context::NUMBER_FUNCTION_INDEX;
- } else if (type->Is(Type::Boolean())) {
+ } else if (type->Is(HeapType::Boolean())) {
// Booleans use the generic oddball map, so an additional check is needed to
// ensure the receiver is really a boolean.
GenerateBooleanCheck(object_reg, miss);
// HandlerFrontend for store uses the name register. It has to be restored
// before a miss.
Register StoreStubCompiler::HandlerFrontendHeader(
- Handle<Type> type,
+ Handle<HeapType> type,
Register object_reg,
Handle<JSObject> holder,
Handle<Name> name,
bool BaseLoadStoreStubCompiler::IncludesNumberType(TypeHandleList* types) {
for (int i = 0; i < types->length(); ++i) {
- if (types->at(i)->Is(Type::Number())) return true;
+ if (types->at(i)->Is(HeapType::Number())) return true;
}
return false;
}
-Register BaseLoadStoreStubCompiler::HandlerFrontend(Handle<Type> type,
+Register BaseLoadStoreStubCompiler::HandlerFrontend(Handle<HeapType> type,
Register object_reg,
Handle<JSObject> holder,
Handle<Name> name) {
}
-void LoadStubCompiler::NonexistentHandlerFrontend(Handle<Type> type,
+void LoadStubCompiler::NonexistentHandlerFrontend(Handle<HeapType> type,
Handle<JSObject> last,
Handle<Name> name) {
Label miss;
Handle<Code> LoadStubCompiler::CompileLoadField(
- Handle<Type> type,
+ Handle<HeapType> type,
Handle<JSObject> holder,
Handle<Name> name,
PropertyIndex field,
Handle<Code> LoadStubCompiler::CompileLoadConstant(
- Handle<Type> type,
+ Handle<HeapType> type,
Handle<JSObject> holder,
Handle<Name> name,
Handle<Object> value) {
Handle<Code> LoadStubCompiler::CompileLoadCallback(
- Handle<Type> type,
+ Handle<HeapType> type,
Handle<JSObject> holder,
Handle<Name> name,
Handle<ExecutableAccessorInfo> callback) {
Handle<Code> LoadStubCompiler::CompileLoadCallback(
- Handle<Type> type,
+ Handle<HeapType> type,
Handle<JSObject> holder,
Handle<Name> name,
const CallOptimization& call_optimization) {
Handle<Code> LoadStubCompiler::CompileLoadInterceptor(
- Handle<Type> type,
+ Handle<HeapType> type,
Handle<JSObject> holder,
Handle<Name> name) {
LookupResult lookup(isolate());
Handle<Code> BaseLoadStoreStubCompiler::CompileMonomorphicIC(
- Handle<Type> type,
+ Handle<HeapType> type,
Handle<Code> handler,
Handle<Name> name) {
TypeHandleList types(1);
Handle<Code> LoadStubCompiler::CompileLoadViaGetter(
- Handle<Type> type,
+ Handle<HeapType> type,
Handle<JSObject> holder,
Handle<Name> name,
Handle<JSFunction> getter) {
InlineCacheHolderFlag cache_holder = OWN_MAP);
Handle<Code> ComputeMonomorphicIC(Handle<Name> name,
- Handle<Type> type,
+ Handle<HeapType> type,
Handle<Code> handler,
ExtraICState extra_ic_state);
- Handle<Code> ComputeLoadNonexistent(Handle<Name> name, Handle<Type> type);
+ Handle<Code> ComputeLoadNonexistent(Handle<Name> name, Handle<HeapType> type);
Handle<Code> ComputeKeyedLoadElement(Handle<Map> receiver_map);
// The function can optionally (when save_at_depth !=
// kInvalidProtoDepth) save the object at the given depth by moving
// it to [esp + kPointerSize].
- Register CheckPrototypes(Handle<Type> type,
+ Register CheckPrototypes(Handle<HeapType> type,
Register object_reg,
Handle<JSObject> holder,
Register holder_reg,
}
virtual ~BaseLoadStoreStubCompiler() { }
- Handle<Code> CompileMonomorphicIC(Handle<Type> type,
+ Handle<Code> CompileMonomorphicIC(Handle<HeapType> type,
Handle<Code> handler,
Handle<Name> name);
}
protected:
- virtual Register HandlerFrontendHeader(Handle<Type> type,
+ virtual Register HandlerFrontendHeader(Handle<HeapType> type,
Register object_reg,
Handle<JSObject> holder,
Handle<Name> name,
virtual void HandlerFrontendFooter(Handle<Name> name, Label* miss) = 0;
- Register HandlerFrontend(Handle<Type> type,
+ Register HandlerFrontend(Handle<HeapType> type,
Register object_reg,
Handle<JSObject> holder,
Handle<Name> name);
cache_holder) { }
virtual ~LoadStubCompiler() { }
- Handle<Code> CompileLoadField(Handle<Type> type,
+ Handle<Code> CompileLoadField(Handle<HeapType> type,
Handle<JSObject> holder,
Handle<Name> name,
PropertyIndex index,
Representation representation);
- Handle<Code> CompileLoadCallback(Handle<Type> type,
+ Handle<Code> CompileLoadCallback(Handle<HeapType> type,
Handle<JSObject> holder,
Handle<Name> name,
Handle<ExecutableAccessorInfo> callback);
- Handle<Code> CompileLoadCallback(Handle<Type> type,
+ Handle<Code> CompileLoadCallback(Handle<HeapType> type,
Handle<JSObject> holder,
Handle<Name> name,
const CallOptimization& call_optimization);
- Handle<Code> CompileLoadConstant(Handle<Type> type,
+ Handle<Code> CompileLoadConstant(Handle<HeapType> type,
Handle<JSObject> holder,
Handle<Name> name,
Handle<Object> value);
- Handle<Code> CompileLoadInterceptor(Handle<Type> type,
+ Handle<Code> CompileLoadInterceptor(Handle<HeapType> type,
Handle<JSObject> holder,
Handle<Name> name);
- Handle<Code> CompileLoadViaGetter(Handle<Type> type,
+ Handle<Code> CompileLoadViaGetter(Handle<HeapType> type,
Handle<JSObject> holder,
Handle<Name> name,
Handle<JSFunction> getter);
Register receiver,
Handle<JSFunction> getter);
- Handle<Code> CompileLoadNonexistent(Handle<Type> type,
+ Handle<Code> CompileLoadNonexistent(Handle<HeapType> type,
Handle<JSObject> last,
Handle<Name> name);
- Handle<Code> CompileLoadGlobal(Handle<Type> type,
+ Handle<Code> CompileLoadGlobal(Handle<HeapType> type,
Handle<GlobalObject> holder,
Handle<PropertyCell> cell,
Handle<Name> name,
return LoadIC::GetContextualMode(extra_state());
}
- virtual Register HandlerFrontendHeader(Handle<Type> type,
+ virtual Register HandlerFrontendHeader(Handle<HeapType> type,
Register object_reg,
Handle<JSObject> holder,
Handle<Name> name,
virtual void HandlerFrontendFooter(Handle<Name> name, Label* miss);
- Register CallbackHandlerFrontend(Handle<Type> type,
+ Register CallbackHandlerFrontend(Handle<HeapType> type,
Register object_reg,
Handle<JSObject> holder,
Handle<Name> name,
Handle<Object> callback);
- void NonexistentHandlerFrontend(Handle<Type> type,
+ void NonexistentHandlerFrontend(Handle<HeapType> type,
Handle<JSObject> last,
Handle<Name> name);
}
protected:
- virtual Register HandlerFrontendHeader(Handle<Type> type,
+ virtual Register HandlerFrontendHeader(Handle<HeapType> type,
Register object_reg,
Handle<JSObject> holder,
Handle<Name> name,
TypeFeedbackOracle::TypeFeedbackOracle(Handle<Code> code,
Handle<Context> native_context,
- Isolate* isolate,
Zone* zone)
: native_context_(native_context),
- isolate_(isolate),
zone_(zone) {
BuildDictionary(code);
ASSERT(dictionary_->IsDictionary());
Object* value = dictionary_->ValueAt(entry);
if (value->IsCell()) {
Cell* cell = Cell::cast(value);
- return Handle<Object>(cell->value(), isolate_);
+ return Handle<Object>(cell->value(), isolate());
} else {
- return Handle<Object>(value, isolate_);
+ return Handle<Object>(value, isolate());
}
}
- return Handle<Object>::cast(isolate_->factory()->undefined_value());
+ return Handle<Object>::cast(isolate()->factory()->undefined_value());
}
Handle<JSFunction> TypeFeedbackOracle::GetCallTarget(TypeFeedbackId id) {
Handle<Object> info = GetInfo(id);
if (info->IsAllocationSite()) {
- return Handle<JSFunction>(isolate_->global_context()->array_function());
+ return Handle<JSFunction>(isolate()->global_context()->array_function());
} else {
return Handle<JSFunction>::cast(info);
}
Handle<JSFunction> TypeFeedbackOracle::GetCallNewTarget(TypeFeedbackId id) {
Handle<Object> info = GetInfo(id);
if (info->IsAllocationSite()) {
- return Handle<JSFunction>(isolate_->global_context()->array_function());
+ return Handle<JSFunction>(isolate()->global_context()->array_function());
} else {
return Handle<JSFunction>::cast(info);
}
bool TypeFeedbackOracle::LoadIsBuiltin(
TypeFeedbackId id, Builtins::Name builtin) {
- return *GetInfo(id) == isolate_->builtins()->builtin(builtin);
+ return *GetInfo(id) == isolate()->builtins()->builtin(builtin);
}
void TypeFeedbackOracle::CompareType(TypeFeedbackId id,
- Handle<Type>* left_type,
- Handle<Type>* right_type,
- Handle<Type>* combined_type) {
+ Type** left_type,
+ Type** right_type,
+ Type** combined_type) {
Handle<Object> info = GetInfo(id);
if (!info->IsCode()) {
// For some comparisons we don't have ICs, e.g. LiteralCompareTypeof.
- *left_type = *right_type = *combined_type = Type::None(isolate_);
+ *left_type = *right_type = *combined_type = Type::None(zone());
return;
}
Handle<Code> code = Handle<Code>::cast(info);
if (code->is_compare_ic_stub()) {
int stub_minor_key = code->stub_info();
CompareIC::StubInfoToType(
- stub_minor_key, left_type, right_type, combined_type, map, isolate());
+ stub_minor_key, left_type, right_type, combined_type, map, zone());
} else if (code->is_compare_nil_ic_stub()) {
CompareNilICStub stub(code->extended_extra_ic_state());
- *combined_type = stub.GetType(isolate_, map);
- *left_type = *right_type = stub.GetInputType(isolate_, map);
+ *combined_type = stub.GetType(zone(), map);
+ *left_type = *right_type = stub.GetInputType(zone(), map);
}
}
void TypeFeedbackOracle::BinaryType(TypeFeedbackId id,
- Handle<Type>* left,
- Handle<Type>* right,
- Handle<Type>* result,
+ Type** left,
+ Type** right,
+ Type** result,
Maybe<int>* fixed_right_arg,
Handle<AllocationSite>* allocation_site,
Token::Value op) {
// operations covered by the BinaryOpIC we should always have them.
ASSERT(op < BinaryOpIC::State::FIRST_TOKEN ||
op > BinaryOpIC::State::LAST_TOKEN);
- *left = *right = *result = Type::None(isolate_);
+ *left = *right = *result = Type::None(zone());
*fixed_right_arg = Maybe<int>();
*allocation_site = Handle<AllocationSite>::null();
return;
BinaryOpIC::State state(code->extended_extra_ic_state());
ASSERT_EQ(op, state.op());
- *left = state.GetLeftType(isolate());
- *right = state.GetRightType(isolate());
- *result = state.GetResultType(isolate());
+ *left = state.GetLeftType(zone());
+ *right = state.GetRightType(zone());
+ *result = state.GetResultType(zone());
*fixed_right_arg = state.fixed_right_arg();
AllocationSite* first_allocation_site = code->FindFirstAllocationSite();
}
-Handle<Type> TypeFeedbackOracle::CountType(TypeFeedbackId id) {
+Type* TypeFeedbackOracle::CountType(TypeFeedbackId id) {
Handle<Object> object = GetInfo(id);
- if (!object->IsCode()) return Type::None(isolate_);
+ if (!object->IsCode()) return Type::None(zone());
Handle<Code> code = Handle<Code>::cast(object);
ASSERT_EQ(Code::BINARY_OP_IC, code->kind());
BinaryOpIC::State state(code->extended_extra_ic_state());
- return state.GetLeftType(isolate());
+ return state.GetLeftType(zone());
}
if (FLAG_collect_megamorphic_maps_from_stub_cache &&
code->ic_state() == MEGAMORPHIC) {
types->Reserve(4, zone());
- isolate_->stub_cache()->CollectMatchingMaps(
+ isolate()->stub_cache()->CollectMatchingMaps(
types, name, flags, native_context_, zone());
} else {
CollectReceiverTypes(ast_id, types);
void TypeFeedbackOracle::BuildDictionary(Handle<Code> code) {
DisallowHeapAllocation no_allocation;
ZoneList<RelocInfo> infos(16, zone());
- HandleScope scope(isolate_);
+ HandleScope scope(isolate());
GetRelocInfos(code, &infos);
CreateDictionary(code, &infos);
ProcessRelocInfos(&infos);
public:
TypeFeedbackOracle(Handle<Code> code,
Handle<Context> native_context,
- Isolate* isolate,
Zone* zone);
bool LoadIsUninitialized(TypeFeedbackId id);
// Get type information for arithmetic operations and compares.
void BinaryType(TypeFeedbackId id,
- Handle<Type>* left,
- Handle<Type>* right,
- Handle<Type>* result,
+ Type** left,
+ Type** right,
+ Type** result,
Maybe<int>* fixed_right_arg,
Handle<AllocationSite>* allocation_site,
Token::Value operation);
void CompareType(TypeFeedbackId id,
- Handle<Type>* left,
- Handle<Type>* right,
- Handle<Type>* combined);
+ Type** left,
+ Type** right,
+ Type** combined);
- Handle<Type> CountType(TypeFeedbackId id);
+ Type* CountType(TypeFeedbackId id);
Zone* zone() const { return zone_; }
- Isolate* isolate() const { return isolate_; }
+ Isolate* isolate() const { return zone_->isolate(); }
private:
void CollectReceiverTypes(TypeFeedbackId id,
private:
Handle<Context> native_context_;
- Isolate* isolate_;
Zone* zone_;
Handle<UnseededNumberDictionary> dictionary_;
// TODO(rossberg): this does not belong here.
-Representation Representation::FromType(Handle<Type> type) {
+Representation Representation::FromType(Type* type) {
if (type->Is(Type::None())) return Representation::None();
if (type->Is(Type::Smi())) return Representation::Smi();
if (type->Is(Type::Signed32())) return Representation::Integer32();
}
};
-typedef TypeImpl<ZoneTypeConfig> ZoneType;
-typedef TypeImpl<HeapTypeConfig> Type;
+typedef TypeImpl<ZoneTypeConfig> Type;
+typedef TypeImpl<HeapTypeConfig> HeapType;
// A simple struct to represent a pair of lower/upper type bounds.
}
};
-typedef BoundsImpl<ZoneTypeConfig> ZoneBounds;
-typedef BoundsImpl<HeapTypeConfig> Bounds;
+typedef BoundsImpl<ZoneTypeConfig> Bounds;
} } // namespace v8::internal
oracle_(
Handle<Code>(info->closure()->shared()->code()),
Handle<Context>(info->closure()->context()->native_context()),
- info->isolate(),
info->zone()),
store_(info->zone()) {
- InitializeAstVisitor(info->isolate());
+ InitializeAstVisitor(info->zone());
}
#ifdef OBJECT_PRINT
- static void PrintObserved(Variable* var, Object* value, Handle<Type> type) {
+ static void PrintObserved(Variable* var, Object* value, Type* type) {
PrintF(" observed %s ", var->IsParameter() ? "param" : "local");
var->name()->Print();
PrintF(" : ");
Effect AstTyper::ObservedOnStack(Object* value) {
- Handle<Type> lower = Type::OfCurrently(handle(value, isolate()), isolate());
- return Effect(Bounds(lower, Type::Any(isolate())));
+ Type* lower = Type::OfCurrently(handle(value, isolate()), zone());
+ return Effect(Bounds(lower, Type::Any(zone())));
}
if (!clause->is_default()) {
Expression* label = clause->label();
// Collect type feedback.
- Handle<Type> tag_type, label_type, combined_type;
+ Type* tag_type;
+ Type* label_type;
+ Type* combined_type;
oracle()->CompareType(clause->CompareId(),
&tag_type, &label_type, &combined_type);
NarrowLowerType(stmt->tag(), tag_type);
NarrowType(expr, Bounds::Either(
expr->then_expression()->bounds(),
- expr->else_expression()->bounds(), isolate_));
+ expr->else_expression()->bounds(), zone()));
}
void AstTyper::VisitLiteral(Literal* expr) {
- Handle<Type> type = Type::Constant(expr->value(), isolate_);
+ Type* type = Type::Constant(expr->value(), zone());
NarrowType(expr, Bounds(type));
}
void AstTyper::VisitRegExpLiteral(RegExpLiteral* expr) {
- NarrowType(expr, Bounds(Type::RegExp(isolate_)));
+ NarrowType(expr, Bounds(Type::RegExp(zone())));
}
RECURSE(Visit(prop->value()));
}
- NarrowType(expr, Bounds(Type::Object(isolate_)));
+ NarrowType(expr, Bounds(Type::Object(zone())));
}
RECURSE(Visit(value));
}
- NarrowType(expr, Bounds(Type::Array(isolate_)));
+ NarrowType(expr, Bounds(Type::Array(zone())));
}
RECURSE(Visit(expr->exception()));
// TODO(rossberg): is it worth having a non-termination effect?
- NarrowType(expr, Bounds(Type::None(isolate_)));
+ NarrowType(expr, Bounds(Type::None(zone())));
}
switch (expr->op()) {
case Token::NOT:
case Token::DELETE:
- NarrowType(expr, Bounds(Type::Boolean(isolate_)));
+ NarrowType(expr, Bounds(Type::Boolean(zone())));
break;
case Token::VOID:
- NarrowType(expr, Bounds(Type::Undefined(isolate_)));
+ NarrowType(expr, Bounds(Type::Undefined(zone())));
break;
case Token::TYPEOF:
- NarrowType(expr, Bounds(Type::InternalizedString(isolate_)));
+ NarrowType(expr, Bounds(Type::InternalizedString(zone())));
break;
default:
UNREACHABLE();
RECURSE(Visit(expr->expression()));
- NarrowType(expr, Bounds(Type::Smi(isolate_), Type::Number(isolate_)));
+ NarrowType(expr, Bounds(Type::Smi(zone()), Type::Number(zone())));
VariableProxy* proxy = expr->expression()->AsVariableProxy();
if (proxy != NULL && proxy->var()->IsStackAllocated()) {
void AstTyper::VisitBinaryOperation(BinaryOperation* expr) {
// Collect type feedback.
- Handle<Type> type, left_type, right_type;
+ Type* type;
+ Type* left_type;
+ Type* right_type;
Maybe<int> fixed_right_arg;
Handle<AllocationSite> allocation_site;
oracle()->BinaryType(expr->BinaryOperationFeedbackId(),
store_.Seq(left_effects);
NarrowType(expr, Bounds::Either(
- expr->left()->bounds(), expr->right()->bounds(), isolate_));
+ expr->left()->bounds(), expr->right()->bounds(), zone()));
break;
}
case Token::BIT_OR:
case Token::BIT_AND: {
RECURSE(Visit(expr->left()));
RECURSE(Visit(expr->right()));
- Handle<Type> upper = Type::Union(
- expr->left()->bounds().upper, expr->right()->bounds().upper,
- isolate_);
- if (!upper->Is(Type::Signed32()))
- upper = Type::Signed32(isolate_);
- Handle<Type> lower =
- Type::Intersect(Type::Smi(isolate_), upper, isolate_);
+ Type* upper = Type::Union(
+ expr->left()->bounds().upper, expr->right()->bounds().upper, zone());
+ if (!upper->Is(Type::Signed32())) upper = Type::Signed32(zone());
+ Type* lower = Type::Intersect(Type::Smi(zone()), upper, zone());
NarrowType(expr, Bounds(lower, upper));
break;
}
case Token::SAR:
RECURSE(Visit(expr->left()));
RECURSE(Visit(expr->right()));
- NarrowType(expr, Bounds(Type::Smi(isolate_), Type::Signed32(isolate_)));
+ NarrowType(expr, Bounds(Type::Smi(zone()), Type::Signed32(zone())));
break;
case Token::SHR:
RECURSE(Visit(expr->left()));
// TODO(rossberg): The upper bound would be Unsigned32, but since there
// is no 'positive Smi' type for the lower bound, we use the smallest
// union of Smi and Unsigned32 as upper bound instead.
- NarrowType(expr, Bounds(Type::Smi(isolate_), Type::Number(isolate_)));
+ NarrowType(expr, Bounds(Type::Smi(zone()), Type::Number(zone())));
break;
case Token::ADD: {
RECURSE(Visit(expr->left()));
RECURSE(Visit(expr->right()));
Bounds l = expr->left()->bounds();
Bounds r = expr->right()->bounds();
- Handle<Type> lower =
+ Type* lower =
l.lower->Is(Type::None()) || r.lower->Is(Type::None()) ?
- Type::None(isolate_) :
+ Type::None(zone()) :
l.lower->Is(Type::String()) || r.lower->Is(Type::String()) ?
- Type::String(isolate_) :
+ Type::String(zone()) :
l.lower->Is(Type::Number()) && r.lower->Is(Type::Number()) ?
- Type::Smi(isolate_) : Type::None(isolate_);
- Handle<Type> upper =
+ Type::Smi(zone()) : Type::None(zone());
+ Type* upper =
l.upper->Is(Type::String()) || r.upper->Is(Type::String()) ?
- Type::String(isolate_) :
+ Type::String(zone()) :
l.upper->Is(Type::Number()) && r.upper->Is(Type::Number()) ?
- Type::Number(isolate_) : Type::NumberOrString(isolate_);
+ Type::Number(zone()) : Type::NumberOrString(zone());
NarrowType(expr, Bounds(lower, upper));
break;
}
case Token::MOD:
RECURSE(Visit(expr->left()));
RECURSE(Visit(expr->right()));
- NarrowType(expr, Bounds(Type::Smi(isolate_), Type::Number(isolate_)));
+ NarrowType(expr, Bounds(Type::Smi(zone()), Type::Number(zone())));
break;
default:
UNREACHABLE();
void AstTyper::VisitCompareOperation(CompareOperation* expr) {
// Collect type feedback.
- Handle<Type> left_type, right_type, combined_type;
+ Type* left_type;
+ Type* right_type;
+ Type* combined_type;
oracle()->CompareType(expr->CompareOperationFeedbackId(),
&left_type, &right_type, &combined_type);
NarrowLowerType(expr->left(), left_type);
RECURSE(Visit(expr->left()));
RECURSE(Visit(expr->right()));
- NarrowType(expr, Bounds(Type::Boolean(isolate_)));
+ NarrowType(expr, Bounds(Type::Boolean(zone())));
}
Store store_;
TypeFeedbackOracle* oracle() { return &oracle_; }
- Zone* zone() const { return info_->zone(); }
void NarrowType(Expression* e, Bounds b) {
- e->set_bounds(Bounds::Both(e->bounds(), b, isolate_));
+ e->set_bounds(Bounds::Both(e->bounds(), b, zone()));
}
- void NarrowLowerType(Expression* e, Handle<Type> t) {
- e->set_bounds(Bounds::NarrowLower(e->bounds(), t, isolate_));
+ void NarrowLowerType(Expression* e, Type* t) {
+ e->set_bounds(Bounds::NarrowLower(e->bounds(), t, zone()));
}
Effects EnterEffects() {
class CodeGenerator: public AstVisitor {
public:
- explicit CodeGenerator(Isolate* isolate) {
- InitializeAstVisitor(isolate);
+ explicit CodeGenerator(Zone* zone) {
+ InitializeAstVisitor(zone);
}
static bool MakeCode(CompilationInfo* info);
#define __ ACCESS_MASM((masm()))
-Register StubCompiler::CheckPrototypes(Handle<Type> type,
+Register StubCompiler::CheckPrototypes(Handle<HeapType> type,
Register object_reg,
Handle<JSObject> holder,
Register holder_reg,
Register LoadStubCompiler::CallbackHandlerFrontend(
- Handle<Type> type,
+ Handle<HeapType> type,
Register object_reg,
Handle<JSObject> holder,
Handle<Name> name,
}
-Handle<Code> LoadStubCompiler::CompileLoadNonexistent(Handle<Type> type,
+Handle<Code> LoadStubCompiler::CompileLoadNonexistent(Handle<HeapType> type,
Handle<JSObject> last,
Handle<Name> name) {
NonexistentHandlerFrontend(type, last, name);
Handle<Code> LoadStubCompiler::CompileLoadGlobal(
- Handle<Type> type,
+ Handle<HeapType> type,
Handle<GlobalObject> global,
Handle<PropertyCell> cell,
Handle<Name> name,
int receiver_count = types->length();
int number_of_handled_maps = 0;
for (int current = 0; current < receiver_count; ++current) {
- Handle<Type> type = types->at(current);
+ Handle<HeapType> type = types->at(current);
Handle<Map> map = IC::TypeToMap(*type, isolate());
if (!map->is_deprecated()) {
number_of_handled_maps++;
// Check map and tail call if there's a match
__ Cmp(map_reg, map);
- if (type->Is(Type::Number())) {
+ if (type->Is(HeapType::Number())) {
ASSERT(!number_case.is_unused());
__ bind(&number_case);
}
Isolate* isolate = CcTest::i_isolate();
Zone zone(isolate);
- AstNodeFactory<AstNullVisitor> factory(isolate, &zone);
+ AstNodeFactory<AstNullVisitor> factory(&zone);
AstNode* node = factory.NewEmptyStatement(RelocInfo::kNoPosition);
list->Add(node);
CHECK_EQ(1, list->length());
// Testing auxiliaries (breaking the Type abstraction).
struct ZoneRep {
- static bool IsTagged(ZoneType* t, int tag) {
+ static bool IsTagged(Type* t, int tag) {
return !IsBitset(t)
&& reinterpret_cast<intptr_t>(AsTagged(t)->at(0)) == tag;
}
- static bool IsBitset(ZoneType* t) {
- return reinterpret_cast<intptr_t>(t) & 1;
- }
- static bool IsClass(ZoneType* t) { return IsTagged(t, 0); }
- static bool IsConstant(ZoneType* t) { return IsTagged(t, 1); }
- static bool IsUnion(ZoneType* t) { return IsTagged(t, 2); }
+ static bool IsBitset(Type* t) { return reinterpret_cast<intptr_t>(t) & 1; }
+ static bool IsClass(Type* t) { return IsTagged(t, 0); }
+ static bool IsConstant(Type* t) { return IsTagged(t, 1); }
+ static bool IsUnion(Type* t) { return IsTagged(t, 2); }
- static ZoneList<void*>* AsTagged(ZoneType* t) {
+ static ZoneList<void*>* AsTagged(Type* t) {
return reinterpret_cast<ZoneList<void*>*>(t);
}
- static int AsBitset(ZoneType* t) {
+ static int AsBitset(Type* t) {
return static_cast<int>(reinterpret_cast<intptr_t>(t) >> 1);
}
- static Map* AsClass(ZoneType* t) {
+ static Map* AsClass(Type* t) {
return *reinterpret_cast<Map**>(AsTagged(t)->at(1));
}
- static Object* AsConstant(ZoneType* t) {
+ static Object* AsConstant(Type* t) {
return *reinterpret_cast<Object**>(AsTagged(t)->at(1));
}
- static ZoneList<ZoneType*>* AsUnion(ZoneType* t) {
- return reinterpret_cast<ZoneList<ZoneType*>*>(AsTagged(t));
+ static ZoneList<Type*>* AsUnion(Type* t) {
+ return reinterpret_cast<ZoneList<Type*>*>(AsTagged(t));
}
static Zone* ToRegion(Zone* zone, Isolate* isolate) { return zone; }
struct HeapRep {
- static bool IsBitset(Handle<Type> t) { return t->IsSmi(); }
- static bool IsClass(Handle<Type> t) { return t->IsMap(); }
- static bool IsConstant(Handle<Type> t) { return t->IsBox(); }
- static bool IsUnion(Handle<Type> t) { return t->IsFixedArray(); }
-
- static int AsBitset(Handle<Type> t) { return Smi::cast(*t)->value(); }
- static Map* AsClass(Handle<Type> t) { return Map::cast(*t); }
- static Object* AsConstant(Handle<Type> t) { return Box::cast(*t)->value(); }
- static FixedArray* AsUnion(Handle<Type> t) { return FixedArray::cast(*t); }
+ static bool IsBitset(Handle<HeapType> t) { return t->IsSmi(); }
+ static bool IsClass(Handle<HeapType> t) { return t->IsMap(); }
+ static bool IsConstant(Handle<HeapType> t) { return t->IsBox(); }
+ static bool IsUnion(Handle<HeapType> t) { return t->IsFixedArray(); }
+
+ static int AsBitset(Handle<HeapType> t) { return Smi::cast(*t)->value(); }
+ static Map* AsClass(Handle<HeapType> t) { return Map::cast(*t); }
+ static Object* AsConstant(Handle<HeapType> t) {
+ return Box::cast(*t)->value();
+ }
+ static FixedArray* AsUnion(Handle<HeapType> t) {
+ return FixedArray::cast(*t);
+ }
static Isolate* ToRegion(Zone* zone, Isolate* isolate) { return isolate; }
};
}
};
-typedef Tests<ZoneType, ZoneType*, Zone, ZoneRep> ZoneTests;
-typedef Tests<Type, Handle<Type>, Isolate, HeapRep> HeapTests;
+typedef Tests<Type, Type*, Zone, ZoneRep> ZoneTests;
+typedef Tests<HeapType, Handle<HeapType>, Isolate, HeapRep> HeapTests;
TEST(Bitset) {