OLD | NEW |
1 // Copyright 2012 the V8 project authors. All rights reserved. | 1 // Copyright 2012 the V8 project authors. All rights reserved. |
2 // Use of this source code is governed by a BSD-style license that can be | 2 // Use of this source code is governed by a BSD-style license that can be |
3 // found in the LICENSE file. | 3 // found in the LICENSE file. |
4 | 4 |
5 #ifndef V8_OBJECTS_H_ | 5 #ifndef V8_OBJECTS_H_ |
6 #define V8_OBJECTS_H_ | 6 #define V8_OBJECTS_H_ |
7 | 7 |
8 #include <iosfwd> | 8 #include <iosfwd> |
9 | 9 |
10 #include "src/allocation.h" | 10 #include "src/allocation.h" |
(...skipping 5114 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
5125 // compiler (but it may not be an optimized function). | 5125 // compiler (but it may not be an optimized function). |
5126 inline bool is_crankshafted(); | 5126 inline bool is_crankshafted(); |
5127 inline bool is_hydrogen_stub(); // Crankshafted, but not a function. | 5127 inline bool is_hydrogen_stub(); // Crankshafted, but not a function. |
5128 inline void set_is_crankshafted(bool value); | 5128 inline void set_is_crankshafted(bool value); |
5129 | 5129 |
5130 // [is_turbofanned]: For kind STUB or OPTIMIZED_FUNCTION, tells whether the | 5130 // [is_turbofanned]: For kind STUB or OPTIMIZED_FUNCTION, tells whether the |
5131 // code object was generated by the TurboFan optimizing compiler. | 5131 // code object was generated by the TurboFan optimizing compiler. |
5132 inline bool is_turbofanned(); | 5132 inline bool is_turbofanned(); |
5133 inline void set_is_turbofanned(bool value); | 5133 inline void set_is_turbofanned(bool value); |
5134 | 5134 |
| 5135 // [can_have_weak_objects]: For kind OPTIMIZED_FUNCTION, tells whether the |
| 5136 // embedded objects in code should be treated weakly. |
| 5137 inline bool can_have_weak_objects(); |
| 5138 inline void set_can_have_weak_objects(bool value); |
| 5139 |
5135 // [optimizable]: For FUNCTION kind, tells if it is optimizable. | 5140 // [optimizable]: For FUNCTION kind, tells if it is optimizable. |
5136 inline bool optimizable(); | 5141 inline bool optimizable(); |
5137 inline void set_optimizable(bool value); | 5142 inline void set_optimizable(bool value); |
5138 | 5143 |
5139 // [has_deoptimization_support]: For FUNCTION kind, tells if it has | 5144 // [has_deoptimization_support]: For FUNCTION kind, tells if it has |
5140 // deoptimization support. | 5145 // deoptimization support. |
5141 inline bool has_deoptimization_support(); | 5146 inline bool has_deoptimization_support(); |
5142 inline void set_has_deoptimization_support(bool value); | 5147 inline void set_has_deoptimization_support(bool value); |
5143 | 5148 |
5144 // [has_debug_break_slots]: For FUNCTION kind, tells if it has | 5149 // [has_debug_break_slots]: For FUNCTION kind, tells if it has |
(...skipping 237 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
5382 bool CanDeoptAt(Address pc); | 5387 bool CanDeoptAt(Address pc); |
5383 | 5388 |
5384 #ifdef VERIFY_HEAP | 5389 #ifdef VERIFY_HEAP |
5385 void VerifyEmbeddedObjectsDependency(); | 5390 void VerifyEmbeddedObjectsDependency(); |
5386 #endif | 5391 #endif |
5387 | 5392 |
5388 #ifdef DEBUG | 5393 #ifdef DEBUG |
5389 void VerifyEmbeddedObjectsInFullCode(); | 5394 void VerifyEmbeddedObjectsInFullCode(); |
5390 #endif // DEBUG | 5395 #endif // DEBUG |
5391 | 5396 |
5392 inline bool CanContainWeakObjects() { return is_optimized_code(); } | 5397 inline bool CanContainWeakObjects() { |
| 5398 // is_turbofanned() implies !can_have_weak_objects(). |
| 5399 DCHECK(!is_optimized_code() || !is_turbofanned() || |
| 5400 !can_have_weak_objects()); |
| 5401 return is_optimized_code() && can_have_weak_objects(); |
| 5402 } |
5393 | 5403 |
5394 inline bool IsWeakObject(Object* object) { | 5404 inline bool IsWeakObject(Object* object) { |
5395 return (is_optimized_code() && !is_turbofanned() && | 5405 return (CanContainWeakObjects() && IsWeakObjectInOptimizedCode(object)); |
5396 IsWeakObjectInOptimizedCode(object)); | |
5397 } | 5406 } |
5398 | 5407 |
5399 static inline bool IsWeakObjectInOptimizedCode(Object* object); | 5408 static inline bool IsWeakObjectInOptimizedCode(Object* object); |
5400 | 5409 |
5401 // Max loop nesting marker used to postpose OSR. We don't take loop | 5410 // Max loop nesting marker used to postpose OSR. We don't take loop |
5402 // nesting that is deeper than 5 levels into account. | 5411 // nesting that is deeper than 5 levels into account. |
5403 static const int kMaxLoopNestingMarker = 6; | 5412 static const int kMaxLoopNestingMarker = 6; |
5404 | 5413 |
5405 // Layout description. | 5414 // Layout description. |
5406 static const int kRelocationInfoOffset = HeapObject::kHeaderSize; | 5415 static const int kRelocationInfoOffset = HeapObject::kHeaderSize; |
(...skipping 45 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
5452 class ExtraICStateField: public BitField<ExtraICState, 11, | 5461 class ExtraICStateField: public BitField<ExtraICState, 11, |
5453 PlatformSmiTagging::kSmiValueSize - 11 + 1> {}; // NOLINT | 5462 PlatformSmiTagging::kSmiValueSize - 11 + 1> {}; // NOLINT |
5454 | 5463 |
5455 // KindSpecificFlags1 layout (STUB and OPTIMIZED_FUNCTION) | 5464 // KindSpecificFlags1 layout (STUB and OPTIMIZED_FUNCTION) |
5456 static const int kStackSlotsFirstBit = 0; | 5465 static const int kStackSlotsFirstBit = 0; |
5457 static const int kStackSlotsBitCount = 24; | 5466 static const int kStackSlotsBitCount = 24; |
5458 static const int kHasFunctionCacheBit = | 5467 static const int kHasFunctionCacheBit = |
5459 kStackSlotsFirstBit + kStackSlotsBitCount; | 5468 kStackSlotsFirstBit + kStackSlotsBitCount; |
5460 static const int kMarkedForDeoptimizationBit = kHasFunctionCacheBit + 1; | 5469 static const int kMarkedForDeoptimizationBit = kHasFunctionCacheBit + 1; |
5461 static const int kIsTurbofannedBit = kMarkedForDeoptimizationBit + 1; | 5470 static const int kIsTurbofannedBit = kMarkedForDeoptimizationBit + 1; |
| 5471 static const int kCanHaveWeakObjects = kIsTurbofannedBit + 1; |
5462 | 5472 |
5463 STATIC_ASSERT(kStackSlotsFirstBit + kStackSlotsBitCount <= 32); | 5473 STATIC_ASSERT(kStackSlotsFirstBit + kStackSlotsBitCount <= 32); |
5464 STATIC_ASSERT(kIsTurbofannedBit + 1 <= 32); | 5474 STATIC_ASSERT(kCanHaveWeakObjects + 1 <= 32); |
5465 | 5475 |
5466 class StackSlotsField: public BitField<int, | 5476 class StackSlotsField: public BitField<int, |
5467 kStackSlotsFirstBit, kStackSlotsBitCount> {}; // NOLINT | 5477 kStackSlotsFirstBit, kStackSlotsBitCount> {}; // NOLINT |
5468 class HasFunctionCacheField : public BitField<bool, kHasFunctionCacheBit, 1> { | 5478 class HasFunctionCacheField : public BitField<bool, kHasFunctionCacheBit, 1> { |
5469 }; // NOLINT | 5479 }; // NOLINT |
5470 class MarkedForDeoptimizationField | 5480 class MarkedForDeoptimizationField |
5471 : public BitField<bool, kMarkedForDeoptimizationBit, 1> {}; // NOLINT | 5481 : public BitField<bool, kMarkedForDeoptimizationBit, 1> {}; // NOLINT |
5472 class IsTurbofannedField : public BitField<bool, kIsTurbofannedBit, 1> { | 5482 class IsTurbofannedField : public BitField<bool, kIsTurbofannedBit, 1> { |
5473 }; // NOLINT | 5483 }; // NOLINT |
| 5484 class CanHaveWeakObjectsField |
| 5485 : public BitField<bool, kCanHaveWeakObjects, 1> {}; // NOLINT |
5474 | 5486 |
5475 // KindSpecificFlags2 layout (ALL) | 5487 // KindSpecificFlags2 layout (ALL) |
5476 static const int kIsCrankshaftedBit = 0; | 5488 static const int kIsCrankshaftedBit = 0; |
5477 class IsCrankshaftedField: public BitField<bool, | 5489 class IsCrankshaftedField: public BitField<bool, |
5478 kIsCrankshaftedBit, 1> {}; // NOLINT | 5490 kIsCrankshaftedBit, 1> {}; // NOLINT |
5479 | 5491 |
5480 // KindSpecificFlags2 layout (STUB and OPTIMIZED_FUNCTION) | 5492 // KindSpecificFlags2 layout (STUB and OPTIMIZED_FUNCTION) |
5481 static const int kSafepointTableOffsetFirstBit = kIsCrankshaftedBit + 1; | 5493 static const int kSafepointTableOffsetFirstBit = kIsCrankshaftedBit + 1; |
5482 static const int kSafepointTableOffsetBitCount = 24; | 5494 static const int kSafepointTableOffsetBitCount = 24; |
5483 | 5495 |
(...skipping 5426 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
10910 } else { | 10922 } else { |
10911 value &= ~(1 << bit_position); | 10923 value &= ~(1 << bit_position); |
10912 } | 10924 } |
10913 return value; | 10925 return value; |
10914 } | 10926 } |
10915 }; | 10927 }; |
10916 | 10928 |
10917 } } // namespace v8::internal | 10929 } } // namespace v8::internal |
10918 | 10930 |
10919 #endif // V8_OBJECTS_H_ | 10931 #endif // V8_OBJECTS_H_ |
OLD | NEW |