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

Unified Diff: src/builtins/builtins-constructor.cc

Issue 2680313002: Count closures using the feedback vector cell map, specialize if count==1. (Closed)
Patch Set: Only specialize if compiling from bytecode Created 3 years, 10 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 side-by-side diff with in-line comments
Download patch
« no previous file with comments | « no previous file | src/code-stub-assembler.h » ('j') | no next file with comments »
Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
Index: src/builtins/builtins-constructor.cc
diff --git a/src/builtins/builtins-constructor.cc b/src/builtins/builtins-constructor.cc
index 782551d3eae0f8cc5d5256ada4615d4446a6f2ef..e2021eaec68201c25422d48d1cab548207fc5fca 100644
--- a/src/builtins/builtins-constructor.cc
+++ b/src/builtins/builtins-constructor.cc
@@ -126,6 +126,26 @@ Node* ConstructorBuiltinsAssembler::EmitFastNewClosure(Node* shared_info,
empty_fixed_array);
Node* literals_cell = LoadFixedArrayElement(
feedback_vector, slot, 0, CodeStubAssembler::SMI_PARAMETERS);
+ {
+ // Bump the closure counter encoded in the cell's map.
+ Node* cell_map = LoadMap(literals_cell);
+ Label no_closures(this), one_closure(this), cell_done(this);
+
+ GotoIf(IsNoClosuresCellMap(cell_map), &no_closures);
+ GotoIf(IsOneClosureCellMap(cell_map), &one_closure);
+ CSA_ASSERT(this, IsManyClosuresCellMap(cell_map));
+ Goto(&cell_done);
+
+ Bind(&no_closures);
+ StoreMapNoWriteBarrier(literals_cell, Heap::kOneClosureCellMapRootIndex);
+ Goto(&cell_done);
+
+ Bind(&one_closure);
+ StoreMapNoWriteBarrier(literals_cell, Heap::kManyClosuresCellMapRootIndex);
+ Goto(&cell_done);
+
+ Bind(&cell_done);
+ }
StoreObjectFieldNoWriteBarrier(result, JSFunction::kFeedbackVectorOffset,
literals_cell);
StoreObjectFieldNoWriteBarrier(
« no previous file with comments | « no previous file | src/code-stub-assembler.h » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698