Index: src/api.cc |
diff --git a/src/api.cc b/src/api.cc |
index aee9e3a469eae454a9fdc7b241142050044a730a..03c40a53d22453809646b272c065875e35cafb2e 100644 |
--- a/src/api.cc |
+++ b/src/api.cc |
@@ -4305,6 +4305,20 @@ int Function::ScriptId() const { |
} |
+Local<v8::Function> Function::GetBoundFunction() const { |
+ i::Handle<i::JSFunction> func = Utils::OpenHandle(this); |
+ if (!func->shared()->bound()) { |
+ return Utils::ToLocal(func); |
+ } |
+ i::Handle<i::FixedArray> bound_args = i::Handle<i::FixedArray>( |
+ i::FixedArray::cast(func->function_bindings())); |
+ i::Handle<i::Object> original( |
+ i::JSReceiver::cast(bound_args->get(i::JSFunction::kBoundFunctionIndex)), |
+ i::Isolate::Current()); |
+ return Utils::ToLocal(i::Handle<i::JSFunction>::cast(original)); |
+} |
+ |
+ |
int String::Length() const { |
i::Handle<i::String> str = Utils::OpenHandle(this); |
return str->length(); |