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/builtins.h" | 5 #include "src/builtins.h" |
6 | 6 |
7 #include "src/api.h" | 7 #include "src/api.h" |
8 #include "src/api-natives.h" | 8 #include "src/api-natives.h" |
9 #include "src/arguments.h" | 9 #include "src/arguments.h" |
10 #include "src/base/once.h" | 10 #include "src/base/once.h" |
(...skipping 1874 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
1885 Object* callback_obj = call_data->callback(); | 1885 Object* callback_obj = call_data->callback(); |
1886 v8::FunctionCallback callback = | 1886 v8::FunctionCallback callback = |
1887 v8::ToCData<v8::FunctionCallback>(callback_obj); | 1887 v8::ToCData<v8::FunctionCallback>(callback_obj); |
1888 Object* data_obj = call_data->data(); | 1888 Object* data_obj = call_data->data(); |
1889 | 1889 |
1890 LOG(isolate, ApiObjectAccess("call", JSObject::cast(*args.receiver()))); | 1890 LOG(isolate, ApiObjectAccess("call", JSObject::cast(*args.receiver()))); |
1891 DCHECK(raw_holder->IsJSObject()); | 1891 DCHECK(raw_holder->IsJSObject()); |
1892 | 1892 |
1893 FunctionCallbackArguments custom(isolate, | 1893 FunctionCallbackArguments custom(isolate, |
1894 data_obj, | 1894 data_obj, |
1895 *function, | |
1896 raw_holder, | 1895 raw_holder, |
1897 &args[0] - 1, | 1896 &args[0] - 1, |
1898 args.length() - 1, | 1897 args.length() - 1, |
1899 is_construct); | 1898 is_construct); |
1900 | 1899 |
1901 v8::Local<v8::Value> value = custom.Call(callback); | 1900 v8::Local<v8::Value> value = custom.Call(callback); |
1902 Handle<Object> result; | 1901 Handle<Object> result; |
1903 if (value.IsEmpty()) { | 1902 if (value.IsEmpty()) { |
1904 result = isolate->factory()->undefined_value(); | 1903 result = isolate->factory()->undefined_value(); |
1905 } else { | 1904 } else { |
(...skipping 142 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
2048 v8::ToCData<v8::FunctionCallback>(callback_obj); | 2047 v8::ToCData<v8::FunctionCallback>(callback_obj); |
2049 | 2048 |
2050 // Get the data for the call and perform the callback. | 2049 // Get the data for the call and perform the callback. |
2051 Object* result; | 2050 Object* result; |
2052 { | 2051 { |
2053 HandleScope scope(isolate); | 2052 HandleScope scope(isolate); |
2054 LOG(isolate, ApiObjectAccess("call non-function", obj)); | 2053 LOG(isolate, ApiObjectAccess("call non-function", obj)); |
2055 | 2054 |
2056 FunctionCallbackArguments custom(isolate, | 2055 FunctionCallbackArguments custom(isolate, |
2057 call_data->data(), | 2056 call_data->data(), |
2058 constructor, | |
2059 obj, | 2057 obj, |
2060 &args[0] - 1, | 2058 &args[0] - 1, |
2061 args.length() - 1, | 2059 args.length() - 1, |
2062 is_construct_call); | 2060 is_construct_call); |
2063 v8::Local<v8::Value> value = custom.Call(callback); | 2061 v8::Local<v8::Value> value = custom.Call(callback); |
2064 if (value.IsEmpty()) { | 2062 if (value.IsEmpty()) { |
2065 result = heap->undefined_value(); | 2063 result = heap->undefined_value(); |
2066 } else { | 2064 } else { |
2067 result = *reinterpret_cast<Object**>(*value); | 2065 result = *reinterpret_cast<Object**>(*value); |
2068 result->VerifyApiCallResultType(); | 2066 result->VerifyApiCallResultType(); |
(...skipping 368 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
2437 BUILTIN_LIST_C(DEFINE_BUILTIN_ACCESSOR_C) | 2435 BUILTIN_LIST_C(DEFINE_BUILTIN_ACCESSOR_C) |
2438 BUILTIN_LIST_A(DEFINE_BUILTIN_ACCESSOR_A) | 2436 BUILTIN_LIST_A(DEFINE_BUILTIN_ACCESSOR_A) |
2439 BUILTIN_LIST_H(DEFINE_BUILTIN_ACCESSOR_H) | 2437 BUILTIN_LIST_H(DEFINE_BUILTIN_ACCESSOR_H) |
2440 BUILTIN_LIST_DEBUG_A(DEFINE_BUILTIN_ACCESSOR_A) | 2438 BUILTIN_LIST_DEBUG_A(DEFINE_BUILTIN_ACCESSOR_A) |
2441 #undef DEFINE_BUILTIN_ACCESSOR_C | 2439 #undef DEFINE_BUILTIN_ACCESSOR_C |
2442 #undef DEFINE_BUILTIN_ACCESSOR_A | 2440 #undef DEFINE_BUILTIN_ACCESSOR_A |
2443 | 2441 |
2444 | 2442 |
2445 } // namespace internal | 2443 } // namespace internal |
2446 } // namespace v8 | 2444 } // namespace v8 |
OLD | NEW |