| Index: src/api.cc
|
| diff --git a/src/api.cc b/src/api.cc
|
| index 0a38fa9f32b2b3e3932a178d756c80b44b1a0c1e..00147c3b3255195ac5e17335c21baa6a8fdfc72d 100644
|
| --- a/src/api.cc
|
| +++ b/src/api.cc
|
| @@ -609,10 +609,19 @@ ResourceConstraints::ResourceConstraints()
|
| bool SetResourceConstraints(ResourceConstraints* constraints) {
|
| i::Isolate* isolate = EnterIsolateIfNeeded();
|
|
|
| + bool changed_memory_constrained = false;
|
| + if (constraints->is_memory_constrained().has_value &&
|
| + !i::FLAG_force_memory_constrained.has_value) {
|
| + isolate->set_is_memory_constrained(
|
| + constraints->is_memory_constrained().value);
|
| + changed_memory_constrained = true;
|
| + }
|
| +
|
| int young_space_size = constraints->max_young_space_size();
|
| int old_gen_size = constraints->max_old_space_size();
|
| int max_executable_size = constraints->max_executable_size();
|
| - if (young_space_size != 0 || old_gen_size != 0 || max_executable_size != 0) {
|
| + if (young_space_size != 0 || old_gen_size != 0 || max_executable_size != 0 ||
|
| + changed_memory_constrained) {
|
| // After initialization it's too late to change Heap constraints.
|
| ASSERT(!isolate->IsInitialized());
|
| bool result = isolate->heap()->ConfigureHeap(young_space_size / 2,
|
| @@ -624,11 +633,6 @@ bool SetResourceConstraints(ResourceConstraints* constraints) {
|
| uintptr_t limit = reinterpret_cast<uintptr_t>(constraints->stack_limit());
|
| isolate->stack_guard()->SetStackLimit(limit);
|
| }
|
| - if (constraints->is_memory_constrained().has_value &&
|
| - !i::FLAG_force_memory_constrained.has_value) {
|
| - isolate->set_is_memory_constrained(
|
| - constraints->is_memory_constrained().value);
|
| - }
|
| return true;
|
| }
|
|
|
|
|