Index: src/ppc/simulator-ppc.cc |
diff --git a/src/ppc/simulator-ppc.cc b/src/ppc/simulator-ppc.cc |
index 1932631215745152f63a05de52d9d1fe092334aa..118741bc323303410e411903dbaf1c8c6cf096af 100644 |
--- a/src/ppc/simulator-ppc.cc |
+++ b/src/ppc/simulator-ppc.cc |
@@ -794,10 +794,11 @@ Simulator::Simulator(Isolate* isolate) : isolate_(isolate) { |
// Set up simulator support first. Some of this information is needed to |
// setup the architecture state. |
#if V8_TARGET_ARCH_PPC64 |
- size_t stack_size = 2 * 1024 * 1024; // allocate 2MB for stack |
+ size_t stack_size = FLAG_sim_stack_size * KB; |
#else |
- size_t stack_size = 1 * 1024 * 1024; // allocate 1MB for stack |
+ size_t stack_size = MB; // allocate 1MB for stack |
#endif |
+ stack_size += 2 * stack_protection_size_; |
stack_ = reinterpret_cast<char*>(malloc(stack_size)); |
pc_modified_ = false; |
icount_ = 0; |
@@ -823,7 +824,8 @@ Simulator::Simulator(Isolate* isolate) : isolate_(isolate) { |
// The sp is initialized to point to the bottom (high address) of the |
// allocated stack area. To be safe in potential stack underflows we leave |
// some buffer below. |
- registers_[sp] = reinterpret_cast<intptr_t>(stack_) + stack_size - 64; |
+ registers_[sp] = |
+ reinterpret_cast<intptr_t>(stack_) + stack_size - stack_protection_size_; |
InitializeCoverage(); |
last_debugger_input_ = NULL; |
@@ -1107,9 +1109,8 @@ void Simulator::WriteDW(intptr_t addr, int64_t value) { |
// Returns the limit of the stack area to enable checking for stack overflows. |
uintptr_t Simulator::StackLimit() const { |
- // Leave a safety margin of 1024 bytes to prevent overrunning the stack when |
- // pushing values. |
- return reinterpret_cast<uintptr_t>(stack_) + 1024; |
+ // Leave a safety margin to prevent overrunning the stack when pushing values. |
+ return reinterpret_cast<uintptr_t>(stack_) + stack_protection_size_; |
} |