| OLD | NEW |
| 1 // Copyright 2009 the V8 project authors. All rights reserved. | 1 // Copyright 2009 the V8 project authors. All rights reserved. |
| 2 // Use of this source code is governed by a BSD-style license that can be | 2 // Use of this source code is governed by a BSD-style license that can be |
| 3 // found in the LICENSE file. | 3 // found in the LICENSE file. |
| 4 | 4 |
| 5 #include "src/v8.h" | 5 #include "src/v8.h" |
| 6 | 6 |
| 7 #include "src/api.h" | 7 #include "src/api.h" |
| 8 #include "src/global-handles.h" | 8 #include "src/global-handles.h" |
| 9 | 9 |
| 10 #include "src/vm-state-inl.h" | 10 #include "src/vm-state-inl.h" |
| (...skipping 267 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 278 DCHECK(jsobject->GetInternalFieldCount() >= 1); | 278 DCHECK(jsobject->GetInternalFieldCount() >= 1); |
| 279 internal_field0 = jsobject->GetInternalField(0); | 279 internal_field0 = jsobject->GetInternalField(0); |
| 280 if (weakness_type() == PHANTOM_WEAK_2_INTERNAL_FIELDS) { | 280 if (weakness_type() == PHANTOM_WEAK_2_INTERNAL_FIELDS) { |
| 281 DCHECK(jsobject->GetInternalFieldCount() >= 2); | 281 DCHECK(jsobject->GetInternalFieldCount() >= 2); |
| 282 internal_field1 = jsobject->GetInternalField(1); | 282 internal_field1 = jsobject->GetInternalField(1); |
| 283 } | 283 } |
| 284 } | 284 } |
| 285 | 285 |
| 286 // Zap with harmless value. | 286 // Zap with harmless value. |
| 287 *location() = Smi::FromInt(0); | 287 *location() = Smi::FromInt(0); |
| 288 typedef PhantomCallbackData<void, void, void> Data; | 288 typedef PhantomCallbackData<void> Data; |
| 289 | 289 |
| 290 if (!internal_field0->IsSmi()) internal_field0 = nullptr; | 290 if (!internal_field0->IsSmi()) internal_field0 = nullptr; |
| 291 if (!internal_field1->IsSmi()) internal_field1 = nullptr; | 291 if (!internal_field1->IsSmi()) internal_field1 = nullptr; |
| 292 | 292 |
| 293 Data data(api_isolate, parameter(), internal_field0, internal_field1); | 293 Data data(api_isolate, parameter(), internal_field0, internal_field1); |
| 294 Data::Callback callback = | 294 Data::Callback callback = |
| 295 reinterpret_cast<Data::Callback>(weak_callback_); | 295 reinterpret_cast<Data::Callback>(weak_callback_); |
| 296 | 296 |
| 297 pending_phantom_callbacks->Add( | 297 pending_phantom_callbacks->Add( |
| 298 PendingPhantomCallback(this, data, callback)); | 298 PendingPhantomCallback(this, data, callback)); |
| (...skipping 256 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 555 if (location != NULL) Node::FromLocation(location)->Release(); | 555 if (location != NULL) Node::FromLocation(location)->Release(); |
| 556 } | 556 } |
| 557 | 557 |
| 558 | 558 |
| 559 void GlobalHandles::MakeWeak(Object** location, void* parameter, | 559 void GlobalHandles::MakeWeak(Object** location, void* parameter, |
| 560 WeakCallback weak_callback) { | 560 WeakCallback weak_callback) { |
| 561 Node::FromLocation(location)->MakeWeak(parameter, weak_callback); | 561 Node::FromLocation(location)->MakeWeak(parameter, weak_callback); |
| 562 } | 562 } |
| 563 | 563 |
| 564 | 564 |
| 565 typedef PhantomCallbackData<void, void, void>::Callback GenericCallback; | 565 typedef PhantomCallbackData<void>::Callback GenericCallback; |
| 566 | 566 |
| 567 | 567 |
| 568 void GlobalHandles::MakePhantom(Object** location, void* parameter, | 568 void GlobalHandles::MakePhantom(Object** location, void* parameter, |
| 569 int number_of_internal_fields, | 569 int number_of_internal_fields, |
| 570 GenericCallback phantom_callback) { | 570 GenericCallback phantom_callback) { |
| 571 Node::FromLocation(location) | 571 Node::FromLocation(location) |
| 572 ->MakePhantom(parameter, number_of_internal_fields, phantom_callback); | 572 ->MakePhantom(parameter, number_of_internal_fields, phantom_callback); |
| 573 } | 573 } |
| 574 | 574 |
| 575 | 575 |
| (...skipping 657 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 1233 DCHECK_EQ(isolate->heap()->the_hole_value(), blocks_[block][offset]); | 1233 DCHECK_EQ(isolate->heap()->the_hole_value(), blocks_[block][offset]); |
| 1234 blocks_[block][offset] = object; | 1234 blocks_[block][offset] = object; |
| 1235 if (isolate->heap()->InNewSpace(object)) { | 1235 if (isolate->heap()->InNewSpace(object)) { |
| 1236 new_space_indices_.Add(size_); | 1236 new_space_indices_.Add(size_); |
| 1237 } | 1237 } |
| 1238 *index = size_++; | 1238 *index = size_++; |
| 1239 } | 1239 } |
| 1240 | 1240 |
| 1241 | 1241 |
| 1242 } } // namespace v8::internal | 1242 } } // namespace v8::internal |
| OLD | NEW |