Commit 207bda5d authored by Sathya Gunasekaran's avatar Sathya Gunasekaran Committed by Commit Bot

[api] Fill FastTemplateCache with holes

The FastTemplateCache gets filled with undefiend when created and then
with holes when it grows causing a mismatch.

This hasn't been a problem so far as the FastTemplateCache is always
initialized to the max size but it could cause problems in the future
if this is changed.

Bug: v8:11289
Change-Id: I8dabce101b25d9f0057183c88f507873d973f2a8
Reviewed-on: https://chromium-review.googlesource.com/c/v8/v8/+/2608472Reviewed-by: 's avatarCamillo Bruni <cbruni@chromium.org>
Commit-Queue: Sathya Gunasekaran  <gsathya@chromium.org>
Cr-Commit-Position: refs/heads/master@{#71939}
parent d1cf8dd8
......@@ -293,7 +293,7 @@ MaybeHandle<JSObject> ProbeInstantiationsCache(
FixedArray fast_cache =
native_context->fast_template_instantiations_cache();
Handle<Object> object{fast_cache.get(serial_number - 1), isolate};
if (object->IsUndefined(isolate)) return {};
if (object->IsTheHole(isolate)) return {};
return Handle<JSObject>::cast(object);
}
if (caching_mode == CachingMode::kUnlimited ||
......
......@@ -4599,8 +4599,9 @@ Handle<JSFunction> Genesis::CreateArrayBuffer(
bool Genesis::InstallABunchOfRandomThings() {
HandleScope scope(isolate());
auto fast_template_instantiations_cache = isolate()->factory()->NewFixedArray(
TemplateInfo::kFastTemplateInstantiationsCacheSize);
auto fast_template_instantiations_cache =
isolate()->factory()->NewFixedArrayWithHoles(
TemplateInfo::kFastTemplateInstantiationsCacheSize);
native_context()->set_fast_template_instantiations_cache(
*fast_template_instantiations_cache);
......
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