OLD | NEW |
1 // Copyright 2012 the V8 project authors. All rights reserved. | 1 // Copyright 2012 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 #ifndef V8_API_H_ | 5 #ifndef V8_API_H_ |
6 #define V8_API_H_ | 6 #define V8_API_H_ |
7 | 7 |
8 #include "include/v8-testing.h" | 8 #include "include/v8-testing.h" |
9 #include "src/contexts.h" | 9 #include "src/contexts.h" |
10 #include "src/factory.h" | 10 #include "src/factory.h" |
(...skipping 436 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
447 public: | 447 public: |
448 explicit HandleScopeImplementer(Isolate* isolate) | 448 explicit HandleScopeImplementer(Isolate* isolate) |
449 : isolate_(isolate), | 449 : isolate_(isolate), |
450 blocks_(0), | 450 blocks_(0), |
451 entered_contexts_(0), | 451 entered_contexts_(0), |
452 saved_contexts_(0), | 452 saved_contexts_(0), |
453 spare_(NULL), | 453 spare_(NULL), |
454 call_depth_(0), | 454 call_depth_(0), |
455 microtasks_depth_(0), | 455 microtasks_depth_(0), |
456 microtasks_suppressions_(0), | 456 microtasks_suppressions_(0), |
457 #ifdef V8_ENABLE_CHECKS | 457 #ifdef DEBUG |
458 debug_microtasks_depth_(0), | 458 debug_microtasks_depth_(0), |
459 #endif | 459 #endif |
460 microtasks_policy_(v8::MicrotasksPolicy::kAuto), | 460 microtasks_policy_(v8::MicrotasksPolicy::kAuto), |
461 last_handle_before_deferred_block_(NULL) { } | 461 last_handle_before_deferred_block_(NULL) { } |
462 | 462 |
463 ~HandleScopeImplementer() { | 463 ~HandleScopeImplementer() { |
464 DeleteArray(spare_); | 464 DeleteArray(spare_); |
465 } | 465 } |
466 | 466 |
467 // Threading support for handle data. | 467 // Threading support for handle data. |
(...skipping 20 matching lines...) Expand all Loading... |
488 inline void IncrementMicrotasksScopeDepth() {microtasks_depth_++;} | 488 inline void IncrementMicrotasksScopeDepth() {microtasks_depth_++;} |
489 inline void DecrementMicrotasksScopeDepth() {microtasks_depth_--;} | 489 inline void DecrementMicrotasksScopeDepth() {microtasks_depth_--;} |
490 inline int GetMicrotasksScopeDepth() { return microtasks_depth_; } | 490 inline int GetMicrotasksScopeDepth() { return microtasks_depth_; } |
491 | 491 |
492 // Possibly nested microtasks suppression scopes prevent microtasks | 492 // Possibly nested microtasks suppression scopes prevent microtasks |
493 // from running. | 493 // from running. |
494 inline void IncrementMicrotasksSuppressions() {microtasks_suppressions_++;} | 494 inline void IncrementMicrotasksSuppressions() {microtasks_suppressions_++;} |
495 inline void DecrementMicrotasksSuppressions() {microtasks_suppressions_--;} | 495 inline void DecrementMicrotasksSuppressions() {microtasks_suppressions_--;} |
496 inline bool HasMicrotasksSuppressions() { return !!microtasks_suppressions_; } | 496 inline bool HasMicrotasksSuppressions() { return !!microtasks_suppressions_; } |
497 | 497 |
498 #ifdef V8_ENABLE_CHECKS | 498 #ifdef DEBUG |
499 // In debug we check that calls not intended to invoke microtasks are | 499 // In debug we check that calls not intended to invoke microtasks are |
500 // still correctly wrapped with microtask scopes. | 500 // still correctly wrapped with microtask scopes. |
501 inline void IncrementDebugMicrotasksScopeDepth() {debug_microtasks_depth_++;} | 501 inline void IncrementDebugMicrotasksScopeDepth() {debug_microtasks_depth_++;} |
502 inline void DecrementDebugMicrotasksScopeDepth() {debug_microtasks_depth_--;} | 502 inline void DecrementDebugMicrotasksScopeDepth() {debug_microtasks_depth_--;} |
503 inline bool DebugMicrotasksScopeDepthIsZero() { | 503 inline bool DebugMicrotasksScopeDepthIsZero() { |
504 return debug_microtasks_depth_ == 0; | 504 return debug_microtasks_depth_ == 0; |
505 } | 505 } |
506 #endif | 506 #endif |
507 | 507 |
508 inline void set_microtasks_policy(v8::MicrotasksPolicy policy); | 508 inline void set_microtasks_policy(v8::MicrotasksPolicy policy); |
(...skipping 50 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
559 Isolate* isolate_; | 559 Isolate* isolate_; |
560 List<internal::Object**> blocks_; | 560 List<internal::Object**> blocks_; |
561 // Used as a stack to keep track of entered contexts. | 561 // Used as a stack to keep track of entered contexts. |
562 List<Context*> entered_contexts_; | 562 List<Context*> entered_contexts_; |
563 // Used as a stack to keep track of saved contexts. | 563 // Used as a stack to keep track of saved contexts. |
564 List<Context*> saved_contexts_; | 564 List<Context*> saved_contexts_; |
565 Object** spare_; | 565 Object** spare_; |
566 int call_depth_; | 566 int call_depth_; |
567 int microtasks_depth_; | 567 int microtasks_depth_; |
568 int microtasks_suppressions_; | 568 int microtasks_suppressions_; |
569 #ifdef V8_ENABLE_CHECKS | 569 #ifdef DEBUG |
570 int debug_microtasks_depth_; | 570 int debug_microtasks_depth_; |
571 #endif | 571 #endif |
572 v8::MicrotasksPolicy microtasks_policy_; | 572 v8::MicrotasksPolicy microtasks_policy_; |
573 Object** last_handle_before_deferred_block_; | 573 Object** last_handle_before_deferred_block_; |
574 // This is only used for threading support. | 574 // This is only used for threading support. |
575 HandleScopeData handle_scope_data_; | 575 HandleScopeData handle_scope_data_; |
576 | 576 |
577 void IterateThis(ObjectVisitor* v); | 577 void IterateThis(ObjectVisitor* v); |
578 char* RestoreThreadHelper(char* from); | 578 char* RestoreThreadHelper(char* from); |
579 char* ArchiveThreadHelper(char* to); | 579 char* ArchiveThreadHelper(char* to); |
(...skipping 110 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
690 } | 690 } |
691 | 691 |
692 private: | 692 private: |
693 static v8::Testing::StressType stress_type_; | 693 static v8::Testing::StressType stress_type_; |
694 }; | 694 }; |
695 | 695 |
696 } // namespace internal | 696 } // namespace internal |
697 } // namespace v8 | 697 } // namespace v8 |
698 | 698 |
699 #endif // V8_API_H_ | 699 #endif // V8_API_H_ |
OLD | NEW |