v8
V8 is Google’s open source high-performance JavaScript and WebAssembly engine, written in C++.
Loading...
Searching...
No Matches
select-lowering.cc
Go to the documentation of this file.
1// Copyright 2014 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
6
9#include "src/compiler/node.h"
11
12namespace v8 {
13namespace internal {
14namespace compiler {
15
17 TFGraph* graph)
18 : graph_assembler_(graph_assembler), start_(graph->start()) {}
19
21
23 if (node->opcode() != IrOpcode::kSelect) return NoChange();
24 return LowerSelect(node);
25}
26
27#define __ gasm()->
28
30 SelectParameters const p = SelectParametersOf(node->op());
31
32 Node* condition = node->InputAt(0);
33 Node* vtrue = node->InputAt(1);
34 Node* vfalse = node->InputAt(2);
35
36 bool reset_gasm = false;
37 if (gasm()->control() == nullptr) {
39 reset_gasm = true;
40 }
41
42 auto done = __ MakeLabel(p.representation());
43
44 __ GotoIf(condition, &done, vtrue);
45 __ Goto(&done, vfalse);
46 __ Bind(&done);
47
48 if (reset_gasm) {
49 gasm()->Reset();
50 }
51
52 return Changed(done.PhiAt(0));
53}
54
55#undef __
56
57} // namespace compiler
58} // namespace internal
59} // namespace v8
void InitializeEffectControl(Node *effect, Node *control)
Node * InputAt(int index) const
Definition node.h:70
static Reduction Changed(Node *node)
Reduction Reduce(Node *node) override
SelectLowering(JSGraphAssembler *graph_assembler, TFGraph *graph)
MachineRepresentation representation() const
uint8_t *const start_
Definition assembler.cc:131
int start
SelectParameters const & SelectParametersOf(const Operator *const op)