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

Side by Side Diff: src/objects.h

Issue 7787028: Use the BitField class for Code::Flags. (Closed) Base URL: https://v8.googlecode.com/svn/branches/bleeding_edge
Patch Set: Created 9 years, 3 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/mips/macro-assembler-mips.cc ('k') | src/objects-inl.h » ('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 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 3738 matching lines...) Expand 10 before | Expand all | Expand 10 after
3749 InlineCacheHolderFlag holder = OWN_MAP); 3749 InlineCacheHolderFlag holder = OWN_MAP);
3750 3750
3751 static inline Flags ComputeMonomorphicFlags( 3751 static inline Flags ComputeMonomorphicFlags(
3752 Kind kind, 3752 Kind kind,
3753 PropertyType type, 3753 PropertyType type,
3754 ExtraICState extra_ic_state = kNoExtraICState, 3754 ExtraICState extra_ic_state = kNoExtraICState,
3755 InlineCacheHolderFlag holder = OWN_MAP, 3755 InlineCacheHolderFlag holder = OWN_MAP,
3756 InLoopFlag in_loop = NOT_IN_LOOP, 3756 InLoopFlag in_loop = NOT_IN_LOOP,
3757 int argc = -1); 3757 int argc = -1);
3758 3758
3759 static inline Kind ExtractKindFromFlags(Flags flags);
3760 static inline InlineCacheState ExtractICStateFromFlags(Flags flags); 3759 static inline InlineCacheState ExtractICStateFromFlags(Flags flags);
3761 static inline ExtraICState ExtractExtraICStateFromFlags(Flags flags);
3762 static inline InLoopFlag ExtractICInLoopFromFlags(Flags flags); 3760 static inline InLoopFlag ExtractICInLoopFromFlags(Flags flags);
3763 static inline PropertyType ExtractTypeFromFlags(Flags flags); 3761 static inline PropertyType ExtractTypeFromFlags(Flags flags);
3762 static inline Kind ExtractKindFromFlags(Flags flags);
3763 static inline InlineCacheHolderFlag ExtractCacheHolderFromFlags(Flags flags);
3764 static inline ExtraICState ExtractExtraICStateFromFlags(Flags flags);
3764 static inline int ExtractArgumentsCountFromFlags(Flags flags); 3765 static inline int ExtractArgumentsCountFromFlags(Flags flags);
3765 static inline InlineCacheHolderFlag ExtractCacheHolderFromFlags(Flags flags); 3766
3766 static inline Flags RemoveTypeFromFlags(Flags flags); 3767 static inline Flags RemoveTypeFromFlags(Flags flags);
3767 3768
3768 // Convert a target address into a code object. 3769 // Convert a target address into a code object.
3769 static inline Code* GetCodeFromTargetAddress(Address address); 3770 static inline Code* GetCodeFromTargetAddress(Address address);
3770 3771
3771 // Convert an entry address into an object. 3772 // Convert an entry address into an object.
3772 static inline Object* GetObjectFromEntryAddress(Address location_of_address); 3773 static inline Object* GetObjectFromEntryAddress(Address location_of_address);
3773 3774
3774 // Returns the address of the first instruction. 3775 // Returns the address of the first instruction.
3775 inline byte* instruction_start(); 3776 inline byte* instruction_start();
(...skipping 99 matching lines...) Expand 10 before | Expand all | Expand 10 after
3875 static const int kToBooleanTypeOffset = kStubMajorKeyOffset + 1; 3876 static const int kToBooleanTypeOffset = kStubMajorKeyOffset + 1;
3876 static const int kHasDeoptimizationSupportOffset = kOptimizableOffset + 1; 3877 static const int kHasDeoptimizationSupportOffset = kOptimizableOffset + 1;
3877 3878
3878 static const int kBinaryOpReturnTypeOffset = kBinaryOpTypeOffset + 1; 3879 static const int kBinaryOpReturnTypeOffset = kBinaryOpTypeOffset + 1;
3879 static const int kAllowOSRAtLoopNestingLevelOffset = 3880 static const int kAllowOSRAtLoopNestingLevelOffset =
3880 kHasDeoptimizationSupportOffset + 1; 3881 kHasDeoptimizationSupportOffset + 1;
3881 3882
3882 static const int kSafepointTableOffsetOffset = kStackSlotsOffset + kIntSize; 3883 static const int kSafepointTableOffsetOffset = kStackSlotsOffset + kIntSize;
3883 static const int kStackCheckTableOffsetOffset = kStackSlotsOffset + kIntSize; 3884 static const int kStackCheckTableOffsetOffset = kStackSlotsOffset + kIntSize;
3884 3885
3885 // Flags layout. 3886 // Flags layout. BitField<type, shift, size>.
3886 static const int kFlagsICStateShift = 0; 3887 class ICStateField: public BitField<InlineCacheState, 0, 3> {};
3887 static const int kFlagsICInLoopShift = 3; 3888 class ICInLoopField: public BitField<InLoopFlag, 3, 1> {};
3888 static const int kFlagsTypeShift = 4; 3889 class TypeField: public BitField<PropertyType, 4, 4> {};
3889 static const int kFlagsKindShift = 8; 3890 class KindField: public BitField<Kind, 8, 4> {};
3890 static const int kFlagsICHolderShift = 12; 3891 class CacheHolderField: public BitField<InlineCacheHolderFlag, 12, 1> {};
3891 static const int kFlagsExtraICStateShift = 13; 3892 class ExtraICStateField: public BitField<ExtraICState, 13, 2> {};
3893
3894 // Signed field cannot be encoded using the BitField class.
3892 static const int kFlagsArgumentsCountShift = 15; 3895 static const int kFlagsArgumentsCountShift = 15;
3893 3896 static const int kFlagsArgumentsCountMask = 0xffff8000;
3894 static const int kFlagsICStateMask = 0x00000007; // 00000000111
3895 static const int kFlagsICInLoopMask = 0x00000008; // 00000001000
3896 static const int kFlagsTypeMask = 0x000000F0; // 00001110000
3897 static const int kFlagsKindMask = 0x00000F00; // 11110000000
3898 static const int kFlagsCacheInPrototypeMapMask = 0x00001000;
3899 static const int kFlagsExtraICStateMask = 0x00006000;
3900 static const int kFlagsArgumentsCountMask = 0xFFFF8000;
3901 3897
3902 static const int kFlagsNotUsedInLookup = 3898 static const int kFlagsNotUsedInLookup =
3903 (kFlagsICInLoopMask | kFlagsTypeMask | kFlagsCacheInPrototypeMapMask); 3899 ICInLoopField::kMask | TypeField::kMask | CacheHolderField::kMask;
3904 3900
3905 private: 3901 private:
3906 DISALLOW_IMPLICIT_CONSTRUCTORS(Code); 3902 DISALLOW_IMPLICIT_CONSTRUCTORS(Code);
3907 }; 3903 };
3908 3904
3909 3905
3910 // All heap objects have a Map that describes their structure. 3906 // All heap objects have a Map that describes their structure.
3911 // A Map contains information about: 3907 // A Map contains information about:
3912 // - Size information about the object 3908 // - Size information about the object
3913 // - How to iterate over an object (for garbage collection) 3909 // - How to iterate over an object (for garbage collection)
(...skipping 3541 matching lines...) Expand 10 before | Expand all | Expand 10 after
7455 } else { 7451 } else {
7456 value &= ~(1 << bit_position); 7452 value &= ~(1 << bit_position);
7457 } 7453 }
7458 return value; 7454 return value;
7459 } 7455 }
7460 }; 7456 };
7461 7457
7462 } } // namespace v8::internal 7458 } } // namespace v8::internal
7463 7459
7464 #endif // V8_OBJECTS_H_ 7460 #endif // V8_OBJECTS_H_
OLDNEW
« no previous file with comments | « src/mips/macro-assembler-mips.cc ('k') | src/objects-inl.h » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698