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 4979 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
4990 // It can be empty. | 4990 // It can be empty. |
4991 class DeoptimizationInputData: public FixedArray { | 4991 class DeoptimizationInputData: public FixedArray { |
4992 public: | 4992 public: |
4993 // Layout description. Indices in the array. | 4993 // Layout description. Indices in the array. |
4994 static const int kTranslationByteArrayIndex = 0; | 4994 static const int kTranslationByteArrayIndex = 0; |
4995 static const int kInlinedFunctionCountIndex = 1; | 4995 static const int kInlinedFunctionCountIndex = 1; |
4996 static const int kLiteralArrayIndex = 2; | 4996 static const int kLiteralArrayIndex = 2; |
4997 static const int kOsrAstIdIndex = 3; | 4997 static const int kOsrAstIdIndex = 3; |
4998 static const int kOsrPcOffsetIndex = 4; | 4998 static const int kOsrPcOffsetIndex = 4; |
4999 static const int kOptimizationIdIndex = 5; | 4999 static const int kOptimizationIdIndex = 5; |
5000 static const int kFirstDeoptEntryIndex = 6; | 5000 static const int kSharedFunctionInfoIndex = 6; |
| 5001 static const int kFirstDeoptEntryIndex = 7; |
5001 | 5002 |
5002 // Offsets of deopt entry elements relative to the start of the entry. | 5003 // Offsets of deopt entry elements relative to the start of the entry. |
5003 static const int kAstIdRawOffset = 0; | 5004 static const int kAstIdRawOffset = 0; |
5004 static const int kTranslationIndexOffset = 1; | 5005 static const int kTranslationIndexOffset = 1; |
5005 static const int kArgumentsStackHeightOffset = 2; | 5006 static const int kArgumentsStackHeightOffset = 2; |
5006 static const int kPcOffset = 3; | 5007 static const int kPcOffset = 3; |
5007 static const int kDeoptEntrySize = 4; | 5008 static const int kDeoptEntrySize = 4; |
5008 | 5009 |
5009 // Simple element accessors. | 5010 // Simple element accessors. |
5010 #define DEFINE_ELEMENT_ACCESSORS(name, type) \ | 5011 #define DEFINE_ELEMENT_ACCESSORS(name, type) \ |
5011 type* name() { \ | 5012 type* name() { \ |
5012 return type::cast(get(k##name##Index)); \ | 5013 return type::cast(get(k##name##Index)); \ |
5013 } \ | 5014 } \ |
5014 void Set##name(type* value) { \ | 5015 void Set##name(type* value) { \ |
5015 set(k##name##Index, value); \ | 5016 set(k##name##Index, value); \ |
5016 } | 5017 } |
5017 | 5018 |
5018 DEFINE_ELEMENT_ACCESSORS(TranslationByteArray, ByteArray) | 5019 DEFINE_ELEMENT_ACCESSORS(TranslationByteArray, ByteArray) |
5019 DEFINE_ELEMENT_ACCESSORS(InlinedFunctionCount, Smi) | 5020 DEFINE_ELEMENT_ACCESSORS(InlinedFunctionCount, Smi) |
5020 DEFINE_ELEMENT_ACCESSORS(LiteralArray, FixedArray) | 5021 DEFINE_ELEMENT_ACCESSORS(LiteralArray, FixedArray) |
5021 DEFINE_ELEMENT_ACCESSORS(OsrAstId, Smi) | 5022 DEFINE_ELEMENT_ACCESSORS(OsrAstId, Smi) |
5022 DEFINE_ELEMENT_ACCESSORS(OsrPcOffset, Smi) | 5023 DEFINE_ELEMENT_ACCESSORS(OsrPcOffset, Smi) |
5023 DEFINE_ELEMENT_ACCESSORS(OptimizationId, Smi) | 5024 DEFINE_ELEMENT_ACCESSORS(OptimizationId, Smi) |
| 5025 DEFINE_ELEMENT_ACCESSORS(SharedFunctionInfo, Object) |
5024 | 5026 |
5025 #undef DEFINE_ELEMENT_ACCESSORS | 5027 #undef DEFINE_ELEMENT_ACCESSORS |
5026 | 5028 |
5027 // Accessors for elements of the ith deoptimization entry. | 5029 // Accessors for elements of the ith deoptimization entry. |
5028 #define DEFINE_ENTRY_ACCESSORS(name, type) \ | 5030 #define DEFINE_ENTRY_ACCESSORS(name, type) \ |
5029 type* name(int i) { \ | 5031 type* name(int i) { \ |
5030 return type::cast(get(IndexForEntry(i) + k##name##Offset)); \ | 5032 return type::cast(get(IndexForEntry(i) + k##name##Offset)); \ |
5031 } \ | 5033 } \ |
5032 void Set##name(int i, type* value) { \ | 5034 void Set##name(int i, type* value) { \ |
5033 set(IndexForEntry(i) + k##name##Offset, value); \ | 5035 set(IndexForEntry(i) + k##name##Offset, value); \ |
(...skipping 1621 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
6655 | 6657 |
6656 // Installs optimized code from the code map on the given closure. The | 6658 // Installs optimized code from the code map on the given closure. The |
6657 // index has to be consistent with a search result as defined above. | 6659 // index has to be consistent with a search result as defined above. |
6658 FixedArray* GetLiteralsFromOptimizedCodeMap(int index); | 6660 FixedArray* GetLiteralsFromOptimizedCodeMap(int index); |
6659 | 6661 |
6660 Code* GetCodeFromOptimizedCodeMap(int index); | 6662 Code* GetCodeFromOptimizedCodeMap(int index); |
6661 | 6663 |
6662 // Clear optimized code map. | 6664 // Clear optimized code map. |
6663 void ClearOptimizedCodeMap(); | 6665 void ClearOptimizedCodeMap(); |
6664 | 6666 |
6665 // Removed code objects associated to the given native context from | 6667 // Removed a specific optimized code object from the optimized code map. |
6666 // the optimized code map. | 6668 void EvictFromOptimizedCodeMap(Code* optimized_code, const char* reason); |
6667 void EvictFromOptimizedCodeMap(Context* context, const char* reason); | |
6668 | 6669 |
6669 // Trims the optimized code map after entries have been removed. | 6670 // Trims the optimized code map after entries have been removed. |
6670 void TrimOptimizedCodeMap(int shrink_by); | 6671 void TrimOptimizedCodeMap(int shrink_by); |
6671 | 6672 |
6672 // Add a new entry to the optimized code map. | 6673 // Add a new entry to the optimized code map. |
6673 MUST_USE_RESULT MaybeObject* AddToOptimizedCodeMap(Context* native_context, | 6674 MUST_USE_RESULT MaybeObject* AddToOptimizedCodeMap(Context* native_context, |
6674 Code* code, | 6675 Code* code, |
6675 FixedArray* literals, | 6676 FixedArray* literals, |
6676 BailoutId osr_ast_id); | 6677 BailoutId osr_ast_id); |
6677 static void AddToOptimizedCodeMap(Handle<SharedFunctionInfo> shared, | 6678 static void AddToOptimizedCodeMap(Handle<SharedFunctionInfo> shared, |
(...skipping 4098 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
10776 } else { | 10777 } else { |
10777 value &= ~(1 << bit_position); | 10778 value &= ~(1 << bit_position); |
10778 } | 10779 } |
10779 return value; | 10780 return value; |
10780 } | 10781 } |
10781 }; | 10782 }; |
10782 | 10783 |
10783 } } // namespace v8::internal | 10784 } } // namespace v8::internal |
10784 | 10785 |
10785 #endif // V8_OBJECTS_H_ | 10786 #endif // V8_OBJECTS_H_ |
OLD | NEW |