Commit 3ca12ea4 authored by Florian Sattler's avatar Florian Sattler Committed by Commit Bot

[scanner] Adapted member order to improve cache behaviour

Bug: v8:7926
Change-Id: I9b8129d60fc4d65481757222c255e883b24f47ab
Reviewed-on: https://chromium-review.googlesource.com/1196549
Commit-Queue: Florian Sattler <sattlerf@google.com>
Reviewed-by: 's avatarCamillo Bruni <cbruni@chromium.org>
Reviewed-by: 's avatarGeorg Neis <neis@chromium.org>
Cr-Commit-Position: refs/heads/master@{#55586}
parent 158216e9
...@@ -173,12 +173,12 @@ Scanner::Scanner(UnicodeCache* unicode_cache, Utf16CharacterStream* source, ...@@ -173,12 +173,12 @@ Scanner::Scanner(UnicodeCache* unicode_cache, Utf16CharacterStream* source,
bool is_module) bool is_module)
: unicode_cache_(unicode_cache), : unicode_cache_(unicode_cache),
source_(source), source_(source),
octal_pos_(Location::invalid()),
octal_message_(MessageTemplate::kNone),
found_html_comment_(false), found_html_comment_(false),
allow_harmony_bigint_(false), allow_harmony_bigint_(false),
allow_harmony_numeric_separator_(false), allow_harmony_numeric_separator_(false),
is_module_(is_module) { is_module_(is_module),
octal_pos_(Location::invalid()),
octal_message_(MessageTemplate::kNone) {
DCHECK_NOT_NULL(source); DCHECK_NOT_NULL(source);
} }
......
...@@ -409,7 +409,7 @@ class Scanner { ...@@ -409,7 +409,7 @@ class Scanner {
class LiteralBuffer { class LiteralBuffer {
public: public:
LiteralBuffer() LiteralBuffer()
: position_(0), is_one_byte_(true), is_used_(false), backing_store_() {} : backing_store_(), position_(0), is_one_byte_(true), is_used_(false) {}
~LiteralBuffer() { backing_store_.Dispose(); } ~LiteralBuffer() { backing_store_.Dispose(); }
...@@ -499,10 +499,10 @@ class Scanner { ...@@ -499,10 +499,10 @@ class Scanner {
void ExpandBuffer(); void ExpandBuffer();
void ConvertToTwoByte(); void ConvertToTwoByte();
Vector<byte> backing_store_;
int position_; int position_;
bool is_one_byte_; bool is_one_byte_;
bool is_used_; bool is_used_;
Vector<byte> backing_store_;
DISALLOW_COPY_AND_ASSIGN(LiteralBuffer); DISALLOW_COPY_AND_ASSIGN(LiteralBuffer);
}; };
...@@ -549,7 +549,7 @@ class Scanner { ...@@ -549,7 +549,7 @@ class Scanner {
}; };
static const int kCharacterLookaheadBufferSize = 1; static const int kCharacterLookaheadBufferSize = 1;
const int kMaxAscii = 127; static const int kMaxAscii = 127;
// Scans octal escape sequence. Also accepts "\0" decimal escape sequence. // Scans octal escape sequence. Also accepts "\0" decimal escape sequence.
template <bool capture_raw> template <bool capture_raw>
...@@ -781,13 +781,7 @@ class Scanner { ...@@ -781,13 +781,7 @@ class Scanner {
void SanityCheckTokenDesc(const TokenDesc&) const; void SanityCheckTokenDesc(const TokenDesc&) const;
#endif #endif
UnicodeCache* unicode_cache_; UnicodeCache* const unicode_cache_;
// Values parsed from magic comments.
LiteralBuffer source_url_;
LiteralBuffer source_mapping_url_;
TokenDesc token_storage_[3];
TokenDesc& next() { return *next_; } TokenDesc& next() { return *next_; }
...@@ -802,13 +796,11 @@ class Scanner { ...@@ -802,13 +796,11 @@ class Scanner {
// Input stream. Must be initialized to an Utf16CharacterStream. // Input stream. Must be initialized to an Utf16CharacterStream.
Utf16CharacterStream* const source_; Utf16CharacterStream* const source_;
// Last-seen positions of potentially problematic tokens.
Location octal_pos_;
MessageTemplate::Template octal_message_;
// One Unicode character look-ahead; c0_ < 0 at the end of the input. // One Unicode character look-ahead; c0_ < 0 at the end of the input.
uc32 c0_; uc32 c0_;
TokenDesc token_storage_[3];
// Whether this scanner encountered an HTML comment. // Whether this scanner encountered an HTML comment.
bool found_html_comment_; bool found_html_comment_;
...@@ -819,6 +811,14 @@ class Scanner { ...@@ -819,6 +811,14 @@ class Scanner {
const bool is_module_; const bool is_module_;
// Values parsed from magic comments.
LiteralBuffer source_url_;
LiteralBuffer source_mapping_url_;
// Last-seen positions of potentially problematic tokens.
Location octal_pos_;
MessageTemplate::Template octal_message_;
MessageTemplate::Template scanner_error_; MessageTemplate::Template scanner_error_;
Location scanner_error_location_; Location scanner_error_location_;
}; };
......
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment