5 #ifndef V8_ALLOCATION_SITE_SCOPES_INL_H_ 6 #define V8_ALLOCATION_SITE_SCOPES_INL_H_ 8 #include "src/allocation-site-scopes.h" 10 #include "src/objects/allocation-site-inl.h" 15 void AllocationSiteContext::InitializeTraversal(Handle<AllocationSite> site) {
19 current_ = Handle<AllocationSite>::New(*top_, isolate());
22 Handle<AllocationSite> AllocationSiteUsageContext::EnterNewScope() {
23 if (top().is_null()) {
24 InitializeTraversal(top_site_);
27 Object* nested_site = current()->nested_site();
29 update_current_site(AllocationSite::cast(nested_site));
31 return Handle<AllocationSite>(*current(), isolate());
34 void AllocationSiteUsageContext::ExitScope(Handle<AllocationSite> scope_site,
35 Handle<JSObject>
object) {
38 DCHECK(
object.is_null() || *
object == scope_site->boilerplate());
41 bool AllocationSiteUsageContext::ShouldCreateMemento(Handle<JSObject>
object) {
42 if (activated_ && AllocationSite::CanTrack(object->map()->instance_type())) {
43 if (FLAG_allocation_site_pretenuring ||
44 AllocationSite::ShouldTrack(object->GetElementsKind())) {
45 if (FLAG_trace_creation_allocation_sites) {
46 PrintF(
"*** Creating Memento for %s %p\n",
47 object->IsJSArray() ?
"JSArray" :
"JSObject",
48 static_cast<void*
>(*object));
59 #endif // V8_ALLOCATION_SITE_SCOPES_INL_H_