OLD | NEW |
---|---|
1 // Copyright 2012 the V8 project authors. All rights reserved. | 1 // Copyright 2012 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 134 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... | |
145 // Failure: [30 bit signed int] 11 | 145 // Failure: [30 bit signed int] 11 |
146 | 146 |
147 namespace v8 { | 147 namespace v8 { |
148 namespace internal { | 148 namespace internal { |
149 | 149 |
150 enum CompareMapMode { | 150 enum CompareMapMode { |
151 REQUIRE_EXACT_MAP, | 151 REQUIRE_EXACT_MAP, |
152 ALLOW_ELEMENT_TRANSITION_MAPS | 152 ALLOW_ELEMENT_TRANSITION_MAPS |
153 }; | 153 }; |
154 | 154 |
155 enum KeyedAccessGrowMode { | 155 enum KeyedAccessStoreMode { |
156 DO_NOT_ALLOW_JSARRAY_GROWTH, | 156 STORE_NO_TRANSITION, |
157 ALLOW_JSARRAY_GROWTH | 157 STORE_TRANSITION_SMI_TO_OBJECT, |
158 STORE_TRANSITION_SMI_TO_DOUBLE, | |
159 STORE_TRANSITION_DOUBLE_TO_OBJECT, | |
160 STORE_TRANSITION_HOLEY_SMI_TO_OBJECT, | |
161 STORE_TRANSITION_HOLEY_SMI_TO_DOUBLE, | |
162 STORE_TRANSITION_HOLEY_DOUBLE_TO_OBJECT, | |
163 STORE_AND_GROW_NO_TRANSITION, | |
164 STORE_AND_GROW_TRANSITION_SMI_TO_OBJECT, | |
165 STORE_AND_GROW_TRANSITION_SMI_TO_DOUBLE, | |
166 STORE_AND_GROW_TRANSITION_DOUBLE_TO_OBJECT, | |
167 STORE_AND_GROW_TRANSITION_HOLEY_SMI_TO_OBJECT, | |
168 STORE_AND_GROW_TRANSITION_HOLEY_SMI_TO_DOUBLE, | |
169 STORE_AND_GROW_TRANSITION_HOLEY_DOUBLE_TO_OBJECT, | |
170 STORE_NO_TRANSITION_IGNORE_OUT_OF_BOUNDS, | |
171 STORE_NO_TRANSITION_HANDLE_COW | |
158 }; | 172 }; |
159 | 173 |
174 | |
175 static const int kGrowICDelta = STORE_AND_GROW_NO_TRANSITION - | |
176 STORE_NO_TRANSITION; | |
177 STATIC_ASSERT(STORE_NO_TRANSITION == 0); | |
178 STATIC_ASSERT(kGrowICDelta == | |
179 STORE_AND_GROW_TRANSITION_SMI_TO_OBJECT - | |
180 STORE_TRANSITION_SMI_TO_OBJECT); | |
181 STATIC_ASSERT(kGrowICDelta == | |
182 STORE_AND_GROW_TRANSITION_SMI_TO_DOUBLE - | |
183 STORE_TRANSITION_SMI_TO_DOUBLE); | |
184 STATIC_ASSERT(kGrowICDelta == | |
185 STORE_AND_GROW_TRANSITION_DOUBLE_TO_OBJECT - | |
186 STORE_TRANSITION_DOUBLE_TO_OBJECT); | |
187 | |
188 | |
189 static inline KeyedAccessStoreMode GetGrowStoreMode( | |
190 KeyedAccessStoreMode store_mode) { | |
191 if (store_mode < STORE_AND_GROW_NO_TRANSITION) { | |
192 store_mode = static_cast<KeyedAccessStoreMode>( | |
193 static_cast<int>(store_mode) + kGrowICDelta); | |
194 } | |
195 return store_mode; | |
196 } | |
197 | |
198 | |
199 static inline bool IsTransitionStoreMode(KeyedAccessStoreMode store_mode) { | |
200 return store_mode > STORE_NO_TRANSITION && | |
201 store_mode <= STORE_AND_GROW_TRANSITION_HOLEY_DOUBLE_TO_OBJECT && | |
202 store_mode != STORE_AND_GROW_NO_TRANSITION; | |
203 } | |
204 | |
205 | |
206 static inline KeyedAccessStoreMode GetUntransitionedStoreMode( | |
207 KeyedAccessStoreMode store_mode) { | |
208 if (IsTransitionStoreMode(store_mode)) { | |
Toon Verwaest
2013/03/06 14:47:28
What about just
if (store_mode >= IGNORE_OUT_OF_B
danno
2013/03/06 16:56:06
Done.
| |
209 if (store_mode > STORE_AND_GROW_NO_TRANSITION) { | |
210 return STORE_AND_GROW_NO_TRANSITION; | |
211 } else { | |
212 return STORE_NO_TRANSITION; | |
213 } | |
214 } else { | |
215 return store_mode; | |
216 } | |
217 } | |
218 | |
219 | |
220 static inline bool IsGrowStoreMode(KeyedAccessStoreMode store_mode) { | |
221 return store_mode >= STORE_AND_GROW_NO_TRANSITION && | |
222 store_mode <= STORE_AND_GROW_TRANSITION_HOLEY_DOUBLE_TO_OBJECT; | |
223 } | |
224 | |
225 | |
160 // Setter that skips the write barrier if mode is SKIP_WRITE_BARRIER. | 226 // Setter that skips the write barrier if mode is SKIP_WRITE_BARRIER. |
161 enum WriteBarrierMode { SKIP_WRITE_BARRIER, UPDATE_WRITE_BARRIER }; | 227 enum WriteBarrierMode { SKIP_WRITE_BARRIER, UPDATE_WRITE_BARRIER }; |
162 | 228 |
163 | 229 |
164 // PropertyNormalizationMode is used to specify whether to keep | 230 // PropertyNormalizationMode is used to specify whether to keep |
165 // inobject properties when normalizing properties of a JSObject. | 231 // inobject properties when normalizing properties of a JSObject. |
166 enum PropertyNormalizationMode { | 232 enum PropertyNormalizationMode { |
167 CLEAR_INOBJECT_PROPERTIES, | 233 CLEAR_INOBJECT_PROPERTIES, |
168 KEEP_INOBJECT_PROPERTIES | 234 KEEP_INOBJECT_PROPERTIES |
169 }; | 235 }; |
(...skipping 4297 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... | |
4467 | 4533 |
4468 // Find the first map in an IC stub. | 4534 // Find the first map in an IC stub. |
4469 Map* FindFirstMap(); | 4535 Map* FindFirstMap(); |
4470 void FindAllMaps(MapHandleList* maps); | 4536 void FindAllMaps(MapHandleList* maps); |
4471 | 4537 |
4472 // Find the first code in an IC stub. | 4538 // Find the first code in an IC stub. |
4473 Code* FindFirstCode(); | 4539 Code* FindFirstCode(); |
4474 void FindAllCode(CodeHandleList* code_list, int length); | 4540 void FindAllCode(CodeHandleList* code_list, int length); |
4475 | 4541 |
4476 class ExtraICStateStrictMode: public BitField<StrictModeFlag, 0, 1> {}; | 4542 class ExtraICStateStrictMode: public BitField<StrictModeFlag, 0, 1> {}; |
4477 class ExtraICStateKeyedAccessGrowMode: | 4543 class ExtraICStateKeyedAccessStoreMode: |
4478 public BitField<KeyedAccessGrowMode, 1, 1> {}; // NOLINT | 4544 public BitField<KeyedAccessStoreMode, 1, 4> {}; // NOLINT |
4479 | |
4480 static const int kExtraICStateGrowModeShift = 1; | |
4481 | 4545 |
4482 static inline StrictModeFlag GetStrictMode(ExtraICState extra_ic_state) { | 4546 static inline StrictModeFlag GetStrictMode(ExtraICState extra_ic_state) { |
4483 return ExtraICStateStrictMode::decode(extra_ic_state); | 4547 return ExtraICStateStrictMode::decode(extra_ic_state); |
4484 } | 4548 } |
4485 | 4549 |
4486 static inline KeyedAccessGrowMode GetKeyedAccessGrowMode( | 4550 static inline KeyedAccessStoreMode GetKeyedAccessStoreMode( |
4487 ExtraICState extra_ic_state) { | 4551 ExtraICState extra_ic_state) { |
4488 return ExtraICStateKeyedAccessGrowMode::decode(extra_ic_state); | 4552 return ExtraICStateKeyedAccessStoreMode::decode(extra_ic_state); |
4489 } | 4553 } |
4490 | 4554 |
4491 static inline ExtraICState ComputeExtraICState( | 4555 static inline ExtraICState ComputeExtraICState( |
4492 KeyedAccessGrowMode grow_mode, | 4556 KeyedAccessStoreMode store_mode, |
4493 StrictModeFlag strict_mode) { | 4557 StrictModeFlag strict_mode) { |
4494 return ExtraICStateKeyedAccessGrowMode::encode(grow_mode) | | 4558 return ExtraICStateKeyedAccessStoreMode::encode(store_mode) | |
4495 ExtraICStateStrictMode::encode(strict_mode); | 4559 ExtraICStateStrictMode::encode(strict_mode); |
4496 } | 4560 } |
4497 | 4561 |
4498 // Flags operations. | 4562 // Flags operations. |
4499 static inline Flags ComputeFlags( | 4563 static inline Flags ComputeFlags( |
4500 Kind kind, | 4564 Kind kind, |
4501 InlineCacheState ic_state = UNINITIALIZED, | 4565 InlineCacheState ic_state = UNINITIALIZED, |
4502 ExtraICState extra_ic_state = kNoExtraICState, | 4566 ExtraICState extra_ic_state = kNoExtraICState, |
4503 StubType type = NORMAL, | 4567 StubType type = NORMAL, |
4504 int argc = -1, | 4568 int argc = -1, |
(...skipping 143 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... | |
4648 class FullCodeFlagsIsCompiledOptimizable: public BitField<bool, 2, 1> {}; | 4712 class FullCodeFlagsIsCompiledOptimizable: public BitField<bool, 2, 1> {}; |
4649 | 4713 |
4650 static const int kAllowOSRAtLoopNestingLevelOffset = kFullCodeFlags + 1; | 4714 static const int kAllowOSRAtLoopNestingLevelOffset = kFullCodeFlags + 1; |
4651 static const int kProfilerTicksOffset = kAllowOSRAtLoopNestingLevelOffset + 1; | 4715 static const int kProfilerTicksOffset = kAllowOSRAtLoopNestingLevelOffset + 1; |
4652 | 4716 |
4653 // Flags layout. BitField<type, shift, size>. | 4717 // Flags layout. BitField<type, shift, size>. |
4654 class ICStateField: public BitField<InlineCacheState, 0, 3> {}; | 4718 class ICStateField: public BitField<InlineCacheState, 0, 3> {}; |
4655 class TypeField: public BitField<StubType, 3, 3> {}; | 4719 class TypeField: public BitField<StubType, 3, 3> {}; |
4656 class CacheHolderField: public BitField<InlineCacheHolderFlag, 6, 1> {}; | 4720 class CacheHolderField: public BitField<InlineCacheHolderFlag, 6, 1> {}; |
4657 class KindField: public BitField<Kind, 7, 4> {}; | 4721 class KindField: public BitField<Kind, 7, 4> {}; |
4658 class ExtraICStateField: public BitField<ExtraICState, 11, 2> {}; | 4722 class ExtraICStateField: public BitField<ExtraICState, 11, 5> {}; |
4659 class IsPregeneratedField: public BitField<bool, 13, 1> {}; | 4723 class IsPregeneratedField: public BitField<bool, 16, 1> {}; |
4660 | 4724 |
4661 // KindSpecificFlags1 layout (STUB and OPTIMIZED_FUNCTION) | 4725 // KindSpecificFlags1 layout (STUB and OPTIMIZED_FUNCTION) |
4662 static const int kStackSlotsFirstBit = 0; | 4726 static const int kStackSlotsFirstBit = 0; |
4663 static const int kStackSlotsBitCount = 24; | 4727 static const int kStackSlotsBitCount = 24; |
4664 static const int kUnaryOpTypeFirstBit = | 4728 static const int kUnaryOpTypeFirstBit = |
4665 kStackSlotsFirstBit + kStackSlotsBitCount; | 4729 kStackSlotsFirstBit + kStackSlotsBitCount; |
4666 static const int kUnaryOpTypeBitCount = 3; | 4730 static const int kUnaryOpTypeBitCount = 3; |
4667 static const int kToBooleanStateFirstBit = | 4731 static const int kToBooleanStateFirstBit = |
4668 kStackSlotsFirstBit + kStackSlotsBitCount; | 4732 kStackSlotsFirstBit + kStackSlotsBitCount; |
4669 static const int kToBooleanStateBitCount = 8; | 4733 static const int kToBooleanStateBitCount = 8; |
(...skipping 36 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... | |
4706 class SafepointTableOffsetField: public BitField<int, | 4770 class SafepointTableOffsetField: public BitField<int, |
4707 kSafepointTableOffsetFirstBit, | 4771 kSafepointTableOffsetFirstBit, |
4708 kSafepointTableOffsetBitCount> {}; // NOLINT | 4772 kSafepointTableOffsetBitCount> {}; // NOLINT |
4709 class StubMajorKeyField: public BitField<int, | 4773 class StubMajorKeyField: public BitField<int, |
4710 kStubMajorKeyFirstBit, kStubMajorKeyBits> {}; // NOLINT | 4774 kStubMajorKeyFirstBit, kStubMajorKeyBits> {}; // NOLINT |
4711 | 4775 |
4712 // KindSpecificFlags2 layout (FUNCTION) | 4776 // KindSpecificFlags2 layout (FUNCTION) |
4713 class StackCheckTableOffsetField: public BitField<int, 0, 31> {}; | 4777 class StackCheckTableOffsetField: public BitField<int, 0, 31> {}; |
4714 | 4778 |
4715 // Signed field cannot be encoded using the BitField class. | 4779 // Signed field cannot be encoded using the BitField class. |
4716 static const int kArgumentsCountShift = 14; | 4780 static const int kArgumentsCountShift = 17; |
4717 static const int kArgumentsCountMask = ~((1 << kArgumentsCountShift) - 1); | 4781 static const int kArgumentsCountMask = ~((1 << kArgumentsCountShift) - 1); |
4718 | 4782 |
4719 // This constant should be encodable in an ARM instruction. | 4783 // This constant should be encodable in an ARM instruction. |
4720 static const int kFlagsNotUsedInLookup = | 4784 static const int kFlagsNotUsedInLookup = |
4721 TypeField::kMask | CacheHolderField::kMask; | 4785 TypeField::kMask | CacheHolderField::kMask; |
4722 | 4786 |
4723 private: | 4787 private: |
4724 friend class RelocIterator; | 4788 friend class RelocIterator; |
4725 | 4789 |
4726 // Code aging | 4790 // Code aging |
(...skipping 4372 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... | |
9099 } else { | 9163 } else { |
9100 value &= ~(1 << bit_position); | 9164 value &= ~(1 << bit_position); |
9101 } | 9165 } |
9102 return value; | 9166 return value; |
9103 } | 9167 } |
9104 }; | 9168 }; |
9105 | 9169 |
9106 } } // namespace v8::internal | 9170 } } // namespace v8::internal |
9107 | 9171 |
9108 #endif // V8_OBJECTS_H_ | 9172 #endif // V8_OBJECTS_H_ |
OLD | NEW |