| OLD | NEW |
| 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 132 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 143 | 143 |
| 144 int field_index() { | 144 int field_index() { |
| 145 ASSERT(is_field_index()); | 145 ASSERT(is_field_index()); |
| 146 return value(); | 146 return value(); |
| 147 } | 147 } |
| 148 int header_index() { | 148 int header_index() { |
| 149 ASSERT(is_header_index()); | 149 ASSERT(is_header_index()); |
| 150 return value(); | 150 return value(); |
| 151 } | 151 } |
| 152 | 152 |
| 153 bool is_inobject(Handle<JSObject> holder) { | 153 bool is_inobject(Map* map) { |
| 154 if (is_header_index()) return true; | 154 if (is_header_index()) return true; |
| 155 return field_index() < holder->map()->inobject_properties(); | 155 return field_index() < map->inobject_properties(); |
| 156 } | 156 } |
| 157 | 157 |
| 158 int translate(Handle<JSObject> holder) { | 158 int translate(Map* map) { |
| 159 if (is_header_index()) return header_index(); | 159 if (is_header_index()) return header_index(); |
| 160 int index = field_index() - holder->map()->inobject_properties(); | 160 int index = field_index() - map->inobject_properties(); |
| 161 if (index >= 0) return index; | 161 if (index >= 0) return index; |
| 162 return index + holder->map()->instance_size() / kPointerSize; | 162 return index + map->instance_size() / kPointerSize; |
| 163 } | 163 } |
| 164 | 164 |
| 165 private: | 165 private: |
| 166 static const int kHeaderIndexBit = 1 << 31; | 166 static const int kHeaderIndexBit = 1 << 31; |
| 167 static const int kIndexMask = ~kHeaderIndexBit; | 167 static const int kIndexMask = ~kHeaderIndexBit; |
| 168 | 168 |
| 169 int value() { return index_ & kIndexMask; } | 169 int value() { return index_ & kIndexMask; } |
| 170 | 170 |
| 171 PropertyIndex(int index, bool is_header_based) | 171 PropertyIndex(int index, bool is_header_based) |
| 172 : index_(index | (is_header_based ? kHeaderIndexBit : 0)) { | 172 : index_(index | (is_header_based ? kHeaderIndexBit : 0)) { |
| (...skipping 330 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 503 JSReceiver* holder_; | 503 JSReceiver* holder_; |
| 504 int number_; | 504 int number_; |
| 505 bool cacheable_; | 505 bool cacheable_; |
| 506 PropertyDetails details_; | 506 PropertyDetails details_; |
| 507 }; | 507 }; |
| 508 | 508 |
| 509 | 509 |
| 510 } } // namespace v8::internal | 510 } } // namespace v8::internal |
| 511 | 511 |
| 512 #endif // V8_PROPERTY_H_ | 512 #endif // V8_PROPERTY_H_ |
| OLD | NEW |