Browse Source

Remove invalid debug optimization for loading 'this'

Taylor Woll 8 years ago
parent
commit
13a0220fb7
1 changed files with 11 additions and 27 deletions
  1. 11 27
      lib/Runtime/Debug/DiagStackFrame.cpp

+ 11 - 27
lib/Runtime/Debug/DiagStackFrame.cpp

@@ -165,37 +165,21 @@ namespace Js
         Assert(pOutResolvedObj);
 
         Js::ScriptContext* scriptContext = this->GetScriptContext();
-        Js::JavascriptFunction* scopeFunction = this->GetJavascriptFunction();
-
-        // Do fast path for 'this', fields on slot, TODO : literals (integer,string)
 
-        if (sourceLength == 4 && wcsncmp(source, _u("this"), 4) == 0)
+        Js::PropertyRecord const * propRecord;
+        scriptContext->FindPropertyRecord(source, sourceLength, &propRecord);
+        if (propRecord != nullptr)
         {
-            pOutResolvedObj->obj = this->GetThisFromFrame(&pOutResolvedObj->address);
-            if (pOutResolvedObj->obj == nullptr)
-            {
-                // TODO: Throw exception; this was not captured by the lambda
-                Assert(scopeFunction->IsLambda());
-                Assert(!scopeFunction->GetParseableFunctionInfo()->GetCapturesThis());
-            }
-        }
-        else
-        {
-            Js::PropertyRecord const * propRecord;
-            scriptContext->FindPropertyRecord(source, sourceLength, &propRecord);
-            if (propRecord != nullptr)
-            {
-                ArenaAllocator *arena = scriptContext->GetThreadContext()->GetDebugManager()->GetDiagnosticArena()->Arena();
+            ArenaAllocator *arena = scriptContext->GetThreadContext()->GetDebugManager()->GetDiagnosticArena()->Arena();
 
-                Js::IDiagObjectModelWalkerBase * localsWalker = Anew(arena, Js::LocalsWalker, this, Js::FrameWalkerFlags::FW_EnumWithScopeAlso);
+            Js::IDiagObjectModelWalkerBase * localsWalker = Anew(arena, Js::LocalsWalker, this, Js::FrameWalkerFlags::FW_EnumWithScopeAlso);
 
-                bool isConst = false;
-                pOutResolvedObj->address = localsWalker->FindPropertyAddress(propRecord->GetPropertyId(), isConst);
-                if (pOutResolvedObj->address != nullptr)
-                {
-                    pOutResolvedObj->obj = pOutResolvedObj->address->GetValue(FALSE);
-                    pOutResolvedObj->isConst = isConst;
-                }
+            bool isConst = false;
+            pOutResolvedObj->address = localsWalker->FindPropertyAddress(propRecord->GetPropertyId(), isConst);
+            if (pOutResolvedObj->address != nullptr)
+            {
+                pOutResolvedObj->obj = pOutResolvedObj->address->GetValue(FALSE);
+                pOutResolvedObj->isConst = isConst;
             }
         }