V8 Project
v8::internal::AllocationSiteUsageContext Class Reference

#include <allocation-site-scopes.h>

+ Inheritance diagram for v8::internal::AllocationSiteUsageContext:
+ Collaboration diagram for v8::internal::AllocationSiteUsageContext:

Public Member Functions

 AllocationSiteUsageContext (Isolate *isolate, Handle< AllocationSite > site, bool activated)
 
Handle< AllocationSiteEnterNewScope ()
 
void ExitScope (Handle< AllocationSite > scope_site, Handle< JSObject > object)
 
bool ShouldCreateMemento (Handle< JSObject > object)
 
- Public Member Functions inherited from v8::internal::AllocationSiteContext
 AllocationSiteContext (Isolate *isolate)
 
Handle< AllocationSitetop ()
 
Handle< AllocationSitecurrent ()
 
bool ShouldCreateMemento (Handle< JSObject > object)
 
Isolateisolate ()
 

Private Attributes

Handle< AllocationSitetop_site_
 
bool activated_
 

Additional Inherited Members

- Protected Member Functions inherited from v8::internal::AllocationSiteContext
void update_current_site (AllocationSite *site)
 
void InitializeTraversal (Handle< AllocationSite > site)
 

Detailed Description

Definition at line 63 of file allocation-site-scopes.h.

Constructor & Destructor Documentation

◆ AllocationSiteUsageContext()

v8::internal::AllocationSiteUsageContext::AllocationSiteUsageContext ( Isolate isolate,
Handle< AllocationSite site,
bool  activated 
)
inline

Member Function Documentation

◆ EnterNewScope()

Handle<AllocationSite> v8::internal::AllocationSiteUsageContext::EnterNewScope ( )
inline

Definition at line 71 of file allocation-site-scopes.h.

71  {
72  if (top().is_null()) {
74  } else {
75  // Advance current site
76  Object* nested_site = current()->nested_site();
77  // Something is wrong if we advance to the end of the list here.
78  DCHECK(nested_site->IsAllocationSite());
79  update_current_site(AllocationSite::cast(nested_site));
80  }
81  return Handle<AllocationSite>(*current(), isolate());
82  }
void InitializeTraversal(Handle< AllocationSite > site)
void update_current_site(AllocationSite *site)
#define DCHECK(condition)
Definition: logging.h:205
kSerializedDataOffset Object
Definition: objects-inl.h:5322

References v8::internal::AllocationSiteContext::current(), DCHECK, v8::internal::AllocationSiteContext::InitializeTraversal(), v8::internal::AllocationSiteContext::isolate(), v8::internal::AllocationSiteContext::top(), top_site_, and v8::internal::AllocationSiteContext::update_current_site().

Referenced by v8::internal::HOptimizedGraphBuilder::BuildEmitFixedArray(), v8::internal::HOptimizedGraphBuilder::BuildEmitInObjectProperties(), v8::internal::CreateArrayLiteralImpl(), and v8::internal::RUNTIME_FUNCTION().

+ Here is the call graph for this function:
+ Here is the caller graph for this function:

◆ ExitScope()

void v8::internal::AllocationSiteUsageContext::ExitScope ( Handle< AllocationSite scope_site,
Handle< JSObject object 
)
inline

Definition at line 84 of file allocation-site-scopes.h.

85  {
86  // This assert ensures that we are pointing at the right sub-object in a
87  // recursive walk of a nested literal.
88  DCHECK(object.is_null() || *object == scope_site->transition_info());
89  }

References DCHECK.

Referenced by v8::internal::HOptimizedGraphBuilder::BuildEmitFixedArray(), v8::internal::HOptimizedGraphBuilder::BuildEmitInObjectProperties(), v8::internal::CreateArrayLiteralImpl(), and v8::internal::RUNTIME_FUNCTION().

+ Here is the caller graph for this function:

◆ ShouldCreateMemento()

bool v8::internal::AllocationSiteUsageContext::ShouldCreateMemento ( Handle< JSObject object)

Definition at line 63 of file allocation-site-scopes.cc.

63  {
64  if (activated_ && AllocationSite::CanTrack(object->map()->instance_type())) {
65  if (FLAG_allocation_site_pretenuring ||
66  AllocationSite::GetMode(object->GetElementsKind()) ==
68  if (FLAG_trace_creation_allocation_sites) {
69  PrintF("*** Creating Memento for %s %p\n",
70  object->IsJSArray() ? "JSArray" : "JSObject",
71  static_cast<void*>(*object));
72  }
73  return true;
74  }
75  }
76  return false;
77 }
static bool CanTrack(InstanceType type)
Definition: objects-inl.h:1614
static AllocationSiteMode GetMode(ElementsKind boilerplate_elements_kind)
Definition: objects-inl.h:1591
@ TRACK_ALLOCATION_SITE
Definition: objects.h:8085
void PrintF(const char *format,...)
Definition: utils.cc:80

References activated_, v8::internal::AllocationSite::CanTrack(), v8::internal::AllocationSite::GetMode(), v8::internal::PrintF(), and v8::internal::TRACK_ALLOCATION_SITE.

+ Here is the call graph for this function:

Member Data Documentation

◆ activated_

bool v8::internal::AllocationSiteUsageContext::activated_
private

Definition at line 95 of file allocation-site-scopes.h.

Referenced by ShouldCreateMemento().

◆ top_site_

Handle<AllocationSite> v8::internal::AllocationSiteUsageContext::top_site_
private

Definition at line 94 of file allocation-site-scopes.h.

Referenced by EnterNewScope().


The documentation for this class was generated from the following files: