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 3278 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
3289 NORMAL, | 3289 NORMAL, |
3290 details.descriptor_index()); | 3290 details.descriptor_index()); |
3291 Object* value = FastPropertyAt(descs->GetFieldIndex(i)); | 3291 Object* value = FastPropertyAt(descs->GetFieldIndex(i)); |
3292 MaybeObject* maybe_dictionary = | 3292 MaybeObject* maybe_dictionary = |
3293 dictionary->Add(descs->GetKey(i), value, d); | 3293 dictionary->Add(descs->GetKey(i), value, d); |
3294 if (!maybe_dictionary->To(&dictionary)) return maybe_dictionary; | 3294 if (!maybe_dictionary->To(&dictionary)) return maybe_dictionary; |
3295 break; | 3295 break; |
3296 } | 3296 } |
3297 case CALLBACKS: { | 3297 case CALLBACKS: { |
3298 Object* value = descs->GetCallbacksObject(i); | 3298 Object* value = descs->GetCallbacksObject(i); |
| 3299 details = details.set_pointer(0); |
3299 MaybeObject* maybe_dictionary = | 3300 MaybeObject* maybe_dictionary = |
3300 dictionary->Add(descs->GetKey(i), value, details); | 3301 dictionary->Add(descs->GetKey(i), value, details); |
3301 if (!maybe_dictionary->To(&dictionary)) return maybe_dictionary; | 3302 if (!maybe_dictionary->To(&dictionary)) return maybe_dictionary; |
3302 break; | 3303 break; |
3303 } | 3304 } |
3304 case INTERCEPTOR: | 3305 case INTERCEPTOR: |
3305 break; | 3306 break; |
3306 case HANDLER: | 3307 case HANDLER: |
3307 case NORMAL: | 3308 case NORMAL: |
3308 case TRANSITION: | 3309 case TRANSITION: |
(...skipping 8959 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
12268 | 12269 |
12269 return Dictionary<Shape, Key>::cast(obj)->AddEntry(key, value, details, | 12270 return Dictionary<Shape, Key>::cast(obj)->AddEntry(key, value, details, |
12270 Dictionary<Shape, Key>::Hash(key)); | 12271 Dictionary<Shape, Key>::Hash(key)); |
12271 } | 12272 } |
12272 | 12273 |
12273 | 12274 |
12274 template<typename Shape, typename Key> | 12275 template<typename Shape, typename Key> |
12275 MaybeObject* Dictionary<Shape, Key>::Add(Key key, | 12276 MaybeObject* Dictionary<Shape, Key>::Add(Key key, |
12276 Object* value, | 12277 Object* value, |
12277 PropertyDetails details) { | 12278 PropertyDetails details) { |
| 12279 ASSERT(details.dictionary_index() == details.descriptor_index()); |
| 12280 |
12278 // Valdate key is absent. | 12281 // Valdate key is absent. |
12279 SLOW_ASSERT((this->FindEntry(key) == Dictionary<Shape, Key>::kNotFound)); | 12282 SLOW_ASSERT((this->FindEntry(key) == Dictionary<Shape, Key>::kNotFound)); |
12280 // Check whether the dictionary should be extended. | 12283 // Check whether the dictionary should be extended. |
12281 Object* obj; | 12284 Object* obj; |
12282 { MaybeObject* maybe_obj = EnsureCapacity(1, key); | 12285 { MaybeObject* maybe_obj = EnsureCapacity(1, key); |
12283 if (!maybe_obj->ToObject(&obj)) return maybe_obj; | 12286 if (!maybe_obj->ToObject(&obj)) return maybe_obj; |
12284 } | 12287 } |
12285 | 12288 |
12286 return Dictionary<Shape, Key>::cast(obj)->AddEntry(key, value, details, | 12289 return Dictionary<Shape, Key>::cast(obj)->AddEntry(key, value, details, |
12287 Dictionary<Shape, Key>::Hash(key)); | 12290 Dictionary<Shape, Key>::Hash(key)); |
(...skipping 317 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
12605 for (int i = 0; i < capacity; i++) { | 12608 for (int i = 0; i < capacity; i++) { |
12606 Object* k = KeyAt(i); | 12609 Object* k = KeyAt(i); |
12607 if (IsKey(k)) { | 12610 if (IsKey(k)) { |
12608 Object* value = ValueAt(i); | 12611 Object* value = ValueAt(i); |
12609 // Ensure the key is a symbol before writing into the instance descriptor. | 12612 // Ensure the key is a symbol before writing into the instance descriptor. |
12610 String* key; | 12613 String* key; |
12611 MaybeObject* maybe_key = heap->LookupSymbol(String::cast(k)); | 12614 MaybeObject* maybe_key = heap->LookupSymbol(String::cast(k)); |
12612 if (!maybe_key->To(&key)) return maybe_key; | 12615 if (!maybe_key->To(&key)) return maybe_key; |
12613 | 12616 |
12614 PropertyDetails details = DetailsAt(i); | 12617 PropertyDetails details = DetailsAt(i); |
12615 int enumeration_index = details.dictionary_index(); | 12618 ASSERT(details.descriptor_index() == details.dictionary_index()); |
| 12619 int enumeration_index = details.descriptor_index(); |
12616 PropertyType type = details.type(); | 12620 PropertyType type = details.type(); |
12617 | 12621 |
12618 if (value->IsJSFunction() && !heap->InNewSpace(value)) { | 12622 if (value->IsJSFunction() && !heap->InNewSpace(value)) { |
12619 ConstantFunctionDescriptor d(key, | 12623 ConstantFunctionDescriptor d(key, |
12620 JSFunction::cast(value), | 12624 JSFunction::cast(value), |
12621 details.attributes(), | 12625 details.attributes(), |
12622 enumeration_index); | 12626 enumeration_index); |
12623 descriptors->Set(enumeration_index - 1, &d, witness); | 12627 descriptors->Set(enumeration_index - 1, &d, witness); |
12624 } else if (type == NORMAL) { | 12628 } else if (type == NORMAL) { |
12625 if (current_offset < inobject_props) { | 12629 if (current_offset < inobject_props) { |
(...skipping 538 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
13164 set_year(Smi::FromInt(year), SKIP_WRITE_BARRIER); | 13168 set_year(Smi::FromInt(year), SKIP_WRITE_BARRIER); |
13165 set_month(Smi::FromInt(month), SKIP_WRITE_BARRIER); | 13169 set_month(Smi::FromInt(month), SKIP_WRITE_BARRIER); |
13166 set_day(Smi::FromInt(day), SKIP_WRITE_BARRIER); | 13170 set_day(Smi::FromInt(day), SKIP_WRITE_BARRIER); |
13167 set_weekday(Smi::FromInt(weekday), SKIP_WRITE_BARRIER); | 13171 set_weekday(Smi::FromInt(weekday), SKIP_WRITE_BARRIER); |
13168 set_hour(Smi::FromInt(hour), SKIP_WRITE_BARRIER); | 13172 set_hour(Smi::FromInt(hour), SKIP_WRITE_BARRIER); |
13169 set_min(Smi::FromInt(min), SKIP_WRITE_BARRIER); | 13173 set_min(Smi::FromInt(min), SKIP_WRITE_BARRIER); |
13170 set_sec(Smi::FromInt(sec), SKIP_WRITE_BARRIER); | 13174 set_sec(Smi::FromInt(sec), SKIP_WRITE_BARRIER); |
13171 } | 13175 } |
13172 | 13176 |
13173 } } // namespace v8::internal | 13177 } } // namespace v8::internal |
OLD | NEW |