Line data Source code
1 : // Copyright 2017 the V8 project authors. All rights reserved.
2 : // Use of this source code is governed by a BSD-style license that can be
3 : // found in the LICENSE file.
4 :
5 : #include "src/builtins/builtins-utils-gen.h"
6 : #include "src/builtins/builtins.h"
7 : #include "src/code-stub-assembler.h"
8 : #include "src/frame-constants.h"
9 : #include "src/macro-assembler.h"
10 :
11 : namespace v8 {
12 : namespace internal {
13 :
14 224 : TF_BUILTIN(FastConsoleAssert, CodeStubAssembler) {
15 112 : Label runtime(this);
16 56 : Label out(this);
17 :
18 : // TODO(ishell): use constants from Descriptor once the JSFunction linkage
19 : // arguments are reordered.
20 : Node* argc = Parameter(Descriptor::kJSActualArgumentsCount);
21 : Node* context = Parameter(Descriptor::kContext);
22 : Node* new_target = Parameter(Descriptor::kJSNewTarget);
23 168 : GotoIf(Word32Equal(argc, Int32Constant(0)), &runtime);
24 :
25 168 : CodeStubArguments args(this, ChangeInt32ToIntPtr(argc));
26 112 : BranchIfToBooleanIsTrue(args.AtIndex(0), &out, &runtime);
27 56 : BIND(&out);
28 112 : args.PopAndReturn(UndefinedConstant());
29 :
30 56 : BIND(&runtime);
31 : {
32 : // We are not using Parameter(Descriptor::kJSTarget) and loading the value
33 : // from the current frame here in order to reduce register pressure on the
34 : // fast path.
35 56 : TNode<JSFunction> target = LoadTargetFromFrame();
36 56 : TailCallBuiltin(Builtins::kConsoleAssert, context, target, new_target,
37 56 : argc);
38 : }
39 56 : }
40 :
41 : } // namespace internal
42 59480 : } // namespace v8
|