Index: src/heap/heap-inl.h |
diff --git a/src/heap/heap-inl.h b/src/heap/heap-inl.h |
index 6f7c060d70c9e53f41fd9802f21389920d2aec2b..aa087a9e1f03017a02db4c297636c0b9a6667d43 100644 |
--- a/src/heap/heap-inl.h |
+++ b/src/heap/heap-inl.h |
@@ -684,12 +684,15 @@ uint32_t Heap::HashSeed() { |
} |
-Smi* Heap::NextScriptId() { |
- int next_id = last_script_id()->value() + 1; |
- if (!Smi::IsValid(next_id) || next_id < 0) next_id = 1; |
- Smi* next_id_smi = Smi::FromInt(next_id); |
- set_last_script_id(next_id_smi); |
- return next_id_smi; |
+int Heap::NextScriptId() { |
+ int last_id = last_script_id()->value(); |
+ if (last_id == Smi::kMaxValue) { |
+ last_id = 1; |
+ } else { |
+ last_id++; |
+ } |
+ set_last_script_id(Smi::FromInt(last_id)); |
+ return last_id; |
} |