[Torque] port FastConsoleAssert to Torque

Change-Id: Iee27a99a9627d73e10c4c85c31d07a5204808259
Reviewed-on: https://chromium-review.googlesource.com/c/v8/v8/+/1864574
Commit-Queue: Tobias Tebbi <tebbi@chromium.org>
Reviewed-by: Jakob Gruber <jgruber@chromium.org>
Reviewed-by: Tobias Tebbi <tebbi@chromium.org>
Cr-Commit-Position: refs/heads/master@{#64483}
This commit is contained in:
Gus Caplan 2019-10-18 08:56:00 -07:00 committed by Commit Bot
parent 729d5de6a2
commit 7a60f322ef
4 changed files with 19 additions and 43 deletions

View File

@ -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",

View File

@ -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<Int32T> argc =
UncheckedCast<Int32T>(Parameter(Descriptor::kJSActualArgumentsCount));
TNode<Context> context = CAST(Parameter(Descriptor::kContext));
TNode<Object> 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<JSFunction> target = LoadTargetFromFrame();
TailCallBuiltin(Builtins::kConsoleAssert, context, target, new_target,
argc);
}
}
} // namespace internal
} // namespace v8

View File

@ -429,7 +429,6 @@ namespace internal {
CPP(ConsoleCount) \
CPP(ConsoleCountReset) \
CPP(ConsoleAssert) \
TFJ(FastConsoleAssert, SharedFunctionInfo::kDontAdaptArgumentsSentinel) \
CPP(ConsoleProfile) \
CPP(ConsoleProfileEnd) \
CPP(ConsoleTime) \

18
src/builtins/console.tq Normal file
View File

@ -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<int32>(arguments.length));
}
}
}