Revision: 21837
Author: [email protected]
Date: Fri Jun 13 11:06:42 2014 UTC
Log: Reland "Rename kIs64BitArch with kRequiresCodeRange."
[email protected]
Review URL: https://codereview.chromium.org/331823002
Patch from Weiliang Lin <[email protected]>.
http://code.google.com/p/v8/source/detail?r=21837
Modified:
/branches/bleeding_edge/include/v8.h
/branches/bleeding_edge/src/api.cc
/branches/bleeding_edge/src/globals.h
/branches/bleeding_edge/src/heap.cc
/branches/bleeding_edge/src/heap.h
/branches/bleeding_edge/src/spaces.cc
/branches/bleeding_edge/test/cctest/test-alloc.cc
/branches/bleeding_edge/test/cctest/test-spaces.cc
=======================================
--- /branches/bleeding_edge/include/v8.h Thu Jun 12 17:31:54 2014 UTC
+++ /branches/bleeding_edge/include/v8.h Fri Jun 13 11:06:42 2014 UTC
@@ -3865,8 +3865,8 @@
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 @@
int max_executable_size_;
uint32_t* stack_limit_;
int max_available_threads_;
- int code_range_size_;
+ size_t code_range_size_;
};
=======================================
--- /branches/bleeding_edge/src/api.cc Thu Jun 12 15:08:33 2014 UTC
+++ /branches/bleeding_edge/src/api.cc Fri Jun 13 11:06:42 2014 UTC
@@ -465,11 +465,12 @@
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 @@
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.
=======================================
--- /branches/bleeding_edge/src/globals.h Fri Jun 13 10:50:11 2014 UTC
+++ /branches/bleeding_edge/src/globals.h Fri Jun 13 11:06:42 2014 UTC
@@ -153,12 +153,14 @@
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;
=======================================
--- /branches/bleeding_edge/src/heap.cc Thu Jun 12 12:39:51 2014 UTC
+++ /branches/bleeding_edge/src/heap.cc Fri Jun 13 11:06:42 2014 UTC
@@ -4936,7 +4936,7 @@
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.
=======================================
--- /branches/bleeding_edge/src/heap.h Thu Jun 12 17:31:54 2014 UTC
+++ /branches/bleeding_edge/src/heap.h Fri Jun 13 11:06:42 2014 UTC
@@ -551,7 +551,7 @@
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 @@
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_;
=======================================
--- /branches/bleeding_edge/src/spaces.cc Thu Jun 12 12:01:01 2014 UTC
+++ /branches/bleeding_edge/src/spaces.cc Fri Jun 13 11:06:42 2014 UTC
@@ -115,15 +115,17 @@
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()) {
=======================================
--- /branches/bleeding_edge/test/cctest/test-alloc.cc Tue Jun 3 08:12:43
2014 UTC
+++ /branches/bleeding_edge/test/cctest/test-alloc.cc Fri Jun 13 11:06:42
2014 UTC
@@ -196,12 +196,12 @@
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) {
=======================================
--- /branches/bleeding_edge/test/cctest/test-spaces.cc Thu Jun 12 12:01:01
2014 UTC
+++ /branches/bleeding_edge/test/cctest/test-spaces.cc Fri Jun 13 11:06:42
2014 UTC
@@ -221,7 +221,7 @@
// 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,
--
--
v8-dev mailing list
[email protected]
http://groups.google.com/group/v8-dev
---
You received this message because you are subscribed to the Google Groups "v8-dev" group.
To unsubscribe from this group and stop receiving emails from it, send an email
to [email protected].
For more options, visit https://groups.google.com/d/optout.