OLD | NEW |
1 // Copyright 2006-2009 the V8 project authors. All rights reserved. | 1 // Copyright 2006-2009 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 2718 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
2729 static const char* Kind2String(Kind kind); | 2729 static const char* Kind2String(Kind kind); |
2730 static const char* ICState2String(InlineCacheState state); | 2730 static const char* ICState2String(InlineCacheState state); |
2731 static const char* PropertyType2String(PropertyType type); | 2731 static const char* PropertyType2String(PropertyType type); |
2732 void Disassemble(const char* name); | 2732 void Disassemble(const char* name); |
2733 #endif // ENABLE_DISASSEMBLER | 2733 #endif // ENABLE_DISASSEMBLER |
2734 | 2734 |
2735 // [instruction_size]: Size of the native instructions | 2735 // [instruction_size]: Size of the native instructions |
2736 inline int instruction_size(); | 2736 inline int instruction_size(); |
2737 inline void set_instruction_size(int value); | 2737 inline void set_instruction_size(int value); |
2738 | 2738 |
2739 // [relocation_size]: Size of relocation information. | 2739 // [relocation_info]: Code relocation information |
| 2740 DECL_ACCESSORS(relocation_info, ByteArray) |
| 2741 |
| 2742 // Unchecked accessor to be used during GC. |
| 2743 inline ByteArray* unchecked_relocation_info(); |
| 2744 |
2740 inline int relocation_size(); | 2745 inline int relocation_size(); |
2741 inline void set_relocation_size(int value); | |
2742 | 2746 |
2743 // [sinfo_size]: Size of scope information. | 2747 // [sinfo_size]: Size of scope information. |
2744 inline int sinfo_size(); | 2748 inline int sinfo_size(); |
2745 inline void set_sinfo_size(int value); | 2749 inline void set_sinfo_size(int value); |
2746 | 2750 |
2747 // [flags]: Various code flags. | 2751 // [flags]: Various code flags. |
2748 inline Flags flags(); | 2752 inline Flags flags(); |
2749 inline void set_flags(Flags flags); | 2753 inline void set_flags(Flags flags); |
2750 | 2754 |
2751 // [flags]: Access to specific code flags. | 2755 // [flags]: Access to specific code flags. |
(...skipping 38 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
2790 static inline int ExtractArgumentsCountFromFlags(Flags flags); | 2794 static inline int ExtractArgumentsCountFromFlags(Flags flags); |
2791 static inline InlineCacheHolderFlag ExtractCacheHolderFromFlags(Flags flags); | 2795 static inline InlineCacheHolderFlag ExtractCacheHolderFromFlags(Flags flags); |
2792 static inline Flags RemoveTypeFromFlags(Flags flags); | 2796 static inline Flags RemoveTypeFromFlags(Flags flags); |
2793 | 2797 |
2794 // Convert a target address into a code object. | 2798 // Convert a target address into a code object. |
2795 static inline Code* GetCodeFromTargetAddress(Address address); | 2799 static inline Code* GetCodeFromTargetAddress(Address address); |
2796 | 2800 |
2797 // Returns the address of the first instruction. | 2801 // Returns the address of the first instruction. |
2798 inline byte* instruction_start(); | 2802 inline byte* instruction_start(); |
2799 | 2803 |
| 2804 // Returns the address right after the last instruction. |
| 2805 inline byte* instruction_end(); |
| 2806 |
2800 // Returns the size of the instructions, padding, and relocation information. | 2807 // Returns the size of the instructions, padding, and relocation information. |
2801 inline int body_size(); | 2808 inline int body_size(); |
2802 | 2809 |
2803 // Returns the address of the first relocation info (read backwards!). | 2810 // Returns the address of the first relocation info (read backwards!). |
2804 inline byte* relocation_start(); | 2811 inline byte* relocation_start(); |
2805 | 2812 |
2806 // Code entry point. | 2813 // Code entry point. |
2807 inline byte* entry(); | 2814 inline byte* entry(); |
2808 | 2815 |
2809 // Returns true if pc is inside this object's instructions. | 2816 // Returns true if pc is inside this object's instructions. |
(...skipping 40 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
2850 void CodePrint(); | 2857 void CodePrint(); |
2851 void CodeVerify(); | 2858 void CodeVerify(); |
2852 #endif | 2859 #endif |
2853 // Code entry points are aligned to 32 bytes. | 2860 // Code entry points are aligned to 32 bytes. |
2854 static const int kCodeAlignmentBits = 5; | 2861 static const int kCodeAlignmentBits = 5; |
2855 static const int kCodeAlignment = 1 << kCodeAlignmentBits; | 2862 static const int kCodeAlignment = 1 << kCodeAlignmentBits; |
2856 static const int kCodeAlignmentMask = kCodeAlignment - 1; | 2863 static const int kCodeAlignmentMask = kCodeAlignment - 1; |
2857 | 2864 |
2858 // Layout description. | 2865 // Layout description. |
2859 static const int kInstructionSizeOffset = HeapObject::kHeaderSize; | 2866 static const int kInstructionSizeOffset = HeapObject::kHeaderSize; |
2860 static const int kRelocationSizeOffset = kInstructionSizeOffset + kIntSize; | 2867 static const int kRelocationInfoOffset = kInstructionSizeOffset + kIntSize; |
2861 static const int kSInfoSizeOffset = kRelocationSizeOffset + kIntSize; | 2868 static const int kSInfoSizeOffset = kRelocationInfoOffset + kPointerSize; |
2862 static const int kFlagsOffset = kSInfoSizeOffset + kIntSize; | 2869 static const int kFlagsOffset = kSInfoSizeOffset + kIntSize; |
2863 static const int kKindSpecificFlagsOffset = kFlagsOffset + kIntSize; | 2870 static const int kKindSpecificFlagsOffset = kFlagsOffset + kIntSize; |
2864 // Add padding to align the instruction start following right after | 2871 // Add padding to align the instruction start following right after |
2865 // the Code object header. | 2872 // the Code object header. |
2866 static const int kHeaderSize = | 2873 static const int kHeaderSize = |
2867 (kKindSpecificFlagsOffset + kIntSize + kCodeAlignmentMask) & | 2874 (kKindSpecificFlagsOffset + kIntSize + kCodeAlignmentMask) & |
2868 ~kCodeAlignmentMask; | 2875 ~kCodeAlignmentMask; |
2869 | 2876 |
2870 // Byte offsets within kKindSpecificFlagsOffset. | 2877 // Byte offsets within kKindSpecificFlagsOffset. |
2871 static const int kStubMajorKeyOffset = kKindSpecificFlagsOffset + 1; | 2878 static const int kStubMajorKeyOffset = kKindSpecificFlagsOffset + 1; |
(...skipping 1527 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
4399 | 4406 |
4400 private: | 4407 private: |
4401 DISALLOW_IMPLICIT_CONSTRUCTORS(SeqString); | 4408 DISALLOW_IMPLICIT_CONSTRUCTORS(SeqString); |
4402 }; | 4409 }; |
4403 | 4410 |
4404 | 4411 |
4405 // The AsciiString class captures sequential ascii string objects. | 4412 // The AsciiString class captures sequential ascii string objects. |
4406 // Each character in the AsciiString is an ascii character. | 4413 // Each character in the AsciiString is an ascii character. |
4407 class SeqAsciiString: public SeqString { | 4414 class SeqAsciiString: public SeqString { |
4408 public: | 4415 public: |
| 4416 static const bool kHasAsciiEncoding = true; |
| 4417 |
4409 // Dispatched behavior. | 4418 // Dispatched behavior. |
4410 inline uint16_t SeqAsciiStringGet(int index); | 4419 inline uint16_t SeqAsciiStringGet(int index); |
4411 inline void SeqAsciiStringSet(int index, uint16_t value); | 4420 inline void SeqAsciiStringSet(int index, uint16_t value); |
4412 | 4421 |
4413 // Get the address of the characters in this string. | 4422 // Get the address of the characters in this string. |
4414 inline Address GetCharsAddress(); | 4423 inline Address GetCharsAddress(); |
4415 | 4424 |
4416 inline char* GetChars(); | 4425 inline char* GetChars(); |
4417 | 4426 |
4418 // Casting | 4427 // Casting |
(...skipping 29 matching lines...) Expand all Loading... |
4448 | 4457 |
4449 private: | 4458 private: |
4450 DISALLOW_IMPLICIT_CONSTRUCTORS(SeqAsciiString); | 4459 DISALLOW_IMPLICIT_CONSTRUCTORS(SeqAsciiString); |
4451 }; | 4460 }; |
4452 | 4461 |
4453 | 4462 |
4454 // The TwoByteString class captures sequential unicode string objects. | 4463 // The TwoByteString class captures sequential unicode string objects. |
4455 // Each character in the TwoByteString is a two-byte uint16_t. | 4464 // Each character in the TwoByteString is a two-byte uint16_t. |
4456 class SeqTwoByteString: public SeqString { | 4465 class SeqTwoByteString: public SeqString { |
4457 public: | 4466 public: |
| 4467 static const bool kHasAsciiEncoding = false; |
| 4468 |
4458 // Dispatched behavior. | 4469 // Dispatched behavior. |
4459 inline uint16_t SeqTwoByteStringGet(int index); | 4470 inline uint16_t SeqTwoByteStringGet(int index); |
4460 inline void SeqTwoByteStringSet(int index, uint16_t value); | 4471 inline void SeqTwoByteStringSet(int index, uint16_t value); |
4461 | 4472 |
4462 // Get the address of the characters in this string. | 4473 // Get the address of the characters in this string. |
4463 inline Address GetCharsAddress(); | 4474 inline Address GetCharsAddress(); |
4464 | 4475 |
4465 inline uc16* GetChars(); | 4476 inline uc16* GetChars(); |
4466 | 4477 |
4467 // For regexp code. | 4478 // For regexp code. |
(...skipping 112 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
4580 | 4591 |
4581 private: | 4592 private: |
4582 DISALLOW_IMPLICIT_CONSTRUCTORS(ExternalString); | 4593 DISALLOW_IMPLICIT_CONSTRUCTORS(ExternalString); |
4583 }; | 4594 }; |
4584 | 4595 |
4585 | 4596 |
4586 // The ExternalAsciiString class is an external string backed by an | 4597 // The ExternalAsciiString class is an external string backed by an |
4587 // ASCII string. | 4598 // ASCII string. |
4588 class ExternalAsciiString: public ExternalString { | 4599 class ExternalAsciiString: public ExternalString { |
4589 public: | 4600 public: |
| 4601 static const bool kHasAsciiEncoding = true; |
| 4602 |
4590 typedef v8::String::ExternalAsciiStringResource Resource; | 4603 typedef v8::String::ExternalAsciiStringResource Resource; |
4591 | 4604 |
4592 // The underlying resource. | 4605 // The underlying resource. |
4593 inline Resource* resource(); | 4606 inline Resource* resource(); |
4594 inline void set_resource(Resource* buffer); | 4607 inline void set_resource(Resource* buffer); |
4595 | 4608 |
4596 // Dispatched behavior. | 4609 // Dispatched behavior. |
4597 uint16_t ExternalAsciiStringGet(int index); | 4610 uint16_t ExternalAsciiStringGet(int index); |
4598 | 4611 |
4599 // Casting. | 4612 // Casting. |
(...skipping 12 matching lines...) Expand all Loading... |
4612 | 4625 |
4613 private: | 4626 private: |
4614 DISALLOW_IMPLICIT_CONSTRUCTORS(ExternalAsciiString); | 4627 DISALLOW_IMPLICIT_CONSTRUCTORS(ExternalAsciiString); |
4615 }; | 4628 }; |
4616 | 4629 |
4617 | 4630 |
4618 // The ExternalTwoByteString class is an external string backed by a UTF-16 | 4631 // The ExternalTwoByteString class is an external string backed by a UTF-16 |
4619 // encoded string. | 4632 // encoded string. |
4620 class ExternalTwoByteString: public ExternalString { | 4633 class ExternalTwoByteString: public ExternalString { |
4621 public: | 4634 public: |
| 4635 static const bool kHasAsciiEncoding = false; |
| 4636 |
4622 typedef v8::String::ExternalStringResource Resource; | 4637 typedef v8::String::ExternalStringResource Resource; |
4623 | 4638 |
4624 // The underlying string resource. | 4639 // The underlying string resource. |
4625 inline Resource* resource(); | 4640 inline Resource* resource(); |
4626 inline void set_resource(Resource* buffer); | 4641 inline void set_resource(Resource* buffer); |
4627 | 4642 |
4628 // Dispatched behavior. | 4643 // Dispatched behavior. |
4629 uint16_t ExternalTwoByteStringGet(int index); | 4644 uint16_t ExternalTwoByteStringGet(int index); |
4630 | 4645 |
4631 // For regexp code. | 4646 // For regexp code. |
(...skipping 710 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
5342 } else { | 5357 } else { |
5343 value &= ~(1 << bit_position); | 5358 value &= ~(1 << bit_position); |
5344 } | 5359 } |
5345 return value; | 5360 return value; |
5346 } | 5361 } |
5347 }; | 5362 }; |
5348 | 5363 |
5349 } } // namespace v8::internal | 5364 } } // namespace v8::internal |
5350 | 5365 |
5351 #endif // V8_OBJECTS_H_ | 5366 #endif // V8_OBJECTS_H_ |
OLD | NEW |