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

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: CR feedback + rebase 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 5874 matching lines...) Expand 10 before | Expand all | Expand 10 after
5885 isolate, obj, buffer, byte_offset, byte_length); 5885 isolate, obj, buffer, byte_offset, byte_length);
5886 5886
5887 i::Handle<i::Object> length_object = 5887 i::Handle<i::Object> length_object =
5888 isolate->factory()->NewNumberFromSize(length); 5888 isolate->factory()->NewNumberFromSize(length);
5889 obj->set_length(*length_object); 5889 obj->set_length(*length_object);
5890 5890
5891 i::Handle<i::ExternalArray> elements = 5891 i::Handle<i::ExternalArray> elements =
5892 isolate->factory()->NewExternalArray( 5892 isolate->factory()->NewExternalArray(
5893 static_cast<int>(length), array_type, 5893 static_cast<int>(length), array_type,
5894 static_cast<uint8_t*>(buffer->backing_store()) + byte_offset); 5894 static_cast<uint8_t*>(buffer->backing_store()) + byte_offset);
5895 obj->set_elements(*elements); 5895 i::Handle<i::Map> map =
5896 i::JSObject::GetElementsTransitionMap(obj, elements_kind);
5897 obj->set_map_and_elements(*map, *elements);
5896 return obj; 5898 return obj;
5897 } 5899 }
5898 5900
5899 5901
5900 #define TYPED_ARRAY_NEW(Type, type, TYPE, ctype, size) \ 5902 #define TYPED_ARRAY_NEW(Type, type, TYPE, ctype, size) \
5901 Local<Type##Array> Type##Array::New(Handle<ArrayBuffer> array_buffer, \ 5903 Local<Type##Array> Type##Array::New(Handle<ArrayBuffer> array_buffer, \
5902 size_t byte_offset, size_t length) { \ 5904 size_t byte_offset, size_t length) { \
5903 i::Isolate* isolate = i::Isolate::Current(); \ 5905 i::Isolate* isolate = i::Isolate::Current(); \
5904 EnsureInitializedForIsolate(isolate, \ 5906 EnsureInitializedForIsolate(isolate, \
5905 "v8::" #Type "Array::New(Handle<ArrayBuffer>, size_t, size_t)"); \ 5907 "v8::" #Type "Array::New(Handle<ArrayBuffer>, size_t, size_t)"); \
(...skipping 1431 matching lines...) Expand 10 before | Expand all | Expand 10 after
7337 Isolate* isolate = reinterpret_cast<Isolate*>(info.GetIsolate()); 7339 Isolate* isolate = reinterpret_cast<Isolate*>(info.GetIsolate());
7338 Address callback_address = 7340 Address callback_address =
7339 reinterpret_cast<Address>(reinterpret_cast<intptr_t>(callback)); 7341 reinterpret_cast<Address>(reinterpret_cast<intptr_t>(callback));
7340 VMState<EXTERNAL> state(isolate); 7342 VMState<EXTERNAL> state(isolate);
7341 ExternalCallbackScope call_scope(isolate, callback_address); 7343 ExternalCallbackScope call_scope(isolate, callback_address);
7342 callback(info); 7344 callback(info);
7343 } 7345 }
7344 7346
7345 7347
7346 } } // namespace v8::internal 7348 } } // namespace v8::internal
OLDNEW
« no previous file with comments | « src/accessors.cc ('k') | src/bootstrapper.cc » ('j') | src/hydrogen.cc » ('J')

Powered by Google App Engine
This is Rietveld 408576698