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 return v8::Handle<Boolean>(); | 595 return v8::Handle<Boolean>(); |
596 } | 596 } |
597 return ToApiHandle<Boolean>(isolate->factory()->false_value()); | 597 return ToApiHandle<Boolean>(isolate->factory()->false_value()); |
598 } | 598 } |
599 | 599 |
600 | 600 |
601 ResourceConstraints::ResourceConstraints() | 601 ResourceConstraints::ResourceConstraints() |
602 : max_young_space_size_(0), | 602 : max_young_space_size_(0), |
603 max_old_space_size_(0), | 603 max_old_space_size_(0), |
604 max_executable_size_(0), | 604 max_executable_size_(0), |
605 stack_limit_(NULL), | 605 stack_limit_(NULL) { } |
606 is_memory_constrained_() { } | |
607 | 606 |
608 | 607 |
609 bool SetResourceConstraints(ResourceConstraints* constraints) { | 608 bool SetResourceConstraints(ResourceConstraints* constraints) { |
610 i::Isolate* isolate = EnterIsolateIfNeeded(); | 609 i::Isolate* isolate = EnterIsolateIfNeeded(); |
611 | 610 |
612 int young_space_size = constraints->max_young_space_size(); | 611 int young_space_size = constraints->max_young_space_size(); |
613 int old_gen_size = constraints->max_old_space_size(); | 612 int old_gen_size = constraints->max_old_space_size(); |
614 int max_executable_size = constraints->max_executable_size(); | 613 int max_executable_size = constraints->max_executable_size(); |
615 if (young_space_size != 0 || old_gen_size != 0 || max_executable_size != 0) { | 614 if (young_space_size != 0 || old_gen_size != 0 || max_executable_size != 0) { |
616 // After initialization it's too late to change Heap constraints. | 615 // After initialization it's too late to change Heap constraints. |
617 ASSERT(!isolate->IsInitialized()); | 616 ASSERT(!isolate->IsInitialized()); |
618 bool result = isolate->heap()->ConfigureHeap(young_space_size / 2, | 617 bool result = isolate->heap()->ConfigureHeap(young_space_size / 2, |
619 old_gen_size, | 618 old_gen_size, |
620 max_executable_size); | 619 max_executable_size); |
621 if (!result) return false; | 620 if (!result) return false; |
622 } | 621 } |
623 if (constraints->stack_limit() != NULL) { | 622 if (constraints->stack_limit() != NULL) { |
624 uintptr_t limit = reinterpret_cast<uintptr_t>(constraints->stack_limit()); | 623 uintptr_t limit = reinterpret_cast<uintptr_t>(constraints->stack_limit()); |
625 isolate->stack_guard()->SetStackLimit(limit); | 624 isolate->stack_guard()->SetStackLimit(limit); |
626 } | 625 } |
627 if (constraints->is_memory_constrained().has_value && | |
628 !i::FLAG_force_memory_constrained.has_value) { | |
629 isolate->set_is_memory_constrained( | |
630 constraints->is_memory_constrained().value); | |
631 } | |
632 return true; | 626 return true; |
633 } | 627 } |
634 | 628 |
635 | 629 |
636 i::Object** V8::GlobalizeReference(i::Isolate* isolate, i::Object** obj) { | 630 i::Object** V8::GlobalizeReference(i::Isolate* isolate, i::Object** obj) { |
637 if (IsDeadCheck(isolate, "V8::Persistent::New")) return NULL; | 631 if (IsDeadCheck(isolate, "V8::Persistent::New")) return NULL; |
638 LOG_API(isolate, "Persistent::New"); | 632 LOG_API(isolate, "Persistent::New"); |
639 i::Handle<i::Object> result = isolate->global_handles()->Create(*obj); | 633 i::Handle<i::Object> result = isolate->global_handles()->Create(*obj); |
640 #ifdef DEBUG | 634 #ifdef DEBUG |
641 (*obj)->Verify(); | 635 (*obj)->Verify(); |
(...skipping 7243 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
7885 Isolate* isolate = reinterpret_cast<Isolate*>(info.GetIsolate()); | 7879 Isolate* isolate = reinterpret_cast<Isolate*>(info.GetIsolate()); |
7886 Address callback_address = | 7880 Address callback_address = |
7887 reinterpret_cast<Address>(reinterpret_cast<intptr_t>(callback)); | 7881 reinterpret_cast<Address>(reinterpret_cast<intptr_t>(callback)); |
7888 VMState<EXTERNAL> state(isolate); | 7882 VMState<EXTERNAL> state(isolate); |
7889 ExternalCallbackScope call_scope(isolate, callback_address); | 7883 ExternalCallbackScope call_scope(isolate, callback_address); |
7890 callback(info); | 7884 callback(info); |
7891 } | 7885 } |
7892 | 7886 |
7893 | 7887 |
7894 } } // namespace v8::internal | 7888 } } // namespace v8::internal |
OLD | NEW |