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

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

Issue 10066046: Tiny DescriptorArray cleanup. (Closed) Base URL: https://v8.googlecode.com/svn/branches/bleeding_edge
Patch Set: Fixed copyright year Created 8 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/property.h » ('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 1915 matching lines...) Expand 10 before | Expand all | Expand 10 after
1926 return String::cast(get(ToKeyIndex(descriptor_number))); 1926 return String::cast(get(ToKeyIndex(descriptor_number)));
1927 } 1927 }
1928 1928
1929 1929
1930 Object* DescriptorArray::GetValue(int descriptor_number) { 1930 Object* DescriptorArray::GetValue(int descriptor_number) {
1931 ASSERT(descriptor_number < number_of_descriptors()); 1931 ASSERT(descriptor_number < number_of_descriptors());
1932 return GetContentArray()->get(ToValueIndex(descriptor_number)); 1932 return GetContentArray()->get(ToValueIndex(descriptor_number));
1933 } 1933 }
1934 1934
1935 1935
1936 Smi* DescriptorArray::GetDetails(int descriptor_number) { 1936 PropertyDetails DescriptorArray::GetDetails(int descriptor_number) {
1937 ASSERT(descriptor_number < number_of_descriptors()); 1937 ASSERT(descriptor_number < number_of_descriptors());
1938 return Smi::cast(GetContentArray()->get(ToDetailsIndex(descriptor_number))); 1938 Object* details = GetContentArray()->get(ToDetailsIndex(descriptor_number));
1939 return PropertyDetails(Smi::cast(details));
1939 } 1940 }
1940 1941
1941 1942
1942 PropertyType DescriptorArray::GetType(int descriptor_number) { 1943 PropertyType DescriptorArray::GetType(int descriptor_number) {
1943 ASSERT(descriptor_number < number_of_descriptors()); 1944 return GetDetails(descriptor_number).type();
1944 return PropertyDetails(GetDetails(descriptor_number)).type();
1945 } 1945 }
1946 1946
1947 1947
1948 int DescriptorArray::GetFieldIndex(int descriptor_number) { 1948 int DescriptorArray::GetFieldIndex(int descriptor_number) {
1949 return Descriptor::IndexFromValue(GetValue(descriptor_number)); 1949 return Descriptor::IndexFromValue(GetValue(descriptor_number));
1950 } 1950 }
1951 1951
1952 1952
1953 JSFunction* DescriptorArray::GetConstantFunction(int descriptor_number) { 1953 JSFunction* DescriptorArray::GetConstantFunction(int descriptor_number) {
1954 return JSFunction::cast(GetValue(descriptor_number)); 1954 return JSFunction::cast(GetValue(descriptor_number));
(...skipping 42 matching lines...) Expand 10 before | Expand all | Expand 10 after
1997 UNREACHABLE(); // Keep the compiler happy. 1997 UNREACHABLE(); // Keep the compiler happy.
1998 return false; 1998 return false;
1999 } 1999 }
2000 2000
2001 2001
2002 bool DescriptorArray::IsNullDescriptor(int descriptor_number) { 2002 bool DescriptorArray::IsNullDescriptor(int descriptor_number) {
2003 return GetType(descriptor_number) == NULL_DESCRIPTOR; 2003 return GetType(descriptor_number) == NULL_DESCRIPTOR;
2004 } 2004 }
2005 2005
2006 2006
2007 bool DescriptorArray::IsDontEnum(int descriptor_number) {
2008 return PropertyDetails(GetDetails(descriptor_number)).IsDontEnum();
2009 }
2010
2011
2012 void DescriptorArray::Get(int descriptor_number, Descriptor* desc) { 2007 void DescriptorArray::Get(int descriptor_number, Descriptor* desc) {
2013 desc->Init(GetKey(descriptor_number), 2008 desc->Init(GetKey(descriptor_number),
2014 GetValue(descriptor_number), 2009 GetValue(descriptor_number),
2015 PropertyDetails(GetDetails(descriptor_number))); 2010 GetDetails(descriptor_number));
2016 } 2011 }
2017 2012
2018 2013
2019 void DescriptorArray::Set(int descriptor_number, 2014 void DescriptorArray::Set(int descriptor_number,
2020 Descriptor* desc, 2015 Descriptor* desc,
2021 const WhitenessWitness&) { 2016 const WhitenessWitness&) {
2022 // Range check. 2017 // Range check.
2023 ASSERT(descriptor_number < number_of_descriptors()); 2018 ASSERT(descriptor_number < number_of_descriptors());
2024 2019
2025 NoIncrementalWriteBarrierSet(this, 2020 NoIncrementalWriteBarrierSet(this,
(...skipping 2921 matching lines...) Expand 10 before | Expand all | Expand 10 after
4947 #undef WRITE_UINT32_FIELD 4942 #undef WRITE_UINT32_FIELD
4948 #undef READ_SHORT_FIELD 4943 #undef READ_SHORT_FIELD
4949 #undef WRITE_SHORT_FIELD 4944 #undef WRITE_SHORT_FIELD
4950 #undef READ_BYTE_FIELD 4945 #undef READ_BYTE_FIELD
4951 #undef WRITE_BYTE_FIELD 4946 #undef WRITE_BYTE_FIELD
4952 4947
4953 4948
4954 } } // namespace v8::internal 4949 } } // namespace v8::internal
4955 4950
4956 #endif // V8_OBJECTS_INL_H_ 4951 #endif // V8_OBJECTS_INL_H_
OLDNEW
« no previous file with comments | « src/objects.cc ('k') | src/property.h » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698