| 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 454 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 465 void V8::SetFlagsFromString(const char* str, int length) { | 465 void V8::SetFlagsFromString(const char* str, int length) { |
| 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::Local<Value> ThrowException(v8::Isolate* v8_isolate, |
| 476 i::Isolate* isolate = i::Isolate::Current(); | 476 v8::Local<v8::Value> value) { |
| 477 i::Isolate* isolate = reinterpret_cast<i::Isolate*>(v8_isolate); |
| 477 ENTER_V8(isolate); | 478 ENTER_V8(isolate); |
| 478 // If we're passed an empty handle, we throw an undefined exception | 479 // If we're passed an empty handle, we throw an undefined exception |
| 479 // to deal more gracefully with out of memory situations. | 480 // to deal more gracefully with out of memory situations. |
| 480 if (value.IsEmpty()) { | 481 if (value.IsEmpty()) { |
| 481 isolate->ScheduleThrow(isolate->heap()->undefined_value()); | 482 isolate->ScheduleThrow(isolate->heap()->undefined_value()); |
| 482 } else { | 483 } else { |
| 483 isolate->ScheduleThrow(*Utils::OpenHandle(*value)); | 484 isolate->ScheduleThrow(*Utils::OpenHandle(*value)); |
| 484 } | 485 } |
| 485 return v8::Undefined(); | 486 return v8::Undefined(); |
| 486 } | 487 } |
| 487 | 488 |
| 488 | 489 |
| 490 v8::Handle<Value> ThrowException(v8::Handle<v8::Value> value) { |
| 491 return ThrowException(v8::Isolate::GetCurrent(), value); |
| 492 } |
| 493 |
| 494 |
| 489 RegisteredExtension* RegisteredExtension::first_extension_ = NULL; | 495 RegisteredExtension* RegisteredExtension::first_extension_ = NULL; |
| 490 | 496 |
| 491 | 497 |
| 492 RegisteredExtension::RegisteredExtension(Extension* extension) | 498 RegisteredExtension::RegisteredExtension(Extension* extension) |
| 493 : extension_(extension) { } | 499 : extension_(extension) { } |
| 494 | 500 |
| 495 | 501 |
| 496 void RegisteredExtension::Register(RegisteredExtension* that) { | 502 void RegisteredExtension::Register(RegisteredExtension* that) { |
| 497 that->next_ = first_extension_; | 503 that->next_ = first_extension_; |
| 498 first_extension_ = that; | 504 first_extension_ = that; |
| (...skipping 1420 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 1919 v8::Local<v8::Value> exc = v8::Local<v8::Value>::New(Exception()); | 1925 v8::Local<v8::Value> exc = v8::Local<v8::Value>::New(Exception()); |
| 1920 if (HasCaught() && capture_message_) { | 1926 if (HasCaught() && capture_message_) { |
| 1921 // If an exception was caught and rethrow_ is indicated, the saved | 1927 // If an exception was caught and rethrow_ is indicated, the saved |
| 1922 // message, script, and location need to be restored to Isolate TLS | 1928 // message, script, and location need to be restored to Isolate TLS |
| 1923 // for reuse. capture_message_ needs to be disabled so that DoThrow() | 1929 // for reuse. capture_message_ needs to be disabled so that DoThrow() |
| 1924 // does not create a new message. | 1930 // does not create a new message. |
| 1925 isolate_->thread_local_top()->rethrowing_message_ = true; | 1931 isolate_->thread_local_top()->rethrowing_message_ = true; |
| 1926 isolate_->RestorePendingMessageFromTryCatch(this); | 1932 isolate_->RestorePendingMessageFromTryCatch(this); |
| 1927 } | 1933 } |
| 1928 isolate_->UnregisterTryCatchHandler(this); | 1934 isolate_->UnregisterTryCatchHandler(this); |
| 1929 v8::ThrowException(exc); | 1935 v8::ThrowException(reinterpret_cast<Isolate*>(isolate_), exc); |
| 1930 ASSERT(!isolate_->thread_local_top()->rethrowing_message_); | 1936 ASSERT(!isolate_->thread_local_top()->rethrowing_message_); |
| 1931 } else { | 1937 } else { |
| 1932 isolate_->UnregisterTryCatchHandler(this); | 1938 isolate_->UnregisterTryCatchHandler(this); |
| 1933 } | 1939 } |
| 1934 } | 1940 } |
| 1935 | 1941 |
| 1936 | 1942 |
| 1937 bool v8::TryCatch::HasCaught() const { | 1943 bool v8::TryCatch::HasCaught() const { |
| 1938 return !reinterpret_cast<i::Object*>(exception_)->IsTheHole(); | 1944 return !reinterpret_cast<i::Object*>(exception_)->IsTheHole(); |
| 1939 } | 1945 } |
| (...skipping 5604 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 7544 Isolate* isolate = reinterpret_cast<Isolate*>(info.GetIsolate()); | 7550 Isolate* isolate = reinterpret_cast<Isolate*>(info.GetIsolate()); |
| 7545 Address callback_address = | 7551 Address callback_address = |
| 7546 reinterpret_cast<Address>(reinterpret_cast<intptr_t>(callback)); | 7552 reinterpret_cast<Address>(reinterpret_cast<intptr_t>(callback)); |
| 7547 VMState<EXTERNAL> state(isolate); | 7553 VMState<EXTERNAL> state(isolate); |
| 7548 ExternalCallbackScope call_scope(isolate, callback_address); | 7554 ExternalCallbackScope call_scope(isolate, callback_address); |
| 7549 callback(info); | 7555 callback(info); |
| 7550 } | 7556 } |
| 7551 | 7557 |
| 7552 | 7558 |
| 7553 } } // namespace v8::internal | 7559 } } // namespace v8::internal |
| OLD | NEW |