| 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 524 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 535 static char* Iterate(v8::internal::ObjectVisitor* v, char* data); | 535 static char* Iterate(v8::internal::ObjectVisitor* v, char* data); |
| 536 | 536 |
| 537 | 537 |
| 538 inline internal::Object** GetSpareOrNewBlock(); | 538 inline internal::Object** GetSpareOrNewBlock(); |
| 539 inline void DeleteExtensions(internal::Object** prev_limit); | 539 inline void DeleteExtensions(internal::Object** prev_limit); |
| 540 | 540 |
| 541 inline void IncrementCallDepth() {call_depth_++;} | 541 inline void IncrementCallDepth() {call_depth_++;} |
| 542 inline void DecrementCallDepth() {call_depth_--;} | 542 inline void DecrementCallDepth() {call_depth_--;} |
| 543 inline bool CallDepthIsZero() { return call_depth_ == 0; } | 543 inline bool CallDepthIsZero() { return call_depth_ == 0; } |
| 544 | 544 |
| 545 inline void EnterContext(Handle<Object> context); | 545 inline void EnterContext(Handle<Context> context); |
| 546 inline bool LeaveContext(Handle<Object> context); | 546 inline bool LeaveContext(Handle<Context> context); |
| 547 | 547 |
| 548 // Returns the last entered context or an empty handle if no | 548 // Returns the last entered context or an empty handle if no |
| 549 // contexts have been entered. | 549 // contexts have been entered. |
| 550 inline Handle<Object> LastEnteredContext(); | 550 inline Handle<Context> LastEnteredContext(); |
| 551 | 551 |
| 552 inline void SaveContext(Context* context); | 552 inline void SaveContext(Context* context); |
| 553 inline Context* RestoreContext(); | 553 inline Context* RestoreContext(); |
| 554 inline bool HasSavedContexts(); | 554 inline bool HasSavedContexts(); |
| 555 | 555 |
| 556 inline List<internal::Object**>* blocks() { return &blocks_; } | 556 inline List<internal::Object**>* blocks() { return &blocks_; } |
| 557 Isolate* isolate() const { return isolate_; } | 557 Isolate* isolate() const { return isolate_; } |
| 558 | 558 |
| 559 void ReturnBlock(Object** block) { | 559 void ReturnBlock(Object** block) { |
| 560 ASSERT(block != NULL); | 560 ASSERT(block != NULL); |
| (...skipping 24 matching lines...) Expand all Loading... |
| 585 } | 585 } |
| 586 ASSERT(call_depth_ == 0); | 586 ASSERT(call_depth_ == 0); |
| 587 } | 587 } |
| 588 | 588 |
| 589 void BeginDeferredScope(); | 589 void BeginDeferredScope(); |
| 590 DeferredHandles* Detach(Object** prev_limit); | 590 DeferredHandles* Detach(Object** prev_limit); |
| 591 | 591 |
| 592 Isolate* isolate_; | 592 Isolate* isolate_; |
| 593 List<internal::Object**> blocks_; | 593 List<internal::Object**> blocks_; |
| 594 // Used as a stack to keep track of entered contexts. | 594 // Used as a stack to keep track of entered contexts. |
| 595 List<Handle<Object> > entered_contexts_; | 595 List<Context*> entered_contexts_; |
| 596 // Used as a stack to keep track of saved contexts. | 596 // Used as a stack to keep track of saved contexts. |
| 597 List<Context*> saved_contexts_; | 597 List<Context*> saved_contexts_; |
| 598 Object** spare_; | 598 Object** spare_; |
| 599 int call_depth_; | 599 int call_depth_; |
| 600 Object** last_handle_before_deferred_block_; | 600 Object** last_handle_before_deferred_block_; |
| 601 // This is only used for threading support. | 601 // This is only used for threading support. |
| 602 v8::ImplementationUtilities::HandleScopeData handle_scope_data_; | 602 v8::ImplementationUtilities::HandleScopeData handle_scope_data_; |
| 603 | 603 |
| 604 void IterateThis(ObjectVisitor* v); | 604 void IterateThis(ObjectVisitor* v); |
| 605 char* RestoreThreadHelper(char* from); | 605 char* RestoreThreadHelper(char* from); |
| (...skipping 17 matching lines...) Expand all Loading... |
| 623 Context* HandleScopeImplementer::RestoreContext() { | 623 Context* HandleScopeImplementer::RestoreContext() { |
| 624 return saved_contexts_.RemoveLast(); | 624 return saved_contexts_.RemoveLast(); |
| 625 } | 625 } |
| 626 | 626 |
| 627 | 627 |
| 628 bool HandleScopeImplementer::HasSavedContexts() { | 628 bool HandleScopeImplementer::HasSavedContexts() { |
| 629 return !saved_contexts_.is_empty(); | 629 return !saved_contexts_.is_empty(); |
| 630 } | 630 } |
| 631 | 631 |
| 632 | 632 |
| 633 void HandleScopeImplementer::EnterContext(Handle<Object> context) { | 633 void HandleScopeImplementer::EnterContext(Handle<Context> context) { |
| 634 entered_contexts_.Add(context); | 634 entered_contexts_.Add(*context); |
| 635 } | 635 } |
| 636 | 636 |
| 637 | 637 |
| 638 bool HandleScopeImplementer::LeaveContext(Handle<Object> context) { | 638 bool HandleScopeImplementer::LeaveContext(Handle<Context> context) { |
| 639 if (entered_contexts_.is_empty()) return false; | 639 if (entered_contexts_.is_empty()) return false; |
| 640 // TODO(dcarney): figure out what's wrong here | 640 // TODO(dcarney): figure out what's wrong here |
| 641 // if (*entered_contexts_.last() != *context) return false; | 641 // if (entered_contexts_.last() != *context) return false; |
| 642 entered_contexts_.RemoveLast(); | 642 entered_contexts_.RemoveLast(); |
| 643 return true; | 643 return true; |
| 644 } | 644 } |
| 645 | 645 |
| 646 | 646 |
| 647 Handle<Object> HandleScopeImplementer::LastEnteredContext() { | 647 Handle<Context> HandleScopeImplementer::LastEnteredContext() { |
| 648 if (entered_contexts_.is_empty()) return Handle<Object>::null(); | 648 if (entered_contexts_.is_empty()) return Handle<Context>::null(); |
| 649 return entered_contexts_.last(); | 649 return Handle<Context>(entered_contexts_.last()); |
| 650 } | 650 } |
| 651 | 651 |
| 652 | 652 |
| 653 // If there's a spare block, use it for growing the current scope. | 653 // If there's a spare block, use it for growing the current scope. |
| 654 internal::Object** HandleScopeImplementer::GetSpareOrNewBlock() { | 654 internal::Object** HandleScopeImplementer::GetSpareOrNewBlock() { |
| 655 internal::Object** block = (spare_ != NULL) ? | 655 internal::Object** block = (spare_ != NULL) ? |
| 656 spare_ : | 656 spare_ : |
| 657 NewArray<internal::Object*>(kHandleBlockSize); | 657 NewArray<internal::Object*>(kHandleBlockSize); |
| 658 spare_ = NULL; | 658 spare_ = NULL; |
| 659 return block; | 659 return block; |
| (...skipping 47 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 707 stress_type_ = stress_type; | 707 stress_type_ = stress_type; |
| 708 } | 708 } |
| 709 | 709 |
| 710 private: | 710 private: |
| 711 static v8::Testing::StressType stress_type_; | 711 static v8::Testing::StressType stress_type_; |
| 712 }; | 712 }; |
| 713 | 713 |
| 714 } } // namespace v8::internal | 714 } } // namespace v8::internal |
| 715 | 715 |
| 716 #endif // V8_API_H_ | 716 #endif // V8_API_H_ |
| OLD | NEW |