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

Side by Side Diff: src/heap.cc

Issue 390004: Fix warnings on Win64. (Closed)
Patch Set: Created 11 years, 1 month 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
« src/api.cc ('K') | « src/handles.cc ('k') | src/ic.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 1854 matching lines...) Expand 10 before | Expand all | Expand 10 after
1865 String::WriteToFlat(buffer, dest, start, end); 1865 String::WriteToFlat(buffer, dest, start, end);
1866 } 1866 }
1867 1867
1868 return result; 1868 return result;
1869 } 1869 }
1870 1870
1871 1871
1872 Object* Heap::AllocateExternalStringFromAscii( 1872 Object* Heap::AllocateExternalStringFromAscii(
1873 ExternalAsciiString::Resource* resource) { 1873 ExternalAsciiString::Resource* resource) {
1874 Map* map; 1874 Map* map;
1875 int length = resource->length(); 1875 size_t length = resource->length();
1876 if (length <= String::kMaxShortSize) { 1876 if (length <= static_cast<size_t>(String::kMaxShortSize)) {
1877 map = short_external_ascii_string_map(); 1877 map = short_external_ascii_string_map();
1878 } else if (length <= String::kMaxMediumSize) { 1878 } else if (length <= static_cast<size_t>(String::kMaxMediumSize)) {
1879 map = medium_external_ascii_string_map(); 1879 map = medium_external_ascii_string_map();
1880 } else if (length <= static_cast<size_t>(String::kMaxLength)) {
1881 map = long_external_ascii_string_map();
1880 } else { 1882 } else {
1881 map = long_external_ascii_string_map(); 1883 Top::context()->mark_out_of_memory();
1884 return Failure::OutOfMemoryException();
1882 } 1885 }
1883 1886
1884 Object* result = Allocate(map, NEW_SPACE); 1887 Object* result = Allocate(map, NEW_SPACE);
1885 if (result->IsFailure()) return result; 1888 if (result->IsFailure()) return result;
1886 1889
1887 ExternalAsciiString* external_string = ExternalAsciiString::cast(result); 1890 ExternalAsciiString* external_string = ExternalAsciiString::cast(result);
1888 external_string->set_length(length); 1891 external_string->set_length(static_cast<int>(length));
1889 external_string->set_resource(resource); 1892 external_string->set_resource(resource);
1890 1893
1891 return result; 1894 return result;
1892 } 1895 }
1893 1896
1894 1897
1895 Object* Heap::AllocateExternalStringFromTwoByte( 1898 Object* Heap::AllocateExternalStringFromTwoByte(
1896 ExternalTwoByteString::Resource* resource) { 1899 ExternalTwoByteString::Resource* resource) {
1897 int length = resource->length(); 1900 size_t length = resource->length();
1898 1901 if (length > static_cast<size_t>(String::kMaxLength)) {
1899 Map* map = ExternalTwoByteString::StringMap(length); 1902 Top::context()->mark_out_of_memory();
1903 return Failure::OutOfMemoryException();
1904 }
1905 Map* map = ExternalTwoByteString::StringMap(static_cast<int>(length));
1900 Object* result = Allocate(map, NEW_SPACE); 1906 Object* result = Allocate(map, NEW_SPACE);
1901 if (result->IsFailure()) return result; 1907 if (result->IsFailure()) return result;
1902 1908
1903 ExternalTwoByteString* external_string = ExternalTwoByteString::cast(result); 1909 ExternalTwoByteString* external_string = ExternalTwoByteString::cast(result);
1904 external_string->set_length(length); 1910 external_string->set_length(static_cast<int>(length));
1905 external_string->set_resource(resource); 1911 external_string->set_resource(resource);
1906 1912
1907 return result; 1913 return result;
1908 } 1914 }
1909 1915
1910 1916
1911 Object* Heap::LookupSingleCharacterStringFromCode(uint16_t code) { 1917 Object* Heap::LookupSingleCharacterStringFromCode(uint16_t code) {
1912 if (code <= String::kMaxAsciiCharCode) { 1918 if (code <= String::kMaxAsciiCharCode) {
1913 Object* value = Heap::single_character_string_cache()->get(code); 1919 Object* value = Heap::single_character_string_cache()->get(code);
1914 if (value != Heap::undefined_value()) return value; 1920 if (value != Heap::undefined_value()) return value;
(...skipping 2070 matching lines...) Expand 10 before | Expand all | Expand 10 after
3985 for (int i = 0; i < kNumberOfCaches; i++) { 3991 for (int i = 0; i < kNumberOfCaches; i++) {
3986 if (caches_[i] != NULL) { 3992 if (caches_[i] != NULL) {
3987 delete caches_[i]; 3993 delete caches_[i];
3988 caches_[i] = NULL; 3994 caches_[i] = NULL;
3989 } 3995 }
3990 } 3996 }
3991 } 3997 }
3992 3998
3993 3999
3994 } } // namespace v8::internal 4000 } } // namespace v8::internal
OLDNEW
« src/api.cc ('K') | « src/handles.cc ('k') | src/ic.cc » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698