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

Unified Diff: src/factory.cc

Issue 646483003: [turbofan] Fix typed lowering of typed array loads/stores. (Closed) Base URL: https://v8.googlecode.com/svn/branches/bleeding_edge
Patch Set: Fix win64. Created 6 years, 2 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/compiler/js-typed-lowering.cc ('k') | no next file » | 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 25d8cd80e50c75f4b2eb3a4d72bf6b831058c575..60ea691d916ff071dfec04459bdccd7c34c7b0fd 100644
--- a/src/factory.cc
+++ b/src/factory.cc
@@ -1731,6 +1731,19 @@ ElementsKind GetExternalArrayElementsKind(ExternalArrayType type) {
}
+size_t GetExternalArrayElementSize(ExternalArrayType type) {
+ switch (type) {
+#define TYPED_ARRAY_CASE(Type, type, TYPE, ctype, size) \
+ case kExternal##Type##Array: \
+ return size;
+ TYPED_ARRAYS(TYPED_ARRAY_CASE)
+ }
+ UNREACHABLE();
+ return 0;
+#undef TYPED_ARRAY_CASE
+}
+
+
JSFunction* GetTypedArrayFun(ExternalArrayType type, Isolate* isolate) {
Context* native_context = isolate->context()->native_context();
switch (type) {
@@ -1769,7 +1782,9 @@ Handle<JSTypedArray> Factory::NewJSTypedArray(ExternalArrayType type,
array->set_weak_next(buffer->weak_first_view());
buffer->set_weak_first_view(*array);
array->set_byte_offset(Smi::FromInt(0));
- array->set_byte_length(buffer->byte_length());
+ Handle<Object> byte_length_handle =
Dmitry Lomov (no reviews) 2014/10/10 08:43:02 DBC: why we have this Factory::NewJSTypedArray? W
+ NewNumberFromSize(length * GetExternalArrayElementSize(type));
+ array->set_byte_length(*byte_length_handle);
Handle<Object> length_handle = NewNumberFromSize(length);
array->set_length(*length_handle);
Handle<ExternalArray> elements =
« no previous file with comments | « src/compiler/js-typed-lowering.cc ('k') | no next file » | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698