| Index: src/runtime.cc
|
| ===================================================================
|
| --- src/runtime.cc (revision 1201)
|
| +++ src/runtime.cc (working copy)
|
| @@ -4061,7 +4061,9 @@
|
| while (!context.is_null()) {
|
| receiver = context->Lookup(Factory::eval_symbol(), FOLLOW_PROTOTYPE_CHAIN,
|
| &index, &attributes);
|
| - if (attributes != ABSENT) break;
|
| + // Stop search when eval is found or when the global context is
|
| + // reached.
|
| + if (attributes != ABSENT || context->IsGlobalContext()) break;
|
| if (context->is_function_context()) {
|
| context = Handle<Context>(Context::cast(context->closure()->context()));
|
| } else {
|
| @@ -4069,6 +4071,15 @@
|
| }
|
| }
|
|
|
| + // If eval could not be resolved, it has been deleted and we need to
|
| + // throw a reference error.
|
| + if (attributes == ABSENT) {
|
| + Handle<Object> name = Factory::eval_symbol();
|
| + Handle<Object> reference_error =
|
| + Factory::NewReferenceError("not_defined", HandleVector(&name, 1));
|
| + return Top::Throw(*reference_error);
|
| + }
|
| +
|
| if (context->IsGlobalContext()) {
|
| // 'eval' is bound in the global context, but it may have been overwritten.
|
| // Compare it to the builtin 'GlobalEval' function to make sure.
|
|
|