Index: src/api.cc |
diff --git a/src/api.cc b/src/api.cc |
index e6833530041b9794dbd0c63f34e5c6e26d33d0e9..3e019dd020a414561f856c84af7deaf3e1941405 100644 |
--- a/src/api.cc |
+++ b/src/api.cc |
@@ -3193,6 +3193,33 @@ int v8::Object::GetIndexedPropertiesExternalArrayDataLength() { |
} |
+Local<v8::Object> Object::NewInstance(int argc, |
+ v8::Handle<v8::Value> argv[]) const { |
+ i::Isolate* isolate = Utils::OpenHandle(this)->GetIsolate(); |
+ ON_BAILOUT(isolate, "v8::Object::NewInstance()", |
+ return Local<v8::Object>()); |
+ LOG_API(isolate, "Object::NewInstance"); |
+ ENTER_V8(isolate); |
+ HandleScope scope; |
+ i::Handle<i::JSObject> obj = Utils::OpenHandle(this); |
+ STATIC_ASSERT(sizeof(v8::Handle<v8::Value>) == sizeof(i::Object**)); |
+ i::Object*** args = reinterpret_cast<i::Object***>(argv); |
+ EXCEPTION_PREAMBLE(isolate); |
+ i::Handle<i::Object> returned; |
+ if (obj->IsJSFunction()) { |
+ i::Handle<i::JSFunction> function = i::Handle<i::JSFunction>::cast(obj); |
+ returned = i::Execution::New(function, argc, args, &has_pending_exception); |
+ } else { |
+ i::Handle<i::JSFunction> delegate = |
+ i::Handle<i::JSFunction>::cast(i::Execution::GetConstructorDelegate(obj)); |
Mads Ager (chromium)
2011/04/28 12:14:42
Use four space indent here.
|
+ returned = |
+ i::Execution::Call(delegate, obj, argc, args, &has_pending_exception); |
Mads Ager (chromium)
2011/04/28 12:14:42
four space indent instead of two
|
+ } |
+ EXCEPTION_BAILOUT_CHECK(isolate, Local<v8::Object>()); |
+ return scope.Close(Utils::ToLocal(i::Handle<i::JSObject>::cast(returned))); |
+} |
+ |
+ |
Local<v8::Object> Function::NewInstance() const { |
return NewInstance(0, NULL); |
} |