| OLD | NEW |
| 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 "allocation.h" | 8 #include "allocation.h" |
| 9 #include "assert-scope.h" | 9 #include "assert-scope.h" |
| 10 #include "builtins.h" | 10 #include "builtins.h" |
| (...skipping 8386 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 8397 class AllocationSite: public Struct { | 8397 class AllocationSite: public Struct { |
| 8398 public: | 8398 public: |
| 8399 static const uint32_t kMaximumArrayBytesToPretransition = 8 * 1024; | 8399 static const uint32_t kMaximumArrayBytesToPretransition = 8 * 1024; |
| 8400 static const double kPretenureRatio; | 8400 static const double kPretenureRatio; |
| 8401 static const int kPretenureMinimumCreated = 100; | 8401 static const int kPretenureMinimumCreated = 100; |
| 8402 | 8402 |
| 8403 // Values for pretenure decision field. | 8403 // Values for pretenure decision field. |
| 8404 enum PretenureDecision { | 8404 enum PretenureDecision { |
| 8405 kUndecided = 0, | 8405 kUndecided = 0, |
| 8406 kDontTenure = 1, | 8406 kDontTenure = 1, |
| 8407 kTenure = 2, | 8407 kMaybeTenure = 2, |
| 8408 kZombie = 3, | 8408 kTenure = 3, |
| 8409 kZombie = 4, |
| 8409 kLastPretenureDecisionValue = kZombie | 8410 kLastPretenureDecisionValue = kZombie |
| 8410 }; | 8411 }; |
| 8411 | 8412 |
| 8413 const char* PretenureDecisionName(PretenureDecision decision); |
| 8414 |
| 8412 DECL_ACCESSORS(transition_info, Object) | 8415 DECL_ACCESSORS(transition_info, Object) |
| 8413 // nested_site threads a list of sites that represent nested literals | 8416 // nested_site threads a list of sites that represent nested literals |
| 8414 // walked in a particular order. So [[1, 2], 1, 2] will have one | 8417 // walked in a particular order. So [[1, 2], 1, 2] will have one |
| 8415 // nested_site, but [[1, 2], 3, [4]] will have a list of two. | 8418 // nested_site, but [[1, 2], 3, [4]] will have a list of two. |
| 8416 DECL_ACCESSORS(nested_site, Object) | 8419 DECL_ACCESSORS(nested_site, Object) |
| 8417 DECL_ACCESSORS(pretenure_data, Smi) | 8420 DECL_ACCESSORS(pretenure_data, Smi) |
| 8418 DECL_ACCESSORS(pretenure_create_count, Smi) | 8421 DECL_ACCESSORS(pretenure_create_count, Smi) |
| 8419 DECL_ACCESSORS(dependent_code, DependentCode) | 8422 DECL_ACCESSORS(dependent_code, DependentCode) |
| 8420 DECL_ACCESSORS(weak_next, Object) | 8423 DECL_ACCESSORS(weak_next, Object) |
| 8421 | 8424 |
| 8422 inline void Initialize(); | 8425 inline void Initialize(); |
| 8423 | 8426 |
| 8424 // This method is expensive, it should only be called for reporting. | 8427 // This method is expensive, it should only be called for reporting. |
| 8425 bool IsNestedSite(); | 8428 bool IsNestedSite(); |
| 8426 | 8429 |
| 8427 // transition_info bitfields, for constructed array transition info. | 8430 // transition_info bitfields, for constructed array transition info. |
| 8428 class ElementsKindBits: public BitField<ElementsKind, 0, 15> {}; | 8431 class ElementsKindBits: public BitField<ElementsKind, 0, 15> {}; |
| 8429 class UnusedBits: public BitField<int, 15, 14> {}; | 8432 class UnusedBits: public BitField<int, 15, 14> {}; |
| 8430 class DoNotInlineBit: public BitField<bool, 29, 1> {}; | 8433 class DoNotInlineBit: public BitField<bool, 29, 1> {}; |
| 8431 | 8434 |
| 8432 // Bitfields for pretenure_data | 8435 // Bitfields for pretenure_data |
| 8433 class MementoFoundCountBits: public BitField<int, 0, 27> {}; | 8436 class MementoFoundCountBits: public BitField<int, 0, 26> {}; |
| 8434 class PretenureDecisionBits: public BitField<PretenureDecision, 27, 2> {}; | 8437 class PretenureDecisionBits: public BitField<PretenureDecision, 26, 3> {}; |
| 8435 class DeoptDependentCodeBit: public BitField<bool, 29, 1> {}; | 8438 class DeoptDependentCodeBit: public BitField<bool, 29, 1> {}; |
| 8436 STATIC_ASSERT(PretenureDecisionBits::kMax >= kLastPretenureDecisionValue); | 8439 STATIC_ASSERT(PretenureDecisionBits::kMax >= kLastPretenureDecisionValue); |
| 8437 | 8440 |
| 8438 // Increments the mementos found counter and returns true when the first | 8441 // Increments the mementos found counter and returns true when the first |
| 8439 // memento was found for a given allocation site. | 8442 // memento was found for a given allocation site. |
| 8440 inline bool IncrementMementoFoundCount(); | 8443 inline bool IncrementMementoFoundCount(); |
| 8441 | 8444 |
| 8442 inline void IncrementMementoCreateCount(); | 8445 inline void IncrementMementoCreateCount(); |
| 8443 | 8446 |
| 8444 PretenureFlag GetPretenureMode(); | 8447 PretenureFlag GetPretenureMode(); |
| (...skipping 42 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 8487 // The pretenuring decision is made during gc, and the zombie state allows | 8490 // The pretenuring decision is made during gc, and the zombie state allows |
| 8488 // us to recognize when an allocation site is just being kept alive because | 8491 // us to recognize when an allocation site is just being kept alive because |
| 8489 // a later traversal of new space may discover AllocationMementos that point | 8492 // a later traversal of new space may discover AllocationMementos that point |
| 8490 // to this AllocationSite. | 8493 // to this AllocationSite. |
| 8491 bool IsZombie() { | 8494 bool IsZombie() { |
| 8492 return pretenure_decision() == kZombie; | 8495 return pretenure_decision() == kZombie; |
| 8493 } | 8496 } |
| 8494 | 8497 |
| 8495 inline void MarkZombie(); | 8498 inline void MarkZombie(); |
| 8496 | 8499 |
| 8497 inline bool DigestPretenuringFeedback(); | 8500 inline bool MakePretenureDecision(PretenureDecision current_decision, |
| 8501 double ratio, |
| 8502 bool maximum_size_scavenge); |
| 8503 |
| 8504 inline bool DigestPretenuringFeedback(bool maximum_size_scavenge); |
| 8498 | 8505 |
| 8499 ElementsKind GetElementsKind() { | 8506 ElementsKind GetElementsKind() { |
| 8500 ASSERT(!SitePointsToLiteral()); | 8507 ASSERT(!SitePointsToLiteral()); |
| 8501 int value = Smi::cast(transition_info())->value(); | 8508 int value = Smi::cast(transition_info())->value(); |
| 8502 return ElementsKindBits::decode(value); | 8509 return ElementsKindBits::decode(value); |
| 8503 } | 8510 } |
| 8504 | 8511 |
| 8505 void SetElementsKind(ElementsKind kind) { | 8512 void SetElementsKind(ElementsKind kind) { |
| 8506 int value = Smi::cast(transition_info())->value(); | 8513 int value = Smi::cast(transition_info())->value(); |
| 8507 set_transition_info(Smi::FromInt(ElementsKindBits::update(value, kind)), | 8514 set_transition_info(Smi::FromInt(ElementsKindBits::update(value, kind)), |
| (...skipping 2566 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 11074 } else { | 11081 } else { |
| 11075 value &= ~(1 << bit_position); | 11082 value &= ~(1 << bit_position); |
| 11076 } | 11083 } |
| 11077 return value; | 11084 return value; |
| 11078 } | 11085 } |
| 11079 }; | 11086 }; |
| 11080 | 11087 |
| 11081 } } // namespace v8::internal | 11088 } } // namespace v8::internal |
| 11082 | 11089 |
| 11083 #endif // V8_OBJECTS_H_ | 11090 #endif // V8_OBJECTS_H_ |
| OLD | NEW |