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

Side by Side Diff: src/runtime/runtime-typedarray.cc

Issue 1109353003: Unify internal and external typed arrays a bit (Closed) Base URL: https://chromium.googlesource.com/v8/v8.git@master
Patch Set: updates Created 5 years, 7 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 unified diff | Download patch
« no previous file with comments | « src/ppc/lithium-codegen-ppc.cc ('k') | src/x64/lithium-codegen-x64.cc » ('j') | no next file with comments »
Toggle Intra-line Diffs ('i') | Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
OLDNEW
1 // Copyright 2014 the V8 project authors. All rights reserved. 1 // Copyright 2014 the V8 project authors. All rights reserved.
2 // Use of this source code is governed by a BSD-style license that can be 2 // Use of this source code is governed by a BSD-style license that can be
3 // found in the LICENSE file. 3 // found in the LICENSE file.
4 4
5 #include "src/v8.h" 5 #include "src/v8.h"
6 6
7 #include "src/arguments.h" 7 #include "src/arguments.h"
8 #include "src/runtime/runtime.h" 8 #include "src/runtime/runtime.h"
9 #include "src/runtime/runtime-utils.h" 9 #include "src/runtime/runtime-utils.h"
10 10
(...skipping 223 matching lines...) Expand 10 before | Expand all | Expand 10 after
234 holder->set_buffer(*buffer); 234 holder->set_buffer(*buffer);
235 235
236 Handle<ExternalArray> elements = isolate->factory()->NewExternalArray( 236 Handle<ExternalArray> elements = isolate->factory()->NewExternalArray(
237 static_cast<int>(length), array_type, 237 static_cast<int>(length), array_type,
238 static_cast<uint8_t*>(buffer->backing_store()) + byte_offset); 238 static_cast<uint8_t*>(buffer->backing_store()) + byte_offset);
239 Handle<Map> map = 239 Handle<Map> map =
240 JSObject::GetElementsTransitionMap(holder, external_elements_kind); 240 JSObject::GetElementsTransitionMap(holder, external_elements_kind);
241 JSObject::SetMapAndElements(holder, map, elements); 241 JSObject::SetMapAndElements(holder, map, elements);
242 DCHECK(IsExternalArrayElementsKind(holder->map()->elements_kind())); 242 DCHECK(IsExternalArrayElementsKind(holder->map()->elements_kind()));
243 } else { 243 } else {
244 holder->set_buffer(Smi::FromInt(0)); 244 Handle<JSArrayBuffer> buffer = isolate->factory()->NewJSArrayBuffer();
245 Runtime::SetupArrayBuffer(isolate, buffer, true, NULL, byte_length);
246 holder->set_buffer(*buffer);
245 Handle<FixedTypedArrayBase> elements = 247 Handle<FixedTypedArrayBase> elements =
246 isolate->factory()->NewFixedTypedArray(static_cast<int>(length), 248 isolate->factory()->NewFixedTypedArray(static_cast<int>(length),
247 array_type); 249 array_type);
248 holder->set_elements(*elements); 250 holder->set_elements(*elements);
249 } 251 }
250 return isolate->heap()->undefined_value(); 252 return isolate->heap()->undefined_value();
251 } 253 }
252 254
253 255
254 // Initializes a typed array from an array-like object. 256 // Initializes a typed array from an array-like object.
(...skipping 462 matching lines...) Expand 10 before | Expand all | Expand 10 after
717 DATA_VIEW_SETTER(Uint16, uint16_t) 719 DATA_VIEW_SETTER(Uint16, uint16_t)
718 DATA_VIEW_SETTER(Int16, int16_t) 720 DATA_VIEW_SETTER(Int16, int16_t)
719 DATA_VIEW_SETTER(Uint32, uint32_t) 721 DATA_VIEW_SETTER(Uint32, uint32_t)
720 DATA_VIEW_SETTER(Int32, int32_t) 722 DATA_VIEW_SETTER(Int32, int32_t)
721 DATA_VIEW_SETTER(Float32, float) 723 DATA_VIEW_SETTER(Float32, float)
722 DATA_VIEW_SETTER(Float64, double) 724 DATA_VIEW_SETTER(Float64, double)
723 725
724 #undef DATA_VIEW_SETTER 726 #undef DATA_VIEW_SETTER
725 } 727 }
726 } // namespace v8::internal 728 } // namespace v8::internal
OLDNEW
« no previous file with comments | « src/ppc/lithium-codegen-ppc.cc ('k') | src/x64/lithium-codegen-x64.cc » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698