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

Unified Diff: src/factory.cc

Issue 1073053006: Revert of LayoutDescriptor should inherit from JSTypedArray (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/factory.h ('k') | src/layout-descriptor.h » ('j') | no next file with comments »
Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
Index: src/factory.cc
diff --git a/src/factory.cc b/src/factory.cc
index f038fec6ddf2daa7c6df66a39b15c9aa3764c4f3..106f3d75d3d27775ba2d13f6e27989f4521a3903 100644
--- a/src/factory.cc
+++ b/src/factory.cc
@@ -1826,38 +1826,9 @@
case kExternal##Type##Array: \
return size;
TYPED_ARRAYS(TYPED_ARRAY_CASE)
- default:
- UNREACHABLE();
- return 0;
- }
-#undef TYPED_ARRAY_CASE
-}
-
-
-size_t GetFixedTypedArraysElementSize(ElementsKind kind) {
- switch (kind) {
-#define TYPED_ARRAY_CASE(Type, type, TYPE, ctype, size) \
- case TYPE##_ELEMENTS: \
- return size;
- TYPED_ARRAYS(TYPED_ARRAY_CASE)
- default:
- UNREACHABLE();
- return 0;
- }
-#undef TYPED_ARRAY_CASE
-}
-
-
-ExternalArrayType GetArrayTypeFromElementsKind(ElementsKind kind) {
- switch (kind) {
-#define TYPED_ARRAY_CASE(Type, type, TYPE, ctype, size) \
- case TYPE##_ELEMENTS: \
- return kExternal##Type##Array;
- TYPED_ARRAYS(TYPED_ARRAY_CASE)
- default:
- UNREACHABLE();
- return kExternalInt8Array;
- }
+ }
+ UNREACHABLE();
+ return 0;
#undef TYPED_ARRAY_CASE
}
@@ -1868,23 +1839,6 @@
#define TYPED_ARRAY_FUN(Type, type, TYPE, ctype, size) \
case kExternal##Type##Array: \
return native_context->type##_array_fun();
-
- TYPED_ARRAYS(TYPED_ARRAY_FUN)
-#undef TYPED_ARRAY_FUN
-
- default:
- UNREACHABLE();
- return NULL;
- }
-}
-
-
-JSFunction* GetTypedArrayFun(ElementsKind elements_kind, Isolate* isolate) {
- Context* native_context = isolate->context()->native_context();
- switch (elements_kind) {
-#define TYPED_ARRAY_FUN(Type, type, TYPE, ctype, size) \
- case TYPE##_ELEMENTS: \
- return native_context->type##_array_fun();
TYPED_ARRAYS(TYPED_ARRAY_FUN)
#undef TYPED_ARRAY_FUN
@@ -1937,16 +1891,6 @@
}
-Handle<JSTypedArray> Factory::NewJSTypedArray(ElementsKind elements_kind) {
- Handle<JSFunction> typed_array_fun_handle(
- GetTypedArrayFun(elements_kind, isolate()));
-
- CALL_HEAP_FUNCTION(
- isolate(), isolate()->heap()->AllocateJSObject(*typed_array_fun_handle),
- JSTypedArray);
-}
-
-
Handle<JSTypedArray> Factory::NewJSTypedArray(ExternalArrayType type,
Handle<JSArrayBuffer> buffer,
size_t byte_offset,
@@ -1971,35 +1915,6 @@
static_cast<uint8_t*>(buffer->backing_store()) + byte_offset);
Handle<Map> map = JSObject::GetElementsTransitionMap(obj, elements_kind);
JSObject::SetMapAndElements(obj, map, elements);
- return obj;
-}
-
-
-Handle<JSTypedArray> Factory::NewJSTypedArray(ElementsKind elements_kind,
- size_t number_of_elements) {
- Handle<JSTypedArray> obj = NewJSTypedArray(elements_kind);
-
- size_t element_size = GetFixedTypedArraysElementSize(elements_kind);
- ExternalArrayType array_type = GetArrayTypeFromElementsKind(elements_kind);
-
- CHECK(number_of_elements <=
- (std::numeric_limits<size_t>::max() / element_size));
- CHECK(number_of_elements <= static_cast<size_t>(Smi::kMaxValue));
- size_t byte_length = number_of_elements * element_size;
-
- obj->set_byte_offset(Smi::FromInt(0));
- i::Handle<i::Object> byte_length_object =
- isolate()->factory()->NewNumberFromSize(byte_length);
- obj->set_byte_length(*byte_length_object);
- Handle<Object> length_object = NewNumberFromSize(number_of_elements);
- obj->set_length(*length_object);
-
- obj->set_buffer(Smi::FromInt(0));
- obj->set_weak_next(isolate()->heap()->undefined_value());
- Handle<FixedTypedArrayBase> elements =
- isolate()->factory()->NewFixedTypedArray(
- static_cast<int>(number_of_elements), array_type);
- obj->set_elements(*elements);
return obj;
}
« no previous file with comments | « src/factory.h ('k') | src/layout-descriptor.h » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698