Commit 626b5af7 authored by Toon Verwaest's avatar Toon Verwaest Committed by Commit Bot

[runtime] Use UnseededNumberDictionary to encode the array_buffer_transfer_map

SeededNumberDictionaries are used to implement element backing stores of JSObjects, not internally used dictionaries. This saves space for the anyway unused PropertyDetails entry (1/3 fields).

Bug: 
Change-Id: I6fe9fae6de500dd0bcb722f51a7543952c7813e9
Reviewed-on: https://chromium-review.googlesource.com/543343
Commit-Queue: Toon Verwaest <verwaest@chromium.org>
Reviewed-by: 's avatarCamillo Bruni <cbruni@chromium.org>
Cr-Commit-Position: refs/heads/master@{#46124}
parent 269eaa82
......@@ -1064,13 +1064,12 @@ void ValueDeserializer::TransferArrayBuffer(
uint32_t transfer_id, Handle<JSArrayBuffer> array_buffer) {
if (array_buffer_transfer_map_.is_null()) {
array_buffer_transfer_map_ = isolate_->global_handles()->Create(
*SeededNumberDictionary::New(isolate_, 0));
*UnseededNumberDictionary::New(isolate_, 0));
}
Handle<SeededNumberDictionary> dictionary =
Handle<UnseededNumberDictionary> dictionary =
array_buffer_transfer_map_.ToHandleChecked();
Handle<JSObject> not_a_prototype_holder;
Handle<SeededNumberDictionary> new_dictionary = SeededNumberDictionary::Set(
dictionary, transfer_id, array_buffer, not_a_prototype_holder);
Handle<UnseededNumberDictionary> new_dictionary =
UnseededNumberDictionary::Set(dictionary, transfer_id, array_buffer);
if (!new_dictionary.is_identical_to(dictionary)) {
GlobalHandles::Destroy(Handle<Object>::cast(dictionary).location());
array_buffer_transfer_map_ =
......@@ -1579,13 +1578,13 @@ MaybeHandle<JSArrayBuffer> ValueDeserializer::ReadTransferredJSArrayBuffer(
bool is_shared) {
uint32_t id = next_id_++;
uint32_t transfer_id;
Handle<SeededNumberDictionary> transfer_map;
Handle<UnseededNumberDictionary> transfer_map;
if (!ReadVarint<uint32_t>().To(&transfer_id) ||
!array_buffer_transfer_map_.ToHandle(&transfer_map)) {
return MaybeHandle<JSArrayBuffer>();
}
int index = transfer_map->FindEntry(isolate_, transfer_id);
if (index == SeededNumberDictionary::kNotFound) {
if (index == UnseededNumberDictionary::kNotFound) {
return MaybeHandle<JSArrayBuffer>();
}
Handle<JSArrayBuffer> array_buffer(
......
......@@ -295,7 +295,7 @@ class ValueDeserializer {
// Always global handles.
Handle<FixedArray> id_map_;
MaybeHandle<SeededNumberDictionary> array_buffer_transfer_map_;
MaybeHandle<UnseededNumberDictionary> array_buffer_transfer_map_;
DISALLOW_COPY_AND_ASSIGN(ValueDeserializer);
};
......
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