diff --git a/BUILD.gn b/BUILD.gn index d98a2d2f9f..ca21882169 100644 --- a/BUILD.gn +++ b/BUILD.gn @@ -945,6 +945,7 @@ torque_files = [ "src/builtins/bigint.tq", "src/builtins/boolean.tq", "src/builtins/collections.tq", + "src/builtins/console.tq", "src/builtins/data-view.tq", "src/builtins/frames.tq", "src/builtins/growable-fixed-array.tq", @@ -1464,7 +1465,6 @@ v8_source_set("v8_initializers") { "src/builtins/builtins-call-gen.cc", "src/builtins/builtins-call-gen.h", "src/builtins/builtins-collections-gen.cc", - "src/builtins/builtins-console-gen.cc", "src/builtins/builtins-constructor-gen.cc", "src/builtins/builtins-constructor-gen.h", "src/builtins/builtins-constructor.h", diff --git a/src/builtins/builtins-console-gen.cc b/src/builtins/builtins-console-gen.cc deleted file mode 100644 index 8a4c8b83da..0000000000 --- a/src/builtins/builtins-console-gen.cc +++ /dev/null @@ -1,41 +0,0 @@ -// Copyright 2017 the V8 project authors. All rights reserved. -// Use of this source code is governed by a BSD-style license that can be -// found in the LICENSE file. - -#include "src/builtins/builtins-utils-gen.h" -#include "src/builtins/builtins.h" -#include "src/codegen/code-stub-assembler.h" -#include "src/codegen/macro-assembler.h" -#include "src/execution/frame-constants.h" - -namespace v8 { -namespace internal { - -TF_BUILTIN(FastConsoleAssert, CodeStubAssembler) { - Label runtime(this); - Label out(this); - - TNode argc = - UncheckedCast(Parameter(Descriptor::kJSActualArgumentsCount)); - TNode context = CAST(Parameter(Descriptor::kContext)); - TNode new_target = CAST(Parameter(Descriptor::kJSNewTarget)); - GotoIf(Word32Equal(argc, Int32Constant(0)), &runtime); - - CodeStubArguments args(this, argc); - BranchIfToBooleanIsTrue(args.AtIndex(0), &out, &runtime); - BIND(&out); - args.PopAndReturn(UndefinedConstant()); - - BIND(&runtime); - { - // We are not using Parameter(Descriptor::kJSTarget) and loading the value - // from the current frame here in order to reduce register pressure on the - // fast path. - TNode target = LoadTargetFromFrame(); - TailCallBuiltin(Builtins::kConsoleAssert, context, target, new_target, - argc); - } -} - -} // namespace internal -} // namespace v8 diff --git a/src/builtins/builtins-definitions.h b/src/builtins/builtins-definitions.h index 5532de5aba..b412848f2e 100644 --- a/src/builtins/builtins-definitions.h +++ b/src/builtins/builtins-definitions.h @@ -429,7 +429,6 @@ namespace internal { CPP(ConsoleCount) \ CPP(ConsoleCountReset) \ CPP(ConsoleAssert) \ - TFJ(FastConsoleAssert, SharedFunctionInfo::kDontAdaptArgumentsSentinel) \ CPP(ConsoleProfile) \ CPP(ConsoleProfileEnd) \ CPP(ConsoleTime) \ diff --git a/src/builtins/console.tq b/src/builtins/console.tq new file mode 100644 index 0000000000..dd6769d7e7 --- /dev/null +++ b/src/builtins/console.tq @@ -0,0 +1,18 @@ +// Copyright 2019 the V8 project authors. All rights reserved. +// Use of this source code is governed by a BSD-style license that can be +// found in the LICENSE file. + +namespace console { + extern builtin ConsoleAssert(implicit context: + Context)(JSFunction, JSAny, int32): JSAny; + + javascript builtin FastConsoleAssert( + js-implicit context: Context, receiver: JSAny, newTarget: JSAny, + target: JSFunction)(...arguments): JSAny { + if (ToBoolean(arguments[0])) { + return Undefined; + } else { + tail ConsoleAssert(target, newTarget, Convert(arguments.length)); + } + } +}