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

Side by Side Diff: src/heap.cc

Issue 1602010: Add number string cache lookup for heap numbers to generatred code (on top of... (Closed) Base URL: http://v8.googlecode.com/svn/branches/bleeding_edge/
Patch Set: Created 10 years, 8 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/heap.h ('k') | src/ia32/codegen-ia32.cc » ('j') | 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 1790 matching lines...) Expand 10 before | Expand all | Expand 10 after
1801 int int_value = FastD2I(value); 1801 int int_value = FastD2I(value);
1802 if (value == FastI2D(int_value) && Smi::IsValid(int_value)) { 1802 if (value == FastI2D(int_value) && Smi::IsValid(int_value)) {
1803 return Smi::FromInt(int_value); 1803 return Smi::FromInt(int_value);
1804 } 1804 }
1805 1805
1806 // Materialize the value in the heap. 1806 // Materialize the value in the heap.
1807 return AllocateHeapNumber(value, pretenure); 1807 return AllocateHeapNumber(value, pretenure);
1808 } 1808 }
1809 1809
1810 1810
1811 Object* Heap::NumberToString(Object* number) { 1811 Object* Heap::NumberToString(Object* number, bool check_number_string_cache) {
1812 Counters::number_to_string_runtime.Increment(); 1812 Counters::number_to_string_runtime.Increment();
1813 Object* cached = GetNumberStringCache(number); 1813 if (check_number_string_cache) {
1814 if (cached != undefined_value()) { 1814 Object* cached = GetNumberStringCache(number);
1815 return cached; 1815 if (cached != undefined_value()) {
1816 return cached;
1817 }
1816 } 1818 }
1817 1819
1818 char arr[100]; 1820 char arr[100];
1819 Vector<char> buffer(arr, ARRAY_SIZE(arr)); 1821 Vector<char> buffer(arr, ARRAY_SIZE(arr));
1820 const char* str; 1822 const char* str;
1821 if (number->IsSmi()) { 1823 if (number->IsSmi()) {
1822 int num = Smi::cast(number)->value(); 1824 int num = Smi::cast(number)->value();
1823 str = IntToCString(num, buffer); 1825 str = IntToCString(num, buffer);
1824 } else { 1826 } else {
1825 double num = HeapNumber::cast(number)->value(); 1827 double num = HeapNumber::cast(number)->value();
(...skipping 2571 matching lines...) Expand 10 before | Expand all | Expand 10 after
4397 void ExternalStringTable::TearDown() { 4399 void ExternalStringTable::TearDown() {
4398 new_space_strings_.Free(); 4400 new_space_strings_.Free();
4399 old_space_strings_.Free(); 4401 old_space_strings_.Free();
4400 } 4402 }
4401 4403
4402 4404
4403 List<Object*> ExternalStringTable::new_space_strings_; 4405 List<Object*> ExternalStringTable::new_space_strings_;
4404 List<Object*> ExternalStringTable::old_space_strings_; 4406 List<Object*> ExternalStringTable::old_space_strings_;
4405 4407
4406 } } // namespace v8::internal 4408 } } // namespace v8::internal
OLDNEW
« no previous file with comments | « src/heap.h ('k') | src/ia32/codegen-ia32.cc » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698