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 4002 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
4013 public: | 4013 public: |
4014 // Layout description. Indices in the array. | 4014 // Layout description. Indices in the array. |
4015 static const int kTranslationByteArrayIndex = 0; | 4015 static const int kTranslationByteArrayIndex = 0; |
4016 static const int kInlinedFunctionCountIndex = 1; | 4016 static const int kInlinedFunctionCountIndex = 1; |
4017 static const int kLiteralArrayIndex = 2; | 4017 static const int kLiteralArrayIndex = 2; |
4018 static const int kOsrAstIdIndex = 3; | 4018 static const int kOsrAstIdIndex = 3; |
4019 static const int kOsrPcOffsetIndex = 4; | 4019 static const int kOsrPcOffsetIndex = 4; |
4020 static const int kFirstDeoptEntryIndex = 5; | 4020 static const int kFirstDeoptEntryIndex = 5; |
4021 | 4021 |
4022 // Offsets of deopt entry elements relative to the start of the entry. | 4022 // Offsets of deopt entry elements relative to the start of the entry. |
4023 static const int kAstIdOffset = 0; | 4023 static const int kAstIdRawOffset = 0; |
4024 static const int kTranslationIndexOffset = 1; | 4024 static const int kTranslationIndexOffset = 1; |
4025 static const int kArgumentsStackHeightOffset = 2; | 4025 static const int kArgumentsStackHeightOffset = 2; |
4026 static const int kPcOffset = 3; | 4026 static const int kPcOffset = 3; |
4027 static const int kDeoptEntrySize = 4; | 4027 static const int kDeoptEntrySize = 4; |
4028 | 4028 |
4029 // Simple element accessors. | 4029 // Simple element accessors. |
4030 #define DEFINE_ELEMENT_ACCESSORS(name, type) \ | 4030 #define DEFINE_ELEMENT_ACCESSORS(name, type) \ |
4031 type* name() { \ | 4031 type* name() { \ |
4032 return type::cast(get(k##name##Index)); \ | 4032 return type::cast(get(k##name##Index)); \ |
4033 } \ | 4033 } \ |
(...skipping 11 matching lines...) Expand all Loading... |
4045 | 4045 |
4046 // Accessors for elements of the ith deoptimization entry. | 4046 // Accessors for elements of the ith deoptimization entry. |
4047 #define DEFINE_ENTRY_ACCESSORS(name, type) \ | 4047 #define DEFINE_ENTRY_ACCESSORS(name, type) \ |
4048 type* name(int i) { \ | 4048 type* name(int i) { \ |
4049 return type::cast(get(IndexForEntry(i) + k##name##Offset)); \ | 4049 return type::cast(get(IndexForEntry(i) + k##name##Offset)); \ |
4050 } \ | 4050 } \ |
4051 void Set##name(int i, type* value) { \ | 4051 void Set##name(int i, type* value) { \ |
4052 set(IndexForEntry(i) + k##name##Offset, value); \ | 4052 set(IndexForEntry(i) + k##name##Offset, value); \ |
4053 } | 4053 } |
4054 | 4054 |
4055 DEFINE_ENTRY_ACCESSORS(AstId, Smi) | 4055 DEFINE_ENTRY_ACCESSORS(AstIdRaw, Smi) |
4056 DEFINE_ENTRY_ACCESSORS(TranslationIndex, Smi) | 4056 DEFINE_ENTRY_ACCESSORS(TranslationIndex, Smi) |
4057 DEFINE_ENTRY_ACCESSORS(ArgumentsStackHeight, Smi) | 4057 DEFINE_ENTRY_ACCESSORS(ArgumentsStackHeight, Smi) |
4058 DEFINE_ENTRY_ACCESSORS(Pc, Smi) | 4058 DEFINE_ENTRY_ACCESSORS(Pc, Smi) |
4059 | 4059 |
4060 #undef DEFINE_ENTRY_ACCESSORS | 4060 #undef DEFINE_ENTRY_ACCESSORS |
4061 | 4061 |
| 4062 BailoutId AstId(int i) { |
| 4063 return BailoutId(AstIdRaw(i)->value()); |
| 4064 } |
| 4065 |
| 4066 void SetAstId(int i, BailoutId value) { |
| 4067 SetAstIdRaw(i, Smi::FromInt(value.ToInt())); |
| 4068 } |
| 4069 |
4062 int DeoptCount() { | 4070 int DeoptCount() { |
4063 return (length() - kFirstDeoptEntryIndex) / kDeoptEntrySize; | 4071 return (length() - kFirstDeoptEntryIndex) / kDeoptEntrySize; |
4064 } | 4072 } |
4065 | 4073 |
4066 // Allocates a DeoptimizationInputData. | 4074 // Allocates a DeoptimizationInputData. |
4067 MUST_USE_RESULT static MaybeObject* Allocate(int deopt_entry_count, | 4075 MUST_USE_RESULT static MaybeObject* Allocate(int deopt_entry_count, |
4068 PretenureFlag pretenure); | 4076 PretenureFlag pretenure); |
4069 | 4077 |
4070 // Casting. | 4078 // Casting. |
4071 static inline DeoptimizationInputData* cast(Object* obj); | 4079 static inline DeoptimizationInputData* cast(Object* obj); |
(...skipping 14 matching lines...) Expand all Loading... |
4086 | 4094 |
4087 | 4095 |
4088 // DeoptimizationOutputData is a fixed array used to hold the deoptimization | 4096 // DeoptimizationOutputData is a fixed array used to hold the deoptimization |
4089 // data for code generated by the full compiler. | 4097 // data for code generated by the full compiler. |
4090 // The format of the these objects is | 4098 // The format of the these objects is |
4091 // [i * 2]: Ast ID for ith deoptimization. | 4099 // [i * 2]: Ast ID for ith deoptimization. |
4092 // [i * 2 + 1]: PC and state of ith deoptimization | 4100 // [i * 2 + 1]: PC and state of ith deoptimization |
4093 class DeoptimizationOutputData: public FixedArray { | 4101 class DeoptimizationOutputData: public FixedArray { |
4094 public: | 4102 public: |
4095 int DeoptPoints() { return length() / 2; } | 4103 int DeoptPoints() { return length() / 2; } |
4096 Smi* AstId(int index) { return Smi::cast(get(index * 2)); } | 4104 |
4097 void SetAstId(int index, Smi* id) { set(index * 2, id); } | 4105 BailoutId AstId(int index) { |
| 4106 return BailoutId(Smi::cast(get(index * 2))->value()); |
| 4107 } |
| 4108 |
| 4109 void SetAstId(int index, BailoutId id) { |
| 4110 set(index * 2, Smi::FromInt(id.ToInt())); |
| 4111 } |
| 4112 |
4098 Smi* PcAndState(int index) { return Smi::cast(get(1 + index * 2)); } | 4113 Smi* PcAndState(int index) { return Smi::cast(get(1 + index * 2)); } |
4099 void SetPcAndState(int index, Smi* offset) { set(1 + index * 2, offset); } | 4114 void SetPcAndState(int index, Smi* offset) { set(1 + index * 2, offset); } |
4100 | 4115 |
4101 static int LengthOfFixedArray(int deopt_points) { | 4116 static int LengthOfFixedArray(int deopt_points) { |
4102 return deopt_points * 2; | 4117 return deopt_points * 2; |
4103 } | 4118 } |
4104 | 4119 |
4105 // Allocates a DeoptimizationOutputData. | 4120 // Allocates a DeoptimizationOutputData. |
4106 MUST_USE_RESULT static MaybeObject* Allocate(int number_of_deopt_points, | 4121 MUST_USE_RESULT static MaybeObject* Allocate(int number_of_deopt_points, |
4107 PretenureFlag pretenure); | 4122 PretenureFlag pretenure); |
(...skipping 14 matching lines...) Expand all Loading... |
4122 // cache cells and AST ids for code generated by the full compiler. | 4137 // cache cells and AST ids for code generated by the full compiler. |
4123 // The format of the these objects is | 4138 // The format of the these objects is |
4124 // [i * 2]: Global property cell of ith cache cell. | 4139 // [i * 2]: Global property cell of ith cache cell. |
4125 // [i * 2 + 1]: Ast ID for ith cache cell. | 4140 // [i * 2 + 1]: Ast ID for ith cache cell. |
4126 class TypeFeedbackCells: public FixedArray { | 4141 class TypeFeedbackCells: public FixedArray { |
4127 public: | 4142 public: |
4128 int CellCount() { return length() / 2; } | 4143 int CellCount() { return length() / 2; } |
4129 static int LengthOfFixedArray(int cell_count) { return cell_count * 2; } | 4144 static int LengthOfFixedArray(int cell_count) { return cell_count * 2; } |
4130 | 4145 |
4131 // Accessors for AST ids associated with cache values. | 4146 // Accessors for AST ids associated with cache values. |
4132 inline Smi* AstId(int index); | 4147 inline TypeFeedbackId AstId(int index); |
4133 inline void SetAstId(int index, Smi* id); | 4148 inline void SetAstId(int index, TypeFeedbackId id); |
4134 | 4149 |
4135 // Accessors for global property cells holding the cache values. | 4150 // Accessors for global property cells holding the cache values. |
4136 inline JSGlobalPropertyCell* Cell(int index); | 4151 inline JSGlobalPropertyCell* Cell(int index); |
4137 inline void SetCell(int index, JSGlobalPropertyCell* cell); | 4152 inline void SetCell(int index, JSGlobalPropertyCell* cell); |
4138 | 4153 |
4139 // The object that indicates an uninitialized cache. | 4154 // The object that indicates an uninitialized cache. |
4140 static inline Handle<Object> UninitializedSentinel(Isolate* isolate); | 4155 static inline Handle<Object> UninitializedSentinel(Isolate* isolate); |
4141 | 4156 |
4142 // The object that indicates a megamorphic state. | 4157 // The object that indicates a megamorphic state. |
4143 static inline Handle<Object> MegamorphicSentinel(Isolate* isolate); | 4158 static inline Handle<Object> MegamorphicSentinel(Isolate* isolate); |
(...skipping 1518 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
5662 // Enable deoptimization support through recompiled code. | 5677 // Enable deoptimization support through recompiled code. |
5663 void EnableDeoptimizationSupport(Code* recompiled); | 5678 void EnableDeoptimizationSupport(Code* recompiled); |
5664 | 5679 |
5665 // Disable (further) attempted optimization of all functions sharing this | 5680 // Disable (further) attempted optimization of all functions sharing this |
5666 // shared function info. | 5681 // shared function info. |
5667 void DisableOptimization(); | 5682 void DisableOptimization(); |
5668 | 5683 |
5669 // Lookup the bailout ID and ASSERT that it exists in the non-optimized | 5684 // Lookup the bailout ID and ASSERT that it exists in the non-optimized |
5670 // code, returns whether it asserted (i.e., always true if assertions are | 5685 // code, returns whether it asserted (i.e., always true if assertions are |
5671 // disabled). | 5686 // disabled). |
5672 bool VerifyBailoutId(int id); | 5687 bool VerifyBailoutId(BailoutId id); |
5673 | 5688 |
5674 // Check whether a inlined constructor can be generated with the given | 5689 // Check whether a inlined constructor can be generated with the given |
5675 // prototype. | 5690 // prototype. |
5676 bool CanGenerateInlineConstructor(Object* prototype); | 5691 bool CanGenerateInlineConstructor(Object* prototype); |
5677 | 5692 |
5678 // Prevents further attempts to generate inline constructors. | 5693 // Prevents further attempts to generate inline constructors. |
5679 // To be called if generation failed for any reason. | 5694 // To be called if generation failed for any reason. |
5680 void ForbidInlineConstructor(); | 5695 void ForbidInlineConstructor(); |
5681 | 5696 |
5682 // For functions which only contains this property assignments this provides | 5697 // For functions which only contains this property assignments this provides |
(...skipping 342 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
6025 void MarkForLazyRecompilation(); | 6040 void MarkForLazyRecompilation(); |
6026 void MarkForParallelRecompilation(); | 6041 void MarkForParallelRecompilation(); |
6027 | 6042 |
6028 // Helpers to compile this function. Returns true on success, false on | 6043 // Helpers to compile this function. Returns true on success, false on |
6029 // failure (e.g., stack overflow during compilation). | 6044 // failure (e.g., stack overflow during compilation). |
6030 static bool EnsureCompiled(Handle<JSFunction> function, | 6045 static bool EnsureCompiled(Handle<JSFunction> function, |
6031 ClearExceptionFlag flag); | 6046 ClearExceptionFlag flag); |
6032 static bool CompileLazy(Handle<JSFunction> function, | 6047 static bool CompileLazy(Handle<JSFunction> function, |
6033 ClearExceptionFlag flag); | 6048 ClearExceptionFlag flag); |
6034 static bool CompileOptimized(Handle<JSFunction> function, | 6049 static bool CompileOptimized(Handle<JSFunction> function, |
6035 int osr_ast_id, | 6050 BailoutId osr_ast_id, |
6036 ClearExceptionFlag flag); | 6051 ClearExceptionFlag flag); |
6037 | 6052 |
6038 // Tells whether or not the function is already marked for lazy | 6053 // Tells whether or not the function is already marked for lazy |
6039 // recompilation. | 6054 // recompilation. |
6040 inline bool IsMarkedForLazyRecompilation(); | 6055 inline bool IsMarkedForLazyRecompilation(); |
6041 inline bool IsMarkedForParallelRecompilation(); | 6056 inline bool IsMarkedForParallelRecompilation(); |
6042 | 6057 |
6043 // Tells whether or not the function is on the parallel | 6058 // Tells whether or not the function is on the parallel |
6044 // recompilation queue. | 6059 // recompilation queue. |
6045 inline bool IsInRecompileQueue(); | 6060 inline bool IsInRecompileQueue(); |
(...skipping 2884 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
8930 } else { | 8945 } else { |
8931 value &= ~(1 << bit_position); | 8946 value &= ~(1 << bit_position); |
8932 } | 8947 } |
8933 return value; | 8948 return value; |
8934 } | 8949 } |
8935 }; | 8950 }; |
8936 | 8951 |
8937 } } // namespace v8::internal | 8952 } } // namespace v8::internal |
8938 | 8953 |
8939 #endif // V8_OBJECTS_H_ | 8954 #endif // V8_OBJECTS_H_ |
OLD | NEW |