diff --git a/src/objects/js-collator.cc b/src/objects/js-collator.cc index fee19acfc8..8d5dd0c56a 100644 --- a/src/objects/js-collator.cc +++ b/src/objects/js-collator.cc @@ -542,12 +542,12 @@ MaybeHandle JSCollator::New(Isolate* isolate, Handle map, Managed::FromUniquePtr(isolate, 0, std::move(icu_collator)); - // Now all properties are ready, so we can allocate the result object. - Handle collator = Handle::cast( - isolate->factory()->NewFastOrSlowJSObjectFromMap(map)); // We only need to do so if it is different from the collator would return. Handle locale_str = isolate->factory()->NewStringFromAsciiChecked( (collator_locale != icu_locale) ? r.locale.c_str() : ""); + // Now all properties are ready, so we can allocate the result object. + Handle collator = Handle::cast( + isolate->factory()->NewFastOrSlowJSObjectFromMap(map)); DisallowHeapAllocation no_gc; collator->set_icu_collator(*managed_collator); collator->set_locale(*locale_str); diff --git a/test/intl/regress-1130489.js b/test/intl/regress-1130489.js new file mode 100644 index 0000000000..bc169f9afb --- /dev/null +++ b/test/intl/regress-1130489.js @@ -0,0 +1,30 @@ +// Copyright 2020 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. + +function runNearStackLimit(f) { + function t() { + try { + return t(); + } catch (e) { + return f(); + } + } + try { + return t(); + } catch (e) {} +} + +const str = 'hello'; +const locale = new Intl.Locale('ja-u-co-eor-kf-lower-kn-false'); + +function test(getLocaleFromCollator) { + const localeInCollator = getLocaleFromCollator(locale); + const temp = str("en"); +} + +runNearStackLimit(() => { + return test(args => { + new Intl.Collator(locale).resolvedOptions().locale; + })} +);