OLD | NEW |
1 // Copyright 2011 the V8 project authors. All rights reserved. | 1 // Copyright 2011 the V8 project authors. All rights reserved. |
2 // Use of this source code is governed by a BSD-style license that can be | 2 // Use of this source code is governed by a BSD-style license that can be |
3 // found in the LICENSE file. | 3 // found in the LICENSE file. |
4 | 4 |
5 #ifndef V8_JSON_PARSER_H_ | 5 #ifndef V8_JSON_PARSER_H_ |
6 #define V8_JSON_PARSER_H_ | 6 #define V8_JSON_PARSER_H_ |
7 | 7 |
8 #include "src/v8.h" | 8 #include "src/v8.h" |
9 | 9 |
10 #include "src/char-predicates-inl.h" | 10 #include "src/char-predicates-inl.h" |
(...skipping 14 matching lines...) Expand all Loading... |
25 } | 25 } |
26 | 26 |
27 static const int kEndOfString = -1; | 27 static const int kEndOfString = -1; |
28 | 28 |
29 private: | 29 private: |
30 explicit JsonParser(Handle<String> source) | 30 explicit JsonParser(Handle<String> source) |
31 : source_(source), | 31 : source_(source), |
32 source_length_(source->length()), | 32 source_length_(source->length()), |
33 isolate_(source->map()->GetHeap()->isolate()), | 33 isolate_(source->map()->GetHeap()->isolate()), |
34 factory_(isolate_->factory()), | 34 factory_(isolate_->factory()), |
35 zone_(isolate_), | |
36 object_constructor_(isolate_->native_context()->object_function(), | 35 object_constructor_(isolate_->native_context()->object_function(), |
37 isolate_), | 36 isolate_), |
38 position_(-1) { | 37 position_(-1) { |
39 source_ = String::Flatten(source_); | 38 source_ = String::Flatten(source_); |
40 pretenure_ = (source_length_ >= kPretenureTreshold) ? TENURED : NOT_TENURED; | 39 pretenure_ = (source_length_ >= kPretenureTreshold) ? TENURED : NOT_TENURED; |
41 | 40 |
42 // Optimized fast case where we only have Latin1 characters. | 41 // Optimized fast case where we only have Latin1 characters. |
43 if (seq_one_byte) { | 42 if (seq_one_byte) { |
44 seq_source_ = Handle<SeqOneByteString>::cast(source_); | 43 seq_source_ = Handle<SeqOneByteString>::cast(source_); |
45 } | 44 } |
(...skipping 765 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
811 | 810 |
812 DCHECK_EQ('"', c0_); | 811 DCHECK_EQ('"', c0_); |
813 // Advance past the last '"'. | 812 // Advance past the last '"'. |
814 AdvanceSkipWhitespace(); | 813 AdvanceSkipWhitespace(); |
815 return result; | 814 return result; |
816 } | 815 } |
817 | 816 |
818 } } // namespace v8::internal | 817 } } // namespace v8::internal |
819 | 818 |
820 #endif // V8_JSON_PARSER_H_ | 819 #endif // V8_JSON_PARSER_H_ |
OLD | NEW |