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 /** \mainpage V8 API Reference Guide | 5 /** \mainpage V8 API Reference Guide |
6 * | 6 * |
7 * V8 is Google's open source JavaScript engine. | 7 * V8 is Google's open source JavaScript engine. |
8 * | 8 * |
9 * This set of documents provides reference material generated from the | 9 * This set of documents provides reference material generated from the |
10 * V8 header file, include/v8.h. | 10 * V8 header file, include/v8.h. |
(...skipping 5220 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... | |
5231 * - kGCCallbackFlagCollectAllAvailableGarbage: The GC callback is called | 5231 * - kGCCallbackFlagCollectAllAvailableGarbage: The GC callback is called |
5232 * in a phase where V8 is trying to collect all available garbage | 5232 * in a phase where V8 is trying to collect all available garbage |
5233 * (e.g., handling a low memory notification). | 5233 * (e.g., handling a low memory notification). |
5234 */ | 5234 */ |
5235 enum GCCallbackFlags { | 5235 enum GCCallbackFlags { |
5236 kNoGCCallbackFlags = 0, | 5236 kNoGCCallbackFlags = 0, |
5237 kGCCallbackFlagConstructRetainedObjectInfos = 1 << 1, | 5237 kGCCallbackFlagConstructRetainedObjectInfos = 1 << 1, |
5238 kGCCallbackFlagForced = 1 << 2, | 5238 kGCCallbackFlagForced = 1 << 2, |
5239 kGCCallbackFlagSynchronousPhantomCallbackProcessing = 1 << 3, | 5239 kGCCallbackFlagSynchronousPhantomCallbackProcessing = 1 << 3, |
5240 kGCCallbackFlagCollectAllAvailableGarbage = 1 << 4, | 5240 kGCCallbackFlagCollectAllAvailableGarbage = 1 << 4, |
5241 kGCCallbackFlagCollectAllExternalMemory = 1 << 5, | |
5241 }; | 5242 }; |
5242 | 5243 |
5243 typedef void (*GCCallback)(GCType type, GCCallbackFlags flags); | 5244 typedef void (*GCCallback)(GCType type, GCCallbackFlags flags); |
5244 | 5245 |
5245 typedef void (*InterruptCallback)(Isolate* isolate, void* data); | 5246 typedef void (*InterruptCallback)(Isolate* isolate, void* data); |
5246 | 5247 |
5247 | 5248 |
5248 /** | 5249 /** |
5249 * Collection of V8 heap information. | 5250 * Collection of V8 heap information. |
5250 * | 5251 * |
(...skipping 3536 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... | |
8787 typedef internal::Internals I; | 8788 typedef internal::Internals I; |
8788 return I::kNumIsolateDataSlots; | 8789 return I::kNumIsolateDataSlots; |
8789 } | 8790 } |
8790 | 8791 |
8791 | 8792 |
8792 int64_t Isolate::AdjustAmountOfExternalAllocatedMemory( | 8793 int64_t Isolate::AdjustAmountOfExternalAllocatedMemory( |
8793 int64_t change_in_bytes) { | 8794 int64_t change_in_bytes) { |
8794 typedef internal::Internals I; | 8795 typedef internal::Internals I; |
8795 int64_t* external_memory = reinterpret_cast<int64_t*>( | 8796 int64_t* external_memory = reinterpret_cast<int64_t*>( |
8796 reinterpret_cast<uint8_t*>(this) + I::kExternalMemoryOffset); | 8797 reinterpret_cast<uint8_t*>(this) + I::kExternalMemoryOffset); |
8797 const int64_t external_memory_limit = *reinterpret_cast<int64_t*>( | 8798 int64_t* external_memory_limit = reinterpret_cast<int64_t*>( |
8798 reinterpret_cast<uint8_t*>(this) + I::kExternalMemoryLimitOffset); | 8799 reinterpret_cast<uint8_t*>(this) + I::kExternalMemoryLimitOffset); |
8799 const int64_t amount = *external_memory + change_in_bytes; | 8800 const int64_t amount = *external_memory + change_in_bytes; |
8800 *external_memory = amount; | 8801 *external_memory = amount; |
8801 if (change_in_bytes > 0 && amount > external_memory_limit) { | 8802 if (amount + 192 * 1024 * 1024 < *external_memory_limit) { |
Michael Lippautz
2016/08/12 07:06:23
Can we avoid polluting the API and instead adjust
| |
8803 *external_memory_limit = amount + 192 * 1024 * 1024; | |
Hannes Payer (out of office)
2016/08/12 14:06:09
Why are you shrinking the limit here?
| |
8804 } | |
8805 if (change_in_bytes > 0 && amount > *external_memory_limit) { | |
8802 ReportExternalAllocationLimitReached(); | 8806 ReportExternalAllocationLimitReached(); |
8803 } | 8807 } |
8804 return *external_memory; | 8808 return *external_memory; |
8805 } | 8809 } |
8806 | 8810 |
8807 | 8811 |
8808 template<typename T> | 8812 template<typename T> |
8809 void Isolate::SetObjectGroupId(const Persistent<T>& object, | 8813 void Isolate::SetObjectGroupId(const Persistent<T>& object, |
8810 UniqueId id) { | 8814 UniqueId id) { |
8811 TYPE_CHECK(Value, T); | 8815 TYPE_CHECK(Value, T); |
(...skipping 154 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... | |
8966 */ | 8970 */ |
8967 | 8971 |
8968 | 8972 |
8969 } // namespace v8 | 8973 } // namespace v8 |
8970 | 8974 |
8971 | 8975 |
8972 #undef TYPE_CHECK | 8976 #undef TYPE_CHECK |
8973 | 8977 |
8974 | 8978 |
8975 #endif // INCLUDE_V8_H_ | 8979 #endif // INCLUDE_V8_H_ |
OLD | NEW |