OLD | NEW |
1 // Copyright 2015 the V8 project authors. All rights reserved. | 1 // Copyright 2015 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/assert-scope.h" | 10 #include "src/assert-scope.h" |
(...skipping 4499 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
4510 inline int register_count() const; | 4510 inline int register_count() const; |
4511 | 4511 |
4512 // Accessors for parameter count (including implicit 'this' receiver). | 4512 // Accessors for parameter count (including implicit 'this' receiver). |
4513 inline int parameter_count() const; | 4513 inline int parameter_count() const; |
4514 inline void set_parameter_count(int number_of_parameters); | 4514 inline void set_parameter_count(int number_of_parameters); |
4515 | 4515 |
4516 // Accessors for profiling count. | 4516 // Accessors for profiling count. |
4517 inline int interrupt_budget() const; | 4517 inline int interrupt_budget() const; |
4518 inline void set_interrupt_budget(int interrupt_budget); | 4518 inline void set_interrupt_budget(int interrupt_budget); |
4519 | 4519 |
| 4520 // Accessors for OSR loop nesting level. |
| 4521 inline int osr_loop_nesting_level() const; |
| 4522 inline void set_osr_loop_nesting_level(int depth); |
| 4523 |
4520 // Accessors for the constant pool. | 4524 // Accessors for the constant pool. |
4521 DECL_ACCESSORS(constant_pool, FixedArray) | 4525 DECL_ACCESSORS(constant_pool, FixedArray) |
4522 | 4526 |
4523 // Accessors for handler table containing offsets of exception handlers. | 4527 // Accessors for handler table containing offsets of exception handlers. |
4524 DECL_ACCESSORS(handler_table, FixedArray) | 4528 DECL_ACCESSORS(handler_table, FixedArray) |
4525 | 4529 |
4526 // Accessors for source position table containing mappings between byte code | 4530 // Accessors for source position table containing mappings between byte code |
4527 // offset and source position. | 4531 // offset and source position. |
4528 DECL_ACCESSORS(source_position_table, ByteArray) | 4532 DECL_ACCESSORS(source_position_table, ByteArray) |
4529 | 4533 |
(...skipping 19 matching lines...) Expand all Loading... |
4549 void CopyBytecodesTo(BytecodeArray* to); | 4553 void CopyBytecodesTo(BytecodeArray* to); |
4550 | 4554 |
4551 // Layout description. | 4555 // Layout description. |
4552 static const int kConstantPoolOffset = FixedArrayBase::kHeaderSize; | 4556 static const int kConstantPoolOffset = FixedArrayBase::kHeaderSize; |
4553 static const int kHandlerTableOffset = kConstantPoolOffset + kPointerSize; | 4557 static const int kHandlerTableOffset = kConstantPoolOffset + kPointerSize; |
4554 static const int kSourcePositionTableOffset = | 4558 static const int kSourcePositionTableOffset = |
4555 kHandlerTableOffset + kPointerSize; | 4559 kHandlerTableOffset + kPointerSize; |
4556 static const int kFrameSizeOffset = kSourcePositionTableOffset + kPointerSize; | 4560 static const int kFrameSizeOffset = kSourcePositionTableOffset + kPointerSize; |
4557 static const int kParameterSizeOffset = kFrameSizeOffset + kIntSize; | 4561 static const int kParameterSizeOffset = kFrameSizeOffset + kIntSize; |
4558 static const int kInterruptBudgetOffset = kParameterSizeOffset + kIntSize; | 4562 static const int kInterruptBudgetOffset = kParameterSizeOffset + kIntSize; |
4559 static const int kHeaderSize = kInterruptBudgetOffset + kIntSize; | 4563 // TODO(4764): The OSR nesting level is guaranteed to be in [0;6] bounds and |
| 4564 // could potentially be merged with another field (e.g. parameter_size). |
| 4565 static const int kOSRNestingLevelOffset = kInterruptBudgetOffset + kIntSize; |
| 4566 static const int kHeaderSize = kOSRNestingLevelOffset + kIntSize; |
4560 | 4567 |
4561 // Maximal memory consumption for a single BytecodeArray. | 4568 // Maximal memory consumption for a single BytecodeArray. |
4562 static const int kMaxSize = 512 * MB; | 4569 static const int kMaxSize = 512 * MB; |
4563 // Maximal length of a single BytecodeArray. | 4570 // Maximal length of a single BytecodeArray. |
4564 static const int kMaxLength = kMaxSize - kHeaderSize; | 4571 static const int kMaxLength = kMaxSize - kHeaderSize; |
4565 | 4572 |
4566 class BodyDescriptor; | 4573 class BodyDescriptor; |
4567 | 4574 |
4568 private: | 4575 private: |
4569 DISALLOW_IMPLICIT_CONSTRUCTORS(BytecodeArray); | 4576 DISALLOW_IMPLICIT_CONSTRUCTORS(BytecodeArray); |
(...skipping 781 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
5351 | 5358 |
5352 inline bool CanContainWeakObjects(); | 5359 inline bool CanContainWeakObjects(); |
5353 | 5360 |
5354 inline bool IsWeakObject(Object* object); | 5361 inline bool IsWeakObject(Object* object); |
5355 | 5362 |
5356 static inline bool IsWeakObjectInOptimizedCode(Object* object); | 5363 static inline bool IsWeakObjectInOptimizedCode(Object* object); |
5357 | 5364 |
5358 static Handle<WeakCell> WeakCellFor(Handle<Code> code); | 5365 static Handle<WeakCell> WeakCellFor(Handle<Code> code); |
5359 WeakCell* CachedWeakCell(); | 5366 WeakCell* CachedWeakCell(); |
5360 | 5367 |
5361 // Max loop nesting marker used to postpose OSR. We don't take loop | |
5362 // nesting that is deeper than 5 levels into account. | |
5363 static const int kMaxLoopNestingMarker = 6; | |
5364 | |
5365 static const int kConstantPoolSize = | 5368 static const int kConstantPoolSize = |
5366 FLAG_enable_embedded_constant_pool ? kIntSize : 0; | 5369 FLAG_enable_embedded_constant_pool ? kIntSize : 0; |
5367 | 5370 |
5368 // Layout description. | 5371 // Layout description. |
5369 static const int kRelocationInfoOffset = HeapObject::kHeaderSize; | 5372 static const int kRelocationInfoOffset = HeapObject::kHeaderSize; |
5370 static const int kHandlerTableOffset = kRelocationInfoOffset + kPointerSize; | 5373 static const int kHandlerTableOffset = kRelocationInfoOffset + kPointerSize; |
5371 static const int kDeoptimizationDataOffset = | 5374 static const int kDeoptimizationDataOffset = |
5372 kHandlerTableOffset + kPointerSize; | 5375 kHandlerTableOffset + kPointerSize; |
5373 static const int kSourcePositionTableOffset = | 5376 static const int kSourcePositionTableOffset = |
5374 kDeoptimizationDataOffset + kPointerSize; | 5377 kDeoptimizationDataOffset + kPointerSize; |
(...skipping 83 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
5458 | 5461 |
5459 class SafepointTableOffsetField: public BitField<int, | 5462 class SafepointTableOffsetField: public BitField<int, |
5460 kSafepointTableOffsetFirstBit, | 5463 kSafepointTableOffsetFirstBit, |
5461 kSafepointTableOffsetBitCount> {}; // NOLINT | 5464 kSafepointTableOffsetBitCount> {}; // NOLINT |
5462 | 5465 |
5463 // KindSpecificFlags2 layout (FUNCTION) | 5466 // KindSpecificFlags2 layout (FUNCTION) |
5464 class BackEdgeTableOffsetField: public BitField<int, | 5467 class BackEdgeTableOffsetField: public BitField<int, |
5465 kIsCrankshaftedBit + 1, 27> {}; // NOLINT | 5468 kIsCrankshaftedBit + 1, 27> {}; // NOLINT |
5466 class AllowOSRAtLoopNestingLevelField: public BitField<int, | 5469 class AllowOSRAtLoopNestingLevelField: public BitField<int, |
5467 kIsCrankshaftedBit + 1 + 27, 4> {}; // NOLINT | 5470 kIsCrankshaftedBit + 1 + 27, 4> {}; // NOLINT |
5468 STATIC_ASSERT(AllowOSRAtLoopNestingLevelField::kMax >= kMaxLoopNestingMarker); | |
5469 | 5471 |
5470 static const int kArgumentsBits = 16; | 5472 static const int kArgumentsBits = 16; |
5471 static const int kMaxArguments = (1 << kArgumentsBits) - 1; | 5473 static const int kMaxArguments = (1 << kArgumentsBits) - 1; |
5472 | 5474 |
5473 // This constant should be encodable in an ARM instruction. | 5475 // This constant should be encodable in an ARM instruction. |
5474 static const int kFlagsNotUsedInLookup = CacheHolderField::kMask; | 5476 static const int kFlagsNotUsedInLookup = CacheHolderField::kMask; |
5475 | 5477 |
5476 private: | 5478 private: |
5477 friend class RelocIterator; | 5479 friend class RelocIterator; |
5478 friend class Deoptimizer; // For FindCodeAgeSequence. | 5480 friend class Deoptimizer; // For FindCodeAgeSequence. |
(...skipping 51 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
5530 // Returns the AbstractCode::Kind of the code. | 5532 // Returns the AbstractCode::Kind of the code. |
5531 inline Kind kind(); | 5533 inline Kind kind(); |
5532 | 5534 |
5533 // Calculate the size of the code object to report for log events. This takes | 5535 // Calculate the size of the code object to report for log events. This takes |
5534 // the layout of the code object into account. | 5536 // the layout of the code object into account. |
5535 inline int ExecutableSize(); | 5537 inline int ExecutableSize(); |
5536 | 5538 |
5537 DECLARE_CAST(AbstractCode) | 5539 DECLARE_CAST(AbstractCode) |
5538 inline Code* GetCode(); | 5540 inline Code* GetCode(); |
5539 inline BytecodeArray* GetBytecodeArray(); | 5541 inline BytecodeArray* GetBytecodeArray(); |
| 5542 |
| 5543 // Max loop nesting marker used to postpose OSR. We don't take loop |
| 5544 // nesting that is deeper than 5 levels into account. |
| 5545 static const int kMaxLoopNestingMarker = 6; |
| 5546 STATIC_ASSERT(Code::AllowOSRAtLoopNestingLevelField::kMax >= |
| 5547 kMaxLoopNestingMarker); |
5540 }; | 5548 }; |
5541 | 5549 |
5542 // Dependent code is a singly linked list of fixed arrays. Each array contains | 5550 // Dependent code is a singly linked list of fixed arrays. Each array contains |
5543 // code objects in weak cells for one dependent group. The suffix of the array | 5551 // code objects in weak cells for one dependent group. The suffix of the array |
5544 // can be filled with the undefined value if the number of codes is less than | 5552 // can be filled with the undefined value if the number of codes is less than |
5545 // the length of the array. | 5553 // the length of the array. |
5546 // | 5554 // |
5547 // +------+-----------------+--------+--------+-----+--------+-----------+-----+ | 5555 // +------+-----------------+--------+--------+-----+--------+-----------+-----+ |
5548 // | next | count & group 1 | code 1 | code 2 | ... | code n | undefined | ... | | 5556 // | next | count & group 1 | code 1 | code 2 | ... | code n | undefined | ... | |
5549 // +------+-----------------+--------+--------+-----+--------+-----------+-----+ | 5557 // +------+-----------------+--------+--------+-----+--------+-----------+-----+ |
(...skipping 5454 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
11004 } | 11012 } |
11005 return value; | 11013 return value; |
11006 } | 11014 } |
11007 }; | 11015 }; |
11008 | 11016 |
11009 | 11017 |
11010 } // NOLINT, false-positive due to second-order macros. | 11018 } // NOLINT, false-positive due to second-order macros. |
11011 } // NOLINT, false-positive due to second-order macros. | 11019 } // NOLINT, false-positive due to second-order macros. |
11012 | 11020 |
11013 #endif // V8_OBJECTS_H_ | 11021 #endif // V8_OBJECTS_H_ |
OLD | NEW |