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 43 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
54 // That means that contextual checks (like a label being declared where | 54 // That means that contextual checks (like a label being declared where |
55 // it is used) are generally omitted. | 55 // it is used) are generally omitted. |
56 | 56 |
57 namespace i = v8::internal; | 57 namespace i = v8::internal; |
58 | 58 |
59 class DuplicateFinder { | 59 class DuplicateFinder { |
60 public: | 60 public: |
61 explicit DuplicateFinder(i::UnicodeCache* constants) | 61 explicit DuplicateFinder(i::UnicodeCache* constants) |
62 : unicode_constants_(constants), | 62 : unicode_constants_(constants), |
63 backing_store_(16), | 63 backing_store_(16), |
64 map_(new i::HashMap(&Match)) { } | 64 map_(&Match) { } |
65 | |
66 ~DuplicateFinder() { | |
67 delete map_; | |
68 } | |
69 | 65 |
70 int AddAsciiSymbol(i::Vector<const char> key, int value); | 66 int AddAsciiSymbol(i::Vector<const char> key, int value); |
71 int AddUC16Symbol(i::Vector<const uint16_t> key, int value); | 67 int AddUC16Symbol(i::Vector<const uint16_t> key, int value); |
72 // Add a a number literal by converting it (if necessary) | 68 // Add a a number literal by converting it (if necessary) |
73 // to the string that ToString(ToNumber(literal)) would generate. | 69 // to the string that ToString(ToNumber(literal)) would generate. |
74 // and then adding that string with AddAsciiSymbol. | 70 // and then adding that string with AddAsciiSymbol. |
75 // This string is the actual value used as key in an object literal, | 71 // This string is the actual value used as key in an object literal, |
76 // and the one that must be different from the other keys. | 72 // and the one that must be different from the other keys. |
77 int AddNumber(i::Vector<const char> key, int value); | 73 int AddNumber(i::Vector<const char> key, int value); |
78 | 74 |
(...skipping 15 matching lines...) Expand all Loading... |
94 // form. | 90 // form. |
95 static bool IsNumberCanonical(i::Vector<const char> key); | 91 static bool IsNumberCanonical(i::Vector<const char> key); |
96 | 92 |
97 // Size of buffer. Sufficient for using it to call DoubleToCString in | 93 // Size of buffer. Sufficient for using it to call DoubleToCString in |
98 // from conversions.h. | 94 // from conversions.h. |
99 static const int kBufferSize = 100; | 95 static const int kBufferSize = 100; |
100 | 96 |
101 i::UnicodeCache* unicode_constants_; | 97 i::UnicodeCache* unicode_constants_; |
102 // Backing store used to store strings used as hashmap keys. | 98 // Backing store used to store strings used as hashmap keys. |
103 i::SequenceCollector<unsigned char> backing_store_; | 99 i::SequenceCollector<unsigned char> backing_store_; |
104 i::HashMap* map_; | 100 i::HashMap map_; |
105 // Buffer used for string->number->canonical string conversions. | 101 // Buffer used for string->number->canonical string conversions. |
106 char number_buffer_[kBufferSize]; | 102 char number_buffer_[kBufferSize]; |
107 }; | 103 }; |
108 | 104 |
109 | 105 |
110 class PreParser { | 106 class PreParser { |
111 public: | 107 public: |
112 enum PreParseResult { | 108 enum PreParseResult { |
113 kPreParseStackOverflow, | 109 kPreParseStackOverflow, |
114 kPreParseSuccess | 110 kPreParseSuccess |
(...skipping 495 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
610 i::Scanner::Location strict_mode_violation_location_; | 606 i::Scanner::Location strict_mode_violation_location_; |
611 const char* strict_mode_violation_type_; | 607 const char* strict_mode_violation_type_; |
612 bool stack_overflow_; | 608 bool stack_overflow_; |
613 bool allow_lazy_; | 609 bool allow_lazy_; |
614 bool parenthesized_function_; | 610 bool parenthesized_function_; |
615 bool harmony_block_scoping_; | 611 bool harmony_block_scoping_; |
616 }; | 612 }; |
617 } } // v8::preparser | 613 } } // v8::preparser |
618 | 614 |
619 #endif // V8_PREPARSER_H | 615 #endif // V8_PREPARSER_H |
OLD | NEW |