| 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 7456 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 7467 | 7467 |
| 7468 enum AllocationSiteMode { | 7468 enum AllocationSiteMode { |
| 7469 DONT_TRACK_ALLOCATION_SITE, | 7469 DONT_TRACK_ALLOCATION_SITE, |
| 7470 TRACK_ALLOCATION_SITE, | 7470 TRACK_ALLOCATION_SITE, |
| 7471 LAST_ALLOCATION_SITE_MODE = TRACK_ALLOCATION_SITE | 7471 LAST_ALLOCATION_SITE_MODE = TRACK_ALLOCATION_SITE |
| 7472 }; | 7472 }; |
| 7473 | 7473 |
| 7474 | 7474 |
| 7475 class AllocationSite: public Struct { | 7475 class AllocationSite: public Struct { |
| 7476 public: | 7476 public: |
| 7477 static const int kTransitionInfoOffset = HeapObject::kHeaderSize; | |
| 7478 static const int kSize = kTransitionInfoOffset + kPointerSize; | |
| 7479 static const uint32_t kMaximumArrayBytesToPretransition = 8 * 1024; | 7477 static const uint32_t kMaximumArrayBytesToPretransition = 8 * 1024; |
| 7480 | 7478 |
| 7481 DECL_ACCESSORS(transition_info, Object) | 7479 DECL_ACCESSORS(transition_info, Object) |
| 7480 DECL_ACCESSORS(weak_next, Object) |
| 7482 | 7481 |
| 7483 void Initialize() { | 7482 void Initialize() { |
| 7484 SetElementsKind(GetInitialFastElementsKind()); | 7483 SetElementsKind(GetInitialFastElementsKind()); |
| 7485 } | 7484 } |
| 7486 | 7485 |
| 7487 ElementsKind GetElementsKind() { | 7486 ElementsKind GetElementsKind() { |
| 7488 ASSERT(!IsLiteralSite()); | 7487 ASSERT(!IsLiteralSite()); |
| 7489 return static_cast<ElementsKind>(Smi::cast(transition_info())->value()); | 7488 return static_cast<ElementsKind>(Smi::cast(transition_info())->value()); |
| 7490 } | 7489 } |
| 7491 | 7490 |
| 7492 void SetElementsKind(ElementsKind kind) { | 7491 void SetElementsKind(ElementsKind kind) { |
| 7493 set_transition_info(Smi::FromInt(static_cast<int>(kind))); | 7492 set_transition_info(Smi::FromInt(static_cast<int>(kind))); |
| 7494 } | 7493 } |
| 7495 | 7494 |
| 7496 bool IsLiteralSite() { | 7495 bool IsLiteralSite() { |
| 7497 // If transition_info is a smi, then it represents an ElementsKind | 7496 // If transition_info is a smi, then it represents an ElementsKind |
| 7498 // for a constructed array. Otherwise, it must be a boilerplate | 7497 // for a constructed array. Otherwise, it must be a boilerplate |
| 7499 // for an array literal | 7498 // for an array literal |
| 7500 return transition_info()->IsJSArray(); | 7499 return transition_info()->IsJSArray(); |
| 7501 } | 7500 } |
| 7502 | 7501 |
| 7503 DECLARE_PRINTER(AllocationSite) | 7502 DECLARE_PRINTER(AllocationSite) |
| 7504 DECLARE_VERIFIER(AllocationSite) | 7503 DECLARE_VERIFIER(AllocationSite) |
| 7505 | 7504 |
| 7506 static inline AllocationSite* cast(Object* obj); | 7505 static inline AllocationSite* cast(Object* obj); |
| 7507 static inline AllocationSiteMode GetMode( | 7506 static inline AllocationSiteMode GetMode( |
| 7508 ElementsKind boilerplate_elements_kind); | 7507 ElementsKind boilerplate_elements_kind); |
| 7509 static inline AllocationSiteMode GetMode(ElementsKind from, ElementsKind to); | 7508 static inline AllocationSiteMode GetMode(ElementsKind from, ElementsKind to); |
| 7510 | 7509 |
| 7510 static const int kTransitionInfoOffset = HeapObject::kHeaderSize; |
| 7511 static const int kWeakNextOffset = kTransitionInfoOffset + kPointerSize; |
| 7512 static const int kSize = kWeakNextOffset + kPointerSize; |
| 7513 |
| 7514 typedef FixedBodyDescriptor<HeapObject::kHeaderSize, |
| 7515 kTransitionInfoOffset + kPointerSize, |
| 7516 kSize> BodyDescriptor; |
| 7517 |
| 7511 private: | 7518 private: |
| 7512 DISALLOW_IMPLICIT_CONSTRUCTORS(AllocationSite); | 7519 DISALLOW_IMPLICIT_CONSTRUCTORS(AllocationSite); |
| 7513 }; | 7520 }; |
| 7514 | 7521 |
| 7515 | 7522 |
| 7516 class AllocationSiteInfo: public Struct { | 7523 class AllocationSiteInfo: public Struct { |
| 7517 public: | 7524 public: |
| 7518 static const int kAllocationSiteOffset = HeapObject::kHeaderSize; | 7525 static const int kAllocationSiteOffset = HeapObject::kHeaderSize; |
| 7519 static const int kSize = kAllocationSiteOffset + kPointerSize; | 7526 static const int kSize = kAllocationSiteOffset + kPointerSize; |
| 7520 | 7527 |
| (...skipping 2298 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 9819 } else { | 9826 } else { |
| 9820 value &= ~(1 << bit_position); | 9827 value &= ~(1 << bit_position); |
| 9821 } | 9828 } |
| 9822 return value; | 9829 return value; |
| 9823 } | 9830 } |
| 9824 }; | 9831 }; |
| 9825 | 9832 |
| 9826 } } // namespace v8::internal | 9833 } } // namespace v8::internal |
| 9827 | 9834 |
| 9828 #endif // V8_OBJECTS_H_ | 9835 #endif // V8_OBJECTS_H_ |
| OLD | NEW |