OLD | NEW |
---|---|
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...) Loading... | |
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 void Context::IncrementExceptionsThrown() { | |
593 if (!IsNativeContext()) return; | |
jochen (gone - plz use gerrit)
2015/10/29 14:37:07
just DCHECK(IsNativeContext())
Michael Hablich
2015/10/29 15:23:34
Done.
| |
594 if (exceptions_thrown()->IsUndefined()) { | |
jochen (gone - plz use gerrit)
2015/10/29 14:37:07
just initialize exceptions_thrown() to 0 in Factor
Michael Hablich
2015/10/29 15:23:34
Done.
| |
595 set_exceptions_thrown(Smi::FromInt(1)); | |
596 return; | |
597 } | |
598 | |
599 int previous_value = Smi::cast(exceptions_thrown())->value(); | |
600 set_exceptions_thrown(Smi::FromInt(previous_value+1)); | |
601 } | |
602 | |
603 | |
604 int Context::GetExceptionsThrown() { | |
605 // return -1 so we can identify stats by non-native contexts | |
606 if (!IsNativeContext()) return -1; | |
jochen (gone - plz use gerrit)
2015/10/29 14:37:07
should never happen
Michael Hablich
2015/10/29 15:23:34
Done.
| |
607 if (exceptions_thrown()->IsUndefined()) { | |
608 return 0; | |
609 } | |
610 | |
611 return Smi::cast(exceptions_thrown())->value(); | |
612 } | |
613 | |
592 } // namespace internal | 614 } // namespace internal |
593 } // namespace v8 | 615 } // namespace v8 |
OLD | NEW |