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 5393 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
5404 // Bit field containing various information collected by the compiler to | 5404 // Bit field containing various information collected by the compiler to |
5405 // drive optimization. | 5405 // drive optimization. |
5406 inline int compiler_hints(); | 5406 inline int compiler_hints(); |
5407 inline void set_compiler_hints(int value); | 5407 inline void set_compiler_hints(int value); |
5408 | 5408 |
5409 inline int ast_node_count(); | 5409 inline int ast_node_count(); |
5410 inline void set_ast_node_count(int count); | 5410 inline void set_ast_node_count(int count); |
5411 | 5411 |
5412 // A counter used to determine when to stress the deoptimizer with a | 5412 // A counter used to determine when to stress the deoptimizer with a |
5413 // deopt. | 5413 // deopt. |
5414 inline int deopt_counter(); | 5414 inline int stress_deopt_counter(); |
5415 inline void set_deopt_counter(int counter); | 5415 inline void set_stress_deopt_counter(int counter); |
5416 | 5416 |
5417 inline int profiler_ticks(); | 5417 inline int profiler_ticks(); |
5418 | 5418 |
5419 // Inline cache age is used to infer whether the function survived a context | 5419 // Inline cache age is used to infer whether the function survived a context |
5420 // disposal or not. In the former case we reset the opt_count. | 5420 // disposal or not. In the former case we reset the opt_count. |
5421 inline int ic_age(); | 5421 inline int ic_age(); |
5422 inline void set_ic_age(int age); | 5422 inline void set_ic_age(int age); |
5423 | 5423 |
5424 // Add information on assignments of the form this.x = ...; | 5424 // Add information on assignments of the form this.x = ...; |
5425 void SetThisPropertyAssignmentsInfo( | 5425 void SetThisPropertyAssignmentsInfo( |
(...skipping 107 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
5533 inline void set_this_property_assignments_count(int value); | 5533 inline void set_this_property_assignments_count(int value); |
5534 String* GetThisPropertyAssignmentName(int index); | 5534 String* GetThisPropertyAssignmentName(int index); |
5535 bool IsThisPropertyAssignmentArgument(int index); | 5535 bool IsThisPropertyAssignmentArgument(int index); |
5536 int GetThisPropertyAssignmentArgument(int index); | 5536 int GetThisPropertyAssignmentArgument(int index); |
5537 Object* GetThisPropertyAssignmentConstant(int index); | 5537 Object* GetThisPropertyAssignmentConstant(int index); |
5538 | 5538 |
5539 // [source code]: Source code for the function. | 5539 // [source code]: Source code for the function. |
5540 bool HasSourceCode(); | 5540 bool HasSourceCode(); |
5541 Handle<Object> GetSourceCode(); | 5541 Handle<Object> GetSourceCode(); |
5542 | 5542 |
| 5543 // Number of times the function was optimized. |
5543 inline int opt_count(); | 5544 inline int opt_count(); |
5544 inline void set_opt_count(int opt_count); | 5545 inline void set_opt_count(int opt_count); |
5545 | 5546 |
| 5547 // Number of times the function was deoptimized. |
| 5548 inline void set_deopt_count(int value); |
| 5549 inline int deopt_count(); |
| 5550 inline void increment_deopt_count(); |
| 5551 |
| 5552 // Number of time we tried to re-enable optimization after it |
| 5553 // was disabled due to high number of deoptimizations. |
| 5554 inline void set_opt_reenable_tries(int value); |
| 5555 inline int opt_reenable_tries(); |
| 5556 |
| 5557 inline void TryReenableOptimization(); |
| 5558 |
| 5559 // Stores deopt_count, opt_reenable_tries and ic_age as bit-fields. |
| 5560 inline void set_counters(int value); |
| 5561 inline int counters(); |
| 5562 |
5546 // Source size of this function. | 5563 // Source size of this function. |
5547 int SourceSize(); | 5564 int SourceSize(); |
5548 | 5565 |
5549 // Calculate the instance size. | 5566 // Calculate the instance size. |
5550 int CalculateInstanceSize(); | 5567 int CalculateInstanceSize(); |
5551 | 5568 |
5552 // Calculate the number of in-object properties. | 5569 // Calculate the number of in-object properties. |
5553 int CalculateInObjectProperties(); | 5570 int CalculateInObjectProperties(); |
5554 | 5571 |
5555 // Dispatched behavior. | 5572 // Dispatched behavior. |
(...skipping 36 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
5592 kConstructStubOffset + kPointerSize; | 5609 kConstructStubOffset + kPointerSize; |
5593 static const int kFunctionDataOffset = | 5610 static const int kFunctionDataOffset = |
5594 kInstanceClassNameOffset + kPointerSize; | 5611 kInstanceClassNameOffset + kPointerSize; |
5595 static const int kScriptOffset = kFunctionDataOffset + kPointerSize; | 5612 static const int kScriptOffset = kFunctionDataOffset + kPointerSize; |
5596 static const int kDebugInfoOffset = kScriptOffset + kPointerSize; | 5613 static const int kDebugInfoOffset = kScriptOffset + kPointerSize; |
5597 static const int kInferredNameOffset = kDebugInfoOffset + kPointerSize; | 5614 static const int kInferredNameOffset = kDebugInfoOffset + kPointerSize; |
5598 static const int kInitialMapOffset = | 5615 static const int kInitialMapOffset = |
5599 kInferredNameOffset + kPointerSize; | 5616 kInferredNameOffset + kPointerSize; |
5600 static const int kThisPropertyAssignmentsOffset = | 5617 static const int kThisPropertyAssignmentsOffset = |
5601 kInitialMapOffset + kPointerSize; | 5618 kInitialMapOffset + kPointerSize; |
5602 // ic_age is a Smi field. It could be grouped with another Smi field into a | 5619 // ast_node_count is a Smi field. It could be grouped with another Smi field |
5603 // PSEUDO_SMI_ACCESSORS pair (on x64), if one becomes available. | 5620 // into a PSEUDO_SMI_ACCESSORS pair (on x64), if one becomes available. |
5604 static const int kICAgeOffset = kThisPropertyAssignmentsOffset + kPointerSize; | 5621 static const int kAstNodeCountOffset = |
| 5622 kThisPropertyAssignmentsOffset + kPointerSize; |
5605 #if V8_HOST_ARCH_32_BIT | 5623 #if V8_HOST_ARCH_32_BIT |
5606 // Smi fields. | 5624 // Smi fields. |
5607 static const int kLengthOffset = | 5625 static const int kLengthOffset = |
5608 kICAgeOffset + kPointerSize; | 5626 kAstNodeCountOffset + kPointerSize; |
5609 static const int kFormalParameterCountOffset = kLengthOffset + kPointerSize; | 5627 static const int kFormalParameterCountOffset = kLengthOffset + kPointerSize; |
5610 static const int kExpectedNofPropertiesOffset = | 5628 static const int kExpectedNofPropertiesOffset = |
5611 kFormalParameterCountOffset + kPointerSize; | 5629 kFormalParameterCountOffset + kPointerSize; |
5612 static const int kNumLiteralsOffset = | 5630 static const int kNumLiteralsOffset = |
5613 kExpectedNofPropertiesOffset + kPointerSize; | 5631 kExpectedNofPropertiesOffset + kPointerSize; |
5614 static const int kStartPositionAndTypeOffset = | 5632 static const int kStartPositionAndTypeOffset = |
5615 kNumLiteralsOffset + kPointerSize; | 5633 kNumLiteralsOffset + kPointerSize; |
5616 static const int kEndPositionOffset = | 5634 static const int kEndPositionOffset = |
5617 kStartPositionAndTypeOffset + kPointerSize; | 5635 kStartPositionAndTypeOffset + kPointerSize; |
5618 static const int kFunctionTokenPositionOffset = | 5636 static const int kFunctionTokenPositionOffset = |
5619 kEndPositionOffset + kPointerSize; | 5637 kEndPositionOffset + kPointerSize; |
5620 static const int kCompilerHintsOffset = | 5638 static const int kCompilerHintsOffset = |
5621 kFunctionTokenPositionOffset + kPointerSize; | 5639 kFunctionTokenPositionOffset + kPointerSize; |
5622 static const int kThisPropertyAssignmentsCountOffset = | 5640 static const int kThisPropertyAssignmentsCountOffset = |
5623 kCompilerHintsOffset + kPointerSize; | 5641 kCompilerHintsOffset + kPointerSize; |
5624 static const int kOptCountOffset = | 5642 static const int kOptCountOffset = |
5625 kThisPropertyAssignmentsCountOffset + kPointerSize; | 5643 kThisPropertyAssignmentsCountOffset + kPointerSize; |
5626 static const int kAstNodeCountOffset = kOptCountOffset + kPointerSize; | 5644 static const int kCountersOffset = kOptCountOffset + kPointerSize; |
5627 static const int kDeoptCounterOffset = kAstNodeCountOffset + kPointerSize; | 5645 static const int kStressDeoptCounterOffset = kCountersOffset + kPointerSize; |
5628 | |
5629 | 5646 |
5630 // Total size. | 5647 // Total size. |
5631 static const int kSize = kDeoptCounterOffset + kPointerSize; | 5648 static const int kSize = kStressDeoptCounterOffset + kPointerSize; |
5632 #else | 5649 #else |
5633 // The only reason to use smi fields instead of int fields | 5650 // The only reason to use smi fields instead of int fields |
5634 // is to allow iteration without maps decoding during | 5651 // is to allow iteration without maps decoding during |
5635 // garbage collections. | 5652 // garbage collections. |
5636 // To avoid wasting space on 64-bit architectures we use | 5653 // To avoid wasting space on 64-bit architectures we use |
5637 // the following trick: we group integer fields into pairs | 5654 // the following trick: we group integer fields into pairs |
5638 // First integer in each pair is shifted left by 1. | 5655 // First integer in each pair is shifted left by 1. |
5639 // By doing this we guarantee that LSB of each kPointerSize aligned | 5656 // By doing this we guarantee that LSB of each kPointerSize aligned |
5640 // word is not set and thus this word cannot be treated as pointer | 5657 // word is not set and thus this word cannot be treated as pointer |
5641 // to HeapObject during old space traversal. | 5658 // to HeapObject during old space traversal. |
5642 static const int kLengthOffset = | 5659 static const int kLengthOffset = |
5643 kICAgeOffset + kPointerSize; | 5660 kAstNodeCountOffset + kPointerSize; |
5644 static const int kFormalParameterCountOffset = | 5661 static const int kFormalParameterCountOffset = |
5645 kLengthOffset + kIntSize; | 5662 kLengthOffset + kIntSize; |
5646 | 5663 |
5647 static const int kExpectedNofPropertiesOffset = | 5664 static const int kExpectedNofPropertiesOffset = |
5648 kFormalParameterCountOffset + kIntSize; | 5665 kFormalParameterCountOffset + kIntSize; |
5649 static const int kNumLiteralsOffset = | 5666 static const int kNumLiteralsOffset = |
5650 kExpectedNofPropertiesOffset + kIntSize; | 5667 kExpectedNofPropertiesOffset + kIntSize; |
5651 | 5668 |
5652 static const int kEndPositionOffset = | 5669 static const int kEndPositionOffset = |
5653 kNumLiteralsOffset + kIntSize; | 5670 kNumLiteralsOffset + kIntSize; |
5654 static const int kStartPositionAndTypeOffset = | 5671 static const int kStartPositionAndTypeOffset = |
5655 kEndPositionOffset + kIntSize; | 5672 kEndPositionOffset + kIntSize; |
5656 | 5673 |
5657 static const int kFunctionTokenPositionOffset = | 5674 static const int kFunctionTokenPositionOffset = |
5658 kStartPositionAndTypeOffset + kIntSize; | 5675 kStartPositionAndTypeOffset + kIntSize; |
5659 static const int kCompilerHintsOffset = | 5676 static const int kCompilerHintsOffset = |
5660 kFunctionTokenPositionOffset + kIntSize; | 5677 kFunctionTokenPositionOffset + kIntSize; |
5661 | 5678 |
5662 static const int kThisPropertyAssignmentsCountOffset = | 5679 static const int kThisPropertyAssignmentsCountOffset = |
5663 kCompilerHintsOffset + kIntSize; | 5680 kCompilerHintsOffset + kIntSize; |
5664 static const int kOptCountOffset = | 5681 static const int kOptCountOffset = |
5665 kThisPropertyAssignmentsCountOffset + kIntSize; | 5682 kThisPropertyAssignmentsCountOffset + kIntSize; |
5666 | 5683 |
5667 static const int kAstNodeCountOffset = kOptCountOffset + kIntSize; | 5684 static const int kCountersOffset = kOptCountOffset + kIntSize; |
5668 static const int kDeoptCounterOffset = kAstNodeCountOffset + kIntSize; | 5685 static const int kStressDeoptCounterOffset = kCountersOffset + kIntSize; |
5669 | 5686 |
5670 // Total size. | 5687 // Total size. |
5671 static const int kSize = kDeoptCounterOffset + kIntSize; | 5688 static const int kSize = kStressDeoptCounterOffset + kIntSize; |
5672 | 5689 |
5673 #endif | 5690 #endif |
5674 | 5691 |
5675 // The construction counter for inobject slack tracking is stored in the | 5692 // The construction counter for inobject slack tracking is stored in the |
5676 // most significant byte of compiler_hints which is otherwise unused. | 5693 // most significant byte of compiler_hints which is otherwise unused. |
5677 // Its offset depends on the endian-ness of the architecture. | 5694 // Its offset depends on the endian-ness of the architecture. |
5678 #if __BYTE_ORDER == __LITTLE_ENDIAN | 5695 #if __BYTE_ORDER == __LITTLE_ENDIAN |
5679 static const int kConstructionCountOffset = kCompilerHintsOffset + 3; | 5696 static const int kConstructionCountOffset = kCompilerHintsOffset + 3; |
5680 #elif __BYTE_ORDER == __BIG_ENDIAN | 5697 #elif __BYTE_ORDER == __BIG_ENDIAN |
5681 static const int kConstructionCountOffset = kCompilerHintsOffset + 0; | 5698 static const int kConstructionCountOffset = kCompilerHintsOffset + 0; |
(...skipping 32 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
5714 kNative, | 5731 kNative, |
5715 kBoundFunction, | 5732 kBoundFunction, |
5716 kIsAnonymous, | 5733 kIsAnonymous, |
5717 kNameShouldPrintAsAnonymous, | 5734 kNameShouldPrintAsAnonymous, |
5718 kIsFunction, | 5735 kIsFunction, |
5719 kDontOptimize, | 5736 kDontOptimize, |
5720 kDontInline, | 5737 kDontInline, |
5721 kCompilerHintsCount // Pseudo entry | 5738 kCompilerHintsCount // Pseudo entry |
5722 }; | 5739 }; |
5723 | 5740 |
| 5741 class DeoptCountBits: public BitField<int, 0, 4> {}; |
| 5742 class OptReenableTriesBits: public BitField<int, 4, 18> {}; |
| 5743 class ICAgeBits: public BitField<int, 22, 8> {}; |
| 5744 |
5724 private: | 5745 private: |
5725 #if V8_HOST_ARCH_32_BIT | 5746 #if V8_HOST_ARCH_32_BIT |
5726 // On 32 bit platforms, compiler hints is a smi. | 5747 // On 32 bit platforms, compiler hints is a smi. |
5727 static const int kCompilerHintsSmiTagSize = kSmiTagSize; | 5748 static const int kCompilerHintsSmiTagSize = kSmiTagSize; |
5728 static const int kCompilerHintsSize = kPointerSize; | 5749 static const int kCompilerHintsSize = kPointerSize; |
5729 #else | 5750 #else |
5730 // On 64 bit platforms, compiler hints is not a smi, see comment above. | 5751 // On 64 bit platforms, compiler hints is not a smi, see comment above. |
5731 static const int kCompilerHintsSmiTagSize = 0; | 5752 static const int kCompilerHintsSmiTagSize = 0; |
5732 static const int kCompilerHintsSize = kIntSize; | 5753 static const int kCompilerHintsSize = kIntSize; |
5733 #endif | 5754 #endif |
(...skipping 3003 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
8737 } else { | 8758 } else { |
8738 value &= ~(1 << bit_position); | 8759 value &= ~(1 << bit_position); |
8739 } | 8760 } |
8740 return value; | 8761 return value; |
8741 } | 8762 } |
8742 }; | 8763 }; |
8743 | 8764 |
8744 } } // namespace v8::internal | 8765 } } // namespace v8::internal |
8745 | 8766 |
8746 #endif // V8_OBJECTS_H_ | 8767 #endif // V8_OBJECTS_H_ |
OLD | NEW |