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"
|
2017-01-02 15:50:55 +00:00
|
|
|
#include "src/compiler/graph-assembler.h"
|
2016-04-18 08:28:33 +00:00
|
|
|
#include "src/compiler/node.h"
|
|
|
|
#include "src/compiler/simplified-operator.h"
|
2016-10-17 10:01:42 +00:00
|
|
|
#include "src/globals.h"
|
2016-04-18 08:28:33 +00:00
|
|
|
|
|
|
|
namespace v8 {
|
|
|
|
namespace internal {
|
|
|
|
|
2016-09-27 11:24:07 +00:00
|
|
|
// Forward declarations.
|
|
|
|
class Callable;
|
2016-04-18 08:28:33 +00:00
|
|
|
class Zone;
|
|
|
|
|
|
|
|
namespace compiler {
|
|
|
|
|
|
|
|
class CommonOperatorBuilder;
|
|
|
|
class SimplifiedOperatorBuilder;
|
|
|
|
class MachineOperatorBuilder;
|
|
|
|
class JSGraph;
|
|
|
|
class Graph;
|
|
|
|
class Schedule;
|
2016-11-16 15:06:05 +00:00
|
|
|
class SourcePositionTable;
|
2016-04-18 08:28:33 +00:00
|
|
|
|
2016-10-17 10:01:42 +00:00
|
|
|
class V8_EXPORT_PRIVATE EffectControlLinearizer {
|
2016-04-18 08:28:33 +00:00
|
|
|
public:
|
2016-11-16 15:06:05 +00:00
|
|
|
EffectControlLinearizer(JSGraph* graph, Schedule* schedule, Zone* temp_zone,
|
|
|
|
SourcePositionTable* source_positions);
|
2016-04-18 08:28:33 +00:00
|
|
|
|
|
|
|
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
|
|
|
|
2016-06-03 11:37:18 +00:00
|
|
|
bool TryWireInStateEffect(Node* node, Node* frame_state, Node** effect,
|
|
|
|
Node** control);
|
2017-01-02 15:50:55 +00:00
|
|
|
Node* LowerChangeBitToTagged(Node* node);
|
|
|
|
Node* LowerChangeInt31ToTaggedSigned(Node* node);
|
|
|
|
Node* LowerChangeInt32ToTagged(Node* node);
|
|
|
|
Node* LowerChangeUint32ToTagged(Node* node);
|
|
|
|
Node* LowerChangeFloat64ToTagged(Node* node);
|
|
|
|
Node* LowerChangeFloat64ToTaggedPointer(Node* node);
|
|
|
|
Node* LowerChangeTaggedSignedToInt32(Node* node);
|
|
|
|
Node* LowerChangeTaggedToBit(Node* node);
|
|
|
|
Node* LowerChangeTaggedToInt32(Node* node);
|
|
|
|
Node* LowerChangeTaggedToUint32(Node* node);
|
2017-01-31 08:55:56 +00:00
|
|
|
Node* LowerChangeTaggedToTaggedSigned(Node* node);
|
2017-01-02 15:50:55 +00:00
|
|
|
Node* LowerCheckBounds(Node* node, Node* frame_state);
|
|
|
|
Node* LowerCheckInternalizedString(Node* node, Node* frame_state);
|
|
|
|
Node* LowerCheckMaps(Node* node, Node* frame_state);
|
|
|
|
Node* LowerCheckNumber(Node* node, Node* frame_state);
|
2017-01-18 07:10:51 +00:00
|
|
|
Node* LowerCheckReceiver(Node* node, Node* frame_state);
|
2017-01-02 15:50:55 +00:00
|
|
|
Node* LowerCheckString(Node* node, Node* frame_state);
|
2017-05-22 12:07:40 +00:00
|
|
|
Node* LowerCheckSymbol(Node* node, Node* frame_state);
|
2017-01-02 15:50:55 +00:00
|
|
|
Node* LowerCheckIf(Node* node, Node* frame_state);
|
|
|
|
Node* LowerCheckedInt32Add(Node* node, Node* frame_state);
|
|
|
|
Node* LowerCheckedInt32Sub(Node* node, Node* frame_state);
|
|
|
|
Node* LowerCheckedInt32Div(Node* node, Node* frame_state);
|
|
|
|
Node* LowerCheckedInt32Mod(Node* node, Node* frame_state);
|
|
|
|
Node* LowerCheckedUint32Div(Node* node, Node* frame_state);
|
|
|
|
Node* LowerCheckedUint32Mod(Node* node, Node* frame_state);
|
|
|
|
Node* LowerCheckedInt32Mul(Node* node, Node* frame_state);
|
|
|
|
Node* LowerCheckedInt32ToTaggedSigned(Node* node, Node* frame_state);
|
|
|
|
Node* LowerCheckedUint32ToInt32(Node* node, Node* frame_state);
|
|
|
|
Node* LowerCheckedUint32ToTaggedSigned(Node* node, Node* frame_state);
|
|
|
|
Node* LowerCheckedFloat64ToInt32(Node* node, Node* frame_state);
|
|
|
|
Node* LowerCheckedTaggedSignedToInt32(Node* node, Node* frame_state);
|
|
|
|
Node* LowerCheckedTaggedToInt32(Node* node, Node* frame_state);
|
|
|
|
Node* LowerCheckedTaggedToFloat64(Node* node, Node* frame_state);
|
|
|
|
Node* LowerCheckedTaggedToTaggedSigned(Node* node, Node* frame_state);
|
|
|
|
Node* LowerCheckedTaggedToTaggedPointer(Node* node, Node* frame_state);
|
|
|
|
Node* LowerChangeTaggedToFloat64(Node* node);
|
|
|
|
Node* LowerTruncateTaggedToBit(Node* node);
|
2017-03-07 10:11:16 +00:00
|
|
|
Node* LowerTruncateTaggedPointerToBit(Node* node);
|
2017-01-02 15:50:55 +00:00
|
|
|
Node* LowerTruncateTaggedToFloat64(Node* node);
|
|
|
|
Node* LowerTruncateTaggedToWord32(Node* node);
|
|
|
|
Node* LowerCheckedTruncateTaggedToWord32(Node* node, Node* frame_state);
|
2017-02-18 12:43:37 +00:00
|
|
|
Node* LowerObjectIsDetectableCallable(Node* node);
|
2017-03-03 09:08:14 +00:00
|
|
|
Node* LowerObjectIsNaN(Node* node);
|
2017-01-19 13:16:27 +00:00
|
|
|
Node* LowerObjectIsNonCallable(Node* node);
|
2017-01-02 15:50:55 +00:00
|
|
|
Node* LowerObjectIsNumber(Node* node);
|
|
|
|
Node* LowerObjectIsReceiver(Node* node);
|
|
|
|
Node* LowerObjectIsSmi(Node* node);
|
|
|
|
Node* LowerObjectIsString(Node* node);
|
2017-03-14 16:14:58 +00:00
|
|
|
Node* LowerObjectIsSymbol(Node* node);
|
2017-01-02 15:50:55 +00:00
|
|
|
Node* LowerObjectIsUndetectable(Node* node);
|
2017-02-28 11:16:27 +00:00
|
|
|
Node* LowerArgumentsFrame(Node* node);
|
|
|
|
Node* LowerArgumentsLength(Node* node);
|
2017-01-02 15:50:55 +00:00
|
|
|
Node* LowerNewUnmappedArgumentsElements(Node* node);
|
|
|
|
Node* LowerArrayBufferWasNeutered(Node* node);
|
|
|
|
Node* LowerStringCharAt(Node* node);
|
|
|
|
Node* LowerStringCharCodeAt(Node* node);
|
|
|
|
Node* LowerStringFromCharCode(Node* node);
|
|
|
|
Node* LowerStringFromCodePoint(Node* node);
|
2017-01-27 12:02:42 +00:00
|
|
|
Node* LowerStringIndexOf(Node* node);
|
2017-01-02 15:50:55 +00:00
|
|
|
Node* LowerStringEqual(Node* node);
|
|
|
|
Node* LowerStringLessThan(Node* node);
|
|
|
|
Node* LowerStringLessThanOrEqual(Node* node);
|
|
|
|
Node* LowerCheckFloat64Hole(Node* node, Node* frame_state);
|
|
|
|
Node* LowerCheckTaggedHole(Node* node, Node* frame_state);
|
|
|
|
Node* LowerConvertTaggedHoleToUndefined(Node* node);
|
|
|
|
Node* LowerPlainPrimitiveToNumber(Node* node);
|
|
|
|
Node* LowerPlainPrimitiveToWord32(Node* node);
|
|
|
|
Node* LowerPlainPrimitiveToFloat64(Node* node);
|
|
|
|
Node* LowerEnsureWritableFastElements(Node* node);
|
|
|
|
Node* LowerMaybeGrowFastElements(Node* node, Node* frame_state);
|
|
|
|
void LowerTransitionElementsKind(Node* node);
|
|
|
|
Node* LowerLoadTypedElement(Node* node);
|
|
|
|
void LowerStoreTypedElement(Node* node);
|
2016-06-10 07:41:45 +00:00
|
|
|
|
2016-08-05 10:05:49 +00:00
|
|
|
// Lowering of optional operators.
|
2017-01-02 15:50:55 +00:00
|
|
|
Maybe<Node*> LowerFloat64RoundUp(Node* node);
|
|
|
|
Maybe<Node*> LowerFloat64RoundDown(Node* node);
|
|
|
|
Maybe<Node*> LowerFloat64RoundTiesEven(Node* node);
|
|
|
|
Maybe<Node*> LowerFloat64RoundTruncate(Node* node);
|
|
|
|
|
|
|
|
Node* AllocateHeapNumberWithValue(Node* node);
|
|
|
|
Node* BuildCheckedFloat64ToInt32(CheckForMinusZeroMode mode, Node* value,
|
|
|
|
Node* frame_state);
|
|
|
|
Node* BuildCheckedHeapNumberOrOddballToFloat64(CheckTaggedInputMode mode,
|
|
|
|
Node* value,
|
|
|
|
Node* frame_state);
|
|
|
|
Node* BuildFloat64RoundDown(Node* value);
|
|
|
|
Node* LowerStringComparison(Callable const& callable, Node* node);
|
2016-06-10 07:41:45 +00:00
|
|
|
|
2016-04-18 08:28:33 +00:00
|
|
|
Node* ChangeInt32ToSmi(Node* value);
|
|
|
|
Node* ChangeUint32ToSmi(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;
|
|
|
|
|
2017-01-02 15:50:55 +00:00
|
|
|
GraphAssembler* gasm() { return &graph_assembler_; }
|
2016-06-10 07:41:45 +00:00
|
|
|
|
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-11-16 15:06:05 +00:00
|
|
|
SourcePositionTable* source_positions_;
|
2017-01-02 15:50:55 +00:00
|
|
|
GraphAssembler graph_assembler_;
|
2017-04-20 14:27:57 +00:00
|
|
|
Node* frame_state_zapper_; // For tracking down compiler::Node::New crashes.
|
2016-04-18 08:28:33 +00:00
|
|
|
};
|
|
|
|
|
|
|
|
} // namespace compiler
|
|
|
|
} // namespace internal
|
|
|
|
} // namespace v8
|
|
|
|
|
|
|
|
#endif // V8_COMPILER_EFFECT_CONTROL_LINEARIZER_H_
|