Chromium Code Reviews| Index: src/isolate.cc |
| diff --git a/src/isolate.cc b/src/isolate.cc |
| index 9ec3c9b2896b4bc294853e6cd82b929d55b51547..ca68e608778222511bd9f9eb9f7457f9e02b68a6 100644 |
| --- a/src/isolate.cc |
| +++ b/src/isolate.cc |
| @@ -793,8 +793,13 @@ Object* Isolate::StackOverflow() { |
| stackTraceLimit); |
| if (!stack_trace_limit->IsNumber()) return heap()->exception(); |
| double dlimit = stack_trace_limit->Number(); |
| - int limit = std::isnan(dlimit) ? 0 : static_cast<int>(dlimit); |
| - |
| + int limit; |
|
Yang
2014/06/18 12:07:39
Can we simply use FastD2IChecked here? Also, pleas
|
| + if (std::isnan(dlimit) || dlimit < 0) |
| + limit = 0; |
| + else if (dlimit > INT_MAX) |
| + limit = INT_MAX; |
| + else |
| + limit = static_cast<int>(dlimit); |
| Handle<JSArray> stack_trace = CaptureSimpleStackTrace( |
| exception, factory()->undefined_value(), limit); |
| JSObject::SetHiddenProperty(exception, |