| 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 7571 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 7582 void* operator new(size_t size) = delete; | 7582 void* operator new(size_t size) = delete; |
| 7583 void* operator new[](size_t size) = delete; | 7583 void* operator new[](size_t size) = delete; |
| 7584 void operator delete(void*, size_t) = delete; | 7584 void operator delete(void*, size_t) = delete; |
| 7585 void operator delete[](void*, size_t) = delete; | 7585 void operator delete[](void*, size_t) = delete; |
| 7586 | 7586 |
| 7587 private: | 7587 private: |
| 7588 template <class K, class V, class Traits> | 7588 template <class K, class V, class Traits> |
| 7589 friend class PersistentValueMapBase; | 7589 friend class PersistentValueMapBase; |
| 7590 | 7590 |
| 7591 void ReportExternalAllocationLimitReached(); | 7591 void ReportExternalAllocationLimitReached(); |
| 7592 void CheckMemoryPressure(); |
| 7592 }; | 7593 }; |
| 7593 | 7594 |
| 7594 class V8_EXPORT StartupData { | 7595 class V8_EXPORT StartupData { |
| 7595 public: | 7596 public: |
| 7596 const char* data; | 7597 const char* data; |
| 7597 int raw_size; | 7598 int raw_size; |
| 7598 }; | 7599 }; |
| 7599 | 7600 |
| 7600 | 7601 |
| 7601 /** | 7602 /** |
| (...skipping 1207 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 8809 static const int kContextEmbedderDataIndex = 5; | 8810 static const int kContextEmbedderDataIndex = 5; |
| 8810 static const int kFullStringRepresentationMask = 0x0f; | 8811 static const int kFullStringRepresentationMask = 0x0f; |
| 8811 static const int kStringEncodingMask = 0x8; | 8812 static const int kStringEncodingMask = 0x8; |
| 8812 static const int kExternalTwoByteRepresentationTag = 0x02; | 8813 static const int kExternalTwoByteRepresentationTag = 0x02; |
| 8813 static const int kExternalOneByteRepresentationTag = 0x0a; | 8814 static const int kExternalOneByteRepresentationTag = 0x0a; |
| 8814 | 8815 |
| 8815 static const int kIsolateEmbedderDataOffset = 0 * kApiPointerSize; | 8816 static const int kIsolateEmbedderDataOffset = 0 * kApiPointerSize; |
| 8816 static const int kExternalMemoryOffset = 4 * kApiPointerSize; | 8817 static const int kExternalMemoryOffset = 4 * kApiPointerSize; |
| 8817 static const int kExternalMemoryLimitOffset = | 8818 static const int kExternalMemoryLimitOffset = |
| 8818 kExternalMemoryOffset + kApiInt64Size; | 8819 kExternalMemoryOffset + kApiInt64Size; |
| 8820 static const int kExternalMemoryAtLastMarkCompactOffset = |
| 8821 kExternalMemoryLimitOffset + kApiInt64Size; |
| 8819 static const int kIsolateRootsOffset = kExternalMemoryLimitOffset + | 8822 static const int kIsolateRootsOffset = kExternalMemoryLimitOffset + |
| 8820 kApiInt64Size + kApiInt64Size + | 8823 kApiInt64Size + kApiInt64Size + |
| 8821 kApiPointerSize + kApiPointerSize; | 8824 kApiPointerSize + kApiPointerSize; |
| 8822 static const int kUndefinedValueRootIndex = 4; | 8825 static const int kUndefinedValueRootIndex = 4; |
| 8823 static const int kTheHoleValueRootIndex = 5; | 8826 static const int kTheHoleValueRootIndex = 5; |
| 8824 static const int kNullValueRootIndex = 6; | 8827 static const int kNullValueRootIndex = 6; |
| 8825 static const int kTrueValueRootIndex = 7; | 8828 static const int kTrueValueRootIndex = 7; |
| 8826 static const int kFalseValueRootIndex = 8; | 8829 static const int kFalseValueRootIndex = 8; |
| 8827 static const int kEmptyStringRootIndex = 9; | 8830 static const int kEmptyStringRootIndex = 9; |
| 8828 | 8831 |
| (...skipping 1197 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 10026 | 10029 |
| 10027 | 10030 |
| 10028 uint32_t Isolate::GetNumberOfDataSlots() { | 10031 uint32_t Isolate::GetNumberOfDataSlots() { |
| 10029 typedef internal::Internals I; | 10032 typedef internal::Internals I; |
| 10030 return I::kNumIsolateDataSlots; | 10033 return I::kNumIsolateDataSlots; |
| 10031 } | 10034 } |
| 10032 | 10035 |
| 10033 | 10036 |
| 10034 int64_t Isolate::AdjustAmountOfExternalAllocatedMemory( | 10037 int64_t Isolate::AdjustAmountOfExternalAllocatedMemory( |
| 10035 int64_t change_in_bytes) { | 10038 int64_t change_in_bytes) { |
| 10039 const int64_t kMemoryReducerActivationLimit = 1024 * 1024; |
| 10036 typedef internal::Internals I; | 10040 typedef internal::Internals I; |
| 10037 int64_t* external_memory = reinterpret_cast<int64_t*>( | 10041 int64_t* external_memory = reinterpret_cast<int64_t*>( |
| 10038 reinterpret_cast<uint8_t*>(this) + I::kExternalMemoryOffset); | 10042 reinterpret_cast<uint8_t*>(this) + I::kExternalMemoryOffset); |
| 10039 const int64_t external_memory_limit = *reinterpret_cast<int64_t*>( | 10043 const int64_t external_memory_limit = *reinterpret_cast<int64_t*>( |
| 10040 reinterpret_cast<uint8_t*>(this) + I::kExternalMemoryLimitOffset); | 10044 reinterpret_cast<uint8_t*>(this) + I::kExternalMemoryLimitOffset); |
| 10045 int64_t* external_memory_at_last_mc = |
| 10046 reinterpret_cast<int64_t*>(reinterpret_cast<uint8_t*>(this) + |
| 10047 I::kExternalMemoryAtLastMarkCompactOffset); |
| 10041 const int64_t amount = *external_memory + change_in_bytes; | 10048 const int64_t amount = *external_memory + change_in_bytes; |
| 10049 |
| 10042 *external_memory = amount; | 10050 *external_memory = amount; |
| 10051 |
| 10052 int64_t allocation_diff_since_last_mc = |
| 10053 *external_memory_at_last_mc - *external_memory; |
| 10054 allocation_diff_since_last_mc = allocation_diff_since_last_mc < 0 |
| 10055 ? -allocation_diff_since_last_mc |
| 10056 : allocation_diff_since_last_mc; |
| 10057 if (allocation_diff_since_last_mc > kMemoryReducerActivationLimit) { |
| 10058 CheckMemoryPressure(); |
| 10059 } |
| 10060 |
| 10043 if (change_in_bytes > 0 && amount > external_memory_limit) { | 10061 if (change_in_bytes > 0 && amount > external_memory_limit) { |
| 10044 ReportExternalAllocationLimitReached(); | 10062 ReportExternalAllocationLimitReached(); |
| 10045 } | 10063 } |
| 10046 return *external_memory; | 10064 return *external_memory; |
| 10047 } | 10065 } |
| 10048 | 10066 |
| 10049 Local<Value> Context::GetEmbedderData(int index) { | 10067 Local<Value> Context::GetEmbedderData(int index) { |
| 10050 #ifndef V8_ENABLE_CHECKS | 10068 #ifndef V8_ENABLE_CHECKS |
| 10051 typedef internal::Object O; | 10069 typedef internal::Object O; |
| 10052 typedef internal::HeapObject HO; | 10070 typedef internal::HeapObject HO; |
| (...skipping 127 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 10180 */ | 10198 */ |
| 10181 | 10199 |
| 10182 | 10200 |
| 10183 } // namespace v8 | 10201 } // namespace v8 |
| 10184 | 10202 |
| 10185 | 10203 |
| 10186 #undef TYPE_CHECK | 10204 #undef TYPE_CHECK |
| 10187 | 10205 |
| 10188 | 10206 |
| 10189 #endif // INCLUDE_V8_H_ | 10207 #endif // INCLUDE_V8_H_ |
| OLD | NEW |