| Index: src/factory.cc
|
| diff --git a/src/factory.cc b/src/factory.cc
|
| index 2a03050b6de7af839c8ccd8719b3030ec55e3b25..673bb23031733ad2c5acde104e94a256b5a9ea70 100644
|
| --- a/src/factory.cc
|
| +++ b/src/factory.cc
|
| @@ -434,27 +434,17 @@ Handle<ExecutableAccessorInfo> Factory::NewExecutableAccessorInfo() {
|
|
|
| Handle<Script> Factory::NewScript(Handle<String> source) {
|
| // Generate id for this script.
|
| - int id;
|
| Heap* heap = isolate()->heap();
|
| - if (heap->last_script_id()->IsUndefined()) {
|
| - // Script ids start from one.
|
| - id = 1;
|
| - } else {
|
| - // Increment id, wrap when positive smi is exhausted.
|
| - id = Smi::cast(heap->last_script_id())->value();
|
| - id++;
|
| - if (!Smi::IsValid(id)) {
|
| - id = 0;
|
| - }
|
| - }
|
| - heap->SetLastScriptId(Smi::FromInt(id));
|
| + 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.
|
| Handle<Foreign> wrapper = NewForeign(0, TENURED);
|
| Handle<Script> script = Handle<Script>::cast(NewStruct(SCRIPT_TYPE));
|
| script->set_source(*source);
|
| script->set_name(heap->undefined_value());
|
| - script->set_id(heap->last_script_id());
|
| + script->set_id(Smi::FromInt(id));
|
| script->set_line_offset(Smi::FromInt(0));
|
| script->set_column_offset(Smi::FromInt(0));
|
| script->set_data(heap->undefined_value());
|
|
|