| Index: src/ast.h
|
| diff --git a/src/ast.h b/src/ast.h
|
| index b07456b8f789ed9f03d6aa8b82a2409bf0fe004b..6336b3a14b0e144aee345f0f2b91acce270f37ac 100644
|
| --- a/src/ast.h
|
| +++ b/src/ast.h
|
| @@ -356,9 +356,11 @@ class Expression: public AstNode {
|
| // True iff the expression is the undefined literal.
|
| bool IsUndefinedLiteral();
|
|
|
| - // Expression type
|
| - Handle<Type> type() { return type_; }
|
| - void set_type(Handle<Type> type) { type_ = type; }
|
| + // Expression type bounds
|
| + Handle<Type> upper_type() { return upper_type_; }
|
| + Handle<Type> lower_type() { return lower_type_; }
|
| + void set_upper_type(Handle<Type> type) { upper_type_ = type; }
|
| + void set_lower_type(Handle<Type> type) { lower_type_ = type; }
|
|
|
| // Type feedback information for assignments and properties.
|
| virtual bool IsMonomorphic() {
|
| @@ -381,7 +383,7 @@ class Expression: public AstNode {
|
| }
|
|
|
| // TODO(rossberg): this should move to its own AST node eventually.
|
| - void RecordToBooleanTypeFeedback(TypeFeedbackOracle* oracle);
|
| + virtual void RecordToBooleanTypeFeedback(TypeFeedbackOracle* oracle);
|
| byte to_boolean_types() const { return to_boolean_types_; }
|
|
|
| BailoutId id() const { return id_; }
|
| @@ -389,12 +391,15 @@ class Expression: public AstNode {
|
|
|
| protected:
|
| explicit Expression(Isolate* isolate)
|
| - : type_(Type::None(), isolate),
|
| + : upper_type_(Type::Any(), isolate),
|
| + lower_type_(Type::None(), isolate),
|
| id_(GetNextId(isolate)),
|
| test_id_(GetNextId(isolate)) {}
|
| + void set_to_boolean_types(byte types) { to_boolean_types_ = types; }
|
|
|
| private:
|
| - Handle<Type> type_;
|
| + Handle<Type> upper_type_;
|
| + Handle<Type> lower_type_;
|
| byte to_boolean_types_;
|
|
|
| const BailoutId id_;
|
| @@ -1308,36 +1313,36 @@ class Literal: public Expression {
|
| DECLARE_NODE_TYPE(Literal)
|
|
|
| virtual bool IsPropertyName() {
|
| - if (handle_->IsInternalizedString()) {
|
| + if (value_->IsInternalizedString()) {
|
| uint32_t ignored;
|
| - return !String::cast(*handle_)->AsArrayIndex(&ignored);
|
| + return !String::cast(*value_)->AsArrayIndex(&ignored);
|
| }
|
| return false;
|
| }
|
|
|
| Handle<String> AsPropertyName() {
|
| ASSERT(IsPropertyName());
|
| - return Handle<String>::cast(handle_);
|
| + return Handle<String>::cast(value_);
|
| }
|
|
|
| - virtual bool ToBooleanIsTrue() { return handle_->BooleanValue(); }
|
| - virtual bool ToBooleanIsFalse() { return !handle_->BooleanValue(); }
|
| + virtual bool ToBooleanIsTrue() { return value_->BooleanValue(); }
|
| + virtual bool ToBooleanIsFalse() { return !value_->BooleanValue(); }
|
|
|
| // Identity testers.
|
| bool IsNull() const {
|
| - ASSERT(!handle_.is_null());
|
| - return handle_->IsNull();
|
| + ASSERT(!value_.is_null());
|
| + return value_->IsNull();
|
| }
|
| bool IsTrue() const {
|
| - ASSERT(!handle_.is_null());
|
| - return handle_->IsTrue();
|
| + ASSERT(!value_.is_null());
|
| + return value_->IsTrue();
|
| }
|
| bool IsFalse() const {
|
| - ASSERT(!handle_.is_null());
|
| - return handle_->IsFalse();
|
| + ASSERT(!value_.is_null());
|
| + return value_->IsFalse();
|
| }
|
|
|
| - Handle<Object> handle() const { return handle_; }
|
| + Handle<Object> value() const { return value_; }
|
|
|
| // Support for using Literal as a HashMap key. NOTE: Currently, this works
|
| // only for string and number literals!
|
| @@ -1352,14 +1357,14 @@ class Literal: public Expression {
|
| TypeFeedbackId LiteralFeedbackId() const { return reuse(id()); }
|
|
|
| protected:
|
| - Literal(Isolate* isolate, Handle<Object> handle)
|
| + Literal(Isolate* isolate, Handle<Object> value)
|
| : Expression(isolate),
|
| - handle_(handle) { }
|
| + value_(value) { }
|
|
|
| private:
|
| Handle<String> ToString();
|
|
|
| - Handle<Object> handle_;
|
| + Handle<Object> value_;
|
| };
|
|
|
|
|
| @@ -1836,8 +1841,8 @@ class UnaryOperation: public Expression {
|
| BailoutId MaterializeFalseId() { return materialize_false_id_; }
|
|
|
| TypeFeedbackId UnaryOperationFeedbackId() const { return reuse(id()); }
|
| - void RecordTypeFeedback(TypeFeedbackOracle* oracle);
|
| - Handle<Type> type() const { return type_; }
|
| +
|
| + virtual void RecordToBooleanTypeFeedback(TypeFeedbackOracle* oracle);
|
|
|
| protected:
|
| UnaryOperation(Isolate* isolate,
|
| @@ -1858,8 +1863,6 @@ class UnaryOperation: public Expression {
|
| Expression* expression_;
|
| int pos_;
|
|
|
| - Handle<Type> type_;
|
| -
|
| // For unary not (Token::NOT), the AST ids where true and false will
|
| // actually be materialized, respectively.
|
| const BailoutId materialize_true_id_;
|
| @@ -1881,12 +1884,10 @@ class BinaryOperation: public Expression {
|
| BailoutId RightId() const { return right_id_; }
|
|
|
| TypeFeedbackId BinaryOperationFeedbackId() const { return reuse(id()); }
|
| - void RecordTypeFeedback(TypeFeedbackOracle* oracle);
|
| - Handle<Type> left_type() const { return left_type_; }
|
| - Handle<Type> right_type() const { return right_type_; }
|
| - Handle<Type> result_type() const { return result_type_; }
|
| - bool has_fixed_right_arg() const { return has_fixed_right_arg_; }
|
| - int fixed_right_arg_value() const { return fixed_right_arg_value_; }
|
| + Maybe<int> fixed_right_arg() const { return fixed_right_arg_; }
|
| + void set_fixed_right_arg(Maybe<int> arg) { fixed_right_arg_ = arg; }
|
| +
|
| + virtual void RecordToBooleanTypeFeedback(TypeFeedbackOracle* oracle);
|
|
|
| protected:
|
| BinaryOperation(Isolate* isolate,
|
| @@ -1909,11 +1910,9 @@ class BinaryOperation: public Expression {
|
| Expression* right_;
|
| int pos_;
|
|
|
| - Handle<Type> left_type_;
|
| - Handle<Type> right_type_;
|
| - Handle<Type> result_type_;
|
| - bool has_fixed_right_arg_;
|
| - int fixed_right_arg_value_;
|
| + // TODO(rossberg): the fixed arg should probably be represented as a Constant
|
| + // type for the RHS.
|
| + Maybe<int> fixed_right_arg_;
|
|
|
| // The short-circuit logical operations need an AST ID for their
|
| // right-hand subexpression.
|
| @@ -1994,11 +1993,8 @@ class CompareOperation: public Expression {
|
|
|
| // Type feedback information.
|
| TypeFeedbackId CompareOperationFeedbackId() const { return reuse(id()); }
|
| - void RecordTypeFeedback(TypeFeedbackOracle* oracle);
|
| - Handle<Type> left_type() const { return left_type_; }
|
| - Handle<Type> right_type() const { return right_type_; }
|
| - Handle<Type> overall_type() const { return overall_type_; }
|
| - Handle<Type> compare_nil_type() const { return compare_nil_type_; }
|
| + Handle<Type> combined_type() const { return combined_type_; }
|
| + void set_combined_type(Handle<Type> type) { combined_type_ = type; }
|
|
|
| // Match special cases.
|
| bool IsLiteralCompareTypeof(Expression** expr, Handle<String>* check);
|
| @@ -2025,10 +2021,7 @@ class CompareOperation: public Expression {
|
| Expression* right_;
|
| int pos_;
|
|
|
| - Handle<Type> left_type_;
|
| - Handle<Type> right_type_;
|
| - Handle<Type> overall_type_;
|
| - Handle<Type> compare_nil_type_;
|
| + Handle<Type> combined_type_;
|
| };
|
|
|
|
|
| @@ -2096,6 +2089,7 @@ class Assignment: public Expression {
|
| TypeFeedbackId AssignmentFeedbackId() { return reuse(id()); }
|
| void RecordTypeFeedback(TypeFeedbackOracle* oracle, Zone* zone);
|
| virtual bool IsMonomorphic() { return is_monomorphic_; }
|
| + bool IsUninitialized() { return is_uninitialized_; }
|
| virtual SmallMapList* GetReceiverTypes() { return &receiver_types_; }
|
| virtual KeyedAccessStoreMode GetStoreMode() {
|
| return store_mode_;
|
| @@ -2126,6 +2120,7 @@ class Assignment: public Expression {
|
| const BailoutId assignment_id_;
|
|
|
| bool is_monomorphic_ : 1;
|
| + bool is_uninitialized_ : 1;
|
| KeyedAccessStoreMode store_mode_ : 5; // Windows treats as signed,
|
| // must have extra bit.
|
| SmallMapList receiver_types_;
|
|
|