Index: src/runtime/runtime-function.cc |
diff --git a/src/runtime/runtime-function.cc b/src/runtime/runtime-function.cc |
index 938293b387c7f846c0e1655a48fd91c83fc8b0d5..e29b3c8c5f02f437934e42556e3dfa83029570ae 100644 |
--- a/src/runtime/runtime-function.cc |
+++ b/src/runtime/runtime-function.cc |
@@ -55,11 +55,14 @@ RUNTIME_FUNCTION(Runtime_FunctionGetScript) { |
DCHECK_EQ(1, args.length()); |
CONVERT_ARG_HANDLE_CHECKED(JSReceiver, function, 0); |
- if (function->IsJSBoundFunction()) return isolate->heap()->undefined_value(); |
- Handle<Object> script(Handle<JSFunction>::cast(function)->shared()->script(), |
- isolate); |
- if (!script->IsScript()) return isolate->heap()->undefined_value(); |
- return *Script::GetWrapper(Handle<Script>::cast(script)); |
+ if (function->IsJSFunction()) { |
+ Handle<Object> script( |
+ Handle<JSFunction>::cast(function)->shared()->script(), isolate); |
+ if (script->IsScript()) { |
+ return *Script::GetWrapper(Handle<Script>::cast(script)); |
+ } |
+ } |
+ return isolate->heap()->undefined_value(); |
} |
@@ -67,8 +70,10 @@ RUNTIME_FUNCTION(Runtime_FunctionGetSourceCode) { |
HandleScope scope(isolate); |
DCHECK_EQ(1, args.length()); |
CONVERT_ARG_HANDLE_CHECKED(JSReceiver, function, 0); |
- if (function->IsJSBoundFunction()) return isolate->heap()->undefined_value(); |
- return *Handle<JSFunction>::cast(function)->shared()->GetSourceCode(); |
+ if (function->IsJSFunction()) { |
+ return *Handle<JSFunction>::cast(function)->shared()->GetSourceCode(); |
+ } |
+ return isolate->heap()->undefined_value(); |
} |