| OLD | NEW |
| 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 1196 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 1207 // of the resolved Reference. | 1207 // of the resolved Reference. |
| 1208 enum Type { NORMAL, SYNTHETIC }; | 1208 enum Type { NORMAL, SYNTHETIC }; |
| 1209 Property(Expression* obj, Expression* key, int pos, Type type = NORMAL) | 1209 Property(Expression* obj, Expression* key, int pos, Type type = NORMAL) |
| 1210 : obj_(obj), | 1210 : obj_(obj), |
| 1211 key_(key), | 1211 key_(key), |
| 1212 pos_(pos), | 1212 pos_(pos), |
| 1213 type_(type), | 1213 type_(type), |
| 1214 is_monomorphic_(false), | 1214 is_monomorphic_(false), |
| 1215 receiver_types_(NULL), | 1215 receiver_types_(NULL), |
| 1216 is_array_length_(false), | 1216 is_array_length_(false), |
| 1217 is_function_prototype_(false), |
| 1217 is_arguments_access_(false) { } | 1218 is_arguments_access_(false) { } |
| 1218 | 1219 |
| 1219 DECLARE_NODE_TYPE(Property) | 1220 DECLARE_NODE_TYPE(Property) |
| 1220 | 1221 |
| 1221 virtual bool IsValidLeftHandSide() { return true; } | 1222 virtual bool IsValidLeftHandSide() { return true; } |
| 1222 virtual bool IsInlineable() const; | 1223 virtual bool IsInlineable() const; |
| 1223 | 1224 |
| 1224 Expression* obj() const { return obj_; } | 1225 Expression* obj() const { return obj_; } |
| 1225 Expression* key() const { return key_; } | 1226 Expression* key() const { return key_; } |
| 1226 int position() const { return pos_; } | 1227 int position() const { return pos_; } |
| 1227 bool is_synthetic() const { return type_ == SYNTHETIC; } | 1228 bool is_synthetic() const { return type_ == SYNTHETIC; } |
| 1228 | 1229 |
| 1230 bool IsFunctionPrototype() const { return is_function_prototype_; } |
| 1231 |
| 1229 // Marks that this is actually an argument rewritten to a keyed property | 1232 // Marks that this is actually an argument rewritten to a keyed property |
| 1230 // accessing the argument through the arguments shadow object. | 1233 // accessing the argument through the arguments shadow object. |
| 1231 void set_is_arguments_access(bool is_arguments_access) { | 1234 void set_is_arguments_access(bool is_arguments_access) { |
| 1232 is_arguments_access_ = is_arguments_access; | 1235 is_arguments_access_ = is_arguments_access; |
| 1233 } | 1236 } |
| 1234 bool is_arguments_access() const { return is_arguments_access_; } | 1237 bool is_arguments_access() const { return is_arguments_access_; } |
| 1235 | 1238 |
| 1236 // Type feedback information. | 1239 // Type feedback information. |
| 1237 void RecordTypeFeedback(TypeFeedbackOracle* oracle); | 1240 void RecordTypeFeedback(TypeFeedbackOracle* oracle); |
| 1238 virtual bool IsMonomorphic() { return is_monomorphic_; } | 1241 virtual bool IsMonomorphic() { return is_monomorphic_; } |
| 1239 virtual ZoneMapList* GetReceiverTypes() { return receiver_types_; } | 1242 virtual ZoneMapList* GetReceiverTypes() { return receiver_types_; } |
| 1240 virtual bool IsArrayLength() { return is_array_length_; } | 1243 virtual bool IsArrayLength() { return is_array_length_; } |
| 1241 virtual Handle<Map> GetMonomorphicReceiverType() { | 1244 virtual Handle<Map> GetMonomorphicReceiverType() { |
| 1242 return monomorphic_receiver_type_; | 1245 return monomorphic_receiver_type_; |
| 1243 } | 1246 } |
| 1244 | 1247 |
| 1245 private: | 1248 private: |
| 1246 Expression* obj_; | 1249 Expression* obj_; |
| 1247 Expression* key_; | 1250 Expression* key_; |
| 1248 int pos_; | 1251 int pos_; |
| 1249 Type type_; | 1252 Type type_; |
| 1250 | 1253 |
| 1251 bool is_monomorphic_; | 1254 bool is_monomorphic_; |
| 1252 ZoneMapList* receiver_types_; | 1255 ZoneMapList* receiver_types_; |
| 1253 bool is_array_length_; | 1256 bool is_array_length_; |
| 1257 bool is_function_prototype_; |
| 1254 bool is_arguments_access_; | 1258 bool is_arguments_access_; |
| 1255 Handle<Map> monomorphic_receiver_type_; | 1259 Handle<Map> monomorphic_receiver_type_; |
| 1256 }; | 1260 }; |
| 1257 | 1261 |
| 1258 | 1262 |
| 1259 class Call: public Expression { | 1263 class Call: public Expression { |
| 1260 public: | 1264 public: |
| 1261 Call(Expression* expression, ZoneList<Expression*>* arguments, int pos) | 1265 Call(Expression* expression, ZoneList<Expression*>* arguments, int pos) |
| 1262 : expression_(expression), | 1266 : expression_(expression), |
| 1263 arguments_(arguments), | 1267 arguments_(arguments), |
| 1264 pos_(pos), | 1268 pos_(pos), |
| 1265 is_monomorphic_(false), | 1269 is_monomorphic_(false), |
| 1270 check_type_(RECEIVER_MAP_CHECK), |
| 1266 receiver_types_(NULL), | 1271 receiver_types_(NULL), |
| 1267 return_id_(GetNextId()) { | 1272 return_id_(GetNextId()) { |
| 1268 } | 1273 } |
| 1269 | 1274 |
| 1270 DECLARE_NODE_TYPE(Call) | 1275 DECLARE_NODE_TYPE(Call) |
| 1271 | 1276 |
| 1272 virtual bool IsInlineable() const; | 1277 virtual bool IsInlineable() const; |
| 1273 | 1278 |
| 1274 Expression* expression() const { return expression_; } | 1279 Expression* expression() const { return expression_; } |
| 1275 ZoneList<Expression*>* arguments() const { return arguments_; } | 1280 ZoneList<Expression*>* arguments() const { return arguments_; } |
| 1276 int position() { return pos_; } | 1281 int position() { return pos_; } |
| 1277 | 1282 |
| 1278 void RecordTypeFeedback(TypeFeedbackOracle* oracle); | 1283 void RecordTypeFeedback(TypeFeedbackOracle* oracle); |
| 1279 virtual ZoneMapList* GetReceiverTypes() { return receiver_types_; } | 1284 virtual ZoneMapList* GetReceiverTypes() { return receiver_types_; } |
| 1280 virtual bool IsMonomorphic() { return is_monomorphic_; } | 1285 virtual bool IsMonomorphic() { return is_monomorphic_; } |
| 1286 CheckType check_type() const { return check_type_; } |
| 1281 Handle<JSFunction> target() { return target_; } | 1287 Handle<JSFunction> target() { return target_; } |
| 1282 Handle<JSObject> holder() { return holder_; } | 1288 Handle<JSObject> holder() { return holder_; } |
| 1283 Handle<JSGlobalPropertyCell> cell() { return cell_; } | 1289 Handle<JSGlobalPropertyCell> cell() { return cell_; } |
| 1284 | 1290 |
| 1285 bool ComputeTarget(Handle<Map> type, Handle<String> name); | 1291 bool ComputeTarget(Handle<Map> type, Handle<String> name); |
| 1286 bool ComputeGlobalTarget(Handle<GlobalObject> global, Handle<String> name); | 1292 bool ComputeGlobalTarget(Handle<GlobalObject> global, Handle<String> name); |
| 1287 | 1293 |
| 1288 // Bailout support. | 1294 // Bailout support. |
| 1289 int ReturnId() const { return return_id_; } | 1295 int ReturnId() const { return return_id_; } |
| 1290 | 1296 |
| 1291 #ifdef DEBUG | 1297 #ifdef DEBUG |
| 1292 // Used to assert that the FullCodeGenerator records the return site. | 1298 // Used to assert that the FullCodeGenerator records the return site. |
| 1293 bool return_is_recorded_; | 1299 bool return_is_recorded_; |
| 1294 #endif | 1300 #endif |
| 1295 | 1301 |
| 1296 private: | 1302 private: |
| 1297 Expression* expression_; | 1303 Expression* expression_; |
| 1298 ZoneList<Expression*>* arguments_; | 1304 ZoneList<Expression*>* arguments_; |
| 1299 int pos_; | 1305 int pos_; |
| 1300 | 1306 |
| 1301 bool is_monomorphic_; | 1307 bool is_monomorphic_; |
| 1308 CheckType check_type_; |
| 1302 ZoneMapList* receiver_types_; | 1309 ZoneMapList* receiver_types_; |
| 1303 Handle<JSFunction> target_; | 1310 Handle<JSFunction> target_; |
| 1304 Handle<JSObject> holder_; | 1311 Handle<JSObject> holder_; |
| 1305 Handle<JSGlobalPropertyCell> cell_; | 1312 Handle<JSGlobalPropertyCell> cell_; |
| 1306 | 1313 |
| 1307 int return_id_; | 1314 int return_id_; |
| 1308 }; | 1315 }; |
| 1309 | 1316 |
| 1310 | 1317 |
| 1311 class AstSentinels { | 1318 class AstSentinels { |
| (...skipping 97 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 1409 | 1416 |
| 1410 class BinaryOperation: public Expression { | 1417 class BinaryOperation: public Expression { |
| 1411 public: | 1418 public: |
| 1412 BinaryOperation(Token::Value op, | 1419 BinaryOperation(Token::Value op, |
| 1413 Expression* left, | 1420 Expression* left, |
| 1414 Expression* right, | 1421 Expression* right, |
| 1415 int pos) | 1422 int pos) |
| 1416 : op_(op), left_(left), right_(right), pos_(pos), is_smi_only_(false) { | 1423 : op_(op), left_(left), right_(right), pos_(pos), is_smi_only_(false) { |
| 1417 ASSERT(Token::IsBinaryOp(op)); | 1424 ASSERT(Token::IsBinaryOp(op)); |
| 1418 right_id_ = (op == Token::AND || op == Token::OR) | 1425 right_id_ = (op == Token::AND || op == Token::OR) |
| 1419 ? GetNextId() | 1426 ? static_cast<int>(GetNextId()) |
| 1420 : AstNode::kNoNumber; | 1427 : AstNode::kNoNumber; |
| 1421 } | 1428 } |
| 1422 | 1429 |
| 1423 // Create the binary operation corresponding to a compound assignment. | 1430 // Create the binary operation corresponding to a compound assignment. |
| 1424 explicit BinaryOperation(Assignment* assignment); | 1431 explicit BinaryOperation(Assignment* assignment); |
| 1425 | 1432 |
| 1426 DECLARE_NODE_TYPE(BinaryOperation) | 1433 DECLARE_NODE_TYPE(BinaryOperation) |
| 1427 | 1434 |
| 1428 virtual bool IsInlineable() const; | 1435 virtual bool IsInlineable() const; |
| 1429 | 1436 |
| (...skipping 756 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 2186 #undef DEF_VISIT | 2193 #undef DEF_VISIT |
| 2187 | 2194 |
| 2188 private: | 2195 private: |
| 2189 bool stack_overflow_; | 2196 bool stack_overflow_; |
| 2190 }; | 2197 }; |
| 2191 | 2198 |
| 2192 | 2199 |
| 2193 } } // namespace v8::internal | 2200 } } // namespace v8::internal |
| 2194 | 2201 |
| 2195 #endif // V8_AST_H_ | 2202 #endif // V8_AST_H_ |
| OLD | NEW |