| 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 7449 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 7460 | 7460 |
| 7461 enum AllocationSiteMode { | 7461 enum AllocationSiteMode { |
| 7462 DONT_TRACK_ALLOCATION_SITE, | 7462 DONT_TRACK_ALLOCATION_SITE, |
| 7463 TRACK_ALLOCATION_SITE, | 7463 TRACK_ALLOCATION_SITE, |
| 7464 LAST_ALLOCATION_SITE_MODE = TRACK_ALLOCATION_SITE | 7464 LAST_ALLOCATION_SITE_MODE = TRACK_ALLOCATION_SITE |
| 7465 }; | 7465 }; |
| 7466 | 7466 |
| 7467 | 7467 |
| 7468 class AllocationSite: public Struct { | 7468 class AllocationSite: public Struct { |
| 7469 public: | 7469 public: |
| 7470 static const int kPayloadOffset = HeapObject::kHeaderSize; | 7470 static const int kTransitionInfoOffset = HeapObject::kHeaderSize; |
| 7471 static const int kSize = kPayloadOffset + kPointerSize; | 7471 static const int kSize = kTransitionInfoOffset + kPointerSize; |
| 7472 static const uint32_t kMaximumArrayBytesToPretransition = 8 * 1024; | 7472 static const uint32_t kMaximumArrayBytesToPretransition = 8 * 1024; |
| 7473 | 7473 |
| 7474 // TODO(mvstanton): rename payload to transition_info. | 7474 DECL_ACCESSORS(transition_info, Object) |
| 7475 DECL_ACCESSORS(payload, Object) | |
| 7476 | 7475 |
| 7477 void Initialize() { | 7476 void Initialize() { |
| 7478 SetElementsKindPayload(GetInitialFastElementsKind()); | 7477 SetElementsKind(GetInitialFastElementsKind()); |
| 7479 } | 7478 } |
| 7480 | 7479 |
| 7481 ElementsKind GetElementsKindPayload() { | 7480 ElementsKind GetElementsKind() { |
| 7482 ASSERT(!IsLiteralSite()); | 7481 ASSERT(!IsLiteralSite()); |
| 7483 return static_cast<ElementsKind>(Smi::cast(payload())->value()); | 7482 return static_cast<ElementsKind>(Smi::cast(transition_info())->value()); |
| 7484 } | 7483 } |
| 7485 | 7484 |
| 7486 void SetElementsKindPayload(ElementsKind kind) { | 7485 void SetElementsKind(ElementsKind kind) { |
| 7487 set_payload(Smi::FromInt(static_cast<int>(kind))); | 7486 set_transition_info(Smi::FromInt(static_cast<int>(kind))); |
| 7488 } | 7487 } |
| 7489 | 7488 |
| 7490 bool IsLiteralSite() { | 7489 bool IsLiteralSite() { |
| 7491 // If the payload is a smi, then it represents an ElementsKind | 7490 // If transition_info is a smi, then it represents an ElementsKind |
| 7492 // for a constructed array. Otherwise, it must be a boilerplate | 7491 // for a constructed array. Otherwise, it must be a boilerplate |
| 7493 // for an array literal | 7492 // for an array literal |
| 7494 return payload()->IsJSArray(); | 7493 return transition_info()->IsJSArray(); |
| 7495 } | 7494 } |
| 7496 | 7495 |
| 7497 DECLARE_PRINTER(AllocationSite) | 7496 DECLARE_PRINTER(AllocationSite) |
| 7498 DECLARE_VERIFIER(AllocationSite) | 7497 DECLARE_VERIFIER(AllocationSite) |
| 7499 | 7498 |
| 7500 static inline AllocationSite* cast(Object* obj); | 7499 static inline AllocationSite* cast(Object* obj); |
| 7501 static inline AllocationSiteMode GetMode( | 7500 static inline AllocationSiteMode GetMode( |
| 7502 ElementsKind boilerplate_elements_kind); | 7501 ElementsKind boilerplate_elements_kind); |
| 7503 static inline AllocationSiteMode GetMode(ElementsKind from, ElementsKind to); | 7502 static inline AllocationSiteMode GetMode(ElementsKind from, ElementsKind to); |
| 7504 | 7503 |
| (...skipping 2308 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 9813 } else { | 9812 } else { |
| 9814 value &= ~(1 << bit_position); | 9813 value &= ~(1 << bit_position); |
| 9815 } | 9814 } |
| 9816 return value; | 9815 return value; |
| 9817 } | 9816 } |
| 9818 }; | 9817 }; |
| 9819 | 9818 |
| 9820 } } // namespace v8::internal | 9819 } } // namespace v8::internal |
| 9821 | 9820 |
| 9822 #endif // V8_OBJECTS_H_ | 9821 #endif // V8_OBJECTS_H_ |
| OLD | NEW |