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

Unified Diff: src/ast.h

Issue 185653004: Experimental parser: merge to r19637 (Closed) Base URL: https://v8.googlecode.com/svn/branches/experimental/parser
Patch Set: Created 6 years, 10 months ago
Use n/p to move between diff chunks; N/P to move between comments. Draft comments are only viewable by you.
Jump to:
View side-by-side diff with in-line comments
Download patch
« no previous file with comments | « src/assembler.cc ('k') | src/ast.cc » ('j') | no next file with comments »
Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
Index: src/ast.h
diff --git a/src/ast.h b/src/ast.h
index f172c594f45f80278c27768024e7ff0264e2703e..aacc5e4fc8189d876c6331d895df252bdcbbeb90 100644
--- a/src/ast.h
+++ b/src/ast.h
@@ -32,6 +32,7 @@
#include "assembler.h"
#include "factory.h"
+#include "feedback-slots.h"
#include "isolate.h"
#include "jsregexp.h"
#include "list-inl.h"
@@ -181,7 +182,7 @@ class AstProperties V8_FINAL BASE_EMBEDDED {
public:
class Flags : public EnumSet<AstPropertiesFlag, int> {};
- AstProperties() : node_count_(0) { }
+ AstProperties() : node_count_(0) {}
Flags* flags() { return &flags_; }
int node_count() { return node_count_; }
@@ -226,13 +227,13 @@ class AstNode: public ZoneObject {
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;
}
@@ -255,7 +256,7 @@ class AstNode: public ZoneObject {
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; }
@@ -377,11 +378,11 @@ class Expression : public AstNode {
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:
@@ -422,13 +423,13 @@ class BreakableStatement : public Statement {
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);
}
@@ -462,13 +463,12 @@ class Block V8_FINAL : public BreakableStatement {
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) {
@@ -490,7 +490,8 @@ class Declaration : public AstNode {
virtual bool IsInlineable() const;
protected:
- Declaration(VariableProxy* proxy,
+ Declaration(Zone* zone,
+ VariableProxy* proxy,
VariableMode mode,
Scope* scope,
int pos)
@@ -519,11 +520,12 @@ class VariableDeclaration V8_FINAL : public Declaration {
}
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) {
}
};
@@ -539,12 +541,13 @@ class FunctionDeclaration V8_FINAL : public Declaration {
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);
@@ -566,11 +569,12 @@ class ModuleDeclaration V8_FINAL : public Declaration {
}
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) {
}
@@ -589,11 +593,12 @@ class ImportDeclaration V8_FINAL : public Declaration {
}
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) {
}
@@ -611,8 +616,8 @@ class ExportDeclaration V8_FINAL : public Declaration {
}
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) {}
};
@@ -626,7 +631,7 @@ class Module : public AstNode {
: 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) {}
@@ -642,8 +647,8 @@ class ModuleLiteral V8_FINAL : public Module {
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) {}
};
@@ -654,7 +659,7 @@ class ModuleVariable V8_FINAL : public Module {
VariableProxy* proxy() const { return proxy_; }
protected:
- inline ModuleVariable(VariableProxy* proxy, int pos);
+ inline ModuleVariable(Zone* zone, VariableProxy* proxy, int pos);
private:
VariableProxy* proxy_;
@@ -669,7 +674,7 @@ class ModulePath V8_FINAL : public Module {
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) {
@@ -688,7 +693,7 @@ class ModuleUrl V8_FINAL : public Module {
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) {
}
@@ -705,8 +710,8 @@ class ModuleStatement V8_FINAL : public Statement {
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) {
}
@@ -734,10 +739,10 @@ class IterationStatement : public BreakableStatement {
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) {
@@ -768,11 +773,11 @@ class DoWhileStatement V8_FINAL : public IterationStatement {
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:
@@ -805,11 +810,11 @@ class WhileStatement V8_FINAL : public IterationStatement {
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:
@@ -856,15 +861,15 @@ class ForStatement V8_FINAL : public IterationStatement {
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:
@@ -898,8 +903,8 @@ class ForEachStatement : public IterationStatement {
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) {
}
@@ -910,7 +915,8 @@ class ForEachStatement : public IterationStatement {
};
-class ForInStatement V8_FINAL : public ForEachStatement {
+class ForInStatement V8_FINAL : public ForEachStatement,
+ public FeedbackSlotInterface {
public:
DECLARE_NODE_TYPE(ForInStatement)
@@ -918,7 +924,16 @@ class ForInStatement V8_FINAL : public ForEachStatement {
return subject();
}
- TypeFeedbackId ForInFeedbackId() const { return reuse(PrepareId()); }
+ // Type feedback information.
+ virtual ComputablePhase GetComputablePhase() { return DURING_PARSE; }
+ virtual int ComputeFeedbackSlotCount(Isolate* isolate) { return 1; }
+ virtual void SetFirstFeedbackSlot(int slot) { for_in_feedback_slot_ = slot; }
+
+ int ForInFeedbackSlot() {
+ ASSERT(for_in_feedback_slot_ != kInvalidFeedbackSlot);
+ return for_in_feedback_slot_;
+ }
+
enum ForInType { FAST_FOR_IN, SLOW_FOR_IN };
ForInType for_in_type() const { return for_in_type_; }
void set_for_in_type(ForInType type) { for_in_type_ = type; }
@@ -929,14 +944,16 @@ class ForInStatement V8_FINAL : public ForEachStatement {
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)) {
+ for_in_feedback_slot_(kInvalidFeedbackSlot),
+ body_id_(GetNextId(zone)),
+ prepare_id_(GetNextId(zone)) {
}
ForInType for_in_type_;
+ int for_in_feedback_slot_;
const BailoutId body_id_;
const BailoutId prepare_id_;
};
@@ -990,13 +1007,13 @@ class ForOfStatement V8_FINAL : public ForEachStatement {
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_;
@@ -1016,8 +1033,8 @@ class ExpressionStatement V8_FINAL : public Statement {
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_;
@@ -1029,7 +1046,7 @@ class JumpStatement : public Statement {
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) {}
};
@@ -1040,8 +1057,8 @@ class ContinueStatement V8_FINAL : public JumpStatement {
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_;
@@ -1055,8 +1072,8 @@ class BreakStatement V8_FINAL : public JumpStatement {
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_;
@@ -1070,8 +1087,8 @@ class ReturnStatement V8_FINAL : public JumpStatement {
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_;
@@ -1088,8 +1105,9 @@ class WithStatement V8_FINAL : public Statement {
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) { }
@@ -1117,11 +1135,11 @@ class CaseClause V8_FINAL : public Expression {
// 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);
@@ -1129,7 +1147,7 @@ class CaseClause V8_FINAL : public Expression {
Expression* label_;
Label body_target_;
ZoneList<Statement*>* statements_;
- Handle<Type> compare_type_;
+ Type* compare_type_;
const TypeFeedbackId compare_id_;
const BailoutId entry_id_;
@@ -1149,8 +1167,8 @@ class SwitchStatement V8_FINAL : public BreakableStatement {
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) { }
@@ -1186,18 +1204,18 @@ class IfStatement V8_FINAL : public Statement {
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:
@@ -1245,8 +1263,8 @@ class TryStatement : public Statement {
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) { }
@@ -1269,13 +1287,14 @@ class TryCatchStatement V8_FINAL : public TryStatement {
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) {
@@ -1296,8 +1315,8 @@ class TryFinallyStatement V8_FINAL : public TryStatement {
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:
@@ -1310,7 +1329,7 @@ class DebuggerStatement V8_FINAL : public Statement {
DECLARE_NODE_TYPE(DebuggerStatement)
protected:
- explicit DebuggerStatement(int pos): Statement(pos) {}
+ explicit DebuggerStatement(Zone* zone, int pos): Statement(zone, pos) {}
};
@@ -1319,7 +1338,7 @@ class EmptyStatement V8_FINAL : public Statement {
DECLARE_NODE_TYPE(EmptyStatement)
protected:
- explicit EmptyStatement(int pos): Statement(pos) {}
+ explicit EmptyStatement(Zone* zone, int pos): Statement(zone, pos) {}
};
@@ -1376,11 +1395,10 @@ class Literal V8_FINAL : public Expression {
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();
@@ -1405,10 +1423,10 @@ class MaterializedLiteral : public Expression {
}
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) {}
@@ -1456,7 +1474,7 @@ class ObjectLiteralProperty V8_FINAL : public ZoneObject {
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_; }
@@ -1475,7 +1493,7 @@ class ObjectLiteralProperty V8_FINAL : public ZoneObject {
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:
@@ -1527,13 +1545,13 @@ class ObjectLiteral V8_FINAL : public MaterializedLiteral {
};
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),
@@ -1559,12 +1577,12 @@ class RegExpLiteral V8_FINAL : public MaterializedLiteral {
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);
@@ -1600,13 +1618,13 @@ class ArrayLiteral V8_FINAL : public MaterializedLiteral {
};
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_;
@@ -1646,9 +1664,9 @@ class VariableProxy V8_FINAL : public Expression {
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,
@@ -1689,28 +1707,28 @@ class Property V8_FINAL : public Expression {
virtual KeyedAccessStoreMode GetStoreMode() V8_OVERRIDE {
return STANDARD_STORE;
}
- bool IsUninitialized() { return is_uninitialized_; }
- bool IsPreMonomorphic() { return is_pre_monomorphic_; }
+ bool IsUninitialized() { return !is_for_call_ && is_uninitialized_; }
bool HasNoTypeInformation() {
- return is_uninitialized_ || is_pre_monomorphic_;
+ return is_uninitialized_;
}
void set_is_uninitialized(bool b) { is_uninitialized_ = b; }
- void set_is_pre_monomorphic(bool b) { is_pre_monomorphic_ = b; }
void set_is_string_access(bool b) { is_string_access_ = b; }
void set_is_function_prototype(bool b) { is_function_prototype_ = b; }
+ void mark_for_call() { is_for_call_ = true; }
+ bool IsForCall() { return is_for_call_; }
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)),
- is_pre_monomorphic_(false),
+ load_id_(GetNextId(zone)),
+ is_for_call_(false),
is_uninitialized_(false),
is_string_access_(false),
is_function_prototype_(false) { }
@@ -1721,14 +1739,14 @@ class Property V8_FINAL : public Expression {
const BailoutId load_id_;
SmallMapList receiver_types_;
- bool is_pre_monomorphic_ : 1;
+ bool is_for_call_ : 1;
bool is_uninitialized_ : 1;
bool is_string_access_ : 1;
bool is_function_prototype_ : 1;
};
-class Call V8_FINAL : public Expression {
+class Call V8_FINAL : public Expression, public FeedbackSlotInterface {
public:
DECLARE_NODE_TYPE(Call)
@@ -1736,40 +1754,36 @@ class Call V8_FINAL : public Expression {
ZoneList<Expression*>* arguments() const { return arguments_; }
// Type feedback information.
- TypeFeedbackId CallFeedbackId() const { return reuse(id()); }
- void RecordTypeFeedback(TypeFeedbackOracle* oracle);
- virtual SmallMapList* GetReceiverTypes() V8_OVERRIDE {
- return &receiver_types_;
+ virtual ComputablePhase GetComputablePhase() { return AFTER_SCOPING; }
+ virtual int ComputeFeedbackSlotCount(Isolate* isolate);
+ virtual void SetFirstFeedbackSlot(int slot) {
+ call_feedback_slot_ = slot;
}
- virtual bool IsMonomorphic() V8_OVERRIDE { return is_monomorphic_; }
- bool KeyedArrayCallIsHoley() { return keyed_array_call_is_holey_; }
- CheckType check_type() const { return check_type_; }
- void set_string_check(Handle<JSObject> holder) {
- holder_ = holder;
- check_type_ = STRING_CHECK;
+ bool HasCallFeedbackSlot() const {
+ return call_feedback_slot_ != kInvalidFeedbackSlot;
}
+ int CallFeedbackSlot() const { return call_feedback_slot_; }
- void set_number_check(Handle<JSObject> holder) {
- holder_ = holder;
- check_type_ = NUMBER_CHECK;
+ virtual SmallMapList* GetReceiverTypes() V8_OVERRIDE {
+ if (expression()->IsProperty()) {
+ return expression()->AsProperty()->GetReceiverTypes();
+ }
+ return NULL;
}
- void set_map_check() {
- holder_ = Handle<JSObject>::null();
- check_type_ = RECEIVER_MAP_CHECK;
+ virtual bool IsMonomorphic() V8_OVERRIDE {
+ if (expression()->IsProperty()) {
+ return expression()->AsProperty()->IsMonomorphic();
+ }
+ return !target_.is_null();
}
Handle<JSFunction> target() { return target_; }
- // A cache for the holder, set as a side effect of computing the target of the
- // call. Note that it contains the null handle when the receiver is the same
- // as the holder!
- Handle<JSObject> holder() { return holder_; }
-
Handle<Cell> cell() { return cell_; }
- bool ComputeTarget(Handle<Map> type, Handle<String> name);
+ void set_target(Handle<JSFunction> target) { target_ = target; }
bool ComputeGlobalTarget(Handle<GlobalObject> global, LookupResult* lookup);
BailoutId ReturnId() const { return return_id_; }
@@ -1785,46 +1799,39 @@ class Call V8_FINAL : public Expression {
// Helpers to determine how to handle the call.
CallType GetCallType(Isolate* isolate) const;
- // TODO(rossberg): this should really move somewhere else (and be merged with
- // various similar methods in objets.cc), but for now...
- static Handle<JSObject> GetPrototypeForPrimitiveCheck(
- CheckType check, Isolate* isolate);
-
#ifdef DEBUG
// Used to assert that the FullCodeGenerator records the return site.
bool return_is_recorded_;
#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)) { }
+ call_feedback_slot_(kInvalidFeedbackSlot),
+ return_id_(GetNextId(zone)) {
+ if (expression->IsProperty()) {
+ expression->AsProperty()->mark_for_call();
+ }
+ }
private:
Expression* expression_;
ZoneList<Expression*>* arguments_;
- bool is_monomorphic_;
- bool keyed_array_call_is_holey_;
- CheckType check_type_;
- SmallMapList receiver_types_;
Handle<JSFunction> target_;
- Handle<JSObject> holder_;
Handle<Cell> cell_;
+ int call_feedback_slot_;
const BailoutId return_id_;
};
-class CallNew V8_FINAL : public Expression {
+class CallNew V8_FINAL : public Expression, public FeedbackSlotInterface {
public:
DECLARE_NODE_TYPE(CallNew)
@@ -1832,28 +1839,42 @@ class CallNew V8_FINAL : public Expression {
ZoneList<Expression*>* arguments() const { return arguments_; }
// Type feedback information.
+ virtual ComputablePhase GetComputablePhase() { return DURING_PARSE; }
+ virtual int ComputeFeedbackSlotCount(Isolate* isolate) { return 1; }
+ virtual void SetFirstFeedbackSlot(int slot) {
+ callnew_feedback_slot_ = slot;
+ }
+
+ int CallNewFeedbackSlot() {
+ ASSERT(callnew_feedback_slot_ != kInvalidFeedbackSlot);
+ return callnew_feedback_slot_;
+ }
+
TypeFeedbackId CallNewFeedbackId() const { return reuse(id()); }
void RecordTypeFeedback(TypeFeedbackOracle* oracle);
virtual bool IsMonomorphic() V8_OVERRIDE { return is_monomorphic_; }
Handle<JSFunction> target() const { return target_; }
ElementsKind elements_kind() const { return elements_kind_; }
- Handle<Cell> allocation_info_cell() const {
- return allocation_info_cell_;
+ Handle<AllocationSite> allocation_site() const {
+ return allocation_site_;
}
+ static int feedback_slots() { return 1; }
+
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)) { }
+ callnew_feedback_slot_(kInvalidFeedbackSlot),
+ return_id_(GetNextId(zone)) { }
private:
Expression* expression_;
@@ -1862,7 +1883,8 @@ class CallNew V8_FINAL : public Expression {
bool is_monomorphic_;
Handle<JSFunction> target_;
ElementsKind elements_kind_;
- Handle<Cell> allocation_info_cell_;
+ Handle<AllocationSite> allocation_site_;
+ int callnew_feedback_slot_;
const BailoutId return_id_;
};
@@ -1884,12 +1906,12 @@ class CallRuntime V8_FINAL : public 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) { }
@@ -1915,15 +1937,15 @@ class UnaryOperation V8_FINAL : public Expression {
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));
}
@@ -1962,16 +1984,16 @@ class BinaryOperation V8_FINAL : public Expression {
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));
}
@@ -2014,9 +2036,9 @@ class CountOperation V8_FINAL : public Expression {
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_; }
@@ -2024,25 +2046,25 @@ class CountOperation V8_FINAL : public Expression {
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_;
@@ -2061,8 +2083,8 @@ class CompareOperation V8_FINAL : public Expression {
// 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);
@@ -2070,16 +2092,16 @@ class CompareOperation V8_FINAL : public Expression {
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));
}
@@ -2088,7 +2110,7 @@ class CompareOperation V8_FINAL : public Expression {
Expression* left_;
Expression* right_;
- Handle<Type> combined_type_;
+ Type* combined_type_;
};
@@ -2104,17 +2126,17 @@ class Conditional V8_FINAL : public Expression {
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_;
@@ -2149,9 +2171,8 @@ class Assignment V8_FINAL : public Expression {
return receiver_types_.length() == 1;
}
bool IsUninitialized() { return is_uninitialized_; }
- bool IsPreMonomorphic() { return is_pre_monomorphic_; }
bool HasNoTypeInformation() {
- return is_uninitialized_ || is_pre_monomorphic_;
+ return is_uninitialized_;
}
virtual SmallMapList* GetReceiverTypes() V8_OVERRIDE {
return &receiver_types_;
@@ -2160,18 +2181,17 @@ class Assignment V8_FINAL : public Expression {
return store_mode_;
}
void set_is_uninitialized(bool b) { is_uninitialized_ = b; }
- void set_is_pre_monomorphic(bool b) { is_pre_monomorphic_ = b; }
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(
@@ -2187,7 +2207,6 @@ class Assignment V8_FINAL : public Expression {
const BailoutId assignment_id_;
bool is_uninitialized_ : 1;
- bool is_pre_monomorphic_ : 1;
KeyedAccessStoreMode store_mode_ : 5; // Windows treats as signed,
// must have extra bit.
SmallMapList receiver_types_;
@@ -2222,12 +2241,12 @@ class Yield V8_FINAL : public Expression {
}
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),
@@ -2248,8 +2267,8 @@ class Throw V8_FINAL : public Expression {
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_;
@@ -2352,7 +2371,15 @@ class FunctionLiteral V8_FINAL : public Expression {
void set_ast_properties(AstProperties* ast_properties) {
ast_properties_ = *ast_properties;
}
-
+ void set_slot_processor(DeferredFeedbackSlotProcessor* slot_processor) {
+ slot_processor_ = *slot_processor;
+ }
+ void ProcessFeedbackSlots(Isolate* isolate) {
+ slot_processor_.ProcessFeedbackSlots(isolate);
+ }
+ int slot_count() {
+ return slot_processor_.slot_count();
+ }
bool dont_optimize() { return dont_optimize_reason_ != kNoReason; }
BailoutReason dont_optimize_reason() { return dont_optimize_reason_; }
void set_dont_optimize_reason(BailoutReason reason) {
@@ -2360,7 +2387,7 @@ class FunctionLiteral V8_FINAL : public Expression {
}
protected:
- FunctionLiteral(Isolate* isolate,
+ FunctionLiteral(Zone* zone,
Handle<String> name,
Scope* scope,
ZoneList<Statement*>* body,
@@ -2374,11 +2401,11 @@ class FunctionLiteral V8_FINAL : public Expression {
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),
@@ -2402,6 +2429,7 @@ class FunctionLiteral V8_FINAL : public Expression {
ZoneList<Statement*>* body_;
Handle<String> inferred_name_;
AstProperties ast_properties_;
+ DeferredFeedbackSlotProcessor slot_processor_;
BailoutReason dont_optimize_reason_;
int materialized_literal_count_;
@@ -2430,8 +2458,8 @@ class NativeFunctionLiteral V8_FINAL : public Expression {
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_;
@@ -2444,7 +2472,7 @@ class ThisFunction V8_FINAL : public Expression {
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
@@ -2811,8 +2839,8 @@ class RegExpEmpty V8_FINAL : public RegExpTree {
// ----------------------------------------------------------------------------
// 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) {
}
@@ -2844,7 +2872,7 @@ class AstVisitor BASE_EMBEDDED {
#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); \
} \
\
@@ -2854,19 +2882,20 @@ public: \
\
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_
@@ -2875,10 +2904,13 @@ private: \
class AstConstructionVisitor BASE_EMBEDDED {
public:
- AstConstructionVisitor() : dont_optimize_reason_(kNoReason) { }
+ explicit AstConstructionVisitor(Zone* zone)
+ : dont_optimize_reason_(kNoReason),
+ zone_(zone) { }
AstProperties* ast_properties() { return &properties_; }
BailoutReason dont_optimize_reason() { return dont_optimize_reason_; }
+ DeferredFeedbackSlotProcessor* slot_processor() { return &slot_processor_; }
private:
template<class> friend class AstNodeFactory;
@@ -2895,13 +2927,21 @@ class AstConstructionVisitor BASE_EMBEDDED {
dont_optimize_reason_ = reason;
}
+ void add_slot_node(FeedbackSlotInterface* slot_node) {
+ slot_processor_.add_slot_node(zone_, slot_node);
+ }
+
AstProperties properties_;
+ DeferredFeedbackSlotProcessor slot_processor_;
BailoutReason dont_optimize_reason_;
+ Zone* zone_;
};
class AstNullVisitor BASE_EMBEDDED {
public:
+ explicit AstNullVisitor(Zone* zone) {}
+
// Node visitors.
#define DEF_VISIT(type) \
void Visit##type(type* node) {}
@@ -2917,9 +2957,9 @@ class AstNullVisitor BASE_EMBEDDED {
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_(zone) { }
Visitor* visitor() { return &visitor_; }
@@ -2932,7 +2972,7 @@ class AstNodeFactory V8_FINAL BASE_EMBEDDED {
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)
}
@@ -2942,7 +2982,7 @@ class AstNodeFactory V8_FINAL BASE_EMBEDDED {
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)
}
@@ -2951,7 +2991,7 @@ class AstNodeFactory V8_FINAL BASE_EMBEDDED {
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)
}
@@ -2960,7 +3000,7 @@ class AstNodeFactory V8_FINAL BASE_EMBEDDED {
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)
}
@@ -2968,27 +3008,28 @@ class AstNodeFactory V8_FINAL BASE_EMBEDDED {
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)
}
@@ -2997,13 +3038,13 @@ class AstNodeFactory V8_FINAL BASE_EMBEDDED {
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)
@@ -3017,11 +3058,11 @@ class AstNodeFactory V8_FINAL BASE_EMBEDDED {
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);
}
}
@@ -3031,27 +3072,28 @@ class AstNodeFactory V8_FINAL BASE_EMBEDDED {
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)
}
@@ -3060,7 +3102,7 @@ class AstNodeFactory V8_FINAL BASE_EMBEDDED {
Statement* statement,
int pos) {
WithStatement* stmt = new(zone_) WithStatement(
- scope, expression, statement, pos);
+ zone_, scope, expression, statement, pos);
VISIT_AND_RETURN(WithStatement, stmt)
}
@@ -3069,7 +3111,7 @@ class AstNodeFactory V8_FINAL BASE_EMBEDDED {
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)
}
@@ -3080,7 +3122,7 @@ class AstNodeFactory V8_FINAL BASE_EMBEDDED {
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)
}
@@ -3088,34 +3130,35 @@ class AstNodeFactory V8_FINAL BASE_EMBEDDED {
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(
@@ -3125,16 +3168,21 @@ class AstNodeFactory V8_FINAL BASE_EMBEDDED {
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.
}
@@ -3144,7 +3192,7 @@ class AstNodeFactory V8_FINAL BASE_EMBEDDED {
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);
}
@@ -3152,13 +3200,13 @@ class AstNodeFactory V8_FINAL BASE_EMBEDDED {
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)
}
@@ -3167,26 +3215,26 @@ class AstNodeFactory V8_FINAL BASE_EMBEDDED {
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)
}
@@ -3195,7 +3243,7 @@ class AstNodeFactory V8_FINAL BASE_EMBEDDED {
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)
}
@@ -3203,7 +3251,7 @@ class AstNodeFactory V8_FINAL BASE_EMBEDDED {
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)
}
@@ -3212,7 +3260,7 @@ class AstNodeFactory V8_FINAL BASE_EMBEDDED {
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)
}
@@ -3221,7 +3269,7 @@ class AstNodeFactory V8_FINAL BASE_EMBEDDED {
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)
}
@@ -3230,7 +3278,7 @@ class AstNodeFactory V8_FINAL BASE_EMBEDDED {
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)
}
@@ -3239,7 +3287,7 @@ class AstNodeFactory V8_FINAL BASE_EMBEDDED {
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)
}
@@ -3248,8 +3296,8 @@ class AstNodeFactory V8_FINAL BASE_EMBEDDED {
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)
}
@@ -3258,12 +3306,12 @@ class AstNodeFactory V8_FINAL BASE_EMBEDDED {
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)
}
@@ -3282,7 +3330,7 @@ class AstNodeFactory V8_FINAL BASE_EMBEDDED {
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);
@@ -3296,19 +3344,18 @@ class AstNodeFactory V8_FINAL BASE_EMBEDDED {
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_;
};
« no previous file with comments | « src/assembler.cc ('k') | src/ast.cc » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698