| 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 STANDARD_STORE, |
| 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 STANDARD_STORE; |
| 177 STATIC_ASSERT(STANDARD_STORE == 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 > STANDARD_STORE && |
| 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 GetNonTransitioningStoreMode( |
| 207 KeyedAccessStoreMode store_mode) { |
| 208 if (store_mode >= STORE_NO_TRANSITION_IGNORE_OUT_OF_BOUNDS) { |
| 209 return store_mode; |
| 210 } |
| 211 if (store_mode >= STORE_AND_GROW_NO_TRANSITION) { |
| 212 return STORE_AND_GROW_NO_TRANSITION; |
| 213 } |
| 214 return STANDARD_STORE; |
| 215 } |
| 216 |
| 217 |
| 218 static inline bool IsGrowStoreMode(KeyedAccessStoreMode store_mode) { |
| 219 return store_mode >= STORE_AND_GROW_NO_TRANSITION && |
| 220 store_mode <= STORE_AND_GROW_TRANSITION_HOLEY_DOUBLE_TO_OBJECT; |
| 221 } |
| 222 |
| 223 |
| 160 // Setter that skips the write barrier if mode is SKIP_WRITE_BARRIER. | 224 // Setter that skips the write barrier if mode is SKIP_WRITE_BARRIER. |
| 161 enum WriteBarrierMode { SKIP_WRITE_BARRIER, UPDATE_WRITE_BARRIER }; | 225 enum WriteBarrierMode { SKIP_WRITE_BARRIER, UPDATE_WRITE_BARRIER }; |
| 162 | 226 |
| 163 | 227 |
| 164 // PropertyNormalizationMode is used to specify whether to keep | 228 // PropertyNormalizationMode is used to specify whether to keep |
| 165 // inobject properties when normalizing properties of a JSObject. | 229 // inobject properties when normalizing properties of a JSObject. |
| 166 enum PropertyNormalizationMode { | 230 enum PropertyNormalizationMode { |
| 167 CLEAR_INOBJECT_PROPERTIES, | 231 CLEAR_INOBJECT_PROPERTIES, |
| 168 KEEP_INOBJECT_PROPERTIES | 232 KEEP_INOBJECT_PROPERTIES |
| 169 }; | 233 }; |
| (...skipping 4297 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 4467 | 4531 |
| 4468 // Find the first map in an IC stub. | 4532 // Find the first map in an IC stub. |
| 4469 Map* FindFirstMap(); | 4533 Map* FindFirstMap(); |
| 4470 void FindAllMaps(MapHandleList* maps); | 4534 void FindAllMaps(MapHandleList* maps); |
| 4471 | 4535 |
| 4472 // Find the first code in an IC stub. | 4536 // Find the first code in an IC stub. |
| 4473 Code* FindFirstCode(); | 4537 Code* FindFirstCode(); |
| 4474 void FindAllCode(CodeHandleList* code_list, int length); | 4538 void FindAllCode(CodeHandleList* code_list, int length); |
| 4475 | 4539 |
| 4476 class ExtraICStateStrictMode: public BitField<StrictModeFlag, 0, 1> {}; | 4540 class ExtraICStateStrictMode: public BitField<StrictModeFlag, 0, 1> {}; |
| 4477 class ExtraICStateKeyedAccessGrowMode: | 4541 class ExtraICStateKeyedAccessStoreMode: |
| 4478 public BitField<KeyedAccessGrowMode, 1, 1> {}; // NOLINT | 4542 public BitField<KeyedAccessStoreMode, 1, 4> {}; // NOLINT |
| 4479 | |
| 4480 static const int kExtraICStateGrowModeShift = 1; | |
| 4481 | 4543 |
| 4482 static inline StrictModeFlag GetStrictMode(ExtraICState extra_ic_state) { | 4544 static inline StrictModeFlag GetStrictMode(ExtraICState extra_ic_state) { |
| 4483 return ExtraICStateStrictMode::decode(extra_ic_state); | 4545 return ExtraICStateStrictMode::decode(extra_ic_state); |
| 4484 } | 4546 } |
| 4485 | 4547 |
| 4486 static inline KeyedAccessGrowMode GetKeyedAccessGrowMode( | 4548 static inline KeyedAccessStoreMode GetKeyedAccessStoreMode( |
| 4487 ExtraICState extra_ic_state) { | 4549 ExtraICState extra_ic_state) { |
| 4488 return ExtraICStateKeyedAccessGrowMode::decode(extra_ic_state); | 4550 return ExtraICStateKeyedAccessStoreMode::decode(extra_ic_state); |
| 4489 } | 4551 } |
| 4490 | 4552 |
| 4491 static inline ExtraICState ComputeExtraICState( | 4553 static inline ExtraICState ComputeExtraICState( |
| 4492 KeyedAccessGrowMode grow_mode, | 4554 KeyedAccessStoreMode store_mode, |
| 4493 StrictModeFlag strict_mode) { | 4555 StrictModeFlag strict_mode) { |
| 4494 return ExtraICStateKeyedAccessGrowMode::encode(grow_mode) | | 4556 return ExtraICStateKeyedAccessStoreMode::encode(store_mode) | |
| 4495 ExtraICStateStrictMode::encode(strict_mode); | 4557 ExtraICStateStrictMode::encode(strict_mode); |
| 4496 } | 4558 } |
| 4497 | 4559 |
| 4498 // Flags operations. | 4560 // Flags operations. |
| 4499 static inline Flags ComputeFlags( | 4561 static inline Flags ComputeFlags( |
| 4500 Kind kind, | 4562 Kind kind, |
| 4501 InlineCacheState ic_state = UNINITIALIZED, | 4563 InlineCacheState ic_state = UNINITIALIZED, |
| 4502 ExtraICState extra_ic_state = kNoExtraICState, | 4564 ExtraICState extra_ic_state = kNoExtraICState, |
| 4503 StubType type = NORMAL, | 4565 StubType type = NORMAL, |
| 4504 int argc = -1, | 4566 int argc = -1, |
| (...skipping 143 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 4648 class FullCodeFlagsIsCompiledOptimizable: public BitField<bool, 2, 1> {}; | 4710 class FullCodeFlagsIsCompiledOptimizable: public BitField<bool, 2, 1> {}; |
| 4649 | 4711 |
| 4650 static const int kAllowOSRAtLoopNestingLevelOffset = kFullCodeFlags + 1; | 4712 static const int kAllowOSRAtLoopNestingLevelOffset = kFullCodeFlags + 1; |
| 4651 static const int kProfilerTicksOffset = kAllowOSRAtLoopNestingLevelOffset + 1; | 4713 static const int kProfilerTicksOffset = kAllowOSRAtLoopNestingLevelOffset + 1; |
| 4652 | 4714 |
| 4653 // Flags layout. BitField<type, shift, size>. | 4715 // Flags layout. BitField<type, shift, size>. |
| 4654 class ICStateField: public BitField<InlineCacheState, 0, 3> {}; | 4716 class ICStateField: public BitField<InlineCacheState, 0, 3> {}; |
| 4655 class TypeField: public BitField<StubType, 3, 3> {}; | 4717 class TypeField: public BitField<StubType, 3, 3> {}; |
| 4656 class CacheHolderField: public BitField<InlineCacheHolderFlag, 6, 1> {}; | 4718 class CacheHolderField: public BitField<InlineCacheHolderFlag, 6, 1> {}; |
| 4657 class KindField: public BitField<Kind, 7, 4> {}; | 4719 class KindField: public BitField<Kind, 7, 4> {}; |
| 4658 class ExtraICStateField: public BitField<ExtraICState, 11, 2> {}; | 4720 class ExtraICStateField: public BitField<ExtraICState, 11, 5> {}; |
| 4659 class IsPregeneratedField: public BitField<bool, 13, 1> {}; | 4721 class IsPregeneratedField: public BitField<bool, 16, 1> {}; |
| 4660 | 4722 |
| 4661 // KindSpecificFlags1 layout (STUB and OPTIMIZED_FUNCTION) | 4723 // KindSpecificFlags1 layout (STUB and OPTIMIZED_FUNCTION) |
| 4662 static const int kStackSlotsFirstBit = 0; | 4724 static const int kStackSlotsFirstBit = 0; |
| 4663 static const int kStackSlotsBitCount = 24; | 4725 static const int kStackSlotsBitCount = 24; |
| 4664 static const int kUnaryOpTypeFirstBit = | 4726 static const int kUnaryOpTypeFirstBit = |
| 4665 kStackSlotsFirstBit + kStackSlotsBitCount; | 4727 kStackSlotsFirstBit + kStackSlotsBitCount; |
| 4666 static const int kUnaryOpTypeBitCount = 3; | 4728 static const int kUnaryOpTypeBitCount = 3; |
| 4667 static const int kToBooleanStateFirstBit = | 4729 static const int kToBooleanStateFirstBit = |
| 4668 kStackSlotsFirstBit + kStackSlotsBitCount; | 4730 kStackSlotsFirstBit + kStackSlotsBitCount; |
| 4669 static const int kToBooleanStateBitCount = 8; | 4731 static const int kToBooleanStateBitCount = 8; |
| (...skipping 36 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 4706 class SafepointTableOffsetField: public BitField<int, | 4768 class SafepointTableOffsetField: public BitField<int, |
| 4707 kSafepointTableOffsetFirstBit, | 4769 kSafepointTableOffsetFirstBit, |
| 4708 kSafepointTableOffsetBitCount> {}; // NOLINT | 4770 kSafepointTableOffsetBitCount> {}; // NOLINT |
| 4709 class StubMajorKeyField: public BitField<int, | 4771 class StubMajorKeyField: public BitField<int, |
| 4710 kStubMajorKeyFirstBit, kStubMajorKeyBits> {}; // NOLINT | 4772 kStubMajorKeyFirstBit, kStubMajorKeyBits> {}; // NOLINT |
| 4711 | 4773 |
| 4712 // KindSpecificFlags2 layout (FUNCTION) | 4774 // KindSpecificFlags2 layout (FUNCTION) |
| 4713 class StackCheckTableOffsetField: public BitField<int, 0, 31> {}; | 4775 class StackCheckTableOffsetField: public BitField<int, 0, 31> {}; |
| 4714 | 4776 |
| 4715 // Signed field cannot be encoded using the BitField class. | 4777 // Signed field cannot be encoded using the BitField class. |
| 4716 static const int kArgumentsCountShift = 14; | 4778 static const int kArgumentsCountShift = 17; |
| 4717 static const int kArgumentsCountMask = ~((1 << kArgumentsCountShift) - 1); | 4779 static const int kArgumentsCountMask = ~((1 << kArgumentsCountShift) - 1); |
| 4718 | 4780 |
| 4719 // This constant should be encodable in an ARM instruction. | 4781 // This constant should be encodable in an ARM instruction. |
| 4720 static const int kFlagsNotUsedInLookup = | 4782 static const int kFlagsNotUsedInLookup = |
| 4721 TypeField::kMask | CacheHolderField::kMask; | 4783 TypeField::kMask | CacheHolderField::kMask; |
| 4722 | 4784 |
| 4723 private: | 4785 private: |
| 4724 friend class RelocIterator; | 4786 friend class RelocIterator; |
| 4725 | 4787 |
| 4726 // Code aging | 4788 // Code aging |
| (...skipping 4372 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 9099 } else { | 9161 } else { |
| 9100 value &= ~(1 << bit_position); | 9162 value &= ~(1 << bit_position); |
| 9101 } | 9163 } |
| 9102 return value; | 9164 return value; |
| 9103 } | 9165 } |
| 9104 }; | 9166 }; |
| 9105 | 9167 |
| 9106 } } // namespace v8::internal | 9168 } } // namespace v8::internal |
| 9107 | 9169 |
| 9108 #endif // V8_OBJECTS_H_ | 9170 #endif // V8_OBJECTS_H_ |
| OLD | NEW |