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 // Review notes: | 5 // Review notes: |
6 // | 6 // |
7 // - The use of macros in these inline functions may seem superfluous | 7 // - The use of macros in these inline functions may seem superfluous |
8 // but it is absolutely needed to make sure gcc generates optimal | 8 // but it is absolutely needed to make sure gcc generates optimal |
9 // code. gcc is not happy when attempting to inline too deep. | 9 // code. gcc is not happy when attempting to inline too deep. |
10 // | 10 // |
(...skipping 4633 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
4644 void Code::set_compiled_optimizable(bool value) { | 4644 void Code::set_compiled_optimizable(bool value) { |
4645 ASSERT_EQ(FUNCTION, kind()); | 4645 ASSERT_EQ(FUNCTION, kind()); |
4646 byte flags = READ_BYTE_FIELD(this, kFullCodeFlags); | 4646 byte flags = READ_BYTE_FIELD(this, kFullCodeFlags); |
4647 flags = FullCodeFlagsIsCompiledOptimizable::update(flags, value); | 4647 flags = FullCodeFlagsIsCompiledOptimizable::update(flags, value); |
4648 WRITE_BYTE_FIELD(this, kFullCodeFlags, flags); | 4648 WRITE_BYTE_FIELD(this, kFullCodeFlags, flags); |
4649 } | 4649 } |
4650 | 4650 |
4651 | 4651 |
4652 int Code::allow_osr_at_loop_nesting_level() { | 4652 int Code::allow_osr_at_loop_nesting_level() { |
4653 ASSERT_EQ(FUNCTION, kind()); | 4653 ASSERT_EQ(FUNCTION, kind()); |
4654 return READ_BYTE_FIELD(this, kAllowOSRAtLoopNestingLevelOffset); | 4654 int fields = READ_UINT32_FIELD(this, kKindSpecificFlags2Offset); |
| 4655 return AllowOSRAtLoopNestingLevelField::decode(fields); |
4655 } | 4656 } |
4656 | 4657 |
4657 | 4658 |
4658 void Code::set_allow_osr_at_loop_nesting_level(int level) { | 4659 void Code::set_allow_osr_at_loop_nesting_level(int level) { |
4659 ASSERT_EQ(FUNCTION, kind()); | 4660 ASSERT_EQ(FUNCTION, kind()); |
4660 ASSERT(level >= 0 && level <= kMaxLoopNestingMarker); | 4661 ASSERT(level >= 0 && level <= kMaxLoopNestingMarker); |
4661 WRITE_BYTE_FIELD(this, kAllowOSRAtLoopNestingLevelOffset, level); | 4662 int previous = READ_UINT32_FIELD(this, kKindSpecificFlags2Offset); |
| 4663 int updated = AllowOSRAtLoopNestingLevelField::update(previous, level); |
| 4664 WRITE_UINT32_FIELD(this, kKindSpecificFlags2Offset, updated); |
4662 } | 4665 } |
4663 | 4666 |
4664 | 4667 |
4665 int Code::profiler_ticks() { | 4668 int Code::profiler_ticks() { |
4666 ASSERT_EQ(FUNCTION, kind()); | 4669 ASSERT_EQ(FUNCTION, kind()); |
4667 return READ_BYTE_FIELD(this, kProfilerTicksOffset); | 4670 return READ_BYTE_FIELD(this, kProfilerTicksOffset); |
4668 } | 4671 } |
4669 | 4672 |
4670 | 4673 |
4671 void Code::set_profiler_ticks(int ticks) { | 4674 void Code::set_profiler_ticks(int ticks) { |
(...skipping 32 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
4704 ASSERT(IsAligned(offset, static_cast<unsigned>(kIntSize))); | 4707 ASSERT(IsAligned(offset, static_cast<unsigned>(kIntSize))); |
4705 int previous = READ_UINT32_FIELD(this, kKindSpecificFlags2Offset); | 4708 int previous = READ_UINT32_FIELD(this, kKindSpecificFlags2Offset); |
4706 int updated = SafepointTableOffsetField::update(previous, offset); | 4709 int updated = SafepointTableOffsetField::update(previous, offset); |
4707 WRITE_UINT32_FIELD(this, kKindSpecificFlags2Offset, updated); | 4710 WRITE_UINT32_FIELD(this, kKindSpecificFlags2Offset, updated); |
4708 } | 4711 } |
4709 | 4712 |
4710 | 4713 |
4711 unsigned Code::back_edge_table_offset() { | 4714 unsigned Code::back_edge_table_offset() { |
4712 ASSERT_EQ(FUNCTION, kind()); | 4715 ASSERT_EQ(FUNCTION, kind()); |
4713 return BackEdgeTableOffsetField::decode( | 4716 return BackEdgeTableOffsetField::decode( |
4714 READ_UINT32_FIELD(this, kKindSpecificFlags2Offset)); | 4717 READ_UINT32_FIELD(this, kKindSpecificFlags2Offset)) << kIntSizeLog2; |
4715 } | 4718 } |
4716 | 4719 |
4717 | 4720 |
4718 void Code::set_back_edge_table_offset(unsigned offset) { | 4721 void Code::set_back_edge_table_offset(unsigned offset) { |
4719 ASSERT_EQ(FUNCTION, kind()); | 4722 ASSERT_EQ(FUNCTION, kind()); |
4720 ASSERT(IsAligned(offset, static_cast<unsigned>(kIntSize))); | 4723 ASSERT(IsAligned(offset, static_cast<unsigned>(kIntSize))); |
| 4724 offset = offset >> kIntSizeLog2; |
4721 int previous = READ_UINT32_FIELD(this, kKindSpecificFlags2Offset); | 4725 int previous = READ_UINT32_FIELD(this, kKindSpecificFlags2Offset); |
4722 int updated = BackEdgeTableOffsetField::update(previous, offset); | 4726 int updated = BackEdgeTableOffsetField::update(previous, offset); |
4723 WRITE_UINT32_FIELD(this, kKindSpecificFlags2Offset, updated); | 4727 WRITE_UINT32_FIELD(this, kKindSpecificFlags2Offset, updated); |
4724 } | 4728 } |
4725 | 4729 |
4726 | 4730 |
4727 bool Code::back_edges_patched_for_osr() { | 4731 bool Code::back_edges_patched_for_osr() { |
4728 ASSERT_EQ(FUNCTION, kind()); | 4732 ASSERT_EQ(FUNCTION, kind()); |
4729 return BackEdgesPatchedForOSRField::decode( | 4733 return allow_osr_at_loop_nesting_level() > 0; |
4730 READ_UINT32_FIELD(this, kKindSpecificFlags2Offset)); | |
4731 } | 4734 } |
4732 | 4735 |
4733 | 4736 |
4734 void Code::set_back_edges_patched_for_osr(bool value) { | |
4735 ASSERT_EQ(FUNCTION, kind()); | |
4736 int previous = READ_UINT32_FIELD(this, kKindSpecificFlags2Offset); | |
4737 int updated = BackEdgesPatchedForOSRField::update(previous, value); | |
4738 WRITE_UINT32_FIELD(this, kKindSpecificFlags2Offset, updated); | |
4739 } | |
4740 | |
4741 | |
4742 | |
4743 byte Code::to_boolean_state() { | 4737 byte Code::to_boolean_state() { |
4744 return extra_ic_state(); | 4738 return extra_ic_state(); |
4745 } | 4739 } |
4746 | 4740 |
4747 | 4741 |
4748 bool Code::has_function_cache() { | 4742 bool Code::has_function_cache() { |
4749 ASSERT(kind() == STUB); | 4743 ASSERT(kind() == STUB); |
4750 return HasFunctionCacheField::decode( | 4744 return HasFunctionCacheField::decode( |
4751 READ_UINT32_FIELD(this, kKindSpecificFlags1Offset)); | 4745 READ_UINT32_FIELD(this, kKindSpecificFlags1Offset)); |
4752 } | 4746 } |
(...skipping 2248 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
7001 #undef READ_SHORT_FIELD | 6995 #undef READ_SHORT_FIELD |
7002 #undef WRITE_SHORT_FIELD | 6996 #undef WRITE_SHORT_FIELD |
7003 #undef READ_BYTE_FIELD | 6997 #undef READ_BYTE_FIELD |
7004 #undef WRITE_BYTE_FIELD | 6998 #undef WRITE_BYTE_FIELD |
7005 #undef NOBARRIER_READ_BYTE_FIELD | 6999 #undef NOBARRIER_READ_BYTE_FIELD |
7006 #undef NOBARRIER_WRITE_BYTE_FIELD | 7000 #undef NOBARRIER_WRITE_BYTE_FIELD |
7007 | 7001 |
7008 } } // namespace v8::internal | 7002 } } // namespace v8::internal |
7009 | 7003 |
7010 #endif // V8_OBJECTS_INL_H_ | 7004 #endif // V8_OBJECTS_INL_H_ |
OLD | NEW |