Index: src/ia32/code-stubs-ia32.h |
=================================================================== |
--- src/ia32/code-stubs-ia32.h (revision 7552) |
+++ src/ia32/code-stubs-ia32.h (working copy) |
@@ -72,161 +72,6 @@ |
}; |
-// Flag that indicates how to generate code for the stub GenericBinaryOpStub. |
-enum GenericBinaryFlags { |
- NO_GENERIC_BINARY_FLAGS = 0, |
- NO_SMI_CODE_IN_STUB = 1 << 0 // Omit smi code in stub. |
-}; |
- |
- |
-class GenericBinaryOpStub: public CodeStub { |
- public: |
- GenericBinaryOpStub(Token::Value op, |
- OverwriteMode mode, |
- GenericBinaryFlags flags, |
- TypeInfo operands_type) |
- : op_(op), |
- mode_(mode), |
- flags_(flags), |
- args_in_registers_(false), |
- args_reversed_(false), |
- static_operands_type_(operands_type), |
- runtime_operands_type_(BinaryOpIC::UNINIT_OR_SMI), |
- name_(NULL) { |
- if (static_operands_type_.IsSmi()) { |
- mode_ = NO_OVERWRITE; |
- } |
- use_sse3_ = CpuFeatures::IsSupported(SSE3); |
- ASSERT(OpBits::is_valid(Token::NUM_TOKENS)); |
- } |
- |
- GenericBinaryOpStub(int key, BinaryOpIC::TypeInfo runtime_operands_type) |
- : op_(OpBits::decode(key)), |
- mode_(ModeBits::decode(key)), |
- flags_(FlagBits::decode(key)), |
- args_in_registers_(ArgsInRegistersBits::decode(key)), |
- args_reversed_(ArgsReversedBits::decode(key)), |
- use_sse3_(SSE3Bits::decode(key)), |
- static_operands_type_(TypeInfo::ExpandedRepresentation( |
- StaticTypeInfoBits::decode(key))), |
- runtime_operands_type_(runtime_operands_type), |
- name_(NULL) { |
- } |
- |
- // Generate code to call the stub with the supplied arguments. This will add |
- // code at the call site to prepare arguments either in registers or on the |
- // stack together with the actual call. |
- void GenerateCall(MacroAssembler* masm, Register left, Register right); |
- void GenerateCall(MacroAssembler* masm, Register left, Smi* right); |
- void GenerateCall(MacroAssembler* masm, Smi* left, Register right); |
- |
- bool ArgsInRegistersSupported() { |
- return op_ == Token::ADD || op_ == Token::SUB |
- || op_ == Token::MUL || op_ == Token::DIV; |
- } |
- |
- void SetArgsInRegisters() { |
- ASSERT(ArgsInRegistersSupported()); |
- args_in_registers_ = true; |
- } |
- |
- private: |
- Token::Value op_; |
- OverwriteMode mode_; |
- GenericBinaryFlags flags_; |
- bool args_in_registers_; // Arguments passed in registers not on the stack. |
- bool args_reversed_; // Left and right argument are swapped. |
- bool use_sse3_; |
- |
- // Number type information of operands, determined by code generator. |
- TypeInfo static_operands_type_; |
- |
- // Operand type information determined at runtime. |
- BinaryOpIC::TypeInfo runtime_operands_type_; |
- |
- char* name_; |
- |
- const char* GetName(); |
- |
-#ifdef DEBUG |
- void Print() { |
- PrintF("GenericBinaryOpStub %d (op %s), " |
- "(mode %d, flags %d, registers %d, reversed %d, type_info %s)\n", |
- MinorKey(), |
- Token::String(op_), |
- static_cast<int>(mode_), |
- static_cast<int>(flags_), |
- static_cast<int>(args_in_registers_), |
- static_cast<int>(args_reversed_), |
- static_operands_type_.ToString()); |
- } |
-#endif |
- |
- // Minor key encoding in 18 bits RRNNNFRASOOOOOOOMM. |
- class ModeBits: public BitField<OverwriteMode, 0, 2> {}; |
- class OpBits: public BitField<Token::Value, 2, 7> {}; |
- class SSE3Bits: public BitField<bool, 9, 1> {}; |
- class ArgsInRegistersBits: public BitField<bool, 10, 1> {}; |
- class ArgsReversedBits: public BitField<bool, 11, 1> {}; |
- class FlagBits: public BitField<GenericBinaryFlags, 12, 1> {}; |
- class StaticTypeInfoBits: public BitField<int, 13, 3> {}; |
- class RuntimeTypeInfoBits: public BitField<BinaryOpIC::TypeInfo, 16, 3> {}; |
- |
- Major MajorKey() { return GenericBinaryOp; } |
- int MinorKey() { |
- // Encode the parameters in a unique 18 bit value. |
- return OpBits::encode(op_) |
- | ModeBits::encode(mode_) |
- | FlagBits::encode(flags_) |
- | SSE3Bits::encode(use_sse3_) |
- | ArgsInRegistersBits::encode(args_in_registers_) |
- | ArgsReversedBits::encode(args_reversed_) |
- | StaticTypeInfoBits::encode( |
- static_operands_type_.ThreeBitRepresentation()) |
- | RuntimeTypeInfoBits::encode(runtime_operands_type_); |
- } |
- |
- void Generate(MacroAssembler* masm); |
- void GenerateSmiCode(MacroAssembler* masm, Label* slow); |
- void GenerateLoadArguments(MacroAssembler* masm); |
- void GenerateReturn(MacroAssembler* masm); |
- void GenerateHeapResultAllocation(MacroAssembler* masm, Label* alloc_failure); |
- void GenerateRegisterArgsPush(MacroAssembler* masm); |
- void GenerateTypeTransition(MacroAssembler* masm); |
- |
- bool IsOperationCommutative() { |
- return (op_ == Token::ADD) || (op_ == Token::MUL); |
- } |
- |
- void SetArgsReversed() { args_reversed_ = true; } |
- bool HasSmiCodeInStub() { return (flags_ & NO_SMI_CODE_IN_STUB) == 0; } |
- bool HasArgsInRegisters() { return args_in_registers_; } |
- bool HasArgsReversed() { return args_reversed_; } |
- |
- bool ShouldGenerateSmiCode() { |
- return HasSmiCodeInStub() && |
- runtime_operands_type_ != BinaryOpIC::HEAP_NUMBERS && |
- runtime_operands_type_ != BinaryOpIC::STRINGS; |
- } |
- |
- bool ShouldGenerateFPCode() { |
- return runtime_operands_type_ != BinaryOpIC::STRINGS; |
- } |
- |
- virtual int GetCodeKind() { return Code::BINARY_OP_IC; } |
- |
- virtual InlineCacheState GetICState() { |
- return BinaryOpIC::ToState(runtime_operands_type_); |
- } |
- |
- virtual void FinishCode(Code* code) { |
- code->set_binary_op_type(runtime_operands_type_); |
- } |
- |
- friend class CodeGenerator; |
-}; |
- |
- |
class TypeRecordingBinaryOpStub: public CodeStub { |
public: |
TypeRecordingBinaryOpStub(Token::Value op, OverwriteMode mode) |