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

Side by Side Diff: src/api.cc

Issue 1324023007: [heap] introduce ArrayBufferTracker (Closed) Base URL: https://chromium.googlesource.com/v8/v8.git@master
Patch Set: split out Created 5 years, 3 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
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 14 matching lines...) Expand all
25 #include "src/compiler.h" 25 #include "src/compiler.h"
26 #include "src/context-measure.h" 26 #include "src/context-measure.h"
27 #include "src/contexts.h" 27 #include "src/contexts.h"
28 #include "src/conversions-inl.h" 28 #include "src/conversions-inl.h"
29 #include "src/counters.h" 29 #include "src/counters.h"
30 #include "src/cpu-profiler.h" 30 #include "src/cpu-profiler.h"
31 #include "src/debug/debug.h" 31 #include "src/debug/debug.h"
32 #include "src/deoptimizer.h" 32 #include "src/deoptimizer.h"
33 #include "src/execution.h" 33 #include "src/execution.h"
34 #include "src/global-handles.h" 34 #include "src/global-handles.h"
35 #include "src/heap/array-buffer-tracker.h"
Michael Lippautz 2015/09/04 08:24:15 Include only src/heap/heap.h
fedor.indutny 2015/09/04 08:58:05 Acknowledged, doesn't look like it is needed.
35 #include "src/heap-profiler.h" 36 #include "src/heap-profiler.h"
36 #include "src/heap-snapshot-generator-inl.h" 37 #include "src/heap-snapshot-generator-inl.h"
37 #include "src/icu_util.h" 38 #include "src/icu_util.h"
38 #include "src/isolate-inl.h" 39 #include "src/isolate-inl.h"
39 #include "src/json-parser.h" 40 #include "src/json-parser.h"
40 #include "src/messages.h" 41 #include "src/messages.h"
41 #include "src/parser.h" 42 #include "src/parser.h"
42 #include "src/pending-compilation-error-handler.h" 43 #include "src/pending-compilation-error-handler.h"
43 #include "src/profile-generator-inl.h" 44 #include "src/profile-generator-inl.h"
44 #include "src/property.h" 45 #include "src/property.h"
(...skipping 6457 matching lines...) Expand 10 before | Expand all | Expand 10 after
6502 return Utils::OpenHandle(this)->is_neuterable(); 6503 return Utils::OpenHandle(this)->is_neuterable();
6503 } 6504 }
6504 6505
6505 6506
6506 v8::ArrayBuffer::Contents v8::ArrayBuffer::Externalize() { 6507 v8::ArrayBuffer::Contents v8::ArrayBuffer::Externalize() {
6507 i::Handle<i::JSArrayBuffer> self = Utils::OpenHandle(this); 6508 i::Handle<i::JSArrayBuffer> self = Utils::OpenHandle(this);
6508 i::Isolate* isolate = self->GetIsolate(); 6509 i::Isolate* isolate = self->GetIsolate();
6509 Utils::ApiCheck(!self->is_external(), "v8::ArrayBuffer::Externalize", 6510 Utils::ApiCheck(!self->is_external(), "v8::ArrayBuffer::Externalize",
6510 "ArrayBuffer already externalized"); 6511 "ArrayBuffer already externalized");
6511 self->set_is_external(true); 6512 self->set_is_external(true);
6512 isolate->heap()->UnregisterArrayBuffer(isolate->heap()->InNewSpace(*self), 6513 isolate->heap()->array_buffer_tracker()->Unregister(*self);
Michael Lippautz 2015/09/04 08:24:15 Use the wrapper call for Unregister.
fedor.indutny 2015/09/04 08:58:05 Acknowledged.
6513 self->backing_store());
6514 6514
6515 return GetContents(); 6515 return GetContents();
6516 } 6516 }
6517 6517
6518 6518
6519 v8::ArrayBuffer::Contents v8::ArrayBuffer::GetContents() { 6519 v8::ArrayBuffer::Contents v8::ArrayBuffer::GetContents() {
6520 i::Handle<i::JSArrayBuffer> self = Utils::OpenHandle(this); 6520 i::Handle<i::JSArrayBuffer> self = Utils::OpenHandle(this);
6521 size_t byte_length = static_cast<size_t>(self->byte_length()->Number()); 6521 size_t byte_length = static_cast<size_t>(self->byte_length()->Number());
6522 Contents contents; 6522 Contents contents;
6523 contents.data_ = self->backing_store(); 6523 contents.data_ = self->backing_store();
(...skipping 188 matching lines...) Expand 10 before | Expand all | Expand 10 after
6712 return Utils::OpenHandle(this)->is_external(); 6712 return Utils::OpenHandle(this)->is_external();
6713 } 6713 }
6714 6714
6715 6715
6716 v8::SharedArrayBuffer::Contents v8::SharedArrayBuffer::Externalize() { 6716 v8::SharedArrayBuffer::Contents v8::SharedArrayBuffer::Externalize() {
6717 i::Handle<i::JSArrayBuffer> self = Utils::OpenHandle(this); 6717 i::Handle<i::JSArrayBuffer> self = Utils::OpenHandle(this);
6718 i::Isolate* isolate = self->GetIsolate(); 6718 i::Isolate* isolate = self->GetIsolate();
6719 Utils::ApiCheck(!self->is_external(), "v8::SharedArrayBuffer::Externalize", 6719 Utils::ApiCheck(!self->is_external(), "v8::SharedArrayBuffer::Externalize",
6720 "SharedArrayBuffer already externalized"); 6720 "SharedArrayBuffer already externalized");
6721 self->set_is_external(true); 6721 self->set_is_external(true);
6722 isolate->heap()->UnregisterArrayBuffer(isolate->heap()->InNewSpace(*self), 6722 isolate->heap()->array_buffer_tracker()->Unregister(*self);
Michael Lippautz 2015/09/04 08:24:15 Ditto.
fedor.indutny 2015/09/04 08:58:05 Acknowledged.
6723 self->backing_store());
6724 return GetContents(); 6723 return GetContents();
6725 } 6724 }
6726 6725
6727 6726
6728 v8::SharedArrayBuffer::Contents v8::SharedArrayBuffer::GetContents() { 6727 v8::SharedArrayBuffer::Contents v8::SharedArrayBuffer::GetContents() {
6729 i::Handle<i::JSArrayBuffer> self = Utils::OpenHandle(this); 6728 i::Handle<i::JSArrayBuffer> self = Utils::OpenHandle(this);
6730 size_t byte_length = static_cast<size_t>(self->byte_length()->Number()); 6729 size_t byte_length = static_cast<size_t>(self->byte_length()->Number());
6731 Contents contents; 6730 Contents contents;
6732 contents.data_ = self->backing_store(); 6731 contents.data_ = self->backing_store();
6733 contents.byte_length_ = byte_length; 6732 contents.byte_length_ = byte_length;
(...skipping 1679 matching lines...) Expand 10 before | Expand all | Expand 10 after
8413 Address callback_address = 8412 Address callback_address =
8414 reinterpret_cast<Address>(reinterpret_cast<intptr_t>(callback)); 8413 reinterpret_cast<Address>(reinterpret_cast<intptr_t>(callback));
8415 VMState<EXTERNAL> state(isolate); 8414 VMState<EXTERNAL> state(isolate);
8416 ExternalCallbackScope call_scope(isolate, callback_address); 8415 ExternalCallbackScope call_scope(isolate, callback_address);
8417 callback(info); 8416 callback(info);
8418 } 8417 }
8419 8418
8420 8419
8421 } // namespace internal 8420 } // namespace internal
8422 } // namespace v8 8421 } // namespace v8
OLDNEW

Powered by Google App Engine
This is Rietveld 408576698