Chromium Code Reviews
chromiumcodereview-hr@appspot.gserviceaccount.com (chromiumcodereview-hr) | Please choose your nickname with Settings | Help | Chromium Project | Gerrit Changes | Sign out
(176)

Side by Side Diff: src/contexts.cc

Issue 1856203002: [V8] Added DebugEvaluateContext to DCHECKs in contexts.cc (Closed) Base URL: https://chromium.googlesource.com/v8/v8.git@master
Patch Set: Created 4 years, 8 months ago
Use n/p to move between diff chunks; N/P to move between comments. Draft comments are only viewable by you.
Jump to:
View unified diff | Download patch
« no previous file with comments | « no previous file | no next file » | no next file with comments »
Toggle Intra-line Diffs ('i') | Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
OLDNEW
1 // Copyright 2011 the V8 project authors. All rights reserved. 1 // Copyright 2011 the V8 project authors. All rights reserved.
2 // Use of this source code is governed by a BSD-style license that can be 2 // Use of this source code is governed by a BSD-style license that can be
3 // found in the LICENSE file. 3 // found in the LICENSE file.
4 4
5 #include "src/contexts.h" 5 #include "src/contexts.h"
6 6
7 #include "src/ast/scopeinfo.h" 7 #include "src/ast/scopeinfo.h"
8 #include "src/bootstrapper.h" 8 #include "src/bootstrapper.h"
9 #include "src/debug/debug.h" 9 #include "src/debug/debug.h"
10 #include "src/isolate-inl.h" 10 #include "src/isolate-inl.h"
(...skipping 72 matching lines...) Expand 10 before | Expand all | Expand 10 after
83 Context* current = this; 83 Context* current = this;
84 while (!current->IsFunctionContext() && !current->IsScriptContext() && 84 while (!current->IsFunctionContext() && !current->IsScriptContext() &&
85 !current->IsNativeContext()) { 85 !current->IsNativeContext()) {
86 current = current->previous(); 86 current = current->previous();
87 DCHECK(current->closure() == closure()); 87 DCHECK(current->closure() == closure());
88 } 88 }
89 return current; 89 return current;
90 } 90 }
91 91
92 JSObject* Context::extension_object() { 92 JSObject* Context::extension_object() {
93 DCHECK(IsNativeContext() || IsFunctionContext() || IsBlockContext()); 93 DCHECK(IsNativeContext() || IsFunctionContext() || IsBlockContext() ||
94 IsDebugEvaluateContext());
Yang 2016/04/05 08:28:01 I don't think this can happen. We don't even expec
94 HeapObject* object = extension(); 95 HeapObject* object = extension();
95 if (object->IsTheHole()) return nullptr; 96 if (object->IsTheHole()) return nullptr;
96 if (IsBlockContext()) { 97 if (IsBlockContext()) {
97 if (!object->IsSloppyBlockWithEvalContextExtension()) return nullptr; 98 if (!object->IsSloppyBlockWithEvalContextExtension()) return nullptr;
98 object = SloppyBlockWithEvalContextExtension::cast(object)->extension(); 99 object = SloppyBlockWithEvalContextExtension::cast(object)->extension();
99 } 100 }
100 DCHECK(object->IsJSContextExtensionObject() || 101 DCHECK(object->IsJSContextExtensionObject() || IsDebugEvaluateContext() ||
101 (IsNativeContext() && object->IsJSGlobalObject())); 102 (IsNativeContext() && object->IsJSGlobalObject()));
102 return JSObject::cast(object); 103 return JSObject::cast(object);
103 } 104 }
104 105
105 106
106 JSReceiver* Context::extension_receiver() { 107 JSReceiver* Context::extension_receiver() {
107 DCHECK(IsNativeContext() || IsWithContext() || 108 DCHECK(IsNativeContext() || IsWithContext() || IsFunctionContext() ||
108 IsFunctionContext() || IsBlockContext()); 109 IsBlockContext() || IsDebugEvaluateContext());
Yang 2016/04/05 08:28:01 This should not happen. The only place I can see t
109 return IsWithContext() ? JSReceiver::cast(extension()) : extension_object(); 110 return IsWithContext() ? JSReceiver::cast(extension()) : extension_object();
110 } 111 }
111 112
112 113
113 ScopeInfo* Context::scope_info() { 114 ScopeInfo* Context::scope_info() {
114 DCHECK(IsModuleContext() || IsScriptContext() || IsBlockContext()); 115 DCHECK(IsModuleContext() || IsScriptContext() || IsBlockContext());
115 HeapObject* object = extension(); 116 HeapObject* object = extension();
116 if (object->IsSloppyBlockWithEvalContextExtension()) { 117 if (object->IsSloppyBlockWithEvalContextExtension()) {
117 DCHECK(IsBlockContext()); 118 DCHECK(IsBlockContext());
118 object = SloppyBlockWithEvalContextExtension::cast(object)->scope_info(); 119 object = SloppyBlockWithEvalContextExtension::cast(object)->scope_info();
(...skipping 463 matching lines...) Expand 10 before | Expand all | Expand 10 after
582 583
583 int previous_value = errors_thrown()->value(); 584 int previous_value = errors_thrown()->value();
584 set_errors_thrown(Smi::FromInt(previous_value + 1)); 585 set_errors_thrown(Smi::FromInt(previous_value + 1));
585 } 586 }
586 587
587 588
588 int Context::GetErrorsThrown() { return errors_thrown()->value(); } 589 int Context::GetErrorsThrown() { return errors_thrown()->value(); }
589 590
590 } // namespace internal 591 } // namespace internal
591 } // namespace v8 592 } // namespace v8
OLDNEW
« no previous file with comments | « no previous file | no next file » | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698