diff options
author | Michaël Zasso <targos@protonmail.com> | 2018-07-25 19:30:07 +0200 |
---|---|---|
committer | Michaël Zasso <targos@protonmail.com> | 2018-07-26 08:31:50 +0200 |
commit | 6a31d05340b22fc413ee83eaacd0a5565bbbe799 (patch) | |
tree | 78f9e1c2f417244842f6422f17e1816e70317100 /deps/v8/src/contexts.cc | |
parent | 4d94bb2b1f72b6b612983a517a39c5545724a3ad (diff) | |
download | android-node-v8-6a31d05340b22fc413ee83eaacd0a5565bbbe799.tar.gz android-node-v8-6a31d05340b22fc413ee83eaacd0a5565bbbe799.tar.bz2 android-node-v8-6a31d05340b22fc413ee83eaacd0a5565bbbe799.zip |
deps: update V8 to 6.8.275.24
PR-URL: https://github.com/nodejs/node/pull/21079
Reviewed-By: James M Snell <jasnell@gmail.com>
Reviewed-By: Matteo Collina <matteo.collina@gmail.com>
Reviewed-By: Colin Ihrig <cjihrig@gmail.com>
Reviewed-By: Yang Guo <yangguo@chromium.org>
Diffstat (limited to 'deps/v8/src/contexts.cc')
-rw-r--r-- | deps/v8/src/contexts.cc | 71 |
1 files changed, 15 insertions, 56 deletions
diff --git a/deps/v8/src/contexts.cc b/deps/v8/src/contexts.cc index 04c4b4899d..2d2ff2d2ce 100644 --- a/deps/v8/src/contexts.cc +++ b/deps/v8/src/contexts.cc @@ -62,14 +62,11 @@ bool Context::is_declaration_context() { IsModuleContext()) { return true; } - if (IsEvalContext()) - return closure()->shared()->language_mode() == LanguageMode::kStrict; + if (IsEvalContext()) { + return scope_info()->language_mode() == LanguageMode::kStrict; + } if (!IsBlockContext()) return false; - Object* ext = extension(); - // If we have the special extension, we immediately know it must be a - // declaration scope. That's just a small performance shortcut. - return ext->IsContextExtension() || - ScopeInfo::cast(ext)->is_declaration_scope(); + return scope_info()->is_declaration_scope(); } @@ -87,20 +84,15 @@ Context* Context::closure_context() { !current->IsModuleContext() && !current->IsNativeContext() && !current->IsEvalContext()) { current = current->previous(); - DCHECK(current->closure() == closure()); } return current; } JSObject* Context::extension_object() { DCHECK(IsNativeContext() || IsFunctionContext() || IsBlockContext() || - IsEvalContext()); + IsEvalContext() || IsCatchContext()); HeapObject* object = extension(); if (object->IsTheHole(GetIsolate())) return nullptr; - if (IsBlockContext()) { - if (!object->IsContextExtension()) return nullptr; - object = JSObject::cast(ContextExtension::cast(object)->extension()); - } DCHECK(object->IsJSContextExtensionObject() || (IsNativeContext() && object->IsJSGlobalObject())); return JSObject::cast(object); @@ -109,23 +101,11 @@ JSObject* Context::extension_object() { JSReceiver* Context::extension_receiver() { DCHECK(IsNativeContext() || IsWithContext() || IsEvalContext() || IsFunctionContext() || IsBlockContext()); - return IsWithContext() ? JSReceiver::cast( - ContextExtension::cast(extension())->extension()) - : extension_object(); + return IsWithContext() ? JSReceiver::cast(extension()) : extension_object(); } ScopeInfo* Context::scope_info() { - DCHECK(!IsNativeContext()); - if (IsFunctionContext() || IsModuleContext() || IsEvalContext()) { - return closure()->shared()->scope_info(); - } - HeapObject* object = extension(); - if (object->IsContextExtension()) { - DCHECK(IsBlockContext() || IsCatchContext() || IsWithContext() || - IsDebugEvaluateContext()); - object = ContextExtension::cast(object)->scope_info(); - } - return ScopeInfo::cast(object); + return ScopeInfo::cast(get(SCOPE_INFO_INDEX)); } Module* Context::module() { @@ -136,12 +116,6 @@ Module* Context::module() { return Module::cast(current->extension()); } -String* Context::catch_name() { - DCHECK(IsCatchContext()); - return String::cast(ContextExtension::cast(extension())->extension()); -} - - JSGlobalObject* Context::global_object() { return JSGlobalObject::cast(native_context()->extension()); } @@ -311,7 +285,7 @@ Handle<Object> Context::Lookup(Handle<String> name, ContextLookupFlags flags, // 2. Check the context proper if it has slots. if (context->IsFunctionContext() || context->IsBlockContext() || context->IsScriptContext() || context->IsEvalContext() || - context->IsModuleContext()) { + context->IsModuleContext() || context->IsCatchContext()) { // Use serialized scope information of functions and blocks to search // for the context index. Handle<ScopeInfo> scope_info(context->scope_info()); @@ -377,31 +351,16 @@ Handle<Object> Context::Lookup(Handle<String> name, ContextLookupFlags flags, return handle(context->module(), isolate); } } - } else if (context->IsCatchContext()) { - // Catch contexts have the variable name in the extension slot. - if (String::Equals(name, handle(context->catch_name()))) { - if (FLAG_trace_contexts) { - PrintF("=> found in catch context\n"); - } - *index = Context::THROWN_OBJECT_INDEX; - *attributes = NONE; - *init_flag = kCreatedInitialized; - *variable_mode = VAR; - return context; - } } else if (context->IsDebugEvaluateContext()) { // Check materialized locals. Object* ext = context->get(EXTENSION_INDEX); - if (ext->IsContextExtension()) { - Object* obj = ContextExtension::cast(ext)->extension(); - if (obj->IsJSReceiver()) { - Handle<JSReceiver> extension(JSReceiver::cast(obj)); - LookupIterator it(extension, name, extension); - Maybe<bool> found = JSReceiver::HasProperty(&it); - if (found.FromMaybe(false)) { - *attributes = NONE; - return extension; - } + if (ext->IsJSReceiver()) { + Handle<JSReceiver> extension(JSReceiver::cast(ext)); + LookupIterator it(extension, name, extension); + Maybe<bool> found = JSReceiver::HasProperty(&it); + if (found.FromMaybe(false)) { + *attributes = NONE; + return extension; } } // Check the original context, but do not follow its context chain. |