Chromium Code Reviews| Index: src/api.cc |
| diff --git a/src/api.cc b/src/api.cc |
| index 1a521748211bcb72be2c434189b96d0c103dcf79..4a1e22c654e34f8465ebffe4910a46c68e25f457 100644 |
| --- a/src/api.cc |
| +++ b/src/api.cc |
| @@ -3182,6 +3182,38 @@ int v8::Object::GetIndexedPropertiesExternalArrayDataLength() { |
| } |
| +Local<v8::Value> Object::Call(v8::Handle<v8::Object> recv, int argc, |
| + v8::Handle<v8::Value> argv[]) { |
|
Mads Ager (chromium)
2011/04/28 11:53:05
Indentation is off.
|
| + i::Isolate* isolate = Utils::OpenHandle(this)->GetIsolate(); |
| + ON_BAILOUT(isolate, "v8::Object::Call()", return Local<v8::Value>()); |
| + LOG_API(isolate, "Object::Call"); |
| + ENTER_V8(isolate); |
| + i::Object* raw_result = NULL; |
| + { |
| + i::HandleScope scope(isolate); |
| + i::Handle<i::JSObject> obj = Utils::OpenHandle(this); |
| + i::Handle<i::Object> recv_obj = Utils::OpenHandle(*recv); |
| + STATIC_ASSERT(sizeof(v8::Handle<v8::Value>) == sizeof(i::Object**)); |
| + i::Object*** args = reinterpret_cast<i::Object***>(argv); |
| + i::Handle<i::JSFunction> fun; |
| + if (obj->IsJSFunction()) { |
| + fun = i::Handle<i::JSFunction>::cast(obj); |
| + } else { |
| + fun = i::Handle<i::JSFunction>::cast( |
| + i::Execution::GetFunctionDelegate(obj)); |
| + recv_obj = obj; |
| + } |
| + EXCEPTION_PREAMBLE(isolate); |
| + i::Handle<i::Object> returned = |
| + i::Execution::Call(fun, recv_obj, argc, args, &has_pending_exception); |
| + EXCEPTION_BAILOUT_CHECK(isolate, Local<Object>()); |
| + raw_result = *returned; |
|
Mads Ager (chromium)
2011/04/28 11:53:05
Please use return scope.Close instead. That will g
|
| + } |
| + i::Handle<i::Object> result(raw_result); |
| + return Utils::ToLocal(result); |
| +} |
| + |
| + |
| Local<v8::Object> Function::NewInstance() const { |
| return NewInstance(0, NULL); |
| } |