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

Side by Side Diff: src/contexts.cc

Issue 1413503007: Provide a counter for thrown JavaScript errors per context (Closed) Base URL: https://chromium.googlesource.com/v8/v8.git@master
Patch Set: Moved counting from creation to throwing again Created 5 years, 1 month 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
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/bootstrapper.h" 7 #include "src/bootstrapper.h"
8 #include "src/debug/debug.h" 8 #include "src/debug/debug.h"
9 #include "src/isolate-inl.h" 9 #include "src/isolate-inl.h"
10 #include "src/scopeinfo.h" 10 #include "src/scopeinfo.h"
(...skipping 571 matching lines...) Expand 10 before | Expand all | Expand 10 after
582 582
583 bool Context::IsBootstrappingOrGlobalObject(Isolate* isolate, Object* object) { 583 bool Context::IsBootstrappingOrGlobalObject(Isolate* isolate, Object* object) {
584 // During bootstrapping we allow all objects to pass as global 584 // During bootstrapping we allow all objects to pass as global
585 // objects. This is necessary to fix circular dependencies. 585 // objects. This is necessary to fix circular dependencies.
586 return isolate->heap()->gc_state() != Heap::NOT_IN_GC || 586 return isolate->heap()->gc_state() != Heap::NOT_IN_GC ||
587 isolate->bootstrapper()->IsActive() || 587 isolate->bootstrapper()->IsActive() ||
588 object->IsGlobalObject(); 588 object->IsGlobalObject();
589 } 589 }
590 #endif 590 #endif
591 591
592
593 void Context::IncrementErrorsThrown() {
594 DCHECK(IsNativeContext());
595
596 int previous_value = Smi::cast(errors_thrown())->value();
Yang 2015/11/02 05:48:57 this cast would be unnecessary if the type of this
Michael Hablich 2015/11/04 10:58:07 Done.
597 set_errors_thrown(Smi::FromInt(previous_value+1));
598 }
599
600
601 int Context::GetErrorsThrown() {
602 return Smi::cast(errors_thrown())->value();
603 }
604
592 } // namespace internal 605 } // namespace internal
593 } // namespace v8 606 } // namespace v8
OLDNEW

Powered by Google App Engine
This is Rietveld 408576698