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

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

Issue 15941016: Move field index into property details, freeing up the value slot of fields. (Closed) Base URL: https://v8.googlecode.com/svn/branches/bleeding_edge
Patch Set: Addressed comments Created 7 years, 6 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 40 matching lines...) Expand 10 before | Expand all | Expand 10 after
51 51
52 namespace v8 { 52 namespace v8 {
53 namespace internal { 53 namespace internal {
54 54
55 PropertyDetails::PropertyDetails(Smi* smi) { 55 PropertyDetails::PropertyDetails(Smi* smi) {
56 value_ = smi->value(); 56 value_ = smi->value();
57 } 57 }
58 58
59 59
60 Smi* PropertyDetails::AsSmi() { 60 Smi* PropertyDetails::AsSmi() {
61 return Smi::FromInt(value_); 61 // Ensure the upper 2 bits have the same value by sign extending it. This is
62 // necessary to be able to use the 31st bit of the property details.
63 int value = value_ << 1;
64 return Smi::FromInt(value >> 1);
62 } 65 }
63 66
64 67
65 PropertyDetails PropertyDetails::AsDeleted() { 68 PropertyDetails PropertyDetails::AsDeleted() {
66 Smi* smi = Smi::FromInt(value_ | DeletedField::encode(1)); 69 Smi* smi = Smi::FromInt(value_ | DeletedField::encode(1));
67 return PropertyDetails(smi); 70 return PropertyDetails(smi);
68 } 71 }
69 72
70 73
71 #define TYPE_CHECKER(type, instancetype) \ 74 #define TYPE_CHECKER(type, instancetype) \
(...skipping 2248 matching lines...) Expand 10 before | Expand all | Expand 10 after
2320 return PropertyDetails(Smi::cast(details)); 2323 return PropertyDetails(Smi::cast(details));
2321 } 2324 }
2322 2325
2323 2326
2324 PropertyType DescriptorArray::GetType(int descriptor_number) { 2327 PropertyType DescriptorArray::GetType(int descriptor_number) {
2325 return GetDetails(descriptor_number).type(); 2328 return GetDetails(descriptor_number).type();
2326 } 2329 }
2327 2330
2328 2331
2329 int DescriptorArray::GetFieldIndex(int descriptor_number) { 2332 int DescriptorArray::GetFieldIndex(int descriptor_number) {
2330 return Descriptor::IndexFromValue(GetValue(descriptor_number)); 2333 return GetDetails(descriptor_number).field_index();
2331 } 2334 }
2332 2335
2333 2336
2334 JSFunction* DescriptorArray::GetConstantFunction(int descriptor_number) { 2337 JSFunction* DescriptorArray::GetConstantFunction(int descriptor_number) {
2335 return JSFunction::cast(GetValue(descriptor_number)); 2338 return JSFunction::cast(GetValue(descriptor_number));
2336 } 2339 }
2337 2340
2338 2341
2339 Object* DescriptorArray::GetCallbacksObject(int descriptor_number) { 2342 Object* DescriptorArray::GetCallbacksObject(int descriptor_number) {
2340 ASSERT(GetType(descriptor_number) == CALLBACKS); 2343 ASSERT(GetType(descriptor_number) == CALLBACKS);
(...skipping 3876 matching lines...) Expand 10 before | Expand all | Expand 10 after
6217 #undef WRITE_UINT32_FIELD 6220 #undef WRITE_UINT32_FIELD
6218 #undef READ_SHORT_FIELD 6221 #undef READ_SHORT_FIELD
6219 #undef WRITE_SHORT_FIELD 6222 #undef WRITE_SHORT_FIELD
6220 #undef READ_BYTE_FIELD 6223 #undef READ_BYTE_FIELD
6221 #undef WRITE_BYTE_FIELD 6224 #undef WRITE_BYTE_FIELD
6222 6225
6223 6226
6224 } } // namespace v8::internal 6227 } } // namespace v8::internal
6225 6228
6226 #endif // V8_OBJECTS_INL_H_ 6229 #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