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

Side by Side Diff: src/global-handles.cc

Issue 9741: Destroyed global handles should not be touched. Added extra... (Closed) Base URL: http://v8.googlecode.com/svn/branches/bleeding_edge/
Patch Set: Created 12 years, 1 month 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 | « no previous file | no next file » | no next file with comments »
Toggle Intra-line Diffs ('i') | Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
OLDNEW
1 // Copyright 2007-2008 the V8 project authors. All rights reserved. 1 // Copyright 2007-2008 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 78 matching lines...) Expand 10 before | Expand all | Expand 10 after
89 ASSERT(OFFSET_OF(Node, object_) == 0); 89 ASSERT(OFFSET_OF(Node, object_) == 0);
90 return reinterpret_cast<Node*>(location); 90 return reinterpret_cast<Node*>(location);
91 } 91 }
92 92
93 // Returns the handle. 93 // Returns the handle.
94 Handle<Object> handle() { return Handle<Object>(&object_); } 94 Handle<Object> handle() { return Handle<Object>(&object_); }
95 95
96 // Make this handle weak. 96 // Make this handle weak.
97 void MakeWeak(void* parameter, WeakReferenceCallback callback) { 97 void MakeWeak(void* parameter, WeakReferenceCallback callback) {
98 LOG(HandleEvent("GlobalHandle::MakeWeak", handle().location())); 98 LOG(HandleEvent("GlobalHandle::MakeWeak", handle().location()));
99 ASSERT(state_ != DESTROYED);
99 if (state_ != WEAK && !IsNearDeath()) { 100 if (state_ != WEAK && !IsNearDeath()) {
100 GlobalHandles::number_of_weak_handles_++; 101 GlobalHandles::number_of_weak_handles_++;
101 if (object_->IsJSGlobalObject()) { 102 if (object_->IsJSGlobalObject()) {
102 GlobalHandles::number_of_global_object_weak_handles_++; 103 GlobalHandles::number_of_global_object_weak_handles_++;
103 } 104 }
104 } 105 }
105 state_ = WEAK; 106 state_ = WEAK;
106 set_parameter(parameter); 107 set_parameter(parameter);
107 callback_ = callback; 108 callback_ = callback;
108 } 109 }
109 110
110 void ClearWeakness() { 111 void ClearWeakness() {
111 LOG(HandleEvent("GlobalHandle::ClearWeakness", handle().location())); 112 LOG(HandleEvent("GlobalHandle::ClearWeakness", handle().location()));
113 ASSERT(state_ != DESTROYED);
112 if (state_ == WEAK || IsNearDeath()) { 114 if (state_ == WEAK || IsNearDeath()) {
113 GlobalHandles::number_of_weak_handles_--; 115 GlobalHandles::number_of_weak_handles_--;
114 if (object_->IsJSGlobalObject()) { 116 if (object_->IsJSGlobalObject()) {
115 GlobalHandles::number_of_global_object_weak_handles_--; 117 GlobalHandles::number_of_global_object_weak_handles_--;
116 } 118 }
117 } 119 }
118 state_ = NORMAL; 120 state_ = NORMAL;
119 set_parameter(NULL); 121 set_parameter(NULL);
120 } 122 }
121 123
(...skipping 248 matching lines...) Expand 10 before | Expand all | Expand 10 after
370 372
371 void GlobalHandles::RemoveObjectGroups() { 373 void GlobalHandles::RemoveObjectGroups() {
372 for (int i = 0; i< object_groups_.length(); i++) { 374 for (int i = 0; i< object_groups_.length(); i++) {
373 delete object_groups_[i]; 375 delete object_groups_[i];
374 } 376 }
375 object_groups_.Clear(); 377 object_groups_.Clear();
376 } 378 }
377 379
378 380
379 } } // namespace v8::internal 381 } } // namespace v8::internal
OLDNEW
« no previous file with comments | « no previous file | no next file » | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698