Chromium Code Reviews
chromiumcodereview-hr@appspot.gserviceaccount.com (chromiumcodereview-hr) | Please choose your nickname with Settings | Help | Chromium Project | Gerrit Changes | Sign out
(174)

Side by Side Diff: src/heap.cc

Issue 501170: - Increased size of number string cache.... (Closed) Base URL: http://v8.googlecode.com/svn/branches/bleeding_edge/
Patch Set: Created 11 years ago
Use n/p to move between diff chunks; N/P to move between comments. Draft comments are only viewable by you.
Jump to:
View unified diff | Download patch | Annotate | Revision Log
OLDNEW
1 // Copyright 2009 the V8 project authors. All rights reserved. 1 // Copyright 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 1592 matching lines...) Expand 10 before | Expand all | Expand 10 after
1603 // Initialize descriptor cache. 1603 // Initialize descriptor cache.
1604 DescriptorLookupCache::Clear(); 1604 DescriptorLookupCache::Clear();
1605 1605
1606 // Initialize compilation cache. 1606 // Initialize compilation cache.
1607 CompilationCache::Clear(); 1607 CompilationCache::Clear();
1608 1608
1609 return true; 1609 return true;
1610 } 1610 }
1611 1611
1612 1612
1613 static inline int double_get_hash(double d) { 1613 static inline int double_get_hash(double d) {
Kasper Lund 2009/12/22 11:25:58 This should really be DoubleGetHash (the same goes
1614 DoubleRepresentation rep(d); 1614 DoubleRepresentation rep(d);
1615 return ((static_cast<int>(rep.bits) ^ static_cast<int>(rep.bits >> 32)) & 1615 int value = (static_cast<int>(rep.bits) ^ static_cast<int>(rep.bits >> 32));
1616 (Heap::kNumberStringCacheSize - 1)); 1616 return (((value >> 16) ^ value))
Kasper Lund 2009/12/22 11:25:58 How about adding another helper function so you ca
1617 & (Heap::kNumberStringCacheSize - 1);
1617 } 1618 }
1618 1619
1619 1620
1620 static inline int smi_get_hash(Smi* smi) { 1621 static inline int smi_get_hash(Smi* smi) {
1621 return (smi->value() & (Heap::kNumberStringCacheSize - 1)); 1622 return ((smi->value() >> 16) ^ smi->value())
1623 & (Heap::kNumberStringCacheSize - 1);
1622 } 1624 }
1623 1625
1624 1626
1625
1626 Object* Heap::GetNumberStringCache(Object* number) { 1627 Object* Heap::GetNumberStringCache(Object* number) {
1627 int hash; 1628 int hash;
1628 if (number->IsSmi()) { 1629 if (number->IsSmi()) {
1629 hash = smi_get_hash(Smi::cast(number)); 1630 hash = smi_get_hash(Smi::cast(number));
1630 } else { 1631 } else {
1631 hash = double_get_hash(number->Number()); 1632 hash = double_get_hash(number->Number());
1632 } 1633 }
1633 Object* key = number_string_cache()->get(hash * 2); 1634 Object* key = number_string_cache()->get(hash * 2);
1634 if (key == number) { 1635 if (key == number) {
1635 return String::cast(number_string_cache()->get(hash * 2 + 1)); 1636 return String::cast(number_string_cache()->get(hash * 2 + 1));
(...skipping 2453 matching lines...) Expand 10 before | Expand all | Expand 10 after
4089 void ExternalStringTable::TearDown() { 4090 void ExternalStringTable::TearDown() {
4090 new_space_strings_.Free(); 4091 new_space_strings_.Free();
4091 old_space_strings_.Free(); 4092 old_space_strings_.Free();
4092 } 4093 }
4093 4094
4094 4095
4095 List<Object*> ExternalStringTable::new_space_strings_; 4096 List<Object*> ExternalStringTable::new_space_strings_;
4096 List<Object*> ExternalStringTable::old_space_strings_; 4097 List<Object*> ExternalStringTable::old_space_strings_;
4097 4098
4098 } } // namespace v8::internal 4099 } } // namespace v8::internal
OLDNEW

Powered by Google App Engine
This is Rietveld 408576698