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 5296 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
5307 inline bool is_load_stub() { return kind() == LOAD_IC; } | 5307 inline bool is_load_stub() { return kind() == LOAD_IC; } |
5308 inline bool is_keyed_load_stub() { return kind() == KEYED_LOAD_IC; } | 5308 inline bool is_keyed_load_stub() { return kind() == KEYED_LOAD_IC; } |
5309 inline bool is_store_stub() { return kind() == STORE_IC; } | 5309 inline bool is_store_stub() { return kind() == STORE_IC; } |
5310 inline bool is_keyed_store_stub() { return kind() == KEYED_STORE_IC; } | 5310 inline bool is_keyed_store_stub() { return kind() == KEYED_STORE_IC; } |
5311 inline bool is_binary_op_stub() { return kind() == BINARY_OP_IC; } | 5311 inline bool is_binary_op_stub() { return kind() == BINARY_OP_IC; } |
5312 inline bool is_compare_ic_stub() { return kind() == COMPARE_IC; } | 5312 inline bool is_compare_ic_stub() { return kind() == COMPARE_IC; } |
5313 inline bool is_compare_nil_ic_stub() { return kind() == COMPARE_NIL_IC; } | 5313 inline bool is_compare_nil_ic_stub() { return kind() == COMPARE_NIL_IC; } |
5314 inline bool is_to_boolean_ic_stub() { return kind() == TO_BOOLEAN_IC; } | 5314 inline bool is_to_boolean_ic_stub() { return kind() == TO_BOOLEAN_IC; } |
5315 inline bool is_keyed_stub(); | 5315 inline bool is_keyed_stub(); |
5316 inline bool is_optimized_code() { return kind() == OPTIMIZED_FUNCTION; } | 5316 inline bool is_optimized_code() { return kind() == OPTIMIZED_FUNCTION; } |
| 5317 inline bool can_be_weak_stub() { |
| 5318 Kind k = kind(); |
| 5319 return (k == LOAD_IC || k == STORE_IC || k == KEYED_LOAD_IC || |
| 5320 k == KEYED_STORE_IC || k == COMPARE_NIL_IC) && |
| 5321 ic_state() == MONOMORPHIC; |
| 5322 } |
| 5323 inline bool is_weak_stub(); |
| 5324 inline void mark_as_weak_stub(); |
| 5325 inline bool is_invalidated_weak_stub(); |
| 5326 inline void mark_as_invalidated_weak_stub(); |
5317 | 5327 |
5318 inline void set_raw_kind_specific_flags1(int value); | 5328 inline void set_raw_kind_specific_flags1(int value); |
5319 inline void set_raw_kind_specific_flags2(int value); | 5329 inline void set_raw_kind_specific_flags2(int value); |
5320 | 5330 |
5321 // [major_key]: For kind STUB or BINARY_OP_IC, the major key. | 5331 // [major_key]: For kind STUB or BINARY_OP_IC, the major key. |
5322 inline int major_key(); | 5332 inline int major_key(); |
5323 inline void set_major_key(int value); | 5333 inline void set_major_key(int value); |
5324 inline bool has_major_key(); | 5334 inline bool has_major_key(); |
5325 | 5335 |
5326 // For kind STUB or ICs, tells whether or not a code object was generated by | 5336 // For kind STUB or ICs, tells whether or not a code object was generated by |
(...skipping 237 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
5564 return GetCodeAgeStub(isolate, kNotExecutedCodeAge, NO_MARKING_PARITY); | 5574 return GetCodeAgeStub(isolate, kNotExecutedCodeAge, NO_MARKING_PARITY); |
5565 } | 5575 } |
5566 | 5576 |
5567 void PrintDeoptLocation(FILE* out, int bailout_id); | 5577 void PrintDeoptLocation(FILE* out, int bailout_id); |
5568 bool CanDeoptAt(Address pc); | 5578 bool CanDeoptAt(Address pc); |
5569 | 5579 |
5570 #ifdef VERIFY_HEAP | 5580 #ifdef VERIFY_HEAP |
5571 void VerifyEmbeddedObjectsDependency(); | 5581 void VerifyEmbeddedObjectsDependency(); |
5572 #endif | 5582 #endif |
5573 | 5583 |
| 5584 inline bool CanContainWeakObjects() { |
| 5585 return is_optimized_code() || is_weak_stub(); |
| 5586 } |
| 5587 |
5574 inline bool IsWeakObject(Object* object) { | 5588 inline bool IsWeakObject(Object* object) { |
5575 return is_optimized_code() && IsWeakObjectInOptimizedCode(object); | 5589 return (is_optimized_code() && IsWeakObjectInOptimizedCode(object)) || |
| 5590 (is_weak_stub() && IsWeakObjectInIC(object)); |
5576 } | 5591 } |
5577 | 5592 |
5578 inline bool IsWeakObjectInOptimizedCode(Object* object); | 5593 inline bool IsWeakObjectInOptimizedCode(Object* object); |
| 5594 inline bool IsWeakObjectInIC(Object* object); |
5579 | 5595 |
5580 // Max loop nesting marker used to postpose OSR. We don't take loop | 5596 // Max loop nesting marker used to postpose OSR. We don't take loop |
5581 // nesting that is deeper than 5 levels into account. | 5597 // nesting that is deeper than 5 levels into account. |
5582 static const int kMaxLoopNestingMarker = 6; | 5598 static const int kMaxLoopNestingMarker = 6; |
5583 | 5599 |
5584 // Layout description. | 5600 // Layout description. |
5585 static const int kInstructionSizeOffset = HeapObject::kHeaderSize; | 5601 static const int kInstructionSizeOffset = HeapObject::kHeaderSize; |
5586 static const int kRelocationInfoOffset = kInstructionSizeOffset + kIntSize; | 5602 static const int kRelocationInfoOffset = kInstructionSizeOffset + kIntSize; |
5587 static const int kHandlerTableOffset = kRelocationInfoOffset + kPointerSize; | 5603 static const int kHandlerTableOffset = kRelocationInfoOffset + kPointerSize; |
5588 static const int kDeoptimizationDataOffset = | 5604 static const int kDeoptimizationDataOffset = |
(...skipping 42 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
5631 | 5647 |
5632 // KindSpecificFlags1 layout (STUB and OPTIMIZED_FUNCTION) | 5648 // KindSpecificFlags1 layout (STUB and OPTIMIZED_FUNCTION) |
5633 static const int kStackSlotsFirstBit = 0; | 5649 static const int kStackSlotsFirstBit = 0; |
5634 static const int kStackSlotsBitCount = 24; | 5650 static const int kStackSlotsBitCount = 24; |
5635 static const int kHasFunctionCacheFirstBit = | 5651 static const int kHasFunctionCacheFirstBit = |
5636 kStackSlotsFirstBit + kStackSlotsBitCount; | 5652 kStackSlotsFirstBit + kStackSlotsBitCount; |
5637 static const int kHasFunctionCacheBitCount = 1; | 5653 static const int kHasFunctionCacheBitCount = 1; |
5638 static const int kMarkedForDeoptimizationFirstBit = | 5654 static const int kMarkedForDeoptimizationFirstBit = |
5639 kStackSlotsFirstBit + kStackSlotsBitCount + 1; | 5655 kStackSlotsFirstBit + kStackSlotsBitCount + 1; |
5640 static const int kMarkedForDeoptimizationBitCount = 1; | 5656 static const int kMarkedForDeoptimizationBitCount = 1; |
| 5657 static const int kWeakStubFirstBit = |
| 5658 kMarkedForDeoptimizationFirstBit + kMarkedForDeoptimizationBitCount; |
| 5659 static const int kWeakStubBitCount = 1; |
| 5660 static const int kInvalidatedWeakStubFirstBit = |
| 5661 kWeakStubFirstBit + kWeakStubBitCount; |
| 5662 static const int kInvalidatedWeakStubBitCount = 1; |
5641 | 5663 |
5642 STATIC_ASSERT(kStackSlotsFirstBit + kStackSlotsBitCount <= 32); | 5664 STATIC_ASSERT(kStackSlotsFirstBit + kStackSlotsBitCount <= 32); |
5643 STATIC_ASSERT(kHasFunctionCacheFirstBit + kHasFunctionCacheBitCount <= 32); | 5665 STATIC_ASSERT(kHasFunctionCacheFirstBit + kHasFunctionCacheBitCount <= 32); |
5644 STATIC_ASSERT(kMarkedForDeoptimizationFirstBit + | 5666 STATIC_ASSERT(kInvalidatedWeakStubFirstBit + |
5645 kMarkedForDeoptimizationBitCount <= 32); | 5667 kInvalidatedWeakStubBitCount <= 32); |
5646 | 5668 |
5647 class StackSlotsField: public BitField<int, | 5669 class StackSlotsField: public BitField<int, |
5648 kStackSlotsFirstBit, kStackSlotsBitCount> {}; // NOLINT | 5670 kStackSlotsFirstBit, kStackSlotsBitCount> {}; // NOLINT |
5649 class HasFunctionCacheField: public BitField<bool, | 5671 class HasFunctionCacheField: public BitField<bool, |
5650 kHasFunctionCacheFirstBit, kHasFunctionCacheBitCount> {}; // NOLINT | 5672 kHasFunctionCacheFirstBit, kHasFunctionCacheBitCount> {}; // NOLINT |
5651 class MarkedForDeoptimizationField: public BitField<bool, | 5673 class MarkedForDeoptimizationField: public BitField<bool, |
5652 kMarkedForDeoptimizationFirstBit, | 5674 kMarkedForDeoptimizationFirstBit, |
5653 kMarkedForDeoptimizationBitCount> {}; // NOLINT | 5675 kMarkedForDeoptimizationBitCount> {}; // NOLINT |
| 5676 class WeakStubField: public BitField<bool, |
| 5677 kWeakStubFirstBit, |
| 5678 kWeakStubBitCount> {}; // NOLINT |
| 5679 class InvalidatedWeakStubField: public BitField<bool, |
| 5680 kInvalidatedWeakStubFirstBit, |
| 5681 kInvalidatedWeakStubBitCount> {}; // NOLINT |
5654 | 5682 |
5655 // KindSpecificFlags2 layout (ALL) | 5683 // KindSpecificFlags2 layout (ALL) |
5656 static const int kIsCrankshaftedBit = 0; | 5684 static const int kIsCrankshaftedBit = 0; |
5657 class IsCrankshaftedField: public BitField<bool, | 5685 class IsCrankshaftedField: public BitField<bool, |
5658 kIsCrankshaftedBit, 1> {}; // NOLINT | 5686 kIsCrankshaftedBit, 1> {}; // NOLINT |
5659 | 5687 |
5660 // KindSpecificFlags2 layout (STUB and OPTIMIZED_FUNCTION) | 5688 // KindSpecificFlags2 layout (STUB and OPTIMIZED_FUNCTION) |
5661 static const int kStubMajorKeyFirstBit = kIsCrankshaftedBit + 1; | 5689 static const int kStubMajorKeyFirstBit = kIsCrankshaftedBit + 1; |
5662 static const int kSafepointTableOffsetFirstBit = | 5690 static const int kSafepointTableOffsetFirstBit = |
5663 kStubMajorKeyFirstBit + kStubMajorKeyBits; | 5691 kStubMajorKeyFirstBit + kStubMajorKeyBits; |
(...skipping 433 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
6097 // [constructor]: points back to the function responsible for this map. | 6125 // [constructor]: points back to the function responsible for this map. |
6098 DECL_ACCESSORS(constructor, Object) | 6126 DECL_ACCESSORS(constructor, Object) |
6099 | 6127 |
6100 // [instance descriptors]: describes the object. | 6128 // [instance descriptors]: describes the object. |
6101 DECL_ACCESSORS(instance_descriptors, DescriptorArray) | 6129 DECL_ACCESSORS(instance_descriptors, DescriptorArray) |
6102 inline void InitializeDescriptors(DescriptorArray* descriptors); | 6130 inline void InitializeDescriptors(DescriptorArray* descriptors); |
6103 | 6131 |
6104 // [stub cache]: contains stubs compiled for this map. | 6132 // [stub cache]: contains stubs compiled for this map. |
6105 DECL_ACCESSORS(code_cache, Object) | 6133 DECL_ACCESSORS(code_cache, Object) |
6106 | 6134 |
6107 // [dependent code]: list of optimized codes that have this map embedded. | 6135 // [dependent code]: list of optimized codes that weakly embed this map. |
6108 DECL_ACCESSORS(dependent_code, DependentCode) | 6136 DECL_ACCESSORS(dependent_code, DependentCode) |
6109 | 6137 |
| 6138 // [depenent ic]: list of IC stubs that weakly embed this map. |
| 6139 // This points to the head of the list or to the undefined value. |
| 6140 // IC stubs in the list are linked using the next_code_link field. |
| 6141 DECL_ACCESSORS(dependent_ic, Object) |
| 6142 |
6110 // [back pointer]: points back to the parent map from which a transition | 6143 // [back pointer]: points back to the parent map from which a transition |
6111 // leads to this map. The field overlaps with prototype transitions and the | 6144 // leads to this map. The field overlaps with prototype transitions and the |
6112 // back pointer will be moved into the prototype transitions array if | 6145 // back pointer will be moved into the prototype transitions array if |
6113 // required. | 6146 // required. |
6114 inline Object* GetBackPointer(); | 6147 inline Object* GetBackPointer(); |
6115 inline void SetBackPointer(Object* value, | 6148 inline void SetBackPointer(Object* value, |
6116 WriteBarrierMode mode = UPDATE_WRITE_BARRIER); | 6149 WriteBarrierMode mode = UPDATE_WRITE_BARRIER); |
6117 inline void init_back_pointer(Object* undefined); | 6150 inline void init_back_pointer(Object* undefined); |
6118 | 6151 |
6119 // [prototype transitions]: cache of prototype transitions. | 6152 // [prototype transitions]: cache of prototype transitions. |
(...skipping 263 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
6383 // the descriptor array. | 6416 // the descriptor array. |
6384 inline void NotifyLeafMapLayoutChange(); | 6417 inline void NotifyLeafMapLayoutChange(); |
6385 | 6418 |
6386 inline bool CanOmitMapChecks(); | 6419 inline bool CanOmitMapChecks(); |
6387 | 6420 |
6388 void AddDependentCompilationInfo(DependentCode::DependencyGroup group, | 6421 void AddDependentCompilationInfo(DependentCode::DependencyGroup group, |
6389 CompilationInfo* info); | 6422 CompilationInfo* info); |
6390 | 6423 |
6391 void AddDependentCode(DependentCode::DependencyGroup group, | 6424 void AddDependentCode(DependentCode::DependencyGroup group, |
6392 Handle<Code> code); | 6425 Handle<Code> code); |
| 6426 void AddDependentIC(Handle<Code> stub); |
6393 | 6427 |
6394 bool IsMapInArrayPrototypeChain(); | 6428 bool IsMapInArrayPrototypeChain(); |
6395 | 6429 |
6396 // Dispatched behavior. | 6430 // Dispatched behavior. |
6397 DECLARE_PRINTER(Map) | 6431 DECLARE_PRINTER(Map) |
6398 DECLARE_VERIFIER(Map) | 6432 DECLARE_VERIFIER(Map) |
6399 | 6433 |
6400 #ifdef VERIFY_HEAP | 6434 #ifdef VERIFY_HEAP |
6401 void SharedMapVerify(); | 6435 void SharedMapVerify(); |
6402 void VerifyOmittedMapChecks(); | 6436 void VerifyOmittedMapChecks(); |
(...skipping 30 matching lines...) Expand all Loading... |
6433 // Storage for the transition array is overloaded to directly contain a back | 6467 // Storage for the transition array is overloaded to directly contain a back |
6434 // pointer if unused. When the map has transitions, the back pointer is | 6468 // pointer if unused. When the map has transitions, the back pointer is |
6435 // transferred to the transition array and accessed through an extra | 6469 // transferred to the transition array and accessed through an extra |
6436 // indirection. | 6470 // indirection. |
6437 static const int kTransitionsOrBackPointerOffset = | 6471 static const int kTransitionsOrBackPointerOffset = |
6438 kConstructorOffset + kPointerSize; | 6472 kConstructorOffset + kPointerSize; |
6439 static const int kDescriptorsOffset = | 6473 static const int kDescriptorsOffset = |
6440 kTransitionsOrBackPointerOffset + kPointerSize; | 6474 kTransitionsOrBackPointerOffset + kPointerSize; |
6441 static const int kCodeCacheOffset = kDescriptorsOffset + kPointerSize; | 6475 static const int kCodeCacheOffset = kDescriptorsOffset + kPointerSize; |
6442 static const int kDependentCodeOffset = kCodeCacheOffset + kPointerSize; | 6476 static const int kDependentCodeOffset = kCodeCacheOffset + kPointerSize; |
6443 static const int kBitField3Offset = kDependentCodeOffset + kPointerSize; | 6477 static const int kDependentICOffset = kDependentCodeOffset + kPointerSize; |
| 6478 static const int kBitField3Offset = kDependentICOffset + kPointerSize; |
6444 static const int kSize = kBitField3Offset + kPointerSize; | 6479 static const int kSize = kBitField3Offset + kPointerSize; |
6445 | 6480 |
6446 // Layout of pointer fields. Heap iteration code relies on them | 6481 // Layout of pointer fields. Heap iteration code relies on them |
6447 // being continuously allocated. | 6482 // being continuously allocated. |
6448 static const int kPointerFieldsBeginOffset = Map::kPrototypeOffset; | 6483 static const int kPointerFieldsBeginOffset = Map::kPrototypeOffset; |
6449 static const int kPointerFieldsEndOffset = kBitField3Offset + kPointerSize; | 6484 static const int kPointerFieldsEndOffset = kDependentICOffset + kPointerSize; |
| 6485 static const int kFirstWeakFieldOffset = kDependentICOffset; |
6450 | 6486 |
6451 // Byte offsets within kInstanceSizesOffset. | 6487 // Byte offsets within kInstanceSizesOffset. |
6452 static const int kInstanceSizeOffset = kInstanceSizesOffset + 0; | 6488 static const int kInstanceSizeOffset = kInstanceSizesOffset + 0; |
6453 static const int kInObjectPropertiesByte = 1; | 6489 static const int kInObjectPropertiesByte = 1; |
6454 static const int kInObjectPropertiesOffset = | 6490 static const int kInObjectPropertiesOffset = |
6455 kInstanceSizesOffset + kInObjectPropertiesByte; | 6491 kInstanceSizesOffset + kInObjectPropertiesByte; |
6456 static const int kPreAllocatedPropertyFieldsByte = 2; | 6492 static const int kPreAllocatedPropertyFieldsByte = 2; |
6457 static const int kPreAllocatedPropertyFieldsOffset = | 6493 static const int kPreAllocatedPropertyFieldsOffset = |
6458 kInstanceSizesOffset + kPreAllocatedPropertyFieldsByte; | 6494 kInstanceSizesOffset + kPreAllocatedPropertyFieldsByte; |
6459 static const int kVisitorIdByte = 3; | 6495 static const int kVisitorIdByte = 3; |
(...skipping 4367 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
10827 } else { | 10863 } else { |
10828 value &= ~(1 << bit_position); | 10864 value &= ~(1 << bit_position); |
10829 } | 10865 } |
10830 return value; | 10866 return value; |
10831 } | 10867 } |
10832 }; | 10868 }; |
10833 | 10869 |
10834 } } // namespace v8::internal | 10870 } } // namespace v8::internal |
10835 | 10871 |
10836 #endif // V8_OBJECTS_H_ | 10872 #endif // V8_OBJECTS_H_ |
OLD | NEW |