| 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 6114 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 6125 i::ElementsKind elements_kind> | 6125 i::ElementsKind elements_kind> |
| 6126 i::Handle<i::JSTypedArray> NewTypedArray( | 6126 i::Handle<i::JSTypedArray> NewTypedArray( |
| 6127 i::Isolate* isolate, | 6127 i::Isolate* isolate, |
| 6128 Handle<ArrayBuffer> array_buffer, size_t byte_offset, size_t length) { | 6128 Handle<ArrayBuffer> array_buffer, size_t byte_offset, size_t length) { |
| 6129 i::Handle<i::JSTypedArray> obj = | 6129 i::Handle<i::JSTypedArray> obj = |
| 6130 isolate->factory()->NewJSTypedArray(array_type); | 6130 isolate->factory()->NewJSTypedArray(array_type); |
| 6131 i::Handle<i::JSArrayBuffer> buffer = Utils::OpenHandle(*array_buffer); | 6131 i::Handle<i::JSArrayBuffer> buffer = Utils::OpenHandle(*array_buffer); |
| 6132 | 6132 |
| 6133 ASSERT(byte_offset % sizeof(ElementType) == 0); | 6133 ASSERT(byte_offset % sizeof(ElementType) == 0); |
| 6134 | 6134 |
| 6135 CHECK(length <= (std::numeric_limits<size_t>::max() / sizeof(ElementType))); |
| 6136 size_t byte_length = length * sizeof(ElementType); |
| 6135 SetupArrayBufferView( | 6137 SetupArrayBufferView( |
| 6136 isolate, obj, buffer, byte_offset, length * sizeof(ElementType)); | 6138 isolate, obj, buffer, byte_offset, byte_length); |
| 6137 | 6139 |
| 6138 i::Handle<i::Object> length_object = | 6140 i::Handle<i::Object> length_object = |
| 6139 isolate->factory()->NewNumberFromSize(length); | 6141 isolate->factory()->NewNumberFromSize(length); |
| 6140 obj->set_length(*length_object); | 6142 obj->set_length(*length_object); |
| 6141 | 6143 |
| 6142 i::Handle<i::ExternalArray> elements = | 6144 i::Handle<i::ExternalArray> elements = |
| 6143 isolate->factory()->NewExternalArray( | 6145 isolate->factory()->NewExternalArray( |
| 6144 static_cast<int>(length), array_type, | 6146 static_cast<int>(length), array_type, |
| 6145 static_cast<uint8_t*>(buffer->backing_store()) + byte_offset); | 6147 static_cast<uint8_t*>(buffer->backing_store()) + byte_offset); |
| 6146 obj->set_elements(*elements); | 6148 obj->set_elements(*elements); |
| (...skipping 1508 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 7655 Isolate* isolate = reinterpret_cast<Isolate*>(info.GetIsolate()); | 7657 Isolate* isolate = reinterpret_cast<Isolate*>(info.GetIsolate()); |
| 7656 Address callback_address = | 7658 Address callback_address = |
| 7657 reinterpret_cast<Address>(reinterpret_cast<intptr_t>(callback)); | 7659 reinterpret_cast<Address>(reinterpret_cast<intptr_t>(callback)); |
| 7658 VMState<EXTERNAL> state(isolate); | 7660 VMState<EXTERNAL> state(isolate); |
| 7659 ExternalCallbackScope call_scope(isolate, callback_address); | 7661 ExternalCallbackScope call_scope(isolate, callback_address); |
| 7660 callback(info); | 7662 callback(info); |
| 7661 } | 7663 } |
| 7662 | 7664 |
| 7663 | 7665 |
| 7664 } } // namespace v8::internal | 7666 } } // namespace v8::internal |
| OLD | NEW |