Chromium Code Reviews| 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 7156 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... | |
| 7167 reinterpret_cast<v8::Isolate::GCCallback>(callback), gc_type, false); | 7167 reinterpret_cast<v8::Isolate::GCCallback>(callback), gc_type, false); |
| 7168 } | 7168 } |
| 7169 | 7169 |
| 7170 | 7170 |
| 7171 void V8::AddGCEpilogueCallback(GCCallback callback, GCType gc_type) { | 7171 void V8::AddGCEpilogueCallback(GCCallback callback, GCType gc_type) { |
| 7172 i::Isolate* isolate = i::Isolate::Current(); | 7172 i::Isolate* isolate = i::Isolate::Current(); |
| 7173 isolate->heap()->AddGCEpilogueCallback( | 7173 isolate->heap()->AddGCEpilogueCallback( |
| 7174 reinterpret_cast<v8::Isolate::GCCallback>(callback), gc_type, false); | 7174 reinterpret_cast<v8::Isolate::GCCallback>(callback), gc_type, false); |
| 7175 } | 7175 } |
| 7176 | 7176 |
| 7177 void Isolate::SetEmbedderHeapTracer(EmbedderHeapTracer* tracer) { | |
| 7178 i::Isolate* isolate = reinterpret_cast<i::Isolate*>(this); | |
| 7179 isolate->heap()->SetEmbedderHeapTracer(tracer); | |
| 7180 } | |
| 7181 | |
| 7182 EmbedderHeapTracer* Isolate::embedder_heap_tracer() { | |
| 7183 i::Isolate* isolate = reinterpret_cast<i::Isolate*>(this); | |
| 7184 return isolate->heap()->embedder_heap_tracer(); | |
| 7185 } | |
| 7177 | 7186 |
| 7178 void Isolate::AddMemoryAllocationCallback(MemoryAllocationCallback callback, | 7187 void Isolate::AddMemoryAllocationCallback(MemoryAllocationCallback callback, |
| 7179 ObjectSpace space, | 7188 ObjectSpace space, |
| 7180 AllocationAction action) { | 7189 AllocationAction action) { |
| 7181 i::Isolate* isolate = reinterpret_cast<i::Isolate*>(this); | 7190 i::Isolate* isolate = reinterpret_cast<i::Isolate*>(this); |
| 7182 isolate->memory_allocator()->AddMemoryAllocationCallback( | 7191 isolate->memory_allocator()->AddMemoryAllocationCallback( |
| 7183 callback, space, action); | 7192 callback, space, action); |
| 7184 } | 7193 } |
| 7185 | 7194 |
| 7186 | 7195 |
| (...skipping 43 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... | |
| 7230 "Isolate::RequestGarbageCollection", kGCCallbackFlagForced); | 7239 "Isolate::RequestGarbageCollection", kGCCallbackFlagForced); |
| 7231 } | 7240 } |
| 7232 } | 7241 } |
| 7233 | 7242 |
| 7234 | 7243 |
| 7235 Isolate* Isolate::GetCurrent() { | 7244 Isolate* Isolate::GetCurrent() { |
| 7236 i::Isolate* isolate = i::Isolate::Current(); | 7245 i::Isolate* isolate = i::Isolate::Current(); |
| 7237 return reinterpret_cast<Isolate*>(isolate); | 7246 return reinterpret_cast<Isolate*>(isolate); |
| 7238 } | 7247 } |
| 7239 | 7248 |
| 7249 void Isolate::AddObjectToMarkingDeque(PersistentBase<Object>* handle) { | |
| 7250 internal::Object** object = | |
| 7251 reinterpret_cast<internal::Object**>(handle->val_); | |
| 7252 internal::Isolate* internal_isolate = | |
| 7253 reinterpret_cast<internal::Isolate*>(this); | |
| 7254 internal_isolate->heap()->AddObjectToMarkingDeque(object); | |
|
jochen (gone - plz use gerrit)
2016/03/30 16:44:45
we usually use i:: and i_ instead of internal.
I'
Marcel Hlopko
2016/03/30 18:51:12
Done.
| |
| 7255 } | |
| 7240 | 7256 |
| 7241 Isolate* Isolate::New(const Isolate::CreateParams& params) { | 7257 Isolate* Isolate::New(const Isolate::CreateParams& params) { |
| 7242 i::Isolate* isolate = new i::Isolate(false); | 7258 i::Isolate* isolate = new i::Isolate(false); |
| 7243 Isolate* v8_isolate = reinterpret_cast<Isolate*>(isolate); | 7259 Isolate* v8_isolate = reinterpret_cast<Isolate*>(isolate); |
| 7244 CHECK(params.array_buffer_allocator != NULL); | 7260 CHECK(params.array_buffer_allocator != NULL); |
| 7245 isolate->set_array_buffer_allocator(params.array_buffer_allocator); | 7261 isolate->set_array_buffer_allocator(params.array_buffer_allocator); |
| 7246 if (params.snapshot_blob != NULL) { | 7262 if (params.snapshot_blob != NULL) { |
| 7247 isolate->set_snapshot_blob(params.snapshot_blob); | 7263 isolate->set_snapshot_blob(params.snapshot_blob); |
| 7248 } else { | 7264 } else { |
| 7249 isolate->set_snapshot_blob(i::Snapshot::DefaultSnapshotBlob()); | 7265 isolate->set_snapshot_blob(i::Snapshot::DefaultSnapshotBlob()); |
| (...skipping 1511 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... | |
| 8761 Address callback_address = | 8777 Address callback_address = |
| 8762 reinterpret_cast<Address>(reinterpret_cast<intptr_t>(callback)); | 8778 reinterpret_cast<Address>(reinterpret_cast<intptr_t>(callback)); |
| 8763 VMState<EXTERNAL> state(isolate); | 8779 VMState<EXTERNAL> state(isolate); |
| 8764 ExternalCallbackScope call_scope(isolate, callback_address); | 8780 ExternalCallbackScope call_scope(isolate, callback_address); |
| 8765 callback(info); | 8781 callback(info); |
| 8766 } | 8782 } |
| 8767 | 8783 |
| 8768 | 8784 |
| 8769 } // namespace internal | 8785 } // namespace internal |
| 8770 } // namespace v8 | 8786 } // namespace v8 |
| OLD | NEW |