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 1235 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
1246 Handle<Object> obj = | 1246 Handle<Object> obj = |
1247 isolate->factory()->NewTypeError( | 1247 isolate->factory()->NewTypeError( |
1248 "illegal_invocation", HandleVector(&function, 1)); | 1248 "illegal_invocation", HandleVector(&function, 1)); |
1249 return isolate->Throw(*obj); | 1249 return isolate->Throw(*obj); |
1250 } | 1250 } |
1251 | 1251 |
1252 Object* raw_call_data = fun_data->call_code(); | 1252 Object* raw_call_data = fun_data->call_code(); |
1253 if (!raw_call_data->IsUndefined()) { | 1253 if (!raw_call_data->IsUndefined()) { |
1254 CallHandlerInfo* call_data = CallHandlerInfo::cast(raw_call_data); | 1254 CallHandlerInfo* call_data = CallHandlerInfo::cast(raw_call_data); |
1255 Object* callback_obj = call_data->callback(); | 1255 Object* callback_obj = call_data->callback(); |
1256 v8::InvocationCallback callback = | 1256 v8::FunctionCallback callback = |
1257 v8::ToCData<v8::InvocationCallback>(callback_obj); | 1257 v8::ToCData<v8::FunctionCallback>(callback_obj); |
1258 Object* data_obj = call_data->data(); | 1258 Object* data_obj = call_data->data(); |
1259 Object* result; | 1259 Object* result; |
1260 | 1260 |
1261 LOG(isolate, ApiObjectAccess("call", JSObject::cast(*args.receiver()))); | 1261 LOG(isolate, ApiObjectAccess("call", JSObject::cast(*args.receiver()))); |
1262 ASSERT(raw_holder->IsJSObject()); | 1262 ASSERT(raw_holder->IsJSObject()); |
1263 | 1263 |
1264 FunctionCallbackArguments custom(isolate, | 1264 FunctionCallbackArguments custom(isolate, |
1265 data_obj, | 1265 data_obj, |
1266 *function, | 1266 *function, |
1267 raw_holder, | 1267 raw_holder, |
(...skipping 47 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
1315 // Get the invocation callback from the function descriptor that was | 1315 // Get the invocation callback from the function descriptor that was |
1316 // used to create the called object. | 1316 // used to create the called object. |
1317 ASSERT(obj->map()->has_instance_call_handler()); | 1317 ASSERT(obj->map()->has_instance_call_handler()); |
1318 JSFunction* constructor = JSFunction::cast(obj->map()->constructor()); | 1318 JSFunction* constructor = JSFunction::cast(obj->map()->constructor()); |
1319 ASSERT(constructor->shared()->IsApiFunction()); | 1319 ASSERT(constructor->shared()->IsApiFunction()); |
1320 Object* handler = | 1320 Object* handler = |
1321 constructor->shared()->get_api_func_data()->instance_call_handler(); | 1321 constructor->shared()->get_api_func_data()->instance_call_handler(); |
1322 ASSERT(!handler->IsUndefined()); | 1322 ASSERT(!handler->IsUndefined()); |
1323 CallHandlerInfo* call_data = CallHandlerInfo::cast(handler); | 1323 CallHandlerInfo* call_data = CallHandlerInfo::cast(handler); |
1324 Object* callback_obj = call_data->callback(); | 1324 Object* callback_obj = call_data->callback(); |
1325 v8::InvocationCallback callback = | 1325 v8::FunctionCallback callback = |
1326 v8::ToCData<v8::InvocationCallback>(callback_obj); | 1326 v8::ToCData<v8::FunctionCallback>(callback_obj); |
1327 | 1327 |
1328 // Get the data for the call and perform the callback. | 1328 // Get the data for the call and perform the callback. |
1329 Object* result; | 1329 Object* result; |
1330 { | 1330 { |
1331 HandleScope scope(isolate); | 1331 HandleScope scope(isolate); |
1332 LOG(isolate, ApiObjectAccess("call non-function", obj)); | 1332 LOG(isolate, ApiObjectAccess("call non-function", obj)); |
1333 | 1333 |
1334 FunctionCallbackArguments custom(isolate, | 1334 FunctionCallbackArguments custom(isolate, |
1335 call_data->data(), | 1335 call_data->data(), |
1336 constructor, | 1336 constructor, |
(...skipping 489 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
1826 return Handle<Code>(code_address); \ | 1826 return Handle<Code>(code_address); \ |
1827 } | 1827 } |
1828 BUILTIN_LIST_C(DEFINE_BUILTIN_ACCESSOR_C) | 1828 BUILTIN_LIST_C(DEFINE_BUILTIN_ACCESSOR_C) |
1829 BUILTIN_LIST_A(DEFINE_BUILTIN_ACCESSOR_A) | 1829 BUILTIN_LIST_A(DEFINE_BUILTIN_ACCESSOR_A) |
1830 BUILTIN_LIST_DEBUG_A(DEFINE_BUILTIN_ACCESSOR_A) | 1830 BUILTIN_LIST_DEBUG_A(DEFINE_BUILTIN_ACCESSOR_A) |
1831 #undef DEFINE_BUILTIN_ACCESSOR_C | 1831 #undef DEFINE_BUILTIN_ACCESSOR_C |
1832 #undef DEFINE_BUILTIN_ACCESSOR_A | 1832 #undef DEFINE_BUILTIN_ACCESSOR_A |
1833 | 1833 |
1834 | 1834 |
1835 } } // namespace v8::internal | 1835 } } // namespace v8::internal |
OLD | NEW |