OLD | NEW |
1 // Copyright 2012 the V8 project authors. All rights reserved. | 1 // Copyright 2012 the V8 project authors. All rights reserved. |
2 // Use of this source code is governed by a BSD-style license that can be | 2 // Use of this source code is governed by a BSD-style license that can be |
3 // found in the LICENSE file. | 3 // found in the LICENSE file. |
4 | 4 |
5 #include "src/api.h" | 5 #include "src/api.h" |
6 | 6 |
7 #include <string.h> // For memcpy, strlen. | 7 #include <string.h> // For memcpy, strlen. |
8 #ifdef V8_USE_ADDRESS_SANITIZER | 8 #ifdef V8_USE_ADDRESS_SANITIZER |
9 #include <sanitizer/asan_interface.h> | 9 #include <sanitizer/asan_interface.h> |
10 #endif // V8_USE_ADDRESS_SANITIZER | 10 #endif // V8_USE_ADDRESS_SANITIZER |
(...skipping 712 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
723 DCHECK(offset < length()); | 723 DCHECK(offset < length()); |
724 return obj_.get(offset + 1); | 724 return obj_.get(offset + 1); |
725 } | 725 } |
726 | 726 |
727 | 727 |
728 // This method cannot easily return an error value, therefore it is necessary | 728 // This method cannot easily return an error value, therefore it is necessary |
729 // to check for a dead VM with ON_BAILOUT before calling it. To remind you | 729 // to check for a dead VM with ON_BAILOUT before calling it. To remind you |
730 // about this there is no HandleScope in this method. When you add one to the | 730 // about this there is no HandleScope in this method. When you add one to the |
731 // site calling this method you should check that you ensured the VM was not | 731 // site calling this method you should check that you ensured the VM was not |
732 // dead first. | 732 // dead first. |
733 void NeanderArray::add(i::Handle<i::Object> value) { | 733 void NeanderArray::add(i::Isolate* isolate, i::Handle<i::Object> value) { |
734 int length = this->length(); | 734 int length = this->length(); |
735 int size = obj_.size(); | 735 int size = obj_.size(); |
736 if (length == size - 1) { | 736 if (length == size - 1) { |
737 i::Factory* factory = i::Isolate::Current()->factory(); | 737 i::Factory* factory = isolate->factory(); |
738 i::Handle<i::FixedArray> new_elms = factory->NewFixedArray(2 * size); | 738 i::Handle<i::FixedArray> new_elms = factory->NewFixedArray(2 * size); |
739 for (int i = 0; i < length; i++) | 739 for (int i = 0; i < length; i++) |
740 new_elms->set(i + 1, get(i)); | 740 new_elms->set(i + 1, get(i)); |
741 obj_.value()->set_elements(*new_elms); | 741 obj_.value()->set_elements(*new_elms); |
742 } | 742 } |
743 obj_.set(length + 1, *value); | 743 obj_.set(length + 1, *value); |
744 obj_.set(0, i::Smi::FromInt(length + 1)); | 744 obj_.set(0, i::Smi::FromInt(length + 1)); |
745 } | 745 } |
746 | 746 |
747 | 747 |
(...skipping 14 matching lines...) Expand all Loading... |
762 static void TemplateSet(i::Isolate* isolate, | 762 static void TemplateSet(i::Isolate* isolate, |
763 v8::Template* templ, | 763 v8::Template* templ, |
764 int length, | 764 int length, |
765 v8::Handle<v8::Data>* data) { | 765 v8::Handle<v8::Data>* data) { |
766 i::Handle<i::Object> list(Utils::OpenHandle(templ)->property_list(), isolate); | 766 i::Handle<i::Object> list(Utils::OpenHandle(templ)->property_list(), isolate); |
767 if (list->IsUndefined()) { | 767 if (list->IsUndefined()) { |
768 list = NeanderArray(isolate).value(); | 768 list = NeanderArray(isolate).value(); |
769 Utils::OpenHandle(templ)->set_property_list(*list); | 769 Utils::OpenHandle(templ)->set_property_list(*list); |
770 } | 770 } |
771 NeanderArray array(list); | 771 NeanderArray array(list); |
772 array.add(isolate->factory()->NewNumberFromInt(length)); | 772 array.add(isolate, isolate->factory()->NewNumberFromInt(length)); |
773 for (int i = 0; i < length; i++) { | 773 for (int i = 0; i < length; i++) { |
774 i::Handle<i::Object> value = data[i].IsEmpty() ? | 774 i::Handle<i::Object> value = data[i].IsEmpty() ? |
775 i::Handle<i::Object>(isolate->factory()->undefined_value()) : | 775 i::Handle<i::Object>(isolate->factory()->undefined_value()) : |
776 Utils::OpenHandle(*data[i]); | 776 Utils::OpenHandle(*data[i]); |
777 array.add(value); | 777 array.add(isolate, value); |
778 } | 778 } |
779 } | 779 } |
780 | 780 |
781 | 781 |
782 void Template::Set(v8::Handle<Name> name, | 782 void Template::Set(v8::Handle<Name> name, |
783 v8::Handle<Data> value, | 783 v8::Handle<Data> value, |
784 v8::PropertyAttribute attribute) { | 784 v8::PropertyAttribute attribute) { |
785 i::Isolate* isolate = i::Isolate::Current(); | 785 i::Isolate* isolate = Utils::OpenHandle(this)->GetIsolate(); |
786 ENTER_V8(isolate); | 786 ENTER_V8(isolate); |
787 i::HandleScope scope(isolate); | 787 i::HandleScope scope(isolate); |
788 const int kSize = 3; | 788 const int kSize = 3; |
789 v8::Isolate* v8_isolate = reinterpret_cast<v8::Isolate*>(isolate); | 789 v8::Isolate* v8_isolate = reinterpret_cast<v8::Isolate*>(isolate); |
790 v8::Handle<v8::Data> data[kSize] = { | 790 v8::Handle<v8::Data> data[kSize] = { |
791 name, | 791 name, |
792 value, | 792 value, |
793 v8::Integer::New(v8_isolate, attribute)}; | 793 v8::Integer::New(v8_isolate, attribute)}; |
794 TemplateSet(isolate, this, kSize, data); | 794 TemplateSet(isolate, this, kSize, data); |
795 } | 795 } |
(...skipping 261 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
1057 i::Handle<i::Struct> struct_obj = | 1057 i::Handle<i::Struct> struct_obj = |
1058 isolate->factory()->NewStruct(i::TYPE_SWITCH_INFO_TYPE); | 1058 isolate->factory()->NewStruct(i::TYPE_SWITCH_INFO_TYPE); |
1059 i::Handle<i::TypeSwitchInfo> obj = | 1059 i::Handle<i::TypeSwitchInfo> obj = |
1060 i::Handle<i::TypeSwitchInfo>::cast(struct_obj); | 1060 i::Handle<i::TypeSwitchInfo>::cast(struct_obj); |
1061 obj->set_types(*vector); | 1061 obj->set_types(*vector); |
1062 return Utils::ToLocal(obj); | 1062 return Utils::ToLocal(obj); |
1063 } | 1063 } |
1064 | 1064 |
1065 | 1065 |
1066 int TypeSwitch::match(v8::Handle<Value> value) { | 1066 int TypeSwitch::match(v8::Handle<Value> value) { |
1067 i::Isolate* isolate = i::Isolate::Current(); | 1067 i::Handle<i::TypeSwitchInfo> info = Utils::OpenHandle(this); |
1068 LOG_API(isolate, "TypeSwitch::match"); | 1068 LOG_API(info->GetIsolate(), "TypeSwitch::match"); |
1069 USE(isolate); | |
1070 i::Handle<i::Object> obj = Utils::OpenHandle(*value); | 1069 i::Handle<i::Object> obj = Utils::OpenHandle(*value); |
1071 i::Handle<i::TypeSwitchInfo> info = Utils::OpenHandle(this); | |
1072 i::FixedArray* types = i::FixedArray::cast(info->types()); | 1070 i::FixedArray* types = i::FixedArray::cast(info->types()); |
1073 for (int i = 0; i < types->length(); i++) { | 1071 for (int i = 0; i < types->length(); i++) { |
1074 if (i::FunctionTemplateInfo::cast(types->get(i))->IsTemplateFor(*obj)) | 1072 if (i::FunctionTemplateInfo::cast(types->get(i))->IsTemplateFor(*obj)) |
1075 return i + 1; | 1073 return i + 1; |
1076 } | 1074 } |
1077 return 0; | 1075 return 0; |
1078 } | 1076 } |
1079 | 1077 |
1080 | 1078 |
1081 #define SET_FIELD_WRAPPED(obj, setter, cdata) do { \ | 1079 #define SET_FIELD_WRAPPED(obj, setter, cdata) do { \ |
(...skipping 183 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
1265 static inline void AddPropertyToTemplate( | 1263 static inline void AddPropertyToTemplate( |
1266 i::Handle<i::TemplateInfo> info, | 1264 i::Handle<i::TemplateInfo> info, |
1267 i::Handle<i::AccessorInfo> obj) { | 1265 i::Handle<i::AccessorInfo> obj) { |
1268 i::Isolate* isolate = info->GetIsolate(); | 1266 i::Isolate* isolate = info->GetIsolate(); |
1269 i::Handle<i::Object> list(info->property_accessors(), isolate); | 1267 i::Handle<i::Object> list(info->property_accessors(), isolate); |
1270 if (list->IsUndefined()) { | 1268 if (list->IsUndefined()) { |
1271 list = NeanderArray(isolate).value(); | 1269 list = NeanderArray(isolate).value(); |
1272 info->set_property_accessors(*list); | 1270 info->set_property_accessors(*list); |
1273 } | 1271 } |
1274 NeanderArray array(list); | 1272 NeanderArray array(list); |
1275 array.add(obj); | 1273 array.add(isolate, obj); |
1276 } | 1274 } |
1277 | 1275 |
1278 | 1276 |
1279 static inline i::Handle<i::TemplateInfo> GetTemplateInfo( | 1277 static inline i::Handle<i::TemplateInfo> GetTemplateInfo( |
1280 i::Isolate* isolate, | 1278 i::Isolate* isolate, |
1281 Template* template_obj) { | 1279 Template* template_obj) { |
1282 return Utils::OpenHandle(template_obj); | 1280 return Utils::OpenHandle(template_obj); |
1283 } | 1281 } |
1284 | 1282 |
1285 | 1283 |
(...skipping 607 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
1893 has_terminated_(false) { | 1891 has_terminated_(false) { |
1894 ResetInternal(); | 1892 ResetInternal(); |
1895 // Special handling for simulators which have a separate JS stack. | 1893 // Special handling for simulators which have a separate JS stack. |
1896 js_stack_comparable_address_ = | 1894 js_stack_comparable_address_ = |
1897 reinterpret_cast<void*>(v8::internal::SimulatorStack::RegisterCTryCatch( | 1895 reinterpret_cast<void*>(v8::internal::SimulatorStack::RegisterCTryCatch( |
1898 v8::internal::GetCurrentStackPosition())); | 1896 v8::internal::GetCurrentStackPosition())); |
1899 isolate_->RegisterTryCatchHandler(this); | 1897 isolate_->RegisterTryCatchHandler(this); |
1900 } | 1898 } |
1901 | 1899 |
1902 | 1900 |
| 1901 v8::TryCatch::TryCatch(v8::Isolate* isolate) |
| 1902 : isolate_(reinterpret_cast<i::Isolate*>(isolate)), |
| 1903 next_(isolate_->try_catch_handler()), |
| 1904 is_verbose_(false), |
| 1905 can_continue_(true), |
| 1906 capture_message_(true), |
| 1907 rethrow_(false), |
| 1908 has_terminated_(false) { |
| 1909 ResetInternal(); |
| 1910 // Special handling for simulators which have a separate JS stack. |
| 1911 js_stack_comparable_address_ = |
| 1912 reinterpret_cast<void*>(v8::internal::SimulatorStack::RegisterCTryCatch( |
| 1913 v8::internal::GetCurrentStackPosition())); |
| 1914 isolate_->RegisterTryCatchHandler(this); |
| 1915 } |
| 1916 |
| 1917 |
1903 v8::TryCatch::~TryCatch() { | 1918 v8::TryCatch::~TryCatch() { |
1904 DCHECK(isolate_ == i::Isolate::Current()); | |
1905 if (rethrow_) { | 1919 if (rethrow_) { |
1906 v8::Isolate* isolate = reinterpret_cast<Isolate*>(isolate_); | 1920 v8::Isolate* isolate = reinterpret_cast<Isolate*>(isolate_); |
1907 v8::HandleScope scope(isolate); | 1921 v8::HandleScope scope(isolate); |
1908 v8::Local<v8::Value> exc = v8::Local<v8::Value>::New(isolate, Exception()); | 1922 v8::Local<v8::Value> exc = v8::Local<v8::Value>::New(isolate, Exception()); |
1909 if (HasCaught() && capture_message_) { | 1923 if (HasCaught() && capture_message_) { |
1910 // If an exception was caught and rethrow_ is indicated, the saved | 1924 // If an exception was caught and rethrow_ is indicated, the saved |
1911 // message, script, and location need to be restored to Isolate TLS | 1925 // message, script, and location need to be restored to Isolate TLS |
1912 // for reuse. capture_message_ needs to be disabled so that DoThrow() | 1926 // for reuse. capture_message_ needs to be disabled so that DoThrow() |
1913 // does not create a new message. | 1927 // does not create a new message. |
1914 isolate_->thread_local_top()->rethrowing_message_ = true; | 1928 isolate_->thread_local_top()->rethrowing_message_ = true; |
(...skipping 32 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
1947 | 1961 |
1948 | 1962 |
1949 v8::Handle<v8::Value> v8::TryCatch::ReThrow() { | 1963 v8::Handle<v8::Value> v8::TryCatch::ReThrow() { |
1950 if (!HasCaught()) return v8::Local<v8::Value>(); | 1964 if (!HasCaught()) return v8::Local<v8::Value>(); |
1951 rethrow_ = true; | 1965 rethrow_ = true; |
1952 return v8::Undefined(reinterpret_cast<v8::Isolate*>(isolate_)); | 1966 return v8::Undefined(reinterpret_cast<v8::Isolate*>(isolate_)); |
1953 } | 1967 } |
1954 | 1968 |
1955 | 1969 |
1956 v8::Local<Value> v8::TryCatch::Exception() const { | 1970 v8::Local<Value> v8::TryCatch::Exception() const { |
1957 DCHECK(isolate_ == i::Isolate::Current()); | |
1958 if (HasCaught()) { | 1971 if (HasCaught()) { |
1959 // Check for out of memory exception. | 1972 // Check for out of memory exception. |
1960 i::Object* exception = reinterpret_cast<i::Object*>(exception_); | 1973 i::Object* exception = reinterpret_cast<i::Object*>(exception_); |
1961 return v8::Utils::ToLocal(i::Handle<i::Object>(exception, isolate_)); | 1974 return v8::Utils::ToLocal(i::Handle<i::Object>(exception, isolate_)); |
1962 } else { | 1975 } else { |
1963 return v8::Local<Value>(); | 1976 return v8::Local<Value>(); |
1964 } | 1977 } |
1965 } | 1978 } |
1966 | 1979 |
1967 | 1980 |
1968 v8::Local<Value> v8::TryCatch::StackTrace() const { | 1981 v8::Local<Value> v8::TryCatch::StackTrace() const { |
1969 DCHECK(isolate_ == i::Isolate::Current()); | |
1970 if (HasCaught()) { | 1982 if (HasCaught()) { |
1971 i::Object* raw_obj = reinterpret_cast<i::Object*>(exception_); | 1983 i::Object* raw_obj = reinterpret_cast<i::Object*>(exception_); |
1972 if (!raw_obj->IsJSObject()) return v8::Local<Value>(); | 1984 if (!raw_obj->IsJSObject()) return v8::Local<Value>(); |
1973 i::HandleScope scope(isolate_); | 1985 i::HandleScope scope(isolate_); |
1974 i::Handle<i::JSObject> obj(i::JSObject::cast(raw_obj), isolate_); | 1986 i::Handle<i::JSObject> obj(i::JSObject::cast(raw_obj), isolate_); |
1975 i::Handle<i::String> name = isolate_->factory()->stack_string(); | 1987 i::Handle<i::String> name = isolate_->factory()->stack_string(); |
1976 EXCEPTION_PREAMBLE(isolate_); | 1988 EXCEPTION_PREAMBLE(isolate_); |
1977 Maybe<bool> maybe = i::JSReceiver::HasProperty(obj, name); | 1989 Maybe<bool> maybe = i::JSReceiver::HasProperty(obj, name); |
1978 has_pending_exception = !maybe.has_value; | 1990 has_pending_exception = !maybe.has_value; |
1979 EXCEPTION_BAILOUT_CHECK(isolate_, v8::Local<Value>()); | 1991 EXCEPTION_BAILOUT_CHECK(isolate_, v8::Local<Value>()); |
1980 if (!maybe.value) return v8::Local<Value>(); | 1992 if (!maybe.value) return v8::Local<Value>(); |
1981 i::Handle<i::Object> value; | 1993 i::Handle<i::Object> value; |
1982 if (!i::Object::GetProperty(obj, name).ToHandle(&value)) { | 1994 if (!i::Object::GetProperty(obj, name).ToHandle(&value)) { |
1983 return v8::Local<Value>(); | 1995 return v8::Local<Value>(); |
1984 } | 1996 } |
1985 return v8::Utils::ToLocal(scope.CloseAndEscape(value)); | 1997 return v8::Utils::ToLocal(scope.CloseAndEscape(value)); |
1986 } else { | 1998 } else { |
1987 return v8::Local<Value>(); | 1999 return v8::Local<Value>(); |
1988 } | 2000 } |
1989 } | 2001 } |
1990 | 2002 |
1991 | 2003 |
1992 v8::Local<v8::Message> v8::TryCatch::Message() const { | 2004 v8::Local<v8::Message> v8::TryCatch::Message() const { |
1993 DCHECK(isolate_ == i::Isolate::Current()); | |
1994 i::Object* message = reinterpret_cast<i::Object*>(message_obj_); | 2005 i::Object* message = reinterpret_cast<i::Object*>(message_obj_); |
1995 DCHECK(message->IsJSMessageObject() || message->IsTheHole()); | 2006 DCHECK(message->IsJSMessageObject() || message->IsTheHole()); |
1996 if (HasCaught() && !message->IsTheHole()) { | 2007 if (HasCaught() && !message->IsTheHole()) { |
1997 return v8::Utils::MessageToLocal(i::Handle<i::Object>(message, isolate_)); | 2008 return v8::Utils::MessageToLocal(i::Handle<i::Object>(message, isolate_)); |
1998 } else { | 2009 } else { |
1999 return v8::Local<v8::Message>(); | 2010 return v8::Local<v8::Message>(); |
2000 } | 2011 } |
2001 } | 2012 } |
2002 | 2013 |
2003 | 2014 |
2004 void v8::TryCatch::Reset() { | 2015 void v8::TryCatch::Reset() { |
2005 DCHECK(isolate_ == i::Isolate::Current()); | |
2006 if (!rethrow_ && HasCaught() && isolate_->has_scheduled_exception()) { | 2016 if (!rethrow_ && HasCaught() && isolate_->has_scheduled_exception()) { |
2007 // If an exception was caught but is still scheduled because no API call | 2017 // If an exception was caught but is still scheduled because no API call |
2008 // promoted it, then it is canceled to prevent it from being propagated. | 2018 // promoted it, then it is canceled to prevent it from being propagated. |
2009 // Note that this will not cancel termination exceptions. | 2019 // Note that this will not cancel termination exceptions. |
2010 isolate_->CancelScheduledExceptionFromTryCatch(this); | 2020 isolate_->CancelScheduledExceptionFromTryCatch(this); |
2011 } | 2021 } |
2012 ResetInternal(); | 2022 ResetInternal(); |
2013 } | 2023 } |
2014 | 2024 |
2015 | 2025 |
(...skipping 67 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
2083 i::Handle<i::JSMessageObject>::cast(Utils::OpenHandle(this)); | 2093 i::Handle<i::JSMessageObject>::cast(Utils::OpenHandle(this)); |
2084 i::Handle<i::Object> stackFramesObj(message->stack_frames(), isolate); | 2094 i::Handle<i::Object> stackFramesObj(message->stack_frames(), isolate); |
2085 if (!stackFramesObj->IsJSArray()) return v8::Handle<v8::StackTrace>(); | 2095 if (!stackFramesObj->IsJSArray()) return v8::Handle<v8::StackTrace>(); |
2086 i::Handle<i::JSArray> stackTrace = | 2096 i::Handle<i::JSArray> stackTrace = |
2087 i::Handle<i::JSArray>::cast(stackFramesObj); | 2097 i::Handle<i::JSArray>::cast(stackFramesObj); |
2088 return scope.Escape(Utils::StackTraceToLocal(stackTrace)); | 2098 return scope.Escape(Utils::StackTraceToLocal(stackTrace)); |
2089 } | 2099 } |
2090 | 2100 |
2091 | 2101 |
2092 MUST_USE_RESULT static i::MaybeHandle<i::Object> CallV8HeapFunction( | 2102 MUST_USE_RESULT static i::MaybeHandle<i::Object> CallV8HeapFunction( |
2093 const char* name, | 2103 i::Isolate* isolate, const char* name, i::Handle<i::Object> recv, int argc, |
2094 i::Handle<i::Object> recv, | |
2095 int argc, | |
2096 i::Handle<i::Object> argv[]) { | 2104 i::Handle<i::Object> argv[]) { |
2097 i::Isolate* isolate = i::Isolate::Current(); | |
2098 i::Handle<i::Object> object_fun = | 2105 i::Handle<i::Object> object_fun = |
2099 i::Object::GetProperty( | 2106 i::Object::GetProperty( |
2100 isolate, isolate->js_builtins_object(), name).ToHandleChecked(); | 2107 isolate, isolate->js_builtins_object(), name).ToHandleChecked(); |
2101 i::Handle<i::JSFunction> fun = i::Handle<i::JSFunction>::cast(object_fun); | 2108 i::Handle<i::JSFunction> fun = i::Handle<i::JSFunction>::cast(object_fun); |
2102 return i::Execution::Call(isolate, fun, recv, argc, argv); | 2109 return i::Execution::Call(isolate, fun, recv, argc, argv); |
2103 } | 2110 } |
2104 | 2111 |
2105 | 2112 |
2106 MUST_USE_RESULT static i::MaybeHandle<i::Object> CallV8HeapFunction( | 2113 MUST_USE_RESULT static i::MaybeHandle<i::Object> CallV8HeapFunction( |
2107 const char* name, | 2114 i::Isolate* isolate, const char* name, i::Handle<i::Object> data) { |
2108 i::Handle<i::Object> data) { | |
2109 i::Handle<i::Object> argv[] = { data }; | 2115 i::Handle<i::Object> argv[] = { data }; |
2110 return CallV8HeapFunction(name, | 2116 return CallV8HeapFunction(isolate, name, isolate->js_builtins_object(), |
2111 i::Isolate::Current()->js_builtins_object(), | 2117 arraysize(argv), argv); |
2112 arraysize(argv), | |
2113 argv); | |
2114 } | 2118 } |
2115 | 2119 |
2116 | 2120 |
2117 int Message::GetLineNumber() const { | 2121 int Message::GetLineNumber() const { |
2118 i::Isolate* isolate = Utils::OpenHandle(this)->GetIsolate(); | 2122 i::Isolate* isolate = Utils::OpenHandle(this)->GetIsolate(); |
2119 ON_BAILOUT(isolate, "v8::Message::GetLineNumber()", return kNoLineNumberInfo); | 2123 ON_BAILOUT(isolate, "v8::Message::GetLineNumber()", return kNoLineNumberInfo); |
2120 ENTER_V8(isolate); | 2124 ENTER_V8(isolate); |
2121 i::HandleScope scope(isolate); | 2125 i::HandleScope scope(isolate); |
2122 | 2126 |
2123 EXCEPTION_PREAMBLE(isolate); | 2127 EXCEPTION_PREAMBLE(isolate); |
2124 i::Handle<i::Object> result; | 2128 i::Handle<i::Object> result; |
2125 has_pending_exception = !CallV8HeapFunction( | 2129 has_pending_exception = |
2126 "GetLineNumber", Utils::OpenHandle(this)).ToHandle(&result); | 2130 !CallV8HeapFunction(isolate, "GetLineNumber", Utils::OpenHandle(this)) |
| 2131 .ToHandle(&result); |
2127 EXCEPTION_BAILOUT_CHECK(isolate, 0); | 2132 EXCEPTION_BAILOUT_CHECK(isolate, 0); |
2128 return static_cast<int>(result->Number()); | 2133 return static_cast<int>(result->Number()); |
2129 } | 2134 } |
2130 | 2135 |
2131 | 2136 |
2132 int Message::GetStartPosition() const { | 2137 int Message::GetStartPosition() const { |
2133 i::Isolate* isolate = Utils::OpenHandle(this)->GetIsolate(); | 2138 i::Isolate* isolate = Utils::OpenHandle(this)->GetIsolate(); |
2134 ENTER_V8(isolate); | 2139 ENTER_V8(isolate); |
2135 i::HandleScope scope(isolate); | 2140 i::HandleScope scope(isolate); |
2136 i::Handle<i::JSMessageObject> message = | 2141 i::Handle<i::JSMessageObject> message = |
(...skipping 13 matching lines...) Expand all Loading... |
2150 | 2155 |
2151 | 2156 |
2152 int Message::GetStartColumn() const { | 2157 int Message::GetStartColumn() const { |
2153 i::Isolate* isolate = Utils::OpenHandle(this)->GetIsolate(); | 2158 i::Isolate* isolate = Utils::OpenHandle(this)->GetIsolate(); |
2154 ON_BAILOUT(isolate, "v8::Message::GetStartColumn()", return kNoColumnInfo); | 2159 ON_BAILOUT(isolate, "v8::Message::GetStartColumn()", return kNoColumnInfo); |
2155 ENTER_V8(isolate); | 2160 ENTER_V8(isolate); |
2156 i::HandleScope scope(isolate); | 2161 i::HandleScope scope(isolate); |
2157 i::Handle<i::JSObject> data_obj = Utils::OpenHandle(this); | 2162 i::Handle<i::JSObject> data_obj = Utils::OpenHandle(this); |
2158 EXCEPTION_PREAMBLE(isolate); | 2163 EXCEPTION_PREAMBLE(isolate); |
2159 i::Handle<i::Object> start_col_obj; | 2164 i::Handle<i::Object> start_col_obj; |
2160 has_pending_exception = !CallV8HeapFunction( | 2165 has_pending_exception = |
2161 "GetPositionInLine", data_obj).ToHandle(&start_col_obj); | 2166 !CallV8HeapFunction(isolate, "GetPositionInLine", data_obj) |
| 2167 .ToHandle(&start_col_obj); |
2162 EXCEPTION_BAILOUT_CHECK(isolate, 0); | 2168 EXCEPTION_BAILOUT_CHECK(isolate, 0); |
2163 return static_cast<int>(start_col_obj->Number()); | 2169 return static_cast<int>(start_col_obj->Number()); |
2164 } | 2170 } |
2165 | 2171 |
2166 | 2172 |
2167 int Message::GetEndColumn() const { | 2173 int Message::GetEndColumn() const { |
2168 i::Isolate* isolate = Utils::OpenHandle(this)->GetIsolate(); | 2174 i::Isolate* isolate = Utils::OpenHandle(this)->GetIsolate(); |
2169 ON_BAILOUT(isolate, "v8::Message::GetEndColumn()", return kNoColumnInfo); | 2175 ON_BAILOUT(isolate, "v8::Message::GetEndColumn()", return kNoColumnInfo); |
2170 ENTER_V8(isolate); | 2176 ENTER_V8(isolate); |
2171 i::HandleScope scope(isolate); | 2177 i::HandleScope scope(isolate); |
2172 i::Handle<i::JSObject> data_obj = Utils::OpenHandle(this); | 2178 i::Handle<i::JSObject> data_obj = Utils::OpenHandle(this); |
2173 EXCEPTION_PREAMBLE(isolate); | 2179 EXCEPTION_PREAMBLE(isolate); |
2174 i::Handle<i::Object> start_col_obj; | 2180 i::Handle<i::Object> start_col_obj; |
2175 has_pending_exception = !CallV8HeapFunction( | 2181 has_pending_exception = |
2176 "GetPositionInLine", data_obj).ToHandle(&start_col_obj); | 2182 !CallV8HeapFunction(isolate, "GetPositionInLine", data_obj) |
| 2183 .ToHandle(&start_col_obj); |
2177 EXCEPTION_BAILOUT_CHECK(isolate, 0); | 2184 EXCEPTION_BAILOUT_CHECK(isolate, 0); |
2178 i::Handle<i::JSMessageObject> message = | 2185 i::Handle<i::JSMessageObject> message = |
2179 i::Handle<i::JSMessageObject>::cast(data_obj); | 2186 i::Handle<i::JSMessageObject>::cast(data_obj); |
2180 int start = message->start_position(); | 2187 int start = message->start_position(); |
2181 int end = message->end_position(); | 2188 int end = message->end_position(); |
2182 return static_cast<int>(start_col_obj->Number()) + (end - start); | 2189 return static_cast<int>(start_col_obj->Number()) + (end - start); |
2183 } | 2190 } |
2184 | 2191 |
2185 | 2192 |
2186 bool Message::IsSharedCrossOrigin() const { | 2193 bool Message::IsSharedCrossOrigin() const { |
2187 i::Isolate* isolate = Utils::OpenHandle(this)->GetIsolate(); | 2194 i::Isolate* isolate = Utils::OpenHandle(this)->GetIsolate(); |
2188 ENTER_V8(isolate); | 2195 ENTER_V8(isolate); |
2189 i::HandleScope scope(isolate); | 2196 i::HandleScope scope(isolate); |
2190 i::Handle<i::JSMessageObject> message = | 2197 i::Handle<i::JSMessageObject> message = |
2191 i::Handle<i::JSMessageObject>::cast(Utils::OpenHandle(this)); | 2198 i::Handle<i::JSMessageObject>::cast(Utils::OpenHandle(this)); |
2192 i::Handle<i::JSValue> script = | 2199 i::Handle<i::JSValue> script = |
2193 i::Handle<i::JSValue>::cast(i::Handle<i::Object>(message->script(), | 2200 i::Handle<i::JSValue>::cast(i::Handle<i::Object>(message->script(), |
2194 isolate)); | 2201 isolate)); |
2195 return i::Script::cast(script->value())->is_shared_cross_origin(); | 2202 return i::Script::cast(script->value())->is_shared_cross_origin(); |
2196 } | 2203 } |
2197 | 2204 |
2198 | 2205 |
2199 Local<String> Message::GetSourceLine() const { | 2206 Local<String> Message::GetSourceLine() const { |
2200 i::Isolate* isolate = Utils::OpenHandle(this)->GetIsolate(); | 2207 i::Isolate* isolate = Utils::OpenHandle(this)->GetIsolate(); |
2201 ON_BAILOUT(isolate, "v8::Message::GetSourceLine()", return Local<String>()); | 2208 ON_BAILOUT(isolate, "v8::Message::GetSourceLine()", return Local<String>()); |
2202 ENTER_V8(isolate); | 2209 ENTER_V8(isolate); |
2203 EscapableHandleScope scope(reinterpret_cast<Isolate*>(isolate)); | 2210 EscapableHandleScope scope(reinterpret_cast<Isolate*>(isolate)); |
2204 EXCEPTION_PREAMBLE(isolate); | 2211 EXCEPTION_PREAMBLE(isolate); |
2205 i::Handle<i::Object> result; | 2212 i::Handle<i::Object> result; |
2206 has_pending_exception = !CallV8HeapFunction( | 2213 has_pending_exception = |
2207 "GetSourceLine", Utils::OpenHandle(this)).ToHandle(&result); | 2214 !CallV8HeapFunction(isolate, "GetSourceLine", Utils::OpenHandle(this)) |
| 2215 .ToHandle(&result); |
2208 EXCEPTION_BAILOUT_CHECK(isolate, Local<v8::String>()); | 2216 EXCEPTION_BAILOUT_CHECK(isolate, Local<v8::String>()); |
2209 if (result->IsString()) { | 2217 if (result->IsString()) { |
2210 return scope.Escape(Utils::ToLocal(i::Handle<i::String>::cast(result))); | 2218 return scope.Escape(Utils::ToLocal(i::Handle<i::String>::cast(result))); |
2211 } else { | 2219 } else { |
2212 return Local<String>(); | 2220 return Local<String>(); |
2213 } | 2221 } |
2214 } | 2222 } |
2215 | 2223 |
2216 | 2224 |
2217 void Message::PrintCurrentStackTrace(Isolate* isolate, FILE* out) { | 2225 void Message::PrintCurrentStackTrace(Isolate* isolate, FILE* out) { |
(...skipping 796 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
3014 i::Handle<i::Object> other = Utils::OpenHandle(*that); | 3022 i::Handle<i::Object> other = Utils::OpenHandle(*that); |
3015 // If both obj and other are JSObjects, we'd better compare by identity | 3023 // If both obj and other are JSObjects, we'd better compare by identity |
3016 // immediately when going into JS builtin. The reason is Invoke | 3024 // immediately when going into JS builtin. The reason is Invoke |
3017 // would overwrite global object receiver with global proxy. | 3025 // would overwrite global object receiver with global proxy. |
3018 if (obj->IsJSObject() && other->IsJSObject()) { | 3026 if (obj->IsJSObject() && other->IsJSObject()) { |
3019 return *obj == *other; | 3027 return *obj == *other; |
3020 } | 3028 } |
3021 i::Handle<i::Object> args[] = { other }; | 3029 i::Handle<i::Object> args[] = { other }; |
3022 EXCEPTION_PREAMBLE(isolate); | 3030 EXCEPTION_PREAMBLE(isolate); |
3023 i::Handle<i::Object> result; | 3031 i::Handle<i::Object> result; |
3024 has_pending_exception = !CallV8HeapFunction( | 3032 has_pending_exception = |
3025 "EQUALS", obj, arraysize(args), args).ToHandle(&result); | 3033 !CallV8HeapFunction(isolate, "EQUALS", obj, arraysize(args), args) |
| 3034 .ToHandle(&result); |
3026 EXCEPTION_BAILOUT_CHECK(isolate, false); | 3035 EXCEPTION_BAILOUT_CHECK(isolate, false); |
3027 return *result == i::Smi::FromInt(i::EQUAL); | 3036 return *result == i::Smi::FromInt(i::EQUAL); |
3028 } | 3037 } |
3029 | 3038 |
3030 | 3039 |
3031 bool Value::StrictEquals(Handle<Value> that) const { | 3040 bool Value::StrictEquals(Handle<Value> that) const { |
3032 i::Isolate* isolate = i::Isolate::Current(); | 3041 i::Isolate* isolate = i::Isolate::Current(); |
3033 i::Handle<i::Object> obj = Utils::OpenHandle(this, true); | 3042 i::Handle<i::Object> obj = Utils::OpenHandle(this, true); |
3034 if (!Utils::ApiCheck(!obj.is_null() && !that.IsEmpty(), | 3043 if (!Utils::ApiCheck(!obj.is_null() && !that.IsEmpty(), |
3035 "v8::Value::StrictEquals()", | 3044 "v8::Value::StrictEquals()", |
(...skipping 244 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
3280 Local<Value> v8::Object::GetOwnPropertyDescriptor(Local<String> key) { | 3289 Local<Value> v8::Object::GetOwnPropertyDescriptor(Local<String> key) { |
3281 i::Isolate* isolate = Utils::OpenHandle(this)->GetIsolate(); | 3290 i::Isolate* isolate = Utils::OpenHandle(this)->GetIsolate(); |
3282 ON_BAILOUT(isolate, "v8::Object::GetOwnPropertyDescriptor()", | 3291 ON_BAILOUT(isolate, "v8::Object::GetOwnPropertyDescriptor()", |
3283 return Local<Value>()); | 3292 return Local<Value>()); |
3284 ENTER_V8(isolate); | 3293 ENTER_V8(isolate); |
3285 i::Handle<i::JSObject> obj = Utils::OpenHandle(this); | 3294 i::Handle<i::JSObject> obj = Utils::OpenHandle(this); |
3286 i::Handle<i::Name> key_name = Utils::OpenHandle(*key); | 3295 i::Handle<i::Name> key_name = Utils::OpenHandle(*key); |
3287 i::Handle<i::Object> args[] = { obj, key_name }; | 3296 i::Handle<i::Object> args[] = { obj, key_name }; |
3288 EXCEPTION_PREAMBLE(isolate); | 3297 EXCEPTION_PREAMBLE(isolate); |
3289 i::Handle<i::Object> result; | 3298 i::Handle<i::Object> result; |
3290 has_pending_exception = !CallV8HeapFunction( | 3299 has_pending_exception = |
3291 "ObjectGetOwnPropertyDescriptor", | 3300 !CallV8HeapFunction(isolate, "ObjectGetOwnPropertyDescriptor", |
3292 isolate->factory()->undefined_value(), | 3301 isolate->factory()->undefined_value(), |
3293 arraysize(args), | 3302 arraysize(args), args).ToHandle(&result); |
3294 args).ToHandle(&result); | |
3295 EXCEPTION_BAILOUT_CHECK(isolate, Local<Value>()); | 3303 EXCEPTION_BAILOUT_CHECK(isolate, Local<Value>()); |
3296 return Utils::ToLocal(result); | 3304 return Utils::ToLocal(result); |
3297 } | 3305 } |
3298 | 3306 |
3299 | 3307 |
3300 Local<Value> v8::Object::GetPrototype() { | 3308 Local<Value> v8::Object::GetPrototype() { |
3301 i::Isolate* isolate = Utils::OpenHandle(this)->GetIsolate(); | 3309 i::Isolate* isolate = Utils::OpenHandle(this)->GetIsolate(); |
3302 ON_BAILOUT(isolate, "v8::Object::GetPrototype()", return Local<v8::Value>()); | 3310 ON_BAILOUT(isolate, "v8::Object::GetPrototype()", return Local<v8::Value>()); |
3303 ENTER_V8(isolate); | 3311 ENTER_V8(isolate); |
3304 i::Handle<i::Object> self = Utils::OpenHandle(this); | 3312 i::Handle<i::Object> self = Utils::OpenHandle(this); |
(...skipping 1955 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
5260 ExtensionConfiguration no_extensions; | 5268 ExtensionConfiguration no_extensions; |
5261 if (extensions == NULL) extensions = &no_extensions; | 5269 if (extensions == NULL) extensions = &no_extensions; |
5262 i::Handle<i::Context> env = | 5270 i::Handle<i::Context> env = |
5263 CreateEnvironment(isolate, extensions, global_template, global_object); | 5271 CreateEnvironment(isolate, extensions, global_template, global_object); |
5264 if (env.is_null()) return Local<Context>(); | 5272 if (env.is_null()) return Local<Context>(); |
5265 return Utils::ToLocal(scope.CloseAndEscape(env)); | 5273 return Utils::ToLocal(scope.CloseAndEscape(env)); |
5266 } | 5274 } |
5267 | 5275 |
5268 | 5276 |
5269 void v8::Context::SetSecurityToken(Handle<Value> token) { | 5277 void v8::Context::SetSecurityToken(Handle<Value> token) { |
5270 i::Isolate* isolate = i::Isolate::Current(); | 5278 i::Handle<i::Context> env = Utils::OpenHandle(this); |
| 5279 i::Isolate* isolate = env->GetIsolate(); |
5271 ENTER_V8(isolate); | 5280 ENTER_V8(isolate); |
5272 i::Handle<i::Context> env = Utils::OpenHandle(this); | |
5273 i::Handle<i::Object> token_handle = Utils::OpenHandle(*token); | 5281 i::Handle<i::Object> token_handle = Utils::OpenHandle(*token); |
5274 env->set_security_token(*token_handle); | 5282 env->set_security_token(*token_handle); |
5275 } | 5283 } |
5276 | 5284 |
5277 | 5285 |
5278 void v8::Context::UseDefaultSecurityToken() { | 5286 void v8::Context::UseDefaultSecurityToken() { |
5279 i::Isolate* isolate = i::Isolate::Current(); | 5287 i::Handle<i::Context> env = Utils::OpenHandle(this); |
| 5288 i::Isolate* isolate = env->GetIsolate(); |
5280 ENTER_V8(isolate); | 5289 ENTER_V8(isolate); |
5281 i::Handle<i::Context> env = Utils::OpenHandle(this); | |
5282 env->set_security_token(env->global_object()); | 5290 env->set_security_token(env->global_object()); |
5283 } | 5291 } |
5284 | 5292 |
5285 | 5293 |
5286 Handle<Value> v8::Context::GetSecurityToken() { | 5294 Handle<Value> v8::Context::GetSecurityToken() { |
5287 i::Isolate* isolate = i::Isolate::Current(); | |
5288 i::Handle<i::Context> env = Utils::OpenHandle(this); | 5295 i::Handle<i::Context> env = Utils::OpenHandle(this); |
| 5296 i::Isolate* isolate = env->GetIsolate(); |
5289 i::Object* security_token = env->security_token(); | 5297 i::Object* security_token = env->security_token(); |
5290 i::Handle<i::Object> token_handle(security_token, isolate); | 5298 i::Handle<i::Object> token_handle(security_token, isolate); |
5291 return Utils::ToLocal(token_handle); | 5299 return Utils::ToLocal(token_handle); |
5292 } | 5300 } |
5293 | 5301 |
5294 | 5302 |
5295 v8::Isolate* Context::GetIsolate() { | 5303 v8::Isolate* Context::GetIsolate() { |
5296 i::Handle<i::Context> env = Utils::OpenHandle(this); | 5304 i::Handle<i::Context> env = Utils::OpenHandle(this); |
5297 return reinterpret_cast<Isolate*>(env->GetIsolate()); | 5305 return reinterpret_cast<Isolate*>(env->GetIsolate()); |
5298 } | 5306 } |
(...skipping 38 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
5337 | 5345 |
5338 void Context::SetErrorMessageForCodeGenerationFromStrings( | 5346 void Context::SetErrorMessageForCodeGenerationFromStrings( |
5339 Handle<String> error) { | 5347 Handle<String> error) { |
5340 i::Handle<i::Context> context = Utils::OpenHandle(this); | 5348 i::Handle<i::Context> context = Utils::OpenHandle(this); |
5341 i::Handle<i::String> error_handle = Utils::OpenHandle(*error); | 5349 i::Handle<i::String> error_handle = Utils::OpenHandle(*error); |
5342 context->set_error_message_for_code_gen_from_strings(*error_handle); | 5350 context->set_error_message_for_code_gen_from_strings(*error_handle); |
5343 } | 5351 } |
5344 | 5352 |
5345 | 5353 |
5346 Local<v8::Object> ObjectTemplate::NewInstance() { | 5354 Local<v8::Object> ObjectTemplate::NewInstance() { |
5347 i::Isolate* isolate = i::Isolate::Current(); | 5355 i::Handle<i::ObjectTemplateInfo> info = Utils::OpenHandle(this); |
| 5356 i::Isolate* isolate = info->GetIsolate(); |
5348 ON_BAILOUT(isolate, "v8::ObjectTemplate::NewInstance()", | 5357 ON_BAILOUT(isolate, "v8::ObjectTemplate::NewInstance()", |
5349 return Local<v8::Object>()); | 5358 return Local<v8::Object>()); |
5350 LOG_API(isolate, "ObjectTemplate::NewInstance"); | 5359 LOG_API(isolate, "ObjectTemplate::NewInstance"); |
5351 ENTER_V8(isolate); | 5360 ENTER_V8(isolate); |
5352 EXCEPTION_PREAMBLE(isolate); | 5361 EXCEPTION_PREAMBLE(isolate); |
5353 i::Handle<i::Object> obj; | 5362 i::Handle<i::Object> obj; |
5354 has_pending_exception = !i::Execution::InstantiateObject( | 5363 has_pending_exception = !i::Execution::InstantiateObject(info).ToHandle(&obj); |
5355 Utils::OpenHandle(this)).ToHandle(&obj); | |
5356 EXCEPTION_BAILOUT_CHECK(isolate, Local<v8::Object>()); | 5364 EXCEPTION_BAILOUT_CHECK(isolate, Local<v8::Object>()); |
5357 return Utils::ToLocal(i::Handle<i::JSObject>::cast(obj)); | 5365 return Utils::ToLocal(i::Handle<i::JSObject>::cast(obj)); |
5358 } | 5366 } |
5359 | 5367 |
5360 | 5368 |
5361 Local<v8::Function> FunctionTemplate::GetFunction() { | 5369 Local<v8::Function> FunctionTemplate::GetFunction() { |
5362 i::Isolate* isolate = i::Isolate::Current(); | 5370 i::Handle<i::FunctionTemplateInfo> info = Utils::OpenHandle(this); |
| 5371 i::Isolate* isolate = info->GetIsolate(); |
5363 ON_BAILOUT(isolate, "v8::FunctionTemplate::GetFunction()", | 5372 ON_BAILOUT(isolate, "v8::FunctionTemplate::GetFunction()", |
5364 return Local<v8::Function>()); | 5373 return Local<v8::Function>()); |
5365 LOG_API(isolate, "FunctionTemplate::GetFunction"); | 5374 LOG_API(isolate, "FunctionTemplate::GetFunction"); |
5366 ENTER_V8(isolate); | 5375 ENTER_V8(isolate); |
5367 EXCEPTION_PREAMBLE(isolate); | 5376 EXCEPTION_PREAMBLE(isolate); |
5368 i::Handle<i::Object> obj; | 5377 i::Handle<i::Object> obj; |
5369 has_pending_exception = !i::Execution::InstantiateFunction( | 5378 has_pending_exception = |
5370 Utils::OpenHandle(this)).ToHandle(&obj); | 5379 !i::Execution::InstantiateFunction(info).ToHandle(&obj); |
5371 EXCEPTION_BAILOUT_CHECK(isolate, Local<v8::Function>()); | 5380 EXCEPTION_BAILOUT_CHECK(isolate, Local<v8::Function>()); |
5372 return Utils::ToLocal(i::Handle<i::JSFunction>::cast(obj)); | 5381 return Utils::ToLocal(i::Handle<i::JSFunction>::cast(obj)); |
5373 } | 5382 } |
5374 | 5383 |
5375 | 5384 |
5376 bool FunctionTemplate::HasInstance(v8::Handle<v8::Value> value) { | 5385 bool FunctionTemplate::HasInstance(v8::Handle<v8::Value> value) { |
5377 ON_BAILOUT(i::Isolate::Current(), "v8::FunctionTemplate::HasInstanceOf()", | 5386 i::Handle<i::FunctionTemplateInfo> info = Utils::OpenHandle(this); |
5378 return false); | 5387 i::Isolate* isolate = info->GetIsolate(); |
| 5388 ON_BAILOUT(isolate, "v8::FunctionTemplate::HasInstanceOf()", return false); |
5379 i::Object* obj = *Utils::OpenHandle(*value); | 5389 i::Object* obj = *Utils::OpenHandle(*value); |
5380 return Utils::OpenHandle(this)->IsTemplateFor(obj); | 5390 return info->IsTemplateFor(obj); |
5381 } | 5391 } |
5382 | 5392 |
5383 | 5393 |
5384 Local<External> v8::External::New(Isolate* isolate, void* value) { | 5394 Local<External> v8::External::New(Isolate* isolate, void* value) { |
5385 STATIC_ASSERT(sizeof(value) == sizeof(i::Address)); | 5395 STATIC_ASSERT(sizeof(value) == sizeof(i::Address)); |
5386 i::Isolate* i_isolate = reinterpret_cast<i::Isolate*>(isolate); | 5396 i::Isolate* i_isolate = reinterpret_cast<i::Isolate*>(isolate); |
5387 LOG_API(i_isolate, "External::New"); | 5397 LOG_API(i_isolate, "External::New"); |
5388 ENTER_V8(i_isolate); | 5398 ENTER_V8(i_isolate); |
5389 i::Handle<i::JSObject> external = i_isolate->factory()->NewExternal(value); | 5399 i::Handle<i::JSObject> external = i_isolate->factory()->NewExternal(value); |
5390 return Utils::ExternalToLocal(external); | 5400 return Utils::ExternalToLocal(external); |
(...skipping 1409 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
6800 bool Isolate::AddMessageListener(MessageCallback that, Handle<Value> data) { | 6810 bool Isolate::AddMessageListener(MessageCallback that, Handle<Value> data) { |
6801 i::Isolate* isolate = reinterpret_cast<i::Isolate*>(this); | 6811 i::Isolate* isolate = reinterpret_cast<i::Isolate*>(this); |
6802 ON_BAILOUT(isolate, "v8::V8::AddMessageListener()", return false); | 6812 ON_BAILOUT(isolate, "v8::V8::AddMessageListener()", return false); |
6803 ENTER_V8(isolate); | 6813 ENTER_V8(isolate); |
6804 i::HandleScope scope(isolate); | 6814 i::HandleScope scope(isolate); |
6805 NeanderArray listeners(isolate->factory()->message_listeners()); | 6815 NeanderArray listeners(isolate->factory()->message_listeners()); |
6806 NeanderObject obj(isolate, 2); | 6816 NeanderObject obj(isolate, 2); |
6807 obj.set(0, *isolate->factory()->NewForeign(FUNCTION_ADDR(that))); | 6817 obj.set(0, *isolate->factory()->NewForeign(FUNCTION_ADDR(that))); |
6808 obj.set(1, data.IsEmpty() ? isolate->heap()->undefined_value() | 6818 obj.set(1, data.IsEmpty() ? isolate->heap()->undefined_value() |
6809 : *Utils::OpenHandle(*data)); | 6819 : *Utils::OpenHandle(*data)); |
6810 listeners.add(obj.value()); | 6820 listeners.add(isolate, obj.value()); |
6811 return true; | 6821 return true; |
6812 } | 6822 } |
6813 | 6823 |
6814 | 6824 |
6815 void Isolate::RemoveMessageListeners(MessageCallback that) { | 6825 void Isolate::RemoveMessageListeners(MessageCallback that) { |
6816 i::Isolate* isolate = reinterpret_cast<i::Isolate*>(this); | 6826 i::Isolate* isolate = reinterpret_cast<i::Isolate*>(this); |
6817 ON_BAILOUT(isolate, "v8::V8::RemoveMessageListeners()", return); | 6827 ON_BAILOUT(isolate, "v8::V8::RemoveMessageListeners()", return); |
6818 ENTER_V8(isolate); | 6828 ENTER_V8(isolate); |
6819 i::HandleScope scope(isolate); | 6829 i::HandleScope scope(isolate); |
6820 NeanderArray listeners(isolate->factory()->message_listeners()); | 6830 NeanderArray listeners(isolate->factory()->message_listeners()); |
(...skipping 917 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
7738 Isolate* isolate = reinterpret_cast<Isolate*>(info.GetIsolate()); | 7748 Isolate* isolate = reinterpret_cast<Isolate*>(info.GetIsolate()); |
7739 Address callback_address = | 7749 Address callback_address = |
7740 reinterpret_cast<Address>(reinterpret_cast<intptr_t>(callback)); | 7750 reinterpret_cast<Address>(reinterpret_cast<intptr_t>(callback)); |
7741 VMState<EXTERNAL> state(isolate); | 7751 VMState<EXTERNAL> state(isolate); |
7742 ExternalCallbackScope call_scope(isolate, callback_address); | 7752 ExternalCallbackScope call_scope(isolate, callback_address); |
7743 callback(info); | 7753 callback(info); |
7744 } | 7754 } |
7745 | 7755 |
7746 | 7756 |
7747 } } // namespace v8::internal | 7757 } } // namespace v8::internal |
OLD | NEW |