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

Side by Side Diff: src/api.cc

Issue 1133773002: Keep track of array buffers in new space separately (Closed) Base URL: https://chromium.googlesource.com/v8/v8.git@master
Patch Set: updates Created 5 years, 6 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 | « no previous file | src/heap/heap.h » ('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 6513 matching lines...) Expand 10 before | Expand all | Expand 10 after
6524 return Utils::OpenHandle(this)->is_neuterable(); 6524 return Utils::OpenHandle(this)->is_neuterable();
6525 } 6525 }
6526 6526
6527 6527
6528 v8::ArrayBuffer::Contents v8::ArrayBuffer::Externalize() { 6528 v8::ArrayBuffer::Contents v8::ArrayBuffer::Externalize() {
6529 i::Handle<i::JSArrayBuffer> self = Utils::OpenHandle(this); 6529 i::Handle<i::JSArrayBuffer> self = Utils::OpenHandle(this);
6530 i::Isolate* isolate = self->GetIsolate(); 6530 i::Isolate* isolate = self->GetIsolate();
6531 Utils::ApiCheck(!self->is_external(), "v8::ArrayBuffer::Externalize", 6531 Utils::ApiCheck(!self->is_external(), "v8::ArrayBuffer::Externalize",
6532 "ArrayBuffer already externalized"); 6532 "ArrayBuffer already externalized");
6533 self->set_is_external(true); 6533 self->set_is_external(true);
6534 isolate->heap()->UnregisterArrayBuffer(self->backing_store()); 6534 isolate->heap()->UnregisterArrayBuffer(isolate->heap()->InNewSpace(*self),
6535 self->backing_store());
6535 6536
6536 return GetContents(); 6537 return GetContents();
6537 } 6538 }
6538 6539
6539 6540
6540 v8::ArrayBuffer::Contents v8::ArrayBuffer::GetContents() { 6541 v8::ArrayBuffer::Contents v8::ArrayBuffer::GetContents() {
6541 i::Handle<i::JSArrayBuffer> self = Utils::OpenHandle(this); 6542 i::Handle<i::JSArrayBuffer> self = Utils::OpenHandle(this);
6542 size_t byte_length = static_cast<size_t>(self->byte_length()->Number()); 6543 size_t byte_length = static_cast<size_t>(self->byte_length()->Number());
6543 Contents contents; 6544 Contents contents;
6544 contents.data_ = self->backing_store(); 6545 contents.data_ = self->backing_store();
(...skipping 186 matching lines...) Expand 10 before | Expand all | Expand 10 after
6731 return Utils::OpenHandle(this)->is_external(); 6732 return Utils::OpenHandle(this)->is_external();
6732 } 6733 }
6733 6734
6734 6735
6735 v8::SharedArrayBuffer::Contents v8::SharedArrayBuffer::Externalize() { 6736 v8::SharedArrayBuffer::Contents v8::SharedArrayBuffer::Externalize() {
6736 i::Handle<i::JSArrayBuffer> self = Utils::OpenHandle(this); 6737 i::Handle<i::JSArrayBuffer> self = Utils::OpenHandle(this);
6737 i::Isolate* isolate = self->GetIsolate(); 6738 i::Isolate* isolate = self->GetIsolate();
6738 Utils::ApiCheck(!self->is_external(), "v8::SharedArrayBuffer::Externalize", 6739 Utils::ApiCheck(!self->is_external(), "v8::SharedArrayBuffer::Externalize",
6739 "SharedArrayBuffer already externalized"); 6740 "SharedArrayBuffer already externalized");
6740 self->set_is_external(true); 6741 self->set_is_external(true);
6741 isolate->heap()->UnregisterArrayBuffer(self->backing_store()); 6742 isolate->heap()->UnregisterArrayBuffer(isolate->heap()->InNewSpace(*self),
6743 self->backing_store());
6742 return GetContents(); 6744 return GetContents();
6743 } 6745 }
6744 6746
6745 6747
6746 v8::SharedArrayBuffer::Contents v8::SharedArrayBuffer::GetContents() { 6748 v8::SharedArrayBuffer::Contents v8::SharedArrayBuffer::GetContents() {
6747 i::Handle<i::JSArrayBuffer> self = Utils::OpenHandle(this); 6749 i::Handle<i::JSArrayBuffer> self = Utils::OpenHandle(this);
6748 size_t byte_length = static_cast<size_t>(self->byte_length()->Number()); 6750 size_t byte_length = static_cast<size_t>(self->byte_length()->Number());
6749 Contents contents; 6751 Contents contents;
6750 contents.data_ = self->backing_store(); 6752 contents.data_ = self->backing_store();
6751 contents.byte_length_ = byte_length; 6753 contents.byte_length_ = byte_length;
(...skipping 1667 matching lines...) Expand 10 before | Expand all | Expand 10 after
8419 Address callback_address = 8421 Address callback_address =
8420 reinterpret_cast<Address>(reinterpret_cast<intptr_t>(callback)); 8422 reinterpret_cast<Address>(reinterpret_cast<intptr_t>(callback));
8421 VMState<EXTERNAL> state(isolate); 8423 VMState<EXTERNAL> state(isolate);
8422 ExternalCallbackScope call_scope(isolate, callback_address); 8424 ExternalCallbackScope call_scope(isolate, callback_address);
8423 callback(info); 8425 callback(info);
8424 } 8426 }
8425 8427
8426 8428
8427 } // namespace internal 8429 } // namespace internal
8428 } // namespace v8 8430 } // namespace v8
OLDNEW
« no previous file with comments | « no previous file | src/heap/heap.h » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698