| OLD | NEW |
| 1 // Copyright 2009 the V8 project authors. All rights reserved. | 1 // Copyright 2009 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 363 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 374 } | 374 } |
| 375 | 375 |
| 376 | 376 |
| 377 ResourceConstraints::ResourceConstraints() | 377 ResourceConstraints::ResourceConstraints() |
| 378 : max_young_space_size_(0), | 378 : max_young_space_size_(0), |
| 379 max_old_space_size_(0), | 379 max_old_space_size_(0), |
| 380 stack_limit_(NULL) { } | 380 stack_limit_(NULL) { } |
| 381 | 381 |
| 382 | 382 |
| 383 bool SetResourceConstraints(ResourceConstraints* constraints) { | 383 bool SetResourceConstraints(ResourceConstraints* constraints) { |
| 384 i::Isolate* isolate = i::Isolate::Current(); |
| 385 |
| 384 int young_space_size = constraints->max_young_space_size(); | 386 int young_space_size = constraints->max_young_space_size(); |
| 385 int old_gen_size = constraints->max_old_space_size(); | 387 int old_gen_size = constraints->max_old_space_size(); |
| 386 if (young_space_size != 0 || old_gen_size != 0) { | 388 if (young_space_size != 0 || old_gen_size != 0) { |
| 387 bool result = i::Heap::ConfigureHeap(young_space_size / 2, old_gen_size); | 389 bool result = isolate->heap()->ConfigureHeap(young_space_size / 2, |
| 390 old_gen_size); |
| 388 if (!result) return false; | 391 if (!result) return false; |
| 389 } | 392 } |
| 390 if (constraints->stack_limit() != NULL) { | 393 if (constraints->stack_limit() != NULL) { |
| 391 uintptr_t limit = reinterpret_cast<uintptr_t>(constraints->stack_limit()); | 394 uintptr_t limit = reinterpret_cast<uintptr_t>(constraints->stack_limit()); |
| 392 i::StackGuard::SetStackLimit(limit); | 395 isolate->stack_guard()->SetStackLimit(limit); |
| 393 } | 396 } |
| 394 return true; | 397 return true; |
| 395 } | 398 } |
| 396 | 399 |
| 397 | 400 |
| 398 i::Object** V8::GlobalizeReference(i::Object** obj) { | 401 i::Object** V8::GlobalizeReference(i::Object** obj) { |
| 399 if (IsDeadCheck("V8::Persistent::New")) return NULL; | 402 if (IsDeadCheck("V8::Persistent::New")) return NULL; |
| 400 LOG_API("Persistent::New"); | 403 LOG_API("Persistent::New"); |
| 401 i::Handle<i::Object> result = | 404 i::Handle<i::Object> result = |
| 402 i::GlobalHandles::Create(*obj); | 405 i::GlobalHandles::Create(*obj); |
| (...skipping 3444 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 3847 int V8::GetCurrentThreadId() { | 3850 int V8::GetCurrentThreadId() { |
| 3848 API_ENTRY_CHECK("V8::GetCurrentThreadId()"); | 3851 API_ENTRY_CHECK("V8::GetCurrentThreadId()"); |
| 3849 EnsureInitialized("V8::GetCurrentThreadId()"); | 3852 EnsureInitialized("V8::GetCurrentThreadId()"); |
| 3850 return i::Top::thread_id(); | 3853 return i::Top::thread_id(); |
| 3851 } | 3854 } |
| 3852 | 3855 |
| 3853 | 3856 |
| 3854 void V8::TerminateExecution(int thread_id) { | 3857 void V8::TerminateExecution(int thread_id) { |
| 3855 if (!i::V8::IsRunning()) return; | 3858 if (!i::V8::IsRunning()) return; |
| 3856 API_ENTRY_CHECK("V8::GetCurrentThreadId()"); | 3859 API_ENTRY_CHECK("V8::GetCurrentThreadId()"); |
| 3860 i::Isolate* isolate = i::Isolate::Current(); |
| 3857 // If the thread_id identifies the current thread just terminate | 3861 // If the thread_id identifies the current thread just terminate |
| 3858 // execution right away. Otherwise, ask the thread manager to | 3862 // execution right away. Otherwise, ask the thread manager to |
| 3859 // terminate the thread with the given id if any. | 3863 // terminate the thread with the given id if any. |
| 3860 if (thread_id == i::Top::thread_id()) { | 3864 if (thread_id == i::Top::thread_id()) { |
| 3861 i::StackGuard::TerminateExecution(); | 3865 isolate->stack_guard()->TerminateExecution(); |
| 3862 } else { | 3866 } else { |
| 3863 i::ThreadManager::TerminateExecution(thread_id); | 3867 i::ThreadManager::TerminateExecution(thread_id); |
| 3864 } | 3868 } |
| 3865 } | 3869 } |
| 3866 | 3870 |
| 3867 | 3871 |
| 3868 void V8::TerminateExecution() { | 3872 void V8::TerminateExecution() { |
| 3869 if (!i::V8::IsRunning()) return; | 3873 if (!i::V8::IsRunning()) return; |
| 3870 i::StackGuard::TerminateExecution(); | 3874 i::Isolate::Current()->stack_guard()->TerminateExecution(); |
| 3871 } | 3875 } |
| 3872 | 3876 |
| 3873 | 3877 |
| 3874 bool V8::IsExecutionTerminating() { | 3878 bool V8::IsExecutionTerminating() { |
| 3875 if (!i::V8::IsRunning()) return false; | 3879 if (!i::V8::IsRunning()) return false; |
| 3876 if (i::Top::has_scheduled_exception()) { | 3880 if (i::Top::has_scheduled_exception()) { |
| 3877 return i::Top::scheduled_exception() == HEAP->termination_exception(); | 3881 return i::Top::scheduled_exception() == HEAP->termination_exception(); |
| 3878 } | 3882 } |
| 3879 return false; | 3883 return false; |
| 3880 } | 3884 } |
| (...skipping 207 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 4088 ON_BAILOUT("v8::Debug::SetDebugEventListener()", return false); | 4092 ON_BAILOUT("v8::Debug::SetDebugEventListener()", return false); |
| 4089 ENTER_V8; | 4093 ENTER_V8; |
| 4090 i::Debugger::SetEventListener(Utils::OpenHandle(*that), | 4094 i::Debugger::SetEventListener(Utils::OpenHandle(*that), |
| 4091 Utils::OpenHandle(*data)); | 4095 Utils::OpenHandle(*data)); |
| 4092 return true; | 4096 return true; |
| 4093 } | 4097 } |
| 4094 | 4098 |
| 4095 | 4099 |
| 4096 void Debug::DebugBreak() { | 4100 void Debug::DebugBreak() { |
| 4097 if (!i::V8::IsRunning()) return; | 4101 if (!i::V8::IsRunning()) return; |
| 4098 i::StackGuard::DebugBreak(); | 4102 i::Isolate::Current()->stack_guard()->DebugBreak(); |
| 4099 } | 4103 } |
| 4100 | 4104 |
| 4101 | 4105 |
| 4102 static v8::Debug::MessageHandler message_handler = NULL; | 4106 static v8::Debug::MessageHandler message_handler = NULL; |
| 4103 | 4107 |
| 4104 static void MessageHandlerWrapper(const v8::Debug::Message& message) { | 4108 static void MessageHandlerWrapper(const v8::Debug::Message& message) { |
| 4105 if (message_handler) { | 4109 if (message_handler) { |
| 4106 v8::String::Value json(message.GetJSON()); | 4110 v8::String::Value json(message.GetJSON()); |
| 4107 message_handler(*json, json.length(), message.GetClientData()); | 4111 message_handler(*json, json.length(), message.GetClientData()); |
| 4108 } | 4112 } |
| (...skipping 317 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 4426 | 4430 |
| 4427 | 4431 |
| 4428 char* HandleScopeImplementer::Iterate(ObjectVisitor* v, char* storage) { | 4432 char* HandleScopeImplementer::Iterate(ObjectVisitor* v, char* storage) { |
| 4429 HandleScopeImplementer* thread_local = | 4433 HandleScopeImplementer* thread_local = |
| 4430 reinterpret_cast<HandleScopeImplementer*>(storage); | 4434 reinterpret_cast<HandleScopeImplementer*>(storage); |
| 4431 thread_local->IterateThis(v); | 4435 thread_local->IterateThis(v); |
| 4432 return storage + ArchiveSpacePerThread(); | 4436 return storage + ArchiveSpacePerThread(); |
| 4433 } | 4437 } |
| 4434 | 4438 |
| 4435 } } // namespace v8::internal | 4439 } } // namespace v8::internal |
| OLD | NEW |