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 7325 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... | |
7336 static const int kContextEmbedderDataIndex = 5; | 7336 static const int kContextEmbedderDataIndex = 5; |
7337 static const int kFullStringRepresentationMask = 0x07; | 7337 static const int kFullStringRepresentationMask = 0x07; |
7338 static const int kStringEncodingMask = 0x4; | 7338 static const int kStringEncodingMask = 0x4; |
7339 static const int kExternalTwoByteRepresentationTag = 0x02; | 7339 static const int kExternalTwoByteRepresentationTag = 0x02; |
7340 static const int kExternalOneByteRepresentationTag = 0x06; | 7340 static const int kExternalOneByteRepresentationTag = 0x06; |
7341 | 7341 |
7342 static const int kIsolateEmbedderDataOffset = 0 * kApiPointerSize; | 7342 static const int kIsolateEmbedderDataOffset = 0 * kApiPointerSize; |
7343 static const int kAmountOfExternalAllocatedMemoryOffset = | 7343 static const int kAmountOfExternalAllocatedMemoryOffset = |
7344 4 * kApiPointerSize; | 7344 4 * kApiPointerSize; |
7345 static const int kAmountOfExternalAllocatedMemoryAtLastGlobalGCOffset = | 7345 static const int kAmountOfExternalAllocatedMemoryAtLastGlobalGCOffset = |
7346 kAmountOfExternalAllocatedMemoryOffset + kApiInt64Size; | 7346 kAmountOfExternalAllocatedMemoryOffset + kApiPointerSize; |
7347 static const int kIsolateRootsOffset = | 7347 static const int kIsolateRootsOffset = |
7348 kAmountOfExternalAllocatedMemoryAtLastGlobalGCOffset + kApiInt64Size + | 7348 kAmountOfExternalAllocatedMemoryAtLastGlobalGCOffset + kApiPointerSize + |
7349 kApiPointerSize; | 7349 kApiPointerSize; |
7350 static const int kUndefinedValueRootIndex = 4; | 7350 static const int kUndefinedValueRootIndex = 4; |
7351 static const int kTheHoleValueRootIndex = 5; | 7351 static const int kTheHoleValueRootIndex = 5; |
7352 static const int kNullValueRootIndex = 6; | 7352 static const int kNullValueRootIndex = 6; |
7353 static const int kTrueValueRootIndex = 7; | 7353 static const int kTrueValueRootIndex = 7; |
7354 static const int kFalseValueRootIndex = 8; | 7354 static const int kFalseValueRootIndex = 8; |
7355 static const int kEmptyStringRootIndex = 9; | 7355 static const int kEmptyStringRootIndex = 9; |
7356 | 7356 |
7357 // The external allocation limit should be below 256 MB on all architectures | 7357 // The external allocation limit should be below 256 MB on all architectures |
7358 // to avoid that resource-constrained embedders run low on memory. | 7358 // to avoid that resource-constrained embedders run low on memory. |
(...skipping 1186 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... | |
8545 | 8545 |
8546 uint32_t Isolate::GetNumberOfDataSlots() { | 8546 uint32_t Isolate::GetNumberOfDataSlots() { |
8547 typedef internal::Internals I; | 8547 typedef internal::Internals I; |
8548 return I::kNumIsolateDataSlots; | 8548 return I::kNumIsolateDataSlots; |
8549 } | 8549 } |
8550 | 8550 |
8551 | 8551 |
8552 int64_t Isolate::AdjustAmountOfExternalAllocatedMemory( | 8552 int64_t Isolate::AdjustAmountOfExternalAllocatedMemory( |
8553 int64_t change_in_bytes) { | 8553 int64_t change_in_bytes) { |
8554 typedef internal::Internals I; | 8554 typedef internal::Internals I; |
8555 int64_t* amount_of_external_allocated_memory = | 8555 intptr_t* amount_of_external_allocated_memory = |
8556 reinterpret_cast<int64_t*>(reinterpret_cast<uint8_t*>(this) + | 8556 reinterpret_cast<intptr_t*>(reinterpret_cast<uint8_t*>(this) + |
8557 I::kAmountOfExternalAllocatedMemoryOffset); | 8557 I::kAmountOfExternalAllocatedMemoryOffset); |
8558 int64_t* amount_of_external_allocated_memory_at_last_global_gc = | 8558 intptr_t* amount_of_external_allocated_memory_at_last_global_gc = |
8559 reinterpret_cast<int64_t*>( | 8559 reinterpret_cast<intptr_t*>( |
Michael Lippautz
2016/05/11 08:22:51
It's really unfortunate that we require this magic
| |
8560 reinterpret_cast<uint8_t*>(this) + | 8560 reinterpret_cast<uint8_t*>(this) + |
8561 I::kAmountOfExternalAllocatedMemoryAtLastGlobalGCOffset); | 8561 I::kAmountOfExternalAllocatedMemoryAtLastGlobalGCOffset); |
8562 int64_t amount = *amount_of_external_allocated_memory + change_in_bytes; | 8562 intptr_t amount = *amount_of_external_allocated_memory + |
8563 static_cast<intptr_t>(change_in_bytes); | |
8563 if (change_in_bytes > 0 && | 8564 if (change_in_bytes > 0 && |
8564 amount - *amount_of_external_allocated_memory_at_last_global_gc > | 8565 amount - *amount_of_external_allocated_memory_at_last_global_gc > |
8565 I::kExternalAllocationLimit) { | 8566 I::kExternalAllocationLimit) { |
8566 ReportExternalAllocationLimitReached(); | 8567 ReportExternalAllocationLimitReached(); |
8567 } | 8568 } |
8568 *amount_of_external_allocated_memory = amount; | 8569 *amount_of_external_allocated_memory = amount; |
8569 return *amount_of_external_allocated_memory; | 8570 return *amount_of_external_allocated_memory; |
8570 } | 8571 } |
8571 | 8572 |
8572 | 8573 |
(...skipping 159 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... | |
8732 */ | 8733 */ |
8733 | 8734 |
8734 | 8735 |
8735 } // namespace v8 | 8736 } // namespace v8 |
8736 | 8737 |
8737 | 8738 |
8738 #undef TYPE_CHECK | 8739 #undef TYPE_CHECK |
8739 | 8740 |
8740 | 8741 |
8741 #endif // INCLUDE_V8_H_ | 8742 #endif // INCLUDE_V8_H_ |
OLD | NEW |