Skip to content

Commit

Permalink
We only require Code range setup if RMODE64 is supported
Browse files Browse the repository at this point in the history
  • Loading branch information
jBarz committed May 22, 2018
1 parent e370576 commit 703c5f0
Show file tree
Hide file tree
Showing 3 changed files with 16 additions and 3 deletions.
2 changes: 1 addition & 1 deletion src/api.cc
Original file line number Diff line number Diff line change
Expand Up @@ -635,7 +635,7 @@ void ResourceConstraints::ConfigureDefaults(uint64_t physical_memory,
set_max_executable_size(i::Heap::kMaxExecutableSizeHugeMemoryDevice);
}

if (virtual_memory_limit > 0 && i::kRequiresCodeRange) {
if (virtual_memory_limit > 0 && i::RequiresCodeRange()) {
// Reserve no more than 1/8 of the memory for the code range, but at most
// kMaximalCodeRangeSize.
set_code_range_size(
Expand Down
13 changes: 13 additions & 0 deletions src/globals.h
Original file line number Diff line number Diff line change
Expand Up @@ -11,6 +11,7 @@
#include <ostream>

#include "src/base/build_config.h"
#include "src/base/sys-info.h"
#include "src/base/logging.h"
#include "src/base/macros.h"

Expand Down Expand Up @@ -1049,6 +1050,18 @@ inline uint32_t ObjectHash(Address address) {
kPointerSizeLog2);
}

inline bool RequiresCodeRange() {
#if V8_HOST_ARCH_64_BIT
return v8::base::SysInfo::ExecutablePagesAbove2GB();
#else
# if V8_TARGET_ARCH_X64 && V8_TARGET_ARCH_32_BIT
return true;
# else
return false;
# endif
#endif
}

} // namespace internal
} // namespace v8

Expand Down
4 changes: 2 additions & 2 deletions src/heap/spaces.cc
Original file line number Diff line number Diff line change
Expand Up @@ -104,7 +104,7 @@ bool CodeRange::SetUp(size_t requested) {
// 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) {
if (RequiresCodeRange()) {
requested = kMaximalCodeRangeSize;
} else {
return true;
Expand All @@ -115,7 +115,7 @@ bool CodeRange::SetUp(size_t requested) {
requested = kMinimumCodeRangeSize;
}

DCHECK(!kRequiresCodeRange || requested <= kMaximalCodeRangeSize);
DCHECK(!RequiresCodeRange() || requested <= kMaximalCodeRangeSize);
#ifdef V8_TARGET_ARCH_MIPS64
// To use pseudo-relative jumps such as j/jal instructions which have 28-bit
// encoded immediate, the addresses have to be in range of 256Mb aligned
Expand Down

3 comments on commit 703c5f0

@jBarz
Copy link
Author

@jBarz jBarz commented on 703c5f0 May 22, 2018

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

@joransiu @mmallick-ca fyi.
Let me know if you see any issues.

@joransiu
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

LGTM.. though it's a bit kludgy that we had to replicate the #defines for RequiresCodeRange implementation.

@jBarz
Copy link
Author

@jBarz jBarz commented on 703c5f0 May 22, 2018

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

ohh, i think I should remove the original kRequiresCodeRange definitions since they are no longer used (replaced by the inline function).
Will commit that after this.

Please sign in to comment.