Commit bfd7c719 authored by vitalyr@chromium.org's avatar vitalyr@chromium.org

Pass isolate to AST ID functions.

R=ager@chromium.org

Review URL: http://codereview.chromium.org/7399023

git-svn-id: http://v8.googlecode.com/svn/branches/bleeding_edge@8678 ce2b1a6d-e550-0410-aec6-3dcde31c8c00
parent 7ac9dfcc
......@@ -37,68 +37,76 @@ namespace v8 {
namespace internal {
SwitchStatement::SwitchStatement(ZoneStringList* labels)
: BreakableStatement(labels, TARGET_FOR_ANONYMOUS),
SwitchStatement::SwitchStatement(Isolate* isolate,
ZoneStringList* labels)
: BreakableStatement(isolate, labels, TARGET_FOR_ANONYMOUS),
tag_(NULL), cases_(NULL) {
}
Block::Block(ZoneStringList* labels, int capacity, bool is_initializer_block)
: BreakableStatement(labels, TARGET_FOR_NAMED_ONLY),
Block::Block(Isolate* isolate,
ZoneStringList* labels,
int capacity,
bool is_initializer_block)
: BreakableStatement(isolate, labels, TARGET_FOR_NAMED_ONLY),
statements_(capacity),
is_initializer_block_(is_initializer_block) {
}
BreakableStatement::BreakableStatement(ZoneStringList* labels, Type type)
BreakableStatement::BreakableStatement(Isolate* isolate,
ZoneStringList* labels,
Type type)
: labels_(labels),
type_(type),
entry_id_(GetNextId()),
exit_id_(GetNextId()) {
entry_id_(GetNextId(isolate)),
exit_id_(GetNextId(isolate)) {
ASSERT(labels == NULL || labels->length() > 0);
}
IterationStatement::IterationStatement(ZoneStringList* labels)
: BreakableStatement(labels, TARGET_FOR_ANONYMOUS),
IterationStatement::IterationStatement(Isolate* isolate, ZoneStringList* labels)
: BreakableStatement(isolate, labels, TARGET_FOR_ANONYMOUS),
body_(NULL),
continue_target_(),
osr_entry_id_(GetNextId()) {
osr_entry_id_(GetNextId(isolate)) {
}
DoWhileStatement::DoWhileStatement(ZoneStringList* labels)
: IterationStatement(labels),
DoWhileStatement::DoWhileStatement(Isolate* isolate, ZoneStringList* labels)
: IterationStatement(isolate, labels),
cond_(NULL),
condition_position_(-1),
continue_id_(GetNextId()),
back_edge_id_(GetNextId()) {
continue_id_(GetNextId(isolate)),
back_edge_id_(GetNextId(isolate)) {
}
WhileStatement::WhileStatement(ZoneStringList* labels)
: IterationStatement(labels),
WhileStatement::WhileStatement(Isolate* isolate, ZoneStringList* labels)
: IterationStatement(isolate, labels),
cond_(NULL),
may_have_function_literal_(true),
body_id_(GetNextId()) {
body_id_(GetNextId(isolate)) {
}
ForStatement::ForStatement(ZoneStringList* labels)
: IterationStatement(labels),
ForStatement::ForStatement(Isolate* isolate, ZoneStringList* labels)
: IterationStatement(isolate, labels),
init_(NULL),
cond_(NULL),
next_(NULL),
may_have_function_literal_(true),
loop_variable_(NULL),
continue_id_(GetNextId()),
body_id_(GetNextId()) {
continue_id_(GetNextId(isolate)),
body_id_(GetNextId(isolate)) {
}
ForInStatement::ForInStatement(ZoneStringList* labels)
: IterationStatement(labels), each_(NULL), enumerable_(NULL),
assignment_id_(GetNextId()) {
ForInStatement::ForInStatement(Isolate* isolate, ZoneStringList* labels)
: IterationStatement(isolate, labels),
each_(NULL),
enumerable_(NULL),
assignment_id_(GetNextId(isolate)) {
}
......
......@@ -37,11 +37,11 @@ namespace v8 {
namespace internal {
AstSentinels::AstSentinels()
: this_proxy_(true),
identifier_proxy_(false),
valid_left_hand_side_sentinel_(),
this_property_(&this_proxy_, NULL, 0),
call_sentinel_(NULL, NULL, 0) {
: this_proxy_(Isolate::Current(), true),
identifier_proxy_(Isolate::Current(), false),
valid_left_hand_side_sentinel_(Isolate::Current()),
this_property_(Isolate::Current(), &this_proxy_, NULL, 0),
call_sentinel_(Isolate::Current(), NULL, NULL, 0) {
}
......@@ -72,8 +72,9 @@ CountOperation* ExpressionStatement::StatementAsCountOperation() {
}
VariableProxy::VariableProxy(Variable* var)
: name_(var->name()),
VariableProxy::VariableProxy(Isolate* isolate, Variable* var)
: Expression(isolate),
name_(var->name()),
var_(NULL), // Will be set by the call to BindTo.
is_this_(var->is_this()),
inside_with_(false),
......@@ -83,26 +84,29 @@ VariableProxy::VariableProxy(Variable* var)
}
VariableProxy::VariableProxy(Handle<String> name,
VariableProxy::VariableProxy(Isolate* isolate,
Handle<String> name,
bool is_this,
bool inside_with,
int position)
: name_(name),
var_(NULL),
is_this_(is_this),
inside_with_(inside_with),
is_trivial_(false),
position_(position) {
: Expression(isolate),
name_(name),
var_(NULL),
is_this_(is_this),
inside_with_(inside_with),
is_trivial_(false),
position_(position) {
// Names must be canonicalized for fast equality checks.
ASSERT(name->IsSymbol());
}
VariableProxy::VariableProxy(bool is_this)
: var_(NULL),
is_this_(is_this),
inside_with_(false),
is_trivial_(false) {
VariableProxy::VariableProxy(Isolate* isolate, bool is_this)
: Expression(isolate),
var_(NULL),
is_this_(is_this),
inside_with_(false),
is_trivial_(false) {
}
......@@ -120,17 +124,19 @@ void VariableProxy::BindTo(Variable* var) {
}
Assignment::Assignment(Token::Value op,
Assignment::Assignment(Isolate* isolate,
Token::Value op,
Expression* target,
Expression* value,
int pos)
: op_(op),
: Expression(isolate),
op_(op),
target_(target),
value_(value),
pos_(pos),
binary_operation_(NULL),
compound_load_id_(kNoNumber),
assignment_id_(GetNextId()),
assignment_id_(GetNextId(isolate)),
block_start_(false),
block_end_(false),
is_monomorphic_(false),
......@@ -138,8 +144,12 @@ Assignment::Assignment(Token::Value op,
ASSERT(Token::IsAssignmentOp(op));
if (is_compound()) {
binary_operation_ =
new(ZONE) BinaryOperation(binary_op(), target, value, pos + 1);
compound_load_id_ = GetNextId();
new(isolate->zone()) BinaryOperation(isolate,
binary_op(),
target,
value,
pos + 1);
compound_load_id_ = GetNextId(isolate);
}
}
......@@ -186,8 +196,9 @@ ObjectLiteral::Property::Property(Literal* key, Expression* value) {
ObjectLiteral::Property::Property(bool is_getter, FunctionLiteral* value) {
Isolate* isolate = Isolate::Current();
emit_store_ = true;
key_ = new(ZONE) Literal(value->name());
key_ = new(isolate->zone()) Literal(isolate, value->name());
value_ = value;
kind_ = is_getter ? GETTER : SETTER;
}
......@@ -1190,15 +1201,16 @@ RegExpAlternative::RegExpAlternative(ZoneList<RegExpTree*>* nodes)
}
CaseClause::CaseClause(Expression* label,
CaseClause::CaseClause(Isolate* isolate,
Expression* label,
ZoneList<Statement*>* statements,
int pos)
: label_(label),
statements_(statements),
position_(pos),
compare_type_(NONE),
compare_id_(AstNode::GetNextId()),
entry_id_(AstNode::GetNextId()) {
compare_id_(AstNode::GetNextId(isolate)),
entry_id_(AstNode::GetNextId(isolate)) {
}
} } // namespace v8::internal
This diff is collapsed.
This diff is collapsed.
......@@ -668,9 +668,12 @@ class Parser {
Expression* NewCall(Expression* expression,
ZoneList<Expression*>* arguments,
int pos) {
return new(zone()) Call(expression, arguments, pos);
return new(zone()) Call(isolate(), expression, arguments, pos);
}
inline Literal* NewLiteral(Handle<Object> handle) {
return new(zone()) Literal(isolate(), handle);
}
// Create a number literal.
Literal* NewNumberLiteral(double value);
......
......@@ -67,8 +67,11 @@ class Processor: public AstVisitor {
Expression* SetResult(Expression* value) {
result_assigned_ = true;
Zone* zone = isolate()->zone();
VariableProxy* result_proxy = new(zone) VariableProxy(result_);
return new(zone) Assignment(Token::ASSIGN, result_proxy, value,
VariableProxy* result_proxy = new(zone) VariableProxy(isolate(), result_);
return new(zone) Assignment(isolate(),
Token::ASSIGN,
result_proxy,
value,
RelocInfo::kNoPosition);
}
......@@ -230,8 +233,9 @@ bool Rewriter::Rewrite(CompilationInfo* info) {
if (processor.HasStackOverflow()) return false;
if (processor.result_assigned()) {
Zone* zone = info->isolate()->zone();
VariableProxy* result_proxy = new(zone) VariableProxy(result);
Isolate* isolate = info->isolate();
Zone* zone = isolate->zone();
VariableProxy* result_proxy = new(zone) VariableProxy(isolate, result);
body->Add(new(zone) ReturnStatement(result_proxy));
}
}
......
......@@ -304,7 +304,7 @@ void Scope::Initialize(bool inside_with) {
Variable::VAR,
false,
Variable::THIS);
var->set_rewrite(new(isolate_->zone()) Slot(var, Slot::PARAMETER, -1));
var->set_rewrite(NewSlot(var, Slot::PARAMETER, -1));
receiver_ = var;
}
......@@ -350,7 +350,7 @@ Variable* Scope::LocalLookup(Handle<String> name) {
Variable* var =
variables_.Declare(this, name, mode, true, Variable::NORMAL);
var->set_rewrite(new(isolate_->zone()) Slot(var, Slot::CONTEXT, index));
var->set_rewrite(NewSlot(var, Slot::CONTEXT, index));
return var;
}
......@@ -407,8 +407,8 @@ VariableProxy* Scope::NewUnresolved(Handle<String> name,
// the same name because they may be removed selectively via
// RemoveUnresolved().
ASSERT(!already_resolved());
VariableProxy* proxy =
new(isolate_->zone()) VariableProxy(name, false, inside_with, position);
VariableProxy* proxy = new(isolate_->zone()) VariableProxy(
isolate_, name, false, inside_with, position);
unresolved_.Add(proxy);
return proxy;
}
......@@ -708,7 +708,7 @@ Variable* Scope::NonLocal(Handle<String> name, Variable::Mode mode) {
// Declare a new non-local.
var = map->Declare(NULL, name, mode, true, Variable::NORMAL);
// Allocate it by giving it a dynamic lookup.
var->set_rewrite(new(isolate_->zone()) Slot(var, Slot::LOOKUP, -1));
var->set_rewrite(NewSlot(var, Slot::LOOKUP, -1));
}
return var;
}
......@@ -964,14 +964,12 @@ bool Scope::HasArgumentsParameter() {
void Scope::AllocateStackSlot(Variable* var) {
var->set_rewrite(
new(isolate_->zone()) Slot(var, Slot::LOCAL, num_stack_slots_++));
var->set_rewrite(NewSlot(var, Slot::LOCAL, num_stack_slots_++));
}
void Scope::AllocateHeapSlot(Variable* var) {
var->set_rewrite(
new(isolate_->zone()) Slot(var, Slot::CONTEXT, num_heap_slots_++));
var->set_rewrite(NewSlot(var, Slot::CONTEXT, num_heap_slots_++));
}
......@@ -1024,7 +1022,7 @@ void Scope::AllocateParameterLocals() {
} else {
ASSERT(var->rewrite() == NULL || var->IsParameter());
if (var->rewrite() == NULL) {
var->set_rewrite(new(isolate_->zone()) Slot(var, Slot::PARAMETER, i));
var->set_rewrite(NewSlot(var, Slot::PARAMETER, i));
}
}
}
......
......@@ -425,6 +425,10 @@ class Scope: public ZoneObject {
// Construct a catch scope with a binding for the name.
Scope(Scope* inner_scope, Handle<String> catch_variable_name);
inline Slot* NewSlot(Variable* var, Slot::Type type, int index) {
return new(isolate_->zone()) Slot(isolate_, var, type, index);
}
void AddInnerScope(Scope* inner_scope) {
if (inner_scope != NULL) {
inner_scopes_.Add(inner_scope);
......
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment