Index: src/runtime/runtime-function.cc |
diff --git a/src/runtime/runtime-function.cc b/src/runtime/runtime-function.cc |
index 608cc9548423a34543b739c6a6d85e0571200579..62d5513e542782ed8b4d285d1130556e9789f0a1 100644 |
--- a/src/runtime/runtime-function.cc |
+++ b/src/runtime/runtime-function.cc |
@@ -326,6 +326,34 @@ RUNTIME_FUNCTION(Runtime_SetNativeFlag) { |
} |
+RUNTIME_FUNCTION(Runtime_IsConstructor) { |
+ HandleScope handles(isolate); |
+ RUNTIME_ASSERT(args.length() == 1); |
+ |
+ CONVERT_ARG_HANDLE_CHECKED(Object, object, 0); |
+ |
+ // TODO(caitp): implement this in a better/simpler way, allow inlining via TF |
+ if (object->IsJSFunction()) { |
+ Handle<JSFunction> func = Handle<JSFunction>::cast(object); |
+ bool should_have_prototype = func->should_have_prototype(); |
+ if (func->shared()->bound()) { |
+ Handle<FixedArray> bound_args = |
+ Handle<FixedArray>(FixedArray::cast(func->function_bindings())); |
+ Handle<Object> bound_function( |
+ JSReceiver::cast(bound_args->get(JSFunction::kBoundFunctionIndex)), |
+ isolate); |
+ if (bound_function->IsJSFunction()) { |
+ Handle<JSFunction> bound = Handle<JSFunction>::cast(bound_function); |
+ DCHECK(!bound->shared()->bound()); |
+ should_have_prototype = bound->should_have_prototype(); |
+ } |
+ } |
+ return isolate->heap()->ToBoolean(should_have_prototype); |
+ } |
+ return isolate->heap()->false_value(); |
+} |
+ |
+ |
RUNTIME_FUNCTION(Runtime_SetInlineBuiltinFlag) { |
SealHandleScope shs(isolate); |
RUNTIME_ASSERT(args.length() == 1); |