| 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 455 matching lines...) Expand 10 before | Expand all | Expand 10 after  Loading... | 
| 466   i::FlagList::SetFlagsFromString(str, length); | 466   i::FlagList::SetFlagsFromString(str, length); | 
| 467 } | 467 } | 
| 468 | 468 | 
| 469 | 469 | 
| 470 void V8::SetFlagsFromCommandLine(int* argc, char** argv, bool remove_flags) { | 470 void V8::SetFlagsFromCommandLine(int* argc, char** argv, bool remove_flags) { | 
| 471   i::FlagList::SetFlagsFromCommandLine(argc, argv, remove_flags); | 471   i::FlagList::SetFlagsFromCommandLine(argc, argv, remove_flags); | 
| 472 } | 472 } | 
| 473 | 473 | 
| 474 | 474 | 
| 475 v8::Handle<Value> ThrowException(v8::Handle<v8::Value> value) { | 475 v8::Handle<Value> ThrowException(v8::Handle<v8::Value> value) { | 
| 476   i::Isolate* isolate = i::Isolate::Current(); | 476   return v8::Isolate::GetCurrent()->ThrowException(value); | 
| 477   ENTER_V8(isolate); |  | 
| 478   // If we're passed an empty handle, we throw an undefined exception |  | 
| 479   // to deal more gracefully with out of memory situations. |  | 
| 480   if (value.IsEmpty()) { |  | 
| 481     isolate->ScheduleThrow(isolate->heap()->undefined_value()); |  | 
| 482   } else { |  | 
| 483     isolate->ScheduleThrow(*Utils::OpenHandle(*value)); |  | 
| 484   } |  | 
| 485   return v8::Undefined(); |  | 
| 486 } | 477 } | 
| 487 | 478 | 
| 488 | 479 | 
| 489 RegisteredExtension* RegisteredExtension::first_extension_ = NULL; | 480 RegisteredExtension* RegisteredExtension::first_extension_ = NULL; | 
| 490 | 481 | 
| 491 | 482 | 
| 492 RegisteredExtension::RegisteredExtension(Extension* extension) | 483 RegisteredExtension::RegisteredExtension(Extension* extension) | 
| 493     : extension_(extension) { } | 484     : extension_(extension) { } | 
| 494 | 485 | 
| 495 | 486 | 
| (...skipping 1423 matching lines...) Expand 10 before | Expand all | Expand 10 after  Loading... | 
| 1919     v8::Local<v8::Value> exc = v8::Local<v8::Value>::New(Exception()); | 1910     v8::Local<v8::Value> exc = v8::Local<v8::Value>::New(Exception()); | 
| 1920     if (HasCaught() && capture_message_) { | 1911     if (HasCaught() && capture_message_) { | 
| 1921       // If an exception was caught and rethrow_ is indicated, the saved | 1912       // If an exception was caught and rethrow_ is indicated, the saved | 
| 1922       // message, script, and location need to be restored to Isolate TLS | 1913       // message, script, and location need to be restored to Isolate TLS | 
| 1923       // for reuse.  capture_message_ needs to be disabled so that DoThrow() | 1914       // for reuse.  capture_message_ needs to be disabled so that DoThrow() | 
| 1924       // does not create a new message. | 1915       // does not create a new message. | 
| 1925       isolate_->thread_local_top()->rethrowing_message_ = true; | 1916       isolate_->thread_local_top()->rethrowing_message_ = true; | 
| 1926       isolate_->RestorePendingMessageFromTryCatch(this); | 1917       isolate_->RestorePendingMessageFromTryCatch(this); | 
| 1927     } | 1918     } | 
| 1928     isolate_->UnregisterTryCatchHandler(this); | 1919     isolate_->UnregisterTryCatchHandler(this); | 
| 1929     v8::ThrowException(exc); | 1920     reinterpret_cast<Isolate*>(isolate_)->ThrowException(exc); | 
| 1930     ASSERT(!isolate_->thread_local_top()->rethrowing_message_); | 1921     ASSERT(!isolate_->thread_local_top()->rethrowing_message_); | 
| 1931   } else { | 1922   } else { | 
| 1932     isolate_->UnregisterTryCatchHandler(this); | 1923     isolate_->UnregisterTryCatchHandler(this); | 
| 1933   } | 1924   } | 
| 1934 } | 1925 } | 
| 1935 | 1926 | 
| 1936 | 1927 | 
| 1937 bool v8::TryCatch::HasCaught() const { | 1928 bool v8::TryCatch::HasCaught() const { | 
| 1938   return !reinterpret_cast<i::Object*>(exception_)->IsTheHole(); | 1929   return !reinterpret_cast<i::Object*>(exception_)->IsTheHole(); | 
| 1939 } | 1930 } | 
| (...skipping 4414 matching lines...) Expand 10 before | Expand all | Expand 10 after  Loading... | 
| 6354 | 6345 | 
| 6355 v8::Local<v8::Context> Isolate::GetEnteredContext() { | 6346 v8::Local<v8::Context> Isolate::GetEnteredContext() { | 
| 6356   i::Isolate* isolate = reinterpret_cast<i::Isolate*>(this); | 6347   i::Isolate* isolate = reinterpret_cast<i::Isolate*>(this); | 
| 6357   i::Handle<i::Object> last = | 6348   i::Handle<i::Object> last = | 
| 6358       isolate->handle_scope_implementer()->LastEnteredContext(); | 6349       isolate->handle_scope_implementer()->LastEnteredContext(); | 
| 6359   if (last.is_null()) return Local<Context>(); | 6350   if (last.is_null()) return Local<Context>(); | 
| 6360   return Utils::ToLocal(i::Handle<i::Context>::cast(last)); | 6351   return Utils::ToLocal(i::Handle<i::Context>::cast(last)); | 
| 6361 } | 6352 } | 
| 6362 | 6353 | 
| 6363 | 6354 | 
|  | 6355 v8::Local<Value> Isolate::ThrowException(v8::Local<v8::Value> value) { | 
|  | 6356   i::Isolate* isolate = reinterpret_cast<i::Isolate*>(this); | 
|  | 6357   ENTER_V8(isolate); | 
|  | 6358   // If we're passed an empty handle, we throw an undefined exception | 
|  | 6359   // to deal more gracefully with out of memory situations. | 
|  | 6360   if (value.IsEmpty()) { | 
|  | 6361     isolate->ScheduleThrow(isolate->heap()->undefined_value()); | 
|  | 6362   } else { | 
|  | 6363     isolate->ScheduleThrow(*Utils::OpenHandle(*value)); | 
|  | 6364   } | 
|  | 6365   return v8::Undefined(); | 
|  | 6366 } | 
|  | 6367 | 
|  | 6368 | 
| 6364 void Isolate::SetObjectGroupId(const Persistent<Value>& object, | 6369 void Isolate::SetObjectGroupId(const Persistent<Value>& object, | 
| 6365                                UniqueId id) { | 6370                                UniqueId id) { | 
| 6366   i::Isolate* internal_isolate = reinterpret_cast<i::Isolate*>(this); | 6371   i::Isolate* internal_isolate = reinterpret_cast<i::Isolate*>(this); | 
| 6367   internal_isolate->global_handles()->SetObjectGroupId( | 6372   internal_isolate->global_handles()->SetObjectGroupId( | 
| 6368       Utils::OpenPersistent(object).location(), | 6373       Utils::OpenPersistent(object).location(), | 
| 6369       id); | 6374       id); | 
| 6370 } | 6375 } | 
| 6371 | 6376 | 
| 6372 | 6377 | 
| 6373 void Isolate::SetReferenceFromGroup(UniqueId id, | 6378 void Isolate::SetReferenceFromGroup(UniqueId id, | 
| (...skipping 1170 matching lines...) Expand 10 before | Expand all | Expand 10 after  Loading... | 
| 7544   Isolate* isolate = reinterpret_cast<Isolate*>(info.GetIsolate()); | 7549   Isolate* isolate = reinterpret_cast<Isolate*>(info.GetIsolate()); | 
| 7545   Address callback_address = | 7550   Address callback_address = | 
| 7546       reinterpret_cast<Address>(reinterpret_cast<intptr_t>(callback)); | 7551       reinterpret_cast<Address>(reinterpret_cast<intptr_t>(callback)); | 
| 7547   VMState<EXTERNAL> state(isolate); | 7552   VMState<EXTERNAL> state(isolate); | 
| 7548   ExternalCallbackScope call_scope(isolate, callback_address); | 7553   ExternalCallbackScope call_scope(isolate, callback_address); | 
| 7549   callback(info); | 7554   callback(info); | 
| 7550 } | 7555 } | 
| 7551 | 7556 | 
| 7552 | 7557 | 
| 7553 } }  // namespace v8::internal | 7558 } }  // namespace v8::internal | 
| OLD | NEW | 
|---|