OLD | NEW |
---|---|
1 // Copyright 2012 the V8 project authors. All rights reserved. | 1 // Copyright 2012 the V8 project authors. All rights reserved. |
2 // Use of this source code is governed by a BSD-style license that can be | 2 // Use of this source code is governed by a BSD-style license that can be |
3 // found in the LICENSE file. | 3 // found in the LICENSE file. |
4 | 4 |
5 #include "src/api.h" | 5 #include "src/api.h" |
6 | 6 |
7 #include <string.h> // For memcpy, strlen. | 7 #include <string.h> // For memcpy, strlen. |
8 #ifdef V8_USE_ADDRESS_SANITIZER | 8 #ifdef V8_USE_ADDRESS_SANITIZER |
9 #include <sanitizer/asan_interface.h> | 9 #include <sanitizer/asan_interface.h> |
10 #endif // V8_USE_ADDRESS_SANITIZER | 10 #endif // V8_USE_ADDRESS_SANITIZER |
(...skipping 6322 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... | |
6333 if (typed_array->buffer()->IsSmi()) { | 6333 if (typed_array->buffer()->IsSmi()) { |
6334 i::Handle<i::FixedTypedArrayBase> fixed_array( | 6334 i::Handle<i::FixedTypedArrayBase> fixed_array( |
6335 i::FixedTypedArrayBase::cast(typed_array->elements())); | 6335 i::FixedTypedArrayBase::cast(typed_array->elements())); |
6336 source = reinterpret_cast<char*>(fixed_array->DataPtr()); | 6336 source = reinterpret_cast<char*>(fixed_array->DataPtr()); |
6337 } else { | 6337 } else { |
6338 i::Handle<i::JSArrayBuffer> buffer( | 6338 i::Handle<i::JSArrayBuffer> buffer( |
6339 i::JSArrayBuffer::cast(typed_array->buffer())); | 6339 i::JSArrayBuffer::cast(typed_array->buffer())); |
6340 source = reinterpret_cast<char*>(buffer->backing_store()); | 6340 source = reinterpret_cast<char*>(buffer->backing_store()); |
6341 } | 6341 } |
6342 } | 6342 } |
6343 if (!source) return 0; | |
Hannes Payer (out of office)
2015/04/22 07:45:53
Isn't that more an assert? source is not null when
jochen (gone - plz use gerrit)
2015/04/22 08:21:42
true. if it's neutered, byte_length() above will b
| |
6343 memcpy(dest, source + byte_offset, bytes_to_copy); | 6344 memcpy(dest, source + byte_offset, bytes_to_copy); |
6344 } | 6345 } |
6345 return bytes_to_copy; | 6346 return bytes_to_copy; |
6346 } | 6347 } |
6347 | 6348 |
6348 | 6349 |
6349 bool v8::ArrayBufferView::HasBuffer() const { | 6350 bool v8::ArrayBufferView::HasBuffer() const { |
6350 i::Handle<i::JSArrayBufferView> obj = Utils::OpenHandle(this); | 6351 i::Handle<i::JSArrayBufferView> obj = Utils::OpenHandle(this); |
6351 if (obj->IsJSDataView()) return true; | 6352 if (obj->IsJSDataView()) return true; |
6352 DCHECK(obj->IsJSTypedArray()); | 6353 DCHECK(obj->IsJSTypedArray()); |
(...skipping 1656 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... | |
8009 Isolate* isolate = reinterpret_cast<Isolate*>(info.GetIsolate()); | 8010 Isolate* isolate = reinterpret_cast<Isolate*>(info.GetIsolate()); |
8010 Address callback_address = | 8011 Address callback_address = |
8011 reinterpret_cast<Address>(reinterpret_cast<intptr_t>(callback)); | 8012 reinterpret_cast<Address>(reinterpret_cast<intptr_t>(callback)); |
8012 VMState<EXTERNAL> state(isolate); | 8013 VMState<EXTERNAL> state(isolate); |
8013 ExternalCallbackScope call_scope(isolate, callback_address); | 8014 ExternalCallbackScope call_scope(isolate, callback_address); |
8014 callback(info); | 8015 callback(info); |
8015 } | 8016 } |
8016 | 8017 |
8017 | 8018 |
8018 } } // namespace v8::internal | 8019 } } // namespace v8::internal |
OLD | NEW |