Chromium Code Reviews| 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 671 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... | |
| 682 | 682 |
| 683 int HandleScope::NumberOfHandles() { | 683 int HandleScope::NumberOfHandles() { |
| 684 i::Isolate* isolate = i::Isolate::Current(); | 684 i::Isolate* isolate = i::Isolate::Current(); |
| 685 if (!EnsureInitializedForIsolate(isolate, "HandleScope::NumberOfHandles")) { | 685 if (!EnsureInitializedForIsolate(isolate, "HandleScope::NumberOfHandles")) { |
| 686 return 0; | 686 return 0; |
| 687 } | 687 } |
| 688 return i::HandleScope::NumberOfHandles(isolate); | 688 return i::HandleScope::NumberOfHandles(isolate); |
| 689 } | 689 } |
| 690 | 690 |
| 691 | 691 |
| 692 i::Object** HandleScope::CreateHandle(i::Object* value) { | |
| 693 return i::HandleScope::CreateHandle(i::Isolate::Current(), value); | |
| 694 } | |
| 695 | |
| 696 | |
| 697 i::Object** HandleScope::CreateHandle(i::Isolate* isolate, i::Object* value) { | 692 i::Object** HandleScope::CreateHandle(i::Isolate* isolate, i::Object* value) { |
| 698 ASSERT(isolate == i::Isolate::Current()); | |
| 699 return i::HandleScope::CreateHandle(isolate, value); | 693 return i::HandleScope::CreateHandle(isolate, value); |
| 700 } | 694 } |
| 701 | 695 |
| 702 | 696 |
| 703 i::Object** HandleScope::CreateHandle(i::HeapObject* value) { | 697 i::Object** HandleScope::CreateHandle(i::HeapObject* heap_object, |
| 704 ASSERT(value->IsHeapObject()); | 698 i::Object* value) { |
| 699 ASSERT(heap_object->IsHeapObject()); | |
| 705 return reinterpret_cast<i::Object**>( | 700 return reinterpret_cast<i::Object**>( |
|
Michael Starzinger
2013/09/26 10:58:31
nit: The reinterpret_cast here should be obsolete.
| |
| 706 i::HandleScope::CreateHandle(value->GetIsolate(), value)); | 701 i::HandleScope::CreateHandle(heap_object->GetIsolate(), value)); |
| 707 } | 702 } |
| 708 | 703 |
| 709 | 704 |
| 710 void Context::Enter() { | 705 void Context::Enter() { |
| 711 i::Handle<i::Context> env = Utils::OpenHandle(this); | 706 i::Handle<i::Context> env = Utils::OpenHandle(this); |
| 712 i::Isolate* isolate = env->GetIsolate(); | 707 i::Isolate* isolate = env->GetIsolate(); |
| 713 ENTER_V8(isolate); | 708 ENTER_V8(isolate); |
| 714 isolate->handle_scope_implementer()->EnterContext(env); | 709 isolate->handle_scope_implementer()->EnterContext(env); |
| 715 isolate->handle_scope_implementer()->SaveContext(isolate->context()); | 710 isolate->handle_scope_implementer()->SaveContext(isolate->context()); |
| 716 isolate->set_context(*env); | 711 isolate->set_context(*env); |
| (...skipping 1197 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... | |
| 1914 rethrow_(false), | 1909 rethrow_(false), |
| 1915 has_terminated_(false) { | 1910 has_terminated_(false) { |
| 1916 Reset(); | 1911 Reset(); |
| 1917 isolate_->RegisterTryCatchHandler(this); | 1912 isolate_->RegisterTryCatchHandler(this); |
| 1918 } | 1913 } |
| 1919 | 1914 |
| 1920 | 1915 |
| 1921 v8::TryCatch::~TryCatch() { | 1916 v8::TryCatch::~TryCatch() { |
| 1922 ASSERT(isolate_ == i::Isolate::Current()); | 1917 ASSERT(isolate_ == i::Isolate::Current()); |
| 1923 if (rethrow_) { | 1918 if (rethrow_) { |
| 1924 v8::HandleScope scope(reinterpret_cast<Isolate*>(isolate_)); | 1919 v8::Isolate* isolate = reinterpret_cast<Isolate*>(isolate_); |
| 1925 v8::Local<v8::Value> exc = v8::Local<v8::Value>::New(Exception()); | 1920 v8::HandleScope scope(isolate); |
| 1921 v8::Local<v8::Value> exc = v8::Local<v8::Value>::New(isolate, Exception()); | |
| 1926 if (HasCaught() && capture_message_) { | 1922 if (HasCaught() && capture_message_) { |
| 1927 // If an exception was caught and rethrow_ is indicated, the saved | 1923 // If an exception was caught and rethrow_ is indicated, the saved |
| 1928 // message, script, and location need to be restored to Isolate TLS | 1924 // message, script, and location need to be restored to Isolate TLS |
| 1929 // for reuse. capture_message_ needs to be disabled so that DoThrow() | 1925 // for reuse. capture_message_ needs to be disabled so that DoThrow() |
| 1930 // does not create a new message. | 1926 // does not create a new message. |
| 1931 isolate_->thread_local_top()->rethrowing_message_ = true; | 1927 isolate_->thread_local_top()->rethrowing_message_ = true; |
| 1932 isolate_->RestorePendingMessageFromTryCatch(this); | 1928 isolate_->RestorePendingMessageFromTryCatch(this); |
| 1933 } | 1929 } |
| 1934 isolate_->UnregisterTryCatchHandler(this); | 1930 isolate_->UnregisterTryCatchHandler(this); |
| 1935 reinterpret_cast<Isolate*>(isolate_)->ThrowException(exc); | 1931 reinterpret_cast<Isolate*>(isolate_)->ThrowException(exc); |
| (...skipping 5630 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... | |
| 7566 Isolate* isolate = reinterpret_cast<Isolate*>(info.GetIsolate()); | 7562 Isolate* isolate = reinterpret_cast<Isolate*>(info.GetIsolate()); |
| 7567 Address callback_address = | 7563 Address callback_address = |
| 7568 reinterpret_cast<Address>(reinterpret_cast<intptr_t>(callback)); | 7564 reinterpret_cast<Address>(reinterpret_cast<intptr_t>(callback)); |
| 7569 VMState<EXTERNAL> state(isolate); | 7565 VMState<EXTERNAL> state(isolate); |
| 7570 ExternalCallbackScope call_scope(isolate, callback_address); | 7566 ExternalCallbackScope call_scope(isolate, callback_address); |
| 7571 callback(info); | 7567 callback(info); |
| 7572 } | 7568 } |
| 7573 | 7569 |
| 7574 | 7570 |
| 7575 } } // namespace v8::internal | 7571 } } // namespace v8::internal |
| OLD | NEW |