OLD | NEW |
1 // Copyright 2009 the V8 project authors. All rights reserved. | 1 // Copyright 2009 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 217 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
228 } | 228 } |
229 | 229 |
230 void MakeWeak(void* parameter, WeakCallback weak_callback) { | 230 void MakeWeak(void* parameter, WeakCallback weak_callback) { |
231 ASSERT(weak_callback != NULL); | 231 ASSERT(weak_callback != NULL); |
232 ASSERT(state() != FREE); | 232 ASSERT(state() != FREE); |
233 set_state(WEAK); | 233 set_state(WEAK); |
234 set_parameter(parameter); | 234 set_parameter(parameter); |
235 weak_callback_ = weak_callback; | 235 weak_callback_ = weak_callback; |
236 } | 236 } |
237 | 237 |
238 void ClearWeakness() { | 238 void* ClearWeakness() { |
239 ASSERT(state() != FREE); | 239 ASSERT(state() != FREE); |
| 240 void* p = parameter(); |
240 set_state(NORMAL); | 241 set_state(NORMAL); |
241 set_parameter(NULL); | 242 set_parameter(NULL); |
| 243 return p; |
242 } | 244 } |
243 | 245 |
244 bool PostGarbageCollectionProcessing(Isolate* isolate) { | 246 bool PostGarbageCollectionProcessing(Isolate* isolate) { |
245 if (state() != Node::PENDING) return false; | 247 if (state() != Node::PENDING) return false; |
246 if (weak_callback_ == NULL) { | 248 if (weak_callback_ == NULL) { |
247 Release(); | 249 Release(); |
248 return false; | 250 return false; |
249 } | 251 } |
250 void* par = parameter(); | 252 void* par = parameter(); |
251 set_state(NEAR_DEATH); | 253 set_state(NEAR_DEATH); |
(...skipping 243 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
495 } | 497 } |
496 | 498 |
497 | 499 |
498 void GlobalHandles::MakeWeak(Object** location, | 500 void GlobalHandles::MakeWeak(Object** location, |
499 void* parameter, | 501 void* parameter, |
500 WeakCallback weak_callback) { | 502 WeakCallback weak_callback) { |
501 Node::FromLocation(location)->MakeWeak(parameter, weak_callback); | 503 Node::FromLocation(location)->MakeWeak(parameter, weak_callback); |
502 } | 504 } |
503 | 505 |
504 | 506 |
505 void GlobalHandles::ClearWeakness(Object** location) { | 507 void* GlobalHandles::ClearWeakness(Object** location) { |
506 Node::FromLocation(location)->ClearWeakness(); | 508 return Node::FromLocation(location)->ClearWeakness(); |
507 } | 509 } |
508 | 510 |
509 | 511 |
510 void GlobalHandles::MarkIndependent(Object** location) { | 512 void GlobalHandles::MarkIndependent(Object** location) { |
511 Node::FromLocation(location)->MarkIndependent(); | 513 Node::FromLocation(location)->MarkIndependent(); |
512 } | 514 } |
513 | 515 |
514 | 516 |
515 void GlobalHandles::MarkPartiallyDependent(Object** location) { | 517 void GlobalHandles::MarkPartiallyDependent(Object** location) { |
516 Node::FromLocation(location)->MarkPartiallyDependent(); | 518 Node::FromLocation(location)->MarkPartiallyDependent(); |
(...skipping 567 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
1084 ASSERT_EQ(isolate->heap()->the_hole_value(), blocks_[block][offset]); | 1086 ASSERT_EQ(isolate->heap()->the_hole_value(), blocks_[block][offset]); |
1085 blocks_[block][offset] = object; | 1087 blocks_[block][offset] = object; |
1086 if (isolate->heap()->InNewSpace(object)) { | 1088 if (isolate->heap()->InNewSpace(object)) { |
1087 new_space_indices_.Add(size_); | 1089 new_space_indices_.Add(size_); |
1088 } | 1090 } |
1089 *index = size_++; | 1091 *index = size_++; |
1090 } | 1092 } |
1091 | 1093 |
1092 | 1094 |
1093 } } // namespace v8::internal | 1095 } } // namespace v8::internal |
OLD | NEW |