Chromium Code Reviews
chromiumcodereview-hr@appspot.gserviceaccount.com (chromiumcodereview-hr) | Please choose your nickname with Settings | Help | Chromium Project | Gerrit Changes | Sign out
(514)

Side by Side Diff: src/ia32/codegen-ia32.cc

Issue 160584: Add support to the CFG builder for non-short-circuited binary... (Closed) Base URL: http://v8.googlecode.com/svn/branches/bleeding_edge/
Patch Set: '' Created 11 years, 4 months ago
Use n/p to move between diff chunks; N/P to move between comments. Draft comments are only viewable by you.
Jump to:
View unified diff | Download patch | Annotate | Revision Log
« no previous file with comments | « src/ia32/codegen-ia32.h ('k') | src/x64/cfg-x64.cc » ('j') | no next file with comments »
Toggle Intra-line Diffs ('i') | Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
OLDNEW
1 // Copyright 2006-2009 the V8 project authors. All rights reserved. 1 // Copyright 2006-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 760 matching lines...) Expand 10 before | Expand all | Expand 10 after
771 // Allocate a heap number in new space with undefined value. 771 // Allocate a heap number in new space with undefined value.
772 // Returns tagged pointer in eax, or jumps to need_gc if new space is full. 772 // Returns tagged pointer in eax, or jumps to need_gc if new space is full.
773 static void AllocateHeapNumber(MacroAssembler* masm, 773 static void AllocateHeapNumber(MacroAssembler* masm,
774 Label* need_gc, 774 Label* need_gc,
775 Register scratch1, 775 Register scratch1,
776 Register scratch2, 776 Register scratch2,
777 Register result); 777 Register result);
778 }; 778 };
779 779
780 780
781 // Flag that indicates whether or not the code that handles smi arguments
782 // should be placed in the stub, inlined, or omitted entirely.
783 enum GenericBinaryFlags {
784 SMI_CODE_IN_STUB,
785 SMI_CODE_INLINED
786 };
787
788
789 class GenericBinaryOpStub: public CodeStub {
790 public:
791 GenericBinaryOpStub(Token::Value op,
792 OverwriteMode mode,
793 GenericBinaryFlags flags)
794 : op_(op), mode_(mode), flags_(flags) {
795 ASSERT(OpBits::is_valid(Token::NUM_TOKENS));
796 }
797
798 void GenerateSmiCode(MacroAssembler* masm, Label* slow);
799
800 private:
801 Token::Value op_;
802 OverwriteMode mode_;
803 GenericBinaryFlags flags_;
804
805 const char* GetName();
806
807 #ifdef DEBUG
808 void Print() {
809 PrintF("GenericBinaryOpStub (op %s), (mode %d, flags %d)\n",
810 Token::String(op_),
811 static_cast<int>(mode_),
812 static_cast<int>(flags_));
813 }
814 #endif
815
816 // Minor key encoding in 16 bits FOOOOOOOOOOOOOMM.
817 class ModeBits: public BitField<OverwriteMode, 0, 2> {};
818 class OpBits: public BitField<Token::Value, 2, 13> {};
819 class FlagBits: public BitField<GenericBinaryFlags, 15, 1> {};
820
821 Major MajorKey() { return GenericBinaryOp; }
822 int MinorKey() {
823 // Encode the parameters in a unique 16 bit value.
824 return OpBits::encode(op_)
825 | ModeBits::encode(mode_)
826 | FlagBits::encode(flags_);
827 }
828 void Generate(MacroAssembler* masm);
829 };
830
831
832 const char* GenericBinaryOpStub::GetName() { 781 const char* GenericBinaryOpStub::GetName() {
833 switch (op_) { 782 switch (op_) {
834 case Token::ADD: return "GenericBinaryOpStub_ADD"; 783 case Token::ADD: return "GenericBinaryOpStub_ADD";
835 case Token::SUB: return "GenericBinaryOpStub_SUB"; 784 case Token::SUB: return "GenericBinaryOpStub_SUB";
836 case Token::MUL: return "GenericBinaryOpStub_MUL"; 785 case Token::MUL: return "GenericBinaryOpStub_MUL";
837 case Token::DIV: return "GenericBinaryOpStub_DIV"; 786 case Token::DIV: return "GenericBinaryOpStub_DIV";
838 case Token::BIT_OR: return "GenericBinaryOpStub_BIT_OR"; 787 case Token::BIT_OR: return "GenericBinaryOpStub_BIT_OR";
839 case Token::BIT_AND: return "GenericBinaryOpStub_BIT_AND"; 788 case Token::BIT_AND: return "GenericBinaryOpStub_BIT_AND";
840 case Token::BIT_XOR: return "GenericBinaryOpStub_BIT_XOR"; 789 case Token::BIT_XOR: return "GenericBinaryOpStub_BIT_XOR";
841 case Token::SAR: return "GenericBinaryOpStub_SAR"; 790 case Token::SAR: return "GenericBinaryOpStub_SAR";
(...skipping 7074 matching lines...) Expand 10 before | Expand all | Expand 10 after
7916 7865
7917 int CompareStub::MinorKey() { 7866 int CompareStub::MinorKey() {
7918 // Encode the two parameters in a unique 16 bit value. 7867 // Encode the two parameters in a unique 16 bit value.
7919 ASSERT(static_cast<unsigned>(cc_) < (1 << 15)); 7868 ASSERT(static_cast<unsigned>(cc_) < (1 << 15));
7920 return (static_cast<unsigned>(cc_) << 1) | (strict_ ? 1 : 0); 7869 return (static_cast<unsigned>(cc_) << 1) | (strict_ ? 1 : 0);
7921 } 7870 }
7922 7871
7923 #undef __ 7872 #undef __
7924 7873
7925 } } // namespace v8::internal 7874 } } // namespace v8::internal
OLDNEW
« no previous file with comments | « src/ia32/codegen-ia32.h ('k') | src/x64/cfg-x64.cc » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698