| 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 255 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 266 | 266 |
| 267 ZoneHashMap table(Literal::Match, ZoneHashMap::kDefaultHashMapCapacity, | 267 ZoneHashMap table(Literal::Match, ZoneHashMap::kDefaultHashMapCapacity, |
| 268 allocator); | 268 allocator); |
| 269 for (int i = properties()->length() - 1; i >= 0; i--) { | 269 for (int i = properties()->length() - 1; i >= 0; i--) { |
| 270 ObjectLiteral::Property* property = properties()->at(i); | 270 ObjectLiteral::Property* property = properties()->at(i); |
| 271 Literal* literal = property->key(); | 271 Literal* literal = property->key(); |
| 272 if (literal->value()->IsNull()) continue; | 272 if (literal->value()->IsNull()) continue; |
| 273 uint32_t hash = literal->Hash(); | 273 uint32_t hash = literal->Hash(); |
| 274 // If the key of a computed property is in the table, do not emit | 274 // If the key of a computed property is in the table, do not emit |
| 275 // a store for the property later. | 275 // a store for the property later. |
| 276 if (property->kind() == ObjectLiteral::Property::COMPUTED && | 276 if ((property->kind() == ObjectLiteral::Property::MATERIALIZED_LITERAL || |
| 277 property->kind() == ObjectLiteral::Property::COMPUTED) && |
| 277 table.Lookup(literal, hash, false, allocator) != NULL) { | 278 table.Lookup(literal, hash, false, allocator) != NULL) { |
| 278 property->set_emit_store(false); | 279 property->set_emit_store(false); |
| 279 } else { | 280 } else { |
| 280 // Add key to the table. | 281 // Add key to the table. |
| 281 table.Lookup(literal, hash, true, allocator); | 282 table.Lookup(literal, hash, true, allocator); |
| 282 } | 283 } |
| 283 } | 284 } |
| 284 } | 285 } |
| 285 | 286 |
| 286 | 287 |
| (...skipping 563 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 850 bool RegExpCapture::IsAnchoredAtEnd() { | 851 bool RegExpCapture::IsAnchoredAtEnd() { |
| 851 return body()->IsAnchoredAtEnd(); | 852 return body()->IsAnchoredAtEnd(); |
| 852 } | 853 } |
| 853 | 854 |
| 854 | 855 |
| 855 // Convert regular expression trees to a simple sexp representation. | 856 // Convert regular expression trees to a simple sexp representation. |
| 856 // This representation should be different from the input grammar | 857 // This representation should be different from the input grammar |
| 857 // in as many cases as possible, to make it more difficult for incorrect | 858 // in as many cases as possible, to make it more difficult for incorrect |
| 858 // parses to look as correct ones which is likely if the input and | 859 // parses to look as correct ones which is likely if the input and |
| 859 // output formats are alike. | 860 // output formats are alike. |
| 860 class RegExpUnparser: public RegExpVisitor { | 861 class RegExpUnparser V8_FINAL : public RegExpVisitor { |
| 861 public: | 862 public: |
| 862 explicit RegExpUnparser(Zone* zone); | 863 explicit RegExpUnparser(Zone* zone); |
| 863 void VisitCharacterRange(CharacterRange that); | 864 void VisitCharacterRange(CharacterRange that); |
| 864 SmartArrayPointer<const char> ToString() { return stream_.ToCString(); } | 865 SmartArrayPointer<const char> ToString() { return stream_.ToCString(); } |
| 865 #define MAKE_CASE(Name) virtual void* Visit##Name(RegExp##Name*, void* data); | 866 #define MAKE_CASE(Name) virtual void* Visit##Name(RegExp##Name*, \ |
| 867 void* data) V8_OVERRIDE; |
| 866 FOR_EACH_REG_EXP_TREE_TYPE(MAKE_CASE) | 868 FOR_EACH_REG_EXP_TREE_TYPE(MAKE_CASE) |
| 867 #undef MAKE_CASE | 869 #undef MAKE_CASE |
| 868 private: | 870 private: |
| 869 StringStream* stream() { return &stream_; } | 871 StringStream* stream() { return &stream_; } |
| 870 HeapStringAllocator alloc_; | 872 HeapStringAllocator alloc_; |
| 871 StringStream stream_; | 873 StringStream stream_; |
| 872 Zone* zone_; | 874 Zone* zone_; |
| 873 }; | 875 }; |
| 874 | 876 |
| 875 | 877 |
| (...skipping 313 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 1189 OS::SNPrintF(buffer, "%d", Smi::cast(*value_)->value()); | 1191 OS::SNPrintF(buffer, "%d", Smi::cast(*value_)->value()); |
| 1190 str = arr; | 1192 str = arr; |
| 1191 } else { | 1193 } else { |
| 1192 str = DoubleToCString(value_->Number(), buffer); | 1194 str = DoubleToCString(value_->Number(), buffer); |
| 1193 } | 1195 } |
| 1194 return factory->NewStringFromAscii(CStrVector(str)); | 1196 return factory->NewStringFromAscii(CStrVector(str)); |
| 1195 } | 1197 } |
| 1196 | 1198 |
| 1197 | 1199 |
| 1198 } } // namespace v8::internal | 1200 } } // namespace v8::internal |
| OLD | NEW |