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