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 148 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
159 Handle<SeqAsciiString> seq_source_; | 159 Handle<SeqAsciiString> seq_source_; |
160 | 160 |
161 Isolate* isolate_; | 161 Isolate* isolate_; |
162 uc32 c0_; | 162 uc32 c0_; |
163 int position_; | 163 int position_; |
164 }; | 164 }; |
165 | 165 |
166 template <bool seq_ascii> | 166 template <bool seq_ascii> |
167 Handle<Object> JsonParser<seq_ascii>::ParseJson(Handle<String> source) { | 167 Handle<Object> JsonParser<seq_ascii>::ParseJson(Handle<String> source) { |
168 isolate_ = source->map()->isolate(); | 168 isolate_ = source->map()->isolate(); |
169 source_ = Handle<String>(source->TryFlattenGetString()); | 169 FlattenString(source); |
| 170 source_ = source; |
170 source_length_ = source_->length(); | 171 source_length_ = source_->length(); |
171 | 172 |
172 // Optimized fast case where we only have ASCII characters. | 173 // Optimized fast case where we only have ASCII characters. |
173 if (seq_ascii) { | 174 if (seq_ascii) { |
174 seq_source_ = Handle<SeqAsciiString>::cast(source_); | 175 seq_source_ = Handle<SeqAsciiString>::cast(source_); |
175 } | 176 } |
176 | 177 |
177 // Set initial position right before the string. | 178 // Set initial position right before the string. |
178 position_ = -1; | 179 position_ = -1; |
179 // Advance to the first character (posibly EOS) | 180 // Advance to the first character (posibly EOS) |
(...skipping 409 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
589 } | 590 } |
590 ASSERT_EQ('"', c0_); | 591 ASSERT_EQ('"', c0_); |
591 // Advance past the last '"'. | 592 // Advance past the last '"'. |
592 AdvanceSkipWhitespace(); | 593 AdvanceSkipWhitespace(); |
593 return result; | 594 return result; |
594 } | 595 } |
595 | 596 |
596 } } // namespace v8::internal | 597 } } // namespace v8::internal |
597 | 598 |
598 #endif // V8_JSON_PARSER_H_ | 599 #endif // V8_JSON_PARSER_H_ |
OLD | NEW |