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

Unified Diff: src/hydrogen.cc

Issue 1257223002: Revert of Remove ExternalArray, derived types, and element kinds (Closed) Base URL: https://chromium.googlesource.com/v8/v8.git@master
Patch Set: Created 5 years, 5 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/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 abfe9cab2b307826353dcff2bde76cb104a56c90..f4bd4179790f34409068a04ce518c46c6ecca4c7 100644
--- a/src/hydrogen.cc
+++ b/src/hydrogen.cc
@@ -2416,7 +2416,9 @@
KeyedAccessStoreMode store_mode) {
DCHECK(top_info()->IsStub() || checked_object->IsCompareMap() ||
checked_object->IsCheckMaps());
- DCHECK(!IsFixedTypedArrayElementsKind(elements_kind) || !is_js_array);
+ DCHECK((!IsExternalArrayElementsKind(elements_kind) &&
+ !IsFixedTypedArrayElementsKind(elements_kind)) ||
+ !is_js_array);
// No GVNFlag is necessary for ElementsKind if there is an explicit dependency
// on a HElementsTransition instruction. The flag can also be removed if the
// map to check has FAST_HOLEY_ELEMENTS, since there can be no further
@@ -2447,17 +2449,24 @@
}
length->set_type(HType::Smi());
HValue* checked_key = NULL;
- if (IsFixedTypedArrayElementsKind(elements_kind)) {
+ if (IsExternalArrayElementsKind(elements_kind) ||
+ IsFixedTypedArrayElementsKind(elements_kind)) {
checked_object = Add<HCheckArrayBufferNotNeutered>(checked_object);
- HValue* external_pointer = Add<HLoadNamedField>(
- elements, nullptr,
- HObjectAccess::ForFixedTypedArrayBaseExternalPointer());
- HValue* base_pointer = Add<HLoadNamedField>(
- elements, nullptr, HObjectAccess::ForFixedTypedArrayBaseBasePointer());
- HValue* backing_store = AddUncasted<HAdd>(
- external_pointer, base_pointer, Strength::WEAK, AddOfExternalAndTagged);
-
+ HValue* backing_store;
+ if (IsExternalArrayElementsKind(elements_kind)) {
+ backing_store = Add<HLoadNamedField>(
+ elements, nullptr, HObjectAccess::ForExternalArrayExternalPointer());
+ } else {
+ HValue* external_pointer = Add<HLoadNamedField>(
+ elements, nullptr,
+ HObjectAccess::ForFixedTypedArrayBaseExternalPointer());
+ HValue* base_pointer = Add<HLoadNamedField>(
+ elements, nullptr,
+ HObjectAccess::ForFixedTypedArrayBaseBasePointer());
+ backing_store = AddUncasted<HAdd>(external_pointer, base_pointer,
+ Strength::WEAK, AddOfExternalAndTagged);
+ }
if (store_mode == STORE_NO_TRANSITION_IGNORE_OUT_OF_BOUNDS) {
NoObservableSideEffectsScope no_effects(this);
IfBuilder length_checker(this);
@@ -2689,7 +2698,8 @@
LoadKeyedHoleMode load_mode) {
if (access_type == STORE) {
DCHECK(val != NULL);
- if (elements_kind == UINT8_CLAMPED_ELEMENTS) {
+ if (elements_kind == EXTERNAL_UINT8_CLAMPED_ELEMENTS ||
+ elements_kind == UINT8_CLAMPED_ELEMENTS) {
val = Add<HClampToUint8>(val);
}
return Add<HStoreKeyed>(elements, checked_key, val, elements_kind,
@@ -2700,7 +2710,8 @@
DCHECK(val == NULL);
HLoadKeyed* load = Add<HLoadKeyed>(
elements, checked_key, dependency, elements_kind, load_mode);
- if (elements_kind == UINT32_ELEMENTS) {
+ if (elements_kind == EXTERNAL_UINT32_ELEMENTS ||
+ elements_kind == UINT32_ELEMENTS) {
graph()->RecordUint32Instruction(load);
}
return load;
@@ -7402,6 +7413,7 @@
val));
} else {
DCHECK(IsFastElementsKind(elements_kind) ||
+ IsExternalArrayElementsKind(elements_kind) ||
IsFixedTypedArrayElementsKind(elements_kind));
LoadKeyedHoleMode load_mode = BuildKeyedHoleMode(map);
// Happily, mapcompare is a checked object.
@@ -9936,14 +9948,14 @@
bool is_zero_byte_offset,
HValue* buffer, HValue* byte_offset, HValue* length) {
Handle<Map> external_array_map(
- isolate()->heap()->MapForFixedTypedArray(array_type));
+ isolate()->heap()->MapForExternalArrayType(array_type));
// The HForceRepresentation is to prevent possible deopt on int-smi
// conversion after allocation but before the new object fields are set.
length = AddUncasted<HForceRepresentation>(length, Representation::Smi());
- HValue* elements = Add<HAllocate>(
- Add<HConstant>(FixedTypedArrayBase::kHeaderSize), HType::HeapObject(),
- NOT_TENURED, external_array_map->instance_type());
+ HValue* elements =
+ Add<HAllocate>(Add<HConstant>(ExternalArray::kSize), HType::HeapObject(),
+ NOT_TENURED, external_array_map->instance_type());
AddStoreMapConstant(elements, external_array_map);
Add<HStoreNamedField>(elements,
@@ -9965,11 +9977,8 @@
}
Add<HStoreNamedField>(elements,
- HObjectAccess::ForFixedTypedArrayBaseBasePointer(),
- graph()->GetConstant0());
- Add<HStoreNamedField>(elements,
- HObjectAccess::ForFixedTypedArrayBaseExternalPointer(),
- typed_array_start);
+ HObjectAccess::ForExternalArrayExternalPointer(),
+ typed_array_start);
return elements;
}
@@ -10116,10 +10125,13 @@
ExternalArrayType array_type =
kExternalInt8Array; // Bogus initialization.
size_t element_size = 1; // Bogus initialization.
+ ElementsKind external_elements_kind = // Bogus initialization.
+ EXTERNAL_INT8_ELEMENTS;
ElementsKind fixed_elements_kind = // Bogus initialization.
INT8_ELEMENTS;
Runtime::ArrayIdToTypeAndSize(array_id,
&array_type,
+ &external_elements_kind,
&fixed_elements_kind,
&element_size);
@@ -10144,8 +10156,8 @@
if (buffer != NULL) {
elements = BuildAllocateExternalElements(
array_type, is_zero_byte_offset, buffer, byte_offset, length);
- Handle<Map> obj_map =
- TypedArrayMap(isolate(), array_type, fixed_elements_kind);
+ Handle<Map> obj_map = TypedArrayMap(
+ isolate(), array_type, external_elements_kind);
AddStoreMapConstant(obj, obj_map);
} else {
DCHECK(is_zero_byte_offset);
« no previous file with comments | « src/heap/objects-visiting.cc ('k') | src/hydrogen-instructions.h » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698