| OLD | NEW |
| 1 // Copyright 2009 the V8 project authors. All rights reserved. | 1 // Copyright 2009 the V8 project authors. All rights reserved. |
| 2 // Redistribution and use in source and binary forms, with or without | 2 // Redistribution and use in source and binary forms, with or without |
| 3 // modification, are permitted provided that the following conditions are | 3 // modification, are permitted provided that the following conditions are |
| 4 // met: | 4 // met: |
| 5 // | 5 // |
| 6 // * Redistributions of source code must retain the above copyright | 6 // * Redistributions of source code must retain the above copyright |
| 7 // notice, this list of conditions and the following disclaimer. | 7 // notice, this list of conditions and the following disclaimer. |
| 8 // * Redistributions in binary form must reproduce the above | 8 // * Redistributions in binary form must reproduce the above |
| 9 // copyright notice, this list of conditions and the following | 9 // copyright notice, this list of conditions and the following |
| 10 // disclaimer in the documentation and/or other materials provided | 10 // disclaimer in the documentation and/or other materials provided |
| (...skipping 4516 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 4527 right_side = Result(right_reg); | 4527 right_side = Result(right_reg); |
| 4528 __ cmpl(left_side.reg(), right_side.reg()); | 4528 __ cmpl(left_side.reg(), right_side.reg()); |
| 4529 right_side.Unuse(); | 4529 right_side.Unuse(); |
| 4530 left_side.Unuse(); | 4530 left_side.Unuse(); |
| 4531 dest->Split(cc); | 4531 dest->Split(cc); |
| 4532 } | 4532 } |
| 4533 } | 4533 } |
| 4534 } | 4534 } |
| 4535 | 4535 |
| 4536 | 4536 |
| 4537 // Flag that indicates whether or not the code that handles smi arguments | |
| 4538 // should be placed in the stub, inlined, or omitted entirely. | |
| 4539 enum GenericBinaryFlags { | |
| 4540 SMI_CODE_IN_STUB, | |
| 4541 SMI_CODE_INLINED | |
| 4542 }; | |
| 4543 | |
| 4544 | |
| 4545 class FloatingPointHelper : public AllStatic { | 4537 class FloatingPointHelper : public AllStatic { |
| 4546 public: | 4538 public: |
| 4547 // Code pattern for loading a floating point value. Input value must | 4539 // Code pattern for loading a floating point value. Input value must |
| 4548 // be either a smi or a heap number object (fp value). Requirements: | 4540 // be either a smi or a heap number object (fp value). Requirements: |
| 4549 // operand in src register. Returns operand as floating point number | 4541 // operand in src register. Returns operand as floating point number |
| 4550 // in XMM register | 4542 // in XMM register |
| 4551 static void LoadFloatOperand(MacroAssembler* masm, | 4543 static void LoadFloatOperand(MacroAssembler* masm, |
| 4552 Register src, | 4544 Register src, |
| 4553 XMMRegister dst); | 4545 XMMRegister dst); |
| 4554 // Code pattern for loading floating point values. Input values must | 4546 // Code pattern for loading floating point values. Input values must |
| (...skipping 31 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 4586 Label* non_float); | 4578 Label* non_float); |
| 4587 // Allocate a heap number in new space with undefined value. | 4579 // Allocate a heap number in new space with undefined value. |
| 4588 // Returns tagged pointer in result, or jumps to need_gc if new space is full. | 4580 // Returns tagged pointer in result, or jumps to need_gc if new space is full. |
| 4589 static void AllocateHeapNumber(MacroAssembler* masm, | 4581 static void AllocateHeapNumber(MacroAssembler* masm, |
| 4590 Label* need_gc, | 4582 Label* need_gc, |
| 4591 Register scratch, | 4583 Register scratch, |
| 4592 Register result); | 4584 Register result); |
| 4593 }; | 4585 }; |
| 4594 | 4586 |
| 4595 | 4587 |
| 4596 class GenericBinaryOpStub: public CodeStub { | |
| 4597 public: | |
| 4598 GenericBinaryOpStub(Token::Value op, | |
| 4599 OverwriteMode mode, | |
| 4600 GenericBinaryFlags flags) | |
| 4601 : op_(op), mode_(mode), flags_(flags) { | |
| 4602 ASSERT(OpBits::is_valid(Token::NUM_TOKENS)); | |
| 4603 } | |
| 4604 | |
| 4605 void GenerateSmiCode(MacroAssembler* masm, Label* slow); | |
| 4606 | |
| 4607 private: | |
| 4608 Token::Value op_; | |
| 4609 OverwriteMode mode_; | |
| 4610 GenericBinaryFlags flags_; | |
| 4611 | |
| 4612 const char* GetName(); | |
| 4613 | |
| 4614 #ifdef DEBUG | |
| 4615 void Print() { | |
| 4616 PrintF("GenericBinaryOpStub (op %s), (mode %d, flags %d)\n", | |
| 4617 Token::String(op_), | |
| 4618 static_cast<int>(mode_), | |
| 4619 static_cast<int>(flags_)); | |
| 4620 } | |
| 4621 #endif | |
| 4622 | |
| 4623 // Minor key encoding in 16 bits FOOOOOOOOOOOOOMM. | |
| 4624 class ModeBits: public BitField<OverwriteMode, 0, 2> {}; | |
| 4625 class OpBits: public BitField<Token::Value, 2, 13> {}; | |
| 4626 class FlagBits: public BitField<GenericBinaryFlags, 15, 1> {}; | |
| 4627 | |
| 4628 Major MajorKey() { return GenericBinaryOp; } | |
| 4629 int MinorKey() { | |
| 4630 // Encode the parameters in a unique 16 bit value. | |
| 4631 return OpBits::encode(op_) | |
| 4632 | ModeBits::encode(mode_) | |
| 4633 | FlagBits::encode(flags_); | |
| 4634 } | |
| 4635 void Generate(MacroAssembler* masm); | |
| 4636 }; | |
| 4637 | |
| 4638 | |
| 4639 class DeferredInlineBinaryOperation: public DeferredCode { | 4588 class DeferredInlineBinaryOperation: public DeferredCode { |
| 4640 public: | 4589 public: |
| 4641 DeferredInlineBinaryOperation(Token::Value op, | 4590 DeferredInlineBinaryOperation(Token::Value op, |
| 4642 Register dst, | 4591 Register dst, |
| 4643 Register left, | 4592 Register left, |
| 4644 Register right, | 4593 Register right, |
| 4645 OverwriteMode mode) | 4594 OverwriteMode mode) |
| 4646 : op_(op), dst_(dst), left_(left), right_(right), mode_(mode) { | 4595 : op_(op), dst_(dst), left_(left), right_(right), mode_(mode) { |
| 4647 set_comment("[ DeferredInlineBinaryOperation"); | 4596 set_comment("[ DeferredInlineBinaryOperation"); |
| 4648 } | 4597 } |
| (...skipping 2612 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 7261 int CompareStub::MinorKey() { | 7210 int CompareStub::MinorKey() { |
| 7262 // Encode the two parameters in a unique 16 bit value. | 7211 // Encode the two parameters in a unique 16 bit value. |
| 7263 ASSERT(static_cast<unsigned>(cc_) < (1 << 15)); | 7212 ASSERT(static_cast<unsigned>(cc_) < (1 << 15)); |
| 7264 return (static_cast<unsigned>(cc_) << 1) | (strict_ ? 1 : 0); | 7213 return (static_cast<unsigned>(cc_) << 1) | (strict_ ? 1 : 0); |
| 7265 } | 7214 } |
| 7266 | 7215 |
| 7267 | 7216 |
| 7268 #undef __ | 7217 #undef __ |
| 7269 | 7218 |
| 7270 } } // namespace v8::internal | 7219 } } // namespace v8::internal |
| OLD | NEW |