| Index: src/x64/lithium-x64.h
|
| ===================================================================
|
| --- src/x64/lithium-x64.h (revision 7006)
|
| +++ src/x64/lithium-x64.h (working copy)
|
| @@ -39,119 +39,8 @@
|
| // Forward declarations.
|
| class LCodeGen;
|
|
|
| -
|
| -// Type hierarchy:
|
| -//
|
| -// LInstruction
|
| -// LTemplateInstruction
|
| -// LControlInstruction
|
| -// LBranch
|
| -// LClassOfTestAndBranch
|
| -// LCmpJSObjectEqAndBranch
|
| -// LCmpIDAndBranch
|
| -// LHasCachedArrayIndexAndBranch
|
| -// LHasInstanceTypeAndBranch
|
| -// LInstanceOfAndBranch
|
| -// LIsNullAndBranch
|
| -// LIsObjectAndBranch
|
| -// LIsSmiAndBranch
|
| -// LTypeofIsAndBranch
|
| -// LAccessArgumentsAt
|
| -// LArgumentsElements
|
| -// LArgumentsLength
|
| -// LAddI
|
| -// LApplyArguments
|
| -// LArithmeticD
|
| -// LArithmeticT
|
| -// LBitI
|
| -// LBoundsCheck
|
| -// LCmpID
|
| -// LCmpJSObjectEq
|
| -// LCmpT
|
| -// LDivI
|
| -// LInstanceOf
|
| -// LInstanceOfKnownGlobal
|
| -// LLoadKeyedFastElement
|
| -// LLoadKeyedGeneric
|
| -// LModI
|
| -// LMulI
|
| -// LPower
|
| -// LShiftI
|
| -// LSubI
|
| -// LCallConstantFunction
|
| -// LCallFunction
|
| -// LCallGlobal
|
| -// LCallKeyed
|
| -// LCallKnownGlobal
|
| -// LCallNamed
|
| -// LCallRuntime
|
| -// LCallStub
|
| -// LConstant
|
| -// LConstantD
|
| -// LConstantI
|
| -// LConstantT
|
| -// LDeoptimize
|
| -// LFunctionLiteral
|
| -// LGap
|
| -// LLabel
|
| -// LGlobalObject
|
| -// LGlobalReceiver
|
| -// LGoto
|
| -// LLazyBailout
|
| -// LLoadGlobal
|
| -// LCheckPrototypeMaps
|
| -// LLoadContextSlot
|
| -// LArrayLiteral
|
| -// LObjectLiteral
|
| -// LRegExpLiteral
|
| -// LOsrEntry
|
| -// LParameter
|
| -// LRegExpConstructResult
|
| -// LStackCheck
|
| -// LStoreKeyed
|
| -// LStoreKeyedFastElement
|
| -// LStoreKeyedGeneric
|
| -// LStoreNamed
|
| -// LStoreNamedField
|
| -// LStoreNamedGeneric
|
| -// LBitNotI
|
| -// LCallNew
|
| -// LCheckFunction
|
| -// LCheckPrototypeMaps
|
| -// LCheckInstanceType
|
| -// LCheckMap
|
| -// LCheckSmi
|
| -// LClassOfTest
|
| -// LDeleteProperty
|
| -// LDoubleToI
|
| -// LFixedArrayLength
|
| -// LHasCachedArrayIndex
|
| -// LHasInstanceType
|
| -// LInteger32ToDouble
|
| -// LIsNull
|
| -// LIsObject
|
| -// LIsSmi
|
| -// LJSArrayLength
|
| -// LLoadNamedField
|
| -// LLoadNamedGeneric
|
| -// LLoadFunctionPrototype
|
| -// LNumberTagD
|
| -// LNumberTagI
|
| -// LPushArgument
|
| -// LReturn
|
| -// LSmiTag
|
| -// LStoreGlobal
|
| -// LTaggedToI
|
| -// LThrow
|
| -// LTypeof
|
| -// LTypeofIs
|
| -// LUnaryMathOperation
|
| -// LValueOf
|
| -// LUnknownOSRValue
|
| -
|
| #define LITHIUM_ALL_INSTRUCTION_LIST(V) \
|
| V(ControlInstruction) \
|
| - V(Constant) \
|
| V(Call) \
|
| V(StoreKeyed) \
|
| V(StoreNamed) \
|
| @@ -259,6 +148,8 @@
|
| V(Typeof) \
|
| V(TypeofIs) \
|
| V(TypeofIsAndBranch) \
|
| + V(IsConstructCall) \
|
| + V(IsConstructCallAndBranch) \
|
| V(UnaryMathOperation) \
|
| V(UnknownOSRValue) \
|
| V(ValueOf)
|
| @@ -287,7 +178,11 @@
|
| class LInstruction: public ZoneObject {
|
| public:
|
| LInstruction()
|
| - : hydrogen_value_(NULL) { }
|
| + : environment_(NULL),
|
| + hydrogen_value_(NULL),
|
| + is_call_(false),
|
| + is_save_doubles_(false) { }
|
| +
|
| virtual ~LInstruction() { }
|
|
|
| virtual void CompileToNative(LCodeGen* generator) = 0;
|
| @@ -304,16 +199,14 @@
|
| virtual bool IsControl() const { return false; }
|
| virtual void SetBranchTargets(int true_block_id, int false_block_id) { }
|
|
|
| - void set_environment(LEnvironment* env) { environment_.set(env); }
|
| - LEnvironment* environment() const { return environment_.get(); }
|
| - bool HasEnvironment() const { return environment_.is_set(); }
|
| + void set_environment(LEnvironment* env) { environment_ = env; }
|
| + LEnvironment* environment() const { return environment_; }
|
| + bool HasEnvironment() const { return environment_ != NULL; }
|
|
|
| void set_pointer_map(LPointerMap* p) { pointer_map_.set(p); }
|
| LPointerMap* pointer_map() const { return pointer_map_.get(); }
|
| bool HasPointerMap() const { return pointer_map_.is_set(); }
|
|
|
| - virtual bool HasResult() const = 0;
|
| -
|
| void set_hydrogen_value(HValue* value) { hydrogen_value_ = value; }
|
| HValue* hydrogen_value() const { return hydrogen_value_; }
|
|
|
| @@ -327,11 +220,35 @@
|
| return deoptimization_environment_.is_set();
|
| }
|
|
|
| + void MarkAsCall() { is_call_ = true; }
|
| + void MarkAsSaveDoubles() { is_save_doubles_ = true; }
|
| +
|
| + // Interface to the register allocator and iterators.
|
| + bool IsMarkedAsCall() const { return is_call_; }
|
| + bool IsMarkedAsSaveDoubles() const { return is_save_doubles_; }
|
| +
|
| + virtual bool HasResult() const = 0;
|
| + virtual LOperand* result() = 0;
|
| +
|
| + virtual int InputCount() = 0;
|
| + virtual LOperand* InputAt(int i) = 0;
|
| + virtual int TempCount() = 0;
|
| + virtual LOperand* TempAt(int i) = 0;
|
| +
|
| + LOperand* FirstInput() { return InputAt(0); }
|
| + LOperand* Output() { return HasResult() ? result() : NULL; }
|
| +
|
| +#ifdef DEBUG
|
| + void VerifyCall();
|
| +#endif
|
| +
|
| private:
|
| - SetOncePointer<LEnvironment> environment_;
|
| + LEnvironment* environment_;
|
| SetOncePointer<LPointerMap> pointer_map_;
|
| HValue* hydrogen_value_;
|
| SetOncePointer<LEnvironment> deoptimization_environment_;
|
| + bool is_call_;
|
| + bool is_save_doubles_;
|
| };
|
|
|
|
|
| @@ -358,6 +275,11 @@
|
| public:
|
| int length() { return 0; }
|
| void PrintOperandsTo(StringStream* stream) { }
|
| + ElementType& operator[](int i) {
|
| + UNREACHABLE();
|
| + static ElementType t = 0;
|
| + return t;
|
| + }
|
| };
|
|
|
|
|
| @@ -617,12 +539,11 @@
|
| };
|
|
|
|
|
| -class LMulI: public LTemplateInstruction<1, 2, 1> {
|
| +class LMulI: public LTemplateInstruction<1, 2, 0> {
|
| public:
|
| - LMulI(LOperand* left, LOperand* right, LOperand* temp) {
|
| + LMulI(LOperand* left, LOperand* right) {
|
| inputs_[0] = left;
|
| inputs_[1] = right;
|
| - temps_[0] = temp;
|
| }
|
|
|
| DECLARE_CONCRETE_INSTRUCTION(MulI, "mul-i")
|
| @@ -982,47 +903,33 @@
|
| };
|
|
|
|
|
| -template <int temp_count>
|
| -class LConstant: public LTemplateInstruction<1, 0, temp_count> {
|
| - DECLARE_INSTRUCTION(Constant)
|
| -};
|
| -
|
| -
|
| -class LConstantI: public LConstant<0> {
|
| +class LConstantI: public LTemplateInstruction<1, 0, 0> {
|
| public:
|
| - explicit LConstantI(int32_t value) : value_(value) { }
|
| - int32_t value() const { return value_; }
|
| -
|
| DECLARE_CONCRETE_INSTRUCTION(ConstantI, "constant-i")
|
| + DECLARE_HYDROGEN_ACCESSOR(Constant)
|
|
|
| - private:
|
| - int32_t value_;
|
| + int32_t value() const { return hydrogen()->Integer32Value(); }
|
| };
|
|
|
|
|
| -class LConstantD: public LConstant<1> {
|
| +class LConstantD: public LTemplateInstruction<1, 0, 1> {
|
| public:
|
| - explicit LConstantD(double value, LOperand* temp) : value_(value) {
|
| + explicit LConstantD(LOperand* temp) {
|
| temps_[0] = temp;
|
| }
|
| - double value() const { return value_; }
|
| -
|
| DECLARE_CONCRETE_INSTRUCTION(ConstantD, "constant-d")
|
| + DECLARE_HYDROGEN_ACCESSOR(Constant)
|
|
|
| - private:
|
| - double value_;
|
| + double value() const { return hydrogen()->DoubleValue(); }
|
| };
|
|
|
|
|
| -class LConstantT: public LConstant<0> {
|
| +class LConstantT: public LTemplateInstruction<1, 0, 0> {
|
| public:
|
| - explicit LConstantT(Handle<Object> value) : value_(value) { }
|
| - Handle<Object> value() const { return value_; }
|
| -
|
| DECLARE_CONCRETE_INSTRUCTION(ConstantT, "constant-t")
|
| + DECLARE_HYDROGEN_ACCESSOR(Constant)
|
|
|
| - private:
|
| - Handle<Object> value_;
|
| + Handle<Object> value() const { return hydrogen()->handle(); }
|
| };
|
|
|
|
|
| @@ -1269,10 +1176,11 @@
|
| };
|
|
|
|
|
| -class LStoreGlobal: public LTemplateInstruction<0, 1, 0> {
|
| +class LStoreGlobal: public LTemplateInstruction<0, 1, 1> {
|
| public:
|
| - explicit LStoreGlobal(LOperand* value) {
|
| + explicit LStoreGlobal(LOperand* value, LOperand* temp) {
|
| inputs_[0] = value;
|
| + temps_[0] = temp;
|
| }
|
|
|
| DECLARE_CONCRETE_INSTRUCTION(StoreGlobal, "store-global")
|
| @@ -1280,12 +1188,16 @@
|
| };
|
|
|
|
|
| -class LLoadContextSlot: public LTemplateInstruction<1, 0, 0> {
|
| +class LLoadContextSlot: public LTemplateInstruction<1, 1, 0> {
|
| public:
|
| + explicit LLoadContextSlot(LOperand* context) {
|
| + inputs_[0] = context;
|
| + }
|
| +
|
| DECLARE_CONCRETE_INSTRUCTION(LoadContextSlot, "load-context-slot")
|
| DECLARE_HYDROGEN_ACCESSOR(LoadContextSlot)
|
|
|
| - int context_chain_length() { return hydrogen()->context_chain_length(); }
|
| + LOperand* context() { return InputAt(0); }
|
| int slot_index() { return hydrogen()->slot_index(); }
|
|
|
| virtual void PrintDataTo(StringStream* stream);
|
| @@ -1602,11 +1514,10 @@
|
| };
|
|
|
|
|
| -class LCheckInstanceType: public LTemplateInstruction<0, 1, 1> {
|
| +class LCheckInstanceType: public LTemplateInstruction<0, 1, 0> {
|
| public:
|
| - LCheckInstanceType(LOperand* value, LOperand* temp) {
|
| + explicit LCheckInstanceType(LOperand* value) {
|
| inputs_[0] = value;
|
| - temps_[0] = temp;
|
| }
|
|
|
| DECLARE_CONCRETE_INSTRUCTION(CheckInstanceType, "check-instance-type")
|
| @@ -1728,6 +1639,24 @@
|
| };
|
|
|
|
|
| +class LIsConstructCall: public LTemplateInstruction<1, 0, 0> {
|
| + public:
|
| + DECLARE_CONCRETE_INSTRUCTION(IsConstructCall, "is-construct-call")
|
| + DECLARE_HYDROGEN_ACCESSOR(IsConstructCall)
|
| +};
|
| +
|
| +
|
| +class LIsConstructCallAndBranch: public LControlInstruction<0, 1> {
|
| + public:
|
| + explicit LIsConstructCallAndBranch(LOperand* temp) {
|
| + temps_[0] = temp;
|
| + }
|
| +
|
| + DECLARE_CONCRETE_INSTRUCTION(IsConstructCallAndBranch,
|
| + "is-construct-call-and-branch")
|
| +};
|
| +
|
| +
|
| class LDeleteProperty: public LTemplateInstruction<1, 2, 0> {
|
| public:
|
| LDeleteProperty(LOperand* obj, LOperand* key) {
|
| @@ -1781,7 +1710,7 @@
|
| pointer_maps_(8),
|
| inlined_closures_(1) { }
|
|
|
| - int AddInstruction(LInstruction* instruction, HBasicBlock* block);
|
| + void AddInstruction(LInstruction* instruction, HBasicBlock* block);
|
| LConstantOperand* DefineConstantOperand(HConstant* constant);
|
| Handle<Object> LookupLiteral(LConstantOperand* operand) const;
|
| Representation LookupLiteralRepresentation(LConstantOperand* operand) const;
|
| @@ -1847,7 +1776,7 @@
|
| argument_count_(0),
|
| allocator_(allocator),
|
| position_(RelocInfo::kNoPosition),
|
| - instructions_pending_deoptimization_environment_(NULL),
|
| + instruction_pending_deoptimization_environment_(NULL),
|
| pending_deoptimization_ast_id_(AstNode::kNoNumber) { }
|
|
|
| // Build the sequence for the graph.
|
| @@ -1981,7 +1910,7 @@
|
| int argument_count_;
|
| LAllocator* allocator_;
|
| int position_;
|
| - LInstruction* instructions_pending_deoptimization_environment_;
|
| + LInstruction* instruction_pending_deoptimization_environment_;
|
| int pending_deoptimization_ast_id_;
|
|
|
| DISALLOW_COPY_AND_ASSIGN(LChunkBuilder);
|
|
|