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()); |