| 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 4246 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 4257 | 4257 |
| 4258 // DeoptimizationInputData is a fixed array used to hold the deoptimization | 4258 // DeoptimizationInputData is a fixed array used to hold the deoptimization |
| 4259 // data for code generated by the Hydrogen/Lithium compiler. It also | 4259 // data for code generated by the Hydrogen/Lithium compiler. It also |
| 4260 // contains information about functions that were inlined. If N different | 4260 // contains information about functions that were inlined. If N different |
| 4261 // functions were inlined then first N elements of the literal array will | 4261 // functions were inlined then first N elements of the literal array will |
| 4262 // contain these functions. | 4262 // contain these functions. |
| 4263 // | 4263 // |
| 4264 // It can be empty. | 4264 // It can be empty. |
| 4265 class DeoptimizationInputData: public FixedArray { | 4265 class DeoptimizationInputData: public FixedArray { |
| 4266 public: | 4266 public: |
| 4267 // Layout description. Indices in the array. | 4267 // Fixed array consists of a header and sequence of entries. |
| 4268 static const int kTranslationByteArrayIndex = 0; | |
| 4269 static const int kInlinedFunctionCountIndex = 1; | |
| 4270 static const int kLiteralArrayIndex = 2; | |
| 4271 static const int kOsrAstIdIndex = 3; | |
| 4272 static const int kOsrPcOffsetIndex = 4; | |
| 4273 static const int kFirstDeoptEntryIndex = 5; | |
| 4274 | 4268 |
| 4275 // Offsets of deopt entry elements relative to the start of the entry. | 4269 // ==== Header field names and types. |
| 4276 static const int kAstIdRawOffset = 0; | 4270 #define FOR_EACH_HEADER_FIELD(F) \ |
| 4277 static const int kTranslationIndexOffset = 1; | 4271 F(TranslationByteArray, ByteArray) \ |
| 4278 static const int kArgumentsStackHeightOffset = 2; | 4272 F(InlinedFunctionCount, Smi) \ |
| 4279 static const int kPcOffset = 3; | 4273 F(LiteralArray, FixedArray) \ |
| 4280 static const int kDeoptEntrySize = 4; | 4274 F(OsrAstId, Smi) \ |
| 4275 F(OsrPcOffset, Smi) |
| 4281 | 4276 |
| 4282 // Simple element accessors. | 4277 // Header layout description by an enum. Value is an index into the fixed |
| 4283 #define DEFINE_ELEMENT_ACCESSORS(name, type) \ | 4278 // array. |
| 4279 #define MAKE_TAG(name, type) k##name##Index, |
| 4280 enum { |
| 4281 FOR_EACH_HEADER_FIELD(MAKE_TAG) |
| 4282 kFirstDeoptEntryIndex // Pseudo-tag. |
| 4283 }; |
| 4284 #undef MAKE_TAG |
| 4285 |
| 4286 // Header field accessors. |
| 4287 #define DEFINE_HEADER_ACCESSORS(name, type) \ |
| 4284 type* name() { \ | 4288 type* name() { \ |
| 4285 return type::cast(get(k##name##Index)); \ | 4289 return type::cast(get(k##name##Index)); \ |
| 4286 } \ | 4290 } \ |
| 4287 void Set##name(type* value) { \ | 4291 void Set##name(type* value) { \ |
| 4288 set(k##name##Index, value); \ | 4292 set(k##name##Index, value); \ |
| 4289 } | 4293 } |
| 4290 | 4294 |
| 4291 DEFINE_ELEMENT_ACCESSORS(TranslationByteArray, ByteArray) | 4295 FOR_EACH_HEADER_FIELD(DEFINE_HEADER_ACCESSORS) |
| 4292 DEFINE_ELEMENT_ACCESSORS(InlinedFunctionCount, Smi) | |
| 4293 DEFINE_ELEMENT_ACCESSORS(LiteralArray, FixedArray) | |
| 4294 DEFINE_ELEMENT_ACCESSORS(OsrAstId, Smi) | |
| 4295 DEFINE_ELEMENT_ACCESSORS(OsrPcOffset, Smi) | |
| 4296 | 4296 |
| 4297 #undef DEFINE_ELEMENT_ACCESSORS | 4297 #undef DEFINE_HEADER_ACCESSORS |
| 4298 #undef FOR_EACH_HEADER_FIELD |
| 4298 | 4299 |
| 4299 // Accessors for elements of the ith deoptimization entry. | 4300 // ==== Entry field names and types. |
| 4301 #define FOR_EACH_ENTRY_FIELD(F) \ |
| 4302 F(AstIdRaw, Smi) \ |
| 4303 F(TranslationIndex, Smi) \ |
| 4304 F(ArgumentsStackHeight, Smi) \ |
| 4305 F(HandlerCount, Smi) \ |
| 4306 F(Pc, Smi) |
| 4307 |
| 4308 // Entry layout description by an enum. Value is an offset relative to |
| 4309 // the start of the entry. |
| 4310 #define MAKE_TAG(name, type) k##name##Offset, |
| 4311 enum { |
| 4312 FOR_EACH_ENTRY_FIELD(MAKE_TAG) |
| 4313 kDeoptEntrySize // Pseudo-value |
| 4314 }; |
| 4315 #undef MAKE_TAG |
| 4316 |
| 4317 // Accessors for fields of the ith deoptimization entry. |
| 4300 #define DEFINE_ENTRY_ACCESSORS(name, type) \ | 4318 #define DEFINE_ENTRY_ACCESSORS(name, type) \ |
| 4301 type* name(int i) { \ | 4319 type* name(int i) { \ |
| 4302 return type::cast(get(IndexForEntry(i) + k##name##Offset)); \ | 4320 return type::cast(get(IndexForEntry(i) + k##name##Offset)); \ |
| 4303 } \ | 4321 } \ |
| 4304 void Set##name(int i, type* value) { \ | 4322 void Set##name(int i, type* value) { \ |
| 4305 set(IndexForEntry(i) + k##name##Offset, value); \ | 4323 set(IndexForEntry(i) + k##name##Offset, value); \ |
| 4306 } | 4324 } |
| 4307 | 4325 |
| 4308 DEFINE_ENTRY_ACCESSORS(AstIdRaw, Smi) | 4326 FOR_EACH_ENTRY_FIELD(DEFINE_ENTRY_ACCESSORS) |
| 4309 DEFINE_ENTRY_ACCESSORS(TranslationIndex, Smi) | |
| 4310 DEFINE_ENTRY_ACCESSORS(ArgumentsStackHeight, Smi) | |
| 4311 DEFINE_ENTRY_ACCESSORS(Pc, Smi) | |
| 4312 | 4327 |
| 4313 #undef DEFINE_ENTRY_ACCESSORS | 4328 #undef DEFINE_ENTRY_ACCESSORS |
| 4329 #undef FOR_EACH_ENTRY_FIELD |
| 4314 | 4330 |
| 4315 BailoutId AstId(int i) { | 4331 BailoutId AstId(int i) { |
| 4316 return BailoutId(AstIdRaw(i)->value()); | 4332 return BailoutId(AstIdRaw(i)->value()); |
| 4317 } | 4333 } |
| 4318 | 4334 |
| 4319 void SetAstId(int i, BailoutId value) { | 4335 void SetAstId(int i, BailoutId value) { |
| 4320 SetAstIdRaw(i, Smi::FromInt(value.ToInt())); | 4336 SetAstIdRaw(i, Smi::FromInt(value.ToInt())); |
| 4321 } | 4337 } |
| 4322 | 4338 |
| 4323 int DeoptCount() { | 4339 int DeoptCount() { |
| (...skipping 1865 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 6189 // Indicates that the function is anonymous (the name field can be set | 6205 // Indicates that the function is anonymous (the name field can be set |
| 6190 // through the API, which does not change this flag). | 6206 // through the API, which does not change this flag). |
| 6191 DECL_BOOLEAN_ACCESSORS(is_anonymous) | 6207 DECL_BOOLEAN_ACCESSORS(is_anonymous) |
| 6192 | 6208 |
| 6193 // Is this a function or top-level/eval code. | 6209 // Is this a function or top-level/eval code. |
| 6194 DECL_BOOLEAN_ACCESSORS(is_function) | 6210 DECL_BOOLEAN_ACCESSORS(is_function) |
| 6195 | 6211 |
| 6196 // Indicates that the function cannot be optimized. | 6212 // Indicates that the function cannot be optimized. |
| 6197 DECL_BOOLEAN_ACCESSORS(dont_optimize) | 6213 DECL_BOOLEAN_ACCESSORS(dont_optimize) |
| 6198 | 6214 |
| 6215 // Indicates that the function cannot be on stack replaced. |
| 6216 DECL_BOOLEAN_ACCESSORS(dont_osr) |
| 6217 |
| 6199 // Indicates that the function cannot be inlined. | 6218 // Indicates that the function cannot be inlined. |
| 6200 DECL_BOOLEAN_ACCESSORS(dont_inline) | 6219 DECL_BOOLEAN_ACCESSORS(dont_inline) |
| 6201 | 6220 |
| 6202 // Indicates that code for this function cannot be cached. | 6221 // Indicates that code for this function cannot be cached. |
| 6203 DECL_BOOLEAN_ACCESSORS(dont_cache) | 6222 DECL_BOOLEAN_ACCESSORS(dont_cache) |
| 6204 | 6223 |
| 6205 // Indicates that code for this function cannot be flushed. | 6224 // Indicates that code for this function cannot be flushed. |
| 6206 DECL_BOOLEAN_ACCESSORS(dont_flush) | 6225 DECL_BOOLEAN_ACCESSORS(dont_flush) |
| 6207 | 6226 |
| 6208 // Indicates that this function is a generator. | 6227 // Indicates that this function is a generator. |
| (...skipping 185 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 6394 kStrictModeFunction, | 6413 kStrictModeFunction, |
| 6395 kExtendedModeFunction, | 6414 kExtendedModeFunction, |
| 6396 kUsesArguments, | 6415 kUsesArguments, |
| 6397 kHasDuplicateParameters, | 6416 kHasDuplicateParameters, |
| 6398 kNative, | 6417 kNative, |
| 6399 kBoundFunction, | 6418 kBoundFunction, |
| 6400 kIsAnonymous, | 6419 kIsAnonymous, |
| 6401 kNameShouldPrintAsAnonymous, | 6420 kNameShouldPrintAsAnonymous, |
| 6402 kIsFunction, | 6421 kIsFunction, |
| 6403 kDontOptimize, | 6422 kDontOptimize, |
| 6423 kDontOsr, |
| 6404 kDontInline, | 6424 kDontInline, |
| 6405 kDontCache, | 6425 kDontCache, |
| 6406 kDontFlush, | 6426 kDontFlush, |
| 6407 kIsGenerator, | 6427 kIsGenerator, |
| 6408 kCompilerHintsCount // Pseudo entry | 6428 kCompilerHintsCount // Pseudo entry |
| 6409 }; | 6429 }; |
| 6410 | 6430 |
| 6411 class DeoptCountBits: public BitField<int, 0, 4> {}; | 6431 class DeoptCountBits: public BitField<int, 0, 4> {}; |
| 6412 class OptReenableTriesBits: public BitField<int, 4, 18> {}; | 6432 class OptReenableTriesBits: public BitField<int, 4, 18> {}; |
| 6413 class ICAgeBits: public BitField<int, 22, 8> {}; | 6433 class ICAgeBits: public BitField<int, 22, 8> {}; |
| (...skipping 3314 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 9728 } else { | 9748 } else { |
| 9729 value &= ~(1 << bit_position); | 9749 value &= ~(1 << bit_position); |
| 9730 } | 9750 } |
| 9731 return value; | 9751 return value; |
| 9732 } | 9752 } |
| 9733 }; | 9753 }; |
| 9734 | 9754 |
| 9735 } } // namespace v8::internal | 9755 } } // namespace v8::internal |
| 9736 | 9756 |
| 9737 #endif // V8_OBJECTS_H_ | 9757 #endif // V8_OBJECTS_H_ |
| OLD | NEW |