Chromium Code Reviews
chromiumcodereview-hr@appspot.gserviceaccount.com (chromiumcodereview-hr) | Please choose your nickname with Settings | Help | Chromium Project | Gerrit Changes | Sign out
(424)

Side by Side Diff: src/handles.cc

Issue 139393002: Removed apiutils.h and related cleanup. (Closed) Base URL: https://v8.googlecode.com/svn/branches/bleeding_edge
Patch Set: Dummy for fixing codereview issues Created 6 years, 11 months ago
Use n/p to move between diff chunks; N/P to move between comments. Draft comments are only viewable by you.
Jump to:
View unified diff | Download patch | Annotate | Revision Log
« no previous file with comments | « src/handles.h ('k') | src/handles-inl.h » ('j') | no next file with comments »
Toggle Intra-line Diffs ('i') | Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
OLDNEW
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 37 matching lines...) Expand 10 before | Expand all | Expand 10 after
48 int HandleScope::NumberOfHandles(Isolate* isolate) { 48 int HandleScope::NumberOfHandles(Isolate* isolate) {
49 HandleScopeImplementer* impl = isolate->handle_scope_implementer(); 49 HandleScopeImplementer* impl = isolate->handle_scope_implementer();
50 int n = impl->blocks()->length(); 50 int n = impl->blocks()->length();
51 if (n == 0) return 0; 51 if (n == 0) return 0;
52 return ((n - 1) * kHandleBlockSize) + static_cast<int>( 52 return ((n - 1) * kHandleBlockSize) + static_cast<int>(
53 (isolate->handle_scope_data()->next - impl->blocks()->last())); 53 (isolate->handle_scope_data()->next - impl->blocks()->last()));
54 } 54 }
55 55
56 56
57 Object** HandleScope::Extend(Isolate* isolate) { 57 Object** HandleScope::Extend(Isolate* isolate) {
58 v8::ImplementationUtilities::HandleScopeData* current = 58 HandleScopeData* current = isolate->handle_scope_data();
59 isolate->handle_scope_data();
60 59
61 Object** result = current->next; 60 Object** result = current->next;
62 61
63 ASSERT(result == current->limit); 62 ASSERT(result == current->limit);
64 // Make sure there's at least one scope on the stack and that the 63 // Make sure there's at least one scope on the stack and that the
65 // top of the scope stack isn't a barrier. 64 // top of the scope stack isn't a barrier.
66 if (!Utils::ApiCheck(current->level != 0, 65 if (!Utils::ApiCheck(current->level != 0,
67 "v8::HandleScope::CreateHandle()", 66 "v8::HandleScope::CreateHandle()",
68 "Cannot create a handle without a HandleScope")) { 67 "Cannot create a handle without a HandleScope")) {
69 return NULL; 68 return NULL;
(...skipping 18 matching lines...) Expand all
88 // extension as part of the current scope. 87 // extension as part of the current scope.
89 impl->blocks()->Add(result); 88 impl->blocks()->Add(result);
90 current->limit = &result[kHandleBlockSize]; 89 current->limit = &result[kHandleBlockSize];
91 } 90 }
92 91
93 return result; 92 return result;
94 } 93 }
95 94
96 95
97 void HandleScope::DeleteExtensions(Isolate* isolate) { 96 void HandleScope::DeleteExtensions(Isolate* isolate) {
98 v8::ImplementationUtilities::HandleScopeData* current = 97 HandleScopeData* current = isolate->handle_scope_data();
99 isolate->handle_scope_data();
100 isolate->handle_scope_implementer()->DeleteExtensions(current->limit); 98 isolate->handle_scope_implementer()->DeleteExtensions(current->limit);
101 } 99 }
102 100
103 101
104 #ifdef ENABLE_HANDLE_ZAPPING 102 #ifdef ENABLE_HANDLE_ZAPPING
105 void HandleScope::ZapRange(Object** start, Object** end) { 103 void HandleScope::ZapRange(Object** start, Object** end) {
106 ASSERT(end - start <= kHandleBlockSize); 104 ASSERT(end - start <= kHandleBlockSize);
107 for (Object** p = start; p != end; p++) { 105 for (Object** p = start; p != end; p++) {
108 *reinterpret_cast<Address*>(p) = v8::internal::kHandleZapValue; 106 *reinterpret_cast<Address*>(p) = v8::internal::kHandleZapValue;
109 } 107 }
(...skipping 634 matching lines...) Expand 10 before | Expand all | Expand 10 after
744 storage = Handle<FixedArray>(dictionary->CopyEnumKeysTo(*storage)); 742 storage = Handle<FixedArray>(dictionary->CopyEnumKeysTo(*storage));
745 ASSERT(storage->length() == object->NumberOfLocalProperties(DONT_SHOW)); 743 ASSERT(storage->length() == object->NumberOfLocalProperties(DONT_SHOW));
746 return storage; 744 return storage;
747 } 745 }
748 } 746 }
749 747
750 748
751 DeferredHandleScope::DeferredHandleScope(Isolate* isolate) 749 DeferredHandleScope::DeferredHandleScope(Isolate* isolate)
752 : impl_(isolate->handle_scope_implementer()) { 750 : impl_(isolate->handle_scope_implementer()) {
753 impl_->BeginDeferredScope(); 751 impl_->BeginDeferredScope();
754 v8::ImplementationUtilities::HandleScopeData* data = 752 HandleScopeData* data = impl_->isolate()->handle_scope_data();
755 impl_->isolate()->handle_scope_data();
756 Object** new_next = impl_->GetSpareOrNewBlock(); 753 Object** new_next = impl_->GetSpareOrNewBlock();
757 Object** new_limit = &new_next[kHandleBlockSize]; 754 Object** new_limit = &new_next[kHandleBlockSize];
758 ASSERT(data->limit == &impl_->blocks()->last()[kHandleBlockSize]); 755 ASSERT(data->limit == &impl_->blocks()->last()[kHandleBlockSize]);
759 impl_->blocks()->Add(new_next); 756 impl_->blocks()->Add(new_next);
760 757
761 #ifdef DEBUG 758 #ifdef DEBUG
762 prev_level_ = data->level; 759 prev_level_ = data->level;
763 #endif 760 #endif
764 data->level++; 761 data->level++;
765 prev_limit_ = data->limit; 762 prev_limit_ = data->limit;
766 prev_next_ = data->next; 763 prev_next_ = data->next;
767 data->next = new_next; 764 data->next = new_next;
768 data->limit = new_limit; 765 data->limit = new_limit;
769 } 766 }
770 767
771 768
772 DeferredHandleScope::~DeferredHandleScope() { 769 DeferredHandleScope::~DeferredHandleScope() {
773 impl_->isolate()->handle_scope_data()->level--; 770 impl_->isolate()->handle_scope_data()->level--;
774 ASSERT(handles_detached_); 771 ASSERT(handles_detached_);
775 ASSERT(impl_->isolate()->handle_scope_data()->level == prev_level_); 772 ASSERT(impl_->isolate()->handle_scope_data()->level == prev_level_);
776 } 773 }
777 774
778 775
779 DeferredHandles* DeferredHandleScope::Detach() { 776 DeferredHandles* DeferredHandleScope::Detach() {
780 DeferredHandles* deferred = impl_->Detach(prev_limit_); 777 DeferredHandles* deferred = impl_->Detach(prev_limit_);
781 v8::ImplementationUtilities::HandleScopeData* data = 778 HandleScopeData* data = impl_->isolate()->handle_scope_data();
782 impl_->isolate()->handle_scope_data();
783 data->next = prev_next_; 779 data->next = prev_next_;
784 data->limit = prev_limit_; 780 data->limit = prev_limit_;
785 #ifdef DEBUG 781 #ifdef DEBUG
786 handles_detached_ = true; 782 handles_detached_ = true;
787 #endif 783 #endif
788 return deferred; 784 return deferred;
789 } 785 }
790 786
791 787
792 void AddWeakObjectToCodeDependency(Heap* heap, 788 void AddWeakObjectToCodeDependency(Heap* heap,
793 Handle<Object> object, 789 Handle<Object> object,
794 Handle<Code> code) { 790 Handle<Code> code) {
795 heap->EnsureWeakObjectToCodeTable(); 791 heap->EnsureWeakObjectToCodeTable();
796 Handle<DependentCode> dep(heap->LookupWeakObjectToCodeDependency(*object)); 792 Handle<DependentCode> dep(heap->LookupWeakObjectToCodeDependency(*object));
797 dep = DependentCode::Insert(dep, DependentCode::kWeaklyEmbeddedGroup, code); 793 dep = DependentCode::Insert(dep, DependentCode::kWeaklyEmbeddedGroup, code);
798 CALL_HEAP_FUNCTION_VOID(heap->isolate(), 794 CALL_HEAP_FUNCTION_VOID(heap->isolate(),
799 heap->AddWeakObjectToCodeDependency(*object, *dep)); 795 heap->AddWeakObjectToCodeDependency(*object, *dep));
800 } 796 }
801 797
802 798
803 } } // namespace v8::internal 799 } } // namespace v8::internal
OLDNEW
« no previous file with comments | « src/handles.h ('k') | src/handles-inl.h » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698