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 6004 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
6015 return static_cast<size_t>(obj->byte_offset()->Number()); | 6015 return static_cast<size_t>(obj->byte_offset()->Number()); |
6016 } | 6016 } |
6017 | 6017 |
6018 | 6018 |
6019 size_t v8::ArrayBufferView::ByteLength() { | 6019 size_t v8::ArrayBufferView::ByteLength() { |
6020 i::Handle<i::JSArrayBufferView> obj = Utils::OpenHandle(this); | 6020 i::Handle<i::JSArrayBufferView> obj = Utils::OpenHandle(this); |
6021 return static_cast<size_t>(obj->byte_length()->Number()); | 6021 return static_cast<size_t>(obj->byte_length()->Number()); |
6022 } | 6022 } |
6023 | 6023 |
6024 | 6024 |
6025 void* v8::ArrayBufferView::BaseAddress() { | |
6026 i::Handle<i::JSArrayBufferView> obj = Utils::OpenHandle(this); | |
6027 i::Handle<i::JSArrayBuffer> buffer(i::JSArrayBuffer::cast(obj->buffer())); | |
6028 void* buffer_data = buffer->backing_store(); | |
6029 size_t byte_offset = static_cast<size_t>(obj->byte_offset()->Number()); | |
6030 return static_cast<uint8_t*>(buffer_data) + byte_offset; | |
6031 } | |
6032 | |
6033 | |
6034 size_t v8::TypedArray::Length() { | 6025 size_t v8::TypedArray::Length() { |
6035 i::Handle<i::JSTypedArray> obj = Utils::OpenHandle(this); | 6026 i::Handle<i::JSTypedArray> obj = Utils::OpenHandle(this); |
6036 return static_cast<size_t>(obj->length()->Number()); | 6027 return static_cast<size_t>(obj->length()->Number()); |
6037 } | 6028 } |
6038 | 6029 |
6039 | 6030 |
6040 static inline void SetupArrayBufferView( | 6031 static inline void SetupArrayBufferView( |
6041 i::Isolate* isolate, | 6032 i::Isolate* isolate, |
6042 i::Handle<i::JSArrayBufferView> obj, | 6033 i::Handle<i::JSArrayBufferView> obj, |
6043 i::Handle<i::JSArrayBuffer> buffer, | 6034 i::Handle<i::JSArrayBuffer> buffer, |
(...skipping 1531 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
7575 Isolate* isolate = reinterpret_cast<Isolate*>(info.GetIsolate()); | 7566 Isolate* isolate = reinterpret_cast<Isolate*>(info.GetIsolate()); |
7576 Address callback_address = | 7567 Address callback_address = |
7577 reinterpret_cast<Address>(reinterpret_cast<intptr_t>(callback)); | 7568 reinterpret_cast<Address>(reinterpret_cast<intptr_t>(callback)); |
7578 VMState<EXTERNAL> state(isolate); | 7569 VMState<EXTERNAL> state(isolate); |
7579 ExternalCallbackScope call_scope(isolate, callback_address); | 7570 ExternalCallbackScope call_scope(isolate, callback_address); |
7580 callback(info); | 7571 callback(info); |
7581 } | 7572 } |
7582 | 7573 |
7583 | 7574 |
7584 } } // namespace v8::internal | 7575 } } // namespace v8::internal |
OLD | NEW |