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

Side by Side Diff: src/ast.h

Issue 6529032: Merge 6168:6800 from bleeding_edge to experimental/gc branch. (Closed) Base URL: http://v8.googlecode.com/svn/branches/experimental/gc/
Patch Set: Created 9 years, 10 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 | « src/assembler.cc ('k') | 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 2010 the V8 project authors. All rights reserved. 1 // Copyright 2010 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 1187 matching lines...) Expand 10 before | Expand all | Expand 10 after
1198 // Synthetic properties are property lookups introduced by the system, 1198 // Synthetic properties are property lookups introduced by the system,
1199 // to objects that aren't visible to the user. Function calls to synthetic 1199 // to objects that aren't visible to the user. Function calls to synthetic
1200 // properties should use the global object as receiver, not the base object 1200 // properties should use the global object as receiver, not the base object
1201 // of the resolved Reference. 1201 // of the resolved Reference.
1202 enum Type { NORMAL, SYNTHETIC }; 1202 enum Type { NORMAL, SYNTHETIC };
1203 Property(Expression* obj, Expression* key, int pos, Type type = NORMAL) 1203 Property(Expression* obj, Expression* key, int pos, Type type = NORMAL)
1204 : obj_(obj), 1204 : obj_(obj),
1205 key_(key), 1205 key_(key),
1206 pos_(pos), 1206 pos_(pos),
1207 type_(type), 1207 type_(type),
1208 receiver_types_(NULL),
1208 is_monomorphic_(false), 1209 is_monomorphic_(false),
1209 receiver_types_(NULL),
1210 is_array_length_(false), 1210 is_array_length_(false),
1211 is_string_length_(false),
1211 is_function_prototype_(false), 1212 is_function_prototype_(false),
1212 is_arguments_access_(false) { } 1213 is_arguments_access_(false) { }
1213 1214
1214 DECLARE_NODE_TYPE(Property) 1215 DECLARE_NODE_TYPE(Property)
1215 1216
1216 virtual bool IsValidLeftHandSide() { return true; } 1217 virtual bool IsValidLeftHandSide() { return true; }
1217 virtual bool IsInlineable() const; 1218 virtual bool IsInlineable() const;
1218 1219
1219 Expression* obj() const { return obj_; } 1220 Expression* obj() const { return obj_; }
1220 Expression* key() const { return key_; } 1221 Expression* key() const { return key_; }
1221 int position() const { return pos_; } 1222 int position() const { return pos_; }
1222 bool is_synthetic() const { return type_ == SYNTHETIC; } 1223 bool is_synthetic() const { return type_ == SYNTHETIC; }
1223 1224
1225 bool IsStringLength() const { return is_string_length_; }
1224 bool IsFunctionPrototype() const { return is_function_prototype_; } 1226 bool IsFunctionPrototype() const { return is_function_prototype_; }
1225 1227
1226 // Marks that this is actually an argument rewritten to a keyed property 1228 // Marks that this is actually an argument rewritten to a keyed property
1227 // accessing the argument through the arguments shadow object. 1229 // accessing the argument through the arguments shadow object.
1228 void set_is_arguments_access(bool is_arguments_access) { 1230 void set_is_arguments_access(bool is_arguments_access) {
1229 is_arguments_access_ = is_arguments_access; 1231 is_arguments_access_ = is_arguments_access;
1230 } 1232 }
1231 bool is_arguments_access() const { return is_arguments_access_; } 1233 bool is_arguments_access() const { return is_arguments_access_; }
1232 1234
1233 // Type feedback information. 1235 // Type feedback information.
1234 void RecordTypeFeedback(TypeFeedbackOracle* oracle); 1236 void RecordTypeFeedback(TypeFeedbackOracle* oracle);
1235 virtual bool IsMonomorphic() { return is_monomorphic_; } 1237 virtual bool IsMonomorphic() { return is_monomorphic_; }
1236 virtual ZoneMapList* GetReceiverTypes() { return receiver_types_; } 1238 virtual ZoneMapList* GetReceiverTypes() { return receiver_types_; }
1237 virtual bool IsArrayLength() { return is_array_length_; } 1239 virtual bool IsArrayLength() { return is_array_length_; }
1238 virtual Handle<Map> GetMonomorphicReceiverType() { 1240 virtual Handle<Map> GetMonomorphicReceiverType() {
1239 return monomorphic_receiver_type_; 1241 return monomorphic_receiver_type_;
1240 } 1242 }
1241 1243
1242 // Returns a property singleton property access on 'this'. Used 1244 // Returns a property singleton property access on 'this'. Used
1243 // during preparsing. 1245 // during preparsing.
1244 static Property* this_property() { return &this_property_; } 1246 static Property* this_property() { return &this_property_; }
1245 1247
1246 private: 1248 private:
1247 Expression* obj_; 1249 Expression* obj_;
1248 Expression* key_; 1250 Expression* key_;
1249 int pos_; 1251 int pos_;
1250 Type type_; 1252 Type type_;
1251 1253
1252 bool is_monomorphic_;
1253 ZoneMapList* receiver_types_; 1254 ZoneMapList* receiver_types_;
1254 bool is_array_length_; 1255 bool is_monomorphic_ : 1;
1255 bool is_function_prototype_; 1256 bool is_array_length_ : 1;
1256 bool is_arguments_access_; 1257 bool is_string_length_ : 1;
1258 bool is_function_prototype_ : 1;
1259 bool is_arguments_access_ : 1;
1257 Handle<Map> monomorphic_receiver_type_; 1260 Handle<Map> monomorphic_receiver_type_;
1258 1261
1259 // Dummy property used during preparsing. 1262 // Dummy property used during preparsing.
1260 static Property this_property_; 1263 static Property this_property_;
1261 }; 1264 };
1262 1265
1263 1266
1264 class Call: public Expression { 1267 class Call: public Expression {
1265 public: 1268 public:
1266 Call(Expression* expression, ZoneList<Expression*>* arguments, int pos) 1269 Call(Expression* expression, ZoneList<Expression*>* arguments, int pos)
1267 : expression_(expression), 1270 : expression_(expression),
1268 arguments_(arguments), 1271 arguments_(arguments),
1269 pos_(pos), 1272 pos_(pos),
1270 is_monomorphic_(false), 1273 is_monomorphic_(false),
1274 check_type_(RECEIVER_MAP_CHECK),
1271 receiver_types_(NULL), 1275 receiver_types_(NULL),
1272 return_id_(GetNextId()) { 1276 return_id_(GetNextId()) {
1273 } 1277 }
1274 1278
1275 DECLARE_NODE_TYPE(Call) 1279 DECLARE_NODE_TYPE(Call)
1276 1280
1277 virtual bool IsInlineable() const; 1281 virtual bool IsInlineable() const;
1278 1282
1279 Expression* expression() const { return expression_; } 1283 Expression* expression() const { return expression_; }
1280 ZoneList<Expression*>* arguments() const { return arguments_; } 1284 ZoneList<Expression*>* arguments() const { return arguments_; }
1281 int position() { return pos_; } 1285 int position() { return pos_; }
1282 1286
1283 void RecordTypeFeedback(TypeFeedbackOracle* oracle); 1287 void RecordTypeFeedback(TypeFeedbackOracle* oracle);
1284 virtual ZoneMapList* GetReceiverTypes() { return receiver_types_; } 1288 virtual ZoneMapList* GetReceiverTypes() { return receiver_types_; }
1285 virtual bool IsMonomorphic() { return is_monomorphic_; } 1289 virtual bool IsMonomorphic() { return is_monomorphic_; }
1290 CheckType check_type() const { return check_type_; }
1286 Handle<JSFunction> target() { return target_; } 1291 Handle<JSFunction> target() { return target_; }
1287 Handle<JSObject> holder() { return holder_; } 1292 Handle<JSObject> holder() { return holder_; }
1288 Handle<JSGlobalPropertyCell> cell() { return cell_; } 1293 Handle<JSGlobalPropertyCell> cell() { return cell_; }
1289 1294
1290 bool ComputeTarget(Handle<Map> type, Handle<String> name); 1295 bool ComputeTarget(Handle<Map> type, Handle<String> name);
1291 bool ComputeGlobalTarget(Handle<GlobalObject> global, Handle<String> name); 1296 bool ComputeGlobalTarget(Handle<GlobalObject> global, Handle<String> name);
1292 1297
1293 // Bailout support. 1298 // Bailout support.
1294 int ReturnId() const { return return_id_; } 1299 int ReturnId() const { return return_id_; }
1295 1300
1296 static Call* sentinel() { return &sentinel_; } 1301 static Call* sentinel() { return &sentinel_; }
1297 1302
1298 #ifdef DEBUG 1303 #ifdef DEBUG
1299 // Used to assert that the FullCodeGenerator records the return site. 1304 // Used to assert that the FullCodeGenerator records the return site.
1300 bool return_is_recorded_; 1305 bool return_is_recorded_;
1301 #endif 1306 #endif
1302 1307
1303 private: 1308 private:
1304 Expression* expression_; 1309 Expression* expression_;
1305 ZoneList<Expression*>* arguments_; 1310 ZoneList<Expression*>* arguments_;
1306 int pos_; 1311 int pos_;
1307 1312
1308 bool is_monomorphic_; 1313 bool is_monomorphic_;
1314 CheckType check_type_;
1309 ZoneMapList* receiver_types_; 1315 ZoneMapList* receiver_types_;
1310 Handle<JSFunction> target_; 1316 Handle<JSFunction> target_;
1311 Handle<JSObject> holder_; 1317 Handle<JSObject> holder_;
1312 Handle<JSGlobalPropertyCell> cell_; 1318 Handle<JSGlobalPropertyCell> cell_;
1313 1319
1314 int return_id_; 1320 int return_id_;
1315 1321
1316 static Call sentinel_; 1322 static Call sentinel_;
1317 }; 1323 };
1318 1324
(...skipping 66 matching lines...) Expand 10 before | Expand all | Expand 10 after
1385 Expression* expression_; 1391 Expression* expression_;
1386 }; 1392 };
1387 1393
1388 1394
1389 class BinaryOperation: public Expression { 1395 class BinaryOperation: public Expression {
1390 public: 1396 public:
1391 BinaryOperation(Token::Value op, 1397 BinaryOperation(Token::Value op,
1392 Expression* left, 1398 Expression* left,
1393 Expression* right, 1399 Expression* right,
1394 int pos) 1400 int pos)
1395 : op_(op), left_(left), right_(right), pos_(pos), is_smi_only_(false) { 1401 : op_(op), left_(left), right_(right), pos_(pos) {
1396 ASSERT(Token::IsBinaryOp(op)); 1402 ASSERT(Token::IsBinaryOp(op));
1397 right_id_ = (op == Token::AND || op == Token::OR) 1403 right_id_ = (op == Token::AND || op == Token::OR)
1398 ? static_cast<int>(GetNextId()) 1404 ? static_cast<int>(GetNextId())
1399 : AstNode::kNoNumber; 1405 : AstNode::kNoNumber;
1400 } 1406 }
1401 1407
1402 // Create the binary operation corresponding to a compound assignment. 1408 // Create the binary operation corresponding to a compound assignment.
1403 explicit BinaryOperation(Assignment* assignment); 1409 explicit BinaryOperation(Assignment* assignment);
1404 1410
1405 DECLARE_NODE_TYPE(BinaryOperation) 1411 DECLARE_NODE_TYPE(BinaryOperation)
1406 1412
1407 virtual bool IsInlineable() const; 1413 virtual bool IsInlineable() const;
1408 1414
1409 virtual bool ResultOverwriteAllowed(); 1415 virtual bool ResultOverwriteAllowed();
1410 1416
1411 Token::Value op() const { return op_; } 1417 Token::Value op() const { return op_; }
1412 Expression* left() const { return left_; } 1418 Expression* left() const { return left_; }
1413 Expression* right() const { return right_; } 1419 Expression* right() const { return right_; }
1414 int position() const { return pos_; } 1420 int position() const { return pos_; }
1415 1421
1416 // Type feedback information.
1417 void RecordTypeFeedback(TypeFeedbackOracle* oracle);
1418 bool IsSmiOnly() const { return is_smi_only_; }
1419
1420 // Bailout support. 1422 // Bailout support.
1421 int RightId() const { return right_id_; } 1423 int RightId() const { return right_id_; }
1422 1424
1423 private: 1425 private:
1424 Token::Value op_; 1426 Token::Value op_;
1425 Expression* left_; 1427 Expression* left_;
1426 Expression* right_; 1428 Expression* right_;
1427 int pos_; 1429 int pos_;
1428 bool is_smi_only_;
1429 // The short-circuit logical operations have an AST ID for their 1430 // The short-circuit logical operations have an AST ID for their
1430 // right-hand subexpression. 1431 // right-hand subexpression.
1431 int right_id_; 1432 int right_id_;
1432 }; 1433 };
1433 1434
1434 1435
1435 class IncrementOperation: public Expression { 1436 class IncrementOperation: public Expression {
1436 public: 1437 public:
1437 IncrementOperation(Token::Value op, Expression* expr) 1438 IncrementOperation(Token::Value op, Expression* expr)
1438 : op_(op), expression_(expr) { 1439 : op_(op), expression_(expr) {
(...skipping 226 matching lines...) Expand 10 before | Expand all | Expand 10 after
1665 Scope* scope, 1666 Scope* scope,
1666 ZoneList<Statement*>* body, 1667 ZoneList<Statement*>* body,
1667 int materialized_literal_count, 1668 int materialized_literal_count,
1668 int expected_property_count, 1669 int expected_property_count,
1669 bool has_only_simple_this_property_assignments, 1670 bool has_only_simple_this_property_assignments,
1670 Handle<FixedArray> this_property_assignments, 1671 Handle<FixedArray> this_property_assignments,
1671 int num_parameters, 1672 int num_parameters,
1672 int start_position, 1673 int start_position,
1673 int end_position, 1674 int end_position,
1674 bool is_expression, 1675 bool is_expression,
1675 bool contains_loops) 1676 bool contains_loops,
1677 bool strict_mode)
1676 : name_(name), 1678 : name_(name),
1677 scope_(scope), 1679 scope_(scope),
1678 body_(body), 1680 body_(body),
1679 materialized_literal_count_(materialized_literal_count), 1681 materialized_literal_count_(materialized_literal_count),
1680 expected_property_count_(expected_property_count), 1682 expected_property_count_(expected_property_count),
1681 has_only_simple_this_property_assignments_( 1683 has_only_simple_this_property_assignments_(
1682 has_only_simple_this_property_assignments), 1684 has_only_simple_this_property_assignments),
1683 this_property_assignments_(this_property_assignments), 1685 this_property_assignments_(this_property_assignments),
1684 num_parameters_(num_parameters), 1686 num_parameters_(num_parameters),
1685 start_position_(start_position), 1687 start_position_(start_position),
1686 end_position_(end_position), 1688 end_position_(end_position),
1687 is_expression_(is_expression), 1689 is_expression_(is_expression),
1688 contains_loops_(contains_loops), 1690 contains_loops_(contains_loops),
1691 strict_mode_(strict_mode),
1689 function_token_position_(RelocInfo::kNoPosition), 1692 function_token_position_(RelocInfo::kNoPosition),
1690 inferred_name_(Heap::empty_string()), 1693 inferred_name_(Heap::empty_string()),
1691 try_full_codegen_(false), 1694 try_full_codegen_(false),
1692 pretenure_(false) { } 1695 pretenure_(false) { }
1693 1696
1694 DECLARE_NODE_TYPE(FunctionLiteral) 1697 DECLARE_NODE_TYPE(FunctionLiteral)
1695 1698
1696 Handle<String> name() const { return name_; } 1699 Handle<String> name() const { return name_; }
1697 Scope* scope() const { return scope_; } 1700 Scope* scope() const { return scope_; }
1698 ZoneList<Statement*>* body() const { return body_; } 1701 ZoneList<Statement*>* body() const { return body_; }
1699 void set_function_token_position(int pos) { function_token_position_ = pos; } 1702 void set_function_token_position(int pos) { function_token_position_ = pos; }
1700 int function_token_position() const { return function_token_position_; } 1703 int function_token_position() const { return function_token_position_; }
1701 int start_position() const { return start_position_; } 1704 int start_position() const { return start_position_; }
1702 int end_position() const { return end_position_; } 1705 int end_position() const { return end_position_; }
1703 bool is_expression() const { return is_expression_; } 1706 bool is_expression() const { return is_expression_; }
1704 bool contains_loops() const { return contains_loops_; } 1707 bool contains_loops() const { return contains_loops_; }
1708 bool strict_mode() const { return strict_mode_; }
1705 1709
1706 int materialized_literal_count() { return materialized_literal_count_; } 1710 int materialized_literal_count() { return materialized_literal_count_; }
1707 int expected_property_count() { return expected_property_count_; } 1711 int expected_property_count() { return expected_property_count_; }
1708 bool has_only_simple_this_property_assignments() { 1712 bool has_only_simple_this_property_assignments() {
1709 return has_only_simple_this_property_assignments_; 1713 return has_only_simple_this_property_assignments_;
1710 } 1714 }
1711 Handle<FixedArray> this_property_assignments() { 1715 Handle<FixedArray> this_property_assignments() {
1712 return this_property_assignments_; 1716 return this_property_assignments_;
1713 } 1717 }
1714 int num_parameters() { return num_parameters_; } 1718 int num_parameters() { return num_parameters_; }
1715 1719
1716 bool AllowsLazyCompilation(); 1720 bool AllowsLazyCompilation();
1717 bool AllowOptimize();
1718 1721
1719 Handle<String> debug_name() const { 1722 Handle<String> debug_name() const {
1720 if (name_->length() > 0) return name_; 1723 if (name_->length() > 0) return name_;
1721 return inferred_name(); 1724 return inferred_name();
1722 } 1725 }
1723 1726
1724 Handle<String> inferred_name() const { return inferred_name_; } 1727 Handle<String> inferred_name() const { return inferred_name_; }
1725 void set_inferred_name(Handle<String> inferred_name) { 1728 void set_inferred_name(Handle<String> inferred_name) {
1726 inferred_name_ = inferred_name; 1729 inferred_name_ = inferred_name;
1727 } 1730 }
(...skipping 10 matching lines...) Expand all
1738 ZoneList<Statement*>* body_; 1741 ZoneList<Statement*>* body_;
1739 int materialized_literal_count_; 1742 int materialized_literal_count_;
1740 int expected_property_count_; 1743 int expected_property_count_;
1741 bool has_only_simple_this_property_assignments_; 1744 bool has_only_simple_this_property_assignments_;
1742 Handle<FixedArray> this_property_assignments_; 1745 Handle<FixedArray> this_property_assignments_;
1743 int num_parameters_; 1746 int num_parameters_;
1744 int start_position_; 1747 int start_position_;
1745 int end_position_; 1748 int end_position_;
1746 bool is_expression_; 1749 bool is_expression_;
1747 bool contains_loops_; 1750 bool contains_loops_;
1751 bool strict_mode_;
1748 int function_token_position_; 1752 int function_token_position_;
1749 Handle<String> inferred_name_; 1753 Handle<String> inferred_name_;
1750 bool try_full_codegen_; 1754 bool try_full_codegen_;
1751 bool pretenure_; 1755 bool pretenure_;
1752 }; 1756 };
1753 1757
1754 1758
1755 class SharedFunctionInfoLiteral: public Expression { 1759 class SharedFunctionInfoLiteral: public Expression {
1756 public: 1760 public:
1757 explicit SharedFunctionInfoLiteral( 1761 explicit SharedFunctionInfoLiteral(
(...skipping 406 matching lines...) Expand 10 before | Expand all | Expand 10 after
2164 AST_NODE_LIST(DEF_VISIT) 2168 AST_NODE_LIST(DEF_VISIT)
2165 #undef DEF_VISIT 2169 #undef DEF_VISIT
2166 2170
2167 private: 2171 private:
2168 bool stack_overflow_; 2172 bool stack_overflow_;
2169 }; 2173 };
2170 2174
2171 } } // namespace v8::internal 2175 } } // namespace v8::internal
2172 2176
2173 #endif // V8_AST_H_ 2177 #endif // V8_AST_H_
OLDNEW
« no previous file with comments | « src/assembler.cc ('k') | src/ast.cc » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698