| OLD | NEW |
| 1 // Copyright 2011 the V8 project authors. All rights reserved. | 1 // Copyright 2011 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 1209 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 1220 | 1220 |
| 1221 SmallMapList receiver_types_; | 1221 SmallMapList receiver_types_; |
| 1222 bool is_monomorphic_ : 1; | 1222 bool is_monomorphic_ : 1; |
| 1223 bool is_array_length_ : 1; | 1223 bool is_array_length_ : 1; |
| 1224 bool is_string_length_ : 1; | 1224 bool is_string_length_ : 1; |
| 1225 bool is_string_access_ : 1; | 1225 bool is_string_access_ : 1; |
| 1226 bool is_function_prototype_ : 1; | 1226 bool is_function_prototype_ : 1; |
| 1227 }; | 1227 }; |
| 1228 | 1228 |
| 1229 | 1229 |
| 1230 class Call: public Expression { | 1230 // Base class for normal calls and constructor calls. |
| 1231 class CallBase: public Expression { |
| 1231 public: | 1232 public: |
| 1232 Call(Isolate* isolate, | 1233 CallBase(Isolate* isolate, |
| 1233 Expression* expression, | 1234 Expression* expression, |
| 1234 ZoneList<Expression*>* arguments, | 1235 ZoneList<Expression*>* arguments, |
| 1235 int pos) | 1236 int pos) |
| 1236 : Expression(isolate), | 1237 : Expression(isolate), |
| 1237 expression_(expression), | 1238 expression_(expression), |
| 1238 arguments_(arguments), | 1239 arguments_(arguments), |
| 1239 pos_(pos), | 1240 pos_(pos), |
| 1240 is_monomorphic_(false), | 1241 return_id_(GetNextId(isolate)) {} |
| 1241 check_type_(RECEIVER_MAP_CHECK), | |
| 1242 return_id_(GetNextId(isolate)) { | |
| 1243 } | |
| 1244 | |
| 1245 DECLARE_NODE_TYPE(Call) | |
| 1246 | 1242 |
| 1247 virtual bool IsInlineable() const; | 1243 virtual bool IsInlineable() const; |
| 1248 | 1244 |
| 1249 Expression* expression() const { return expression_; } | 1245 Expression* expression() const { return expression_; } |
| 1250 ZoneList<Expression*>* arguments() const { return arguments_; } | 1246 ZoneList<Expression*>* arguments() const { return arguments_; } |
| 1251 virtual int position() const { return pos_; } | 1247 virtual int position() const { return pos_; } |
| 1252 | 1248 |
| 1253 void RecordTypeFeedback(TypeFeedbackOracle* oracle, | |
| 1254 CallKind call_kind); | |
| 1255 virtual SmallMapList* GetReceiverTypes() { return &receiver_types_; } | |
| 1256 virtual bool IsMonomorphic() { return is_monomorphic_; } | |
| 1257 CheckType check_type() const { return check_type_; } | |
| 1258 Handle<JSFunction> target() { return target_; } | |
| 1259 Handle<JSObject> holder() { return holder_; } | |
| 1260 Handle<JSGlobalPropertyCell> cell() { return cell_; } | |
| 1261 | |
| 1262 bool ComputeTarget(Handle<Map> type, Handle<String> name); | |
| 1263 bool ComputeGlobalTarget(Handle<GlobalObject> global, LookupResult* lookup); | |
| 1264 | |
| 1265 // Bailout support. | 1249 // Bailout support. |
| 1266 int ReturnId() const { return return_id_; } | 1250 int ReturnId() const { return return_id_; } |
| 1267 | 1251 |
| 1268 #ifdef DEBUG | 1252 #ifdef DEBUG |
| 1269 // Used to assert that the FullCodeGenerator records the return site. | 1253 // Used to assert that the FullCodeGenerator records the return site. |
| 1270 bool return_is_recorded_; | 1254 bool return_is_recorded_; |
| 1271 #endif | 1255 #endif |
| 1272 | 1256 |
| 1273 private: | 1257 private: |
| 1274 Expression* expression_; | 1258 Expression* expression_; |
| 1275 ZoneList<Expression*>* arguments_; | 1259 ZoneList<Expression*>* arguments_; |
| 1276 int pos_; | 1260 int pos_; |
| 1261 int return_id_; |
| 1262 }; |
| 1277 | 1263 |
| 1264 |
| 1265 class Call: public CallBase { |
| 1266 public: |
| 1267 Call(Isolate* isolate, |
| 1268 Expression* expression, |
| 1269 ZoneList<Expression*>* arguments, |
| 1270 int pos) |
| 1271 : CallBase(isolate, expression, arguments, pos), |
| 1272 is_monomorphic_(false), |
| 1273 check_type_(RECEIVER_MAP_CHECK) {} |
| 1274 |
| 1275 DECLARE_NODE_TYPE(Call) |
| 1276 |
| 1277 void RecordTypeFeedback(TypeFeedbackOracle* oracle, |
| 1278 CallKind call_kind); |
| 1279 virtual SmallMapList* GetReceiverTypes() { return &receiver_types_; } |
| 1280 virtual bool IsMonomorphic() { return is_monomorphic_; } |
| 1281 CheckType check_type() const { return check_type_; } |
| 1282 Handle<JSFunction> target() { return target_; } |
| 1283 Handle<JSObject> holder() { return holder_; } |
| 1284 Handle<JSGlobalPropertyCell> cell() { return cell_; } |
| 1285 |
| 1286 bool ComputeTarget(Handle<Map> type, Handle<String> name); |
| 1287 bool ComputeGlobalTarget(Handle<GlobalObject> global, LookupResult* lookup); |
| 1288 |
| 1289 private: |
| 1278 bool is_monomorphic_; | 1290 bool is_monomorphic_; |
| 1279 CheckType check_type_; | 1291 CheckType check_type_; |
| 1280 SmallMapList receiver_types_; | 1292 SmallMapList receiver_types_; |
| 1281 Handle<JSFunction> target_; | 1293 Handle<JSFunction> target_; |
| 1282 Handle<JSObject> holder_; | 1294 Handle<JSObject> holder_; |
| 1283 Handle<JSGlobalPropertyCell> cell_; | 1295 Handle<JSGlobalPropertyCell> cell_; |
| 1284 | |
| 1285 int return_id_; | |
| 1286 }; | 1296 }; |
| 1287 | 1297 |
| 1288 | 1298 |
| 1289 class CallNew: public Expression { | 1299 class CallNew: public CallBase { |
| 1290 public: | 1300 public: |
| 1291 CallNew(Isolate* isolate, | 1301 CallNew(Isolate* isolate, |
| 1292 Expression* expression, | 1302 Expression* expression, |
| 1293 ZoneList<Expression*>* arguments, | 1303 ZoneList<Expression*>* arguments, |
| 1294 int pos) | 1304 int pos) |
| 1295 : Expression(isolate), | 1305 : CallBase(isolate, expression, arguments, pos) {} |
| 1296 expression_(expression), | |
| 1297 arguments_(arguments), | |
| 1298 pos_(pos) { } | |
| 1299 | 1306 |
| 1300 DECLARE_NODE_TYPE(CallNew) | 1307 DECLARE_NODE_TYPE(CallNew) |
| 1301 | |
| 1302 virtual bool IsInlineable() const; | |
| 1303 | |
| 1304 Expression* expression() const { return expression_; } | |
| 1305 ZoneList<Expression*>* arguments() const { return arguments_; } | |
| 1306 virtual int position() const { return pos_; } | |
| 1307 | |
| 1308 private: | |
| 1309 Expression* expression_; | |
| 1310 ZoneList<Expression*>* arguments_; | |
| 1311 int pos_; | |
| 1312 }; | 1308 }; |
| 1313 | 1309 |
| 1314 | 1310 |
| 1315 // The CallRuntime class does not represent any official JavaScript | 1311 // The CallRuntime class does not represent any official JavaScript |
| 1316 // language construct. Instead it is used to call a C or JS function | 1312 // language construct. Instead it is used to call a C or JS function |
| 1317 // with a set of arguments. This is used from the builtins that are | 1313 // with a set of arguments. This is used from the builtins that are |
| 1318 // implemented in JavaScript (see "v8natives.js"). | 1314 // implemented in JavaScript (see "v8natives.js"). |
| 1319 class CallRuntime: public Expression { | 1315 class CallRuntime: public Expression { |
| 1320 public: | 1316 public: |
| 1321 CallRuntime(Isolate* isolate, | 1317 CallRuntime(Isolate* isolate, |
| (...skipping 852 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 2174 | 2170 |
| 2175 private: | 2171 private: |
| 2176 Isolate* isolate_; | 2172 Isolate* isolate_; |
| 2177 bool stack_overflow_; | 2173 bool stack_overflow_; |
| 2178 }; | 2174 }; |
| 2179 | 2175 |
| 2180 | 2176 |
| 2181 } } // namespace v8::internal | 2177 } } // namespace v8::internal |
| 2182 | 2178 |
| 2183 #endif // V8_AST_H_ | 2179 #endif // V8_AST_H_ |
| OLD | NEW |