Chromium Code Reviews
chromiumcodereview-hr@appspot.gserviceaccount.com (chromiumcodereview-hr) | Please choose your nickname with Settings | Help | Chromium Project | Gerrit Changes | Sign out
(50)

Side by Side Diff: src/objects.h

Issue 504493002: Fix deoptimization address patching in Turbofan to use safepoints. (Closed) Base URL: https://v8.googlecode.com/svn/branches/bleeding_edge
Patch Set: Compilation fix. Created 6 years, 4 months ago
Use n/p to move between diff chunks; N/P to move between comments. Draft comments are only viewable by you.
Jump to:
View unified diff | Download patch | Annotate | Revision Log
« no previous file with comments | « src/mips64/lithium-codegen-mips64.cc ('k') | src/objects.cc » ('j') | no next file with comments »
Toggle Intra-line Diffs ('i') | Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
OLDNEW
1 // Copyright 2012 the V8 project authors. All rights reserved. 1 // Copyright 2012 the V8 project authors. All rights reserved.
2 // Use of this source code is governed by a BSD-style license that can be 2 // Use of this source code is governed by a BSD-style license that can be
3 // found in the LICENSE file. 3 // found in the LICENSE file.
4 4
5 #ifndef V8_OBJECTS_H_ 5 #ifndef V8_OBJECTS_H_
6 #define V8_OBJECTS_H_ 6 #define V8_OBJECTS_H_
7 7
8 #include "src/allocation.h" 8 #include "src/allocation.h"
9 #include "src/assert-scope.h" 9 #include "src/assert-scope.h"
10 #include "src/builtins.h" 10 #include "src/builtins.h"
(...skipping 5133 matching lines...) Expand 10 before | Expand all | Expand 10 after
5144 // DeoptimizationInputData is a fixed array used to hold the deoptimization 5144 // DeoptimizationInputData is a fixed array used to hold the deoptimization
5145 // data for code generated by the Hydrogen/Lithium compiler. It also 5145 // data for code generated by the Hydrogen/Lithium compiler. It also
5146 // contains information about functions that were inlined. If N different 5146 // contains information about functions that were inlined. If N different
5147 // functions were inlined then first N elements of the literal array will 5147 // functions were inlined then first N elements of the literal array will
5148 // contain these functions. 5148 // contain these functions.
5149 // 5149 //
5150 // It can be empty. 5150 // It can be empty.
5151 class DeoptimizationInputData: public FixedArray { 5151 class DeoptimizationInputData: public FixedArray {
5152 public: 5152 public:
5153 // Layout description. Indices in the array. 5153 // Layout description. Indices in the array.
5154 static const int kDeoptEntryCountIndex = 0; 5154 static const int kTranslationByteArrayIndex = 0;
5155 static const int kReturnAddressPatchEntryCountIndex = 1; 5155 static const int kInlinedFunctionCountIndex = 1;
5156 static const int kTranslationByteArrayIndex = 2; 5156 static const int kLiteralArrayIndex = 2;
5157 static const int kInlinedFunctionCountIndex = 3; 5157 static const int kOsrAstIdIndex = 3;
5158 static const int kLiteralArrayIndex = 4; 5158 static const int kOsrPcOffsetIndex = 4;
5159 static const int kOsrAstIdIndex = 5; 5159 static const int kOptimizationIdIndex = 5;
5160 static const int kOsrPcOffsetIndex = 6; 5160 static const int kSharedFunctionInfoIndex = 6;
5161 static const int kOptimizationIdIndex = 7; 5161 static const int kFirstDeoptEntryIndex = 7;
5162 static const int kSharedFunctionInfoIndex = 8;
5163 static const int kFirstDeoptEntryIndex = 9;
5164 5162
5165 // Offsets of deopt entry elements relative to the start of the entry. 5163 // Offsets of deopt entry elements relative to the start of the entry.
5166 static const int kAstIdRawOffset = 0; 5164 static const int kAstIdRawOffset = 0;
5167 static const int kTranslationIndexOffset = 1; 5165 static const int kTranslationIndexOffset = 1;
5168 static const int kArgumentsStackHeightOffset = 2; 5166 static const int kArgumentsStackHeightOffset = 2;
5169 static const int kPcOffset = 3; 5167 static const int kPcOffset = 3;
5170 static const int kDeoptEntrySize = 4; 5168 static const int kDeoptEntrySize = 4;
5171 5169
5172 // Offsets of return address patch entry elements relative to the start of the
5173 // entry
5174 static const int kReturnAddressPcOffset = 0;
5175 static const int kPatchedAddressPcOffset = 1;
5176 static const int kReturnAddressPatchEntrySize = 2;
5177
5178 // Simple element accessors. 5170 // Simple element accessors.
5179 #define DEFINE_ELEMENT_ACCESSORS(name, type) \ 5171 #define DEFINE_ELEMENT_ACCESSORS(name, type) \
5180 type* name() { \ 5172 type* name() { \
5181 return type::cast(get(k##name##Index)); \ 5173 return type::cast(get(k##name##Index)); \
5182 } \ 5174 } \
5183 void Set##name(type* value) { \ 5175 void Set##name(type* value) { \
5184 set(k##name##Index, value); \ 5176 set(k##name##Index, value); \
5185 } 5177 }
5186 5178
5187 DEFINE_ELEMENT_ACCESSORS(TranslationByteArray, ByteArray) 5179 DEFINE_ELEMENT_ACCESSORS(TranslationByteArray, ByteArray)
5188 DEFINE_ELEMENT_ACCESSORS(InlinedFunctionCount, Smi) 5180 DEFINE_ELEMENT_ACCESSORS(InlinedFunctionCount, Smi)
5189 DEFINE_ELEMENT_ACCESSORS(LiteralArray, FixedArray) 5181 DEFINE_ELEMENT_ACCESSORS(LiteralArray, FixedArray)
5190 DEFINE_ELEMENT_ACCESSORS(OsrAstId, Smi) 5182 DEFINE_ELEMENT_ACCESSORS(OsrAstId, Smi)
5191 DEFINE_ELEMENT_ACCESSORS(OsrPcOffset, Smi) 5183 DEFINE_ELEMENT_ACCESSORS(OsrPcOffset, Smi)
5192 DEFINE_ELEMENT_ACCESSORS(OptimizationId, Smi) 5184 DEFINE_ELEMENT_ACCESSORS(OptimizationId, Smi)
5193 DEFINE_ELEMENT_ACCESSORS(SharedFunctionInfo, Object) 5185 DEFINE_ELEMENT_ACCESSORS(SharedFunctionInfo, Object)
5194 5186
5195 #undef DEFINE_ELEMENT_ACCESSORS 5187 #undef DEFINE_ELEMENT_ACCESSORS
5196 5188
5197 // Accessors for elements of the ith deoptimization entry. 5189 // Accessors for elements of the ith deoptimization entry.
5198 #define DEFINE_DEOPT_ENTRY_ACCESSORS(name, type) \ 5190 #define DEFINE_ENTRY_ACCESSORS(name, type) \
5199 type* name(int i) { \ 5191 type* name(int i) { \
5200 return type::cast(get(IndexForEntry(i) + k##name##Offset)); \ 5192 return type::cast(get(IndexForEntry(i) + k##name##Offset)); \
5201 } \ 5193 } \
5202 void Set##name(int i, type* value) { \ 5194 void Set##name(int i, type* value) { \
5203 set(IndexForEntry(i) + k##name##Offset, value); \ 5195 set(IndexForEntry(i) + k##name##Offset, value); \
5204 } 5196 }
5205 5197
5206 DEFINE_DEOPT_ENTRY_ACCESSORS(AstIdRaw, Smi) 5198 DEFINE_ENTRY_ACCESSORS(AstIdRaw, Smi)
5207 DEFINE_DEOPT_ENTRY_ACCESSORS(TranslationIndex, Smi) 5199 DEFINE_ENTRY_ACCESSORS(TranslationIndex, Smi)
5208 DEFINE_DEOPT_ENTRY_ACCESSORS(ArgumentsStackHeight, Smi) 5200 DEFINE_ENTRY_ACCESSORS(ArgumentsStackHeight, Smi)
5209 DEFINE_DEOPT_ENTRY_ACCESSORS(Pc, Smi) 5201 DEFINE_ENTRY_ACCESSORS(Pc, Smi)
5210 5202
5211 #undef DEFINE_DEOPT_ENTRY_ACCESSORS 5203 #undef DEFINE_DEOPT_ENTRY_ACCESSORS
5212 5204
5213 // Accessors for elements of the ith deoptimization entry.
5214 #define DEFINE_PATCH_ENTRY_ACCESSORS(name, type) \
5215 type* name(int i) { \
5216 return type::cast( \
5217 get(IndexForReturnAddressPatchEntry(i) + k##name##Offset)); \
5218 } \
5219 void Set##name(int i, type* value) { \
5220 set(IndexForReturnAddressPatchEntry(i) + k##name##Offset, value); \
5221 }
5222
5223 DEFINE_PATCH_ENTRY_ACCESSORS(ReturnAddressPc, Smi)
5224 DEFINE_PATCH_ENTRY_ACCESSORS(PatchedAddressPc, Smi)
5225
5226 #undef DEFINE_PATCH_ENTRY_ACCESSORS
5227
5228 BailoutId AstId(int i) { 5205 BailoutId AstId(int i) {
5229 return BailoutId(AstIdRaw(i)->value()); 5206 return BailoutId(AstIdRaw(i)->value());
5230 } 5207 }
5231 5208
5232 void SetAstId(int i, BailoutId value) { 5209 void SetAstId(int i, BailoutId value) {
5233 SetAstIdRaw(i, Smi::FromInt(value.ToInt())); 5210 SetAstIdRaw(i, Smi::FromInt(value.ToInt()));
5234 } 5211 }
5235 5212
5236 int DeoptCount() { 5213 int DeoptCount() {
5237 return length() == 0 ? 0 : Smi::cast(get(kDeoptEntryCountIndex))->value(); 5214 return (length() - kFirstDeoptEntryIndex) / kDeoptEntrySize;
5238 }
5239
5240 int ReturnAddressPatchCount() {
5241 return length() == 0
5242 ? 0
5243 : Smi::cast(get(kReturnAddressPatchEntryCountIndex))->value();
5244 } 5215 }
5245 5216
5246 // Allocates a DeoptimizationInputData. 5217 // Allocates a DeoptimizationInputData.
5247 static Handle<DeoptimizationInputData> New(Isolate* isolate, 5218 static Handle<DeoptimizationInputData> New(Isolate* isolate,
5248 int deopt_entry_count, 5219 int deopt_entry_count,
5249 int return_address_patch_count,
5250 PretenureFlag pretenure); 5220 PretenureFlag pretenure);
5251 5221
5252 DECLARE_CAST(DeoptimizationInputData) 5222 DECLARE_CAST(DeoptimizationInputData)
5253 5223
5254 #ifdef ENABLE_DISASSEMBLER 5224 #ifdef ENABLE_DISASSEMBLER
5255 void DeoptimizationInputDataPrint(OStream& os); // NOLINT 5225 void DeoptimizationInputDataPrint(OStream& os); // NOLINT
5256 #endif 5226 #endif
5257 5227
5258 private: 5228 private:
5259 friend class Object; // For accessing LengthFor.
5260
5261 static int IndexForEntry(int i) { 5229 static int IndexForEntry(int i) {
5262 return kFirstDeoptEntryIndex + (i * kDeoptEntrySize); 5230 return kFirstDeoptEntryIndex + (i * kDeoptEntrySize);
5263 } 5231 }
5264 5232
5265 int IndexForReturnAddressPatchEntry(int i) {
5266 return kFirstDeoptEntryIndex + (DeoptCount() * kDeoptEntrySize) +
5267 (i * kReturnAddressPatchEntrySize);
5268 }
5269 5233
5270 static int LengthFor(int deopt_count, int return_address_patch_count) { 5234 static int LengthFor(int entry_count) { return IndexForEntry(entry_count); }
5271 return kFirstDeoptEntryIndex + (deopt_count * kDeoptEntrySize) +
5272 (return_address_patch_count * kReturnAddressPatchEntrySize);
5273 }
5274 }; 5235 };
5275 5236
5276 5237
5277 // DeoptimizationOutputData is a fixed array used to hold the deoptimization 5238 // DeoptimizationOutputData is a fixed array used to hold the deoptimization
5278 // data for code generated by the full compiler. 5239 // data for code generated by the full compiler.
5279 // The format of the these objects is 5240 // The format of the these objects is
5280 // [i * 2]: Ast ID for ith deoptimization. 5241 // [i * 2]: Ast ID for ith deoptimization.
5281 // [i * 2 + 1]: PC and state of ith deoptimization 5242 // [i * 2 + 1]: PC and state of ith deoptimization
5282 class DeoptimizationOutputData: public FixedArray { 5243 class DeoptimizationOutputData: public FixedArray {
5283 public: 5244 public:
(...skipping 5906 matching lines...) Expand 10 before | Expand all | Expand 10 after
11190 } else { 11151 } else {
11191 value &= ~(1 << bit_position); 11152 value &= ~(1 << bit_position);
11192 } 11153 }
11193 return value; 11154 return value;
11194 } 11155 }
11195 }; 11156 };
11196 11157
11197 } } // namespace v8::internal 11158 } } // namespace v8::internal
11198 11159
11199 #endif // V8_OBJECTS_H_ 11160 #endif // V8_OBJECTS_H_
OLDNEW
« no previous file with comments | « src/mips64/lithium-codegen-mips64.cc ('k') | src/objects.cc » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698