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 6078 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
6089 isolate, obj, buffer, byte_offset, byte_length); | 6089 isolate, obj, buffer, byte_offset, byte_length); |
6090 | 6090 |
6091 i::Handle<i::Object> length_object = | 6091 i::Handle<i::Object> length_object = |
6092 isolate->factory()->NewNumberFromSize(length); | 6092 isolate->factory()->NewNumberFromSize(length); |
6093 obj->set_length(*length_object); | 6093 obj->set_length(*length_object); |
6094 | 6094 |
6095 i::Handle<i::ExternalArray> elements = | 6095 i::Handle<i::ExternalArray> elements = |
6096 isolate->factory()->NewExternalArray( | 6096 isolate->factory()->NewExternalArray( |
6097 static_cast<int>(length), array_type, | 6097 static_cast<int>(length), array_type, |
6098 static_cast<uint8_t*>(buffer->backing_store()) + byte_offset); | 6098 static_cast<uint8_t*>(buffer->backing_store()) + byte_offset); |
6099 obj->set_elements(*elements); | 6099 i::Handle<i::Map> map = |
| 6100 i::JSObject::GetElementsTransitionMap(obj, elements_kind); |
| 6101 obj->set_map_and_elements(*map, *elements); |
6100 return obj; | 6102 return obj; |
6101 } | 6103 } |
6102 | 6104 |
6103 | 6105 |
6104 #define TYPED_ARRAY_NEW(Type, type, TYPE, ctype, size) \ | 6106 #define TYPED_ARRAY_NEW(Type, type, TYPE, ctype, size) \ |
6105 Local<Type##Array> Type##Array::New(Handle<ArrayBuffer> array_buffer, \ | 6107 Local<Type##Array> Type##Array::New(Handle<ArrayBuffer> array_buffer, \ |
6106 size_t byte_offset, size_t length) { \ | 6108 size_t byte_offset, size_t length) { \ |
6107 i::Isolate* isolate = i::Isolate::Current(); \ | 6109 i::Isolate* isolate = i::Isolate::Current(); \ |
6108 EnsureInitializedForIsolate(isolate, \ | 6110 EnsureInitializedForIsolate(isolate, \ |
6109 "v8::" #Type "Array::New(Handle<ArrayBuffer>, size_t, size_t)"); \ | 6111 "v8::" #Type "Array::New(Handle<ArrayBuffer>, size_t, size_t)"); \ |
(...skipping 1487 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
7597 Isolate* isolate = reinterpret_cast<Isolate*>(info.GetIsolate()); | 7599 Isolate* isolate = reinterpret_cast<Isolate*>(info.GetIsolate()); |
7598 Address callback_address = | 7600 Address callback_address = |
7599 reinterpret_cast<Address>(reinterpret_cast<intptr_t>(callback)); | 7601 reinterpret_cast<Address>(reinterpret_cast<intptr_t>(callback)); |
7600 VMState<EXTERNAL> state(isolate); | 7602 VMState<EXTERNAL> state(isolate); |
7601 ExternalCallbackScope call_scope(isolate, callback_address); | 7603 ExternalCallbackScope call_scope(isolate, callback_address); |
7602 callback(info); | 7604 callback(info); |
7603 } | 7605 } |
7604 | 7606 |
7605 | 7607 |
7606 } } // namespace v8::internal | 7608 } } // namespace v8::internal |
OLD | NEW |