Index: src/ast.h |
diff --git a/src/ast.h b/src/ast.h |
index b07456b8f789ed9f03d6aa8b82a2409bf0fe004b..568725d33f835c62e7e8fc6a19640f92418f0b4e 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() { |
@@ -389,12 +391,14 @@ 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)) {} |
private: |
- Handle<Type> type_; |
+ Handle<Type> upper_type_; |
+ Handle<Type> lower_type_; |
byte to_boolean_types_; |
const BailoutId id_; |
@@ -1836,8 +1840,6 @@ 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_; } |
protected: |
UnaryOperation(Isolate* isolate, |
@@ -1858,8 +1860,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 +1881,11 @@ 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_; } |
+ // TODO(rossberg): result_type should be subsumed by lower_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_; } |
+ void set_result_type(Handle<Type> type) { result_type_ = type; } |
+ Maybe<int> fixed_right_arg() const { return fixed_right_arg_; } |
+ void set_fixed_right_arg(Maybe<int> arg) { fixed_right_arg_ = arg; } |
protected: |
BinaryOperation(Isolate* isolate, |
@@ -1909,11 +1908,10 @@ 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 +1992,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 +2020,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_; |
}; |