Chromium Code Reviews

Unified Diff: src/compiler/js-native-context-specialization.cc

Issue 1453653003: [turbofan] Add support for special JSArrayBufferView accessors. (Closed) Base URL: https://chromium.googlesource.com/v8/v8.git@master
Patch Set: Created 5 years, 1 month ago
Use n/p to move between diff chunks; N/P to move between comments.
Jump to:
View side-by-side diff with in-line comments
« no previous file with comments | « src/compiler/access-info.cc ('k') | src/objects.h » ('j') | no next file with comments »
Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
Index: src/compiler/js-native-context-specialization.cc
diff --git a/src/compiler/js-native-context-specialization.cc b/src/compiler/js-native-context-specialization.cc
index 8c44eaf1752a083de65f0550399fa4f5d3741d27..237d372fb00ade0b8e3ac92f81fa51d673a9c83b 100644
--- a/src/compiler/js-native-context-specialization.cc
+++ b/src/compiler/js-native-context-specialization.cc
@@ -210,7 +210,33 @@ Reduction JSNativeContextSpecialization::ReduceNamedAccess(
} else {
DCHECK(access_info.IsDataField());
FieldIndex const field_index = access_info.field_index();
+ FieldCheck const field_check = access_info.field_check();
Type* const field_type = access_info.field_type();
+ switch (field_check) {
+ case FieldCheck::kNone:
+ break;
+ case FieldCheck::kJSArrayBufferViewBufferNotNeutered: {
+ Node* this_buffer = this_effect =
+ graph()->NewNode(simplified()->LoadField(
+ AccessBuilder::ForJSArrayBufferViewBuffer()),
+ this_receiver, this_effect, this_control);
+ Node* this_buffer_bit_field = this_effect =
+ graph()->NewNode(simplified()->LoadField(
+ AccessBuilder::ForJSArrayBufferBitField()),
+ this_buffer, this_effect, this_control);
+ Node* check = graph()->NewNode(
+ machine()->Word32Equal(),
+ graph()->NewNode(machine()->Word32And(), this_buffer_bit_field,
+ jsgraph()->Int32Constant(
+ 1 << JSArrayBuffer::WasNeutered::kShift)),
+ jsgraph()->Int32Constant(0));
+ Node* branch = graph()->NewNode(common()->Branch(BranchHint::kFalse),
+ check, this_control);
+ exit_controls.push_back(graph()->NewNode(common()->IfTrue(), branch));
+ this_control = graph()->NewNode(common()->IfFalse(), branch);
+ break;
+ }
+ }
if (access_mode == AccessMode::kLoad &&
access_info.holder().ToHandle(&holder)) {
this_receiver = jsgraph()->Constant(holder);
« no previous file with comments | « src/compiler/access-info.cc ('k') | src/objects.h » ('j') | no next file with comments »

Powered by Google App Engine