OLD | NEW |
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 6072 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
6083 isolate, obj, buffer, byte_offset, byte_length); | 6083 isolate, obj, buffer, byte_offset, byte_length); |
6084 | 6084 |
6085 i::Handle<i::Object> length_object = | 6085 i::Handle<i::Object> length_object = |
6086 isolate->factory()->NewNumberFromSize(length); | 6086 isolate->factory()->NewNumberFromSize(length); |
6087 obj->set_length(*length_object); | 6087 obj->set_length(*length_object); |
6088 | 6088 |
6089 i::Handle<i::ExternalArray> elements = | 6089 i::Handle<i::ExternalArray> elements = |
6090 isolate->factory()->NewExternalArray( | 6090 isolate->factory()->NewExternalArray( |
6091 static_cast<int>(length), array_type, | 6091 static_cast<int>(length), array_type, |
6092 static_cast<uint8_t*>(buffer->backing_store()) + byte_offset); | 6092 static_cast<uint8_t*>(buffer->backing_store()) + byte_offset); |
6093 i::Handle<i::Map> map = | 6093 obj->set_elements(*elements); |
6094 i::JSObject::GetElementsTransitionMap(obj, elements_kind); | |
6095 obj->set_map_and_elements(*map, *elements); | |
6096 return obj; | 6094 return obj; |
6097 } | 6095 } |
6098 | 6096 |
6099 | 6097 |
6100 #define TYPED_ARRAY_NEW(Type, type, TYPE, ctype, size) \ | 6098 #define TYPED_ARRAY_NEW(Type, type, TYPE, ctype, size) \ |
6101 Local<Type##Array> Type##Array::New(Handle<ArrayBuffer> array_buffer, \ | 6099 Local<Type##Array> Type##Array::New(Handle<ArrayBuffer> array_buffer, \ |
6102 size_t byte_offset, size_t length) { \ | 6100 size_t byte_offset, size_t length) { \ |
6103 i::Isolate* isolate = i::Isolate::Current(); \ | 6101 i::Isolate* isolate = i::Isolate::Current(); \ |
6104 EnsureInitializedForIsolate(isolate, \ | 6102 EnsureInitializedForIsolate(isolate, \ |
6105 "v8::" #Type "Array::New(Handle<ArrayBuffer>, size_t, size_t)"); \ | 6103 "v8::" #Type "Array::New(Handle<ArrayBuffer>, size_t, size_t)"); \ |
(...skipping 1531 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
7637 Isolate* isolate = reinterpret_cast<Isolate*>(info.GetIsolate()); | 7635 Isolate* isolate = reinterpret_cast<Isolate*>(info.GetIsolate()); |
7638 Address callback_address = | 7636 Address callback_address = |
7639 reinterpret_cast<Address>(reinterpret_cast<intptr_t>(callback)); | 7637 reinterpret_cast<Address>(reinterpret_cast<intptr_t>(callback)); |
7640 VMState<EXTERNAL> state(isolate); | 7638 VMState<EXTERNAL> state(isolate); |
7641 ExternalCallbackScope call_scope(isolate, callback_address); | 7639 ExternalCallbackScope call_scope(isolate, callback_address); |
7642 callback(info); | 7640 callback(info); |
7643 } | 7641 } |
7644 | 7642 |
7645 | 7643 |
7646 } } // namespace v8::internal | 7644 } } // namespace v8::internal |
OLD | NEW |