Commit 7a4744ad authored by Ben L. Titzer's avatar Ben L. Titzer

Always wrap AllocationSiteContext::current() in a new handle in Crankshaft.

R=mvstanton@chromium.org
BUG=

Review URL: https://codereview.chromium.org/1086863003

Cr-Commit-Position: refs/heads/master@{#27935}
parent f15d0137
......@@ -75,7 +75,6 @@ class AllocationSiteUsageContext : public AllocationSiteContext {
// Advance current site
Object* nested_site = current()->nested_site();
// Something is wrong if we advance to the end of the list here.
DCHECK(nested_site->IsAllocationSite());
update_current_site(AllocationSite::cast(nested_site));
}
return Handle<AllocationSite>(*current(), isolate());
......
......@@ -5590,10 +5590,10 @@ void HOptimizedGraphBuilder::VisitObjectLiteral(ObjectLiteral* expr) {
if (!boilerplate.is_null() &&
IsFastLiteral(boilerplate, kMaxFastLiteralDepth, &max_properties)) {
AllocationSiteUsageContext usage_context(isolate(), site, false);
usage_context.EnterNewScope();
literal = BuildFastLiteral(boilerplate, &usage_context);
usage_context.ExitScope(site, boilerplate);
AllocationSiteUsageContext site_context(isolate(), site, false);
site_context.EnterNewScope();
literal = BuildFastLiteral(boilerplate, &site_context);
site_context.ExitScope(site, boilerplate);
} else {
NoObservableSideEffectsScope no_effects(this);
Handle<FixedArray> closure_literals(closure->literals(), isolate());
......@@ -5754,10 +5754,10 @@ void HOptimizedGraphBuilder::VisitArrayLiteral(ArrayLiteral* expr) {
if (IsFastLiteral(boilerplate_object,
kMaxFastLiteralDepth,
&max_properties)) {
AllocationSiteUsageContext usage_context(isolate(), site, false);
usage_context.EnterNewScope();
literal = BuildFastLiteral(boilerplate_object, &usage_context);
usage_context.ExitScope(site, boilerplate_object);
AllocationSiteUsageContext site_context(isolate(), site, false);
site_context.EnterNewScope();
literal = BuildFastLiteral(boilerplate_object, &site_context);
site_context.ExitScope(site, boilerplate_object);
} else {
NoObservableSideEffectsScope no_effects(this);
// Boilerplate already exists and constant elements are never accessed,
......@@ -11081,16 +11081,16 @@ HInstruction* HOptimizedGraphBuilder::BuildFastLiteral(
boilerplate_object->map()->instance_size());
PretenureFlag pretenure_flag = NOT_TENURED;
Handle<AllocationSite> site(site_context->current());
Handle<AllocationSite> current_site(*site_context->current(), isolate());
if (FLAG_allocation_site_pretenuring) {
pretenure_flag = site_context->current()->GetPretenureMode();
AllocationSite::RegisterForDeoptOnTenureChange(site, top_info());
pretenure_flag = current_site->GetPretenureMode();
AllocationSite::RegisterForDeoptOnTenureChange(current_site, top_info());
}
AllocationSite::RegisterForDeoptOnTransitionChange(site, top_info());
AllocationSite::RegisterForDeoptOnTransitionChange(current_site, top_info());
HInstruction* object = Add<HAllocate>(object_size_constant, type,
pretenure_flag, instance_type, site_context->current());
HInstruction* object = Add<HAllocate>(
object_size_constant, type, pretenure_flag, instance_type, current_site);
// If allocation folding reaches Page::kMaxRegularHeapObjectSize the
// elements array may not get folded into the object. Hence, we set the
......@@ -11125,9 +11125,9 @@ HInstruction* HOptimizedGraphBuilder::BuildFastLiteral(
HValue* object_elements_size = Add<HConstant>(elements_size);
InstanceType instance_type = boilerplate_object->HasFastDoubleElements()
? FIXED_DOUBLE_ARRAY_TYPE : FIXED_ARRAY_TYPE;
object_elements = Add<HAllocate>(
object_elements_size, HType::HeapObject(),
pretenure_flag, instance_type, site_context->current());
object_elements =
Add<HAllocate>(object_elements_size, HType::HeapObject(),
pretenure_flag, instance_type, current_site);
}
BuildInitElementsInObjectHeader(boilerplate_object, object, object_elements);
......
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment