Chromium Code Reviews
chromiumcodereview-hr@appspot.gserviceaccount.com (chromiumcodereview-hr) | Please choose your nickname with Settings | Help | Chromium Project | Gerrit Changes | Sign out
(122)

Unified Diff: src/runtime/runtime-typedarray.cc

Issue 1079923003: Put newly allocated buffers at the right end of the buffers list (Closed) Base URL: https://chromium.googlesource.com/v8/v8.git@master
Patch Set: Created 5 years, 8 months ago
Use n/p to move between diff chunks; N/P to move between comments. Draft comments are only viewable by you.
Jump to:
View side-by-side diff with in-line comments
Download patch
« no previous file with comments | « src/heap/objects-visiting.cc ('k') | src/snapshot/serialize.cc » ('j') | no next file with comments »
Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
Index: src/runtime/runtime-typedarray.cc
diff --git a/src/runtime/runtime-typedarray.cc b/src/runtime/runtime-typedarray.cc
index 510ceb1ac9631e4ebb9fc97f2f958fb0d3fccf2d..a1aacd7aa8a744236c311f8698e8b0f8b810016b 100644
--- a/src/runtime/runtime-typedarray.cc
+++ b/src/runtime/runtime-typedarray.cc
@@ -51,9 +51,18 @@ void Runtime::SetupArrayBuffer(Isolate* isolate,
CHECK(byte_length->IsSmi() || byte_length->IsHeapNumber());
array_buffer->set_byte_length(*byte_length);
- array_buffer->set_weak_next(isolate->heap()->array_buffers_list());
- CHECK(isolate->heap()->InNewSpace(*array_buffer));
- isolate->heap()->set_array_buffers_list(*array_buffer);
+ if (isolate->heap()->InNewSpace(*array_buffer) ||
+ isolate->heap()->array_buffers_list()->IsUndefined()) {
+ array_buffer->set_weak_next(isolate->heap()->array_buffers_list());
+ isolate->heap()->set_array_buffers_list(*array_buffer);
+ if (isolate->heap()->last_array_buffer_in_list()->IsUndefined()) {
+ isolate->heap()->set_last_array_buffer_in_list(*array_buffer);
+ }
+ } else {
+ JSArrayBuffer::cast(isolate->heap()->last_array_buffer_in_list())
+ ->set_weak_next(*array_buffer);
+ isolate->heap()->set_last_array_buffer_in_list(*array_buffer);
+ }
array_buffer->set_weak_first_view(isolate->heap()->undefined_value());
}
« no previous file with comments | « src/heap/objects-visiting.cc ('k') | src/snapshot/serialize.cc » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698