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

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

Issue 218753005: Replace set_map_and_elements by MigrateToMap-based SetMapAndElements (Closed) Base URL: https://v8.googlecode.com/svn/branches/bleeding_edge
Patch Set: Addressed comment Created 6 years, 8 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 1680 matching lines...) Expand 10 before | Expand all | Expand 10 after
1691 if (maybe_transitioned_map->IsMap()) { 1691 if (maybe_transitioned_map->IsMap()) {
1692 return Map::cast(maybe_transitioned_map); 1692 return Map::cast(maybe_transitioned_map);
1693 } 1693 }
1694 } 1694 }
1695 } 1695 }
1696 1696
1697 return GetElementsTransitionMapSlow(to_kind); 1697 return GetElementsTransitionMapSlow(to_kind);
1698 } 1698 }
1699 1699
1700 1700
1701 void JSObject::set_map_and_elements(Map* new_map, 1701 void JSObject::SetMapAndElements(Handle<JSObject> object,
1702 FixedArrayBase* value, 1702 Handle<Map> new_map,
1703 WriteBarrierMode mode) { 1703 Handle<FixedArrayBase> value) {
1704 ASSERT(value->HasValidElements()); 1704 JSObject::MigrateToMap(object, new_map);
1705 if (new_map != NULL) { 1705 ASSERT((object->map()->has_fast_smi_or_object_elements() ||
1706 if (mode == UPDATE_WRITE_BARRIER) { 1706 (*value == object->GetHeap()->empty_fixed_array())) ==
1707 set_map(new_map); 1707 (value->map() == object->GetHeap()->fixed_array_map() ||
1708 } else { 1708 value->map() == object->GetHeap()->fixed_cow_array_map()));
1709 ASSERT(mode == SKIP_WRITE_BARRIER); 1709 ASSERT((*value == object->GetHeap()->empty_fixed_array()) ||
1710 set_map_no_write_barrier(new_map); 1710 (object->map()->has_fast_double_elements() ==
1711 } 1711 value->IsFixedDoubleArray()));
1712 } 1712 object->set_elements(*value);
1713 ASSERT((map()->has_fast_smi_or_object_elements() || 1713 }
1714 (value == GetHeap()->empty_fixed_array())) == 1714
1715 (value->map() == GetHeap()->fixed_array_map() || 1715
1716 value->map() == GetHeap()->fixed_cow_array_map())); 1716 void JSObject::set_elements(FixedArrayBase* value, WriteBarrierMode mode) {
1717 ASSERT((value == GetHeap()->empty_fixed_array()) ||
1718 (map()->has_fast_double_elements() == value->IsFixedDoubleArray()));
1719 WRITE_FIELD(this, kElementsOffset, value); 1717 WRITE_FIELD(this, kElementsOffset, value);
1720 CONDITIONAL_WRITE_BARRIER(GetHeap(), this, kElementsOffset, value, mode); 1718 CONDITIONAL_WRITE_BARRIER(GetHeap(), this, kElementsOffset, value, mode);
1721 } 1719 }
1722 1720
1723 1721
1724 void JSObject::set_elements(FixedArrayBase* value, WriteBarrierMode mode) {
1725 set_map_and_elements(NULL, value, mode);
1726 }
1727
1728
1729 void JSObject::initialize_properties() { 1722 void JSObject::initialize_properties() {
1730 ASSERT(!GetHeap()->InNewSpace(GetHeap()->empty_fixed_array())); 1723 ASSERT(!GetHeap()->InNewSpace(GetHeap()->empty_fixed_array()));
1731 WRITE_FIELD(this, kPropertiesOffset, GetHeap()->empty_fixed_array()); 1724 WRITE_FIELD(this, kPropertiesOffset, GetHeap()->empty_fixed_array());
1732 } 1725 }
1733 1726
1734 1727
1735 void JSObject::initialize_elements() { 1728 void JSObject::initialize_elements() {
1736 if (map()->has_fast_smi_or_object_elements() || 1729 if (map()->has_fast_smi_or_object_elements() ||
1737 map()->has_fast_double_elements()) { 1730 map()->has_fast_double_elements()) {
1738 ASSERT(!GetHeap()->InNewSpace(GetHeap()->empty_fixed_array())); 1731 ASSERT(!GetHeap()->InNewSpace(GetHeap()->empty_fixed_array()));
(...skipping 5154 matching lines...) Expand 10 before | Expand all | Expand 10 after
6893 #undef READ_UINT32_FIELD 6886 #undef READ_UINT32_FIELD
6894 #undef WRITE_UINT32_FIELD 6887 #undef WRITE_UINT32_FIELD
6895 #undef READ_SHORT_FIELD 6888 #undef READ_SHORT_FIELD
6896 #undef WRITE_SHORT_FIELD 6889 #undef WRITE_SHORT_FIELD
6897 #undef READ_BYTE_FIELD 6890 #undef READ_BYTE_FIELD
6898 #undef WRITE_BYTE_FIELD 6891 #undef WRITE_BYTE_FIELD
6899 6892
6900 } } // namespace v8::internal 6893 } } // namespace v8::internal
6901 6894
6902 #endif // V8_OBJECTS_INL_H_ 6895 #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