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

Unified Diff: src/crankshaft/hydrogen.cc

Issue 2778623003: [typedarrays] Check detached buffer at start of typed array methods (Closed)
Patch Set: pass test262 for subarray Created 3 years, 9 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/crankshaft/hydrogen.h ('k') | src/js/typedarray.js » ('j') | no next file with comments »
Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
Index: src/crankshaft/hydrogen.cc
diff --git a/src/crankshaft/hydrogen.cc b/src/crankshaft/hydrogen.cc
index dbbddf3ba697fe97f08856fe6f16eebb393c4686..91691e08baac35879bf7fad76cde16f7a59451af 100644
--- a/src/crankshaft/hydrogen.cc
+++ b/src/crankshaft/hydrogen.cc
@@ -9924,6 +9924,23 @@ void HOptimizedGraphBuilder::GenerateArrayBufferViewGetByteOffset(
FieldIndex::ForInObjectOffset(JSArrayBufferView::kByteOffsetOffset)));
}
+void HOptimizedGraphBuilder::GenerateArrayBufferViewWasNeutered(
+ CallRuntime* expr) {
+ NoObservableSideEffectsScope scope(this);
+ DCHECK_EQ(expr->arguments()->length(), 1);
+ CHECK_ALIVE(VisitForValue(expr->arguments()->at(0)));
+ HValue* view = Pop();
+
+ HInstruction* buffer = Add<HLoadNamedField>(
+ view, nullptr, HObjectAccess::ForJSArrayBufferViewBuffer());
+ HInstruction* flags = Add<HLoadNamedField>(
+ buffer, nullptr, HObjectAccess::ForJSArrayBufferBitField());
+ HValue* was_neutered_mask =
+ Add<HConstant>(1 << JSArrayBuffer::WasNeutered::kShift);
+ HValue* was_neutered =
+ AddUncasted<HBitwise>(Token::BIT_AND, flags, was_neutered_mask);
+ return ast_context()->ReturnValue(was_neutered);
+}
void HOptimizedGraphBuilder::GenerateTypedArrayGetLength(
CallRuntime* expr) {
« no previous file with comments | « src/crankshaft/hydrogen.h ('k') | src/js/typedarray.js » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698