OLD | NEW |
1 // Copyright 2012 the V8 project authors. All rights reserved. | 1 // Copyright 2012 the V8 project authors. All rights reserved. |
2 // Redistribution and use in source and binary forms, with or without | 2 // Redistribution and use in source and binary forms, with or without |
3 // modification, are permitted provided that the following conditions are | 3 // modification, are permitted provided that the following conditions are |
4 // met: | 4 // met: |
5 // | 5 // |
6 // * Redistributions of source code must retain the above copyright | 6 // * Redistributions of source code must retain the above copyright |
7 // notice, this list of conditions and the following disclaimer. | 7 // notice, this list of conditions and the following disclaimer. |
8 // * Redistributions in binary form must reproduce the above | 8 // * Redistributions in binary form must reproduce the above |
9 // copyright notice, this list of conditions and the following | 9 // copyright notice, this list of conditions and the following |
10 // disclaimer in the documentation and/or other materials provided | 10 // disclaimer in the documentation and/or other materials provided |
(...skipping 584 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
595 set_max_old_space_size(512 * lump_of_memory); | 595 set_max_old_space_size(512 * lump_of_memory); |
596 set_max_executable_size(256 * lump_of_memory); | 596 set_max_executable_size(256 * lump_of_memory); |
597 } else { | 597 } else { |
598 set_max_young_space_size(16 * lump_of_memory); | 598 set_max_young_space_size(16 * lump_of_memory); |
599 set_max_old_space_size(700 * lump_of_memory); | 599 set_max_old_space_size(700 * lump_of_memory); |
600 set_max_executable_size(256 * lump_of_memory); | 600 set_max_executable_size(256 * lump_of_memory); |
601 } | 601 } |
602 } | 602 } |
603 | 603 |
604 | 604 |
605 bool SetResourceConstraints(ResourceConstraints* constraints) { | |
606 i::Isolate* isolate = EnterIsolateIfNeeded(); | |
607 return SetResourceConstraints(reinterpret_cast<Isolate*>(isolate), | |
608 constraints); | |
609 } | |
610 | |
611 | |
612 bool SetResourceConstraints(Isolate* v8_isolate, | 605 bool SetResourceConstraints(Isolate* v8_isolate, |
613 ResourceConstraints* constraints) { | 606 ResourceConstraints* constraints) { |
614 i::Isolate* isolate = reinterpret_cast<i::Isolate*>(v8_isolate); | 607 i::Isolate* isolate = reinterpret_cast<i::Isolate*>(v8_isolate); |
615 int young_space_size = constraints->max_young_space_size(); | 608 int young_space_size = constraints->max_young_space_size(); |
616 int old_gen_size = constraints->max_old_space_size(); | 609 int old_gen_size = constraints->max_old_space_size(); |
617 int max_executable_size = constraints->max_executable_size(); | 610 int max_executable_size = constraints->max_executable_size(); |
618 if (young_space_size != 0 || old_gen_size != 0 || max_executable_size != 0) { | 611 if (young_space_size != 0 || old_gen_size != 0 || max_executable_size != 0) { |
619 // After initialization it's too late to change Heap constraints. | 612 // After initialization it's too late to change Heap constraints. |
620 ASSERT(!isolate->IsInitialized()); | 613 ASSERT(!isolate->IsInitialized()); |
621 bool result = isolate->heap()->ConfigureHeap(young_space_size / 2, | 614 bool result = isolate->heap()->ConfigureHeap(young_space_size / 2, |
(...skipping 7035 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
7657 Isolate* isolate = reinterpret_cast<Isolate*>(info.GetIsolate()); | 7650 Isolate* isolate = reinterpret_cast<Isolate*>(info.GetIsolate()); |
7658 Address callback_address = | 7651 Address callback_address = |
7659 reinterpret_cast<Address>(reinterpret_cast<intptr_t>(callback)); | 7652 reinterpret_cast<Address>(reinterpret_cast<intptr_t>(callback)); |
7660 VMState<EXTERNAL> state(isolate); | 7653 VMState<EXTERNAL> state(isolate); |
7661 ExternalCallbackScope call_scope(isolate, callback_address); | 7654 ExternalCallbackScope call_scope(isolate, callback_address); |
7662 callback(info); | 7655 callback(info); |
7663 } | 7656 } |
7664 | 7657 |
7665 | 7658 |
7666 } } // namespace v8::internal | 7659 } } // namespace v8::internal |
OLD | NEW |