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 1249 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
1260 ASSERT(raw_holder->IsJSObject()); | 1260 ASSERT(raw_holder->IsJSObject()); |
1261 | 1261 |
1262 FunctionCallbackArguments custom(isolate, | 1262 FunctionCallbackArguments custom(isolate, |
1263 data_obj, | 1263 data_obj, |
1264 *function, | 1264 *function, |
1265 raw_holder, | 1265 raw_holder, |
1266 &args[0] - 1, | 1266 &args[0] - 1, |
1267 args.length() - 1, | 1267 args.length() - 1, |
1268 is_construct); | 1268 is_construct); |
1269 | 1269 |
1270 v8::Handle<v8::Value> value; | 1270 v8::Handle<v8::Value> value = custom.Call(callback); |
1271 { | |
1272 // Leaving JavaScript. | |
1273 VMState<EXTERNAL> state(isolate); | |
1274 ExternalCallbackScope call_scope(isolate, | |
1275 v8::ToCData<Address>(callback_obj)); | |
1276 value = custom.Call(callback); | |
1277 } | |
1278 if (value.IsEmpty()) { | 1271 if (value.IsEmpty()) { |
1279 result = heap->undefined_value(); | 1272 result = heap->undefined_value(); |
1280 } else { | 1273 } else { |
1281 result = *reinterpret_cast<Object**>(*value); | 1274 result = *reinterpret_cast<Object**>(*value); |
1282 result->VerifyApiCallResultType(); | 1275 result->VerifyApiCallResultType(); |
1283 } | 1276 } |
1284 | 1277 |
1285 RETURN_IF_SCHEDULED_EXCEPTION(isolate); | 1278 RETURN_IF_SCHEDULED_EXCEPTION(isolate); |
1286 if (!is_construct || result->IsJSObject()) return result; | 1279 if (!is_construct || result->IsJSObject()) return result; |
1287 } | 1280 } |
(...skipping 48 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
1336 HandleScope scope(isolate); | 1329 HandleScope scope(isolate); |
1337 LOG(isolate, ApiObjectAccess("call non-function", obj)); | 1330 LOG(isolate, ApiObjectAccess("call non-function", obj)); |
1338 | 1331 |
1339 FunctionCallbackArguments custom(isolate, | 1332 FunctionCallbackArguments custom(isolate, |
1340 call_data->data(), | 1333 call_data->data(), |
1341 constructor, | 1334 constructor, |
1342 obj, | 1335 obj, |
1343 &args[0] - 1, | 1336 &args[0] - 1, |
1344 args.length() - 1, | 1337 args.length() - 1, |
1345 is_construct_call); | 1338 is_construct_call); |
1346 v8::Handle<v8::Value> value; | 1339 v8::Handle<v8::Value> value = custom.Call(callback); |
1347 { | |
1348 // Leaving JavaScript. | |
1349 VMState<EXTERNAL> state(isolate); | |
1350 ExternalCallbackScope call_scope(isolate, | |
1351 v8::ToCData<Address>(callback_obj)); | |
1352 value = custom.Call(callback); | |
1353 } | |
1354 if (value.IsEmpty()) { | 1340 if (value.IsEmpty()) { |
1355 result = heap->undefined_value(); | 1341 result = heap->undefined_value(); |
1356 } else { | 1342 } else { |
1357 result = *reinterpret_cast<Object**>(*value); | 1343 result = *reinterpret_cast<Object**>(*value); |
1358 result->VerifyApiCallResultType(); | 1344 result->VerifyApiCallResultType(); |
1359 } | 1345 } |
1360 } | 1346 } |
1361 // Check for exceptions and return result. | 1347 // Check for exceptions and return result. |
1362 RETURN_IF_SCHEDULED_EXCEPTION(isolate); | 1348 RETURN_IF_SCHEDULED_EXCEPTION(isolate); |
1363 return result; | 1349 return result; |
(...skipping 476 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
1840 return Handle<Code>(code_address); \ | 1826 return Handle<Code>(code_address); \ |
1841 } | 1827 } |
1842 BUILTIN_LIST_C(DEFINE_BUILTIN_ACCESSOR_C) | 1828 BUILTIN_LIST_C(DEFINE_BUILTIN_ACCESSOR_C) |
1843 BUILTIN_LIST_A(DEFINE_BUILTIN_ACCESSOR_A) | 1829 BUILTIN_LIST_A(DEFINE_BUILTIN_ACCESSOR_A) |
1844 BUILTIN_LIST_DEBUG_A(DEFINE_BUILTIN_ACCESSOR_A) | 1830 BUILTIN_LIST_DEBUG_A(DEFINE_BUILTIN_ACCESSOR_A) |
1845 #undef DEFINE_BUILTIN_ACCESSOR_C | 1831 #undef DEFINE_BUILTIN_ACCESSOR_C |
1846 #undef DEFINE_BUILTIN_ACCESSOR_A | 1832 #undef DEFINE_BUILTIN_ACCESSOR_A |
1847 | 1833 |
1848 | 1834 |
1849 } } // namespace v8::internal | 1835 } } // namespace v8::internal |
OLD | NEW |