File tree Expand file tree Collapse file tree 2 files changed +12
-0
lines changed
pkg/dev_compiler/lib/src/kernel Expand file tree Collapse file tree 2 files changed +12
-0
lines changed Original file line number Diff line number Diff line change @@ -927,6 +927,12 @@ class ProgramCompiler extends ComputeOnceConstantVisitor<js_ast.Expression>
927
927
_emitLibraryProcedures (library);
928
928
_emitTopLevelFields (library.fields);
929
929
}
930
+ // Creating a function and setting the library object as the prototype
931
+ // serves as a signal to V8 that the members of the library should get
932
+ // optimized for fast lookup.
933
+ // Do not remove without testing for performance regressions.
934
+ _moduleItems.add (js.statement (
935
+ '(function() {}).prototype = #' , [_libraries[_currentLibrary! ]]));
930
936
_staticTypeContext.leaveLibrary (_currentLibrary! );
931
937
_currentLibrary = null ;
932
938
}
Original file line number Diff line number Diff line change @@ -1163,6 +1163,12 @@ class LibraryCompiler extends ComputeOnceConstantVisitor<js_ast.Expression>
1163
1163
library.classes.forEach (_emitClass);
1164
1164
_emitLibraryMembers (library);
1165
1165
}
1166
+ // Creating a function and setting the library object as the prototype
1167
+ // serves as a signal to V8 that the members of the library should get
1168
+ // optimized for fast lookup.
1169
+ // Do not remove without testing for performance regressions.
1170
+ _moduleItems.add (js.statement (
1171
+ '(function() {}).prototype = #' , [_libraries[_currentLibrary! ]]));
1166
1172
_staticTypeContext.leaveLibrary (_currentLibrary! );
1167
1173
}
1168
1174
You can’t perform that action at this time.
0 commit comments