Chromium Code Reviews
chromiumcodereview-hr@appspot.gserviceaccount.com (chromiumcodereview-hr) | Please choose your nickname with Settings | Help | Chromium Project | Gerrit Changes | Sign out
(244)

Side by Side Diff: src/api.cc

Issue 1110713004: Version 4.3.61.16 (cherry-pick) (Closed) Base URL: https://chromium.googlesource.com/v8/v8.git@4.3
Patch Set: Created 5 years, 7 months ago
Use n/p to move between diff chunks; N/P to move between comments. Draft comments are only viewable by you.
Jump to:
View unified diff | Download patch
« no previous file with comments | « include/v8-version.h ('k') | test/cctest/test-typedarrays.cc » ('j') | no next file with comments »
Toggle Intra-line Diffs ('i') | Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
OLDNEW
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 6448 matching lines...) Expand 10 before | Expand all | Expand 10 after
6459 i::JSArrayBuffer::cast(typed_array->buffer())); 6459 i::JSArrayBuffer::cast(typed_array->buffer()));
6460 source = reinterpret_cast<char*>(buffer->backing_store()); 6460 source = reinterpret_cast<char*>(buffer->backing_store());
6461 } 6461 }
6462 } 6462 }
6463 memcpy(dest, source + byte_offset, bytes_to_copy); 6463 memcpy(dest, source + byte_offset, bytes_to_copy);
6464 } 6464 }
6465 return bytes_to_copy; 6465 return bytes_to_copy;
6466 } 6466 }
6467 6467
6468 6468
6469 bool v8::ArrayBufferView::HasBuffer() const {
6470 i::Handle<i::JSArrayBufferView> obj = Utils::OpenHandle(this);
6471 if (obj->IsJSDataView()) return true;
6472 DCHECK(obj->IsJSTypedArray());
6473 i::Handle<i::JSTypedArray> typed_array(i::JSTypedArray::cast(*obj));
6474 return !typed_array->buffer()->IsSmi();
6475 }
6476
6477
6469 size_t v8::ArrayBufferView::ByteOffset() { 6478 size_t v8::ArrayBufferView::ByteOffset() {
6470 i::Handle<i::JSArrayBufferView> obj = Utils::OpenHandle(this); 6479 i::Handle<i::JSArrayBufferView> obj = Utils::OpenHandle(this);
6471 return static_cast<size_t>(obj->byte_offset()->Number()); 6480 return static_cast<size_t>(obj->byte_offset()->Number());
6472 } 6481 }
6473 6482
6474 6483
6475 size_t v8::ArrayBufferView::ByteLength() { 6484 size_t v8::ArrayBufferView::ByteLength() {
6476 i::Handle<i::JSArrayBufferView> obj = Utils::OpenHandle(this); 6485 i::Handle<i::JSArrayBufferView> obj = Utils::OpenHandle(this);
6477 return static_cast<size_t>(obj->byte_length()->Number()); 6486 return static_cast<size_t>(obj->byte_length()->Number());
6478 } 6487 }
(...skipping 1616 matching lines...) Expand 10 before | Expand all | Expand 10 after
8095 Isolate* isolate = reinterpret_cast<Isolate*>(info.GetIsolate()); 8104 Isolate* isolate = reinterpret_cast<Isolate*>(info.GetIsolate());
8096 Address callback_address = 8105 Address callback_address =
8097 reinterpret_cast<Address>(reinterpret_cast<intptr_t>(callback)); 8106 reinterpret_cast<Address>(reinterpret_cast<intptr_t>(callback));
8098 VMState<EXTERNAL> state(isolate); 8107 VMState<EXTERNAL> state(isolate);
8099 ExternalCallbackScope call_scope(isolate, callback_address); 8108 ExternalCallbackScope call_scope(isolate, callback_address);
8100 callback(info); 8109 callback(info);
8101 } 8110 }
8102 8111
8103 8112
8104 } } // namespace v8::internal 8113 } } // namespace v8::internal
OLDNEW
« no previous file with comments | « include/v8-version.h ('k') | test/cctest/test-typedarrays.cc » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698