| Index: src/contexts.cc
|
| diff --git a/src/contexts.cc b/src/contexts.cc
|
| index 4cc6222939962928a43600c062a37b240c1d0056..d066d347692931b887a1f767828293a0c2ab5d19 100644
|
| --- a/src/contexts.cc
|
| +++ b/src/contexts.cc
|
| @@ -34,6 +34,16 @@
|
| namespace v8 {
|
| namespace internal {
|
|
|
| +Context* Context::declaration_context() {
|
| + Context* current = this;
|
| + while (!current->IsFunctionContext() && !current->IsGlobalContext()) {
|
| + current = current->previous();
|
| + ASSERT(current->closure() == closure());
|
| + }
|
| + return current;
|
| +}
|
| +
|
| +
|
| JSBuiltinsObject* Context::builtins() {
|
| GlobalObject* object = global();
|
| if (object->IsJSGlobalObject()) {
|
| @@ -246,20 +256,22 @@ void Context::ComputeEvalScopeInfo(bool* outer_scope_calls_eval,
|
| bool* outer_scope_calls_non_strict_eval) {
|
| // Skip up the context chain checking all the function contexts to see
|
| // whether they call eval.
|
| - Context* context = fcontext();
|
| + Context* context = this;
|
| while (!context->IsGlobalContext()) {
|
| - Handle<SerializedScopeInfo> scope_info(
|
| - context->closure()->shared()->scope_info());
|
| - if (scope_info->CallsEval()) {
|
| - *outer_scope_calls_eval = true;
|
| - if (!scope_info->IsStrictMode()) {
|
| - // No need to go further since the answers will not change
|
| - // from here.
|
| - *outer_scope_calls_non_strict_eval = true;
|
| - return;
|
| + if (context->IsFunctionContext()) {
|
| + Handle<SerializedScopeInfo> scope_info(
|
| + context->closure()->shared()->scope_info());
|
| + if (scope_info->CallsEval()) {
|
| + *outer_scope_calls_eval = true;
|
| + if (!scope_info->IsStrictMode()) {
|
| + // No need to go further since the answers will not change from
|
| + // here.
|
| + *outer_scope_calls_non_strict_eval = true;
|
| + return;
|
| + }
|
| }
|
| }
|
| - context = context->previous()->fcontext();
|
| + context = context->previous();
|
| }
|
| }
|
|
|
|
|