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

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

Issue 149063010: Remake of the load elimination fix made earlier (r18884). (Closed) Base URL: https://v8.googlecode.com/svn/branches/bleeding_edge
Patch Set: Rebasing on r19056. Created 6 years, 10 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.h ('k') | no next file » | 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 1950 matching lines...) Expand 10 before | Expand all | Expand 10 after
1961 WRITE_FIELD(this, offset, value); 1961 WRITE_FIELD(this, offset, value);
1962 WRITE_BARRIER(GetHeap(), this, offset, value); 1962 WRITE_BARRIER(GetHeap(), this, offset, value);
1963 } else { 1963 } else {
1964 ASSERT(index < properties()->length()); 1964 ASSERT(index < properties()->length());
1965 properties()->set(index, value); 1965 properties()->set(index, value);
1966 } 1966 }
1967 } 1967 }
1968 1968
1969 1969
1970 int JSObject::GetInObjectPropertyOffset(int index) { 1970 int JSObject::GetInObjectPropertyOffset(int index) {
1971 // Adjust for the number of properties stored in the object. 1971 return map()->GetInObjectPropertyOffset(index);
1972 index -= map()->inobject_properties();
1973 ASSERT(index < 0);
1974 return map()->instance_size() + (index * kPointerSize);
1975 } 1972 }
1976 1973
1977 1974
1978 Object* JSObject::InObjectPropertyAt(int index) { 1975 Object* JSObject::InObjectPropertyAt(int index) {
1979 // Adjust for the number of properties stored in the object. 1976 int offset = GetInObjectPropertyOffset(index);
1980 index -= map()->inobject_properties();
1981 ASSERT(index < 0);
1982 int offset = map()->instance_size() + (index * kPointerSize);
1983 return READ_FIELD(this, offset); 1977 return READ_FIELD(this, offset);
1984 } 1978 }
1985 1979
1986 1980
1987 Object* JSObject::InObjectPropertyAtPut(int index, 1981 Object* JSObject::InObjectPropertyAtPut(int index,
1988 Object* value, 1982 Object* value,
1989 WriteBarrierMode mode) { 1983 WriteBarrierMode mode) {
1990 // Adjust for the number of properties stored in the object. 1984 // Adjust for the number of properties stored in the object.
1991 index -= map()->inobject_properties(); 1985 int offset = GetInObjectPropertyOffset(index);
1992 ASSERT(index < 0);
1993 int offset = map()->instance_size() + (index * kPointerSize);
1994 WRITE_FIELD(this, offset, value); 1986 WRITE_FIELD(this, offset, value);
1995 CONDITIONAL_WRITE_BARRIER(GetHeap(), this, offset, value, mode); 1987 CONDITIONAL_WRITE_BARRIER(GetHeap(), this, offset, value, mode);
1996 return value; 1988 return value;
1997 } 1989 }
1998 1990
1999 1991
2000 1992
2001 void JSObject::InitializeBody(Map* map, 1993 void JSObject::InitializeBody(Map* map,
2002 Object* pre_allocated_value, 1994 Object* pre_allocated_value,
2003 Object* filler_value) { 1995 Object* filler_value) {
(...skipping 1797 matching lines...) Expand 10 before | Expand all | Expand 10 after
3801 int Map::inobject_properties() { 3793 int Map::inobject_properties() {
3802 return READ_BYTE_FIELD(this, kInObjectPropertiesOffset); 3794 return READ_BYTE_FIELD(this, kInObjectPropertiesOffset);
3803 } 3795 }
3804 3796
3805 3797
3806 int Map::pre_allocated_property_fields() { 3798 int Map::pre_allocated_property_fields() {
3807 return READ_BYTE_FIELD(this, kPreAllocatedPropertyFieldsOffset); 3799 return READ_BYTE_FIELD(this, kPreAllocatedPropertyFieldsOffset);
3808 } 3800 }
3809 3801
3810 3802
3803 int Map::GetInObjectPropertyOffset(int index) {
3804 // Adjust for the number of properties stored in the object.
3805 index -= inobject_properties();
3806 ASSERT(index < 0);
3807 return instance_size() + (index * kPointerSize);
3808 }
3809
3810
3811 int HeapObject::SizeFromMap(Map* map) { 3811 int HeapObject::SizeFromMap(Map* map) {
3812 int instance_size = map->instance_size(); 3812 int instance_size = map->instance_size();
3813 if (instance_size != kVariableSizeSentinel) return instance_size; 3813 if (instance_size != kVariableSizeSentinel) return instance_size;
3814 // Only inline the most frequent cases. 3814 // Only inline the most frequent cases.
3815 int instance_type = static_cast<int>(map->instance_type()); 3815 int instance_type = static_cast<int>(map->instance_type());
3816 if (instance_type == FIXED_ARRAY_TYPE) { 3816 if (instance_type == FIXED_ARRAY_TYPE) {
3817 return FixedArray::BodyDescriptor::SizeOf(map, this); 3817 return FixedArray::BodyDescriptor::SizeOf(map, this);
3818 } 3818 }
3819 if (instance_type == ASCII_STRING_TYPE || 3819 if (instance_type == ASCII_STRING_TYPE ||
3820 instance_type == ASCII_INTERNALIZED_STRING_TYPE) { 3820 instance_type == ASCII_INTERNALIZED_STRING_TYPE) {
(...skipping 2960 matching lines...) Expand 10 before | Expand all | Expand 10 after
6781 #undef READ_UINT32_FIELD 6781 #undef READ_UINT32_FIELD
6782 #undef WRITE_UINT32_FIELD 6782 #undef WRITE_UINT32_FIELD
6783 #undef READ_SHORT_FIELD 6783 #undef READ_SHORT_FIELD
6784 #undef WRITE_SHORT_FIELD 6784 #undef WRITE_SHORT_FIELD
6785 #undef READ_BYTE_FIELD 6785 #undef READ_BYTE_FIELD
6786 #undef WRITE_BYTE_FIELD 6786 #undef WRITE_BYTE_FIELD
6787 6787
6788 } } // namespace v8::internal 6788 } } // namespace v8::internal
6789 6789
6790 #endif // V8_OBJECTS_INL_H_ 6790 #endif // V8_OBJECTS_INL_H_
OLDNEW
« no previous file with comments | « src/objects.h ('k') | no next file » | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698