diff options
author | isaacs <i@izs.me> | 2012-02-23 16:35:46 -0800 |
---|---|---|
committer | isaacs <i@izs.me> | 2012-02-27 12:11:09 -0800 |
commit | f4641bd4de566145e99b05c47c8f3d629b0223cd (patch) | |
tree | 2d0ccb1c338bec65881b30c49707d9e688fed154 /deps/v8/src/heap.cc | |
parent | 82ad1f87fa99b420a97cc9bfae727fce0b1bf8a4 (diff) | |
download | node-f4641bd4de566145e99b05c47c8f3d629b0223cd.tar.gz |
Update v8 to 3.9.9
Diffstat (limited to 'deps/v8/src/heap.cc')
-rw-r--r-- | deps/v8/src/heap.cc | 63 |
1 files changed, 55 insertions, 8 deletions
diff --git a/deps/v8/src/heap.cc b/deps/v8/src/heap.cc index b08288639..4c54e84f6 100644 --- a/deps/v8/src/heap.cc +++ b/deps/v8/src/heap.cc @@ -1938,6 +1938,19 @@ MaybeObject* Heap::AllocateAccessorPair() { } +MaybeObject* Heap::AllocateTypeFeedbackInfo() { + TypeFeedbackInfo* info; + { MaybeObject* maybe_result = AllocateStruct(TYPE_FEEDBACK_INFO_TYPE); + if (!maybe_result->To(&info)) return maybe_result; + } + info->set_ic_total_count(0); + info->set_ic_with_typeinfo_count(0); + info->set_type_feedback_cells(TypeFeedbackCells::cast(empty_fixed_array()), + SKIP_WRITE_BARRIER); + return info; +} + + const Heap::StringTypeTable Heap::string_type_table[] = { #define STRING_TYPE_ELEMENT(type, size, name, camel_name) \ {type, size, k##camel_name##MapRootIndex}, @@ -2221,6 +2234,12 @@ bool Heap::CreateInitialMaps() { AllocateMap(FIXED_ARRAY_TYPE, kVariableSizeSentinel); if (!maybe_obj->ToObject(&obj)) return false; } + set_module_context_map(Map::cast(obj)); + + { MaybeObject* maybe_obj = + AllocateMap(FIXED_ARRAY_TYPE, kVariableSizeSentinel); + if (!maybe_obj->ToObject(&obj)) return false; + } Map* global_context_map = Map::cast(obj); global_context_map->set_visitor_id(StaticVisitorBase::kVisitGlobalContext); set_global_context_map(global_context_map); @@ -3361,8 +3380,7 @@ MaybeObject* Heap::CreateCode(const CodeDesc& desc, code->set_check_type(RECEIVER_MAP_CHECK); } code->set_deoptimization_data(empty_fixed_array(), SKIP_WRITE_BARRIER); - code->set_type_feedback_cells(TypeFeedbackCells::cast(empty_fixed_array()), - SKIP_WRITE_BARRIER); + code->set_type_feedback_info(undefined_value(), SKIP_WRITE_BARRIER); code->set_handler_table(empty_fixed_array(), SKIP_WRITE_BARRIER); code->set_gc_metadata(Smi::FromInt(0)); // Allow self references to created code object by patching the handle to @@ -4361,10 +4379,10 @@ MaybeObject* Heap::AllocateJSArray( Context* global_context = isolate()->context()->global_context(); JSFunction* array_function = global_context->array_function(); Map* map = array_function->initial_map(); - if (elements_kind == FAST_ELEMENTS || !FLAG_smi_only_arrays) { - map = Map::cast(global_context->object_js_array_map()); - } else if (elements_kind == FAST_DOUBLE_ELEMENTS) { + if (elements_kind == FAST_DOUBLE_ELEMENTS) { map = Map::cast(global_context->double_js_array_map()); + } else if (elements_kind == FAST_ELEMENTS || !FLAG_smi_only_arrays) { + map = Map::cast(global_context->object_js_array_map()); } else { ASSERT(elements_kind == FAST_SMI_ONLY_ELEMENTS); ASSERT(map == global_context->smi_js_array_map()); @@ -4562,7 +4580,7 @@ MaybeObject* Heap::AllocateEmptyFixedDoubleArray() { MaybeObject* Heap::AllocateUninitializedFixedDoubleArray( int length, PretenureFlag pretenure) { - if (length == 0) return empty_fixed_double_array(); + if (length == 0) return empty_fixed_array(); Object* elements_object; MaybeObject* maybe_obj = AllocateRawFixedDoubleArray(length, pretenure); @@ -4579,7 +4597,7 @@ MaybeObject* Heap::AllocateUninitializedFixedDoubleArray( MaybeObject* Heap::AllocateFixedDoubleArrayWithHoles( int length, PretenureFlag pretenure) { - if (length == 0) return empty_fixed_double_array(); + if (length == 0) return empty_fixed_array(); Object* elements_object; MaybeObject* maybe_obj = AllocateRawFixedDoubleArray(length, pretenure); @@ -5062,8 +5080,37 @@ void Heap::Verify() { cell_space_->Verify(&no_dirty_regions_visitor); lo_space_->Verify(); -} + VerifyNoAccessorPairSharing(); +} + + +void Heap::VerifyNoAccessorPairSharing() { + // Verification is done in 2 phases: First we mark all AccessorPairs, checking + // that we mark only unmarked pairs, then we clear all marks, restoring the + // initial state. We use the Smi tag of the AccessorPair's getter as the + // marking bit, because we can never see a Smi as the getter. + for (int phase = 0; phase < 2; phase++) { + HeapObjectIterator iter(map_space()); + for (HeapObject* obj = iter.Next(); obj != NULL; obj = iter.Next()) { + if (obj->IsMap()) { + DescriptorArray* descs = Map::cast(obj)->instance_descriptors(); + for (int i = 0; i < descs->number_of_descriptors(); i++) { + if (descs->GetType(i) == CALLBACKS && + descs->GetValue(i)->IsAccessorPair()) { + AccessorPair* accessors = AccessorPair::cast(descs->GetValue(i)); + uintptr_t before = reinterpret_cast<intptr_t>(accessors->getter()); + uintptr_t after = (phase == 0) ? + ((before & ~kSmiTagMask) | kSmiTag) : + ((before & ~kHeapObjectTag) | kHeapObjectTag); + CHECK(before != after); + accessors->set_getter(reinterpret_cast<Object*>(after)); + } + } + } + } + } +} #endif // DEBUG |