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 779 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
790 i_isolate); | 790 i_isolate); |
791 if (result->IsUndefined()) { | 791 if (result->IsUndefined()) { |
792 v8::Isolate* isolate = reinterpret_cast<v8::Isolate*>(i_isolate); | 792 v8::Isolate* isolate = reinterpret_cast<v8::Isolate*>(i_isolate); |
793 result = Utils::OpenHandle(*ObjectTemplate::New(isolate)); | 793 result = Utils::OpenHandle(*ObjectTemplate::New(isolate)); |
794 Utils::OpenHandle(this)->set_prototype_template(*result); | 794 Utils::OpenHandle(this)->set_prototype_template(*result); |
795 } | 795 } |
796 return ToApiHandle<ObjectTemplate>(result); | 796 return ToApiHandle<ObjectTemplate>(result); |
797 } | 797 } |
798 | 798 |
799 | 799 |
| 800 static void EnsureNotInstantiated(i::Handle<i::FunctionTemplateInfo> info, |
| 801 const char* func) { |
| 802 Utils::ApiCheck(!info->instantiated(), func, |
| 803 "FunctionTemplate already instantiated"); |
| 804 } |
| 805 |
| 806 |
800 void FunctionTemplate::Inherit(v8::Handle<FunctionTemplate> value) { | 807 void FunctionTemplate::Inherit(v8::Handle<FunctionTemplate> value) { |
801 i::Isolate* isolate = Utils::OpenHandle(this)->GetIsolate(); | 808 auto info = Utils::OpenHandle(this); |
| 809 EnsureNotInstantiated(info, "v8::FunctionTemplate::Inherit"); |
| 810 i::Isolate* isolate = info->GetIsolate(); |
802 ENTER_V8(isolate); | 811 ENTER_V8(isolate); |
803 Utils::OpenHandle(this)->set_parent_template(*Utils::OpenHandle(*value)); | 812 info->set_parent_template(*Utils::OpenHandle(*value)); |
804 } | 813 } |
805 | 814 |
806 | 815 |
807 static Local<FunctionTemplate> FunctionTemplateNew( | 816 static Local<FunctionTemplate> FunctionTemplateNew( |
808 i::Isolate* isolate, | 817 i::Isolate* isolate, |
809 FunctionCallback callback, | 818 FunctionCallback callback, |
810 v8::Handle<Value> data, | 819 v8::Handle<Value> data, |
811 v8::Handle<Signature> signature, | 820 v8::Handle<Signature> signature, |
812 int length, | 821 int length, |
813 bool do_not_cache) { | 822 bool do_not_cache) { |
(...skipping 89 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
903 | 912 |
904 | 913 |
905 #define SET_FIELD_WRAPPED(obj, setter, cdata) do { \ | 914 #define SET_FIELD_WRAPPED(obj, setter, cdata) do { \ |
906 i::Handle<i::Object> foreign = FromCData(obj->GetIsolate(), cdata); \ | 915 i::Handle<i::Object> foreign = FromCData(obj->GetIsolate(), cdata); \ |
907 (obj)->setter(*foreign); \ | 916 (obj)->setter(*foreign); \ |
908 } while (false) | 917 } while (false) |
909 | 918 |
910 | 919 |
911 void FunctionTemplate::SetCallHandler(FunctionCallback callback, | 920 void FunctionTemplate::SetCallHandler(FunctionCallback callback, |
912 v8::Handle<Value> data) { | 921 v8::Handle<Value> data) { |
913 i::Isolate* isolate = Utils::OpenHandle(this)->GetIsolate(); | 922 auto info = Utils::OpenHandle(this); |
| 923 EnsureNotInstantiated(info, "v8::FunctionTemplate::SetCallHandler"); |
| 924 i::Isolate* isolate = info->GetIsolate(); |
914 ENTER_V8(isolate); | 925 ENTER_V8(isolate); |
915 i::HandleScope scope(isolate); | 926 i::HandleScope scope(isolate); |
916 i::Handle<i::Struct> struct_obj = | 927 i::Handle<i::Struct> struct_obj = |
917 isolate->factory()->NewStruct(i::CALL_HANDLER_INFO_TYPE); | 928 isolate->factory()->NewStruct(i::CALL_HANDLER_INFO_TYPE); |
918 i::Handle<i::CallHandlerInfo> obj = | 929 i::Handle<i::CallHandlerInfo> obj = |
919 i::Handle<i::CallHandlerInfo>::cast(struct_obj); | 930 i::Handle<i::CallHandlerInfo>::cast(struct_obj); |
920 SET_FIELD_WRAPPED(obj, set_callback, callback); | 931 SET_FIELD_WRAPPED(obj, set_callback, callback); |
921 if (data.IsEmpty()) { | 932 if (data.IsEmpty()) { |
922 data = v8::Undefined(reinterpret_cast<v8::Isolate*>(isolate)); | 933 data = v8::Undefined(reinterpret_cast<v8::Isolate*>(isolate)); |
923 } | 934 } |
924 obj->set_data(*Utils::OpenHandle(*data)); | 935 obj->set_data(*Utils::OpenHandle(*data)); |
925 Utils::OpenHandle(this)->set_call_code(*obj); | 936 info->set_call_code(*obj); |
926 } | 937 } |
927 | 938 |
928 | 939 |
929 static i::Handle<i::AccessorInfo> SetAccessorInfoProperties( | 940 static i::Handle<i::AccessorInfo> SetAccessorInfoProperties( |
930 i::Handle<i::AccessorInfo> obj, | 941 i::Handle<i::AccessorInfo> obj, |
931 v8::Handle<Name> name, | 942 v8::Handle<Name> name, |
932 v8::AccessControl settings, | 943 v8::AccessControl settings, |
933 v8::PropertyAttribute attributes, | 944 v8::PropertyAttribute attributes, |
934 v8::Handle<AccessorSignature> signature) { | 945 v8::Handle<AccessorSignature> signature) { |
935 obj->set_name(*Utils::OpenHandle(*name)); | 946 obj->set_name(*Utils::OpenHandle(*name)); |
(...skipping 43 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
979 ObjectTemplate::New(isolate, ToApiHandle<FunctionTemplate>(handle)); | 990 ObjectTemplate::New(isolate, ToApiHandle<FunctionTemplate>(handle)); |
980 handle->set_instance_template(*Utils::OpenHandle(*templ)); | 991 handle->set_instance_template(*Utils::OpenHandle(*templ)); |
981 } | 992 } |
982 i::Handle<i::ObjectTemplateInfo> result( | 993 i::Handle<i::ObjectTemplateInfo> result( |
983 i::ObjectTemplateInfo::cast(handle->instance_template())); | 994 i::ObjectTemplateInfo::cast(handle->instance_template())); |
984 return Utils::ToLocal(result); | 995 return Utils::ToLocal(result); |
985 } | 996 } |
986 | 997 |
987 | 998 |
988 void FunctionTemplate::SetLength(int length) { | 999 void FunctionTemplate::SetLength(int length) { |
989 i::Isolate* isolate = Utils::OpenHandle(this)->GetIsolate(); | 1000 auto info = Utils::OpenHandle(this); |
| 1001 EnsureNotInstantiated(info, "v8::FunctionTemplate::SetLength"); |
| 1002 auto isolate = info->GetIsolate(); |
990 ENTER_V8(isolate); | 1003 ENTER_V8(isolate); |
991 Utils::OpenHandle(this)->set_length(length); | 1004 info->set_length(length); |
992 } | 1005 } |
993 | 1006 |
994 | 1007 |
995 void FunctionTemplate::SetClassName(Handle<String> name) { | 1008 void FunctionTemplate::SetClassName(Handle<String> name) { |
996 i::Isolate* isolate = Utils::OpenHandle(this)->GetIsolate(); | 1009 auto info = Utils::OpenHandle(this); |
| 1010 EnsureNotInstantiated(info, "v8::FunctionTemplate::SetClassName"); |
| 1011 auto isolate = info->GetIsolate(); |
997 ENTER_V8(isolate); | 1012 ENTER_V8(isolate); |
998 Utils::OpenHandle(this)->set_class_name(*Utils::OpenHandle(*name)); | 1013 info->set_class_name(*Utils::OpenHandle(*name)); |
999 } | 1014 } |
1000 | 1015 |
1001 | 1016 |
1002 void FunctionTemplate::SetHiddenPrototype(bool value) { | 1017 void FunctionTemplate::SetHiddenPrototype(bool value) { |
1003 i::Isolate* isolate = Utils::OpenHandle(this)->GetIsolate(); | 1018 auto info = Utils::OpenHandle(this); |
| 1019 EnsureNotInstantiated(info, "v8::FunctionTemplate::SetHiddenPrototype"); |
| 1020 auto isolate = info->GetIsolate(); |
1004 ENTER_V8(isolate); | 1021 ENTER_V8(isolate); |
1005 Utils::OpenHandle(this)->set_hidden_prototype(value); | 1022 info->set_hidden_prototype(value); |
1006 } | 1023 } |
1007 | 1024 |
1008 | 1025 |
1009 void FunctionTemplate::ReadOnlyPrototype() { | 1026 void FunctionTemplate::ReadOnlyPrototype() { |
1010 i::Isolate* isolate = Utils::OpenHandle(this)->GetIsolate(); | 1027 auto info = Utils::OpenHandle(this); |
| 1028 EnsureNotInstantiated(info, "v8::FunctionTemplate::ReadOnlyPrototype"); |
| 1029 auto isolate = info->GetIsolate(); |
1011 ENTER_V8(isolate); | 1030 ENTER_V8(isolate); |
1012 Utils::OpenHandle(this)->set_read_only_prototype(true); | 1031 info->set_read_only_prototype(true); |
1013 } | 1032 } |
1014 | 1033 |
1015 | 1034 |
1016 void FunctionTemplate::RemovePrototype() { | 1035 void FunctionTemplate::RemovePrototype() { |
1017 i::Isolate* isolate = Utils::OpenHandle(this)->GetIsolate(); | 1036 auto info = Utils::OpenHandle(this); |
| 1037 EnsureNotInstantiated(info, "v8::FunctionTemplate::RemovePrototype"); |
| 1038 auto isolate = info->GetIsolate(); |
1018 ENTER_V8(isolate); | 1039 ENTER_V8(isolate); |
1019 Utils::OpenHandle(this)->set_remove_prototype(true); | 1040 info->set_remove_prototype(true); |
1020 } | 1041 } |
1021 | 1042 |
1022 | 1043 |
1023 // --- O b j e c t T e m p l a t e --- | 1044 // --- O b j e c t T e m p l a t e --- |
1024 | 1045 |
1025 | 1046 |
1026 Local<ObjectTemplate> ObjectTemplate::New(Isolate* isolate) { | 1047 Local<ObjectTemplate> ObjectTemplate::New(Isolate* isolate) { |
1027 return New(reinterpret_cast<i::Isolate*>(isolate), Local<FunctionTemplate>()); | 1048 return New(reinterpret_cast<i::Isolate*>(isolate), Local<FunctionTemplate>()); |
1028 } | 1049 } |
1029 | 1050 |
(...skipping 146 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
1176 typename Enumerator> | 1197 typename Enumerator> |
1177 static void ObjectTemplateSetNamedPropertyHandler(ObjectTemplate* templ, | 1198 static void ObjectTemplateSetNamedPropertyHandler(ObjectTemplate* templ, |
1178 Getter getter, Setter setter, | 1199 Getter getter, Setter setter, |
1179 Query query, Deleter remover, | 1200 Query query, Deleter remover, |
1180 Enumerator enumerator, | 1201 Enumerator enumerator, |
1181 Handle<Value> data, | 1202 Handle<Value> data, |
1182 bool can_intercept_symbols) { | 1203 bool can_intercept_symbols) { |
1183 i::Isolate* isolate = Utils::OpenHandle(templ)->GetIsolate(); | 1204 i::Isolate* isolate = Utils::OpenHandle(templ)->GetIsolate(); |
1184 ENTER_V8(isolate); | 1205 ENTER_V8(isolate); |
1185 i::HandleScope scope(isolate); | 1206 i::HandleScope scope(isolate); |
1186 EnsureConstructor(isolate, templ); | 1207 auto cons = EnsureConstructor(isolate, templ); |
1187 i::FunctionTemplateInfo* constructor = | 1208 EnsureNotInstantiated(cons, "ObjectTemplateSetNamedPropertyHandler"); |
1188 i::FunctionTemplateInfo::cast(Utils::OpenHandle(templ)->constructor()); | |
1189 i::Handle<i::FunctionTemplateInfo> cons(constructor); | |
1190 i::Handle<i::Struct> struct_obj = | 1209 i::Handle<i::Struct> struct_obj = |
1191 isolate->factory()->NewStruct(i::INTERCEPTOR_INFO_TYPE); | 1210 isolate->factory()->NewStruct(i::INTERCEPTOR_INFO_TYPE); |
1192 i::Handle<i::InterceptorInfo> obj = | 1211 i::Handle<i::InterceptorInfo> obj = |
1193 i::Handle<i::InterceptorInfo>::cast(struct_obj); | 1212 i::Handle<i::InterceptorInfo>::cast(struct_obj); |
1194 | 1213 |
1195 if (getter != 0) SET_FIELD_WRAPPED(obj, set_getter, getter); | 1214 if (getter != 0) SET_FIELD_WRAPPED(obj, set_getter, getter); |
1196 if (setter != 0) SET_FIELD_WRAPPED(obj, set_setter, setter); | 1215 if (setter != 0) SET_FIELD_WRAPPED(obj, set_setter, setter); |
1197 if (query != 0) SET_FIELD_WRAPPED(obj, set_query, query); | 1216 if (query != 0) SET_FIELD_WRAPPED(obj, set_query, query); |
1198 if (remover != 0) SET_FIELD_WRAPPED(obj, set_deleter, remover); | 1217 if (remover != 0) SET_FIELD_WRAPPED(obj, set_deleter, remover); |
1199 if (enumerator != 0) SET_FIELD_WRAPPED(obj, set_enumerator, enumerator); | 1218 if (enumerator != 0) SET_FIELD_WRAPPED(obj, set_enumerator, enumerator); |
(...skipping 22 matching lines...) Expand all Loading... |
1222 ObjectTemplateSetNamedPropertyHandler(this, config.getter, config.setter, | 1241 ObjectTemplateSetNamedPropertyHandler(this, config.getter, config.setter, |
1223 config.query, config.deleter, | 1242 config.query, config.deleter, |
1224 config.enumerator, config.data, true); | 1243 config.enumerator, config.data, true); |
1225 } | 1244 } |
1226 | 1245 |
1227 | 1246 |
1228 void ObjectTemplate::MarkAsUndetectable() { | 1247 void ObjectTemplate::MarkAsUndetectable() { |
1229 i::Isolate* isolate = Utils::OpenHandle(this)->GetIsolate(); | 1248 i::Isolate* isolate = Utils::OpenHandle(this)->GetIsolate(); |
1230 ENTER_V8(isolate); | 1249 ENTER_V8(isolate); |
1231 i::HandleScope scope(isolate); | 1250 i::HandleScope scope(isolate); |
1232 EnsureConstructor(isolate, this); | 1251 auto cons = EnsureConstructor(isolate, this); |
1233 i::FunctionTemplateInfo* constructor = | 1252 EnsureNotInstantiated(cons, "v8::ObjectTemplate::MarkAsUndetectable"); |
1234 i::FunctionTemplateInfo::cast(Utils::OpenHandle(this)->constructor()); | |
1235 i::Handle<i::FunctionTemplateInfo> cons(constructor); | |
1236 cons->set_undetectable(true); | 1253 cons->set_undetectable(true); |
1237 } | 1254 } |
1238 | 1255 |
1239 | 1256 |
1240 void ObjectTemplate::SetAccessCheckCallbacks( | 1257 void ObjectTemplate::SetAccessCheckCallbacks( |
1241 NamedSecurityCallback named_callback, | 1258 NamedSecurityCallback named_callback, |
1242 IndexedSecurityCallback indexed_callback, | 1259 IndexedSecurityCallback indexed_callback, |
1243 Handle<Value> data, | 1260 Handle<Value> data, |
1244 bool turned_on_by_default) { | 1261 bool turned_on_by_default) { |
1245 i::Isolate* isolate = Utils::OpenHandle(this)->GetIsolate(); | 1262 i::Isolate* isolate = Utils::OpenHandle(this)->GetIsolate(); |
1246 ENTER_V8(isolate); | 1263 ENTER_V8(isolate); |
1247 i::HandleScope scope(isolate); | 1264 i::HandleScope scope(isolate); |
1248 EnsureConstructor(isolate, this); | 1265 auto cons = EnsureConstructor(isolate, this); |
| 1266 EnsureNotInstantiated(cons, "v8::ObjectTemplate::SetAccessCheckCallbacks"); |
1249 | 1267 |
1250 i::Handle<i::Struct> struct_info = | 1268 i::Handle<i::Struct> struct_info = |
1251 isolate->factory()->NewStruct(i::ACCESS_CHECK_INFO_TYPE); | 1269 isolate->factory()->NewStruct(i::ACCESS_CHECK_INFO_TYPE); |
1252 i::Handle<i::AccessCheckInfo> info = | 1270 i::Handle<i::AccessCheckInfo> info = |
1253 i::Handle<i::AccessCheckInfo>::cast(struct_info); | 1271 i::Handle<i::AccessCheckInfo>::cast(struct_info); |
1254 | 1272 |
1255 SET_FIELD_WRAPPED(info, set_named_callback, named_callback); | 1273 SET_FIELD_WRAPPED(info, set_named_callback, named_callback); |
1256 SET_FIELD_WRAPPED(info, set_indexed_callback, indexed_callback); | 1274 SET_FIELD_WRAPPED(info, set_indexed_callback, indexed_callback); |
1257 | 1275 |
1258 if (data.IsEmpty()) { | 1276 if (data.IsEmpty()) { |
1259 data = v8::Undefined(reinterpret_cast<v8::Isolate*>(isolate)); | 1277 data = v8::Undefined(reinterpret_cast<v8::Isolate*>(isolate)); |
1260 } | 1278 } |
1261 info->set_data(*Utils::OpenHandle(*data)); | 1279 info->set_data(*Utils::OpenHandle(*data)); |
1262 | 1280 |
1263 i::FunctionTemplateInfo* constructor = | |
1264 i::FunctionTemplateInfo::cast(Utils::OpenHandle(this)->constructor()); | |
1265 i::Handle<i::FunctionTemplateInfo> cons(constructor); | |
1266 cons->set_access_check_info(*info); | 1281 cons->set_access_check_info(*info); |
1267 cons->set_needs_access_check(turned_on_by_default); | 1282 cons->set_needs_access_check(turned_on_by_default); |
1268 } | 1283 } |
1269 | 1284 |
1270 | 1285 |
1271 void ObjectTemplate::SetHandler( | 1286 void ObjectTemplate::SetHandler( |
1272 const IndexedPropertyHandlerConfiguration& config) { | 1287 const IndexedPropertyHandlerConfiguration& config) { |
1273 i::Isolate* isolate = Utils::OpenHandle(this)->GetIsolate(); | 1288 i::Isolate* isolate = Utils::OpenHandle(this)->GetIsolate(); |
1274 ENTER_V8(isolate); | 1289 ENTER_V8(isolate); |
1275 i::HandleScope scope(isolate); | 1290 i::HandleScope scope(isolate); |
1276 EnsureConstructor(isolate, this); | 1291 auto cons = EnsureConstructor(isolate, this); |
1277 i::FunctionTemplateInfo* constructor = i::FunctionTemplateInfo::cast( | 1292 EnsureNotInstantiated(cons, "v8::ObjectTemplate::SetHandler"); |
1278 Utils::OpenHandle(this)->constructor()); | |
1279 i::Handle<i::FunctionTemplateInfo> cons(constructor); | |
1280 i::Handle<i::Struct> struct_obj = | 1293 i::Handle<i::Struct> struct_obj = |
1281 isolate->factory()->NewStruct(i::INTERCEPTOR_INFO_TYPE); | 1294 isolate->factory()->NewStruct(i::INTERCEPTOR_INFO_TYPE); |
1282 i::Handle<i::InterceptorInfo> obj = | 1295 i::Handle<i::InterceptorInfo> obj = |
1283 i::Handle<i::InterceptorInfo>::cast(struct_obj); | 1296 i::Handle<i::InterceptorInfo>::cast(struct_obj); |
1284 | 1297 |
1285 if (config.getter != 0) SET_FIELD_WRAPPED(obj, set_getter, config.getter); | 1298 if (config.getter != 0) SET_FIELD_WRAPPED(obj, set_getter, config.getter); |
1286 if (config.setter != 0) SET_FIELD_WRAPPED(obj, set_setter, config.setter); | 1299 if (config.setter != 0) SET_FIELD_WRAPPED(obj, set_setter, config.setter); |
1287 if (config.query != 0) SET_FIELD_WRAPPED(obj, set_query, config.query); | 1300 if (config.query != 0) SET_FIELD_WRAPPED(obj, set_query, config.query); |
1288 if (config.deleter != 0) SET_FIELD_WRAPPED(obj, set_deleter, config.deleter); | 1301 if (config.deleter != 0) SET_FIELD_WRAPPED(obj, set_deleter, config.deleter); |
1289 if (config.enumerator != 0) { | 1302 if (config.enumerator != 0) { |
1290 SET_FIELD_WRAPPED(obj, set_enumerator, config.enumerator); | 1303 SET_FIELD_WRAPPED(obj, set_enumerator, config.enumerator); |
1291 } | 1304 } |
1292 obj->set_flags(0); | 1305 obj->set_flags(0); |
1293 | 1306 |
1294 v8::Local<v8::Value> data = config.data; | 1307 v8::Local<v8::Value> data = config.data; |
1295 if (data.IsEmpty()) { | 1308 if (data.IsEmpty()) { |
1296 data = v8::Undefined(reinterpret_cast<v8::Isolate*>(isolate)); | 1309 data = v8::Undefined(reinterpret_cast<v8::Isolate*>(isolate)); |
1297 } | 1310 } |
1298 obj->set_data(*Utils::OpenHandle(*data)); | 1311 obj->set_data(*Utils::OpenHandle(*data)); |
1299 cons->set_indexed_property_handler(*obj); | 1312 cons->set_indexed_property_handler(*obj); |
1300 } | 1313 } |
1301 | 1314 |
1302 | 1315 |
1303 void ObjectTemplate::SetCallAsFunctionHandler(FunctionCallback callback, | 1316 void ObjectTemplate::SetCallAsFunctionHandler(FunctionCallback callback, |
1304 Handle<Value> data) { | 1317 Handle<Value> data) { |
1305 i::Isolate* isolate = Utils::OpenHandle(this)->GetIsolate(); | 1318 i::Isolate* isolate = Utils::OpenHandle(this)->GetIsolate(); |
1306 ENTER_V8(isolate); | 1319 ENTER_V8(isolate); |
1307 i::HandleScope scope(isolate); | 1320 i::HandleScope scope(isolate); |
1308 EnsureConstructor(isolate, this); | 1321 auto cons = EnsureConstructor(isolate, this); |
1309 i::FunctionTemplateInfo* constructor = i::FunctionTemplateInfo::cast( | 1322 EnsureNotInstantiated(cons, "v8::ObjectTemplate::SetCallAsFunctionHandler"); |
1310 Utils::OpenHandle(this)->constructor()); | |
1311 i::Handle<i::FunctionTemplateInfo> cons(constructor); | |
1312 i::Handle<i::Struct> struct_obj = | 1323 i::Handle<i::Struct> struct_obj = |
1313 isolate->factory()->NewStruct(i::CALL_HANDLER_INFO_TYPE); | 1324 isolate->factory()->NewStruct(i::CALL_HANDLER_INFO_TYPE); |
1314 i::Handle<i::CallHandlerInfo> obj = | 1325 i::Handle<i::CallHandlerInfo> obj = |
1315 i::Handle<i::CallHandlerInfo>::cast(struct_obj); | 1326 i::Handle<i::CallHandlerInfo>::cast(struct_obj); |
1316 SET_FIELD_WRAPPED(obj, set_callback, callback); | 1327 SET_FIELD_WRAPPED(obj, set_callback, callback); |
1317 if (data.IsEmpty()) { | 1328 if (data.IsEmpty()) { |
1318 data = v8::Undefined(reinterpret_cast<v8::Isolate*>(isolate)); | 1329 data = v8::Undefined(reinterpret_cast<v8::Isolate*>(isolate)); |
1319 } | 1330 } |
1320 obj->set_data(*Utils::OpenHandle(*data)); | 1331 obj->set_data(*Utils::OpenHandle(*data)); |
1321 cons->set_instance_call_handler(*obj); | 1332 cons->set_instance_call_handler(*obj); |
(...skipping 6273 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
7595 Isolate* isolate = reinterpret_cast<Isolate*>(info.GetIsolate()); | 7606 Isolate* isolate = reinterpret_cast<Isolate*>(info.GetIsolate()); |
7596 Address callback_address = | 7607 Address callback_address = |
7597 reinterpret_cast<Address>(reinterpret_cast<intptr_t>(callback)); | 7608 reinterpret_cast<Address>(reinterpret_cast<intptr_t>(callback)); |
7598 VMState<EXTERNAL> state(isolate); | 7609 VMState<EXTERNAL> state(isolate); |
7599 ExternalCallbackScope call_scope(isolate, callback_address); | 7610 ExternalCallbackScope call_scope(isolate, callback_address); |
7600 callback(info); | 7611 callback(info); |
7601 } | 7612 } |
7602 | 7613 |
7603 | 7614 |
7604 } } // namespace v8::internal | 7615 } } // namespace v8::internal |
OLD | NEW |