| OLD | NEW |
| 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 1314 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 1325 bool emit_store_; | 1325 bool emit_store_; |
| 1326 Handle<Map> receiver_type_; | 1326 Handle<Map> receiver_type_; |
| 1327 }; | 1327 }; |
| 1328 | 1328 |
| 1329 DECLARE_NODE_TYPE(ObjectLiteral) | 1329 DECLARE_NODE_TYPE(ObjectLiteral) |
| 1330 | 1330 |
| 1331 Handle<FixedArray> constant_properties() const { | 1331 Handle<FixedArray> constant_properties() const { |
| 1332 return constant_properties_; | 1332 return constant_properties_; |
| 1333 } | 1333 } |
| 1334 ZoneList<Property*>* properties() const { return properties_; } | 1334 ZoneList<Property*>* properties() const { return properties_; } |
| 1335 | |
| 1336 bool fast_elements() const { return fast_elements_; } | 1335 bool fast_elements() const { return fast_elements_; } |
| 1337 | 1336 bool may_store_doubles() const { return may_store_doubles_; } |
| 1338 bool has_function() { return has_function_; } | 1337 bool has_function() const { return has_function_; } |
| 1339 | 1338 |
| 1340 // Mark all computed expressions that are bound to a key that | 1339 // Mark all computed expressions that are bound to a key that |
| 1341 // is shadowed by a later occurrence of the same key. For the | 1340 // is shadowed by a later occurrence of the same key. For the |
| 1342 // marked expressions, no store code is emitted. | 1341 // marked expressions, no store code is emitted. |
| 1343 void CalculateEmitStore(Zone* zone); | 1342 void CalculateEmitStore(Zone* zone); |
| 1344 | 1343 |
| 1345 enum Flags { | 1344 enum Flags { |
| 1346 kNoFlags = 0, | 1345 kNoFlags = 0, |
| 1347 kFastElements = 1, | 1346 kFastElements = 1, |
| 1348 kHasFunction = 1 << 1 | 1347 kHasFunction = 1 << 1 |
| 1349 }; | 1348 }; |
| 1350 | 1349 |
| 1351 struct Accessors: public ZoneObject { | 1350 struct Accessors: public ZoneObject { |
| 1352 Accessors() : getter(NULL), setter(NULL) { } | 1351 Accessors() : getter(NULL), setter(NULL) { } |
| 1353 Expression* getter; | 1352 Expression* getter; |
| 1354 Expression* setter; | 1353 Expression* setter; |
| 1355 }; | 1354 }; |
| 1356 | 1355 |
| 1357 protected: | 1356 protected: |
| 1358 ObjectLiteral(Isolate* isolate, | 1357 ObjectLiteral(Isolate* isolate, |
| 1359 Handle<FixedArray> constant_properties, | 1358 Handle<FixedArray> constant_properties, |
| 1360 ZoneList<Property*>* properties, | 1359 ZoneList<Property*>* properties, |
| 1361 int literal_index, | 1360 int literal_index, |
| 1362 bool is_simple, | 1361 bool is_simple, |
| 1363 bool fast_elements, | 1362 bool fast_elements, |
| 1364 int depth, | 1363 int depth, |
| 1364 bool may_store_doubles, |
| 1365 bool has_function) | 1365 bool has_function) |
| 1366 : MaterializedLiteral(isolate, literal_index, is_simple, depth), | 1366 : MaterializedLiteral(isolate, literal_index, is_simple, depth), |
| 1367 constant_properties_(constant_properties), | 1367 constant_properties_(constant_properties), |
| 1368 properties_(properties), | 1368 properties_(properties), |
| 1369 fast_elements_(fast_elements), | 1369 fast_elements_(fast_elements), |
| 1370 may_store_doubles_(may_store_doubles), |
| 1370 has_function_(has_function) {} | 1371 has_function_(has_function) {} |
| 1371 | 1372 |
| 1372 private: | 1373 private: |
| 1373 Handle<FixedArray> constant_properties_; | 1374 Handle<FixedArray> constant_properties_; |
| 1374 ZoneList<Property*>* properties_; | 1375 ZoneList<Property*>* properties_; |
| 1375 bool fast_elements_; | 1376 bool fast_elements_; |
| 1377 bool may_store_doubles_; |
| 1376 bool has_function_; | 1378 bool has_function_; |
| 1377 }; | 1379 }; |
| 1378 | 1380 |
| 1379 | 1381 |
| 1380 // Node for capturing a regexp literal. | 1382 // Node for capturing a regexp literal. |
| 1381 class RegExpLiteral: public MaterializedLiteral { | 1383 class RegExpLiteral: public MaterializedLiteral { |
| 1382 public: | 1384 public: |
| 1383 DECLARE_NODE_TYPE(RegExpLiteral) | 1385 DECLARE_NODE_TYPE(RegExpLiteral) |
| 1384 | 1386 |
| 1385 Handle<String> pattern() const { return pattern_; } | 1387 Handle<String> pattern() const { return pattern_; } |
| (...skipping 1464 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 2850 return NewLiteral(isolate_->factory()->NewNumber(number, TENURED)); | 2852 return NewLiteral(isolate_->factory()->NewNumber(number, TENURED)); |
| 2851 } | 2853 } |
| 2852 | 2854 |
| 2853 ObjectLiteral* NewObjectLiteral( | 2855 ObjectLiteral* NewObjectLiteral( |
| 2854 Handle<FixedArray> constant_properties, | 2856 Handle<FixedArray> constant_properties, |
| 2855 ZoneList<ObjectLiteral::Property*>* properties, | 2857 ZoneList<ObjectLiteral::Property*>* properties, |
| 2856 int literal_index, | 2858 int literal_index, |
| 2857 bool is_simple, | 2859 bool is_simple, |
| 2858 bool fast_elements, | 2860 bool fast_elements, |
| 2859 int depth, | 2861 int depth, |
| 2862 bool may_store_doubles, |
| 2860 bool has_function) { | 2863 bool has_function) { |
| 2861 ObjectLiteral* lit = new(zone_) ObjectLiteral( | 2864 ObjectLiteral* lit = new(zone_) ObjectLiteral( |
| 2862 isolate_, constant_properties, properties, literal_index, | 2865 isolate_, constant_properties, properties, literal_index, |
| 2863 is_simple, fast_elements, depth, has_function); | 2866 is_simple, fast_elements, depth, may_store_doubles, has_function); |
| 2864 VISIT_AND_RETURN(ObjectLiteral, lit) | 2867 VISIT_AND_RETURN(ObjectLiteral, lit) |
| 2865 } | 2868 } |
| 2866 | 2869 |
| 2867 ObjectLiteral::Property* NewObjectLiteralProperty(bool is_getter, | 2870 ObjectLiteral::Property* NewObjectLiteralProperty(bool is_getter, |
| 2868 FunctionLiteral* value) { | 2871 FunctionLiteral* value) { |
| 2869 ObjectLiteral::Property* prop = | 2872 ObjectLiteral::Property* prop = |
| 2870 new(zone_) ObjectLiteral::Property(is_getter, value); | 2873 new(zone_) ObjectLiteral::Property(is_getter, value); |
| 2871 prop->set_key(NewLiteral(value->name())); | 2874 prop->set_key(NewLiteral(value->name())); |
| 2872 return prop; // Not an AST node, will not be visited. | 2875 return prop; // Not an AST node, will not be visited. |
| 2873 } | 2876 } |
| (...skipping 172 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 3046 private: | 3049 private: |
| 3047 Isolate* isolate_; | 3050 Isolate* isolate_; |
| 3048 Zone* zone_; | 3051 Zone* zone_; |
| 3049 Visitor visitor_; | 3052 Visitor visitor_; |
| 3050 }; | 3053 }; |
| 3051 | 3054 |
| 3052 | 3055 |
| 3053 } } // namespace v8::internal | 3056 } } // namespace v8::internal |
| 3054 | 3057 |
| 3055 #endif // V8_AST_H_ | 3058 #endif // V8_AST_H_ |
| OLD | NEW |