js-intrinsic-lowering.h 2.38 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/compiler/common-operator.h"
9 10 11 12 13 14 15 16 17 18 19 20 21 22
#include "src/compiler/graph-reducer.h"
#include "src/compiler/simplified-operator.h"

namespace v8 {
namespace internal {
namespace compiler {

// Forward declarations.
class CommonOperatorBuilder;
class JSGraph;
class MachineOperatorBuilder;


// Lowers certain JS-level runtime calls.
23
class JSIntrinsicLowering final : public Reducer {
24 25
 public:
  explicit JSIntrinsicLowering(JSGraph* jsgraph);
26
  ~JSIntrinsicLowering() final {}
27

28
  Reduction Reduce(Node* node) final;
29 30

 private:
31
  Reduction ReduceConstructDouble(Node* node);
32 33
  Reduction ReduceCreateArrayLiteral(Node* node);
  Reduction ReduceCreateObjectLiteral(Node* node);
34 35 36 37
  Reduction ReduceDeoptimizeNow(Node* node);
  Reduction ReduceDoubleHi(Node* node);
  Reduction ReduceDoubleLo(Node* node);
  Reduction ReduceHeapObjectGetMap(Node* node);
38
  Reduction ReduceIncrementStatsCounter(Node* node);
39 40 41 42 43 44 45 46
  Reduction ReduceIsInstanceType(Node* node, InstanceType instance_type);
  Reduction ReduceIsNonNegativeSmi(Node* node);
  Reduction ReduceIsSmi(Node* node);
  Reduction ReduceJSValueGetValue(Node* node);
  Reduction ReduceMapGetInstanceType(Node* node);
  Reduction ReduceMathClz32(Node* node);
  Reduction ReduceMathFloor(Node* node);
  Reduction ReduceMathSqrt(Node* node);
47 48
  Reduction ReduceSeqStringGetChar(Node* node, String::Encoding encoding);
  Reduction ReduceSeqStringSetChar(Node* node, String::Encoding encoding);
49
  Reduction ReduceStringGetLength(Node* node);
50
  Reduction ReduceUnLikely(Node* node, BranchHint hint);
51
  Reduction ReduceValueOf(Node* node);
52 53 54

  Reduction Change(Node* node, const Operator* op);
  Reduction Change(Node* node, const Operator* op, Node* a, Node* b, Node* c);
55
  Reduction ChangeToUndefined(Node* node, Node* effect = nullptr);
56 57 58 59 60 61 62 63 64 65 66 67 68 69 70 71

  Graph* graph() const;
  JSGraph* jsgraph() const { return jsgraph_; }
  CommonOperatorBuilder* common() const;
  MachineOperatorBuilder* machine() const;
  SimplifiedOperatorBuilder* simplified() { return &simplified_; }

  JSGraph* jsgraph_;
  SimplifiedOperatorBuilder simplified_;
};

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

#endif  // V8_COMPILER_JS_INTRINSIC_LOWERING_H_