Don't overwrite existing serial numbers on the function template, otherwise instantiating the function for a new context causes the serial number to bump.

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

Cr-Commit-Position: refs/heads/master@{#27048}
This commit is contained in:
verwaest 2015-03-06 07:25:51 -08:00 committed by Commit bot
parent 206303f703
commit 1e638c3610

View File

@ -943,7 +943,7 @@ static Local<FunctionTemplate> FunctionTemplateNew(
InitializeFunctionTemplate(obj);
obj->set_do_not_cache(do_not_cache);
int next_serial_number = 0;
if (!do_not_cache) {
if (!do_not_cache && !obj->serial_number()->IsSmi()) {
next_serial_number = isolate->next_serial_number() + 1;
isolate->set_next_serial_number(next_serial_number);
}