7aac6bc905
Moves the unicode predicate cache tables out of the unicode cache, and turns them into generic predicates in char-predicates.h which use static constexpr tables. This drops the per-isolate cost of unicode caches, and removes the need for accessing the unicode cache from most files. It does remove the mutability of the cache, which means that there may be regressions when parsing non-ASCII identifiers. Most likely the benefits to ASCII identifiers/keywords will outweigh any non-ASCII costs. Change-Id: I9a7a8b7c9b22d3e9ede824ab4e27f133ce20a399 Reviewed-on: https://chromium-review.googlesource.com/c/1335564 Reviewed-by: Yang Guo <yangguo@chromium.org> Reviewed-by: Toon Verwaest <verwaest@chromium.org> Reviewed-by: Michael Starzinger <mstarzinger@chromium.org> Commit-Queue: Leszek Swirski <leszeks@chromium.org> Cr-Commit-Position: refs/heads/master@{#57506}
34 lines
773 B
C++
34 lines
773 B
C++
// 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/unicode-decoder.h"
|
|
#include "src/unicode.h"
|
|
#include "src/utils.h"
|
|
|
|
namespace v8 {
|
|
namespace internal {
|
|
|
|
// Caching predicates used by scanners.
|
|
class UnicodeCache {
|
|
public:
|
|
UnicodeCache() = default;
|
|
typedef unibrow::Utf8Decoder<512> Utf8Decoder;
|
|
|
|
StaticResource<Utf8Decoder>* utf8_decoder() { return &utf8_decoder_; }
|
|
|
|
private:
|
|
StaticResource<Utf8Decoder> utf8_decoder_;
|
|
|
|
DISALLOW_COPY_AND_ASSIGN(UnicodeCache);
|
|
};
|
|
|
|
} // namespace internal
|
|
} // namespace v8
|
|
|
|
#endif // V8_UNICODE_CACHE_H_
|