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 5060 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
5071 i::Isolate* isolate = reinterpret_cast<i::Isolate*>(exported_isolate); | 5071 i::Isolate* isolate = reinterpret_cast<i::Isolate*>(exported_isolate); |
5072 ASSERT(isolate == i::Isolate::Current()); | 5072 ASSERT(isolate == i::Isolate::Current()); |
5073 i::DisallowHeapAllocation no_allocation; | 5073 i::DisallowHeapAllocation no_allocation; |
5074 | 5074 |
5075 VisitorAdapter visitor_adapter(visitor); | 5075 VisitorAdapter visitor_adapter(visitor); |
5076 isolate->global_handles()->IterateAllRootsInNewSpaceWithClassIds( | 5076 isolate->global_handles()->IterateAllRootsInNewSpaceWithClassIds( |
5077 &visitor_adapter); | 5077 &visitor_adapter); |
5078 } | 5078 } |
5079 | 5079 |
5080 | 5080 |
5081 bool v8::V8::IdleNotification(int hint) { | |
5082 // Returning true tells the caller that it need not | |
5083 // continue to call IdleNotification. | |
5084 i::Isolate* isolate = i::Isolate::Current(); | |
5085 if (isolate == NULL || !isolate->IsInitialized()) return true; | |
5086 if (!i::FLAG_use_idle_notification) return true; | |
5087 return isolate->heap()->IdleNotification(hint); | |
5088 } | |
5089 | |
5090 | |
5091 void v8::V8::LowMemoryNotification() { | |
5092 i::Isolate* isolate = i::Isolate::Current(); | |
5093 if (isolate == NULL || !isolate->IsInitialized()) return; | |
5094 { | |
5095 i::HistogramTimerScope idle_notification_scope( | |
5096 isolate->counters()->gc_low_memory_notification()); | |
5097 isolate->heap()->CollectAllAvailableGarbage("low memory notification"); | |
5098 } | |
5099 } | |
5100 | |
5101 | |
5102 int v8::V8::ContextDisposedNotification() { | |
5103 i::Isolate* isolate = i::Isolate::Current(); | |
5104 if (!isolate->IsInitialized()) return 0; | |
5105 return isolate->heap()->NotifyContextDisposed(); | |
5106 } | |
5107 | |
5108 | |
5109 bool v8::V8::InitializeICU(const char* icu_data_file) { | 5081 bool v8::V8::InitializeICU(const char* icu_data_file) { |
5110 return i::InitializeICU(icu_data_file); | 5082 return i::InitializeICU(icu_data_file); |
5111 } | 5083 } |
5112 | 5084 |
5113 | 5085 |
5114 const char* v8::V8::GetVersion() { | 5086 const char* v8::V8::GetVersion() { |
5115 return i::Version::GetVersion(); | 5087 return i::Version::GetVersion(); |
5116 } | 5088 } |
5117 | 5089 |
5118 | 5090 |
(...skipping 2543 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
7662 Isolate* isolate = reinterpret_cast<Isolate*>(info.GetIsolate()); | 7634 Isolate* isolate = reinterpret_cast<Isolate*>(info.GetIsolate()); |
7663 Address callback_address = | 7635 Address callback_address = |
7664 reinterpret_cast<Address>(reinterpret_cast<intptr_t>(callback)); | 7636 reinterpret_cast<Address>(reinterpret_cast<intptr_t>(callback)); |
7665 VMState<EXTERNAL> state(isolate); | 7637 VMState<EXTERNAL> state(isolate); |
7666 ExternalCallbackScope call_scope(isolate, callback_address); | 7638 ExternalCallbackScope call_scope(isolate, callback_address); |
7667 callback(info); | 7639 callback(info); |
7668 } | 7640 } |
7669 | 7641 |
7670 | 7642 |
7671 } } // namespace v8::internal | 7643 } } // namespace v8::internal |
OLD | NEW |