js-intrinsic-lowering.h 3.32 KB
Newer Older
1 2 3 4 5 6 7
// Copyright 2015 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.

#ifndef V8_COMPILER_JS_INTRINSIC_LOWERING_H_
#define V8_COMPILER_JS_INTRINSIC_LOWERING_H_

8
#include "src/base/compiler-specific.h"
9
#include "src/common/globals.h"
10
#include "src/compiler/common-operator.h"
11 12 13 14
#include "src/compiler/graph-reducer.h"

namespace v8 {
namespace internal {
15 16

// Forward declarations.
17
class Callable;
18 19


20 21 22 23
namespace compiler {

// Forward declarations.
class CommonOperatorBuilder;
24
struct FieldAccess;
25
class JSOperatorBuilder;
26
class JSGraph;
27
class SimplifiedOperatorBuilder;
28 29 30


// Lowers certain JS-level runtime calls.
31 32
class V8_EXPORT_PRIVATE JSIntrinsicLowering final
    : public NON_EXPORTED_BASE(AdvancedReducer) {
33
 public:
34
  JSIntrinsicLowering(Editor* editor, JSGraph* jsgraph, JSHeapBroker* broker);
35
  ~JSIntrinsicLowering() final = default;
36

37 38
  const char* reducer_name() const override { return "JSIntrinsicLowering"; }

39
  Reduction Reduce(Node* node) final;
40 41

 private:
42
  Reduction ReduceCopyDataProperties(Node* node);
43
  Reduction ReduceCreateIterResultObject(Node* node);
44
  Reduction ReduceDeoptimizeNow(Node* node);
45
  Reduction ReduceCreateJSGeneratorObject(Node* node);
46
  Reduction ReduceGeneratorClose(Node* node);
47 48
  Reduction ReduceAsyncFunctionAwaitCaught(Node* node);
  Reduction ReduceAsyncFunctionAwaitUncaught(Node* node);
49 50 51
  Reduction ReduceAsyncFunctionEnter(Node* node);
  Reduction ReduceAsyncFunctionReject(Node* node);
  Reduction ReduceAsyncFunctionResolve(Node* node);
52 53
  Reduction ReduceAsyncGeneratorAwaitCaught(Node* node);
  Reduction ReduceAsyncGeneratorAwaitUncaught(Node* node);
54 55
  Reduction ReduceAsyncGeneratorReject(Node* node);
  Reduction ReduceAsyncGeneratorResolve(Node* node);
56
  Reduction ReduceAsyncGeneratorYield(Node* node);
57
  Reduction ReduceGeneratorGetResumeMode(Node* node);
58
  Reduction ReduceIsInstanceType(Node* node, InstanceType instance_type);
59
  Reduction ReduceIsJSReceiver(Node* node);
60
  Reduction ReduceIsSmi(Node* node);
61
  Reduction ReduceIsBeingInterpreted(Node* node);
62
  Reduction ReduceTurbofanStaticAssert(Node* node);
63
  Reduction ReduceToLength(Node* node);
64
  Reduction ReduceToObject(Node* node);
65
  Reduction ReduceToString(Node* node);
66
  Reduction ReduceCall(Node* node);
67
  Reduction ReduceIncBlockCounter(Node* node);
68 69

  Reduction Change(Node* node, const Operator* op);
70
  Reduction Change(Node* node, const Operator* op, Node* a, Node* b);
71
  Reduction Change(Node* node, const Operator* op, Node* a, Node* b, Node* c);
72 73
  Reduction Change(Node* node, const Operator* op, Node* a, Node* b, Node* c,
                   Node* d);
74 75 76 77 78

  enum FrameStateFlag {
    kNeedsFrameState,
    kDoesNotNeedFrameState,
  };
79
  Reduction Change(Node* node, Callable const& callable,
80 81
                   int stack_parameter_count,
                   enum FrameStateFlag frame_state_flag = kNeedsFrameState);
82 83 84

  Graph* graph() const;
  JSGraph* jsgraph() const { return jsgraph_; }
85
  JSHeapBroker* broker() const { return broker_; }
86
  Isolate* isolate() const;
87
  CommonOperatorBuilder* common() const;
88
  JSOperatorBuilder* javascript() const;
89
  SimplifiedOperatorBuilder* simplified() const;
90

91
  JSGraph* const jsgraph_;
92
  JSHeapBroker* const broker_;
93 94 95 96 97 98 99
};

}  // namespace compiler
}  // namespace internal
}  // namespace v8

#endif  // V8_COMPILER_JS_INTRINSIC_LOWERING_H_