OLD | NEW |
1 // Copyright 2006-2009 the V8 project authors. All rights reserved. | 1 // Copyright 2006-2009 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 4841 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
4852 // know it will fit into the smi-data type. | 4852 // know it will fit into the smi-data type. |
4853 int d = ParseDecimalInteger(data, start_pos, len); | 4853 int d = ParseDecimalInteger(data, start_pos, len); |
4854 if (minus) { | 4854 if (minus) { |
4855 if (d == 0) return Heap::minus_zero_value(); | 4855 if (d == 0) return Heap::minus_zero_value(); |
4856 d = -d; | 4856 d = -d; |
4857 } else if (!subject->HasHashCode() && | 4857 } else if (!subject->HasHashCode() && |
4858 len <= String::kMaxArrayIndexSize && | 4858 len <= String::kMaxArrayIndexSize && |
4859 (len == 1 || data[0] != '0')) { | 4859 (len == 1 || data[0] != '0')) { |
4860 // String hash is not calculated yet but all the data are present. | 4860 // String hash is not calculated yet but all the data are present. |
4861 // Update the hash field to speed up sequential convertions. | 4861 // Update the hash field to speed up sequential convertions. |
4862 uint32_t hash = StringHasher::MakeCachedArrayIndex(d, len); | 4862 uint32_t hash = StringHasher::MakeArrayIndexHash(d, len); |
4863 #ifdef DEBUG | 4863 #ifdef DEBUG |
4864 ASSERT((hash & String::kContainsCachedArrayIndexMask) == 0); | |
4865 subject->Hash(); // Force hash calculation. | 4864 subject->Hash(); // Force hash calculation. |
4866 ASSERT_EQ(static_cast<int>(subject->hash_field()), | 4865 ASSERT_EQ(static_cast<int>(subject->hash_field()), |
4867 static_cast<int>(hash)); | 4866 static_cast<int>(hash)); |
4868 #endif | 4867 #endif |
4869 subject->set_hash_field(hash); | 4868 subject->set_hash_field(hash); |
4870 } | 4869 } |
4871 return Smi::FromInt(d); | 4870 return Smi::FromInt(d); |
4872 } | 4871 } |
4873 } | 4872 } |
4874 | 4873 |
(...skipping 5864 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
10739 } else { | 10738 } else { |
10740 // Handle last resort GC and make sure to allow future allocations | 10739 // Handle last resort GC and make sure to allow future allocations |
10741 // to grow the heap without causing GCs (if possible). | 10740 // to grow the heap without causing GCs (if possible). |
10742 Counters::gc_last_resort_from_js.Increment(); | 10741 Counters::gc_last_resort_from_js.Increment(); |
10743 Heap::CollectAllGarbage(false); | 10742 Heap::CollectAllGarbage(false); |
10744 } | 10743 } |
10745 } | 10744 } |
10746 | 10745 |
10747 | 10746 |
10748 } } // namespace v8::internal | 10747 } } // namespace v8::internal |
OLD | NEW |