js-intrinsic-lowering.h 3.37 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/compiler/common-operator.h"
10
#include "src/compiler/graph-reducer.h"
11
#include "src/globals.h"
12 13 14

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);
35
  ~JSIntrinsicLowering() final {}
36

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

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

 private:
42
  Reduction ReduceCreateIterResultObject(Node* node);
43
  Reduction ReduceDebugIsActive(Node* node);
44
  Reduction ReduceDeoptimizeNow(Node* node);
45
  Reduction ReduceCreateJSGeneratorObject(Node* node);
46
  Reduction ReduceGeneratorClose(Node* node);
47
  Reduction ReduceGeneratorGetInputOrDebugPos(Node* node);
48 49
  Reduction ReduceAsyncGeneratorReject(Node* node);
  Reduction ReduceAsyncGeneratorResolve(Node* node);
50
  Reduction ReduceAsyncGeneratorYield(Node* node);
51
  Reduction ReduceGeneratorSaveInputForAwait(Node* node);
52
  Reduction ReduceGeneratorGetResumeMode(Node* node);
53
  Reduction ReduceIsInstanceType(Node* node, InstanceType instance_type);
54
  Reduction ReduceIsJSReceiver(Node* node);
55
  Reduction ReduceIsSmi(Node* node);
56 57
  Reduction ReduceRejectPromise(Node* node);
  Reduction ReduceResolvePromise(Node* node);
58 59 60
  Reduction ReduceToInteger(Node* node);
  Reduction ReduceToLength(Node* node);
  Reduction ReduceToNumber(Node* node);
61
  Reduction ReduceToObject(Node* node);
62
  Reduction ReduceToString(Node* node);
63
  Reduction ReduceCall(Node* node);
64
  Reduction ReduceGetSuperConstructor(Node* node);
65

66 67
  // TODO(turbofan): typedarray.js support; drop once TypedArrays are
  // converted to proper CodeStubAssembler based builtins.
68
  Reduction ReduceArrayBufferViewField(Node* node, FieldAccess const& access);
69
  Reduction ReduceArrayBufferViewWasNeutered(Node* node);
70 71
  Reduction ReduceMaxSmi(Node* node);

72 73 74 75
  // TODO(turbofan): collection.js support; drop once Maps and Sets are
  // converted to proper CodeStubAssembler based builtins.
  Reduction ReduceTheHole(Node* node);

76
  Reduction ReduceStringMaxLength(Node* node);
77

78
  Reduction Change(Node* node, const Operator* op);
79
  Reduction Change(Node* node, const Operator* op, Node* a, Node* b);
80
  Reduction Change(Node* node, const Operator* op, Node* a, Node* b, Node* c);
81 82
  Reduction Change(Node* node, const Operator* op, Node* a, Node* b, Node* c,
                   Node* d);
83 84
  Reduction Change(Node* node, Callable const& callable,
                   int stack_parameter_count);
85 86 87

  Graph* graph() const;
  JSGraph* jsgraph() const { return jsgraph_; }
88
  Isolate* isolate() const;
89
  CommonOperatorBuilder* common() const;
90
  JSOperatorBuilder* javascript() const;
91
  SimplifiedOperatorBuilder* simplified() const;
92

93
  JSGraph* const jsgraph_;
94 95 96 97 98 99 100
};

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

#endif  // V8_COMPILER_JS_INTRINSIC_LOWERING_H_