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