Revision f230a1cf deps/v8/src/api.h
deps/v8/src/api.h | ||
---|---|---|
542 | 542 |
inline void DecrementCallDepth() {call_depth_--;} |
543 | 543 |
inline bool CallDepthIsZero() { return call_depth_ == 0; } |
544 | 544 |
|
545 |
inline void EnterContext(Handle<Object> context);
|
|
546 |
inline bool LeaveLastContext();
|
|
545 |
inline void EnterContext(Handle<Context> context);
|
|
546 |
inline bool LeaveContext(Handle<Context> context);
|
|
547 | 547 |
|
548 | 548 |
// Returns the last entered context or an empty handle if no |
549 | 549 |
// contexts have been entered. |
550 |
inline Handle<Object> LastEnteredContext();
|
|
550 |
inline Handle<Context> LastEnteredContext();
|
|
551 | 551 |
|
552 | 552 |
inline void SaveContext(Context* context); |
553 | 553 |
inline Context* RestoreContext(); |
... | ... | |
592 | 592 |
Isolate* isolate_; |
593 | 593 |
List<internal::Object**> blocks_; |
594 | 594 |
// Used as a stack to keep track of entered contexts. |
595 |
List<Handle<Object> > entered_contexts_;
|
|
595 |
List<Context*> entered_contexts_;
|
|
596 | 596 |
// Used as a stack to keep track of saved contexts. |
597 | 597 |
List<Context*> saved_contexts_; |
598 | 598 |
Object** spare_; |
... | ... | |
630 | 630 |
} |
631 | 631 |
|
632 | 632 |
|
633 |
void HandleScopeImplementer::EnterContext(Handle<Object> context) {
|
|
634 |
entered_contexts_.Add(context); |
|
633 |
void HandleScopeImplementer::EnterContext(Handle<Context> context) {
|
|
634 |
entered_contexts_.Add(*context);
|
|
635 | 635 |
} |
636 | 636 |
|
637 | 637 |
|
638 |
bool HandleScopeImplementer::LeaveLastContext() {
|
|
638 |
bool HandleScopeImplementer::LeaveContext(Handle<Context> context) {
|
|
639 | 639 |
if (entered_contexts_.is_empty()) return false; |
640 |
// TODO(dcarney): figure out what's wrong here |
|
641 |
// if (entered_contexts_.last() != *context) return false; |
|
640 | 642 |
entered_contexts_.RemoveLast(); |
641 | 643 |
return true; |
642 | 644 |
} |
643 | 645 |
|
644 | 646 |
|
645 |
Handle<Object> HandleScopeImplementer::LastEnteredContext() {
|
|
646 |
if (entered_contexts_.is_empty()) return Handle<Object>::null();
|
|
647 |
return entered_contexts_.last();
|
|
647 |
Handle<Context> HandleScopeImplementer::LastEnteredContext() {
|
|
648 |
if (entered_contexts_.is_empty()) return Handle<Context>::null();
|
|
649 |
return Handle<Context>(entered_contexts_.last());
|
|
648 | 650 |
} |
649 | 651 |
|
650 | 652 |
|
... | ... | |
665 | 667 |
#ifdef DEBUG |
666 | 668 |
// SealHandleScope may make the prev_limit to point inside the block. |
667 | 669 |
if (block_start <= prev_limit && prev_limit <= block_limit) { |
668 |
#ifdef ENABLE_EXTRA_CHECKS
|
|
670 |
#ifdef ENABLE_HANDLE_ZAPPING
|
|
669 | 671 |
internal::HandleScope::ZapRange(prev_limit, block_limit); |
670 | 672 |
#endif |
671 | 673 |
break; |
... | ... | |
675 | 677 |
#endif |
676 | 678 |
|
677 | 679 |
blocks_.RemoveLast(); |
678 |
#ifdef ENABLE_EXTRA_CHECKS
|
|
680 |
#ifdef ENABLE_HANDLE_ZAPPING
|
|
679 | 681 |
internal::HandleScope::ZapRange(block_start, block_limit); |
680 | 682 |
#endif |
681 | 683 |
if (spare_ != NULL) { |
Also available in: Unified diff