Congrats to the 10k-th commit! On Tue, Nov 15, 2011 at 3:01 PM, <[email protected]> wrote:
> Revision: 10000 > Author: [email protected] > Date: Tue Nov 15 06:01:02 2011 > Log: Elide superfluous write barriers. > Review URL: > http://codereview.chromium.**org/8468005<http://codereview.chromium.org/8468005> > http://code.google.com/p/v8/**source/detail?r=10000<http://code.google.com/p/v8/source/detail?r=10000> > > Modified: > /branches/bleeding_edge/src/**heap.cc > > ==============================**========= > --- /branches/bleeding_edge/src/**heap.cc Fri Nov 11 05:48:14 2011 > +++ /branches/bleeding_edge/src/**heap.cc Tue Nov 15 06:01:02 2011 > @@ -1765,18 +1765,18 @@ > } > > Map* map = reinterpret_cast<Map*>(result)**; > - map->set_map(meta_map()); > + map->set_map_unsafe(meta_map()**); > map->set_instance_type(**instance_type); > map->set_visitor_id( > StaticVisitorBase::**GetVisitorId(instance_type, instance_size)); > - map->set_prototype(null_value(**)); > - map->set_constructor(null_**value()); > + map->set_prototype(null_value(**), SKIP_WRITE_BARRIER); > + map->set_constructor(null_**value(), SKIP_WRITE_BARRIER); > map->set_instance_size(**instance_size); > map->set_inobject_properties(**0); > map->set_pre_allocated_**property_fields(0); > map->init_instance_**descriptors(); > - map->set_code_cache(empty_**fixed_array()); > - map->set_prototype_**transitions(empty_fixed_array(**)); > + map->set_code_cache(empty_**fixed_array(), SKIP_WRITE_BARRIER); > + map->set_prototype_**transitions(empty_fixed_array(**), > SKIP_WRITE_BARRIER); > map->set_unused_property_**fields(0); > map->set_bit_field(0); > map->set_bit_field2(1 << Map::kIsExtensible); > @@ -1798,8 +1798,8 @@ > if (!maybe_result->ToObject(&**result)) return maybe_result; > } > CodeCache* code_cache = CodeCache::cast(result); > - code_cache->set_default_cache(**empty_fixed_array()); > - code_cache->set_normal_type_**cache(undefined_value()); > + code_cache->set_default_cache(**empty_fixed_array(), > SKIP_WRITE_BARRIER); > + code_cache->set_normal_type_**cache(undefined_value(), > SKIP_WRITE_BARRIER); > return code_cache; > } > > @@ -2125,7 +2125,7 @@ > if (!maybe_result->ToObject(&**result)) return maybe_result; > } > > - HeapObject::cast(result)->set_**map(heap_number_map()); > + HeapObject::cast(result)->set_**map_unsafe(heap_number_map()); > HeapNumber::cast(result)->set_**value(value); > return result; > } > @@ -2143,7 +2143,7 @@ > { MaybeObject* maybe_result = new_space_.AllocateRaw(** > HeapNumber::kSize); > if (!maybe_result->ToObject(&**result)) return maybe_result; > } > - HeapObject::cast(result)->set_**map(heap_number_map()); > + HeapObject::cast(result)->set_**map_unsafe(heap_number_map()); > HeapNumber::cast(result)->set_**value(value); > return result; > } > @@ -2154,7 +2154,7 @@ > { MaybeObject* maybe_result = AllocateRawCell(); > if (!maybe_result->ToObject(&**result)) return maybe_result; > } > - HeapObject::cast(result)->set_**map(global_property_cell_map()**); > + HeapObject::cast(result)->set_**map_unsafe(global_property_** > cell_map()); > JSGlobalPropertyCell::cast(**result)->set_value(value); > return result; > } > @@ -2693,12 +2693,12 @@ > isolate_->builtins()->builtin(**Builtins::** > kJSConstructStubGeneric); > share->set_construct_stub(**construct_stub); > share->set_instance_class_**name(Object_symbol()); > - share->set_function_data(**undefined_value()); > - share->set_script(undefined_**value()); > - share->set_debug_info(**undefined_value()); > - share->set_inferred_name(**empty_string()); > - share->set_initial_map(**undefined_value()); > - share->set_this_property_**assignments(undefined_value())**; > + share->set_function_data(**undefined_value(), SKIP_WRITE_BARRIER); > + share->set_script(undefined_**value(), SKIP_WRITE_BARRIER); > + share->set_debug_info(**undefined_value(), SKIP_WRITE_BARRIER); > + share->set_inferred_name(**empty_string(), SKIP_WRITE_BARRIER); > + share->set_initial_map(**undefined_value(), SKIP_WRITE_BARRIER); > + share->set_this_property_**assignments(undefined_value(), > SKIP_WRITE_BARRIER); > share->set_deopt_counter(Smi::**FromInt(FLAG_deopt_every_n_**times)); > > // Set integer fields (smi or int, depending on the architecture). > @@ -2730,8 +2730,8 @@ > if (!maybe_result->ToObject(&**result)) return maybe_result; > } > JSMessageObject* message = JSMessageObject::cast(result); > - message->set_properties(Heap::**empty_fixed_array()); > - message->set_elements(Heap::**empty_fixed_array()); > + message->set_properties(Heap::**empty_fixed_array(), > SKIP_WRITE_BARRIER); > + message->set_elements(Heap::**empty_fixed_array(), SKIP_WRITE_BARRIER); > message->set_type(type); > message->set_arguments(**arguments); > message->set_start_position(**start_position); > @@ -3091,7 +3091,7 @@ > if (!maybe_result->ToObject(&**result)) return maybe_result; > } > > - reinterpret_cast<ByteArray*>(**result)->set_map(byte_array_**map()); > + reinterpret_cast<ByteArray*>(**result)->set_map_unsafe(byte_** > array_map()); > reinterpret_cast<ByteArray*>(**result)->set_length(length); > return result; > } > @@ -3109,7 +3109,7 @@ > if (!maybe_result->ToObject(&**result)) return maybe_result; > } > > - reinterpret_cast<ByteArray*>(**result)->set_map(byte_array_**map()); > + reinterpret_cast<ByteArray*>(**result)->set_map_unsafe(byte_** > array_map()); > reinterpret_cast<ByteArray*>(**result)->set_length(length); > return result; > } > @@ -3119,11 +3119,11 @@ > if (size == 0) return; > HeapObject* filler = HeapObject::FromAddress(addr); > if (size == kPointerSize) { > - filler->set_map(one_pointer_**filler_map()); > + filler->set_map_unsafe(one_**pointer_filler_map()); > } else if (size == 2 * kPointerSize) { > - filler->set_map(two_pointer_**filler_map()); > + filler->set_map_unsafe(two_**pointer_filler_map()); > } else { > - filler->set_map(free_space_**map()); > + filler->set_map_unsafe(free_**space_map()); > FreeSpace::cast(filler)->set_**size(size); > } > } > @@ -3141,7 +3141,7 @@ > if (!maybe_result->ToObject(&**result)) return maybe_result; > } > > - reinterpret_cast<**ExternalArray*>(result)->set_**map( > + reinterpret_cast<**ExternalArray*>(result)->set_**map_unsafe( > MapForExternalArrayType(array_**type)); > reinterpret_cast<**ExternalArray*>(result)->set_**length(length); > reinterpret_cast<**ExternalArray*>(result)->set_**external_pointer( > @@ -3178,7 +3178,7 @@ > if (!maybe_result->ToObject(&**result)) return maybe_result; > > // Initialize the object > - HeapObject::cast(result)->set_**map(code_map()); > + HeapObject::cast(result)->set_**map_unsafe(code_map()); > Code* code = Code::cast(result); > ASSERT(!isolate_->code_range()**->exists() || > isolate_->code_range()->**contains(code->address())); > @@ -3188,8 +3188,8 @@ > if (code->is_call_stub() || code->is_keyed_call_stub()) { > code->set_check_type(RECEIVER_**MAP_CHECK); > } > - code->set_deoptimization_data(**empty_fixed_array()); > - code->set_handler_table(empty_**fixed_array()); > + code->set_deoptimization_data(**empty_fixed_array(), > SKIP_WRITE_BARRIER); > + code->set_handler_table(empty_**fixed_array(), SKIP_WRITE_BARRIER); > code->set_next_code_flushing_**candidate(undefined_value()); > // Allow self references to created code object by patching the handle to > // point to the newly allocated Code object. > @@ -3306,7 +3306,8 @@ > AllocateRaw(map->instance_**size(), space, retry_space); > if (!maybe_result->ToObject(&**result)) return maybe_result; > } > - HeapObject::cast(result)->set_**map(map); > + // No need for write barrier since object is white and map is in old > space. > + HeapObject::cast(result)->set_**map_unsafe(map); > return result; > } > > @@ -3633,7 +3634,7 @@ > if (!maybe_result->To<JSProxy>(&**result)) return maybe_result; > result->InitializeBody(map->**instance_size(), Smi::FromInt(0)); > result->set_handler(handler); > - result->set_hash(undefined_**value()); > + result->set_hash(undefined_**value(), SKIP_WRITE_BARRIER); > return result; > } > > @@ -3657,7 +3658,7 @@ > if (!maybe_result->To<**JSFunctionProxy>(&result)) return maybe_result; > result->InitializeBody(map->**instance_size(), Smi::FromInt(0)); > result->set_handler(handler); > - result->set_hash(undefined_**value()); > + result->set_hash(undefined_**value(), SKIP_WRITE_BARRIER); > result->set_call_trap(call_**trap); > result->set_construct_trap(**construct_trap); > return result; > @@ -3845,7 +3846,7 @@ > // we must NOT fail after this point, where we have changed the type! > > // Reset the map for the object. > - object->set_map(map); > + object->set_map_unsafe(map); > JSObject* jsobj = JSObject::cast(object); > > // Reinitialize the object from the constructor map. > @@ -4044,7 +4045,7 @@ > if (!maybe_result->ToObject(&**result)) return maybe_result; > } > > - reinterpret_cast<HeapObject*>(**result)->set_map(map); > + reinterpret_cast<HeapObject*>(**result)->set_map_unsafe(map); > // Set length and hash fields of the allocated string. > String* answer = String::cast(result); > answer->set_length(chars); > @@ -4088,7 +4089,7 @@ > } > > // Partially initialize the object. > - HeapObject::cast(result)->set_**map(ascii_string_map()); > + HeapObject::cast(result)->set_**map_unsafe(ascii_string_map())**; > String::cast(result)->set_**length(length); > String::cast(result)->set_**hash_field(String::**kEmptyHashField); > ASSERT_EQ(size, HeapObject::cast(result)->**Size()); > @@ -4123,7 +4124,7 @@ > } > > // Partially initialize the object. > - HeapObject::cast(result)->set_**map(string_map()); > + HeapObject::cast(result)->set_**map_unsafe(string_map()); > String::cast(result)->set_**length(length); > String::cast(result)->set_**hash_field(String::**kEmptyHashField); > ASSERT_EQ(size, HeapObject::cast(result)->**Size()); > @@ -4139,7 +4140,7 @@ > if (!maybe_result->ToObject(&**result)) return maybe_result; > } > // Initialize the object. > - reinterpret_cast<FixedArray*>(**result)->set_map(fixed_array_**map()); > + reinterpret_cast<FixedArray*>(**result)->set_map_unsafe(fixed_** > array_map()); > reinterpret_cast<FixedArray*>(**result)->set_length(0); > return result; > } > @@ -4168,13 +4169,13 @@ > } > if (InNewSpace(obj)) { > HeapObject* dst = HeapObject::cast(obj); > - dst->set_map(map); > + dst->set_map_unsafe(map); > CopyBlock(dst->address() + kPointerSize, > src->address() + kPointerSize, > FixedArray::SizeFor(len) - kPointerSize); > return obj; > } > - HeapObject::cast(obj)->set_**map(map); > + HeapObject::cast(obj)->set_**map_unsafe(map); > FixedArray* result = FixedArray::cast(obj); > result->set_length(len); > > @@ -4194,7 +4195,7 @@ > if (!maybe_obj->ToObject(&obj)) return maybe_obj; > } > HeapObject* dst = HeapObject::cast(obj); > - dst->set_map(map); > + dst->set_map_unsafe(map); > CopyBlock( > dst->address() + FixedDoubleArray::**kLengthOffset, > src->address() + FixedDoubleArray::**kLengthOffset, > @@ -4212,7 +4213,7 @@ > } > // Initialize header. > FixedArray* array = reinterpret_cast<FixedArray*>(**result); > - array->set_map(fixed_array_**map()); > + array->set_map_unsafe(fixed_**array_map()); > array->set_length(length); > // Initialize body. > ASSERT(!InNewSpace(undefined_**value())); > @@ -4260,7 +4261,7 @@ > if (!maybe_result->ToObject(&**result)) return maybe_result; > } > > - HeapObject::cast(result)->set_**map(heap->fixed_array_map()); > + HeapObject::cast(result)->set_**map_unsafe(heap->fixed_array_**map()); > FixedArray* array = FixedArray::cast(result); > array->set_length(length); > MemsetPointer(array->data_**start(), filler, length); > @@ -4293,7 +4294,7 @@ > if (!maybe_obj->ToObject(&obj)) return maybe_obj; > } > > - reinterpret_cast<FixedArray*>(**obj)->set_map(fixed_array_map(**)); > + reinterpret_cast<FixedArray*>(**obj)->set_map_unsafe(fixed_** > array_map()); > FixedArray::cast(obj)->set_**length(length); > return obj; > } > @@ -4307,7 +4308,7 @@ > if (!maybe_result->ToObject(&**result)) return maybe_result; > } > // Initialize the object. > - reinterpret_cast<**FixedDoubleArray*>(result)->**set_map( > + reinterpret_cast<**FixedDoubleArray*>(result)->**set_map_unsafe( > fixed_double_array_map()); > reinterpret_cast<**FixedDoubleArray*>(result)->**set_length(0); > return result; > @@ -4324,7 +4325,8 @@ > if (!maybe_obj->ToObject(&obj)) return maybe_obj; > } > > - reinterpret_cast<**FixedDoubleArray*>(obj)->set_** > map(fixed_double_array_map()); > + reinterpret_cast<**FixedDoubleArray*>(obj)->set_**map_unsafe( > + fixed_double_array_map()); > FixedDoubleArray::cast(obj)->**set_length(length); > return obj; > } > @@ -4360,7 +4362,7 @@ > { MaybeObject* maybe_result = AllocateFixedArray(length, pretenure); > if (!maybe_result->ToObject(&**result)) return maybe_result; > } > - reinterpret_cast<HeapObject*>(**result)->set_map(hash_table_**map()); > + reinterpret_cast<HeapObject*>(**result)->set_map_unsafe(hash_** > table_map()); > ASSERT(result->IsHashTable()); > return result; > } > @@ -4373,7 +4375,7 @@ > if (!maybe_result->ToObject(&**result)) return maybe_result; > } > Context* context = reinterpret_cast<Context*>(**result); > - context->set_map(global_**context_map()); > + context->set_map_unsafe(**global_context_map()); > ASSERT(context->**IsGlobalContext()); > ASSERT(result->IsContext()); > return result; > @@ -4387,7 +4389,7 @@ > if (!maybe_result->ToObject(&**result)) return maybe_result; > } > Context* context = reinterpret_cast<Context*>(**result); > - context->set_map(function_**context_map()); > + context->set_map_unsafe(**function_context_map()); > context->set_closure(function)**; > context->set_previous(**function->context()); > context->set_extension(NULL); > @@ -4407,7 +4409,7 @@ > if (!maybe_result->ToObject(&**result)) return maybe_result; > } > Context* context = reinterpret_cast<Context*>(**result); > - context->set_map(catch_**context_map()); > + context->set_map_unsafe(catch_**context_map()); > context->set_closure(function)**; > context->set_previous(**previous); > context->set_extension(name); > @@ -4425,7 +4427,7 @@ > if (!maybe_result->ToObject(&**result)) return maybe_result; > } > Context* context = reinterpret_cast<Context*>(**result); > - context->set_map(with_context_**map()); > + context->set_map_unsafe(with_**context_map()); > context->set_closure(function)**; > context->set_previous(**previous); > context->set_extension(**extension); > @@ -4443,7 +4445,7 @@ > if (!maybe_result->ToObject(&**result)) return maybe_result; > } > Context* context = reinterpret_cast<Context*>(**result); > - context->set_map(block_**context_map()); > + context->set_map_unsafe(block_**context_map()); > context->set_closure(function)**; > context->set_previous(**previous); > context->set_extension(scope_**info); > @@ -4456,7 +4458,7 @@ > FixedArray* scope_info; > MaybeObject* maybe_scope_info = AllocateFixedArray(length, TENURED); > if (!maybe_scope_info->To(&scope_**info)) return maybe_scope_info; > - scope_info->set_map(scope_**info_map()); > + scope_info->set_map_unsafe(**scope_info_map()); > return scope_info; > } > > -- > v8-dev mailing list > [email protected] > http://groups.google.com/**group/v8-dev<http://groups.google.com/group/v8-dev> > -- v8-dev mailing list [email protected] http://groups.google.com/group/v8-dev
