OLD | NEW |
1 // Copyright 2012 the V8 project authors. All rights reserved. | 1 // Copyright 2012 the V8 project authors. All rights reserved. |
2 // Use of this source code is governed by a BSD-style license that can be | 2 // Use of this source code is governed by a BSD-style license that can be |
3 // found in the LICENSE file. | 3 // found in the LICENSE file. |
4 | 4 |
5 #include "api.h" | 5 #include "api.h" |
6 | 6 |
7 #include <string.h> // For memcpy, strlen. | 7 #include <string.h> // For memcpy, strlen. |
8 #include <cmath> // For isnan. | 8 #include <cmath> // For isnan. |
9 #include "../include/v8-debug.h" | 9 #include "../include/v8-debug.h" |
10 #include "../include/v8-profiler.h" | 10 #include "../include/v8-profiler.h" |
(...skipping 456 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
467 set_code_range_size( | 467 set_code_range_size( |
468 i::Min(512 * i::MB, static_cast<int>(virtual_memory_limit >> 3))); | 468 i::Min(512 * i::MB, static_cast<int>(virtual_memory_limit >> 3))); |
469 } | 469 } |
470 } | 470 } |
471 | 471 |
472 | 472 |
473 bool SetResourceConstraints(Isolate* v8_isolate, | 473 bool SetResourceConstraints(Isolate* v8_isolate, |
474 ResourceConstraints* constraints) { | 474 ResourceConstraints* constraints) { |
475 i::Isolate* isolate = reinterpret_cast<i::Isolate*>(v8_isolate); | 475 i::Isolate* isolate = reinterpret_cast<i::Isolate*>(v8_isolate); |
476 int new_space_size = constraints->max_new_space_size(); | 476 int new_space_size = constraints->max_new_space_size(); |
477 int old_gen_size = constraints->max_old_space_size(); | 477 int old_space_size = constraints->max_old_space_size(); |
478 int max_executable_size = constraints->max_executable_size(); | 478 int max_executable_size = constraints->max_executable_size(); |
479 int code_range_size = constraints->code_range_size(); | 479 int code_range_size = constraints->code_range_size(); |
480 if (new_space_size != 0 || old_gen_size != 0 || max_executable_size != 0 || | 480 if (new_space_size != 0 || old_space_size != 0 || max_executable_size != 0 || |
481 code_range_size != 0) { | 481 code_range_size != 0) { |
482 // After initialization it's too late to change Heap constraints. | 482 // After initialization it's too late to change Heap constraints. |
483 ASSERT(!isolate->IsInitialized()); | 483 ASSERT(!isolate->IsInitialized()); |
484 bool result = isolate->heap()->ConfigureHeap(new_space_size / 2, | 484 bool result = isolate->heap()->ConfigureHeap(new_space_size / 2, |
485 old_gen_size, | 485 old_space_size, |
486 max_executable_size, | 486 max_executable_size, |
487 code_range_size); | 487 code_range_size); |
488 if (!result) return false; | 488 if (!result) return false; |
489 } | 489 } |
490 if (constraints->stack_limit() != NULL) { | 490 if (constraints->stack_limit() != NULL) { |
491 uintptr_t limit = reinterpret_cast<uintptr_t>(constraints->stack_limit()); | 491 uintptr_t limit = reinterpret_cast<uintptr_t>(constraints->stack_limit()); |
492 isolate->stack_guard()->SetStackLimit(limit); | 492 isolate->stack_guard()->SetStackLimit(limit); |
493 } | 493 } |
494 | 494 |
495 isolate->set_max_available_threads(constraints->max_available_threads()); | 495 isolate->set_max_available_threads(constraints->max_available_threads()); |
(...skipping 7098 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
7594 Isolate* isolate = reinterpret_cast<Isolate*>(info.GetIsolate()); | 7594 Isolate* isolate = reinterpret_cast<Isolate*>(info.GetIsolate()); |
7595 Address callback_address = | 7595 Address callback_address = |
7596 reinterpret_cast<Address>(reinterpret_cast<intptr_t>(callback)); | 7596 reinterpret_cast<Address>(reinterpret_cast<intptr_t>(callback)); |
7597 VMState<EXTERNAL> state(isolate); | 7597 VMState<EXTERNAL> state(isolate); |
7598 ExternalCallbackScope call_scope(isolate, callback_address); | 7598 ExternalCallbackScope call_scope(isolate, callback_address); |
7599 callback(info); | 7599 callback(info); |
7600 } | 7600 } |
7601 | 7601 |
7602 | 7602 |
7603 } } // namespace v8::internal | 7603 } } // namespace v8::internal |
OLD | NEW |