| 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 5176 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 5187 // Is this function a top-level function (scripts, evals). | 5187 // Is this function a top-level function (scripts, evals). |
| 5188 DECL_BOOLEAN_ACCESSORS(is_toplevel) | 5188 DECL_BOOLEAN_ACCESSORS(is_toplevel) |
| 5189 | 5189 |
| 5190 // Bit field containing various information collected by the compiler to | 5190 // Bit field containing various information collected by the compiler to |
| 5191 // drive optimization. | 5191 // drive optimization. |
| 5192 inline int compiler_hints(); | 5192 inline int compiler_hints(); |
| 5193 inline void set_compiler_hints(int value); | 5193 inline void set_compiler_hints(int value); |
| 5194 | 5194 |
| 5195 // A counter used to determine when to stress the deoptimizer with a | 5195 // A counter used to determine when to stress the deoptimizer with a |
| 5196 // deopt. | 5196 // deopt. |
| 5197 inline Smi* deopt_counter(); | 5197 inline int deopt_counter(); |
| 5198 inline void set_deopt_counter(Smi* counter); | 5198 inline void set_deopt_counter(int counter); |
| 5199 |
| 5200 inline int ast_node_count(); |
| 5201 inline void set_ast_node_count(int count); |
| 5199 | 5202 |
| 5200 // Add information on assignments of the form this.x = ...; | 5203 // Add information on assignments of the form this.x = ...; |
| 5201 void SetThisPropertyAssignmentsInfo( | 5204 void SetThisPropertyAssignmentsInfo( |
| 5202 bool has_only_simple_this_property_assignments, | 5205 bool has_only_simple_this_property_assignments, |
| 5203 FixedArray* this_property_assignments); | 5206 FixedArray* this_property_assignments); |
| 5204 | 5207 |
| 5205 // Clear information on assignments of the form this.x = ...; | 5208 // Clear information on assignments of the form this.x = ...; |
| 5206 void ClearThisPropertyAssignmentsInfo(); | 5209 void ClearThisPropertyAssignmentsInfo(); |
| 5207 | 5210 |
| 5208 // Indicate that this function only consists of assignments of the form | 5211 // Indicate that this function only consists of assignments of the form |
| (...skipping 53 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 5262 DECL_BOOLEAN_ACCESSORS(name_should_print_as_anonymous) | 5265 DECL_BOOLEAN_ACCESSORS(name_should_print_as_anonymous) |
| 5263 | 5266 |
| 5264 // Indicates whether the function is a bound function created using | 5267 // Indicates whether the function is a bound function created using |
| 5265 // the bind function. | 5268 // the bind function. |
| 5266 DECL_BOOLEAN_ACCESSORS(bound) | 5269 DECL_BOOLEAN_ACCESSORS(bound) |
| 5267 | 5270 |
| 5268 // Indicates that the function is anonymous (the name field can be set | 5271 // Indicates that the function is anonymous (the name field can be set |
| 5269 // through the API, which does not change this flag). | 5272 // through the API, which does not change this flag). |
| 5270 DECL_BOOLEAN_ACCESSORS(is_anonymous) | 5273 DECL_BOOLEAN_ACCESSORS(is_anonymous) |
| 5271 | 5274 |
| 5275 // Indicates that the function cannot be crankshafted. |
| 5276 DECL_BOOLEAN_ACCESSORS(dont_crankshaft) |
| 5277 |
| 5278 // Indicates that the function cannot be inlined. |
| 5279 DECL_BOOLEAN_ACCESSORS(dont_inline) |
| 5280 |
| 5272 // Indicates whether or not the code in the shared function support | 5281 // Indicates whether or not the code in the shared function support |
| 5273 // deoptimization. | 5282 // deoptimization. |
| 5274 inline bool has_deoptimization_support(); | 5283 inline bool has_deoptimization_support(); |
| 5275 | 5284 |
| 5276 // Enable deoptimization support through recompiled code. | 5285 // Enable deoptimization support through recompiled code. |
| 5277 void EnableDeoptimizationSupport(Code* recompiled); | 5286 void EnableDeoptimizationSupport(Code* recompiled); |
| 5278 | 5287 |
| 5279 // Disable (further) attempted optimization of all functions sharing this | 5288 // Disable (further) attempted optimization of all functions sharing this |
| 5280 // shared function info. The function is the one we actually tried to | 5289 // shared function info. The function is the one we actually tried to |
| 5281 // optimize. | 5290 // optimize. |
| (...skipping 74 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 5356 kConstructStubOffset + kPointerSize; | 5365 kConstructStubOffset + kPointerSize; |
| 5357 static const int kFunctionDataOffset = | 5366 static const int kFunctionDataOffset = |
| 5358 kInstanceClassNameOffset + kPointerSize; | 5367 kInstanceClassNameOffset + kPointerSize; |
| 5359 static const int kScriptOffset = kFunctionDataOffset + kPointerSize; | 5368 static const int kScriptOffset = kFunctionDataOffset + kPointerSize; |
| 5360 static const int kDebugInfoOffset = kScriptOffset + kPointerSize; | 5369 static const int kDebugInfoOffset = kScriptOffset + kPointerSize; |
| 5361 static const int kInferredNameOffset = kDebugInfoOffset + kPointerSize; | 5370 static const int kInferredNameOffset = kDebugInfoOffset + kPointerSize; |
| 5362 static const int kInitialMapOffset = | 5371 static const int kInitialMapOffset = |
| 5363 kInferredNameOffset + kPointerSize; | 5372 kInferredNameOffset + kPointerSize; |
| 5364 static const int kThisPropertyAssignmentsOffset = | 5373 static const int kThisPropertyAssignmentsOffset = |
| 5365 kInitialMapOffset + kPointerSize; | 5374 kInitialMapOffset + kPointerSize; |
| 5366 static const int kDeoptCounterOffset = | |
| 5367 kThisPropertyAssignmentsOffset + kPointerSize; | |
| 5368 #if V8_HOST_ARCH_32_BIT | 5375 #if V8_HOST_ARCH_32_BIT |
| 5369 // Smi fields. | 5376 // Smi fields. |
| 5370 static const int kLengthOffset = | 5377 static const int kLengthOffset = |
| 5371 kDeoptCounterOffset + kPointerSize; | 5378 kThisPropertyAssignmentsOffset + kPointerSize; |
| 5372 static const int kFormalParameterCountOffset = kLengthOffset + kPointerSize; | 5379 static const int kFormalParameterCountOffset = kLengthOffset + kPointerSize; |
| 5373 static const int kExpectedNofPropertiesOffset = | 5380 static const int kExpectedNofPropertiesOffset = |
| 5374 kFormalParameterCountOffset + kPointerSize; | 5381 kFormalParameterCountOffset + kPointerSize; |
| 5375 static const int kNumLiteralsOffset = | 5382 static const int kNumLiteralsOffset = |
| 5376 kExpectedNofPropertiesOffset + kPointerSize; | 5383 kExpectedNofPropertiesOffset + kPointerSize; |
| 5377 static const int kStartPositionAndTypeOffset = | 5384 static const int kStartPositionAndTypeOffset = |
| 5378 kNumLiteralsOffset + kPointerSize; | 5385 kNumLiteralsOffset + kPointerSize; |
| 5379 static const int kEndPositionOffset = | 5386 static const int kEndPositionOffset = |
| 5380 kStartPositionAndTypeOffset + kPointerSize; | 5387 kStartPositionAndTypeOffset + kPointerSize; |
| 5381 static const int kFunctionTokenPositionOffset = | 5388 static const int kFunctionTokenPositionOffset = |
| 5382 kEndPositionOffset + kPointerSize; | 5389 kEndPositionOffset + kPointerSize; |
| 5383 static const int kCompilerHintsOffset = | 5390 static const int kCompilerHintsOffset = |
| 5384 kFunctionTokenPositionOffset + kPointerSize; | 5391 kFunctionTokenPositionOffset + kPointerSize; |
| 5385 static const int kThisPropertyAssignmentsCountOffset = | 5392 static const int kThisPropertyAssignmentsCountOffset = |
| 5386 kCompilerHintsOffset + kPointerSize; | 5393 kCompilerHintsOffset + kPointerSize; |
| 5387 static const int kOptCountOffset = | 5394 static const int kOptCountOffset = |
| 5388 kThisPropertyAssignmentsCountOffset + kPointerSize; | 5395 kThisPropertyAssignmentsCountOffset + kPointerSize; |
| 5396 static const int kAstNodeCountOffset = kOptCountOffset + kPointerSize; |
| 5397 static const int kDeoptCounterOffset = |
| 5398 kAstNodeCountOffset + kPointerSize; |
| 5389 // Total size. | 5399 // Total size. |
| 5390 static const int kSize = kOptCountOffset + kPointerSize; | 5400 static const int kSize = kDeoptCounterOffset + kPointerSize; |
| 5391 #else | 5401 #else |
| 5392 // The only reason to use smi fields instead of int fields | 5402 // The only reason to use smi fields instead of int fields |
| 5393 // is to allow iteration without maps decoding during | 5403 // is to allow iteration without maps decoding during |
| 5394 // garbage collections. | 5404 // garbage collections. |
| 5395 // To avoid wasting space on 64-bit architectures we use | 5405 // To avoid wasting space on 64-bit architectures we use |
| 5396 // the following trick: we group integer fields into pairs | 5406 // the following trick: we group integer fields into pairs |
| 5397 // First integer in each pair is shifted left by 1. | 5407 // First integer in each pair is shifted left by 1. |
| 5398 // By doing this we guarantee that LSB of each kPointerSize aligned | 5408 // By doing this we guarantee that LSB of each kPointerSize aligned |
| 5399 // word is not set and thus this word cannot be treated as pointer | 5409 // word is not set and thus this word cannot be treated as pointer |
| 5400 // to HeapObject during old space traversal. | 5410 // to HeapObject during old space traversal. |
| 5401 static const int kLengthOffset = | 5411 static const int kLengthOffset = |
| 5402 kDeoptCounterOffset + kPointerSize; | 5412 kThisPropertyAssignmentsOffset + kPointerSize; |
| 5403 static const int kFormalParameterCountOffset = | 5413 static const int kFormalParameterCountOffset = |
| 5404 kLengthOffset + kIntSize; | 5414 kLengthOffset + kIntSize; |
| 5405 | 5415 |
| 5406 static const int kExpectedNofPropertiesOffset = | 5416 static const int kExpectedNofPropertiesOffset = |
| 5407 kFormalParameterCountOffset + kIntSize; | 5417 kFormalParameterCountOffset + kIntSize; |
| 5408 static const int kNumLiteralsOffset = | 5418 static const int kNumLiteralsOffset = |
| 5409 kExpectedNofPropertiesOffset + kIntSize; | 5419 kExpectedNofPropertiesOffset + kIntSize; |
| 5410 | 5420 |
| 5411 static const int kEndPositionOffset = | 5421 static const int kEndPositionOffset = |
| 5412 kNumLiteralsOffset + kIntSize; | 5422 kNumLiteralsOffset + kIntSize; |
| 5413 static const int kStartPositionAndTypeOffset = | 5423 static const int kStartPositionAndTypeOffset = |
| 5414 kEndPositionOffset + kIntSize; | 5424 kEndPositionOffset + kIntSize; |
| 5415 | 5425 |
| 5416 static const int kFunctionTokenPositionOffset = | 5426 static const int kFunctionTokenPositionOffset = |
| 5417 kStartPositionAndTypeOffset + kIntSize; | 5427 kStartPositionAndTypeOffset + kIntSize; |
| 5418 static const int kCompilerHintsOffset = | 5428 static const int kCompilerHintsOffset = |
| 5419 kFunctionTokenPositionOffset + kIntSize; | 5429 kFunctionTokenPositionOffset + kIntSize; |
| 5420 | 5430 |
| 5421 static const int kThisPropertyAssignmentsCountOffset = | 5431 static const int kThisPropertyAssignmentsCountOffset = |
| 5422 kCompilerHintsOffset + kIntSize; | 5432 kCompilerHintsOffset + kIntSize; |
| 5423 static const int kOptCountOffset = | 5433 static const int kOptCountOffset = |
| 5424 kThisPropertyAssignmentsCountOffset + kIntSize; | 5434 kThisPropertyAssignmentsCountOffset + kIntSize; |
| 5425 | 5435 |
| 5436 static const int kAstNodeCountOffset = kOptCountOffset + kIntSize; |
| 5437 static const int kDeoptCounterOffset = kAstNodeCountOffset + kIntSize; |
| 5438 |
| 5426 // Total size. | 5439 // Total size. |
| 5427 static const int kSize = kOptCountOffset + kIntSize; | 5440 static const int kSize = kDeoptCounterOffset + kIntSize; |
| 5428 | 5441 |
| 5429 #endif | 5442 #endif |
| 5430 | 5443 |
| 5431 // The construction counter for inobject slack tracking is stored in the | 5444 // The construction counter for inobject slack tracking is stored in the |
| 5432 // most significant byte of compiler_hints which is otherwise unused. | 5445 // most significant byte of compiler_hints which is otherwise unused. |
| 5433 // Its offset depends on the endian-ness of the architecture. | 5446 // Its offset depends on the endian-ness of the architecture. |
| 5434 #if __BYTE_ORDER == __LITTLE_ENDIAN | 5447 #if __BYTE_ORDER == __LITTLE_ENDIAN |
| 5435 static const int kConstructionCountOffset = kCompilerHintsOffset + 3; | 5448 static const int kConstructionCountOffset = kCompilerHintsOffset + 3; |
| 5436 #elif __BYTE_ORDER == __BIG_ENDIAN | 5449 #elif __BYTE_ORDER == __BIG_ENDIAN |
| 5437 static const int kConstructionCountOffset = kCompilerHintsOffset + 0; | 5450 static const int kConstructionCountOffset = kCompilerHintsOffset + 0; |
| (...skipping 26 matching lines...) Expand all Loading... |
| 5464 kCodeAgeShift, | 5477 kCodeAgeShift, |
| 5465 kOptimizationDisabled = kCodeAgeShift + kCodeAgeSize, | 5478 kOptimizationDisabled = kCodeAgeShift + kCodeAgeSize, |
| 5466 kStrictModeFunction, | 5479 kStrictModeFunction, |
| 5467 kExtendedModeFunction, | 5480 kExtendedModeFunction, |
| 5468 kUsesArguments, | 5481 kUsesArguments, |
| 5469 kHasDuplicateParameters, | 5482 kHasDuplicateParameters, |
| 5470 kNative, | 5483 kNative, |
| 5471 kBoundFunction, | 5484 kBoundFunction, |
| 5472 kIsAnonymous, | 5485 kIsAnonymous, |
| 5473 kNameShouldPrintAsAnonymous, | 5486 kNameShouldPrintAsAnonymous, |
| 5487 kDontCrankshaft, |
| 5488 kDontInline, |
| 5474 kCompilerHintsCount // Pseudo entry | 5489 kCompilerHintsCount // Pseudo entry |
| 5475 }; | 5490 }; |
| 5476 | 5491 |
| 5477 private: | 5492 private: |
| 5478 #if V8_HOST_ARCH_32_BIT | 5493 #if V8_HOST_ARCH_32_BIT |
| 5479 // On 32 bit platforms, compiler hints is a smi. | 5494 // On 32 bit platforms, compiler hints is a smi. |
| 5480 static const int kCompilerHintsSmiTagSize = kSmiTagSize; | 5495 static const int kCompilerHintsSmiTagSize = kSmiTagSize; |
| 5481 static const int kCompilerHintsSize = kPointerSize; | 5496 static const int kCompilerHintsSize = kPointerSize; |
| 5482 #else | 5497 #else |
| 5483 // On 64 bit platforms, compiler hints is not a smi, see comment above. | 5498 // On 64 bit platforms, compiler hints is not a smi, see comment above. |
| (...skipping 2752 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 8236 } else { | 8251 } else { |
| 8237 value &= ~(1 << bit_position); | 8252 value &= ~(1 << bit_position); |
| 8238 } | 8253 } |
| 8239 return value; | 8254 return value; |
| 8240 } | 8255 } |
| 8241 }; | 8256 }; |
| 8242 | 8257 |
| 8243 } } // namespace v8::internal | 8258 } } // namespace v8::internal |
| 8244 | 8259 |
| 8245 #endif // V8_OBJECTS_H_ | 8260 #endif // V8_OBJECTS_H_ |
| OLD | NEW |