Chromium Code Reviews
chromiumcodereview-hr@appspot.gserviceaccount.com (chromiumcodereview-hr) | Please choose your nickname with Settings | Help | Chromium Project | Gerrit Changes | Sign out
(104)

Side by Side Diff: src/ast.h

Issue 16361015: Migrate Compare ICs to new type rep (Closed) Base URL: https://v8.googlecode.com/svn/branches/bleeding_edge
Patch Set: Comments Created 7 years, 6 months ago
Use n/p to move between diff chunks; N/P to move between comments. Draft comments are only viewable by you.
Jump to:
View unified diff | Download patch | Annotate | Revision Log
« no previous file with comments | « no previous file | src/ast.cc » ('j') | no next file with comments »
Toggle Intra-line Diffs ('i') | Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
OLDNEW
1 // Copyright 2012 the V8 project authors. All rights reserved. 1 // Copyright 2012 the V8 project authors. All rights reserved.
2 // Redistribution and use in source and binary forms, with or without 2 // Redistribution and use in source and binary forms, with or without
3 // modification, are permitted provided that the following conditions are 3 // modification, are permitted provided that the following conditions are
4 // met: 4 // met:
5 // 5 //
6 // * Redistributions of source code must retain the above copyright 6 // * Redistributions of source code must retain the above copyright
7 // notice, this list of conditions and the following disclaimer. 7 // notice, this list of conditions and the following disclaimer.
8 // * Redistributions in binary form must reproduce the above 8 // * Redistributions in binary form must reproduce the above
9 // copyright notice, this list of conditions and the following 9 // copyright notice, this list of conditions and the following
10 // disclaimer in the documentation and/or other materials provided 10 // disclaimer in the documentation and/or other materials provided
(...skipping 340 matching lines...) Expand 10 before | Expand all | Expand 10 after
351 bool IsStringLiteral(); 351 bool IsStringLiteral();
352 352
353 // True iff the expression is the null literal. 353 // True iff the expression is the null literal.
354 bool IsNullLiteral(); 354 bool IsNullLiteral();
355 355
356 // True iff the expression is the undefined literal. 356 // True iff the expression is the undefined literal.
357 bool IsUndefinedLiteral(); 357 bool IsUndefinedLiteral();
358 358
359 // Expression type 359 // Expression type
360 Handle<Type> type() { return type_; } 360 Handle<Type> type() { return type_; }
361 void set_type(Handle<Type> type) { type_ = type; }
361 362
362 // Type feedback information for assignments and properties. 363 // Type feedback information for assignments and properties.
363 virtual bool IsMonomorphic() { 364 virtual bool IsMonomorphic() {
364 UNREACHABLE(); 365 UNREACHABLE();
365 return false; 366 return false;
366 } 367 }
367 virtual SmallMapList* GetReceiverTypes() { 368 virtual SmallMapList* GetReceiverTypes() {
368 UNREACHABLE(); 369 UNREACHABLE();
369 return NULL; 370 return NULL;
370 } 371 }
(...skipping 10 matching lines...) Expand all
381 382
382 // TODO(rossberg): this should move to its own AST node eventually. 383 // TODO(rossberg): this should move to its own AST node eventually.
383 void RecordToBooleanTypeFeedback(TypeFeedbackOracle* oracle); 384 void RecordToBooleanTypeFeedback(TypeFeedbackOracle* oracle);
384 byte to_boolean_types() const { return to_boolean_types_; } 385 byte to_boolean_types() const { return to_boolean_types_; }
385 386
386 BailoutId id() const { return id_; } 387 BailoutId id() const { return id_; }
387 TypeFeedbackId test_id() const { return test_id_; } 388 TypeFeedbackId test_id() const { return test_id_; }
388 389
389 protected: 390 protected:
390 explicit Expression(Isolate* isolate) 391 explicit Expression(Isolate* isolate)
391 : type_(Type::Any(), isolate), 392 : type_(Type::None(), isolate),
392 id_(GetNextId(isolate)), 393 id_(GetNextId(isolate)),
393 test_id_(GetNextId(isolate)) {} 394 test_id_(GetNextId(isolate)) {}
394 395
395 private: 396 private:
396 Handle<Type> type_; 397 Handle<Type> type_;
397 byte to_boolean_types_; 398 byte to_boolean_types_;
398 399
399 const BailoutId id_; 400 const BailoutId id_;
400 const TypeFeedbackId test_id_; 401 const TypeFeedbackId test_id_;
401 }; 402 };
(...skipping 697 matching lines...) Expand 10 before | Expand all | Expand 10 after
1099 ZoneList<Statement*>* statements() const { return statements_; } 1100 ZoneList<Statement*>* statements() const { return statements_; }
1100 1101
1101 int position() const { return position_; } 1102 int position() const { return position_; }
1102 void set_position(int pos) { position_ = pos; } 1103 void set_position(int pos) { position_ = pos; }
1103 1104
1104 BailoutId EntryId() const { return entry_id_; } 1105 BailoutId EntryId() const { return entry_id_; }
1105 1106
1106 // Type feedback information. 1107 // Type feedback information.
1107 TypeFeedbackId CompareId() { return compare_id_; } 1108 TypeFeedbackId CompareId() { return compare_id_; }
1108 void RecordTypeFeedback(TypeFeedbackOracle* oracle); 1109 void RecordTypeFeedback(TypeFeedbackOracle* oracle);
1109 bool IsSmiCompare() { return compare_type_ == SMI_ONLY; } 1110 Handle<Type> compare_type() { return compare_type_; }
1110 bool IsNameCompare() { return compare_type_ == NAME_ONLY; }
1111 bool IsStringCompare() { return compare_type_ == STRING_ONLY; }
1112 bool IsObjectCompare() { return compare_type_ == OBJECT_ONLY; }
1113 1111
1114 private: 1112 private:
1115 Expression* label_; 1113 Expression* label_;
1116 Label body_target_; 1114 Label body_target_;
1117 ZoneList<Statement*>* statements_; 1115 ZoneList<Statement*>* statements_;
1118 int position_; 1116 int position_;
1119 enum CompareTypeFeedback { 1117 Handle<Type> compare_type_;
1120 NONE, 1118
1121 SMI_ONLY,
1122 NAME_ONLY,
1123 STRING_ONLY,
1124 OBJECT_ONLY
1125 };
1126 CompareTypeFeedback compare_type_;
1127 const TypeFeedbackId compare_id_; 1119 const TypeFeedbackId compare_id_;
1128 const BailoutId entry_id_; 1120 const BailoutId entry_id_;
1129 }; 1121 };
1130 1122
1131 1123
1132 class SwitchStatement: public BreakableStatement { 1124 class SwitchStatement: public BreakableStatement {
1133 public: 1125 public:
1134 DECLARE_NODE_TYPE(SwitchStatement) 1126 DECLARE_NODE_TYPE(SwitchStatement)
1135 1127
1136 void Initialize(Expression* tag, ZoneList<CaseClause*>* cases) { 1128 void Initialize(Expression* tag, ZoneList<CaseClause*>* cases) {
(...skipping 859 matching lines...) Expand 10 before | Expand all | Expand 10 after
1996 DECLARE_NODE_TYPE(CompareOperation) 1988 DECLARE_NODE_TYPE(CompareOperation)
1997 1989
1998 Token::Value op() const { return op_; } 1990 Token::Value op() const { return op_; }
1999 Expression* left() const { return left_; } 1991 Expression* left() const { return left_; }
2000 Expression* right() const { return right_; } 1992 Expression* right() const { return right_; }
2001 virtual int position() const { return pos_; } 1993 virtual int position() const { return pos_; }
2002 1994
2003 // Type feedback information. 1995 // Type feedback information.
2004 TypeFeedbackId CompareOperationFeedbackId() const { return reuse(id()); } 1996 TypeFeedbackId CompareOperationFeedbackId() const { return reuse(id()); }
2005 void RecordTypeFeedback(TypeFeedbackOracle* oracle); 1997 void RecordTypeFeedback(TypeFeedbackOracle* oracle);
2006 TypeInfo left_type() const { return left_type_; } 1998 Handle<Type> left_type() const { return left_type_; }
2007 TypeInfo right_type() const { return right_type_; } 1999 Handle<Type> right_type() const { return right_type_; }
2008 TypeInfo overall_type() const { return overall_type_; } 2000 Handle<Type> overall_type() const { return overall_type_; }
2009 byte compare_nil_types() const { return compare_nil_types_; } 2001 Handle<Type> compare_nil_type() const { return compare_nil_type_; }
2010 Handle<Map> map() const { return map_; }
2011 2002
2012 // Match special cases. 2003 // Match special cases.
2013 bool IsLiteralCompareTypeof(Expression** expr, Handle<String>* check); 2004 bool IsLiteralCompareTypeof(Expression** expr, Handle<String>* check);
2014 bool IsLiteralCompareUndefined(Expression** expr); 2005 bool IsLiteralCompareUndefined(Expression** expr);
2015 bool IsLiteralCompareNull(Expression** expr); 2006 bool IsLiteralCompareNull(Expression** expr);
2016 2007
2017 protected: 2008 protected:
2018 CompareOperation(Isolate* isolate, 2009 CompareOperation(Isolate* isolate,
2019 Token::Value op, 2010 Token::Value op,
2020 Expression* left, 2011 Expression* left,
2021 Expression* right, 2012 Expression* right,
2022 int pos) 2013 int pos)
2023 : Expression(isolate), 2014 : Expression(isolate),
2024 op_(op), 2015 op_(op),
2025 left_(left), 2016 left_(left),
2026 right_(right), 2017 right_(right),
2027 pos_(pos) { 2018 pos_(pos) {
2028 ASSERT(Token::IsCompareOp(op)); 2019 ASSERT(Token::IsCompareOp(op));
2029 } 2020 }
2030 2021
2031 private: 2022 private:
2032 Token::Value op_; 2023 Token::Value op_;
2033 Expression* left_; 2024 Expression* left_;
2034 Expression* right_; 2025 Expression* right_;
2035 int pos_; 2026 int pos_;
2036 2027
2037 TypeInfo left_type_; 2028 Handle<Type> left_type_;
2038 TypeInfo right_type_; 2029 Handle<Type> right_type_;
2039 TypeInfo overall_type_; 2030 Handle<Type> overall_type_;
2040 byte compare_nil_types_; 2031 Handle<Type> compare_nil_type_;
2041 Handle<Map> map_;
2042 }; 2032 };
2043 2033
2044 2034
2045 class Conditional: public Expression { 2035 class Conditional: public Expression {
2046 public: 2036 public:
2047 DECLARE_NODE_TYPE(Conditional) 2037 DECLARE_NODE_TYPE(Conditional)
2048 2038
2049 Expression* condition() const { return condition_; } 2039 Expression* condition() const { return condition_; }
2050 Expression* then_expression() const { return then_expression_; } 2040 Expression* then_expression() const { return then_expression_; }
2051 Expression* else_expression() const { return else_expression_; } 2041 Expression* else_expression() const { return else_expression_; }
(...skipping 1176 matching lines...) Expand 10 before | Expand all | Expand 10 after
3228 private: 3218 private:
3229 Isolate* isolate_; 3219 Isolate* isolate_;
3230 Zone* zone_; 3220 Zone* zone_;
3231 Visitor visitor_; 3221 Visitor visitor_;
3232 }; 3222 };
3233 3223
3234 3224
3235 } } // namespace v8::internal 3225 } } // namespace v8::internal
3236 3226
3237 #endif // V8_AST_H_ 3227 #endif // V8_AST_H_
OLDNEW
« no previous file with comments | « no previous file | src/ast.cc » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698