| 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 161 matching lines...) Expand 10 before | Expand all | Expand 10 after  Loading... | 
|    172   STORE_AND_GROW_TRANSITION_SMI_TO_DOUBLE, |    172   STORE_AND_GROW_TRANSITION_SMI_TO_DOUBLE, | 
|    173   STORE_AND_GROW_TRANSITION_DOUBLE_TO_OBJECT, |    173   STORE_AND_GROW_TRANSITION_DOUBLE_TO_OBJECT, | 
|    174   STORE_AND_GROW_TRANSITION_HOLEY_SMI_TO_OBJECT, |    174   STORE_AND_GROW_TRANSITION_HOLEY_SMI_TO_OBJECT, | 
|    175   STORE_AND_GROW_TRANSITION_HOLEY_SMI_TO_DOUBLE, |    175   STORE_AND_GROW_TRANSITION_HOLEY_SMI_TO_DOUBLE, | 
|    176   STORE_AND_GROW_TRANSITION_HOLEY_DOUBLE_TO_OBJECT, |    176   STORE_AND_GROW_TRANSITION_HOLEY_DOUBLE_TO_OBJECT, | 
|    177   STORE_NO_TRANSITION_IGNORE_OUT_OF_BOUNDS, |    177   STORE_NO_TRANSITION_IGNORE_OUT_OF_BOUNDS, | 
|    178   STORE_NO_TRANSITION_HANDLE_COW |    178   STORE_NO_TRANSITION_HANDLE_COW | 
|    179 }; |    179 }; | 
|    180  |    180  | 
|    181  |    181  | 
 |    182 enum ContextualMode { | 
 |    183   NOT_CONTEXTUAL, | 
 |    184   CONTEXTUAL | 
 |    185 }; | 
 |    186  | 
 |    187  | 
