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

Unified Diff: src/factory.cc

Issue 1035523005: Serializer: ensure unique script ids when deserializing. (Closed) Base URL: https://chromium.googlesource.com/v8/v8.git@master
Patch Set: fix test Created 5 years, 9 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/heap/heap.h » ('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 5dac6a1ada3454980e348caf6a76b8268d51ee0d..3b3d0d29eadf6ccfd79555e5aa0e1ca269749533 100644
--- a/src/factory.cc
+++ b/src/factory.cc
@@ -825,17 +825,12 @@ Handle<ExecutableAccessorInfo> Factory::NewExecutableAccessorInfo() {
Handle<Script> Factory::NewScript(Handle<String> source) {
- // Generate id for this script.
- Heap* heap = isolate()->heap();
- int id = heap->last_script_id()->value() + 1;
- if (!Smi::IsValid(id) || id < 0) id = 1;
- heap->set_last_script_id(Smi::FromInt(id));
-
// Create and initialize script object.
+ Heap* heap = isolate()->heap();
Handle<Script> script = Handle<Script>::cast(NewStruct(SCRIPT_TYPE));
script->set_source(*source);
script->set_name(heap->undefined_value());
- script->set_id(Smi::FromInt(id));
+ script->set_id(isolate()->heap()->NextScriptId());
script->set_line_offset(Smi::FromInt(0));
script->set_column_offset(Smi::FromInt(0));
script->set_context_data(heap->undefined_value());
« no previous file with comments | « no previous file | src/heap/heap.h » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698