Chromium Code Reviews
chromiumcodereview-hr@appspot.gserviceaccount.com (chromiumcodereview-hr) | Please choose your nickname with Settings | Help | Chromium Project | Gerrit Changes | Sign out
(178)

Side by Side Diff: src/objects.h

Issue 18173013: AllocationSite objects weakly linked for traversal (Closed) Base URL: https://v8.googlecode.com/svn/branches/bleeding_edge
Patch Set: Review ready Created 7 years, 5 months ago
Use n/p to move between diff chunks; N/P to move between comments. Draft comments are only viewable by you.
Jump to:
View unified diff | Download patch | Annotate | Revision Log
OLDNEW
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 7457 matching lines...) Expand 10 before | Expand all | Expand 10 after
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; 7477 static const int kTransitionInfoOffset = HeapObject::kHeaderSize;
7478 static const int kSize = kTransitionInfoOffset + kPointerSize; 7478 static const int kWeakNextOffset = kTransitionInfoOffset + kPointerSize;
7479 static const int kSize = kWeakNextOffset + kPointerSize;
Michael Starzinger 2013/07/16 18:14:46 nit: The offset and size calculation should go to
mvstanton 2013/07/16 19:34:57 Hmm. I actually moved these constants to the top o
7480
7479 static const uint32_t kMaximumArrayBytesToPretransition = 8 * 1024; 7481 static const uint32_t kMaximumArrayBytesToPretransition = 8 * 1024;
7480 7482
7483 typedef FixedBodyDescriptor<HeapObject::kHeaderSize,
7484 kTransitionInfoOffset + kPointerSize,
7485 kSize> BodyDescriptor;
7486
7481 DECL_ACCESSORS(transition_info, Object) 7487 DECL_ACCESSORS(transition_info, Object)
7488 DECL_ACCESSORS(weak_next, Object)
7482 7489
7483 void Initialize() { 7490 void Initialize() {
7484 SetElementsKind(GetInitialFastElementsKind()); 7491 SetElementsKind(GetInitialFastElementsKind());
7485 } 7492 }
7486 7493
7487 ElementsKind GetElementsKind() { 7494 ElementsKind GetElementsKind() {
7488 ASSERT(!IsLiteralSite()); 7495 ASSERT(!IsLiteralSite());
7489 return static_cast<ElementsKind>(Smi::cast(transition_info())->value()); 7496 return static_cast<ElementsKind>(Smi::cast(transition_info())->value());
7490 } 7497 }
7491 7498
7492 void SetElementsKind(ElementsKind kind) { 7499 void SetElementsKind(ElementsKind kind) {
7493 set_transition_info(Smi::FromInt(static_cast<int>(kind))); 7500 set_transition_info(Smi::FromInt(static_cast<int>(kind)));
7494 } 7501 }
7495 7502
7496 bool IsLiteralSite() { 7503 bool IsLiteralSite() {
7497 // If transition_info is a smi, then it represents an ElementsKind 7504 // If transition_info is a smi, then it represents an ElementsKind
7498 // for a constructed array. Otherwise, it must be a boilerplate 7505 // for a constructed array. Otherwise, it must be a boilerplate
7499 // for an array literal 7506 // for an array literal
7500 return transition_info()->IsJSArray(); 7507 return transition_info()->IsJSArray();
7501 } 7508 }
7502 7509
7503 DECLARE_PRINTER(AllocationSite) 7510 DECLARE_PRINTER(AllocationSite)
7504 DECLARE_VERIFIER(AllocationSite) 7511 DECLARE_VERIFIER(AllocationSite)
7505 7512
7506 static inline AllocationSite* cast(Object* obj); 7513 static inline AllocationSite* cast(Object* obj);
7507 static inline AllocationSiteMode GetMode( 7514 static inline AllocationSiteMode GetMode(
7508 ElementsKind boilerplate_elements_kind); 7515 ElementsKind boilerplate_elements_kind);
7509 static inline AllocationSiteMode GetMode(ElementsKind from, ElementsKind to); 7516 static inline AllocationSiteMode GetMode(ElementsKind from, ElementsKind to);
7510 7517
7518 // Dispatched behavior.
7519 inline void AllocationSiteIterateBody(ObjectVisitor* v);
7520
7511 private: 7521 private:
7512 DISALLOW_IMPLICIT_CONSTRUCTORS(AllocationSite); 7522 DISALLOW_IMPLICIT_CONSTRUCTORS(AllocationSite);
7513 }; 7523 };
7514 7524
7515 7525
7516 class AllocationSiteInfo: public Struct { 7526 class AllocationSiteInfo: public Struct {
7517 public: 7527 public:
7518 static const int kAllocationSiteOffset = HeapObject::kHeaderSize; 7528 static const int kAllocationSiteOffset = HeapObject::kHeaderSize;
7519 static const int kSize = kAllocationSiteOffset + kPointerSize; 7529 static const int kSize = kAllocationSiteOffset + kPointerSize;
7520 7530
(...skipping 2217 matching lines...) Expand 10 before | Expand all | Expand 10 after
9738 9748
9739 // Visits a code target in the instruction stream. 9749 // Visits a code target in the instruction stream.
9740 virtual void VisitCodeTarget(RelocInfo* rinfo); 9750 virtual void VisitCodeTarget(RelocInfo* rinfo);
9741 9751
9742 // Visits a code entry in a JS function. 9752 // Visits a code entry in a JS function.
9743 virtual void VisitCodeEntry(Address entry_address); 9753 virtual void VisitCodeEntry(Address entry_address);
9744 9754
9745 // Visits a global property cell reference in the instruction stream. 9755 // Visits a global property cell reference in the instruction stream.
9746 virtual void VisitCell(RelocInfo* rinfo); 9756 virtual void VisitCell(RelocInfo* rinfo);
9747 9757
9758 virtual void VisitAllocationSite(HeapObject* site) {
9759 AllocationSite::BodyDescriptor::IterateBody(site, this);
9760 }
9761
9748 // Visits a runtime entry in the instruction stream. 9762 // Visits a runtime entry in the instruction stream.
9749 virtual void VisitRuntimeEntry(RelocInfo* rinfo) {} 9763 virtual void VisitRuntimeEntry(RelocInfo* rinfo) {}
9750 9764
9751 // Visits the resource of an ASCII or two-byte string. 9765 // Visits the resource of an ASCII or two-byte string.
9752 virtual void VisitExternalAsciiString( 9766 virtual void VisitExternalAsciiString(
9753 v8::String::ExternalAsciiStringResource** resource) {} 9767 v8::String::ExternalAsciiStringResource** resource) {}
9754 virtual void VisitExternalTwoByteString( 9768 virtual void VisitExternalTwoByteString(
9755 v8::String::ExternalStringResource** resource) {} 9769 v8::String::ExternalStringResource** resource) {}
9756 9770
9757 // Visits a debug call target in the instruction stream. 9771 // Visits a debug call target in the instruction stream.
(...skipping 61 matching lines...) Expand 10 before | Expand all | Expand 10 after
9819 } else { 9833 } else {
9820 value &= ~(1 << bit_position); 9834 value &= ~(1 << bit_position);
9821 } 9835 }
9822 return value; 9836 return value;
9823 } 9837 }
9824 }; 9838 };
9825 9839
9826 } } // namespace v8::internal 9840 } } // namespace v8::internal
9827 9841
9828 #endif // V8_OBJECTS_H_ 9842 #endif // V8_OBJECTS_H_
OLDNEW

Powered by Google App Engine
This is Rietveld 408576698