Index: src/ia32/code-stubs-ia32.h |
diff --git a/src/ia32/code-stubs-ia32.h b/src/ia32/code-stubs-ia32.h |
index dc21d40b23c2ca037e2bc6f39998f4b58888b074..6dc63bdd4910c2356f654b3a54c94915ec927efd 100644 |
--- a/src/ia32/code-stubs-ia32.h |
+++ b/src/ia32/code-stubs-ia32.h |
@@ -86,6 +86,80 @@ class StoreBufferOverflowStub: public PlatformCodeStub { |
}; |
+class UnaryOpStub: public PlatformCodeStub { |
+ public: |
+ UnaryOpStub(Token::Value op, |
+ UnaryOverwriteMode mode, |
+ UnaryOpIC::TypeInfo operand_type = UnaryOpIC::UNINITIALIZED) |
+ : op_(op), |
+ mode_(mode), |
+ operand_type_(operand_type) { |
+ } |
+ |
+ private: |
+ Token::Value op_; |
+ UnaryOverwriteMode mode_; |
+ |
+ // Operand type information determined at runtime. |
+ UnaryOpIC::TypeInfo operand_type_; |
+ |
+ virtual void PrintName(StringStream* stream); |
+ |
+ class ModeBits: public BitField<UnaryOverwriteMode, 0, 1> {}; |
+ class OpBits: public BitField<Token::Value, 1, 7> {}; |
+ class OperandTypeInfoBits: public BitField<UnaryOpIC::TypeInfo, 8, 3> {}; |
+ |
+ Major MajorKey() { return UnaryOp; } |
+ int MinorKey() { |
+ return ModeBits::encode(mode_) |
+ | OpBits::encode(op_) |
+ | OperandTypeInfoBits::encode(operand_type_); |
+ } |
+ |
+ // Note: A lot of the helper functions below will vanish when we use virtual |
+ // function instead of switch more often. |
+ void Generate(MacroAssembler* masm); |
+ |
+ void GenerateTypeTransition(MacroAssembler* masm); |
+ |
+ void GenerateSmiStub(MacroAssembler* masm); |
+ void GenerateSmiStubSub(MacroAssembler* masm); |
+ void GenerateSmiStubBitNot(MacroAssembler* masm); |
+ void GenerateSmiCodeSub(MacroAssembler* masm, |
+ Label* non_smi, |
+ Label* undo, |
+ Label* slow, |
+ Label::Distance non_smi_near = Label::kFar, |
+ Label::Distance undo_near = Label::kFar, |
+ Label::Distance slow_near = Label::kFar); |
+ void GenerateSmiCodeBitNot(MacroAssembler* masm, |
+ Label* non_smi, |
+ Label::Distance non_smi_near = Label::kFar); |
+ void GenerateSmiCodeUndo(MacroAssembler* masm); |
+ |
+ void GenerateNumberStub(MacroAssembler* masm); |
+ void GenerateNumberStubSub(MacroAssembler* masm); |
+ void GenerateNumberStubBitNot(MacroAssembler* masm); |
+ void GenerateHeapNumberCodeSub(MacroAssembler* masm, Label* slow); |
+ void GenerateHeapNumberCodeBitNot(MacroAssembler* masm, Label* slow); |
+ |
+ void GenerateGenericStub(MacroAssembler* masm); |
+ void GenerateGenericStubSub(MacroAssembler* masm); |
+ void GenerateGenericStubBitNot(MacroAssembler* masm); |
+ void GenerateGenericCodeFallback(MacroAssembler* masm); |
+ |
+ virtual Code::Kind GetCodeKind() const { return Code::UNARY_OP_IC; } |
+ |
+ virtual InlineCacheState GetICState() { |
+ return UnaryOpIC::ToState(operand_type_); |
+ } |
+ |
+ virtual void FinishCode(Handle<Code> code) { |
+ code->set_unary_op_type(operand_type_); |
+ } |
+}; |
+ |
+ |
class StringHelper : public AllStatic { |
public: |
// Generate code for copying characters using a simple loop. This should only |