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

Side by Side Diff: src/heap.cc

Issue 597007: Faster implementation of integer-to-ascii conversion. I think.... (Closed) Base URL: http://v8.googlecode.com/svn/branches/bleeding_edge/
Patch Set: Created 10 years, 10 months 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
« no previous file with comments | « src/conversions.cc ('k') | no next file » | no next file with comments »
Toggle Intra-line Diffs ('i') | Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
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 1768 matching lines...) Expand 10 before | Expand all | Expand 10 after
1779 1779
1780 Object* Heap::NumberToString(Object* number) { 1780 Object* Heap::NumberToString(Object* number) {
1781 Object* cached = GetNumberStringCache(number); 1781 Object* cached = GetNumberStringCache(number);
1782 if (cached != undefined_value()) { 1782 if (cached != undefined_value()) {
1783 return cached; 1783 return cached;
1784 } 1784 }
1785 1785
1786 char arr[100]; 1786 char arr[100];
1787 Vector<char> buffer(arr, ARRAY_SIZE(arr)); 1787 Vector<char> buffer(arr, ARRAY_SIZE(arr));
1788 const char* str; 1788 const char* str;
1789 int length = 0;
1789 if (number->IsSmi()) { 1790 if (number->IsSmi()) {
1790 int num = Smi::cast(number)->value(); 1791 int num = Smi::cast(number)->value();
1791 str = IntToCString(num, buffer); 1792 str = IntToCString(num, &length);
1792 } else { 1793 } else {
1793 double num = HeapNumber::cast(number)->value(); 1794 double num = HeapNumber::cast(number)->value();
1794 str = DoubleToCString(num, buffer); 1795 str = DoubleToCString(num, buffer);
1796 length = strlen(str);
1795 } 1797 }
1796 Object* result = AllocateStringFromAscii(CStrVector(str)); 1798 Object* result = AllocateStringFromAscii(Vector<const char>(str, length));
1797 1799
1798 if (!result->IsFailure()) { 1800 if (!result->IsFailure()) {
1799 SetNumberStringCache(number, String::cast(result)); 1801 SetNumberStringCache(number, String::cast(result));
1800 } 1802 }
1801 return result; 1803 return result;
1802 } 1804 }
1803 1805
1804 1806
1805 Map* Heap::MapForExternalArrayType(ExternalArrayType array_type) { 1807 Map* Heap::MapForExternalArrayType(ExternalArrayType array_type) {
1806 return Map::cast(roots_[RootIndexForExternalArrayType(array_type)]); 1808 return Map::cast(roots_[RootIndexForExternalArrayType(array_type)]);
(...skipping 2421 matching lines...) Expand 10 before | Expand all | Expand 10 after
4228 void ExternalStringTable::TearDown() { 4230 void ExternalStringTable::TearDown() {
4229 new_space_strings_.Free(); 4231 new_space_strings_.Free();
4230 old_space_strings_.Free(); 4232 old_space_strings_.Free();
4231 } 4233 }
4232 4234
4233 4235
4234 List<Object*> ExternalStringTable::new_space_strings_; 4236 List<Object*> ExternalStringTable::new_space_strings_;
4235 List<Object*> ExternalStringTable::old_space_strings_; 4237 List<Object*> ExternalStringTable::old_space_strings_;
4236 4238
4237 } } // namespace v8::internal 4239 } } // namespace v8::internal
OLDNEW
« no previous file with comments | « src/conversions.cc ('k') | no next file » | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698