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 13474 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
13485 return Shrink(key); | 13485 return Shrink(key); |
13486 } | 13486 } |
13487 | 13487 |
13488 // Key is already in table, just overwrite value. | 13488 // Key is already in table, just overwrite value. |
13489 if (entry != kNotFound) { | 13489 if (entry != kNotFound) { |
13490 set(EntryToIndex(entry) + 1, value); | 13490 set(EntryToIndex(entry) + 1, value); |
13491 return this; | 13491 return this; |
13492 } | 13492 } |
13493 | 13493 |
13494 // Check whether the hash table should be extended. | 13494 // Check whether the hash table should be extended. |
13495 Object* obj; | 13495 ObjectHashTable* table; |
13496 { MaybeObject* maybe_obj = EnsureCapacity(1, key); | 13496 { MaybeObject* maybe_obj = EnsureCapacity(1, key); |
13497 if (!maybe_obj->ToObject(&obj)) return maybe_obj; | 13497 if (!maybe_obj->To(&table)) return maybe_obj; |
13498 } | 13498 } |
13499 ObjectHashTable* table = ObjectHashTable::cast(obj); | |
13500 table->AddEntry(table->FindInsertionEntry(hash), key, value); | 13499 table->AddEntry(table->FindInsertionEntry(hash), key, value); |
13501 return table; | 13500 return table; |
13502 } | 13501 } |
13503 | 13502 |
13504 | 13503 |
13505 void ObjectHashTable::AddEntry(int entry, Object* key, Object* value) { | 13504 void ObjectHashTable::AddEntry(int entry, Object* key, Object* value) { |
13506 set(EntryToIndex(entry), key); | 13505 set(EntryToIndex(entry), key); |
13507 set(EntryToIndex(entry) + 1, value); | 13506 set(EntryToIndex(entry) + 1, value); |
13508 ElementAdded(); | 13507 ElementAdded(); |
13509 } | 13508 } |
(...skipping 382 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
13892 set_year(Smi::FromInt(year), SKIP_WRITE_BARRIER); | 13891 set_year(Smi::FromInt(year), SKIP_WRITE_BARRIER); |
13893 set_month(Smi::FromInt(month), SKIP_WRITE_BARRIER); | 13892 set_month(Smi::FromInt(month), SKIP_WRITE_BARRIER); |
13894 set_day(Smi::FromInt(day), SKIP_WRITE_BARRIER); | 13893 set_day(Smi::FromInt(day), SKIP_WRITE_BARRIER); |
13895 set_weekday(Smi::FromInt(weekday), SKIP_WRITE_BARRIER); | 13894 set_weekday(Smi::FromInt(weekday), SKIP_WRITE_BARRIER); |
13896 set_hour(Smi::FromInt(hour), SKIP_WRITE_BARRIER); | 13895 set_hour(Smi::FromInt(hour), SKIP_WRITE_BARRIER); |
13897 set_min(Smi::FromInt(min), SKIP_WRITE_BARRIER); | 13896 set_min(Smi::FromInt(min), SKIP_WRITE_BARRIER); |
13898 set_sec(Smi::FromInt(sec), SKIP_WRITE_BARRIER); | 13897 set_sec(Smi::FromInt(sec), SKIP_WRITE_BARRIER); |
13899 } | 13898 } |
13900 | 13899 |
13901 } } // namespace v8::internal | 13900 } } // namespace v8::internal |
OLD | NEW |