AST nodes have at most one bailout/typefeedback ID now, saving lots of memory.

This is basically https://codereview.chromium.org/569573002/ done right:

During construction, each node type tells its parent how many IDs it
needs in addition to the parent's ones. This is done all the way up in
the class hierarchy until a node's parent doesn't need any ID. At that
point we know how many IDs in summary are needed, and we reserve the
whole range at once, saving only the base ID of that range. All IDs
are now calculated via simple offsets to that base ID. To all
performaniacs: The C++ compiler simplifies the constant calculation to
a simple load and the addition of a single constant.

Note that the actual code is much simpler than all that prose above. :-)
It's basically how compilers for OO languages figure out vtable entries.

We still have lots of holes due to padding in the AST nodes, but this
will be addressed in a separate CL.

BUG=chromium:417697
LOG=y
R=mvstanton@chromium.org

Review URL: https://codereview.chromium.org/643633003

git-svn-id: https://v8.googlecode.com/svn/branches/bleeding_edge@24524 ce2b1a6d-e550-0410-aec6-3dcde31c8c00
parent 6ca8f782
......@@ -61,7 +61,7 @@ bool Expression::IsUndefinedLiteral(Isolate* isolate) const {
VariableProxy::VariableProxy(Zone* zone, Variable* var, int position,
IdGen* id_gen)
: Expression(zone, position, id_gen),
: Expression(zone, position, 0, id_gen),
raw_name_(var->raw_name()),
interface_(var->interface()),
variable_feedback_slot_(kInvalidFeedbackSlot),
......@@ -74,7 +74,7 @@ VariableProxy::VariableProxy(Zone* zone, Variable* var, int position,
VariableProxy::VariableProxy(Zone* zone, const AstRawString* name, bool is_this,
Interface* interface, int position, IdGen* id_gen)
: Expression(zone, position, id_gen),
: Expression(zone, position, 0, id_gen),
raw_name_(name),
interface_(interface),
variable_feedback_slot_(kInvalidFeedbackSlot),
......@@ -99,12 +99,11 @@ void VariableProxy::BindTo(Variable* var) {
Assignment::Assignment(Zone* zone, Token::Value op, Expression* target,
Expression* value, int pos, IdGen* id_gen)
: Expression(zone, pos, id_gen),
: Expression(zone, pos, num_ids(), id_gen),
op_(op),
target_(target),
value_(value),
binary_operation_(NULL),
assignment_id_(id_gen->GetNextId()),
is_uninitialized_(false),
store_mode_(STANDARD_STORE) {}
......@@ -989,12 +988,10 @@ RegExpAlternative::RegExpAlternative(ZoneList<RegExpTree*>* nodes)
CaseClause::CaseClause(Zone* zone, Expression* label,
ZoneList<Statement*>* statements, int pos, IdGen* id_gen)
: Expression(zone, pos, id_gen),
: Expression(zone, pos, num_ids(), id_gen),
label_(label),
statements_(statements),
compare_type_(Type::None(zone)),
compare_id_(id_gen->GetNextId()),
entry_id_(id_gen->GetNextId()) {}
compare_type_(Type::None(zone)) {}
#define REGULAR_NODE(NodeType) \
......
This diff is collapsed.
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