| OLD | NEW |
| 1 // Copyright 2011 the V8 project authors. All rights reserved. | 1 // Copyright 2011 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 658 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 669 }; | 669 }; |
| 670 | 670 |
| 671 | 671 |
| 672 class CallFunctionStub: public CodeStub { | 672 class CallFunctionStub: public CodeStub { |
| 673 public: | 673 public: |
| 674 CallFunctionStub(int argc, CallFunctionFlags flags) | 674 CallFunctionStub(int argc, CallFunctionFlags flags) |
| 675 : argc_(argc), flags_(flags) { } | 675 : argc_(argc), flags_(flags) { } |
| 676 | 676 |
| 677 void Generate(MacroAssembler* masm); | 677 void Generate(MacroAssembler* masm); |
| 678 | 678 |
| 679 virtual void FinishCode(Code* code); |
| 680 |
| 681 static void Clear(Heap* heap, Address address); |
| 682 |
| 683 static Object* GetCachedValue(Address address); |
| 684 |
| 679 static int ExtractArgcFromMinorKey(int minor_key) { | 685 static int ExtractArgcFromMinorKey(int minor_key) { |
| 680 return ArgcBits::decode(minor_key); | 686 return ArgcBits::decode(minor_key); |
| 681 } | 687 } |
| 682 | 688 |
| 689 // The object that indicates an uninitialized cache. |
| 690 static Handle<Object> UninitializedSentinel(Isolate* isolate) { |
| 691 return isolate->factory()->the_hole_value(); |
| 692 } |
| 693 |
| 694 // A raw version of the uninitialized sentinel that's safe to read during |
| 695 // garbage collection (e.g., for patching the cache). |
| 696 static Object* RawUninitializedSentinel(Heap* heap) { |
| 697 return heap->raw_unchecked_the_hole_value(); |
| 698 } |
| 699 |
| 700 // The object that indicates a megamorphic state. |
| 701 static Handle<Object> MegamorphicSentinel(Isolate* isolate) { |
| 702 return isolate->factory()->undefined_value(); |
| 703 } |
| 704 |
| 683 private: | 705 private: |
| 684 int argc_; | 706 int argc_; |
| 685 CallFunctionFlags flags_; | 707 CallFunctionFlags flags_; |
| 686 | 708 |
| 687 virtual void PrintName(StringStream* stream); | 709 virtual void PrintName(StringStream* stream); |
| 688 | 710 |
| 689 // Minor key encoding in 32 bits with Bitfield <Type, shift, size>. | 711 // Minor key encoding in 32 bits with Bitfield <Type, shift, size>. |
| 690 class FlagBits: public BitField<CallFunctionFlags, 0, 1> {}; | 712 class FlagBits: public BitField<CallFunctionFlags, 0, 2> {}; |
| 691 class ArgcBits: public BitField<unsigned, 1, 32 - 1> {}; | 713 class ArgcBits: public BitField<unsigned, 2, 32 - 2> {}; |
| 692 | 714 |
| 693 Major MajorKey() { return CallFunction; } | 715 Major MajorKey() { return CallFunction; } |
| 694 int MinorKey() { | 716 int MinorKey() { |
| 695 // Encode the parameters in a unique 32 bit value. | 717 // Encode the parameters in a unique 32 bit value. |
| 696 return FlagBits::encode(flags_) | ArgcBits::encode(argc_); | 718 return FlagBits::encode(flags_) | ArgcBits::encode(argc_); |
| 697 } | 719 } |
| 698 | 720 |
| 699 bool ReceiverMightBeImplicit() { | 721 bool ReceiverMightBeImplicit() { |
| 700 return (flags_ & RECEIVER_MIGHT_BE_IMPLICIT) != 0; | 722 return (flags_ & RECEIVER_MIGHT_BE_IMPLICIT) != 0; |
| 701 } | 723 } |
| 724 |
| 725 bool RecordCallTarget() { |
| 726 return (flags_ & RECORD_CALL_TARGET) != 0; |
| 727 } |
| 702 }; | 728 }; |
| 703 | 729 |
| 704 | 730 |
| 705 enum StringIndexFlags { | 731 enum StringIndexFlags { |
| 706 // Accepts smis or heap numbers. | 732 // Accepts smis or heap numbers. |
| 707 STRING_INDEX_IS_NUMBER, | 733 STRING_INDEX_IS_NUMBER, |
| 708 | 734 |
| 709 // Accepts smis or heap numbers that are valid array indices | 735 // Accepts smis or heap numbers that are valid array indices |
| 710 // (ECMA-262 15.4). Invalid indices are reported as being out of | 736 // (ECMA-262 15.4). Invalid indices are reported as being out of |
| 711 // range. | 737 // range. |
| (...skipping 267 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 979 bool result); | 1005 bool result); |
| 980 void GenerateTypeTransition(MacroAssembler* masm); | 1006 void GenerateTypeTransition(MacroAssembler* masm); |
| 981 | 1007 |
| 982 Register tos_; | 1008 Register tos_; |
| 983 Types types_; | 1009 Types types_; |
| 984 }; | 1010 }; |
| 985 | 1011 |
| 986 } } // namespace v8::internal | 1012 } } // namespace v8::internal |
| 987 | 1013 |
| 988 #endif // V8_CODE_STUBS_H_ | 1014 #endif // V8_CODE_STUBS_H_ |
| OLD | NEW |