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

Side by Side Diff: src/api.cc

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