summaryrefslogtreecommitdiff
path: root/deps/v8/src/parsing/preparsed-scope-data.cc
diff options
context:
space:
mode:
Diffstat (limited to 'deps/v8/src/parsing/preparsed-scope-data.cc')
-rw-r--r--deps/v8/src/parsing/preparsed-scope-data.cc19
1 files changed, 15 insertions, 4 deletions
diff --git a/deps/v8/src/parsing/preparsed-scope-data.cc b/deps/v8/src/parsing/preparsed-scope-data.cc
index 786be3f0e5..70880f55c4 100644
--- a/deps/v8/src/parsing/preparsed-scope-data.cc
+++ b/deps/v8/src/parsing/preparsed-scope-data.cc
@@ -396,6 +396,7 @@ void ProducedPreParsedScopeData::SaveDataForVariable(Variable* var) {
// Store the variable name in debug mode; this way we can check that we
// restore data to the correct variable.
const AstRawString* name = var->raw_name();
+ byte_data_->WriteUint8(name->is_one_byte());
byte_data_->WriteUint32(name->length());
for (int i = 0; i < name->length(); ++i) {
byte_data_->WriteUint8(name->raw_data()[i]);
@@ -571,8 +572,7 @@ void ConsumedPreParsedScopeData::RestoreData(Scope* scope) {
if (scope_data_->RemainingBytes() < kUint8Size) {
// Temporary debugging code for detecting inconsistent data. Write debug
// information on the stack, then crash.
- data_->GetIsolate()->PushStackTraceAndDie(0xC0DEFEE, nullptr, nullptr,
- 0xC0DEFEE);
+ data_->GetIsolate()->PushStackTraceAndDie();
}
// scope_type is stored only in debug mode.
@@ -606,9 +606,20 @@ void ConsumedPreParsedScopeData::RestoreData(Scope* scope) {
void ConsumedPreParsedScopeData::RestoreDataForVariable(Variable* var) {
#ifdef DEBUG
const AstRawString* name = var->raw_name();
+ bool data_one_byte = scope_data_->ReadUint8();
+ DCHECK_IMPLIES(name->is_one_byte(), data_one_byte);
DCHECK_EQ(scope_data_->ReadUint32(), static_cast<uint32_t>(name->length()));
- for (int i = 0; i < name->length(); ++i) {
- DCHECK_EQ(scope_data_->ReadUint8(), name->raw_data()[i]);
+ if (!name->is_one_byte() && data_one_byte) {
+ // It's possible that "name" is a two-byte representation of the string
+ // stored in the data.
+ for (int i = 0; i < 2 * name->length(); i += 2) {
+ DCHECK_EQ(scope_data_->ReadUint8(), name->raw_data()[i]);
+ DCHECK_EQ(0, name->raw_data()[i + 1]);
+ }
+ } else {
+ for (int i = 0; i < name->length(); ++i) {
+ DCHECK_EQ(scope_data_->ReadUint8(), name->raw_data()[i]);
+ }
}
#endif
uint8_t variable_data = scope_data_->ReadQuarter();