Chromium Code Reviews
chromiumcodereview-hr@appspot.gserviceaccount.com (chromiumcodereview-hr) | Please choose your nickname with Settings | Help | Chromium Project | Gerrit Changes | Sign out
(895)

Side by Side Diff: src/objects-inl.h

Issue 10780031: Grouping all map creation code. (Closed) Base URL: https://v8.googlecode.com/svn/branches/bleeding_edge
Patch Set: Addressing comments Created 8 years, 5 months ago
Use n/p to move between diff chunks; N/P to move between comments. Draft comments are only viewable by you.
Jump to:
View unified diff | Download patch | Annotate | Revision Log
« no previous file with comments | « src/objects.cc ('k') | src/runtime.cc » ('j') | no next file with comments »
Toggle Intra-line Diffs ('i') | Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
OLDNEW
1 // Copyright 2012 the V8 project authors. All rights reserved. 1 // Copyright 2012 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 3635 matching lines...) Expand 10 before | Expand all | Expand 10 after
3646 ASSERT(undefined->IsUndefined()); 3646 ASSERT(undefined->IsUndefined());
3647 WRITE_FIELD(this, kInstanceDescriptorsOrBackPointerOffset, undefined); 3647 WRITE_FIELD(this, kInstanceDescriptorsOrBackPointerOffset, undefined);
3648 } 3648 }
3649 3649
3650 3650
3651 void Map::SetBackPointer(Object* value, WriteBarrierMode mode) { 3651 void Map::SetBackPointer(Object* value, WriteBarrierMode mode) {
3652 ASSERT(instance_type() >= FIRST_JS_RECEIVER_TYPE); 3652 ASSERT(instance_type() >= FIRST_JS_RECEIVER_TYPE);
3653 ASSERT((value->IsUndefined() && GetBackPointer()->IsMap()) || 3653 ASSERT((value->IsUndefined() && GetBackPointer()->IsMap()) ||
3654 (value->IsMap() && GetBackPointer()->IsUndefined())); 3654 (value->IsMap() && GetBackPointer()->IsUndefined()));
3655 Object* object = READ_FIELD(this, kInstanceDescriptorsOrBackPointerOffset); 3655 Object* object = READ_FIELD(this, kInstanceDescriptorsOrBackPointerOffset);
3656 if (object->IsMap()) { 3656 if (object->IsDescriptorArray()) {
3657 DescriptorArray::cast(object)->set_back_pointer_storage(value);
3658 } else {
3657 WRITE_FIELD(this, kInstanceDescriptorsOrBackPointerOffset, value); 3659 WRITE_FIELD(this, kInstanceDescriptorsOrBackPointerOffset, value);
3658 CONDITIONAL_WRITE_BARRIER( 3660 CONDITIONAL_WRITE_BARRIER(
3659 GetHeap(), this, kInstanceDescriptorsOrBackPointerOffset, value, mode); 3661 GetHeap(), this, kInstanceDescriptorsOrBackPointerOffset, value, mode);
3660 } else {
3661 DescriptorArray::cast(object)->set_back_pointer_storage(value);
3662 } 3662 }
3663 } 3663 }
3664 3664
3665 3665
3666 // Can either be Smi (no transitions), normal transition array, or a transition 3666 // Can either be Smi (no transitions), normal transition array, or a transition
3667 // array with the header overwritten as a Smi (thus iterating). 3667 // array with the header overwritten as a Smi (thus iterating).
3668 TransitionArray* Map::unchecked_transition_array() { 3668 TransitionArray* Map::unchecked_transition_array() {
3669 ASSERT(HasTransitionArray()); 3669 ASSERT(HasTransitionArray());
3670 Object* object = *HeapObject::RawField(instance_descriptors(), 3670 Object* object = *HeapObject::RawField(instance_descriptors(),
3671 DescriptorArray::kTransitionsOffset); 3671 DescriptorArray::kTransitionsOffset);
(...skipping 622 matching lines...) Expand 10 before | Expand all | Expand 10 after
4294 4294
4295 Map* current_map = initial_map; 4295 Map* current_map = initial_map;
4296 ElementsKind kind = current_map->elements_kind(); 4296 ElementsKind kind = current_map->elements_kind();
4297 ASSERT(kind == GetInitialFastElementsKind()); 4297 ASSERT(kind == GetInitialFastElementsKind());
4298 maps->set(kind, current_map); 4298 maps->set(kind, current_map);
4299 for (int i = GetSequenceIndexFromFastElementsKind(kind) + 1; 4299 for (int i = GetSequenceIndexFromFastElementsKind(kind) + 1;
4300 i < kFastElementsKindCount; ++i) { 4300 i < kFastElementsKindCount; ++i) {
4301 Map* new_map; 4301 Map* new_map;
4302 ElementsKind next_kind = GetFastElementsKindFromSequenceIndex(i); 4302 ElementsKind next_kind = GetFastElementsKindFromSequenceIndex(i);
4303 MaybeObject* maybe_new_map = 4303 MaybeObject* maybe_new_map =
4304 current_map->CreateNextElementsTransition(next_kind); 4304 current_map->CopyAsElementsKind(next_kind, INSERT_TRANSITION);
4305 if (!maybe_new_map->To(&new_map)) return maybe_new_map; 4305 if (!maybe_new_map->To(&new_map)) return maybe_new_map;
4306 maps->set(next_kind, new_map); 4306 maps->set(next_kind, new_map);
4307 current_map = new_map; 4307 current_map = new_map;
4308 } 4308 }
4309 global_context->set_js_array_maps(maps); 4309 global_context->set_js_array_maps(maps);
4310 } 4310 }
4311 set_initial_map(initial_map); 4311 set_initial_map(initial_map);
4312 return this; 4312 return this;
4313 } 4313 }
4314 4314
(...skipping 1007 matching lines...) Expand 10 before | Expand all | Expand 10 after
5322 #undef WRITE_UINT32_FIELD 5322 #undef WRITE_UINT32_FIELD
5323 #undef READ_SHORT_FIELD 5323 #undef READ_SHORT_FIELD
5324 #undef WRITE_SHORT_FIELD 5324 #undef WRITE_SHORT_FIELD
5325 #undef READ_BYTE_FIELD 5325 #undef READ_BYTE_FIELD
5326 #undef WRITE_BYTE_FIELD 5326 #undef WRITE_BYTE_FIELD
5327 5327
5328 5328
5329 } } // namespace v8::internal 5329 } } // namespace v8::internal
5330 5330
5331 #endif // V8_OBJECTS_INL_H_ 5331 #endif // V8_OBJECTS_INL_H_
OLDNEW
« no previous file with comments | « src/objects.cc ('k') | src/runtime.cc » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698