This make inclusion of unicode-inl.h in object.h absolete. Now most
compilation units don't require that header. It also breaks a cycle
within declarations of the scanner.h header.
This tries to remove includes of "-inl.h" headers from normal ".h"
headers, thereby reducing the chance of any cyclic dependencies and
decreasing the average size of our compilation units.
Note that this change still leaves 3 violations of that rule in the
code, checked with the "tools/check-inline-includes.sh" tool.
R=yangguo@chromium.org
Review URL: https://codereview.chromium.org/
1287893006
Cr-Commit-Position: refs/heads/master@{#30268}
"src/unicode-inl.h",
"src/unicode.cc",
"src/unicode.h",
+ "src/unicode-cache-inl.h",
+ "src/unicode-cache.h",
"src/unicode-decoder.cc",
"src/unicode-decoder.h",
"src/unique.h",
#include <stdarg.h>
#include <cmath>
#include "src/globals.h" // Required for V8_INFINITY
+#include "src/unicode-cache-inl.h"
// ----------------------------------------------------------------------------
// Extra POSIX/ANSI functions for Win32/MSVC.
#include "src/char-predicates-inl.h"
#include "src/dateparser.h"
+#include "src/unicode-cache-inl.h"
namespace v8 {
namespace internal {
}
+template <typename Char>
+bool DateParser::InputReader<Char>::SkipWhiteSpace() {
+ if (unicode_cache_->IsWhiteSpaceOrLineTerminator(ch_)) {
+ Next();
+ return true;
+ }
+ return false;
+}
+
+
+template <typename Char>
+bool DateParser::InputReader<Char>::SkipParentheses() {
+ if (ch_ != '(') return false;
+ int balance = 0;
+ do {
+ if (ch_ == ')') --balance;
+ else if (ch_ == '(') ++balance;
+ Next();
+ } while (balance > 0 && ch_);
+ return true;
+}
+
+
template <typename Char>
DateParser::DateToken DateParser::ParseES6DateTime(
DateStringTokenizer<Char>* scanner,
return false;
}
- bool SkipWhiteSpace() {
- if (unicode_cache_->IsWhiteSpaceOrLineTerminator(ch_)) {
- Next();
- return true;
- }
- return false;
- }
-
- bool SkipParentheses() {
- if (ch_ != '(') return false;
- int balance = 0;
- do {
- if (ch_ == ')') --balance;
- else if (ch_ == '(') ++balance;
- Next();
- } while (balance > 0 && ch_);
- return true;
- }
+ inline bool SkipWhiteSpace();
+ inline bool SkipParentheses();
// Character testing/classification. Non-ASCII digits are not supported.
bool Is(uint32_t c) const { return ch_ == c; }
#include "src/flags.h"
#include "src/list.h"
#include "src/property-details.h"
-#include "src/unicode-inl.h"
+#include "src/unicode.h"
#include "src/unicode-decoder.h"
#include "src/zone.h"
#include "src/allocation.h"
#include "src/objects.h"
+#include "src/unicode.h"
#include "src/zone.h"
namespace v8 {
class AstRawString;
class AstValueFactory;
class ParserRecorder;
+class UnicodeCache;
// Returns the value (0 .. 15) of a hexadecimal character c.
};
-// ---------------------------------------------------------------------
-// Caching predicates used by scanners.
-
-class UnicodeCache {
- public:
- UnicodeCache() {}
- typedef unibrow::Utf8Decoder<512> Utf8Decoder;
-
- StaticResource<Utf8Decoder>* utf8_decoder() {
- return &utf8_decoder_;
- }
-
- bool IsIdentifierStart(unibrow::uchar c) { return kIsIdentifierStart.get(c); }
- bool IsIdentifierPart(unibrow::uchar c) { return kIsIdentifierPart.get(c); }
- bool IsLineTerminator(unibrow::uchar c) { return kIsLineTerminator.get(c); }
- bool IsLineTerminatorSequence(unibrow::uchar c, unibrow::uchar next) {
- if (!IsLineTerminator(c)) return false;
- if (c == 0x000d && next == 0x000a) return false; // CR with following LF.
- return true;
- }
-
- bool IsWhiteSpace(unibrow::uchar c) { return kIsWhiteSpace.get(c); }
- bool IsWhiteSpaceOrLineTerminator(unibrow::uchar c) {
- return kIsWhiteSpaceOrLineTerminator.get(c);
- }
-
- private:
- unibrow::Predicate<IdentifierStart, 128> kIsIdentifierStart;
- unibrow::Predicate<IdentifierPart, 128> kIsIdentifierPart;
- unibrow::Predicate<unibrow::LineTerminator, 128> kIsLineTerminator;
- unibrow::Predicate<WhiteSpace, 128> kIsWhiteSpace;
- unibrow::Predicate<WhiteSpaceOrLineTerminator, 128>
- kIsWhiteSpaceOrLineTerminator;
- StaticResource<Utf8Decoder> utf8_decoder_;
-
- DISALLOW_COPY_AND_ASSIGN(UnicodeCache);
-};
-
-
// ---------------------------------------------------------------------
// DuplicateFinder discovers duplicate symbols.
--- /dev/null
+// Copyright 2015 the V8 project authors. All rights reserved.
+// Use of this source code is governed by a BSD-style license that can be
+// found in the LICENSE file.
+
+#ifndef V8_UNICODE_CACHE_INL_H_
+#define V8_UNICODE_CACHE_INL_H_
+
+#include "src/unicode-inl.h"
+#include "src/unicode-cache.h"
+
+namespace v8 {
+namespace internal {
+
+bool UnicodeCache::IsIdentifierStart(unibrow::uchar c) {
+ return kIsIdentifierStart.get(c);
+}
+
+
+bool UnicodeCache::IsIdentifierPart(unibrow::uchar c) {
+ return kIsIdentifierPart.get(c);
+}
+
+
+bool UnicodeCache::IsLineTerminator(unibrow::uchar c) {
+ return kIsLineTerminator.get(c);
+}
+
+
+bool UnicodeCache::IsLineTerminatorSequence(unibrow::uchar c,
+ unibrow::uchar next) {
+ if (!IsLineTerminator(c)) return false;
+ if (c == 0x000d && next == 0x000a) return false; // CR with following LF.
+ return true;
+}
+
+
+bool UnicodeCache::IsWhiteSpace(unibrow::uchar c) {
+ return kIsWhiteSpace.get(c);
+}
+
+
+bool UnicodeCache::IsWhiteSpaceOrLineTerminator(unibrow::uchar c) {
+ return kIsWhiteSpaceOrLineTerminator.get(c);
+}
+
+} // namespace internal
+} // namespace v8
+
+#endif // V8_UNICODE_CACHE_INL_H_
--- /dev/null
+// Copyright 2015 the V8 project authors. All rights reserved.
+// Use of this source code is governed by a BSD-style license that can be
+// found in the LICENSE file.
+
+#ifndef V8_UNICODE_CACHE_H_
+#define V8_UNICODE_CACHE_H_
+
+#include "src/base/macros.h"
+#include "src/char-predicates.h"
+#include "src/unicode.h"
+#include "src/unicode-decoder.h"
+
+namespace v8 {
+namespace internal {
+
+// Caching predicates used by scanners.
+class UnicodeCache {
+ public:
+ UnicodeCache() {}
+ typedef unibrow::Utf8Decoder<512> Utf8Decoder;
+
+ StaticResource<Utf8Decoder>* utf8_decoder() { return &utf8_decoder_; }
+
+ inline bool IsIdentifierStart(unibrow::uchar c);
+ inline bool IsIdentifierPart(unibrow::uchar c);
+ inline bool IsLineTerminator(unibrow::uchar c);
+ inline bool IsLineTerminatorSequence(unibrow::uchar c, unibrow::uchar next);
+
+ inline bool IsWhiteSpace(unibrow::uchar c);
+ inline bool IsWhiteSpaceOrLineTerminator(unibrow::uchar c);
+
+ private:
+ unibrow::Predicate<IdentifierStart, 128> kIsIdentifierStart;
+ unibrow::Predicate<IdentifierPart, 128> kIsIdentifierPart;
+ unibrow::Predicate<unibrow::LineTerminator, 128> kIsLineTerminator;
+ unibrow::Predicate<WhiteSpace, 128> kIsWhiteSpace;
+ unibrow::Predicate<WhiteSpaceOrLineTerminator, 128>
+ kIsWhiteSpaceOrLineTerminator;
+ StaticResource<Utf8Decoder> utf8_decoder_;
+
+ DISALLOW_COPY_AND_ASSIGN(UnicodeCache);
+};
+
+} // namespace internal
+} // namespace v8
+
+#endif // V8_UNICODE_CACHE_H_
'../../src/unicode-inl.h',
'../../src/unicode.cc',
'../../src/unicode.h',
+ '../../src/unicode-cache-inl.h',
+ '../../src/unicode-cache.h',
'../../src/unicode-decoder.cc',
'../../src/unicode-decoder.h',
'../../src/unique.h',