Index: src/accessors.cc |
diff --git a/src/accessors.cc b/src/accessors.cc |
index da44151b3edbdd6d4b517e14936aacc83bd0b6fc..8d7fac5d3cd279a9f87bada7e33a6a520851ee1d 100644 |
--- a/src/accessors.cc |
+++ b/src/accessors.cc |
@@ -737,7 +737,12 @@ void Accessors::FunctionLengthGetter( |
Handle<JSFunction> function = |
Handle<JSFunction>::cast(Utils::OpenHandle(*info.Holder())); |
Handle<Object> result; |
- if (!JSFunction::GetLength(isolate, function).ToHandle(&result)) { |
+ // This may invoke the compiler, so check for stack overflow like other |
+ // compiler entrypoints, and return 0 on failure (as on an exception). |
+ StackLimitCheck check(isolate); |
+ if (check.JsHasOverflowed(1 * KB)) { |
+ result = handle(Smi::FromInt(0), isolate); |
caitp
2016/08/12 01:57:10
thinking about this, we only want to return 0 if c
Dan Ehrenberg
2016/08/12 02:20:47
I backed out this change in the most recent versio
|
+ } else if (!JSFunction::GetLength(isolate, function).ToHandle(&result)) { |
result = handle(Smi::FromInt(0), isolate); |
isolate->OptionalRescheduleException(false); |
} |