diff options
author | Ben Noordhuis <info@bnoordhuis.nl> | 2014-11-14 00:52:27 +0100 |
---|---|---|
committer | Ben Noordhuis <info@bnoordhuis.nl> | 2014-11-14 16:34:58 +0100 |
commit | 5d1b6d3e0fa4b97a490ef964be48aed9872e3ec1 (patch) | |
tree | ab5f510c4d83b175681de629395525bf7ec7cedb /deps/v8/src/contexts.cc | |
parent | 3b3d89bad26f5dfebe73fef6ae284ee78acbd5c9 (diff) | |
download | node-new-5d1b6d3e0fa4b97a490ef964be48aed9872e3ec1.tar.gz |
deps: upgrade v8 to 3.30.37
Diffstat (limited to 'deps/v8/src/contexts.cc')
-rw-r--r-- | deps/v8/src/contexts.cc | 20 |
1 files changed, 19 insertions, 1 deletions
diff --git a/deps/v8/src/contexts.cc b/deps/v8/src/contexts.cc index 30c474d5ff..537d92d0f4 100644 --- a/deps/v8/src/contexts.cc +++ b/deps/v8/src/contexts.cc @@ -122,13 +122,30 @@ Handle<Object> Context::Lookup(Handle<String> name, PrintF(")\n"); } + bool visited_global_context = false; + do { if (FLAG_trace_contexts) { PrintF(" - looking in context %p", reinterpret_cast<void*>(*context)); + if (context->IsGlobalContext()) PrintF(" (global context)"); if (context->IsNativeContext()) PrintF(" (native context)"); PrintF("\n"); } + if (follow_context_chain && FLAG_harmony_scoping && + !visited_global_context && + (context->IsGlobalContext() || context->IsNativeContext())) { + // For lexical scoping, on a top level, we might resolve to the + // lexical bindings introduced by later scrips. Therefore we need to + // switch to the the last added global context during lookup here. + context = Handle<Context>(context->global_object()->global_context()); + visited_global_context = true; + if (FLAG_trace_contexts) { + PrintF(" - switching to current global context %p\n", + reinterpret_cast<void*>(*context)); + } + } + // 1. Check global objects, subjects of with, and extension objects. if (context->IsNativeContext() || context->IsWithContext() || @@ -163,7 +180,8 @@ Handle<Object> Context::Lookup(Handle<String> name, } // 2. Check the context proper if it has slots. - if (context->IsFunctionContext() || context->IsBlockContext()) { + if (context->IsFunctionContext() || context->IsBlockContext() || + (FLAG_harmony_scoping && context->IsGlobalContext())) { // Use serialized scope information of functions and blocks to search // for the context index. Handle<ScopeInfo> scope_info; |