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 41 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
52 private: | 52 private: |
53 explicit JsonParser(Handle<String> source) | 53 explicit JsonParser(Handle<String> source) |
54 : source_(source), | 54 : source_(source), |
55 source_length_(source->length()), | 55 source_length_(source->length()), |
56 isolate_(source->map()->GetHeap()->isolate()), | 56 isolate_(source->map()->GetHeap()->isolate()), |
57 factory_(isolate_->factory()), | 57 factory_(isolate_->factory()), |
58 zone_(isolate_), | 58 zone_(isolate_), |
59 object_constructor_(isolate_->native_context()->object_function(), | 59 object_constructor_(isolate_->native_context()->object_function(), |
60 isolate_), | 60 isolate_), |
61 position_(-1) { | 61 position_(-1) { |
62 FlattenString(source_); | 62 source_ = String::Flatten(source_); |
63 pretenure_ = (source_length_ >= kPretenureTreshold) ? TENURED : NOT_TENURED; | 63 pretenure_ = (source_length_ >= kPretenureTreshold) ? TENURED : NOT_TENURED; |
64 | 64 |
65 // Optimized fast case where we only have ASCII characters. | 65 // Optimized fast case where we only have ASCII characters. |
66 if (seq_ascii) { | 66 if (seq_ascii) { |
67 seq_source_ = Handle<SeqOneByteString>::cast(source_); | 67 seq_source_ = Handle<SeqOneByteString>::cast(source_); |
68 } | 68 } |
69 } | 69 } |
70 | 70 |
71 // Parse a string containing a single JSON value. | 71 // Parse a string containing a single JSON value. |
72 MaybeHandle<Object> ParseJson(); | 72 MaybeHandle<Object> ParseJson(); |
(...skipping 724 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
797 | 797 |
798 ASSERT_EQ('"', c0_); | 798 ASSERT_EQ('"', c0_); |
799 // Advance past the last '"'. | 799 // Advance past the last '"'. |
800 AdvanceSkipWhitespace(); | 800 AdvanceSkipWhitespace(); |
801 return result; | 801 return result; |
802 } | 802 } |
803 | 803 |
804 } } // namespace v8::internal | 804 } } // namespace v8::internal |
805 | 805 |
806 #endif // V8_JSON_PARSER_H_ | 806 #endif // V8_JSON_PARSER_H_ |
OLD | NEW |