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

Unified Diff: src/hydrogen.cc

Issue 1061753008: Revert of Remove the weak list of views from array buffers (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/hydrogen.h ('k') | src/hydrogen-instructions.h » ('j') | 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 74434cd528b9dbc95bdb7e7f17fd1acbe57981dd..e7621d4d0f48b209e8553a1635fc904e9472597b 100644
--- a/src/hydrogen.cc
+++ b/src/hydrogen.cc
@@ -2427,22 +2427,6 @@
IsFixedTypedArrayElementsKind(elements_kind)) {
HValue* backing_store;
if (IsExternalArrayElementsKind(elements_kind)) {
- NoObservableSideEffectsScope no_effects(this);
- HInstruction* buffer = Add<HLoadNamedField>(
- checked_object, nullptr, HObjectAccess::ForJSArrayBufferViewBuffer());
- HInstruction* flags = Add<HLoadNamedField>(
- buffer, nullptr, HObjectAccess::ForJSArrayBufferFlag());
- HValue* was_neutered_mask =
- Add<HConstant>(1 << JSArrayBuffer::kWasNeuteredBit);
- HValue* was_neutered_test =
- AddUncasted<HBitwise>(Token::BIT_AND, flags, was_neutered_mask);
-
- IfBuilder if_was_neutered(this);
- if_was_neutered.If<HCompareNumericAndBranch>(
- was_neutered_test, graph()->GetConstant0(), Token::NE);
- if_was_neutered.ThenDeopt(Deoptimizer::kOutOfBounds);
- if_was_neutered.End();
-
backing_store = Add<HLoadNamedField>(
elements, nullptr, HObjectAccess::ForExternalArrayExternalPointer());
} else {
@@ -9629,11 +9613,20 @@
Add<HStoreNamedField>(
obj,
HObjectAccess::ForJSArrayBufferViewBuffer(), buffer);
+ HObjectAccess weak_first_view_access =
+ HObjectAccess::ForJSArrayBufferWeakFirstView();
+ Add<HStoreNamedField>(
+ obj, HObjectAccess::ForJSArrayBufferViewWeakNext(),
+ Add<HLoadNamedField>(buffer, nullptr, weak_first_view_access));
+ Add<HStoreNamedField>(buffer, weak_first_view_access, obj);
} else {
Add<HStoreNamedField>(
obj,
HObjectAccess::ForJSArrayBufferViewBuffer(),
Add<HConstant>(static_cast<int32_t>(0)));
+ Add<HStoreNamedField>(obj,
+ HObjectAccess::ForJSArrayBufferViewWeakNext(),
+ graph()->GetConstantUndefined());
}
}
@@ -9927,62 +9920,36 @@
}
-void HOptimizedGraphBuilder::GenerateArrayBufferViewIndirectAccessor(
- CallRuntime* expr, HObjectAccess access) {
- NoObservableSideEffectsScope scope(this);
+void HOptimizedGraphBuilder::GenerateArrayBufferViewGetByteLength(
+ CallRuntime* expr) {
DCHECK(expr->arguments()->length() == 1);
CHECK_ALIVE(VisitForValue(expr->arguments()->at(0)));
- HValue* view = Pop();
- HInstruction* buffer = Add<HLoadNamedField>(
- view, nullptr, HObjectAccess::ForJSArrayBufferViewBuffer());
- HInstruction* field = Add<HLoadNamedField>(view, nullptr, access);
-
- IfBuilder if_has_buffer(this);
- if_has_buffer.IfNot<HIsSmiAndBranch>(buffer);
- if_has_buffer.Then();
- {
- HInstruction* flags = Add<HLoadNamedField>(
- buffer, nullptr, HObjectAccess::ForJSArrayBufferFlag());
- HValue* was_neutered_mask =
- Add<HConstant>(1 << JSArrayBuffer::kWasNeuteredBit);
- HValue* was_neutered_test =
- AddUncasted<HBitwise>(Token::BIT_AND, flags, was_neutered_mask);
-
- IfBuilder if_was_neutered(this);
- if_was_neutered.If<HCompareNumericAndBranch>(
- was_neutered_test, graph()->GetConstant0(), Token::NE);
- if_was_neutered.Then();
- Push(graph()->GetConstant0());
- if_was_neutered.Else();
- Push(field);
- if_was_neutered.End();
- }
- if_has_buffer.Else();
- Push(field);
- if_has_buffer.End();
-
- return ast_context()->ReturnValue(Pop());
-}
-
-
-void HOptimizedGraphBuilder::GenerateArrayBufferViewGetByteLength(
- CallRuntime* expr) {
- return GenerateArrayBufferViewIndirectAccessor(
- expr, HObjectAccess::ForJSArrayBufferViewByteLength());
+ HValue* buffer = Pop();
+ HInstruction* result = New<HLoadNamedField>(
+ buffer, nullptr, HObjectAccess::ForJSArrayBufferViewByteLength());
+ return ast_context()->ReturnInstruction(result, expr->id());
}
void HOptimizedGraphBuilder::GenerateArrayBufferViewGetByteOffset(
CallRuntime* expr) {
- return GenerateArrayBufferViewIndirectAccessor(
- expr, HObjectAccess::ForJSArrayBufferViewByteOffset());
+ DCHECK(expr->arguments()->length() == 1);
+ CHECK_ALIVE(VisitForValue(expr->arguments()->at(0)));
+ HValue* buffer = Pop();
+ HInstruction* result = New<HLoadNamedField>(
+ buffer, nullptr, HObjectAccess::ForJSArrayBufferViewByteOffset());
+ return ast_context()->ReturnInstruction(result, expr->id());
}
void HOptimizedGraphBuilder::GenerateTypedArrayGetLength(
CallRuntime* expr) {
- return GenerateArrayBufferViewIndirectAccessor(
- expr, HObjectAccess::ForJSTypedArrayLength());
+ DCHECK(expr->arguments()->length() == 1);
+ CHECK_ALIVE(VisitForValue(expr->arguments()->at(0)));
+ HValue* buffer = Pop();
+ HInstruction* result = New<HLoadNamedField>(
+ buffer, nullptr, HObjectAccess::ForJSTypedArrayLength());
+ return ast_context()->ReturnInstruction(result, expr->id());
}
« no previous file with comments | « src/hydrogen.h ('k') | src/hydrogen-instructions.h » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698