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 11564 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
11575 | 11575 |
11576 template<typename Shape, typename Key> | 11576 template<typename Shape, typename Key> |
11577 MaybeObject* HashTable<Shape, Key>::Allocate(int at_least_space_for, | 11577 MaybeObject* HashTable<Shape, Key>::Allocate(int at_least_space_for, |
11578 MinimumCapacity capacity_option, | 11578 MinimumCapacity capacity_option, |
11579 PretenureFlag pretenure) { | 11579 PretenureFlag pretenure) { |
11580 ASSERT(!capacity_option || IS_POWER_OF_TWO(at_least_space_for)); | 11580 ASSERT(!capacity_option || IS_POWER_OF_TWO(at_least_space_for)); |
11581 int capacity = (capacity_option == USE_CUSTOM_MINIMUM_CAPACITY) | 11581 int capacity = (capacity_option == USE_CUSTOM_MINIMUM_CAPACITY) |
11582 ? at_least_space_for | 11582 ? at_least_space_for |
11583 : ComputeCapacity(at_least_space_for); | 11583 : ComputeCapacity(at_least_space_for); |
11584 if (capacity > HashTable::kMaxCapacity) { | 11584 if (capacity > HashTable::kMaxCapacity) { |
11585 return Failure::OutOfMemoryException(); | 11585 return Failure::OutOfMemoryException(0x10); |
11586 } | 11586 } |
11587 | 11587 |
11588 Object* obj; | 11588 Object* obj; |
11589 { MaybeObject* maybe_obj = Isolate::Current()->heap()-> | 11589 { MaybeObject* maybe_obj = Isolate::Current()->heap()-> |
11590 AllocateHashTable(EntryToIndex(capacity), pretenure); | 11590 AllocateHashTable(EntryToIndex(capacity), pretenure); |
11591 if (!maybe_obj->ToObject(&obj)) return maybe_obj; | 11591 if (!maybe_obj->ToObject(&obj)) return maybe_obj; |
11592 } | 11592 } |
11593 HashTable::cast(obj)->SetNumberOfElements(0); | 11593 HashTable::cast(obj)->SetNumberOfElements(0); |
11594 HashTable::cast(obj)->SetNumberOfDeletedElements(0); | 11594 HashTable::cast(obj)->SetNumberOfDeletedElements(0); |
11595 HashTable::cast(obj)->SetCapacity(capacity); | 11595 HashTable::cast(obj)->SetCapacity(capacity); |
(...skipping 2128 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
13724 set_year(Smi::FromInt(year), SKIP_WRITE_BARRIER); | 13724 set_year(Smi::FromInt(year), SKIP_WRITE_BARRIER); |
13725 set_month(Smi::FromInt(month), SKIP_WRITE_BARRIER); | 13725 set_month(Smi::FromInt(month), SKIP_WRITE_BARRIER); |
13726 set_day(Smi::FromInt(day), SKIP_WRITE_BARRIER); | 13726 set_day(Smi::FromInt(day), SKIP_WRITE_BARRIER); |
13727 set_weekday(Smi::FromInt(weekday), SKIP_WRITE_BARRIER); | 13727 set_weekday(Smi::FromInt(weekday), SKIP_WRITE_BARRIER); |
13728 set_hour(Smi::FromInt(hour), SKIP_WRITE_BARRIER); | 13728 set_hour(Smi::FromInt(hour), SKIP_WRITE_BARRIER); |
13729 set_min(Smi::FromInt(min), SKIP_WRITE_BARRIER); | 13729 set_min(Smi::FromInt(min), SKIP_WRITE_BARRIER); |
13730 set_sec(Smi::FromInt(sec), SKIP_WRITE_BARRIER); | 13730 set_sec(Smi::FromInt(sec), SKIP_WRITE_BARRIER); |
13731 } | 13731 } |
13732 | 13732 |
13733 } } // namespace v8::internal | 13733 } } // namespace v8::internal |
OLD | NEW |