OLD | NEW |
1 // Copyright 2012 the V8 project authors. All rights reserved. | 1 // Copyright 2012 the V8 project authors. All rights reserved. |
2 // Redistribution and use in source and binary forms, with or without | 2 // Redistribution and use in source and binary forms, with or without |
3 // modification, are permitted provided that the following conditions are | 3 // modification, are permitted provided that the following conditions are |
4 // met: | 4 // met: |
5 // | 5 // |
6 // * Redistributions of source code must retain the above copyright | 6 // * Redistributions of source code must retain the above copyright |
7 // notice, this list of conditions and the following disclaimer. | 7 // notice, this list of conditions and the following disclaimer. |
8 // * Redistributions in binary form must reproduce the above | 8 // * Redistributions in binary form must reproduce the above |
9 // copyright notice, this list of conditions and the following | 9 // copyright notice, this list of conditions and the following |
10 // disclaimer in the documentation and/or other materials provided | 10 // disclaimer in the documentation and/or other materials provided |
(...skipping 533 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
544 | 544 |
545 | 545 |
546 inline internal::Object** GetSpareOrNewBlock(); | 546 inline internal::Object** GetSpareOrNewBlock(); |
547 inline void DeleteExtensions(internal::Object** prev_limit); | 547 inline void DeleteExtensions(internal::Object** prev_limit); |
548 | 548 |
549 inline void IncrementCallDepth() {call_depth_++;} | 549 inline void IncrementCallDepth() {call_depth_++;} |
550 inline void DecrementCallDepth() {call_depth_--;} | 550 inline void DecrementCallDepth() {call_depth_--;} |
551 inline bool CallDepthIsZero() { return call_depth_ == 0; } | 551 inline bool CallDepthIsZero() { return call_depth_ == 0; } |
552 | 552 |
553 inline void EnterContext(Handle<Context> context); | 553 inline void EnterContext(Handle<Context> context); |
554 inline bool LeaveContext(Handle<Context> context); | 554 inline void LeaveContext(); |
| 555 inline bool LastEnteredContextWas(Handle<Context> context); |
555 | 556 |
556 // Returns the last entered context or an empty handle if no | 557 // Returns the last entered context or an empty handle if no |
557 // contexts have been entered. | 558 // contexts have been entered. |
558 inline Handle<Context> LastEnteredContext(); | 559 inline Handle<Context> LastEnteredContext(); |
559 | 560 |
560 inline void SaveContext(Context* context); | 561 inline void SaveContext(Context* context); |
561 inline Context* RestoreContext(); | 562 inline Context* RestoreContext(); |
562 inline bool HasSavedContexts(); | 563 inline bool HasSavedContexts(); |
563 | 564 |
564 inline List<internal::Object**>* blocks() { return &blocks_; } | 565 inline List<internal::Object**>* blocks() { return &blocks_; } |
(...skipping 71 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
636 bool HandleScopeImplementer::HasSavedContexts() { | 637 bool HandleScopeImplementer::HasSavedContexts() { |
637 return !saved_contexts_.is_empty(); | 638 return !saved_contexts_.is_empty(); |
638 } | 639 } |
639 | 640 |
640 | 641 |
641 void HandleScopeImplementer::EnterContext(Handle<Context> context) { | 642 void HandleScopeImplementer::EnterContext(Handle<Context> context) { |
642 entered_contexts_.Add(*context); | 643 entered_contexts_.Add(*context); |
643 } | 644 } |
644 | 645 |
645 | 646 |
646 bool HandleScopeImplementer::LeaveContext(Handle<Context> context) { | 647 void HandleScopeImplementer::LeaveContext() { |
647 if (entered_contexts_.is_empty()) return false; | |
648 // TODO(dcarney): figure out what's wrong here | |
649 // if (entered_contexts_.last() != *context) return false; | |
650 entered_contexts_.RemoveLast(); | 648 entered_contexts_.RemoveLast(); |
651 return true; | |
652 } | 649 } |
653 | 650 |
654 | 651 |
| 652 bool HandleScopeImplementer::LastEnteredContextWas(Handle<Context> context) { |
| 653 return !entered_contexts_.is_empty() && entered_contexts_.last() == *context; |
| 654 } |
| 655 |
| 656 |
655 Handle<Context> HandleScopeImplementer::LastEnteredContext() { | 657 Handle<Context> HandleScopeImplementer::LastEnteredContext() { |
656 if (entered_contexts_.is_empty()) return Handle<Context>::null(); | 658 if (entered_contexts_.is_empty()) return Handle<Context>::null(); |
657 return Handle<Context>(entered_contexts_.last()); | 659 return Handle<Context>(entered_contexts_.last()); |
658 } | 660 } |
659 | 661 |
660 | 662 |
661 // If there's a spare block, use it for growing the current scope. | 663 // If there's a spare block, use it for growing the current scope. |
662 internal::Object** HandleScopeImplementer::GetSpareOrNewBlock() { | 664 internal::Object** HandleScopeImplementer::GetSpareOrNewBlock() { |
663 internal::Object** block = (spare_ != NULL) ? | 665 internal::Object** block = (spare_ != NULL) ? |
664 spare_ : | 666 spare_ : |
(...skipping 50 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
715 stress_type_ = stress_type; | 717 stress_type_ = stress_type; |
716 } | 718 } |
717 | 719 |
718 private: | 720 private: |
719 static v8::Testing::StressType stress_type_; | 721 static v8::Testing::StressType stress_type_; |
720 }; | 722 }; |
721 | 723 |
722 } } // namespace v8::internal | 724 } } // namespace v8::internal |
723 | 725 |
724 #endif // V8_API_H_ | 726 #endif // V8_API_H_ |
OLD | NEW |