| Index: src/ia32/lithium-ia32.h
|
| ===================================================================
|
| --- src/ia32/lithium-ia32.h (revision 7006)
|
| +++ src/ia32/lithium-ia32.h (working copy)
|
| @@ -39,121 +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
|
| -// LStringCharCodeAt
|
| -// 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
|
| -// LStringLength
|
| -// LTaggedToI
|
| -// LThrow
|
| -// LTypeof
|
| -// LTypeofIs
|
| -// LUnaryMathOperation
|
| -// LValueOf
|
| -// LUnknownOSRValue
|
| -
|
| #define LITHIUM_ALL_INSTRUCTION_LIST(V) \
|
| V(ControlInstruction) \
|
| - V(Constant) \
|
| V(Call) \
|
| V(StoreKeyed) \
|
| V(StoreNamed) \
|
| @@ -187,6 +74,8 @@
|
| V(CheckMap) \
|
| V(CheckPrototypeMaps) \
|
| V(CheckSmi) \
|
| + V(ClassOfTest) \
|
| + V(ClassOfTestAndBranch) \
|
| V(CmpID) \
|
| V(CmpIDAndBranch) \
|
| V(CmpJSObjectEq) \
|
| @@ -197,16 +86,21 @@
|
| V(ConstantD) \
|
| V(ConstantI) \
|
| V(ConstantT) \
|
| + V(Context) \
|
| V(DeleteProperty) \
|
| V(Deoptimize) \
|
| V(DivI) \
|
| V(DoubleToI) \
|
| + V(FixedArrayLength) \
|
| V(FunctionLiteral) \
|
| V(Gap) \
|
| V(GlobalObject) \
|
| V(GlobalReceiver) \
|
| V(Goto) \
|
| - V(FixedArrayLength) \
|
| + V(HasCachedArrayIndex) \
|
| + V(HasCachedArrayIndexAndBranch) \
|
| + V(HasInstanceType) \
|
| + V(HasInstanceTypeAndBranch) \
|
| V(InstanceOf) \
|
| V(InstanceOfAndBranch) \
|
| V(InstanceOfKnownGlobal) \
|
| @@ -217,23 +111,19 @@
|
| V(IsObjectAndBranch) \
|
| V(IsSmi) \
|
| V(IsSmiAndBranch) \
|
| + V(IsConstructCall) \
|
| + V(IsConstructCallAndBranch) \
|
| V(JSArrayLength) \
|
| - V(HasInstanceType) \
|
| - V(HasInstanceTypeAndBranch) \
|
| - V(HasCachedArrayIndex) \
|
| - V(HasCachedArrayIndexAndBranch) \
|
| - V(ClassOfTest) \
|
| - V(ClassOfTestAndBranch) \
|
| V(Label) \
|
| V(LazyBailout) \
|
| V(LoadContextSlot) \
|
| V(LoadElements) \
|
| + V(LoadFunctionPrototype) \
|
| V(LoadGlobal) \
|
| V(LoadKeyedFastElement) \
|
| V(LoadKeyedGeneric) \
|
| V(LoadNamedField) \
|
| V(LoadNamedGeneric) \
|
| - V(LoadFunctionPrototype) \
|
| V(ModI) \
|
| V(MulI) \
|
| V(NumberTagD) \
|
| @@ -241,6 +131,7 @@
|
| V(NumberUntagD) \
|
| V(ObjectLiteral) \
|
| V(OsrEntry) \
|
| + V(OuterContext) \
|
| V(Parameter) \
|
| V(Power) \
|
| V(PushArgument) \
|
| @@ -250,6 +141,7 @@
|
| V(SmiTag) \
|
| V(SmiUntag) \
|
| V(StackCheck) \
|
| + V(StoreContextSlot) \
|
| V(StoreGlobal) \
|
| V(StoreKeyedFastElement) \
|
| V(StoreKeyedGeneric) \
|
| @@ -291,7 +183,10 @@
|
| 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;
|
| @@ -308,15 +203,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_; }
|
| @@ -331,11 +225,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_;
|
| };
|
|
|
|
|
| @@ -362,6 +280,11 @@
|
| public:
|
| int length() { return 0; }
|
| void PrintOperandsTo(StringStream* stream) { }
|
| + ElementType& operator[](int i) {
|
| + UNREACHABLE();
|
| + static ElementType t = 0;
|
| + return t;
|
| + }
|
| };
|
|
|
|
|
| @@ -833,6 +756,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 LClassOfTest: public LTemplateInstruction<1, 1, 1> {
|
| public:
|
| LClassOfTest(LOperand* value, LOperand* temp) {
|
| @@ -991,44 +932,34 @@
|
| };
|
|
|
|
|
| -class LConstant: public LTemplateInstruction<1, 0, 0> {
|
| - DECLARE_INSTRUCTION(Constant)
|
| -};
|
| -
|
| -
|
| -class LConstantI: public LConstant {
|
| +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 {
|
| +class LConstantD: public LTemplateInstruction<1, 0, 1> {
|
| public:
|
| - explicit LConstantD(double value) : value_(value) { }
|
| - double value() const { return value_; }
|
| + explicit LConstantD(LOperand* temp) {
|
| + temps_[0] = temp;
|
| + }
|
|
|
| DECLARE_CONCRETE_INSTRUCTION(ConstantD, "constant-d")
|
| + DECLARE_HYDROGEN_ACCESSOR(Constant)
|
|
|
| - private:
|
| - double value_;
|
| + double value() const { return hydrogen()->DoubleValue(); }
|
| };
|
|
|
|
|
| -class LConstantT: public LConstant {
|
| +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(); }
|
| };
|
|
|
|
|
| @@ -1286,18 +1217,42 @@
|
| };
|
|
|
|
|
| -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);
|
| };
|
|
|
|
|
| +class LStoreContextSlot: public LTemplateInstruction<0, 2, 1> {
|
| + public:
|
| + LStoreContextSlot(LOperand* context, LOperand* value, LOperand* temp) {
|
| + inputs_[0] = context;
|
| + inputs_[1] = value;
|
| + temps_[0] = temp;
|
| + }
|
| +
|
| + DECLARE_CONCRETE_INSTRUCTION(StoreContextSlot, "store-context-slot")
|
| + DECLARE_HYDROGEN_ACCESSOR(StoreContextSlot)
|
| +
|
| + LOperand* context() { return InputAt(0); }
|
| + LOperand* value() { return InputAt(1); }
|
| + int slot_index() { return hydrogen()->slot_index(); }
|
| + int needs_write_barrier() { return hydrogen()->NeedsWriteBarrier(); }
|
| +
|
| + virtual void PrintDataTo(StringStream* stream);
|
| +};
|
| +
|
| +
|
| class LPushArgument: public LTemplateInstruction<0, 1, 0> {
|
| public:
|
| explicit LPushArgument(LOperand* value) {
|
| @@ -1308,15 +1263,45 @@
|
| };
|
|
|
|
|
| -class LGlobalObject: public LTemplateInstruction<1, 0, 0> {
|
| +class LContext: public LTemplateInstruction<1, 0, 0> {
|
| public:
|
| + DECLARE_CONCRETE_INSTRUCTION(Context, "context")
|
| +};
|
| +
|
| +
|
| +class LOuterContext: public LTemplateInstruction<1, 1, 0> {
|
| + public:
|
| + explicit LOuterContext(LOperand* context) {
|
| + inputs_[0] = context;
|
| + }
|
| +
|
| + DECLARE_CONCRETE_INSTRUCTION(OuterContext, "outer-context")
|
| +
|
| + LOperand* context() { return InputAt(0); }
|
| +};
|
| +
|
| +
|
| +class LGlobalObject: public LTemplateInstruction<1, 1, 0> {
|
| + public:
|
| + explicit LGlobalObject(LOperand* context) {
|
| + inputs_[0] = context;
|
| + }
|
| +
|
| DECLARE_CONCRETE_INSTRUCTION(GlobalObject, "global-object")
|
| +
|
| + LOperand* context() { return InputAt(0); }
|
| };
|
|
|
|
|
| -class LGlobalReceiver: public LTemplateInstruction<1, 0, 0> {
|
| +class LGlobalReceiver: public LTemplateInstruction<1, 1, 0> {
|
| public:
|
| + explicit LGlobalReceiver(LOperand* global_object) {
|
| + inputs_[0] = global_object;
|
| + }
|
| +
|
| DECLARE_CONCRETE_INSTRUCTION(GlobalReceiver, "global-receiver")
|
| +
|
| + LOperand* global() { return InputAt(0); }
|
| };
|
|
|
|
|
| @@ -1815,7 +1800,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;
|
| @@ -1881,7 +1866,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.
|
| @@ -2015,7 +2000,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);
|
|
|