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

Side by Side Diff: src/api.cc

Issue 150813004: In-heap small typed arrays (Closed) Base URL: https://v8.googlecode.com/svn/branches/bleeding_edge
Patch Set: Patch for review Created 6 years, 9 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 | Annotate | Revision Log
OLDNEW
1 // Copyright 2012 the V8 project authors. All rights reserved. 1 // Copyright 2012 the V8 project authors. All rights reserved.
2 // Redistribution and use in source and binary forms, with or without 2 // Redistribution and use in source and binary forms, with or without
3 // modification, are permitted provided that the following conditions are 3 // modification, are permitted provided that the following conditions are
4 // met: 4 // met:
5 // 5 //
6 // * Redistributions of source code must retain the above copyright 6 // * Redistributions of source code must retain the above copyright
7 // notice, this list of conditions and the following disclaimer. 7 // notice, this list of conditions and the following disclaimer.
8 // * Redistributions in binary form must reproduce the above 8 // * Redistributions in binary form must reproduce the above
9 // copyright notice, this list of conditions and the following 9 // copyright notice, this list of conditions and the following
10 // disclaimer in the documentation and/or other materials provided 10 // disclaimer in the documentation and/or other materials provided
(...skipping 5909 matching lines...) Expand 10 before | Expand all | Expand 10 after
5920 isolate, obj, buffer, byte_offset, byte_length); 5920 isolate, obj, buffer, byte_offset, byte_length);
5921 5921
5922 i::Handle<i::Object> length_object = 5922 i::Handle<i::Object> length_object =
5923 isolate->factory()->NewNumberFromSize(length); 5923 isolate->factory()->NewNumberFromSize(length);
5924 obj->set_length(*length_object); 5924 obj->set_length(*length_object);
5925 5925
5926 i::Handle<i::ExternalArray> elements = 5926 i::Handle<i::ExternalArray> elements =
5927 isolate->factory()->NewExternalArray( 5927 isolate->factory()->NewExternalArray(
5928 static_cast<int>(length), array_type, 5928 static_cast<int>(length), array_type,
5929 static_cast<uint8_t*>(buffer->backing_store()) + byte_offset); 5929 static_cast<uint8_t*>(buffer->backing_store()) + byte_offset);
5930 obj->set_elements(*elements); 5930 i::Handle<i::Map> map =
5931 i::JSObject::GetElementsTransitionMap(obj, elements_kind);
5932 obj->set_map_and_elements(*map, *elements);
5931 return obj; 5933 return obj;
5932 } 5934 }
5933 5935
5934 5936
5935 #define TYPED_ARRAY_NEW(Type, type, TYPE, ctype, size) \ 5937 #define TYPED_ARRAY_NEW(Type, type, TYPE, ctype, size) \
5936 Local<Type##Array> Type##Array::New(Handle<ArrayBuffer> array_buffer, \ 5938 Local<Type##Array> Type##Array::New(Handle<ArrayBuffer> array_buffer, \
5937 size_t byte_offset, size_t length) { \ 5939 size_t byte_offset, size_t length) { \
5938 i::Isolate* isolate = i::Isolate::Current(); \ 5940 i::Isolate* isolate = i::Isolate::Current(); \
5939 EnsureInitializedForIsolate(isolate, \ 5941 EnsureInitializedForIsolate(isolate, \
5940 "v8::" #Type "Array::New(Handle<ArrayBuffer>, size_t, size_t)"); \ 5942 "v8::" #Type "Array::New(Handle<ArrayBuffer>, size_t, size_t)"); \
(...skipping 1436 matching lines...) Expand 10 before | Expand all | Expand 10 after
7377 Isolate* isolate = reinterpret_cast<Isolate*>(info.GetIsolate()); 7379 Isolate* isolate = reinterpret_cast<Isolate*>(info.GetIsolate());
7378 Address callback_address = 7380 Address callback_address =
7379 reinterpret_cast<Address>(reinterpret_cast<intptr_t>(callback)); 7381 reinterpret_cast<Address>(reinterpret_cast<intptr_t>(callback));
7380 VMState<EXTERNAL> state(isolate); 7382 VMState<EXTERNAL> state(isolate);
7381 ExternalCallbackScope call_scope(isolate, callback_address); 7383 ExternalCallbackScope call_scope(isolate, callback_address);
7382 callback(info); 7384 callback(info);
7383 } 7385 }
7384 7386
7385 7387
7386 } } // namespace v8::internal 7388 } } // namespace v8::internal
OLDNEW
« no previous file with comments | « src/accessors.cc ('k') | src/bootstrapper.cc » ('j') | src/flag-definitions.h » ('J')

Powered by Google App Engine
This is Rietveld 408576698