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

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

Issue 668151: Make more use of the NumberInfo data.... (Closed) Base URL: http://v8.googlecode.com/svn/branches/bleeding_edge/
Patch Set: '' Created 10 years, 9 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
OLDNEW
1 // Copyright 2010 the V8 project authors. All rights reserved. 1 // Copyright 2010 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 478 matching lines...) Expand 10 before | Expand all | Expand 10 after
489 Result* right, 489 Result* right,
490 OverwriteMode overwrite_mode); 490 OverwriteMode overwrite_mode);
491 491
492 void Comparison(AstNode* node, 492 void Comparison(AstNode* node,
493 Condition cc, 493 Condition cc,
494 bool strict, 494 bool strict,
495 ControlDestination* destination); 495 ControlDestination* destination);
496 496
497 // To prevent long attacker-controlled byte sequences, integer constants 497 // To prevent long attacker-controlled byte sequences, integer constants
498 // from the JavaScript source are loaded in two parts if they are larger 498 // from the JavaScript source are loaded in two parts if they are larger
499 // than 16 bits. 499 // than 17 bits.
500 static const int kMaxSmiInlinedBits = 16; 500 static const int kMaxSmiInlinedBits = 17;
501 bool IsUnsafeSmi(Handle<Object> value); 501 bool IsUnsafeSmi(Handle<Object> value);
502 // Load an integer constant x into a register target or into the stack using 502 // Load an integer constant x into a register target or into the stack using
503 // at most 16 bits of user-controlled data per assembly operation. 503 // at most 16 bits of user-controlled data per assembly operation.
504 void MoveUnsafeSmi(Register target, Handle<Object> value); 504 void MoveUnsafeSmi(Register target, Handle<Object> value);
505 void StoreUnsafeSmiToLocal(int offset, Handle<Object> value); 505 void StoreUnsafeSmiToLocal(int offset, Handle<Object> value);
506 void PushUnsafeSmi(Handle<Object> value); 506 void PushUnsafeSmi(Handle<Object> value);
507 507
508 void CallWithArguments(ZoneList<Expression*>* arguments, 508 void CallWithArguments(ZoneList<Expression*>* arguments,
509 CallFunctionFlags flags, 509 CallFunctionFlags flags,
510 int position); 510 int position);
(...skipping 177 matching lines...) Expand 10 before | Expand all | Expand 10 after
688 NO_GENERIC_BINARY_FLAGS = 0, 688 NO_GENERIC_BINARY_FLAGS = 0,
689 NO_SMI_CODE_IN_STUB = 1 << 0 // Omit smi code in stub. 689 NO_SMI_CODE_IN_STUB = 1 << 0 // Omit smi code in stub.
690 }; 690 };
691 691
692 692
693 class GenericBinaryOpStub: public CodeStub { 693 class GenericBinaryOpStub: public CodeStub {
694 public: 694 public:
695 GenericBinaryOpStub(Token::Value op, 695 GenericBinaryOpStub(Token::Value op,
696 OverwriteMode mode, 696 OverwriteMode mode,
697 GenericBinaryFlags flags, 697 GenericBinaryFlags flags,
698 NumberInfo::Type operands_type = NumberInfo::kUnknown) 698 NumberInfo operands_type)
699 : op_(op), 699 : op_(op),
700 mode_(mode), 700 mode_(mode),
701 flags_(flags), 701 flags_(flags),
702 args_in_registers_(false), 702 args_in_registers_(false),
703 args_reversed_(false), 703 args_reversed_(false),
704 static_operands_type_(operands_type), 704 static_operands_type_(operands_type),
705 runtime_operands_type_(BinaryOpIC::DEFAULT), 705 runtime_operands_type_(BinaryOpIC::DEFAULT),
706 name_(NULL) { 706 name_(NULL) {
707 if (static_operands_type_.IsSmi()) {
708 mode_ = NO_OVERWRITE;
709 }
707 use_sse3_ = CpuFeatures::IsSupported(SSE3); 710 use_sse3_ = CpuFeatures::IsSupported(SSE3);
708 ASSERT(OpBits::is_valid(Token::NUM_TOKENS)); 711 ASSERT(OpBits::is_valid(Token::NUM_TOKENS));
709 } 712 }
710 713
711 GenericBinaryOpStub(int key, BinaryOpIC::TypeInfo runtime_operands_type) 714 GenericBinaryOpStub(int key, BinaryOpIC::TypeInfo runtime_operands_type)
712 : op_(OpBits::decode(key)), 715 : op_(OpBits::decode(key)),
713 mode_(ModeBits::decode(key)), 716 mode_(ModeBits::decode(key)),
714 flags_(FlagBits::decode(key)), 717 flags_(FlagBits::decode(key)),
715 args_in_registers_(ArgsInRegistersBits::decode(key)), 718 args_in_registers_(ArgsInRegistersBits::decode(key)),
716 args_reversed_(ArgsReversedBits::decode(key)), 719 args_reversed_(ArgsReversedBits::decode(key)),
717 use_sse3_(SSE3Bits::decode(key)), 720 use_sse3_(SSE3Bits::decode(key)),
718 static_operands_type_(StaticTypeInfoBits::decode(key)), 721 static_operands_type_(NumberInfo::ExpandedRepresentation(StaticTypeInfoB its::decode(key))),
719 runtime_operands_type_(runtime_operands_type), 722 runtime_operands_type_(runtime_operands_type),
720 name_(NULL) { 723 name_(NULL) {
721 } 724 }
722 725
723 // Generate code to call the stub with the supplied arguments. This will add 726 // Generate code to call the stub with the supplied arguments. This will add
724 // code at the call site to prepare arguments either in registers or on the 727 // code at the call site to prepare arguments either in registers or on the
725 // stack together with the actual call. 728 // stack together with the actual call.
726 void GenerateCall(MacroAssembler* masm, Register left, Register right); 729 void GenerateCall(MacroAssembler* masm, Register left, Register right);
727 void GenerateCall(MacroAssembler* masm, Register left, Smi* right); 730 void GenerateCall(MacroAssembler* masm, Register left, Smi* right);
728 void GenerateCall(MacroAssembler* masm, Smi* left, Register right); 731 void GenerateCall(MacroAssembler* masm, Smi* left, Register right);
729 732
730 Result GenerateCall(MacroAssembler* masm, 733 Result GenerateCall(MacroAssembler* masm,
731 VirtualFrame* frame, 734 VirtualFrame* frame,
732 Result* left, 735 Result* left,
733 Result* right); 736 Result* right);
734 737
735 private: 738 private:
736 Token::Value op_; 739 Token::Value op_;
737 OverwriteMode mode_; 740 OverwriteMode mode_;
738 GenericBinaryFlags flags_; 741 GenericBinaryFlags flags_;
739 bool args_in_registers_; // Arguments passed in registers not on the stack. 742 bool args_in_registers_; // Arguments passed in registers not on the stack.
740 bool args_reversed_; // Left and right argument are swapped. 743 bool args_reversed_; // Left and right argument are swapped.
741 bool use_sse3_; 744 bool use_sse3_;
742 745
743 // Number type information of operands, determined by code generator. 746 // Number type information of operands, determined by code generator.
744 NumberInfo::Type static_operands_type_; 747 NumberInfo static_operands_type_;
745 748
746 // Operand type information determined at runtime. 749 // Operand type information determined at runtime.
747 BinaryOpIC::TypeInfo runtime_operands_type_; 750 BinaryOpIC::TypeInfo runtime_operands_type_;
748 751
749 char* name_; 752 char* name_;
750 753
751 const char* GetName(); 754 const char* GetName();
752 755
753 #ifdef DEBUG 756 #ifdef DEBUG
754 void Print() { 757 void Print() {
755 PrintF("GenericBinaryOpStub %d (op %s), " 758 PrintF("GenericBinaryOpStub %d (op %s), "
756 "(mode %d, flags %d, registers %d, reversed %d, number_info %s)\n", 759 "(mode %d, flags %d, registers %d, reversed %d, number_info %s)\n",
757 MinorKey(), 760 MinorKey(),
758 Token::String(op_), 761 Token::String(op_),
759 static_cast<int>(mode_), 762 static_cast<int>(mode_),
760 static_cast<int>(flags_), 763 static_cast<int>(flags_),
761 static_cast<int>(args_in_registers_), 764 static_cast<int>(args_in_registers_),
762 static_cast<int>(args_reversed_), 765 static_cast<int>(args_reversed_),
763 NumberInfo::ToString(static_operands_type_)); 766 static_operands_type_.ToString());
764 } 767 }
765 #endif 768 #endif
766 769
767 // Minor key encoding in 18 bits RRNNNFRASOOOOOOOMM. 770 // Minor key encoding in 18 bits RRNNNFRASOOOOOOOMM.
768 class ModeBits: public BitField<OverwriteMode, 0, 2> {}; 771 class ModeBits: public BitField<OverwriteMode, 0, 2> {};
769 class OpBits: public BitField<Token::Value, 2, 7> {}; 772 class OpBits: public BitField<Token::Value, 2, 7> {};
770 class SSE3Bits: public BitField<bool, 9, 1> {}; 773 class SSE3Bits: public BitField<bool, 9, 1> {};
771 class ArgsInRegistersBits: public BitField<bool, 10, 1> {}; 774 class ArgsInRegistersBits: public BitField<bool, 10, 1> {};
772 class ArgsReversedBits: public BitField<bool, 11, 1> {}; 775 class ArgsReversedBits: public BitField<bool, 11, 1> {};
773 class FlagBits: public BitField<GenericBinaryFlags, 12, 1> {}; 776 class FlagBits: public BitField<GenericBinaryFlags, 12, 1> {};
774 class StaticTypeInfoBits: public BitField<NumberInfo::Type, 13, 3> {}; 777 class StaticTypeInfoBits: public BitField<int, 13, 3> {};
775 class RuntimeTypeInfoBits: public BitField<BinaryOpIC::TypeInfo, 16, 2> {}; 778 class RuntimeTypeInfoBits: public BitField<BinaryOpIC::TypeInfo, 16, 2> {};
776 779
777 Major MajorKey() { return GenericBinaryOp; } 780 Major MajorKey() { return GenericBinaryOp; }
778 int MinorKey() { 781 int MinorKey() {
779 // Encode the parameters in a unique 18 bit value. 782 // Encode the parameters in a unique 18 bit value.
780 return OpBits::encode(op_) 783 return OpBits::encode(op_)
781 | ModeBits::encode(mode_) 784 | ModeBits::encode(mode_)
782 | FlagBits::encode(flags_) 785 | FlagBits::encode(flags_)
783 | SSE3Bits::encode(use_sse3_) 786 | SSE3Bits::encode(use_sse3_)
784 | ArgsInRegistersBits::encode(args_in_registers_) 787 | ArgsInRegistersBits::encode(args_in_registers_)
785 | ArgsReversedBits::encode(args_reversed_) 788 | ArgsReversedBits::encode(args_reversed_)
786 | StaticTypeInfoBits::encode(static_operands_type_) 789 | StaticTypeInfoBits::encode(static_operands_type_.ThreeBitRepresenta tion())
787 | RuntimeTypeInfoBits::encode(runtime_operands_type_); 790 | RuntimeTypeInfoBits::encode(runtime_operands_type_);
788 } 791 }
789 792
790 void Generate(MacroAssembler* masm); 793 void Generate(MacroAssembler* masm);
791 void GenerateSmiCode(MacroAssembler* masm, Label* slow); 794 void GenerateSmiCode(MacroAssembler* masm, Label* slow);
792 void GenerateLoadArguments(MacroAssembler* masm); 795 void GenerateLoadArguments(MacroAssembler* masm);
793 void GenerateReturn(MacroAssembler* masm); 796 void GenerateReturn(MacroAssembler* masm);
794 void GenerateHeapResultAllocation(MacroAssembler* masm, Label* alloc_failure); 797 void GenerateHeapResultAllocation(MacroAssembler* masm, Label* alloc_failure);
795 void GenerateRegisterArgsPush(MacroAssembler* masm); 798 void GenerateRegisterArgsPush(MacroAssembler* masm);
796 void GenerateTypeTransition(MacroAssembler* masm); 799 void GenerateTypeTransition(MacroAssembler* masm);
(...skipping 167 matching lines...) Expand 10 before | Expand all | Expand 10 after
964 void Print() { 967 void Print() {
965 PrintF("NumberToStringStub\n"); 968 PrintF("NumberToStringStub\n");
966 } 969 }
967 #endif 970 #endif
968 }; 971 };
969 972
970 973
971 } } // namespace v8::internal 974 } } // namespace v8::internal
972 975
973 #endif // V8_IA32_CODEGEN_IA32_H_ 976 #endif // V8_IA32_CODEGEN_IA32_H_
OLDNEW
« no previous file with comments | « src/frame-element.h ('k') | src/ia32/codegen-ia32.cc » ('j') | src/ia32/codegen-ia32.cc » ('J')

Powered by Google App Engine
This is Rietveld 408576698