|    182 static const int kGrowICDelta = STORE_AND_GROW_NO_TRANSITION - |    188 static const int kGrowICDelta = STORE_AND_GROW_NO_TRANSITION - | 
|    183     STANDARD_STORE; |    189     STANDARD_STORE; | 
|    184 STATIC_ASSERT(STANDARD_STORE == 0); |    190 STATIC_ASSERT(STANDARD_STORE == 0); | 
|    185 STATIC_ASSERT(kGrowICDelta == |    191 STATIC_ASSERT(kGrowICDelta == | 
|    186               STORE_AND_GROW_TRANSITION_SMI_TO_OBJECT - |    192               STORE_AND_GROW_TRANSITION_SMI_TO_OBJECT - | 
|    187               STORE_TRANSITION_SMI_TO_OBJECT); |    193               STORE_TRANSITION_SMI_TO_OBJECT); | 
|    188 STATIC_ASSERT(kGrowICDelta == |    194 STATIC_ASSERT(kGrowICDelta == | 
|    189               STORE_AND_GROW_TRANSITION_SMI_TO_DOUBLE - |    195               STORE_AND_GROW_TRANSITION_SMI_TO_DOUBLE - | 
|    190               STORE_TRANSITION_SMI_TO_DOUBLE); |    196               STORE_TRANSITION_SMI_TO_DOUBLE); | 
|    191 STATIC_ASSERT(kGrowICDelta == |    197 STATIC_ASSERT(kGrowICDelta == | 
| (...skipping 98 matching lines...) Expand 10 before | Expand all | Expand 10 after  Loading... | 
|    290 // that piggy-back on marking can use the parity to ensure that they only |    296 // that piggy-back on marking can use the parity to ensure that they only | 
|    291 // perform an operation on an object once per marking phase: they record the |    297 // perform an operation on an object once per marking phase: they record the | 
|    292 // MarkingParity when they visit an object, and only re-visit the object when it |    298 // MarkingParity when they visit an object, and only re-visit the object when it | 
|    293 // is marked again and the MarkingParity changes. |    299 // is marked again and the MarkingParity changes. | 
|    294 enum MarkingParity { |    300 enum MarkingParity { | 
|    295   NO_MARKING_PARITY, |    301   NO_MARKING_PARITY, | 
|    296   ODD_MARKING_PARITY, |    302   ODD_MARKING_PARITY, | 
|    297   EVEN_MARKING_PARITY |    303   EVEN_MARKING_PARITY | 
|    298 }; |    304 }; | 
|    299  |    305  | 
 |    306 // ICs store extra state in a Code object. The default extra state is | 
 |    307 // kNoExtraICState. | 
 |    308 typedef int ExtraICState; | 
 |    309 static const ExtraICState kNoExtraICState = 0; | 
 |    310  | 
|    300 // Instance size sentinel for objects of variable size. |    311 // Instance size sentinel for objects of variable size. | 
|    301 const int kVariableSizeSentinel = 0; |    312 const int kVariableSizeSentinel = 0; | 
|    302  |    313  | 
|    303 const int kStubMajorKeyBits = 6; |    314 const int kStubMajorKeyBits = 6; | 
|    304 const int kStubMinorKeyBits = kBitsPerInt - kSmiTagSize - kStubMajorKeyBits; |    315 const int kStubMinorKeyBits = kBitsPerInt - kSmiTagSize - kStubMajorKeyBits; | 
|    305  |    316  | 
|    306 // All Maps have a field instance_type containing a InstanceType. |    317 // All Maps have a field instance_type containing a InstanceType. | 
|    307 // It describes the type of the instances. |    318 // It describes the type of the instances. | 
|    308 // |    319 // | 
|    309 // As an example, a JavaScript object is a heap object and its map |    320 // As an example, a JavaScript object is a heap object and its map | 
| (...skipping 4719 matching lines...) Expand 10 before | Expand all | Expand 10 after  Loading... | 
|   5029   STATIC_ASSERT(NUMBER_OF_KINDS <= 16); |   5040   STATIC_ASSERT(NUMBER_OF_KINDS <= 16); | 
|   5030  |   5041  | 
|   5031   static const char* Kind2String(Kind kind); |   5042   static const char* Kind2String(Kind kind); | 
|   5032  |   5043  | 
|   5033   // Types of stubs. |   5044   // Types of stubs. | 
|   5034   enum StubType { |   5045   enum StubType { | 
|   5035     NORMAL, |   5046     NORMAL, | 
|   5036     FAST |   5047     FAST | 
|   5037   }; |   5048   }; | 
|   5038  |   5049  | 
|   5039   typedef int ExtraICState; |  | 
|   5040  |  | 
|   5041   static const ExtraICState kNoExtraICState = 0; |  | 
|   5042  |  | 
|   5043   static const int kPrologueOffsetNotSet = -1; |   5050   static const int kPrologueOffsetNotSet = -1; | 
|   5044  |   5051  | 
|   5045 #ifdef ENABLE_DISASSEMBLER |   5052 #ifdef ENABLE_DISASSEMBLER | 
|   5046   // Printing |   5053   // Printing | 
|   5047   static const char* ICState2String(InlineCacheState state); |   5054   static const char* ICState2String(InlineCacheState state); | 
|   5048   static const char* StubType2String(StubType type); |   5055   static const char* StubType2String(StubType type); | 
|   5049   static void PrintExtraICState(FILE* out, Kind kind, ExtraICState extra); |   5056   static void PrintExtraICState(FILE* out, Kind kind, ExtraICState extra); | 
|   5050   void Disassemble(const char* name, FILE* out = stdout); |   5057   void Disassemble(const char* name, FILE* out = stdout); | 
|   5051 #endif  // ENABLE_DISASSEMBLER |   5058 #endif  // ENABLE_DISASSEMBLER | 
|   5052  |   5059  | 
| (...skipping 199 matching lines...) Expand 10 before | Expand all | Expand 10 after  Loading... | 
|   5252  |   5259  | 
|   5253   // The entire code object including its header is copied verbatim to the |   5260   // The entire code object including its header is copied verbatim to the | 
|   5254   // snapshot so that it can be written in one, fast, memcpy during |   5261   // snapshot so that it can be written in one, fast, memcpy during | 
|   5255   // deserialization. The deserializer will overwrite some pointers, rather |   5262   // deserialization. The deserializer will overwrite some pointers, rather | 
|   5256   // like a runtime linker, but the random allocation addresses used in the |   5263   // like a runtime linker, but the random allocation addresses used in the | 
|   5257   // mksnapshot process would still be present in the unlinked snapshot data, |   5264   // mksnapshot process would still be present in the unlinked snapshot data, | 
|   5258   // which would make snapshot production non-reproducible. This method wipes |   5265   // which would make snapshot production non-reproducible. This method wipes | 
|   5259   // out the to-be-overwritten header data for reproducible snapshots. |   5266   // out the to-be-overwritten header data for reproducible snapshots. | 
|   5260   inline void WipeOutHeader(); |   5267   inline void WipeOutHeader(); | 
|   5261  |   5268  | 
|   5262   class ExtraICStateStrictMode: public BitField<StrictModeFlag, 0, 1> {}; |  | 
|   5263   class ExtraICStateKeyedAccessStoreMode: |  | 
|   5264       public BitField<KeyedAccessStoreMode, 1, 4> {};  // NOLINT |  | 
|   5265  |  | 
|   5266   static inline StrictModeFlag GetStrictMode(ExtraICState extra_ic_state) { |  | 
|   5267     return ExtraICStateStrictMode::decode(extra_ic_state); |  | 
|   5268   } |  | 
|   5269  |  | 
|   5270   static inline KeyedAccessStoreMode GetKeyedAccessStoreMode( |  | 
|   5271       ExtraICState extra_ic_state) { |  | 
|   5272     return ExtraICStateKeyedAccessStoreMode::decode(extra_ic_state); |  | 
|   5273   } |  | 
|   5274  |  | 
|   5275   static inline ExtraICState ComputeExtraICState( |  | 
|   5276       KeyedAccessStoreMode store_mode, |  | 
|   5277       StrictModeFlag strict_mode) { |  | 
|   5278     return ExtraICStateKeyedAccessStoreMode::encode(store_mode) | |  | 
|   5279         ExtraICStateStrictMode::encode(strict_mode); |  | 
|   5280   } |  | 
|   5281  |  | 
|   5282   // Flags operations. |   5269   // Flags operations. | 
|   5283   static inline Flags ComputeFlags( |   5270   static inline Flags ComputeFlags( | 
|   5284       Kind kind, |   5271       Kind kind, | 
|   5285       InlineCacheState ic_state = UNINITIALIZED, |   5272       InlineCacheState ic_state = UNINITIALIZED, | 
|   5286       ExtraICState extra_ic_state = kNoExtraICState, |   5273       ExtraICState extra_ic_state = kNoExtraICState, | 
|   5287       StubType type = NORMAL, |   5274       StubType type = NORMAL, | 
|   5288       int argc = -1, |   5275       int argc = -1, | 
|   5289       InlineCacheHolderFlag holder = OWN_MAP); |   5276       InlineCacheHolderFlag holder = OWN_MAP); | 
|   5290  |   5277  | 
|   5291   static inline Flags ComputeMonomorphicFlags( |   5278   static inline Flags ComputeMonomorphicFlags( | 
| (...skipping 163 matching lines...) Expand 10 before | Expand all | Expand 10 after  Loading... | 
|   5455       public BitField<bool, 0, 1> {};  // NOLINT |   5442       public BitField<bool, 0, 1> {};  // NOLINT | 
|   5456   class FullCodeFlagsHasDebugBreakSlotsField: public BitField<bool, 1, 1> {}; |   5443   class FullCodeFlagsHasDebugBreakSlotsField: public BitField<bool, 1, 1> {}; | 
|   5457   class FullCodeFlagsIsCompiledOptimizable: public BitField<bool, 2, 1> {}; |   5444   class FullCodeFlagsIsCompiledOptimizable: public BitField<bool, 2, 1> {}; | 
|   5458  |   5445  | 
|   5459   static const int kAllowOSRAtLoopNestingLevelOffset = kFullCodeFlags + 1; |   5446   static const int kAllowOSRAtLoopNestingLevelOffset = kFullCodeFlags + 1; | 
|   5460   static const int kProfilerTicksOffset = kAllowOSRAtLoopNestingLevelOffset + 1; |   5447   static const int kProfilerTicksOffset = kAllowOSRAtLoopNestingLevelOffset + 1; | 
|   5461  |   5448  | 
|   5462   // Flags layout.  BitField<type, shift, size>. |   5449   // Flags layout.  BitField<type, shift, size>. | 
|   5463   class ICStateField: public BitField<InlineCacheState, 0, 3> {}; |   5450   class ICStateField: public BitField<InlineCacheState, 0, 3> {}; | 
|   5464   class TypeField: public BitField<StubType, 3, 1> {}; |   5451   class TypeField: public BitField<StubType, 3, 1> {}; | 
|   5465   class CacheHolderField: public BitField<InlineCacheHolderFlag, 6, 1> {}; |   5452   class CacheHolderField: public BitField<InlineCacheHolderFlag, 5, 1> {}; | 
|   5466   class KindField: public BitField<Kind, 7, 4> {}; |   5453   class KindField: public BitField<Kind, 6, 4> {}; | 
|   5467   class IsPregeneratedField: public BitField<bool, 11, 1> {}; |   5454   class IsPregeneratedField: public BitField<bool, 10, 1> {}; | 
|   5468   class ExtraICStateField: public BitField<ExtraICState, 12, 5> {}; |   5455   class ExtraICStateField: public BitField<ExtraICState, 11, 6> {}; | 
|   5469   class ExtendedExtraICStateField: public BitField<ExtraICState, 12, |   5456   class ExtendedExtraICStateField: public BitField<ExtraICState, 11, | 
|   5470       PlatformSmiTagging::kSmiValueSize - 12 + 1> {};  // NOLINT |   5457       PlatformSmiTagging::kSmiValueSize - 11 + 1> {};  // NOLINT | 
|   5471   STATIC_ASSERT(ExtraICStateField::kShift == ExtendedExtraICStateField::kShift); |   5458   STATIC_ASSERT(ExtraICStateField::kShift == ExtendedExtraICStateField::kShift); | 
|   5472  |   5459  | 
|   5473   // KindSpecificFlags1 layout (STUB and OPTIMIZED_FUNCTION) |   5460   // KindSpecificFlags1 layout (STUB and OPTIMIZED_FUNCTION) | 
|   5474   static const int kStackSlotsFirstBit = 0; |   5461   static const int kStackSlotsFirstBit = 0; | 
|   5475   static const int kStackSlotsBitCount = 24; |   5462   static const int kStackSlotsBitCount = 24; | 
|   5476   static const int kHasFunctionCacheFirstBit = |   5463   static const int kHasFunctionCacheFirstBit = | 
|   5477       kStackSlotsFirstBit + kStackSlotsBitCount; |   5464       kStackSlotsFirstBit + kStackSlotsBitCount; | 
|   5478   static const int kHasFunctionCacheBitCount = 1; |   5465   static const int kHasFunctionCacheBitCount = 1; | 
|   5479   static const int kMarkedForDeoptimizationFirstBit = |   5466   static const int kMarkedForDeoptimizationFirstBit = | 
|   5480       kStackSlotsFirstBit + kStackSlotsBitCount + 1; |   5467       kStackSlotsFirstBit + kStackSlotsBitCount + 1; | 
| (...skipping 5149 matching lines...) Expand 10 before | Expand all | Expand 10 after  Loading... | 
|  10630     } else { |  10617     } else { | 
|  10631       value &= ~(1 << bit_position); |  10618       value &= ~(1 << bit_position); | 
|  10632     } |  10619     } | 
|  10633     return value; |  10620     return value; | 
|  10634   } |  10621   } | 
|  10635 }; |  10622 }; | 
|  10636  |  10623  | 
|  10637 } }  // namespace v8::internal |  10624 } }  // namespace v8::internal | 
|  10638  |  10625  | 
|  10639 #endif  // V8_OBJECTS_H_ |  10626 #endif  // V8_OBJECTS_H_ | 
| OLD | NEW |