| Index: src/isolate.cc
 | 
| diff --git a/src/isolate.cc b/src/isolate.cc
 | 
| index 632ecdc50a32b569ba3224c9428a165ef10deccb..15a99dd2bf5f55569a0b9ab196bb4039ff43d009 100644
 | 
| --- a/src/isolate.cc
 | 
| +++ b/src/isolate.cc
 | 
| @@ -617,8 +617,11 @@ Handle<JSArray> Isolate::CaptureSimpleStackTrace(Handle<JSObject> error_object,
 | 
|    // If the caller parameter is a function we skip frames until we're
 | 
|    // under it before starting to collect.
 | 
|    bool seen_caller = !caller->IsJSFunction();
 | 
| -  int cursor = 0;
 | 
| +  // First element is reserved to store the number of non-strict frames.
 | 
| +  int cursor = 1;
 | 
|    int frames_seen = 0;
 | 
| +  int non_strict_frames = 0;
 | 
| +  bool encountered_strict_function = false;
 | 
|    for (StackFrameIterator iter(this);
 | 
|         !iter.done() && frames_seen < limit;
 | 
|         iter.Advance()) {
 | 
| @@ -646,6 +649,17 @@ Handle<JSArray> Isolate::CaptureSimpleStackTrace(Handle<JSObject> error_object,
 | 
|          Handle<JSFunction> fun = frames[i].function();
 | 
|          Handle<Code> code = frames[i].code();
 | 
|          Handle<Smi> offset(Smi::FromInt(frames[i].offset()), this);
 | 
| +        // The stack trace API should not expose receivers and function
 | 
| +        // objects on frames deeper than the top-most one with a strict
 | 
| +        // mode function.  The number of non-strict frames is stored as
 | 
| +        // first element in the result array.
 | 
| +        if (!encountered_strict_function) {
 | 
| +          if (!fun->shared()->is_classic_mode()) {
 | 
| +            encountered_strict_function = true;
 | 
| +          } else {
 | 
| +            non_strict_frames++;
 | 
| +          }
 | 
| +        }
 | 
|          elements->set(cursor++, *recv);
 | 
|          elements->set(cursor++, *fun);
 | 
|          elements->set(cursor++, *code);
 | 
| @@ -653,6 +667,7 @@ Handle<JSArray> Isolate::CaptureSimpleStackTrace(Handle<JSObject> error_object,
 | 
|        }
 | 
|      }
 | 
|    }
 | 
| +  elements->set(0, Smi::FromInt(non_strict_frames));
 | 
|    Handle<JSArray> result = factory()->NewJSArrayWithElements(elements);
 | 
|    result->set_length(Smi::FromInt(cursor));
 | 
|    return result;
 | 
| 
 |