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 4590 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
4601 SMI_ACCESSORS(SharedFunctionInfo, expected_nof_properties, | 4601 SMI_ACCESSORS(SharedFunctionInfo, expected_nof_properties, |
4602 kExpectedNofPropertiesOffset) | 4602 kExpectedNofPropertiesOffset) |
4603 SMI_ACCESSORS(SharedFunctionInfo, num_literals, kNumLiteralsOffset) | 4603 SMI_ACCESSORS(SharedFunctionInfo, num_literals, kNumLiteralsOffset) |
4604 SMI_ACCESSORS(SharedFunctionInfo, start_position_and_type, | 4604 SMI_ACCESSORS(SharedFunctionInfo, start_position_and_type, |
4605 kStartPositionAndTypeOffset) | 4605 kStartPositionAndTypeOffset) |
4606 SMI_ACCESSORS(SharedFunctionInfo, end_position, kEndPositionOffset) | 4606 SMI_ACCESSORS(SharedFunctionInfo, end_position, kEndPositionOffset) |
4607 SMI_ACCESSORS(SharedFunctionInfo, function_token_position, | 4607 SMI_ACCESSORS(SharedFunctionInfo, function_token_position, |
4608 kFunctionTokenPositionOffset) | 4608 kFunctionTokenPositionOffset) |
4609 SMI_ACCESSORS(SharedFunctionInfo, compiler_hints, | 4609 SMI_ACCESSORS(SharedFunctionInfo, compiler_hints, |
4610 kCompilerHintsOffset) | 4610 kCompilerHintsOffset) |
4611 SMI_ACCESSORS(SharedFunctionInfo, opt_count, kOptCountOffset) | 4611 SMI_ACCESSORS(SharedFunctionInfo, opt_count_and_bailout_reason, |
| 4612 kOptCountAndBailoutReasonOffset) |
4612 SMI_ACCESSORS(SharedFunctionInfo, counters, kCountersOffset) | 4613 SMI_ACCESSORS(SharedFunctionInfo, counters, kCountersOffset) |
4613 | 4614 |
4614 #else | 4615 #else |
4615 | 4616 |
4616 #define PSEUDO_SMI_ACCESSORS_LO(holder, name, offset) \ | 4617 #define PSEUDO_SMI_ACCESSORS_LO(holder, name, offset) \ |
4617 STATIC_ASSERT(holder::offset % kPointerSize == 0); \ | 4618 STATIC_ASSERT(holder::offset % kPointerSize == 0); \ |
4618 int holder::name() { \ | 4619 int holder::name() { \ |
4619 int value = READ_INT_FIELD(this, offset); \ | 4620 int value = READ_INT_FIELD(this, offset); \ |
4620 ASSERT(kHeapObjectTag == 1); \ | 4621 ASSERT(kHeapObjectTag == 1); \ |
4621 ASSERT((value & kHeapObjectTag) == 0); \ | 4622 ASSERT((value & kHeapObjectTag) == 0); \ |
(...skipping 28 matching lines...) Expand all Loading... |
4650 start_position_and_type, | 4651 start_position_and_type, |
4651 kStartPositionAndTypeOffset) | 4652 kStartPositionAndTypeOffset) |
4652 | 4653 |
4653 PSEUDO_SMI_ACCESSORS_LO(SharedFunctionInfo, | 4654 PSEUDO_SMI_ACCESSORS_LO(SharedFunctionInfo, |
4654 function_token_position, | 4655 function_token_position, |
4655 kFunctionTokenPositionOffset) | 4656 kFunctionTokenPositionOffset) |
4656 PSEUDO_SMI_ACCESSORS_HI(SharedFunctionInfo, | 4657 PSEUDO_SMI_ACCESSORS_HI(SharedFunctionInfo, |
4657 compiler_hints, | 4658 compiler_hints, |
4658 kCompilerHintsOffset) | 4659 kCompilerHintsOffset) |
4659 | 4660 |
4660 PSEUDO_SMI_ACCESSORS_LO(SharedFunctionInfo, opt_count, kOptCountOffset) | 4661 PSEUDO_SMI_ACCESSORS_LO(SharedFunctionInfo, |
| 4662 opt_count_and_bailout_reason, |
| 4663 kOptCountAndBailoutReasonOffset) |
4661 | 4664 |
4662 PSEUDO_SMI_ACCESSORS_HI(SharedFunctionInfo, counters, kCountersOffset) | 4665 PSEUDO_SMI_ACCESSORS_HI(SharedFunctionInfo, counters, kCountersOffset) |
4663 | 4666 |
4664 #endif | 4667 #endif |
4665 | 4668 |
4666 | 4669 |
4667 int SharedFunctionInfo::construction_count() { | 4670 int SharedFunctionInfo::construction_count() { |
4668 return READ_BYTE_FIELD(this, kConstructionCountOffset); | 4671 return READ_BYTE_FIELD(this, kConstructionCountOffset); |
4669 } | 4672 } |
4670 | 4673 |
(...skipping 226 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
4897 int SharedFunctionInfo::opt_reenable_tries() { | 4900 int SharedFunctionInfo::opt_reenable_tries() { |
4898 return OptReenableTriesBits::decode(counters()); | 4901 return OptReenableTriesBits::decode(counters()); |
4899 } | 4902 } |
4900 | 4903 |
4901 | 4904 |
4902 void SharedFunctionInfo::set_opt_reenable_tries(int tries) { | 4905 void SharedFunctionInfo::set_opt_reenable_tries(int tries) { |
4903 set_counters(OptReenableTriesBits::update(counters(), tries)); | 4906 set_counters(OptReenableTriesBits::update(counters(), tries)); |
4904 } | 4907 } |
4905 | 4908 |
4906 | 4909 |
| 4910 int SharedFunctionInfo::opt_count() { |
| 4911 return OptCountBits::decode(opt_count_and_bailout_reason()); |
| 4912 } |
| 4913 |
| 4914 |
| 4915 void SharedFunctionInfo::set_opt_count(int opt_count) { |
| 4916 set_opt_count_and_bailout_reason( |
| 4917 OptCountBits::update(opt_count_and_bailout_reason(), opt_count)); |
| 4918 } |
| 4919 |
| 4920 |
| 4921 BailoutReason SharedFunctionInfo::DisableOptimizationReason() { |
| 4922 BailoutReason reason = static_cast<BailoutReason>( |
| 4923 DisabledOptimizationReasonBits::decode(opt_count_and_bailout_reason())); |
| 4924 return reason; |
| 4925 } |
| 4926 |
| 4927 |
4907 bool SharedFunctionInfo::has_deoptimization_support() { | 4928 bool SharedFunctionInfo::has_deoptimization_support() { |
4908 Code* code = this->code(); | 4929 Code* code = this->code(); |
4909 return code->kind() == Code::FUNCTION && code->has_deoptimization_support(); | 4930 return code->kind() == Code::FUNCTION && code->has_deoptimization_support(); |
4910 } | 4931 } |
4911 | 4932 |
4912 | 4933 |
4913 void SharedFunctionInfo::TryReenableOptimization() { | 4934 void SharedFunctionInfo::TryReenableOptimization() { |
4914 int tries = opt_reenable_tries(); | 4935 int tries = opt_reenable_tries(); |
4915 set_opt_reenable_tries((tries + 1) & OptReenableTriesBits::kMax); | 4936 set_opt_reenable_tries((tries + 1) & OptReenableTriesBits::kMax); |
4916 // We reenable optimization whenever the number of tries is a large | 4937 // We reenable optimization whenever the number of tries is a large |
(...skipping 1368 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
6285 #undef WRITE_UINT32_FIELD | 6306 #undef WRITE_UINT32_FIELD |
6286 #undef READ_SHORT_FIELD | 6307 #undef READ_SHORT_FIELD |
6287 #undef WRITE_SHORT_FIELD | 6308 #undef WRITE_SHORT_FIELD |
6288 #undef READ_BYTE_FIELD | 6309 #undef READ_BYTE_FIELD |
6289 #undef WRITE_BYTE_FIELD | 6310 #undef WRITE_BYTE_FIELD |
6290 | 6311 |
6291 | 6312 |
6292 } } // namespace v8::internal | 6313 } } // namespace v8::internal |
6293 | 6314 |
6294 #endif // V8_OBJECTS_INL_H_ | 6315 #endif // V8_OBJECTS_INL_H_ |
OLD | NEW |