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 5218 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
5229 inline void set_flags(Flags flags); | 5229 inline void set_flags(Flags flags); |
5230 | 5230 |
5231 // [flags]: Access to specific code flags. | 5231 // [flags]: Access to specific code flags. |
5232 inline Kind kind(); | 5232 inline Kind kind(); |
5233 inline Kind handler_kind() { | 5233 inline Kind handler_kind() { |
5234 return static_cast<Kind>(arguments_count()); | 5234 return static_cast<Kind>(arguments_count()); |
5235 } | 5235 } |
5236 inline InlineCacheState ic_state(); // Only valid for IC stubs. | 5236 inline InlineCacheState ic_state(); // Only valid for IC stubs. |
5237 inline ExtraICState extra_ic_state(); // Only valid for IC stubs. | 5237 inline ExtraICState extra_ic_state(); // Only valid for IC stubs. |
5238 | 5238 |
5239 inline ExtraICState extended_extra_ic_state(); // Only valid for | |
5240 // non-call IC stubs. | |
5241 static bool needs_extended_extra_ic_state(Kind kind) { | |
5242 // TODO(danno): This is a bit of a hack right now since there are still | |
5243 // clients of this API that pass "extra" values in for argc. These clients | |
5244 // should be retrofitted to used ExtendedExtraICState. | |
5245 return kind == COMPARE_NIL_IC || kind == TO_BOOLEAN_IC || | |
5246 kind == BINARY_OP_IC; | |
5247 } | |
5248 | |
5249 inline StubType type(); // Only valid for monomorphic IC stubs. | 5239 inline StubType type(); // Only valid for monomorphic IC stubs. |
5250 inline int arguments_count(); // Only valid for call IC stubs. | 5240 inline int arguments_count(); // Only valid for call IC stubs. |
5251 | 5241 |
5252 // Testers for IC stub kinds. | 5242 // Testers for IC stub kinds. |
5253 inline bool is_inline_cache_stub(); | 5243 inline bool is_inline_cache_stub(); |
5254 inline bool is_debug_stub(); | 5244 inline bool is_debug_stub(); |
5255 inline bool is_handler() { return kind() == HANDLER; } | 5245 inline bool is_handler() { return kind() == HANDLER; } |
5256 inline bool is_load_stub() { return kind() == LOAD_IC; } | 5246 inline bool is_load_stub() { return kind() == LOAD_IC; } |
5257 inline bool is_keyed_load_stub() { return kind() == KEYED_LOAD_IC; } | 5247 inline bool is_keyed_load_stub() { return kind() == KEYED_LOAD_IC; } |
5258 inline bool is_store_stub() { return kind() == STORE_IC; } | 5248 inline bool is_store_stub() { return kind() == STORE_IC; } |
(...skipping 120 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
5379 // which would make snapshot production non-reproducible. This method wipes | 5369 // which would make snapshot production non-reproducible. This method wipes |
5380 // out the to-be-overwritten header data for reproducible snapshots. | 5370 // out the to-be-overwritten header data for reproducible snapshots. |
5381 inline void WipeOutHeader(); | 5371 inline void WipeOutHeader(); |
5382 | 5372 |
5383 // Flags operations. | 5373 // Flags operations. |
5384 static inline Flags ComputeFlags( | 5374 static inline Flags ComputeFlags( |
5385 Kind kind, | 5375 Kind kind, |
5386 InlineCacheState ic_state = UNINITIALIZED, | 5376 InlineCacheState ic_state = UNINITIALIZED, |
5387 ExtraICState extra_ic_state = kNoExtraICState, | 5377 ExtraICState extra_ic_state = kNoExtraICState, |
5388 StubType type = NORMAL, | 5378 StubType type = NORMAL, |
5389 int argc = -1, | 5379 Kind handler_kind = STUB, |
5390 InlineCacheHolderFlag holder = OWN_MAP); | 5380 InlineCacheHolderFlag holder = OWN_MAP); |
5391 | 5381 |
5392 static inline Flags ComputeMonomorphicFlags( | 5382 static inline Flags ComputeMonomorphicFlags( |
5393 Kind kind, | 5383 Kind kind, |
5394 ExtraICState extra_ic_state = kNoExtraICState, | 5384 ExtraICState extra_ic_state = kNoExtraICState, |
5395 InlineCacheHolderFlag holder = OWN_MAP, | 5385 InlineCacheHolderFlag holder = OWN_MAP, |
5396 StubType type = NORMAL, | 5386 StubType type = NORMAL, |
5397 int argc = -1); | 5387 Kind handler_kind = STUB); |
5398 | 5388 |
5399 static inline InlineCacheState ExtractICStateFromFlags(Flags flags); | 5389 static inline InlineCacheState ExtractICStateFromFlags(Flags flags); |
5400 static inline StubType ExtractTypeFromFlags(Flags flags); | 5390 static inline StubType ExtractTypeFromFlags(Flags flags); |
5401 static inline Kind ExtractKindFromFlags(Flags flags); | 5391 static inline Kind ExtractKindFromFlags(Flags flags); |
5402 static inline InlineCacheHolderFlag ExtractCacheHolderFromFlags(Flags flags); | 5392 static inline InlineCacheHolderFlag ExtractCacheHolderFromFlags(Flags flags); |
5403 static inline ExtraICState ExtractExtraICStateFromFlags(Flags flags); | 5393 static inline ExtraICState ExtractExtraICStateFromFlags(Flags flags); |
5404 static inline ExtraICState ExtractExtendedExtraICStateFromFlags(Flags flags); | |
5405 static inline int ExtractArgumentsCountFromFlags(Flags flags); | 5394 static inline int ExtractArgumentsCountFromFlags(Flags flags); |
5406 | 5395 |
5407 static inline Flags RemoveTypeFromFlags(Flags flags); | 5396 static inline Flags RemoveTypeFromFlags(Flags flags); |
5408 | 5397 |
5409 // Convert a target address into a code object. | 5398 // Convert a target address into a code object. |
5410 static inline Code* GetCodeFromTargetAddress(Address address); | 5399 static inline Code* GetCodeFromTargetAddress(Address address); |
5411 | 5400 |
5412 // Convert an entry address into an object. | 5401 // Convert an entry address into an object. |
5413 static inline Object* GetObjectFromEntryAddress(Address location_of_address); | 5402 static inline Object* GetObjectFromEntryAddress(Address location_of_address); |
5414 | 5403 |
(...skipping 145 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
5560 | 5549 |
5561 static const int kAllowOSRAtLoopNestingLevelOffset = kFullCodeFlags + 1; | 5550 static const int kAllowOSRAtLoopNestingLevelOffset = kFullCodeFlags + 1; |
5562 static const int kProfilerTicksOffset = kAllowOSRAtLoopNestingLevelOffset + 1; | 5551 static const int kProfilerTicksOffset = kAllowOSRAtLoopNestingLevelOffset + 1; |
5563 | 5552 |
5564 // Flags layout. BitField<type, shift, size>. | 5553 // Flags layout. BitField<type, shift, size>. |
5565 class ICStateField: public BitField<InlineCacheState, 0, 3> {}; | 5554 class ICStateField: public BitField<InlineCacheState, 0, 3> {}; |
5566 class TypeField: public BitField<StubType, 3, 1> {}; | 5555 class TypeField: public BitField<StubType, 3, 1> {}; |
5567 class CacheHolderField: public BitField<InlineCacheHolderFlag, 5, 1> {}; | 5556 class CacheHolderField: public BitField<InlineCacheHolderFlag, 5, 1> {}; |
5568 class KindField: public BitField<Kind, 6, 4> {}; | 5557 class KindField: public BitField<Kind, 6, 4> {}; |
5569 // TODO(bmeurer): Bit 10 is available for free use. :-) | 5558 // TODO(bmeurer): Bit 10 is available for free use. :-) |
5570 class ExtraICStateField: public BitField<ExtraICState, 11, 6> {}; | 5559 class ExtraICStateField: public BitField<ExtraICState, 11, |
5571 class ExtendedExtraICStateField: public BitField<ExtraICState, 11, | |
5572 PlatformSmiTagging::kSmiValueSize - 11 + 1> {}; // NOLINT | 5560 PlatformSmiTagging::kSmiValueSize - 11 + 1> {}; // NOLINT |
5573 STATIC_ASSERT(ExtraICStateField::kShift == ExtendedExtraICStateField::kShift); | |
5574 | 5561 |
5575 // KindSpecificFlags1 layout (STUB and OPTIMIZED_FUNCTION) | 5562 // KindSpecificFlags1 layout (STUB and OPTIMIZED_FUNCTION) |
5576 static const int kStackSlotsFirstBit = 0; | 5563 static const int kStackSlotsFirstBit = 0; |
5577 static const int kStackSlotsBitCount = 24; | 5564 static const int kStackSlotsBitCount = 24; |
5578 static const int kHasFunctionCacheFirstBit = | 5565 static const int kHasFunctionCacheFirstBit = |
5579 kStackSlotsFirstBit + kStackSlotsBitCount; | 5566 kStackSlotsFirstBit + kStackSlotsBitCount; |
5580 static const int kHasFunctionCacheBitCount = 1; | 5567 static const int kHasFunctionCacheBitCount = 1; |
5581 static const int kMarkedForDeoptimizationFirstBit = | 5568 static const int kMarkedForDeoptimizationFirstBit = |
5582 kStackSlotsFirstBit + kStackSlotsBitCount + 1; | 5569 kStackSlotsFirstBit + kStackSlotsBitCount + 1; |
5583 static const int kMarkedForDeoptimizationBitCount = 1; | 5570 static const int kMarkedForDeoptimizationBitCount = 1; |
(...skipping 40 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
5624 class BackEdgesPatchedForOSRField: public BitField<bool, | 5611 class BackEdgesPatchedForOSRField: public BitField<bool, |
5625 kIsCrankshaftedBit + 1 + 29, 1> {}; // NOLINT | 5612 kIsCrankshaftedBit + 1 + 29, 1> {}; // NOLINT |
5626 | 5613 |
5627 // Signed field cannot be encoded using the BitField class. | 5614 // Signed field cannot be encoded using the BitField class. |
5628 static const int kArgumentsCountShift = 17; | 5615 static const int kArgumentsCountShift = 17; |
5629 static const int kArgumentsCountMask = ~((1 << kArgumentsCountShift) - 1); | 5616 static const int kArgumentsCountMask = ~((1 << kArgumentsCountShift) - 1); |
5630 static const int kArgumentsBits = | 5617 static const int kArgumentsBits = |
5631 PlatformSmiTagging::kSmiValueSize - Code::kArgumentsCountShift + 1; | 5618 PlatformSmiTagging::kSmiValueSize - Code::kArgumentsCountShift + 1; |
5632 static const int kMaxArguments = (1 << kArgumentsBits) - 1; | 5619 static const int kMaxArguments = (1 << kArgumentsBits) - 1; |
5633 | 5620 |
5634 // ICs can use either argument count or ExtendedExtraIC, since their storage | |
5635 // overlaps. | |
5636 STATIC_ASSERT(ExtraICStateField::kShift + | |
5637 ExtraICStateField::kSize + kArgumentsBits == | |
5638 ExtendedExtraICStateField::kShift + | |
5639 ExtendedExtraICStateField::kSize); | |
5640 | |
5641 // This constant should be encodable in an ARM instruction. | 5621 // This constant should be encodable in an ARM instruction. |
5642 static const int kFlagsNotUsedInLookup = | 5622 static const int kFlagsNotUsedInLookup = |
5643 TypeField::kMask | CacheHolderField::kMask; | 5623 TypeField::kMask | CacheHolderField::kMask; |
5644 | 5624 |
5645 private: | 5625 private: |
5646 friend class RelocIterator; | 5626 friend class RelocIterator; |
5647 | 5627 |
5648 void ClearInlineCaches(Kind* kind); | 5628 void ClearInlineCaches(Kind* kind); |
5649 | 5629 |
5650 // Code aging | 5630 // Code aging |
(...skipping 5110 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
10761 } else { | 10741 } else { |
10762 value &= ~(1 << bit_position); | 10742 value &= ~(1 << bit_position); |
10763 } | 10743 } |
10764 return value; | 10744 return value; |
10765 } | 10745 } |
10766 }; | 10746 }; |
10767 | 10747 |
10768 } } // namespace v8::internal | 10748 } } // namespace v8::internal |
10769 | 10749 |
10770 #endif // V8_OBJECTS_H_ | 10750 #endif // V8_OBJECTS_H_ |
OLD | NEW |