2016-04-18 08:28:33 +00:00
|
|
|
// Copyright 2016 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_EFFECT_CONTROL_LINEARIZER_H_
|
|
|
|
#define V8_COMPILER_EFFECT_CONTROL_LINEARIZER_H_
|
|
|
|
|
|
|
|
#include "src/compiler/common-operator.h"
|
|
|
|
#include "src/compiler/node.h"
|
|
|
|
#include "src/compiler/simplified-operator.h"
|
|
|
|
|
|
|
|
namespace v8 {
|
|
|
|
namespace internal {
|
|
|
|
|
|
|
|
class Zone;
|
|
|
|
|
|
|
|
namespace compiler {
|
|
|
|
|
|
|
|
class CommonOperatorBuilder;
|
|
|
|
class SimplifiedOperatorBuilder;
|
|
|
|
class MachineOperatorBuilder;
|
|
|
|
class JSGraph;
|
|
|
|
class Graph;
|
|
|
|
class Schedule;
|
|
|
|
|
|
|
|
class EffectControlLinearizer {
|
|
|
|
public:
|
|
|
|
EffectControlLinearizer(JSGraph* graph, Schedule* schedule, Zone* temp_zone);
|
|
|
|
|
|
|
|
void Run();
|
|
|
|
|
|
|
|
private:
|
2016-06-03 11:37:18 +00:00
|
|
|
void ProcessNode(Node* node, Node** frame_state, Node** effect,
|
|
|
|
Node** control);
|
2016-04-18 08:28:33 +00:00
|
|
|
|
|
|
|
struct ValueEffectControl {
|
|
|
|
Node* value;
|
|
|
|
Node* effect;
|
|
|
|
Node* control;
|
|
|
|
ValueEffectControl(Node* value, Node* effect, Node* control)
|
|
|
|
: value(value), effect(effect), control(control) {}
|
|
|
|
};
|
|
|
|
|
2016-06-03 11:37:18 +00:00
|
|
|
bool TryWireInStateEffect(Node* node, Node* frame_state, Node** effect,
|
|
|
|
Node** control);
|
2016-05-02 10:23:02 +00:00
|
|
|
ValueEffectControl LowerChangeBitToTagged(Node* node, Node* effect,
|
|
|
|
Node* control);
|
|
|
|
ValueEffectControl LowerChangeInt31ToTaggedSigned(Node* node, Node* effect,
|
|
|
|
Node* control);
|
2016-04-18 08:28:33 +00:00
|
|
|
ValueEffectControl LowerChangeInt32ToTagged(Node* node, Node* effect,
|
|
|
|
Node* control);
|
|
|
|
ValueEffectControl LowerChangeUint32ToTagged(Node* node, Node* effect,
|
|
|
|
Node* control);
|
|
|
|
ValueEffectControl LowerChangeFloat64ToTagged(Node* node, Node* effect,
|
|
|
|
Node* control);
|
2016-05-02 10:23:02 +00:00
|
|
|
ValueEffectControl LowerChangeTaggedSignedToInt32(Node* node, Node* effect,
|
|
|
|
Node* control);
|
|
|
|
ValueEffectControl LowerChangeTaggedToBit(Node* node, Node* effect,
|
|
|
|
Node* control);
|
2016-04-25 12:40:46 +00:00
|
|
|
ValueEffectControl LowerChangeTaggedToInt32(Node* node, Node* effect,
|
|
|
|
Node* control);
|
|
|
|
ValueEffectControl LowerChangeTaggedToUint32(Node* node, Node* effect,
|
|
|
|
Node* control);
|
2016-06-15 13:04:36 +00:00
|
|
|
ValueEffectControl LowerCheckBounds(Node* node, Node* frame_state,
|
|
|
|
Node* effect, Node* control);
|
2016-06-28 13:08:26 +00:00
|
|
|
ValueEffectControl LowerCheckNumber(Node* node, Node* frame_state,
|
|
|
|
Node* effect, Node* control);
|
2016-06-30 08:39:49 +00:00
|
|
|
ValueEffectControl LowerCheckIf(Node* node, Node* frame_state, Node* effect,
|
|
|
|
Node* control);
|
2016-06-20 10:46:12 +00:00
|
|
|
ValueEffectControl LowerCheckTaggedPointer(Node* node, Node* frame_state,
|
|
|
|
Node* effect, Node* control);
|
|
|
|
ValueEffectControl LowerCheckTaggedSigned(Node* node, Node* frame_state,
|
|
|
|
Node* effect, Node* control);
|
2016-06-21 15:46:10 +00:00
|
|
|
ValueEffectControl LowerCheckedInt32Add(Node* node, Node* frame_state,
|
|
|
|
Node* effect, Node* control);
|
|
|
|
ValueEffectControl LowerCheckedInt32Sub(Node* node, Node* frame_state,
|
|
|
|
Node* effect, Node* control);
|
2016-07-11 05:27:14 +00:00
|
|
|
ValueEffectControl LowerCheckedInt32Div(Node* node, Node* frame_state,
|
|
|
|
Node* effect, Node* control);
|
|
|
|
ValueEffectControl LowerCheckedInt32Mod(Node* node, Node* frame_state,
|
|
|
|
Node* effect, Node* control);
|
2016-07-13 08:16:35 +00:00
|
|
|
ValueEffectControl LowerCheckedUint32Div(Node* node, Node* frame_state,
|
|
|
|
Node* effect, Node* control);
|
|
|
|
ValueEffectControl LowerCheckedUint32Mod(Node* node, Node* frame_state,
|
|
|
|
Node* effect, Node* control);
|
2016-07-14 13:21:55 +00:00
|
|
|
ValueEffectControl LowerCheckedInt32Mul(Node* node, Node* frame_state,
|
|
|
|
Node* effect, Node* control);
|
2016-06-03 11:37:18 +00:00
|
|
|
ValueEffectControl LowerCheckedUint32ToInt32(Node* node, Node* frame_state,
|
|
|
|
Node* effect, Node* control);
|
|
|
|
ValueEffectControl LowerCheckedFloat64ToInt32(Node* node, Node* frame_state,
|
|
|
|
Node* effect, Node* control);
|
|
|
|
ValueEffectControl LowerCheckedTaggedToInt32(Node* node, Node* frame_state,
|
|
|
|
Node* effect, Node* control);
|
|
|
|
ValueEffectControl LowerCheckedTaggedToFloat64(Node* node, Node* frame_state,
|
|
|
|
Node* effect, Node* control);
|
2016-04-25 12:40:46 +00:00
|
|
|
ValueEffectControl LowerChangeTaggedToFloat64(Node* node, Node* effect,
|
|
|
|
Node* control);
|
2016-05-31 11:59:59 +00:00
|
|
|
ValueEffectControl LowerTruncateTaggedToFloat64(Node* node, Node* effect,
|
|
|
|
Node* control);
|
2016-04-25 12:40:46 +00:00
|
|
|
ValueEffectControl LowerTruncateTaggedToWord32(Node* node, Node* effect,
|
|
|
|
Node* control);
|
2016-04-25 06:12:37 +00:00
|
|
|
ValueEffectControl LowerObjectIsCallable(Node* node, Node* effect,
|
|
|
|
Node* control);
|
|
|
|
ValueEffectControl LowerObjectIsNumber(Node* node, Node* effect,
|
|
|
|
Node* control);
|
|
|
|
ValueEffectControl LowerObjectIsReceiver(Node* node, Node* effect,
|
|
|
|
Node* control);
|
2016-05-02 10:23:02 +00:00
|
|
|
ValueEffectControl LowerObjectIsSmi(Node* node, Node* effect, Node* control);
|
2016-04-25 06:12:37 +00:00
|
|
|
ValueEffectControl LowerObjectIsString(Node* node, Node* effect,
|
|
|
|
Node* control);
|
|
|
|
ValueEffectControl LowerObjectIsUndetectable(Node* node, Node* effect,
|
|
|
|
Node* control);
|
2016-06-02 07:59:29 +00:00
|
|
|
ValueEffectControl LowerStringFromCharCode(Node* node, Node* effect,
|
|
|
|
Node* control);
|
2016-06-15 12:24:10 +00:00
|
|
|
ValueEffectControl LowerCheckFloat64Hole(Node* node, Node* frame_state,
|
|
|
|
Node* effect, Node* control);
|
|
|
|
ValueEffectControl LowerCheckTaggedHole(Node* node, Node* frame_state,
|
|
|
|
Node* effect, Node* control);
|
2016-06-10 07:41:45 +00:00
|
|
|
ValueEffectControl LowerPlainPrimitiveToNumber(Node* node, Node* effect,
|
|
|
|
Node* control);
|
|
|
|
ValueEffectControl LowerPlainPrimitiveToWord32(Node* node, Node* effect,
|
|
|
|
Node* control);
|
|
|
|
ValueEffectControl LowerPlainPrimitiveToFloat64(Node* node, Node* effect,
|
|
|
|
Node* control);
|
2016-07-19 13:38:12 +00:00
|
|
|
ValueEffectControl LowerTransitionElementsKind(Node* node, Node* effect,
|
|
|
|
Node* control);
|
2016-06-10 07:41:45 +00:00
|
|
|
|
2016-04-18 08:28:33 +00:00
|
|
|
ValueEffectControl AllocateHeapNumberWithValue(Node* node, Node* effect,
|
|
|
|
Node* control);
|
2016-06-02 09:20:50 +00:00
|
|
|
ValueEffectControl BuildCheckedFloat64ToInt32(Node* value, Node* frame_state,
|
|
|
|
Node* effect, Node* control);
|
|
|
|
ValueEffectControl BuildCheckedHeapNumberOrOddballToFloat64(Node* value,
|
|
|
|
Node* frame_state,
|
|
|
|
Node* effect,
|
|
|
|
Node* control);
|
2016-06-10 07:41:45 +00:00
|
|
|
|
2016-04-18 08:28:33 +00:00
|
|
|
Node* ChangeInt32ToSmi(Node* value);
|
|
|
|
Node* ChangeUint32ToSmi(Node* value);
|
|
|
|
Node* ChangeInt32ToFloat64(Node* value);
|
|
|
|
Node* ChangeUint32ToFloat64(Node* value);
|
2016-05-02 10:23:02 +00:00
|
|
|
Node* ChangeSmiToInt32(Node* value);
|
|
|
|
Node* ObjectIsSmi(Node* value);
|
2016-04-18 08:28:33 +00:00
|
|
|
|
|
|
|
Node* SmiMaxValueConstant();
|
|
|
|
Node* SmiShiftBitsConstant();
|
|
|
|
|
2016-06-02 07:59:29 +00:00
|
|
|
Factory* factory() const;
|
|
|
|
Isolate* isolate() const;
|
2016-04-18 08:28:33 +00:00
|
|
|
JSGraph* jsgraph() const { return js_graph_; }
|
|
|
|
Graph* graph() const;
|
|
|
|
Schedule* schedule() const { return schedule_; }
|
|
|
|
Zone* temp_zone() const { return temp_zone_; }
|
|
|
|
CommonOperatorBuilder* common() const;
|
|
|
|
SimplifiedOperatorBuilder* simplified() const;
|
|
|
|
MachineOperatorBuilder* machine() const;
|
|
|
|
|
2016-06-10 07:41:45 +00:00
|
|
|
Operator const* ToNumberOperator();
|
|
|
|
|
2016-04-18 08:28:33 +00:00
|
|
|
JSGraph* js_graph_;
|
|
|
|
Schedule* schedule_;
|
|
|
|
Zone* temp_zone_;
|
2016-06-20 10:46:12 +00:00
|
|
|
RegionObservability region_observability_ = RegionObservability::kObservable;
|
2016-06-10 07:41:45 +00:00
|
|
|
|
|
|
|
SetOncePointer<Operator const> to_number_operator_;
|
2016-04-18 08:28:33 +00:00
|
|
|
};
|
|
|
|
|
|
|
|
} // namespace compiler
|
|
|
|
} // namespace internal
|
|
|
|
} // namespace v8
|
|
|
|
|
|
|
|
#endif // V8_COMPILER_EFFECT_CONTROL_LINEARIZER_H_
|