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

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: Response to first comments 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 7456 matching lines...) Expand 10 before | Expand all | Expand 10 after
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 // Dispatched behavior.
7511 inline void AllocationSiteIterateBody(ObjectVisitor* v);
7512
7513 static const int kTransitionInfoOffset = HeapObject::kHeaderSize;
7514 static const int kWeakNextOffset = kTransitionInfoOffset + kPointerSize;
7515 static const int kSize = kWeakNextOffset + kPointerSize;
7516
7517 typedef FixedBodyDescriptor<HeapObject::kHeaderSize,
7518 kTransitionInfoOffset + kPointerSize,
7519 kSize> BodyDescriptor;
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) {
Michael Starzinger 2013/07/17 08:48:57 As discussed offline: It should be possible to get
mvstanton 2013/07/17 09:56:16 Done.
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
« no previous file with comments | « src/ia32/lithium-ia32.cc ('k') | src/objects.cc » ('j') | src/serialize.cc » ('J')

Powered by Google App Engine
This is Rietveld 408576698