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

Unified Diff: src/hydrogen.cc

Issue 1215003002: Avoid allocations during ArrayBuffer initialization. (Closed) Base URL: https://chromium.googlesource.com/v8/v8.git@master
Patch Set: Created 5 years, 6 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 | « no previous file | no next file » | no next file with comments »
Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
Index: src/hydrogen.cc
diff --git a/src/hydrogen.cc b/src/hydrogen.cc
index 0019b6d578c803af9f19376d253cfc8945165ef6..6f63b76ba97693cdea6946ec98e6004a191f7b37 100644
--- a/src/hydrogen.cc
+++ b/src/hydrogen.cc
@@ -9722,6 +9722,12 @@ void HOptimizedGraphBuilder::BuildInitializeInobjectProperties(
HValue* HGraphBuilder::BuildAllocateEmptyArrayBuffer(HValue* byte_length) {
+ // We HForceRepresentation here to avoid allocations during an *-to-tagged
+ // HChange that could cause GC while the array buffer object is not fully
+ // initialized.
+ HObjectAccess byte_length_access(HObjectAccess::ForJSArrayBufferByteLength());
+ byte_length = AddUncasted<HForceRepresentation>(
+ byte_length, byte_length_access.representation());
HAllocate* result =
BuildAllocate(Add<HConstant>(JSArrayBuffer::kSizeWithInternalFields),
HType::JSObject(), JS_ARRAY_BUFFER_TYPE, HAllocationMode());
@@ -9749,8 +9755,7 @@ HValue* HGraphBuilder::BuildAllocateEmptyArrayBuffer(HValue* byte_length) {
result, HObjectAccess::ForJSArrayBufferBackingStore().WithRepresentation(
Representation::Smi()),
graph()->GetConstant0());
- Add<HStoreNamedField>(result, HObjectAccess::ForJSArrayBufferByteLength(),
- byte_length);
+ Add<HStoreNamedField>(result, byte_length_access, byte_length);
Add<HStoreNamedField>(result, HObjectAccess::ForJSArrayBufferBitFieldSlot(),
graph()->GetConstant0());
Add<HStoreNamedField>(
« no previous file with comments | « no previous file | no next file » | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698