Commit ecaf4605 authored by dslomov@chromium.org's avatar dslomov@chromium.org

Unify processing of weak lists in heap.cc

R=hpayer@chromium.org, mstarzinger@chromium.org

Review URL: https://codereview.chromium.org/16641003

git-svn-id: http://v8.googlecode.com/svn/branches/bleeding_edge@15076 ce2b1a6d-e550-0410-aec6-3dcde31c8c00
parent b34d1cf3
......@@ -6162,7 +6162,7 @@ void v8::ArrayBuffer::Neuter() {
ENTER_V8(isolate);
for (i::Handle<i::Object> array_obj(obj->weak_first_array(), isolate);
*array_obj != i::Smi::FromInt(0);) {
!array_obj->IsUndefined();) {
i::Handle<i::JSTypedArray> typed_array(i::JSTypedArray::cast(*array_obj));
typed_array->Neuter();
array_obj = i::handle(typed_array->weak_next(), isolate);
......
This diff is collapsed.
......@@ -691,7 +691,7 @@ void Runtime::SetupArrayBuffer(Isolate* isolate,
array_buffer->set_weak_next(isolate->heap()->array_buffers_list());
isolate->heap()->set_array_buffers_list(*array_buffer);
array_buffer->set_weak_first_array(Smi::FromInt(0));
array_buffer->set_weak_first_array(isolate->heap()->undefined_value());
}
......
......@@ -687,6 +687,8 @@ void Deserializer::Deserialize() {
isolate_->heap()->set_native_contexts_list(
isolate_->heap()->undefined_value());
isolate_->heap()->set_array_buffers_list(
isolate_->heap()->undefined_value());
// Update data pointers to the external strings containing natives sources.
for (int i = 0; i < Natives::GetBuiltinsCount(); i++) {
......
......@@ -44,7 +44,7 @@ static Isolate* GetIsolateFrom(LocalContext* context) {
static int CountArrayBuffersInWeakList(Heap* heap) {
int count = 0;
for (Object* o = heap->array_buffers_list();
o != Smi::FromInt(0);
!o->IsUndefined();
o = JSArrayBuffer::cast(o)->weak_next()) {
count++;
}
......@@ -54,7 +54,7 @@ static int CountArrayBuffersInWeakList(Heap* heap) {
static bool HasArrayBufferInWeakList(Heap* heap, JSArrayBuffer* ab) {
for (Object* o = heap->array_buffers_list();
o != Smi::FromInt(0);
!o->IsUndefined();
o = JSArrayBuffer::cast(o)->weak_next()) {
if (ab == o) return true;
}
......@@ -65,7 +65,7 @@ static bool HasArrayBufferInWeakList(Heap* heap, JSArrayBuffer* ab) {
static int CountTypedArrays(JSArrayBuffer* array_buffer) {
int count = 0;
for (Object* o = array_buffer->weak_first_array();
o != Smi::FromInt(0);
!o->IsUndefined();
o = JSTypedArray::cast(o)->weak_next()) {
count++;
}
......@@ -76,7 +76,7 @@ static int CountTypedArrays(JSArrayBuffer* array_buffer) {
static bool HasTypedArrayInWeakList(JSArrayBuffer* array_buffer,
JSTypedArray* ta) {
for (Object* o = array_buffer->weak_first_array();
o != Smi::FromInt(0);
!o->IsUndefined();
o = JSTypedArray::cast(o)->weak_next()) {
if (ta == o) return true;
}
......
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment