Chromium Code Reviews
chromiumcodereview-hr@appspot.gserviceaccount.com (chromiumcodereview-hr) | Please choose your nickname with Settings | Help | Chromium Project | Gerrit Changes | Sign out
(549)

Side by Side Diff: include/v8.h

Issue 2085893002: [heap] Internalize kExternalAllocationLimit (Closed) Base URL: https://chromium.googlesource.com/v8/v8.git@master
Patch Set: Initialize limit Created 4 years, 6 months ago
Use n/p to move between diff chunks; N/P to move between comments. Draft comments are only viewable by you.
Jump to:
View unified diff | Download patch
« no previous file with comments | « no previous file | src/extensions/statistics-extension.cc » ('j') | no next file with comments »
Toggle Intra-line Diffs ('i') | Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
OLDNEW
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 7475 matching lines...) Expand 10 before | Expand all | Expand 10 after
7486 static const int kJSObjectHeaderSize = 3 * kApiPointerSize; 7486 static const int kJSObjectHeaderSize = 3 * kApiPointerSize;
7487 static const int kFixedArrayHeaderSize = 2 * kApiPointerSize; 7487 static const int kFixedArrayHeaderSize = 2 * kApiPointerSize;
7488 static const int kContextHeaderSize = 2 * kApiPointerSize; 7488 static const int kContextHeaderSize = 2 * kApiPointerSize;
7489 static const int kContextEmbedderDataIndex = 5; 7489 static const int kContextEmbedderDataIndex = 5;
7490 static const int kFullStringRepresentationMask = 0x07; 7490 static const int kFullStringRepresentationMask = 0x07;
7491 static const int kStringEncodingMask = 0x4; 7491 static const int kStringEncodingMask = 0x4;
7492 static const int kExternalTwoByteRepresentationTag = 0x02; 7492 static const int kExternalTwoByteRepresentationTag = 0x02;
7493 static const int kExternalOneByteRepresentationTag = 0x06; 7493 static const int kExternalOneByteRepresentationTag = 0x06;
7494 7494
7495 static const int kIsolateEmbedderDataOffset = 0 * kApiPointerSize; 7495 static const int kIsolateEmbedderDataOffset = 0 * kApiPointerSize;
7496 static const int kAmountOfExternalAllocatedMemoryOffset = 7496 static const int kExternalMemoryOffset = 4 * kApiPointerSize;
7497 4 * kApiPointerSize; 7497 static const int kExternalMemoryLimitOffset =
7498 static const int kAmountOfExternalAllocatedMemoryAtLastGlobalGCOffset = 7498 kExternalMemoryOffset + kApiInt64Size;
7499 kAmountOfExternalAllocatedMemoryOffset + kApiInt64Size; 7499 static const int kIsolateRootsOffset = kExternalMemoryLimitOffset +
7500 static const int kIsolateRootsOffset = 7500 kApiInt64Size + kApiInt64Size +
7501 kAmountOfExternalAllocatedMemoryAtLastGlobalGCOffset + kApiInt64Size + 7501 kApiPointerSize + kApiPointerSize;
7502 kApiPointerSize + kApiPointerSize;
7503 static const int kUndefinedValueRootIndex = 4; 7502 static const int kUndefinedValueRootIndex = 4;
7504 static const int kTheHoleValueRootIndex = 5; 7503 static const int kTheHoleValueRootIndex = 5;
7505 static const int kNullValueRootIndex = 6; 7504 static const int kNullValueRootIndex = 6;
7506 static const int kTrueValueRootIndex = 7; 7505 static const int kTrueValueRootIndex = 7;
7507 static const int kFalseValueRootIndex = 8; 7506 static const int kFalseValueRootIndex = 8;
7508 static const int kEmptyStringRootIndex = 9; 7507 static const int kEmptyStringRootIndex = 9;
7509 7508
7510 // The external allocation limit should be below 256 MB on all architectures
7511 // to avoid that resource-constrained embedders run low on memory.
7512 static const int kExternalAllocationLimit = 192 * 1024 * 1024;
7513
7514 static const int kNodeClassIdOffset = 1 * kApiPointerSize; 7509 static const int kNodeClassIdOffset = 1 * kApiPointerSize;
7515 static const int kNodeFlagsOffset = 1 * kApiPointerSize + 3; 7510 static const int kNodeFlagsOffset = 1 * kApiPointerSize + 3;
7516 static const int kNodeStateMask = 0x7; 7511 static const int kNodeStateMask = 0x7;
7517 static const int kNodeStateIsWeakValue = 2; 7512 static const int kNodeStateIsWeakValue = 2;
7518 static const int kNodeStateIsPendingValue = 3; 7513 static const int kNodeStateIsPendingValue = 3;
7519 static const int kNodeStateIsNearDeathValue = 4; 7514 static const int kNodeStateIsNearDeathValue = 4;
7520 static const int kNodeIsIndependentShift = 3; 7515 static const int kNodeIsIndependentShift = 3;
7521 static const int kNodeIsPartiallyDependentShift = 4; 7516 static const int kNodeIsPartiallyDependentShift = 4;
7522 static const int kNodeIsActiveShift = 4; 7517 static const int kNodeIsActiveShift = 4;
7523 7518
(...skipping 1174 matching lines...) Expand 10 before | Expand all | Expand 10 after
8698 8693
8699 uint32_t Isolate::GetNumberOfDataSlots() { 8694 uint32_t Isolate::GetNumberOfDataSlots() {
8700 typedef internal::Internals I; 8695 typedef internal::Internals I;
8701 return I::kNumIsolateDataSlots; 8696 return I::kNumIsolateDataSlots;
8702 } 8697 }
8703 8698
8704 8699
8705 int64_t Isolate::AdjustAmountOfExternalAllocatedMemory( 8700 int64_t Isolate::AdjustAmountOfExternalAllocatedMemory(
8706 int64_t change_in_bytes) { 8701 int64_t change_in_bytes) {
8707 typedef internal::Internals I; 8702 typedef internal::Internals I;
8708 int64_t* amount_of_external_allocated_memory = 8703 int64_t* external_memory = reinterpret_cast<int64_t*>(
8709 reinterpret_cast<int64_t*>(reinterpret_cast<uint8_t*>(this) + 8704 reinterpret_cast<uint8_t*>(this) + I::kExternalMemoryOffset);
8710 I::kAmountOfExternalAllocatedMemoryOffset); 8705 const int64_t external_memory_limit = *reinterpret_cast<int64_t*>(
8711 int64_t* amount_of_external_allocated_memory_at_last_global_gc = 8706 reinterpret_cast<uint8_t*>(this) + I::kExternalMemoryLimitOffset);
8712 reinterpret_cast<int64_t*>( 8707 const int64_t amount = *external_memory + change_in_bytes;
8713 reinterpret_cast<uint8_t*>(this) + 8708 *external_memory = amount;
8714 I::kAmountOfExternalAllocatedMemoryAtLastGlobalGCOffset); 8709 if (change_in_bytes > 0 && amount > external_memory_limit) {
8715 int64_t amount = *amount_of_external_allocated_memory + change_in_bytes;
8716 if (change_in_bytes > 0 &&
8717 amount - *amount_of_external_allocated_memory_at_last_global_gc >
8718 I::kExternalAllocationLimit) {
8719 ReportExternalAllocationLimitReached(); 8710 ReportExternalAllocationLimitReached();
8720 } 8711 }
8721 *amount_of_external_allocated_memory = amount; 8712 return *external_memory;
8722 return *amount_of_external_allocated_memory;
8723 } 8713 }
8724 8714
8725 8715
8726 template<typename T> 8716 template<typename T>
8727 void Isolate::SetObjectGroupId(const Persistent<T>& object, 8717 void Isolate::SetObjectGroupId(const Persistent<T>& object,
8728 UniqueId id) { 8718 UniqueId id) {
8729 TYPE_CHECK(Value, T); 8719 TYPE_CHECK(Value, T);
8730 SetObjectGroupId(reinterpret_cast<v8::internal::Object**>(object.val_), id); 8720 SetObjectGroupId(reinterpret_cast<v8::internal::Object**>(object.val_), id);
8731 } 8721 }
8732 8722
(...skipping 152 matching lines...) Expand 10 before | Expand all | Expand 10 after
8885 */ 8875 */
8886 8876
8887 8877
8888 } // namespace v8 8878 } // namespace v8
8889 8879
8890 8880
8891 #undef TYPE_CHECK 8881 #undef TYPE_CHECK
8892 8882
8893 8883
8894 #endif // INCLUDE_V8_H_ 8884 #endif // INCLUDE_V8_H_
OLDNEW
« no previous file with comments | « no previous file | src/extensions/statistics-extension.cc » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698