| 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 3961 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 3972 | 3972 |
| 3973 // DeoptimizationInputData is a fixed array used to hold the deoptimization | 3973 // DeoptimizationInputData is a fixed array used to hold the deoptimization |
| 3974 // data for code generated by the Hydrogen/Lithium compiler. It also | 3974 // data for code generated by the Hydrogen/Lithium compiler. It also |
| 3975 // contains information about functions that were inlined. If N different | 3975 // contains information about functions that were inlined. If N different |
| 3976 // functions were inlined then first N elements of the literal array will | 3976 // functions were inlined then first N elements of the literal array will |
| 3977 // contain these functions. | 3977 // contain these functions. |
| 3978 // | 3978 // |
| 3979 // It can be empty. | 3979 // It can be empty. |
| 3980 class DeoptimizationInputData: public FixedArray { | 3980 class DeoptimizationInputData: public FixedArray { |
| 3981 public: | 3981 public: |
| 3982 // Layout description. Indices in the array. | 3982 // Fixed array consists of a header and sequence of entries. |
| 3983 static const int kTranslationByteArrayIndex = 0; | |
| 3984 static const int kInlinedFunctionCountIndex = 1; | |
| 3985 static const int kLiteralArrayIndex = 2; | |
| 3986 static const int kOsrAstIdIndex = 3; | |
| 3987 static const int kOsrPcOffsetIndex = 4; | |
| 3988 static const int kFirstDeoptEntryIndex = 5; | |
| 3989 | 3983 |
| 3990 // Offsets of deopt entry elements relative to the start of the entry. | 3984 // ==== Header field names and types. |
| 3991 static const int kAstIdRawOffset = 0; | 3985 #define FOR_EACH_HEADER_FIELD(F) \ |
| 3992 static const int kTranslationIndexOffset = 1; | 3986 F(TranslationByteArray, ByteArray) \ |
| 3993 static const int kArgumentsStackHeightOffset = 2; | 3987 F(InlinedFunctionCount, Smi) \ |
| 3994 static const int kPcOffset = 3; | 3988 F(LiteralArray, FixedArray) \ |
| 3995 static const int kDeoptEntrySize = 4; | 3989 F(OsrAstId, Smi) \ |
| 3990 F(OsrPcOffset, Smi) |
| 3996 | 3991 |
| 3997 // Simple element accessors. | 3992 // Header layout description by an enum. Value is an index into the fixed |
| 3998 #define DEFINE_ELEMENT_ACCESSORS(name, type) \ | 3993 // array. |
| 3994 #define MAKE_TAG(name, type) k##name##Index, |
| 3995 enum { |
| 3996 FOR_EACH_HEADER_FIELD(MAKE_TAG) |
| 3997 kFirstDeoptEntryIndex // Pseudo-tag. |
| 3998 }; |
| 3999 #undef MAKE_TAG |
| 4000 |
| 4001 // Header field accessors. |
| 4002 #define DEFINE_HEADER_ACCESSORS(name, type) \ |
| 3999 type* name() { \ | 4003 type* name() { \ |
| 4000 return type::cast(get(k##name##Index)); \ | 4004 return type::cast(get(k##name##Index)); \ |
| 4001 } \ | 4005 } \ |
| 4002 void Set##name(type* value) { \ | 4006 void Set##name(type* value) { \ |
| 4003 set(k##name##Index, value); \ | 4007 set(k##name##Index, value); \ |
| 4004 } | 4008 } |
| 4005 | 4009 |
| 4006 DEFINE_ELEMENT_ACCESSORS(TranslationByteArray, ByteArray) | 4010 FOR_EACH_HEADER_FIELD(DEFINE_HEADER_ACCESSORS) |
| 4007 DEFINE_ELEMENT_ACCESSORS(InlinedFunctionCount, Smi) | |
| 4008 DEFINE_ELEMENT_ACCESSORS(LiteralArray, FixedArray) | |
| 4009 DEFINE_ELEMENT_ACCESSORS(OsrAstId, Smi) | |
| 4010 DEFINE_ELEMENT_ACCESSORS(OsrPcOffset, Smi) | |
| 4011 | 4011 |
| 4012 #undef DEFINE_ELEMENT_ACCESSORS | 4012 #undef DEFINE_HEADER_ACCESSORS |
| 4013 #undef FOR_EACH_HEADER_FIELD |
| 4013 | 4014 |
| 4014 // Accessors for elements of the ith deoptimization entry. | 4015 // ==== Entry field names and types. |
| 4016 #define FOR_EACH_ENTRY_FIELD(F) \ |
| 4017 F(AstIdRaw, Smi) \ |
| 4018 F(TranslationIndex, Smi) \ |
| 4019 F(ArgumentsStackHeight, Smi) \ |
| 4020 F(HandlerCount, Smi) \ |
| 4021 F(Pc, Smi) |
| 4022 |
| 4023 // Entry layout description by an enum. Value is an offset relative to |
| 4024 // the start of the entry. |
| 4025 #define MAKE_TAG(name, type) k##name##Offset, |
| 4026 enum { |
| 4027 FOR_EACH_ENTRY_FIELD(MAKE_TAG) |
| 4028 kDeoptEntrySize // Pseudo-value |
| 4029 }; |
| 4030 #undef MAKE_TAG |
| 4031 |
| 4032 // Accessors for fields of the ith deoptimization entry. |
| 4015 #define DEFINE_ENTRY_ACCESSORS(name, type) \ | 4033 #define DEFINE_ENTRY_ACCESSORS(name, type) \ |
| 4016 type* name(int i) { \ | 4034 type* name(int i) { \ |
| 4017 return type::cast(get(IndexForEntry(i) + k##name##Offset)); \ | 4035 return type::cast(get(IndexForEntry(i) + k##name##Offset)); \ |
| 4018 } \ | 4036 } \ |
| 4019 void Set##name(int i, type* value) { \ | 4037 void Set##name(int i, type* value) { \ |
| 4020 set(IndexForEntry(i) + k##name##Offset, value); \ | 4038 set(IndexForEntry(i) + k##name##Offset, value); \ |
| 4021 } | 4039 } |
| 4022 | 4040 |
| 4023 DEFINE_ENTRY_ACCESSORS(AstIdRaw, Smi) | 4041 FOR_EACH_ENTRY_FIELD(DEFINE_ENTRY_ACCESSORS) |
| 4024 DEFINE_ENTRY_ACCESSORS(TranslationIndex, Smi) | |
| 4025 DEFINE_ENTRY_ACCESSORS(ArgumentsStackHeight, Smi) | |
| 4026 DEFINE_ENTRY_ACCESSORS(Pc, Smi) | |
| 4027 | 4042 |
| 4028 #undef DEFINE_ENTRY_ACCESSORS | 4043 #undef DEFINE_ENTRY_ACCESSORS |
| 4044 #undef FOR_EACH_ENTRY_FIELD |
| 4029 | 4045 |
| 4030 BailoutId AstId(int i) { | 4046 BailoutId AstId(int i) { |
| 4031 return BailoutId(AstIdRaw(i)->value()); | 4047 return BailoutId(AstIdRaw(i)->value()); |
| 4032 } | 4048 } |
| 4033 | 4049 |
| 4034 void SetAstId(int i, BailoutId value) { | 4050 void SetAstId(int i, BailoutId value) { |
| 4035 SetAstIdRaw(i, Smi::FromInt(value.ToInt())); | 4051 SetAstIdRaw(i, Smi::FromInt(value.ToInt())); |
| 4036 } | 4052 } |
| 4037 | 4053 |
| 4038 int DeoptCount() { | 4054 int DeoptCount() { |
| (...skipping 1598 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 5637 // Indicates that the function is anonymous (the name field can be set | 5653 // Indicates that the function is anonymous (the name field can be set |
| 5638 // through the API, which does not change this flag). | 5654 // through the API, which does not change this flag). |
| 5639 DECL_BOOLEAN_ACCESSORS(is_anonymous) | 5655 DECL_BOOLEAN_ACCESSORS(is_anonymous) |
| 5640 | 5656 |
| 5641 // Is this a function or top-level/eval code. | 5657 // Is this a function or top-level/eval code. |
| 5642 DECL_BOOLEAN_ACCESSORS(is_function) | 5658 DECL_BOOLEAN_ACCESSORS(is_function) |
| 5643 | 5659 |
| 5644 // Indicates that the function cannot be optimized. | 5660 // Indicates that the function cannot be optimized. |
| 5645 DECL_BOOLEAN_ACCESSORS(dont_optimize) | 5661 DECL_BOOLEAN_ACCESSORS(dont_optimize) |
| 5646 | 5662 |
| 5663 // Indicates that the function cannot be on stack replaced. |
| 5664 DECL_BOOLEAN_ACCESSORS(dont_osr) |
| 5665 |
| 5647 // Indicates that the function cannot be inlined. | 5666 // Indicates that the function cannot be inlined. |
| 5648 DECL_BOOLEAN_ACCESSORS(dont_inline) | 5667 DECL_BOOLEAN_ACCESSORS(dont_inline) |
| 5649 | 5668 |
| 5650 // Indicates that code for this function cannot be cached. | 5669 // Indicates that code for this function cannot be cached. |
| 5651 DECL_BOOLEAN_ACCESSORS(dont_cache) | 5670 DECL_BOOLEAN_ACCESSORS(dont_cache) |
| 5652 | 5671 |
| 5653 // Indicates whether or not the code in the shared function support | 5672 // Indicates whether or not the code in the shared function support |
| 5654 // deoptimization. | 5673 // deoptimization. |
| 5655 inline bool has_deoptimization_support(); | 5674 inline bool has_deoptimization_support(); |
| 5656 | 5675 |
| (...skipping 217 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 5874 kStrictModeFunction, | 5893 kStrictModeFunction, |
| 5875 kExtendedModeFunction, | 5894 kExtendedModeFunction, |
| 5876 kUsesArguments, | 5895 kUsesArguments, |
| 5877 kHasDuplicateParameters, | 5896 kHasDuplicateParameters, |
| 5878 kNative, | 5897 kNative, |
| 5879 kBoundFunction, | 5898 kBoundFunction, |
| 5880 kIsAnonymous, | 5899 kIsAnonymous, |
| 5881 kNameShouldPrintAsAnonymous, | 5900 kNameShouldPrintAsAnonymous, |
| 5882 kIsFunction, | 5901 kIsFunction, |
| 5883 kDontOptimize, | 5902 kDontOptimize, |
| 5903 kDontOsr, |
| 5884 kDontInline, | 5904 kDontInline, |
| 5885 kDontCache, | 5905 kDontCache, |
| 5886 kCompilerHintsCount // Pseudo entry | 5906 kCompilerHintsCount // Pseudo entry |
| 5887 }; | 5907 }; |
| 5888 | 5908 |
| 5889 class DeoptCountBits: public BitField<int, 0, 4> {}; | 5909 class DeoptCountBits: public BitField<int, 0, 4> {}; |
| 5890 class OptReenableTriesBits: public BitField<int, 4, 18> {}; | 5910 class OptReenableTriesBits: public BitField<int, 4, 18> {}; |
| 5891 class ICAgeBits: public BitField<int, 22, 8> {}; | 5911 class ICAgeBits: public BitField<int, 22, 8> {}; |
| 5892 | 5912 |
| 5893 private: | 5913 private: |
| (...skipping 3056 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 8950 } else { | 8970 } else { |
| 8951 value &= ~(1 << bit_position); | 8971 value &= ~(1 << bit_position); |
| 8952 } | 8972 } |
| 8953 return value; | 8973 return value; |
| 8954 } | 8974 } |
| 8955 }; | 8975 }; |
| 8956 | 8976 |
| 8957 } } // namespace v8::internal | 8977 } } // namespace v8::internal |
| 8958 | 8978 |
| 8959 #endif // V8_OBJECTS_H_ | 8979 #endif // V8_OBJECTS_H_ |
| OLD | NEW |