| 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 57 matching lines...) Expand 10 before | Expand all | Expand 10 after  Loading... | 
| 68 | 68 | 
| 69 #define EXCEPTION_BAILOUT_CHECK(value)                                         \ | 69 #define EXCEPTION_BAILOUT_CHECK(value)                                         \ | 
| 70   do {                                                                         \ | 70   do {                                                                         \ | 
| 71     thread_local.DecrementCallDepth();                                         \ | 71     thread_local.DecrementCallDepth();                                         \ | 
| 72     if (has_pending_exception) {                                               \ | 72     if (has_pending_exception) {                                               \ | 
| 73       if (thread_local.CallDepthIsZero() && i::Top::is_out_of_memory()) {      \ | 73       if (thread_local.CallDepthIsZero() && i::Top::is_out_of_memory()) {      \ | 
| 74         if (!thread_local.IgnoreOutOfMemory())                                 \ | 74         if (!thread_local.IgnoreOutOfMemory())                                 \ | 
| 75           i::V8::FatalProcessOutOfMemory(NULL);                                \ | 75           i::V8::FatalProcessOutOfMemory(NULL);                                \ | 
| 76       }                                                                        \ | 76       }                                                                        \ | 
| 77       bool call_depth_is_zero = thread_local.CallDepthIsZero();                \ | 77       bool call_depth_is_zero = thread_local.CallDepthIsZero();                \ | 
| 78       i::Top::optional_reschedule_exception(call_depth_is_zero);               \ | 78       i::Top::OptionalRescheduleException(call_depth_is_zero, false);        \ | 
| 79       return value;                                                            \ | 79       return value;                                                            \ | 
| 80     }                                                                          \ | 80     }                                                                          \ | 
| 81   } while (false) | 81   } while (false) | 
| 82 | 82 | 
| 83 | 83 | 
| 84 #define API_ENTRY_CHECK(msg)                                                   \ | 84 #define API_ENTRY_CHECK(msg)                                                   \ | 
| 85   do {                                                                         \ | 85   do {                                                                         \ | 
| 86     if (v8::Locker::IsActive()) {                                              \ | 86     if (v8::Locker::IsActive()) {                                              \ | 
| 87       ApiCheck(i::ThreadManager::IsLockedByCurrentThread(),                    \ | 87       ApiCheck(i::ThreadManager::IsLockedByCurrentThread(),                    \ | 
| 88                msg,                                                            \ | 88                msg,                                                            \ | 
| (...skipping 1112 matching lines...) Expand 10 before | Expand all | Expand 10 after  Loading... | 
| 1201 v8::TryCatch::~TryCatch() { | 1201 v8::TryCatch::~TryCatch() { | 
| 1202   i::Top::UnregisterTryCatchHandler(this); | 1202   i::Top::UnregisterTryCatchHandler(this); | 
| 1203 } | 1203 } | 
| 1204 | 1204 | 
| 1205 | 1205 | 
| 1206 bool v8::TryCatch::HasCaught() const { | 1206 bool v8::TryCatch::HasCaught() const { | 
| 1207   return !reinterpret_cast<i::Object*>(exception_)->IsTheHole(); | 1207   return !reinterpret_cast<i::Object*>(exception_)->IsTheHole(); | 
| 1208 } | 1208 } | 
| 1209 | 1209 | 
| 1210 | 1210 | 
|  | 1211 bool v8::TryCatch::CanContinue() const { | 
|  | 1212   return can_continue_; | 
|  | 1213 } | 
|  | 1214 | 
|  | 1215 | 
| 1211 v8::Local<Value> v8::TryCatch::Exception() const { | 1216 v8::Local<Value> v8::TryCatch::Exception() const { | 
| 1212   if (HasCaught()) { | 1217   if (HasCaught()) { | 
| 1213     // Check for out of memory exception. | 1218     // Check for out of memory exception. | 
| 1214     i::Object* exception = reinterpret_cast<i::Object*>(exception_); | 1219     i::Object* exception = reinterpret_cast<i::Object*>(exception_); | 
| 1215     return v8::Utils::ToLocal(i::Handle<i::Object>(exception)); | 1220     return v8::Utils::ToLocal(i::Handle<i::Object>(exception)); | 
| 1216   } else { | 1221   } else { | 
| 1217     return v8::Local<Value>(); | 1222     return v8::Local<Value>(); | 
| 1218   } | 1223   } | 
| 1219 } | 1224 } | 
| 1220 | 1225 | 
| (...skipping 2126 matching lines...) Expand 10 before | Expand all | Expand 10 after  Loading... | 
| 3347 } | 3352 } | 
| 3348 | 3353 | 
| 3349 | 3354 | 
| 3350 int V8::GetLogLines(int from_pos, char* dest_buf, int max_size) { | 3355 int V8::GetLogLines(int from_pos, char* dest_buf, int max_size) { | 
| 3351 #ifdef ENABLE_LOGGING_AND_PROFILING | 3356 #ifdef ENABLE_LOGGING_AND_PROFILING | 
| 3352   return i::Logger::GetLogLines(from_pos, dest_buf, max_size); | 3357   return i::Logger::GetLogLines(from_pos, dest_buf, max_size); | 
| 3353 #endif | 3358 #endif | 
| 3354   return 0; | 3359   return 0; | 
| 3355 } | 3360 } | 
| 3356 | 3361 | 
|  | 3362 | 
|  | 3363 int V8::GetCurrentThreadId() { | 
|  | 3364   API_ENTRY_CHECK("V8::GetCurrentThreadId()"); | 
|  | 3365   EnsureInitialized("V8::GetCurrentThreadId()"); | 
|  | 3366   return i::Top::thread_id(); | 
|  | 3367 } | 
|  | 3368 | 
|  | 3369 | 
|  | 3370 void V8::TerminateExecution(int thread_id) { | 
|  | 3371   if (!i::V8::IsRunning()) return; | 
|  | 3372   API_ENTRY_CHECK("V8::GetCurrentThreadId()"); | 
|  | 3373   // If the thread_id identifies the current thread just terminate | 
|  | 3374   // execution right away.  Otherwise, ask the thread manager to | 
|  | 3375   // terminate the thread with the given id if any. | 
|  | 3376   if (thread_id == i::Top::thread_id()) { | 
|  | 3377     i::StackGuard::TerminateExecution(); | 
|  | 3378   } else { | 
|  | 3379     i::ThreadManager::TerminateExecution(thread_id); | 
|  | 3380   } | 
|  | 3381 } | 
|  | 3382 | 
|  | 3383 | 
|  | 3384 void V8::TerminateExecution() { | 
|  | 3385   if (!i::V8::IsRunning()) return; | 
|  | 3386   i::StackGuard::TerminateExecution(); | 
|  | 3387 } | 
|  | 3388 | 
|  | 3389 | 
| 3357 String::Utf8Value::Utf8Value(v8::Handle<v8::Value> obj) { | 3390 String::Utf8Value::Utf8Value(v8::Handle<v8::Value> obj) { | 
| 3358   EnsureInitialized("v8::String::Utf8Value::Utf8Value()"); | 3391   EnsureInitialized("v8::String::Utf8Value::Utf8Value()"); | 
| 3359   if (obj.IsEmpty()) { | 3392   if (obj.IsEmpty()) { | 
| 3360     str_ = NULL; | 3393     str_ = NULL; | 
| 3361     length_ = 0; | 3394     length_ = 0; | 
| 3362     return; | 3395     return; | 
| 3363   } | 3396   } | 
| 3364   ENTER_V8; | 3397   ENTER_V8; | 
| 3365   HandleScope scope; | 3398   HandleScope scope; | 
| 3366   TryCatch try_catch; | 3399   TryCatch try_catch; | 
| (...skipping 350 matching lines...) Expand 10 before | Expand all | Expand 10 after  Loading... | 
| 3717       reinterpret_cast<HandleScopeImplementer*>(storage); | 3750       reinterpret_cast<HandleScopeImplementer*>(storage); | 
| 3718   List<void**>* blocks_of_archived_thread = thread_local->Blocks(); | 3751   List<void**>* blocks_of_archived_thread = thread_local->Blocks(); | 
| 3719   v8::ImplementationUtilities::HandleScopeData* handle_data_of_archived_thread = | 3752   v8::ImplementationUtilities::HandleScopeData* handle_data_of_archived_thread = | 
| 3720       &thread_local->handle_scope_data_; | 3753       &thread_local->handle_scope_data_; | 
| 3721   Iterate(v, blocks_of_archived_thread, handle_data_of_archived_thread); | 3754   Iterate(v, blocks_of_archived_thread, handle_data_of_archived_thread); | 
| 3722 | 3755 | 
| 3723   return storage + ArchiveSpacePerThread(); | 3756   return storage + ArchiveSpacePerThread(); | 
| 3724 } | 3757 } | 
| 3725 | 3758 | 
| 3726 } }  // namespace v8::internal | 3759 } }  // namespace v8::internal | 
| OLD | NEW | 
|---|