| 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 794 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 805 | 805 |
| 806 EscapableHandleScope::EscapableHandleScope(Isolate* v8_isolate) { | 806 EscapableHandleScope::EscapableHandleScope(Isolate* v8_isolate) { |
| 807 i::Isolate* isolate = reinterpret_cast<i::Isolate*>(v8_isolate); | 807 i::Isolate* isolate = reinterpret_cast<i::Isolate*>(v8_isolate); |
| 808 escape_slot_ = CreateHandle(isolate, isolate->heap()->the_hole_value()); | 808 escape_slot_ = CreateHandle(isolate, isolate->heap()->the_hole_value()); |
| 809 Initialize(v8_isolate); | 809 Initialize(v8_isolate); |
| 810 } | 810 } |
| 811 | 811 |
| 812 | 812 |
| 813 i::Object** EscapableHandleScope::Escape(i::Object** escape_value) { | 813 i::Object** EscapableHandleScope::Escape(i::Object** escape_value) { |
| 814 i::Heap* heap = reinterpret_cast<i::Isolate*>(GetIsolate())->heap(); | 814 i::Heap* heap = reinterpret_cast<i::Isolate*>(GetIsolate())->heap(); |
| 815 Utils::ApiCheck(*escape_slot_ == heap->the_hole_value(), | 815 Utils::ApiCheck((*escape_slot_)->IsTheHole(heap->isolate()), |
| 816 "EscapeableHandleScope::Escape", | 816 "EscapeableHandleScope::Escape", "Escape value set twice"); |
| 817 "Escape value set twice"); | |
| 818 if (escape_value == NULL) { | 817 if (escape_value == NULL) { |
| 819 *escape_slot_ = heap->undefined_value(); | 818 *escape_slot_ = heap->undefined_value(); |
| 820 return NULL; | 819 return NULL; |
| 821 } | 820 } |
| 822 *escape_slot_ = *escape_value; | 821 *escape_slot_ = *escape_value; |
| 823 return escape_slot_; | 822 return escape_slot_; |
| 824 } | 823 } |
| 825 | 824 |
| 826 | 825 |
| 827 SealHandleScope::SealHandleScope(Isolate* isolate) { | 826 SealHandleScope::SealHandleScope(Isolate* isolate) { |
| (...skipping 240 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 1068 | 1067 |
| 1069 static Local<ObjectTemplate> ObjectTemplateNew( | 1068 static Local<ObjectTemplate> ObjectTemplateNew( |
| 1070 i::Isolate* isolate, v8::Local<FunctionTemplate> constructor, | 1069 i::Isolate* isolate, v8::Local<FunctionTemplate> constructor, |
| 1071 bool do_not_cache); | 1070 bool do_not_cache); |
| 1072 | 1071 |
| 1073 Local<ObjectTemplate> FunctionTemplate::PrototypeTemplate() { | 1072 Local<ObjectTemplate> FunctionTemplate::PrototypeTemplate() { |
| 1074 i::Isolate* i_isolate = Utils::OpenHandle(this)->GetIsolate(); | 1073 i::Isolate* i_isolate = Utils::OpenHandle(this)->GetIsolate(); |
| 1075 ENTER_V8(i_isolate); | 1074 ENTER_V8(i_isolate); |
| 1076 i::Handle<i::Object> result(Utils::OpenHandle(this)->prototype_template(), | 1075 i::Handle<i::Object> result(Utils::OpenHandle(this)->prototype_template(), |
| 1077 i_isolate); | 1076 i_isolate); |
| 1078 if (result->IsUndefined()) { | 1077 if (result->IsUndefined(i_isolate)) { |
| 1079 // Do not cache prototype objects. | 1078 // Do not cache prototype objects. |
| 1080 result = Utils::OpenHandle( | 1079 result = Utils::OpenHandle( |
| 1081 *ObjectTemplateNew(i_isolate, Local<FunctionTemplate>(), true)); | 1080 *ObjectTemplateNew(i_isolate, Local<FunctionTemplate>(), true)); |
| 1082 Utils::OpenHandle(this)->set_prototype_template(*result); | 1081 Utils::OpenHandle(this)->set_prototype_template(*result); |
| 1083 } | 1082 } |
| 1084 return ToApiHandle<ObjectTemplate>(result); | 1083 return ToApiHandle<ObjectTemplate>(result); |
| 1085 } | 1084 } |
| 1086 | 1085 |
| 1087 | 1086 |
| 1088 static void EnsureNotInstantiated(i::Handle<i::FunctionTemplateInfo> info, | 1087 static void EnsureNotInstantiated(i::Handle<i::FunctionTemplateInfo> info, |
| (...skipping 159 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 1248 | 1247 |
| 1249 Local<ObjectTemplate> FunctionTemplate::InstanceTemplate() { | 1248 Local<ObjectTemplate> FunctionTemplate::InstanceTemplate() { |
| 1250 i::Handle<i::FunctionTemplateInfo> handle = Utils::OpenHandle(this, true); | 1249 i::Handle<i::FunctionTemplateInfo> handle = Utils::OpenHandle(this, true); |
| 1251 if (!Utils::ApiCheck(!handle.is_null(), | 1250 if (!Utils::ApiCheck(!handle.is_null(), |
| 1252 "v8::FunctionTemplate::InstanceTemplate()", | 1251 "v8::FunctionTemplate::InstanceTemplate()", |
| 1253 "Reading from empty handle")) { | 1252 "Reading from empty handle")) { |
| 1254 return Local<ObjectTemplate>(); | 1253 return Local<ObjectTemplate>(); |
| 1255 } | 1254 } |
| 1256 i::Isolate* isolate = handle->GetIsolate(); | 1255 i::Isolate* isolate = handle->GetIsolate(); |
| 1257 ENTER_V8(isolate); | 1256 ENTER_V8(isolate); |
| 1258 if (handle->instance_template()->IsUndefined()) { | 1257 if (handle->instance_template()->IsUndefined(isolate)) { |
| 1259 Local<ObjectTemplate> templ = | 1258 Local<ObjectTemplate> templ = |
| 1260 ObjectTemplate::New(isolate, ToApiHandle<FunctionTemplate>(handle)); | 1259 ObjectTemplate::New(isolate, ToApiHandle<FunctionTemplate>(handle)); |
| 1261 handle->set_instance_template(*Utils::OpenHandle(*templ)); | 1260 handle->set_instance_template(*Utils::OpenHandle(*templ)); |
| 1262 } | 1261 } |
| 1263 i::Handle<i::ObjectTemplateInfo> result( | 1262 i::Handle<i::ObjectTemplateInfo> result( |
| 1264 i::ObjectTemplateInfo::cast(handle->instance_template())); | 1263 i::ObjectTemplateInfo::cast(handle->instance_template())); |
| 1265 return Utils::ToLocal(result); | 1264 return Utils::ToLocal(result); |
| 1266 } | 1265 } |
| 1267 | 1266 |
| 1268 | 1267 |
| (...skipping 93 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 1362 i::Isolate* isolate, v8::Local<FunctionTemplate> constructor) { | 1361 i::Isolate* isolate, v8::Local<FunctionTemplate> constructor) { |
| 1363 return ObjectTemplateNew(isolate, constructor, false); | 1362 return ObjectTemplateNew(isolate, constructor, false); |
| 1364 } | 1363 } |
| 1365 | 1364 |
| 1366 // Ensure that the object template has a constructor. If no | 1365 // Ensure that the object template has a constructor. If no |
| 1367 // constructor is available we create one. | 1366 // constructor is available we create one. |
| 1368 static i::Handle<i::FunctionTemplateInfo> EnsureConstructor( | 1367 static i::Handle<i::FunctionTemplateInfo> EnsureConstructor( |
| 1369 i::Isolate* isolate, | 1368 i::Isolate* isolate, |
| 1370 ObjectTemplate* object_template) { | 1369 ObjectTemplate* object_template) { |
| 1371 i::Object* obj = Utils::OpenHandle(object_template)->constructor(); | 1370 i::Object* obj = Utils::OpenHandle(object_template)->constructor(); |
| 1372 if (!obj ->IsUndefined()) { | 1371 if (!obj->IsUndefined(isolate)) { |
| 1373 i::FunctionTemplateInfo* info = i::FunctionTemplateInfo::cast(obj); | 1372 i::FunctionTemplateInfo* info = i::FunctionTemplateInfo::cast(obj); |
| 1374 return i::Handle<i::FunctionTemplateInfo>(info, isolate); | 1373 return i::Handle<i::FunctionTemplateInfo>(info, isolate); |
| 1375 } | 1374 } |
| 1376 Local<FunctionTemplate> templ = | 1375 Local<FunctionTemplate> templ = |
| 1377 FunctionTemplate::New(reinterpret_cast<Isolate*>(isolate)); | 1376 FunctionTemplate::New(reinterpret_cast<Isolate*>(isolate)); |
| 1378 i::Handle<i::FunctionTemplateInfo> constructor = Utils::OpenHandle(*templ); | 1377 i::Handle<i::FunctionTemplateInfo> constructor = Utils::OpenHandle(*templ); |
| 1379 constructor->set_instance_template(*Utils::OpenHandle(object_template)); | 1378 constructor->set_instance_template(*Utils::OpenHandle(object_template)); |
| 1380 Utils::OpenHandle(object_template)->set_constructor(*constructor); | 1379 Utils::OpenHandle(object_template)->set_constructor(*constructor); |
| 1381 return constructor; | 1380 return constructor; |
| 1382 } | 1381 } |
| (...skipping 868 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 2251 // Note that this will not cancel termination exceptions. | 2250 // Note that this will not cancel termination exceptions. |
| 2252 isolate_->CancelScheduledExceptionFromTryCatch(this); | 2251 isolate_->CancelScheduledExceptionFromTryCatch(this); |
| 2253 } | 2252 } |
| 2254 isolate_->UnregisterTryCatchHandler(this); | 2253 isolate_->UnregisterTryCatchHandler(this); |
| 2255 v8::internal::SimulatorStack::UnregisterCTryCatch(isolate_); | 2254 v8::internal::SimulatorStack::UnregisterCTryCatch(isolate_); |
| 2256 } | 2255 } |
| 2257 } | 2256 } |
| 2258 | 2257 |
| 2259 | 2258 |
| 2260 bool v8::TryCatch::HasCaught() const { | 2259 bool v8::TryCatch::HasCaught() const { |
| 2261 return !reinterpret_cast<i::Object*>(exception_)->IsTheHole(); | 2260 return !reinterpret_cast<i::Object*>(exception_)->IsTheHole(isolate_); |
| 2262 } | 2261 } |
| 2263 | 2262 |
| 2264 | 2263 |
| 2265 bool v8::TryCatch::CanContinue() const { | 2264 bool v8::TryCatch::CanContinue() const { |
| 2266 return can_continue_; | 2265 return can_continue_; |
| 2267 } | 2266 } |
| 2268 | 2267 |
| 2269 | 2268 |
| 2270 bool v8::TryCatch::HasTerminated() const { | 2269 bool v8::TryCatch::HasTerminated() const { |
| 2271 return has_terminated_; | 2270 return has_terminated_; |
| (...skipping 38 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 2310 | 2309 |
| 2311 | 2310 |
| 2312 v8::Local<Value> v8::TryCatch::StackTrace() const { | 2311 v8::Local<Value> v8::TryCatch::StackTrace() const { |
| 2313 auto context = reinterpret_cast<v8::Isolate*>(isolate_)->GetCurrentContext(); | 2312 auto context = reinterpret_cast<v8::Isolate*>(isolate_)->GetCurrentContext(); |
| 2314 RETURN_TO_LOCAL_UNCHECKED(StackTrace(context), Value); | 2313 RETURN_TO_LOCAL_UNCHECKED(StackTrace(context), Value); |
| 2315 } | 2314 } |
| 2316 | 2315 |
| 2317 | 2316 |
| 2318 v8::Local<v8::Message> v8::TryCatch::Message() const { | 2317 v8::Local<v8::Message> v8::TryCatch::Message() const { |
| 2319 i::Object* message = reinterpret_cast<i::Object*>(message_obj_); | 2318 i::Object* message = reinterpret_cast<i::Object*>(message_obj_); |
| 2320 DCHECK(message->IsJSMessageObject() || message->IsTheHole()); | 2319 DCHECK(message->IsJSMessageObject() || message->IsTheHole(isolate_)); |
| 2321 if (HasCaught() && !message->IsTheHole()) { | 2320 if (HasCaught() && !message->IsTheHole(isolate_)) { |
| 2322 return v8::Utils::MessageToLocal(i::Handle<i::Object>(message, isolate_)); | 2321 return v8::Utils::MessageToLocal(i::Handle<i::Object>(message, isolate_)); |
| 2323 } else { | 2322 } else { |
| 2324 return v8::Local<v8::Message>(); | 2323 return v8::Local<v8::Message>(); |
| 2325 } | 2324 } |
| 2326 } | 2325 } |
| 2327 | 2326 |
| 2328 | 2327 |
| 2329 void v8::TryCatch::Reset() { | 2328 void v8::TryCatch::Reset() { |
| 2330 if (!rethrow_ && HasCaught() && isolate_->has_scheduled_exception()) { | 2329 if (!rethrow_ && HasCaught() && isolate_->has_scheduled_exception()) { |
| 2331 // If an exception was caught but is still scheduled because no API call | 2330 // If an exception was caught but is still scheduled because no API call |
| (...skipping 348 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 2680 DCHECK(false); | 2679 DCHECK(false); |
| 2681 return v8::Undefined(reinterpret_cast<v8::Isolate*>(isolate)); | 2680 return v8::Undefined(reinterpret_cast<v8::Isolate*>(isolate)); |
| 2682 } | 2681 } |
| 2683 i::Handle<i::ObjectHashTable> table( | 2682 i::Handle<i::ObjectHashTable> table( |
| 2684 i::ObjectHashTable::cast(weak_collection->table())); | 2683 i::ObjectHashTable::cast(weak_collection->table())); |
| 2685 if (!table->IsKey(*key)) { | 2684 if (!table->IsKey(*key)) { |
| 2686 DCHECK(false); | 2685 DCHECK(false); |
| 2687 return v8::Undefined(reinterpret_cast<v8::Isolate*>(isolate)); | 2686 return v8::Undefined(reinterpret_cast<v8::Isolate*>(isolate)); |
| 2688 } | 2687 } |
| 2689 i::Handle<i::Object> lookup(table->Lookup(key), isolate); | 2688 i::Handle<i::Object> lookup(table->Lookup(key), isolate); |
| 2690 if (lookup->IsTheHole()) | 2689 if (lookup->IsTheHole(isolate)) |
| 2691 return v8::Undefined(reinterpret_cast<v8::Isolate*>(isolate)); | 2690 return v8::Undefined(reinterpret_cast<v8::Isolate*>(isolate)); |
| 2692 return Utils::ToLocal(lookup); | 2691 return Utils::ToLocal(lookup); |
| 2693 } | 2692 } |
| 2694 | 2693 |
| 2695 | 2694 |
| 2696 bool NativeWeakMap::Has(Local<Value> v8_key) { | 2695 bool NativeWeakMap::Has(Local<Value> v8_key) { |
| 2697 i::Handle<i::JSWeakMap> weak_collection = Utils::OpenHandle(this); | 2696 i::Handle<i::JSWeakMap> weak_collection = Utils::OpenHandle(this); |
| 2698 i::Isolate* isolate = weak_collection->GetIsolate(); | 2697 i::Isolate* isolate = weak_collection->GetIsolate(); |
| 2699 ENTER_V8(isolate); | 2698 ENTER_V8(isolate); |
| 2700 i::HandleScope scope(isolate); | 2699 i::HandleScope scope(isolate); |
| 2701 i::Handle<i::Object> key = Utils::OpenHandle(*v8_key); | 2700 i::Handle<i::Object> key = Utils::OpenHandle(*v8_key); |
| 2702 if (!key->IsJSReceiver() && !key->IsSymbol()) { | 2701 if (!key->IsJSReceiver() && !key->IsSymbol()) { |
| 2703 DCHECK(false); | 2702 DCHECK(false); |
| 2704 return false; | 2703 return false; |
| 2705 } | 2704 } |
| 2706 i::Handle<i::ObjectHashTable> table( | 2705 i::Handle<i::ObjectHashTable> table( |
| 2707 i::ObjectHashTable::cast(weak_collection->table())); | 2706 i::ObjectHashTable::cast(weak_collection->table())); |
| 2708 if (!table->IsKey(*key)) { | 2707 if (!table->IsKey(*key)) { |
| 2709 DCHECK(false); | 2708 DCHECK(false); |
| 2710 return false; | 2709 return false; |
| 2711 } | 2710 } |
| 2712 i::Handle<i::Object> lookup(table->Lookup(key), isolate); | 2711 i::Handle<i::Object> lookup(table->Lookup(key), isolate); |
| 2713 return !lookup->IsTheHole(); | 2712 return !lookup->IsTheHole(isolate); |
| 2714 } | 2713 } |
| 2715 | 2714 |
| 2716 | 2715 |
| 2717 bool NativeWeakMap::Delete(Local<Value> v8_key) { | 2716 bool NativeWeakMap::Delete(Local<Value> v8_key) { |
| 2718 i::Handle<i::JSWeakMap> weak_collection = Utils::OpenHandle(this); | 2717 i::Handle<i::JSWeakMap> weak_collection = Utils::OpenHandle(this); |
| 2719 i::Isolate* isolate = weak_collection->GetIsolate(); | 2718 i::Isolate* isolate = weak_collection->GetIsolate(); |
| 2720 ENTER_V8(isolate); | 2719 ENTER_V8(isolate); |
| 2721 i::HandleScope scope(isolate); | 2720 i::HandleScope scope(isolate); |
| 2722 i::Handle<i::Object> key = Utils::OpenHandle(*v8_key); | 2721 i::Handle<i::Object> key = Utils::OpenHandle(*v8_key); |
| 2723 if (!key->IsJSReceiver() && !key->IsSymbol()) { | 2722 if (!key->IsJSReceiver() && !key->IsSymbol()) { |
| (...skipping 2837 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 5561 proxy_constructor = EnsureConstructor(isolate, *proxy_template); | 5560 proxy_constructor = EnsureConstructor(isolate, *proxy_template); |
| 5562 | 5561 |
| 5563 // Set the global template to be the prototype template of | 5562 // Set the global template to be the prototype template of |
| 5564 // global proxy template. | 5563 // global proxy template. |
| 5565 proxy_constructor->set_prototype_template( | 5564 proxy_constructor->set_prototype_template( |
| 5566 *Utils::OpenHandle(*global_template)); | 5565 *Utils::OpenHandle(*global_template)); |
| 5567 | 5566 |
| 5568 // Migrate security handlers from global_template to | 5567 // Migrate security handlers from global_template to |
| 5569 // proxy_template. Temporarily removing access check | 5568 // proxy_template. Temporarily removing access check |
| 5570 // information from the global template. | 5569 // information from the global template. |
| 5571 if (!global_constructor->access_check_info()->IsUndefined()) { | 5570 if (!global_constructor->access_check_info()->IsUndefined(isolate)) { |
| 5572 proxy_constructor->set_access_check_info( | 5571 proxy_constructor->set_access_check_info( |
| 5573 global_constructor->access_check_info()); | 5572 global_constructor->access_check_info()); |
| 5574 proxy_constructor->set_needs_access_check( | 5573 proxy_constructor->set_needs_access_check( |
| 5575 global_constructor->needs_access_check()); | 5574 global_constructor->needs_access_check()); |
| 5576 global_constructor->set_needs_access_check(false); | 5575 global_constructor->set_needs_access_check(false); |
| 5577 global_constructor->set_access_check_info( | 5576 global_constructor->set_access_check_info( |
| 5578 isolate->heap()->undefined_value()); | 5577 isolate->heap()->undefined_value()); |
| 5579 } | 5578 } |
| 5580 } | 5579 } |
| 5581 | 5580 |
| (...skipping 1353 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 6935 i::Handle<i::String> name, | 6934 i::Handle<i::String> name, |
| 6936 i::Handle<i::String> part, | 6935 i::Handle<i::String> part, |
| 6937 bool private_symbol) { | 6936 bool private_symbol) { |
| 6938 i::Handle<i::JSObject> registry = isolate->GetSymbolRegistry(); | 6937 i::Handle<i::JSObject> registry = isolate->GetSymbolRegistry(); |
| 6939 i::Handle<i::JSObject> symbols = | 6938 i::Handle<i::JSObject> symbols = |
| 6940 i::Handle<i::JSObject>::cast( | 6939 i::Handle<i::JSObject>::cast( |
| 6941 i::Object::GetPropertyOrElement(registry, part).ToHandleChecked()); | 6940 i::Object::GetPropertyOrElement(registry, part).ToHandleChecked()); |
| 6942 i::Handle<i::Object> symbol = | 6941 i::Handle<i::Object> symbol = |
| 6943 i::Object::GetPropertyOrElement(symbols, name).ToHandleChecked(); | 6942 i::Object::GetPropertyOrElement(symbols, name).ToHandleChecked(); |
| 6944 if (!symbol->IsSymbol()) { | 6943 if (!symbol->IsSymbol()) { |
| 6945 DCHECK(symbol->IsUndefined()); | 6944 DCHECK(symbol->IsUndefined(isolate)); |
| 6946 if (private_symbol) | 6945 if (private_symbol) |
| 6947 symbol = isolate->factory()->NewPrivateSymbol(); | 6946 symbol = isolate->factory()->NewPrivateSymbol(); |
| 6948 else | 6947 else |
| 6949 symbol = isolate->factory()->NewSymbol(); | 6948 symbol = isolate->factory()->NewSymbol(); |
| 6950 i::Handle<i::Symbol>::cast(symbol)->set_name(*name); | 6949 i::Handle<i::Symbol>::cast(symbol)->set_name(*name); |
| 6951 i::Object::SetPropertyOrElement(symbols, name, symbol, i::STRICT).Assert(); | 6950 i::Object::SetPropertyOrElement(symbols, name, symbol, i::STRICT).Assert(); |
| 6952 } | 6951 } |
| 6953 return i::Handle<i::Symbol>::cast(symbol); | 6952 return i::Handle<i::Symbol>::cast(symbol); |
| 6954 } | 6953 } |
| 6955 | 6954 |
| (...skipping 799 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 7755 return true; | 7754 return true; |
| 7756 } | 7755 } |
| 7757 | 7756 |
| 7758 | 7757 |
| 7759 void Isolate::RemoveMessageListeners(MessageCallback that) { | 7758 void Isolate::RemoveMessageListeners(MessageCallback that) { |
| 7760 i::Isolate* isolate = reinterpret_cast<i::Isolate*>(this); | 7759 i::Isolate* isolate = reinterpret_cast<i::Isolate*>(this); |
| 7761 ENTER_V8(isolate); | 7760 ENTER_V8(isolate); |
| 7762 i::HandleScope scope(isolate); | 7761 i::HandleScope scope(isolate); |
| 7763 NeanderArray listeners(isolate->factory()->message_listeners()); | 7762 NeanderArray listeners(isolate->factory()->message_listeners()); |
| 7764 for (int i = 0; i < listeners.length(); i++) { | 7763 for (int i = 0; i < listeners.length(); i++) { |
| 7765 if (listeners.get(i)->IsUndefined()) continue; // skip deleted ones | 7764 if (listeners.get(i)->IsUndefined(isolate)) continue; // skip deleted ones |
| 7766 | 7765 |
| 7767 NeanderObject listener(i::JSObject::cast(listeners.get(i))); | 7766 NeanderObject listener(i::JSObject::cast(listeners.get(i))); |
| 7768 i::Handle<i::Foreign> callback_obj(i::Foreign::cast(listener.get(0))); | 7767 i::Handle<i::Foreign> callback_obj(i::Foreign::cast(listener.get(0))); |
| 7769 if (callback_obj->foreign_address() == FUNCTION_ADDR(that)) { | 7768 if (callback_obj->foreign_address() == FUNCTION_ADDR(that)) { |
| 7770 listeners.set(i, isolate->heap()->undefined_value()); | 7769 listeners.set(i, isolate->heap()->undefined_value()); |
| 7771 } | 7770 } |
| 7772 } | 7771 } |
| 7773 } | 7772 } |
| 7774 | 7773 |
| 7775 | 7774 |
| (...skipping 1041 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 8817 Address callback_address = | 8816 Address callback_address = |
| 8818 reinterpret_cast<Address>(reinterpret_cast<intptr_t>(callback)); | 8817 reinterpret_cast<Address>(reinterpret_cast<intptr_t>(callback)); |
| 8819 VMState<EXTERNAL> state(isolate); | 8818 VMState<EXTERNAL> state(isolate); |
| 8820 ExternalCallbackScope call_scope(isolate, callback_address); | 8819 ExternalCallbackScope call_scope(isolate, callback_address); |
| 8821 callback(info); | 8820 callback(info); |
| 8822 } | 8821 } |
| 8823 | 8822 |
| 8824 | 8823 |
| 8825 } // namespace internal | 8824 } // namespace internal |
| 8826 } // namespace v8 | 8825 } // namespace v8 |
| OLD | NEW |