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

Unified Diff: src/factory.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 | « src/factory.h ('k') | src/feedback-vector.cc » ('j') | no next file with comments »
Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
Index: src/factory.cc
diff --git a/src/factory.cc b/src/factory.cc
index 24f3a0ada74d549b4e368fd8328bb63366cc41c1..1c38193a5634f7fcbb3af1b405540b87649d5d66 100644
--- a/src/factory.cc
+++ b/src/factory.cc
@@ -1173,6 +1173,24 @@ Handle<Cell> Factory::NewCell(Handle<Object> value) {
Cell);
}
+Handle<Cell> Factory::NewNoClosuresCell(Handle<Object> value) {
+ Handle<Cell> cell = NewCell(value);
+ cell->set_map_no_write_barrier(*no_closures_cell_map());
+ return cell;
+}
+
+Handle<Cell> Factory::NewOneClosureCell(Handle<Object> value) {
+ Handle<Cell> cell = NewCell(value);
+ cell->set_map_no_write_barrier(*one_closure_cell_map());
+ return cell;
+}
+
+Handle<Cell> Factory::NewManyClosuresCell(Handle<Object> value) {
+ Handle<Cell> cell = NewCell(value);
+ cell->set_map_no_write_barrier(*many_closures_cell_map());
+ return cell;
+}
+
Handle<PropertyCell> Factory::NewPropertyCell() {
CALL_HEAP_FUNCTION(
isolate(),
@@ -1590,6 +1608,15 @@ Handle<JSFunction> Factory::NewFunctionFromSharedFunctionInfo(
Handle<JSFunction> result =
NewFunction(initial_map, info, context_or_undefined, pretenure);
+ // Bump the closure count that is encoded in the vector cell's map.
+ if (vector->map() == *no_closures_cell_map()) {
+ vector->set_map(*one_closure_cell_map());
+ } else if (vector->map() == *one_closure_cell_map()) {
+ vector->set_map(*many_closures_cell_map());
+ } else {
+ DCHECK_EQ(vector->map(), *many_closures_cell_map());
+ }
+
result->set_feedback_vector_cell(*vector);
if (info->ic_age() != isolate()->heap()->global_ic_age()) {
info->ResetForNewContext(isolate()->heap()->global_ic_age());
« no previous file with comments | « src/factory.h ('k') | src/feedback-vector.cc » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698