OLD | NEW |
1 // Copyright 2006-2008 the V8 project authors. All rights reserved. | 1 // Copyright 2006-2008 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 42 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
53 void Reset() { | 53 void Reset() { |
54 if (data_ == NULL) { | 54 if (data_ == NULL) { |
55 data_ = NewArray<char>(kInitialCapacity); | 55 data_ = NewArray<char>(kInitialCapacity); |
56 limit_ = ComputeLimit(data_, kInitialCapacity); | 56 limit_ = ComputeLimit(data_, kInitialCapacity); |
57 } | 57 } |
58 cursor_ = data_; | 58 cursor_ = data_; |
59 } | 59 } |
60 | 60 |
61 int pos() const { | 61 int pos() const { |
62 ASSERT_NOT_NULL(data_); | 62 ASSERT_NOT_NULL(data_); |
63 return cursor_ - data_; | 63 return static_cast<int>(cursor_ - data_); |
64 } | 64 } |
65 | 65 |
66 char* data() const { return data_; } | 66 char* data() const { return data_; } |
67 | 67 |
68 private: | 68 private: |
69 static const int kInitialCapacity = 256; | 69 static const int kInitialCapacity = 256; |
70 char* data_; | 70 char* data_; |
71 char* cursor_; | 71 char* cursor_; |
72 char* limit_; | 72 char* limit_; |
73 | 73 |
74 int Capacity() const { | 74 int Capacity() const { |
75 ASSERT_NOT_NULL(data_); | 75 ASSERT_NOT_NULL(data_); |
76 return (limit_ - data_) + unibrow::Utf8::kMaxEncodedSize; | 76 return static_cast<int>(limit_ - data_) + unibrow::Utf8::kMaxEncodedSize; |
77 } | 77 } |
78 | 78 |
79 static char* ComputeLimit(char* data, int capacity) { | 79 static char* ComputeLimit(char* data, int capacity) { |
80 return (data + capacity) - unibrow::Utf8::kMaxEncodedSize; | 80 return (data + capacity) - unibrow::Utf8::kMaxEncodedSize; |
81 } | 81 } |
82 | 82 |
83 void AddCharSlow(uc32 c); | 83 void AddCharSlow(uc32 c); |
84 }; | 84 }; |
85 | 85 |
86 | 86 |
(...skipping 329 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
416 } | 416 } |
417 | 417 |
418 // Decodes a unicode escape-sequence which is part of an identifier. | 418 // Decodes a unicode escape-sequence which is part of an identifier. |
419 // If the escape sequence cannot be decoded the result is kBadRune. | 419 // If the escape sequence cannot be decoded the result is kBadRune. |
420 uc32 ScanIdentifierUnicodeEscape(); | 420 uc32 ScanIdentifierUnicodeEscape(); |
421 }; | 421 }; |
422 | 422 |
423 } } // namespace v8::internal | 423 } } // namespace v8::internal |
424 | 424 |
425 #endif // V8_SCANNER_H_ | 425 #endif // V8_SCANNER_H_ |
OLD | NEW |