VariableProxy::VariableProxy(Zone* zone, Variable* var, int position,
IdGen* id_gen)
: Expression(zone, position, 0, id_gen),
- raw_name_(var->raw_name()),
- interface_(var->interface()),
- variable_feedback_slot_(FeedbackVectorSlot::Invalid()),
is_this_(var->is_this()),
is_assigned_(false),
- is_resolved_(false) {
+ is_resolved_(false),
+ variable_feedback_slot_(FeedbackVectorSlot::Invalid()),
+ raw_name_(var->raw_name()),
+ interface_(var->interface()) {
BindTo(var);
}
VariableProxy::VariableProxy(Zone* zone, const AstRawString* name, bool is_this,
Interface* interface, int position, IdGen* id_gen)
: Expression(zone, position, 0, id_gen),
- raw_name_(name),
- interface_(interface),
- variable_feedback_slot_(FeedbackVectorSlot::Invalid()),
is_this_(is_this),
is_assigned_(false),
- is_resolved_(false) {}
+ is_resolved_(false),
+ variable_feedback_slot_(FeedbackVectorSlot::Invalid()),
+ raw_name_(name),
+ interface_(interface) {}
void VariableProxy::BindTo(Variable* var) {
Assignment::Assignment(Zone* zone, Token::Value op, Expression* target,
Expression* value, int pos, IdGen* id_gen)
: Expression(zone, pos, num_ids(), id_gen),
+ is_uninitialized_(false),
+ store_mode_(STANDARD_STORE),
op_(op),
target_(target),
value_(value),
- binary_operation_(NULL),
- is_uninitialized_(false),
- store_mode_(STANDARD_STORE) {}
+ binary_operation_(NULL) {}
Token::Value Assignment::binary_op() const {
bool BinaryOperation::ResultOverwriteAllowed() const {
- switch (op_) {
+ switch (op()) {
case Token::COMMA:
case Token::OR:
case Token::AND:
protected:
Expression(Zone* zone, int pos, int num_ids_needed_by_subclass, IdGen* id_gen)
: AstNode(pos),
- is_parenthesized_(false),
- is_multi_parenthesized_(false),
- bounds_(Bounds::Unbounded(zone)),
base_id_(
- id_gen->ReserveIdRange(num_ids_needed_by_subclass + num_ids())) {}
+ id_gen->ReserveIdRange(num_ids_needed_by_subclass + num_ids())),
+ bounds_(Bounds::Unbounded(zone)),
+ is_parenthesized_(false),
+ is_multi_parenthesized_(false) {}
void set_to_boolean_types(byte types) { to_boolean_types_ = types; }
static int num_ids() { return 2; }
int base_id() const { return base_id_; }
private:
+ const int base_id_;
+ Bounds bounds_;
byte to_boolean_types_;
bool is_parenthesized_ : 1;
bool is_multi_parenthesized_ : 1;
- Bounds bounds_;
- const int base_id_;
};
virtual bool IsInlineable() const;
protected:
- Declaration(Zone* zone,
- VariableProxy* proxy,
- VariableMode mode,
- Scope* scope,
+ Declaration(Zone* zone, VariableProxy* proxy, VariableMode mode, Scope* scope,
int pos)
- : AstNode(pos),
- proxy_(proxy),
- mode_(mode),
- scope_(scope) {
+ : AstNode(pos), mode_(mode), proxy_(proxy), scope_(scope) {
DCHECK(IsDeclaredVariableMode(mode));
}
private:
- VariableProxy* proxy_;
VariableMode mode_;
+ VariableProxy* proxy_;
// Nested scope from which the declaration originated.
Scope* scope_;
VariableProxy(Zone* zone, const AstRawString* name, bool is_this,
Interface* interface, int position, IdGen* id_gen);
+ bool is_this_ : 1;
+ bool is_assigned_ : 1;
+ bool is_resolved_ : 1;
+ FeedbackVectorSlot variable_feedback_slot_;
union {
const AstRawString* raw_name_; // if !is_resolved_
Variable* var_; // if is_resolved_
};
Interface* interface_;
- FeedbackVectorSlot variable_feedback_slot_;
- bool is_this_ : 1;
- bool is_assigned_ : 1;
- bool is_resolved_ : 1;
};
protected:
Property(Zone* zone, Expression* obj, Expression* key, int pos, IdGen* id_gen)
: Expression(zone, pos, num_ids(), id_gen),
- obj_(obj),
- key_(key),
- property_feedback_slot_(FeedbackVectorSlot::Invalid()),
is_for_call_(false),
is_uninitialized_(false),
- is_string_access_(false) {}
+ is_string_access_(false),
+ property_feedback_slot_(FeedbackVectorSlot::Invalid()),
+ obj_(obj),
+ key_(key) {}
static int num_ids() { return 2; }
int base_id() const { return Expression::base_id() + Expression::num_ids(); }
private:
- Expression* obj_;
- Expression* key_;
- FeedbackVectorSlot property_feedback_slot_;
-
- SmallMapList receiver_types_;
bool is_for_call_ : 1;
bool is_uninitialized_ : 1;
bool is_string_access_ : 1;
+ FeedbackVectorSlot property_feedback_slot_;
+ Expression* obj_;
+ Expression* key_;
+ SmallMapList receiver_types_;
};
Call(Zone* zone, Expression* expression, ZoneList<Expression*>* arguments,
int pos, IdGen* id_gen)
: Expression(zone, pos, num_ids(), id_gen),
+ call_feedback_slot_(FeedbackVectorSlot::Invalid()),
expression_(expression),
- arguments_(arguments),
- call_feedback_slot_(FeedbackVectorSlot::Invalid()) {
+ arguments_(arguments) {
if (expression->IsProperty()) {
expression->AsProperty()->mark_for_call();
}
int base_id() const { return Expression::base_id() + Expression::num_ids(); }
private:
+ FeedbackVectorSlot call_feedback_slot_;
Expression* expression_;
ZoneList<Expression*>* arguments_;
Handle<JSFunction> target_;
Handle<Cell> cell_;
Handle<AllocationSite> allocation_site_;
- FeedbackVectorSlot call_feedback_slot_;
};
virtual bool ResultOverwriteAllowed() const OVERRIDE;
- Token::Value op() const { return op_; }
+ Token::Value op() const { return static_cast<Token::Value>(op_); }
Expression* left() const { return left_; }
Expression* right() const { return right_; }
Handle<AllocationSite> allocation_site() const { return allocation_site_; }
TypeFeedbackId BinaryOperationFeedbackId() const {
return TypeFeedbackId(base_id() + 1);
}
- Maybe<int> fixed_right_arg() const { return fixed_right_arg_; }
- void set_fixed_right_arg(Maybe<int> arg) { fixed_right_arg_ = arg; }
+ Maybe<int> fixed_right_arg() const {
+ return has_fixed_right_arg_ ? Maybe<int>(fixed_right_arg_value_)
+ : Maybe<int>();
+ }
+ void set_fixed_right_arg(Maybe<int> arg) {
+ has_fixed_right_arg_ = arg.has_value;
+ if (arg.has_value) fixed_right_arg_value_ = arg.value;
+ }
virtual void RecordToBooleanTypeFeedback(
TypeFeedbackOracle* oracle) OVERRIDE;
BinaryOperation(Zone* zone, Token::Value op, Expression* left,
Expression* right, int pos, IdGen* id_gen)
: Expression(zone, pos, num_ids(), id_gen),
- op_(op),
+ op_(static_cast<byte>(op)),
left_(left),
right_(right) {
DCHECK(Token::IsBinaryOp(op));
int base_id() const { return Expression::base_id() + Expression::num_ids(); }
private:
- Token::Value op_;
+ const byte op_; // actually Token::Value
+ // TODO(rossberg): the fixed arg should probably be represented as a Constant
+ // type for the RHS. Currenty it's actually a Maybe<int>
+ bool has_fixed_right_arg_;
+ int fixed_right_arg_value_;
Expression* left_;
Expression* right_;
Handle<AllocationSite> allocation_site_;
-
- // TODO(rossberg): the fixed arg should probably be represented as a Constant
- // type for the RHS.
- Maybe<int> fixed_right_arg_;
};
}
private:
- Token::Value op_;
- Expression* target_;
- Expression* value_;
- BinaryOperation* binary_operation_;
bool is_uninitialized_ : 1;
IcCheckType key_type_ : 1;
KeyedAccessStoreMode store_mode_ : 5; // Windows treats as signed,
// must have extra bit.
+ Token::Value op_;
+ Expression* target_;
+ Expression* value_;
+ BinaryOperation* binary_operation_;
SmallMapList receiver_types_;
};