diff --git a/src/parsing/scanner-character-streams.cc b/src/parsing/scanner-character-streams.cc index 7ac7af74ab..052b6007ae 100644 --- a/src/parsing/scanner-character-streams.cc +++ b/src/parsing/scanner-character-streams.cc @@ -564,9 +564,11 @@ Utf16CharacterStream* ScannerStream::For(Isolate* isolate, Handle data, if (data->IsSlicedString()) { SlicedString* string = SlicedString::cast(*data); start_offset = string->offset(); - data = handle(string->parent(), string->GetIsolate()); + String* parent = string->parent(); + if (parent->IsThinString()) parent = ThinString::cast(parent)->actual(); + data = handle(parent, isolate); } else { - data = String::Flatten(data->GetIsolate(), data); + data = String::Flatten(isolate, data); } if (data->IsExternalOneByteString()) { return new BufferedCharacterStream( diff --git a/test/mjsunit/regress/regress-crbug-862538.js b/test/mjsunit/regress/regress-crbug-862538.js new file mode 100644 index 0000000000..f5da2eecbe --- /dev/null +++ b/test/mjsunit/regress/regress-crbug-862538.js @@ -0,0 +1,13 @@ +// Copyright 2018 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. + +var uvwxyzundefined; + +function __f_5778(__v_29973) { + var __v_29975 = __v_29973 + undefined; + var __v_29976 = __v_29975.substring( 20); + ({})[__v_29975]; + return eval(__v_29976); +} +__f_5778("abcdefghijklmnopqrstuvwxyz");