Reland "Rename kIs64BitArch with kRequiresCodeRange."

R=svenpanne@chromium.org

Review URL: https://codereview.chromium.org/331823002

Patch from Weiliang Lin <weiliang.lin@intel.com>.

git-svn-id: https://v8.googlecode.com/svn/branches/bleeding_edge@21837 ce2b1a6d-e550-0410-aec6-3dcde31c8c00
This commit is contained in:
svenpanne@chromium.org 2014-06-13 11:06:42 +00:00
parent 3b545740b4
commit 510ea9e529
8 changed files with 25 additions and 20 deletions

View File

@ -3865,8 +3865,8 @@ class V8_EXPORT ResourceConstraints {
void set_max_available_threads(int value) {
max_available_threads_ = value;
}
int code_range_size() const { return code_range_size_; }
void set_code_range_size(int value) {
size_t code_range_size() const { return code_range_size_; }
void set_code_range_size(size_t value) {
code_range_size_ = value;
}
@ -3876,7 +3876,7 @@ class V8_EXPORT ResourceConstraints {
int max_executable_size_;
uint32_t* stack_limit_;
int max_available_threads_;
int code_range_size_;
size_t code_range_size_;
};

View File

@ -465,11 +465,12 @@ void ResourceConstraints::ConfigureDefaults(uint64_t physical_memory,
set_max_available_threads(i::Max(i::Min(number_of_processors, 4u), 1u));
if (virtual_memory_limit > 0 && i::kIs64BitArch) {
if (virtual_memory_limit > 0 && i::kRequiresCodeRange) {
// Reserve no more than 1/8 of the memory for the code range, but at most
// 512 MB.
// kMaximalCodeRangeSize.
set_code_range_size(
i::Min(512, static_cast<int>((virtual_memory_limit >> 3) / i::MB)));
i::Min(i::kMaximalCodeRangeSize / i::MB,
static_cast<size_t>((virtual_memory_limit >> 3) / i::MB)));
}
}
@ -480,7 +481,7 @@ bool SetResourceConstraints(Isolate* v8_isolate,
int semi_space_size = constraints->max_semi_space_size();
int old_space_size = constraints->max_old_space_size();
int max_executable_size = constraints->max_executable_size();
int code_range_size = constraints->code_range_size();
size_t code_range_size = constraints->code_range_size();
if (semi_space_size != 0 || old_space_size != 0 ||
max_executable_size != 0 || code_range_size != 0) {
// After initialization it's too late to change Heap constraints.

View File

@ -153,12 +153,14 @@ const int kDoubleSizeLog2 = 3;
const int kPointerSizeLog2 = 3;
const intptr_t kIntptrSignBit = V8_INT64_C(0x8000000000000000);
const uintptr_t kUintptrAllBitsSet = V8_UINT64_C(0xFFFFFFFFFFFFFFFF);
const bool kIs64BitArch = true;
const bool kRequiresCodeRange = true;
const size_t kMaximalCodeRangeSize = 512 * MB;
#else
const int kPointerSizeLog2 = 2;
const intptr_t kIntptrSignBit = 0x80000000;
const uintptr_t kUintptrAllBitsSet = 0xFFFFFFFFu;
const bool kIs64BitArch = false;
const bool kRequiresCodeRange = false;
const size_t kMaximalCodeRangeSize = 0 * MB;
#endif
const int kBitsPerByte = 8;

View File

@ -4936,7 +4936,7 @@ void Heap::IterateStrongRoots(ObjectVisitor* v, VisitMode mode) {
bool Heap::ConfigureHeap(int max_semi_space_size,
int max_old_space_size,
int max_executable_size,
int code_range_size) {
size_t code_range_size) {
if (HasBeenSetUp()) return false;
// Overwrite default configuration.

View File

@ -551,7 +551,7 @@ class Heap {
bool ConfigureHeap(int max_semi_space_size,
int max_old_space_size,
int max_executable_size,
int code_range_size);
size_t code_range_size);
bool ConfigureHeapDefault();
// Prepares the heap, setting up memory areas that are needed in the isolate
@ -1519,7 +1519,7 @@ class Heap {
Object* roots_[kRootListLength];
intptr_t code_range_size_;
size_t code_range_size_;
int reserved_semispace_size_;
int max_semi_space_size_;
int initial_semispace_size_;

View File

@ -115,15 +115,17 @@ bool CodeRange::SetUp(size_t requested) {
ASSERT(code_range_ == NULL);
if (requested == 0) {
// On 64-bit platform(s), we put all code objects in a 512 MB range of
// virtual address space, so that they can call each other with near calls.
if (kIs64BitArch) {
requested = 512 * MB;
// When a target requires the code range feature, we put all code objects
// in a kMaximalCodeRangeSize range of virtual address space, so that
// they can call each other with near calls.
if (kRequiresCodeRange) {
requested = kMaximalCodeRangeSize;
} else {
return true;
}
}
ASSERT(!kRequiresCodeRange || requested <= kMaximalCodeRangeSize);
code_range_ = new VirtualMemory(requested);
CHECK(code_range_ != NULL);
if (!code_range_->IsReserved()) {

View File

@ -196,12 +196,12 @@ class Block {
TEST(CodeRange) {
const int code_range_size = 32*MB;
const size_t code_range_size = 32*MB;
CcTest::InitializeVM();
CodeRange code_range(reinterpret_cast<Isolate*>(CcTest::isolate()));
code_range.SetUp(code_range_size);
int current_allocated = 0;
int total_allocated = 0;
size_t current_allocated = 0;
size_t total_allocated = 0;
List<Block> blocks(1000);
while (total_allocated < 5 * code_range_size) {

View File

@ -221,7 +221,7 @@ TEST(MemoryChunk) {
// With CodeRange.
CodeRange* code_range = new CodeRange(isolate);
const int code_range_size = 32 * MB;
const size_t code_range_size = 32 * MB;
if (!code_range->SetUp(code_range_size)) return;
VerifyMemoryChunk(isolate,