| Index: src/runtime/runtime-debug.cc
|
| diff --git a/src/runtime/runtime-debug.cc b/src/runtime/runtime-debug.cc
|
| index d94c75fa0e135cf11f4d9fe1cd270124eeb891d5..3d6f02f2ea1050b7b8ca08f88a45bc5f4800e8cb 100644
|
| --- a/src/runtime/runtime-debug.cc
|
| +++ b/src/runtime/runtime-debug.cc
|
| @@ -150,29 +150,33 @@
|
| MaybeHandle<JSArray> Runtime::GetInternalProperties(Isolate* isolate,
|
| Handle<Object> object) {
|
| Factory* factory = isolate->factory();
|
| - if (object->IsJSBoundFunction()) {
|
| - Handle<JSBoundFunction> function = Handle<JSBoundFunction>::cast(object);
|
| -
|
| - Handle<FixedArray> result = factory->NewFixedArray(2 * 3);
|
| - Handle<String> target =
|
| - factory->NewStringFromAsciiChecked("[[TargetFunction]]");
|
| - result->set(0, *target);
|
| - result->set(1, function->bound_target_function());
|
| -
|
| - Handle<String> bound_this =
|
| - factory->NewStringFromAsciiChecked("[[BoundThis]]");
|
| - result->set(2, *bound_this);
|
| - result->set(3, function->bound_this());
|
| -
|
| - Handle<String> bound_args =
|
| - factory->NewStringFromAsciiChecked("[[BoundArgs]]");
|
| - result->set(4, *bound_args);
|
| - Handle<FixedArray> bound_arguments =
|
| - factory->CopyFixedArray(handle(function->bound_arguments(), isolate));
|
| - Handle<JSArray> arguments_array =
|
| - factory->NewJSArrayWithElements(bound_arguments);
|
| - result->set(5, *arguments_array);
|
| - return factory->NewJSArrayWithElements(result);
|
| + if (object->IsJSFunction()) {
|
| + Handle<JSFunction> function = Handle<JSFunction>::cast(object);
|
| + if (function->shared()->bound()) {
|
| + RUNTIME_ASSERT_HANDLIFIED(function->function_bindings()->IsFixedArray(),
|
| + JSArray);
|
| +
|
| + Handle<BindingsArray> bindings(function->function_bindings());
|
| +
|
| + Handle<FixedArray> result = factory->NewFixedArray(2 * 3);
|
| + Handle<String> target =
|
| + factory->NewStringFromAsciiChecked("[[TargetFunction]]");
|
| + result->set(0, *target);
|
| + result->set(1, bindings->bound_function());
|
| +
|
| + Handle<String> bound_this =
|
| + factory->NewStringFromAsciiChecked("[[BoundThis]]");
|
| + result->set(2, *bound_this);
|
| + result->set(3, bindings->bound_this());
|
| +
|
| + Handle<String> bound_args =
|
| + factory->NewStringFromAsciiChecked("[[BoundArgs]]");
|
| + result->set(4, *bound_args);
|
| + Handle<JSArray> arguments_array =
|
| + BindingsArray::CreateBoundArguments(bindings);
|
| + result->set(5, *arguments_array);
|
| + return factory->NewJSArrayWithElements(result);
|
| + }
|
| } else if (object->IsJSMapIterator()) {
|
| Handle<JSMapIterator> iterator = Handle<JSMapIterator>::cast(object);
|
| return GetIteratorInternalProperties(isolate, iterator);
|
| @@ -869,18 +873,15 @@
|
|
|
| RUNTIME_FUNCTION(Runtime_GetFunctionScopeCount) {
|
| HandleScope scope(isolate);
|
| - DCHECK_EQ(1, args.length());
|
| + DCHECK(args.length() == 1);
|
|
|
| // Check arguments.
|
| - CONVERT_ARG_HANDLE_CHECKED(JSReceiver, function, 0);
|
| + CONVERT_ARG_HANDLE_CHECKED(JSFunction, fun, 0);
|
|
|
| // Count the visible scopes.
|
| int n = 0;
|
| - if (function->IsJSFunction()) {
|
| - for (ScopeIterator it(isolate, Handle<JSFunction>::cast(function));
|
| - !it.Done(); it.Next()) {
|
| - n++;
|
| - }
|
| + for (ScopeIterator it(isolate, fun); !it.Done(); it.Next()) {
|
| + n++;
|
| }
|
|
|
| return Smi::FromInt(n);
|
| @@ -1467,27 +1468,19 @@
|
|
|
| RUNTIME_FUNCTION(Runtime_FunctionGetInferredName) {
|
| SealHandleScope shs(isolate);
|
| - DCHECK_EQ(1, args.length());
|
| -
|
| - CONVERT_ARG_CHECKED(Object, f, 0);
|
| - if (f->IsJSFunction()) {
|
| - return JSFunction::cast(f)->shared()->inferred_name();
|
| - }
|
| - return isolate->heap()->empty_string();
|
| + DCHECK(args.length() == 1);
|
| +
|
| + CONVERT_ARG_CHECKED(JSFunction, f, 0);
|
| + return f->shared()->inferred_name();
|
| }
|
|
|
|
|
| RUNTIME_FUNCTION(Runtime_FunctionGetDebugName) {
|
| HandleScope scope(isolate);
|
| - DCHECK_EQ(1, args.length());
|
| -
|
| - CONVERT_ARG_HANDLE_CHECKED(JSReceiver, function, 0);
|
| -
|
| - if (function->IsJSBoundFunction()) {
|
| - return Handle<JSBoundFunction>::cast(function)->name();
|
| - }
|
| - Handle<Object> name =
|
| - JSFunction::GetDebugName(Handle<JSFunction>::cast(function));
|
| + DCHECK(args.length() == 1);
|
| +
|
| + CONVERT_ARG_HANDLE_CHECKED(JSFunction, f, 0);
|
| + Handle<Object> name = JSFunction::GetDebugName(f);
|
| return *name;
|
| }
|
|
|
|
|