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 606 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
617 return v8::Handle<Boolean>(); | 617 return v8::Handle<Boolean>(); |
618 } | 618 } |
619 return ToApiHandle<Boolean>(isolate->factory()->false_value()); | 619 return ToApiHandle<Boolean>(isolate->factory()->false_value()); |
620 } | 620 } |
621 | 621 |
622 | 622 |
623 ResourceConstraints::ResourceConstraints() | 623 ResourceConstraints::ResourceConstraints() |
624 : max_young_space_size_(0), | 624 : max_young_space_size_(0), |
625 max_old_space_size_(0), | 625 max_old_space_size_(0), |
626 max_executable_size_(0), | 626 max_executable_size_(0), |
627 stack_limit_(NULL) { } | 627 stack_limit_(NULL), |
| 628 is_memory_constrained_() { } |
628 | 629 |
629 | 630 |
630 bool SetResourceConstraints(ResourceConstraints* constraints) { | 631 bool SetResourceConstraints(ResourceConstraints* constraints) { |
631 i::Isolate* isolate = EnterIsolateIfNeeded(); | 632 i::Isolate* isolate = EnterIsolateIfNeeded(); |
632 | 633 |
633 int young_space_size = constraints->max_young_space_size(); | 634 int young_space_size = constraints->max_young_space_size(); |
634 int old_gen_size = constraints->max_old_space_size(); | 635 int old_gen_size = constraints->max_old_space_size(); |
635 int max_executable_size = constraints->max_executable_size(); | 636 int max_executable_size = constraints->max_executable_size(); |
636 if (young_space_size != 0 || old_gen_size != 0 || max_executable_size != 0) { | 637 if (young_space_size != 0 || old_gen_size != 0 || max_executable_size != 0) { |
637 // After initialization it's too late to change Heap constraints. | 638 // After initialization it's too late to change Heap constraints. |
638 ASSERT(!isolate->IsInitialized()); | 639 ASSERT(!isolate->IsInitialized()); |
639 bool result = isolate->heap()->ConfigureHeap(young_space_size / 2, | 640 bool result = isolate->heap()->ConfigureHeap(young_space_size / 2, |
640 old_gen_size, | 641 old_gen_size, |
641 max_executable_size); | 642 max_executable_size); |
642 if (!result) return false; | 643 if (!result) return false; |
643 } | 644 } |
644 if (constraints->stack_limit() != NULL) { | 645 if (constraints->stack_limit() != NULL) { |
645 uintptr_t limit = reinterpret_cast<uintptr_t>(constraints->stack_limit()); | 646 uintptr_t limit = reinterpret_cast<uintptr_t>(constraints->stack_limit()); |
646 isolate->stack_guard()->SetStackLimit(limit); | 647 isolate->stack_guard()->SetStackLimit(limit); |
647 } | 648 } |
| 649 if (constraints->is_memory_constrained().has_value) { |
| 650 isolate->set_is_memory_constrained( |
| 651 constraints->is_memory_constrained().value); |
| 652 } |
648 return true; | 653 return true; |
649 } | 654 } |
650 | 655 |
651 | 656 |
652 i::Object** V8::GlobalizeReference(i::Isolate* isolate, i::Object** obj) { | 657 i::Object** V8::GlobalizeReference(i::Isolate* isolate, i::Object** obj) { |
653 if (IsDeadCheck(isolate, "V8::Persistent::New")) return NULL; | 658 if (IsDeadCheck(isolate, "V8::Persistent::New")) return NULL; |
654 LOG_API(isolate, "Persistent::New"); | 659 LOG_API(isolate, "Persistent::New"); |
655 i::Handle<i::Object> result = isolate->global_handles()->Create(*obj); | 660 i::Handle<i::Object> result = isolate->global_handles()->Create(*obj); |
656 #ifdef DEBUG | 661 #ifdef DEBUG |
657 (*obj)->Verify(); | 662 (*obj)->Verify(); |
(...skipping 7239 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
7897 Isolate* isolate = reinterpret_cast<Isolate*>(info.GetIsolate()); | 7902 Isolate* isolate = reinterpret_cast<Isolate*>(info.GetIsolate()); |
7898 Address callback_address = | 7903 Address callback_address = |
7899 reinterpret_cast<Address>(reinterpret_cast<intptr_t>(callback)); | 7904 reinterpret_cast<Address>(reinterpret_cast<intptr_t>(callback)); |
7900 VMState<EXTERNAL> state(isolate); | 7905 VMState<EXTERNAL> state(isolate); |
7901 ExternalCallbackScope call_scope(isolate, callback_address); | 7906 ExternalCallbackScope call_scope(isolate, callback_address); |
7902 return callback(info); | 7907 return callback(info); |
7903 } | 7908 } |
7904 | 7909 |
7905 | 7910 |
7906 } } // namespace v8::internal | 7911 } } // namespace v8::internal |
OLD | NEW |