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

Side by Side Diff: src/objects-inl.h

Issue 4220002: Fix memory corruption in JSFunctionResultCache::Clear. (Closed) Base URL: http://v8.googlecode.com/svn/branches/2.4/
Patch Set: Created 10 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 | Annotate | Revision Log
« no previous file with comments | « no previous file | src/version.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 2006-2008 the V8 project authors. All rights reserved. 1 // Copyright 2006-2008 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 1905 matching lines...) Expand 10 before | Expand all | Expand 10 after
1916 1916
1917 void JSFunctionResultCache::MakeZeroSize() { 1917 void JSFunctionResultCache::MakeZeroSize() {
1918 set(kFingerIndex, Smi::FromInt(kEntriesIndex)); 1918 set(kFingerIndex, Smi::FromInt(kEntriesIndex));
1919 set(kCacheSizeIndex, Smi::FromInt(kEntriesIndex)); 1919 set(kCacheSizeIndex, Smi::FromInt(kEntriesIndex));
1920 } 1920 }
1921 1921
1922 1922
1923 void JSFunctionResultCache::Clear() { 1923 void JSFunctionResultCache::Clear() {
1924 int cache_size = Smi::cast(get(kCacheSizeIndex))->value(); 1924 int cache_size = Smi::cast(get(kCacheSizeIndex))->value();
1925 Object** entries_start = RawField(this, OffsetOfElementAt(kEntriesIndex)); 1925 Object** entries_start = RawField(this, OffsetOfElementAt(kEntriesIndex));
1926 MemsetPointer(entries_start, Heap::the_hole_value(), cache_size); 1926 MemsetPointer(entries_start,
1927 Heap::the_hole_value(),
1928 cache_size - kEntriesIndex);
1927 MakeZeroSize(); 1929 MakeZeroSize();
1928 } 1930 }
1929 1931
1930 1932
1931 byte ByteArray::get(int index) { 1933 byte ByteArray::get(int index) {
1932 ASSERT(index >= 0 && index < this->length()); 1934 ASSERT(index >= 0 && index < this->length());
1933 return READ_BYTE_FIELD(this, kHeaderSize + index * kCharSize); 1935 return READ_BYTE_FIELD(this, kHeaderSize + index * kCharSize);
1934 } 1936 }
1935 1937
1936 1938
(...skipping 1598 matching lines...) Expand 10 before | Expand all | Expand 10 after
3535 #undef WRITE_INT_FIELD 3537 #undef WRITE_INT_FIELD
3536 #undef READ_SHORT_FIELD 3538 #undef READ_SHORT_FIELD
3537 #undef WRITE_SHORT_FIELD 3539 #undef WRITE_SHORT_FIELD
3538 #undef READ_BYTE_FIELD 3540 #undef READ_BYTE_FIELD
3539 #undef WRITE_BYTE_FIELD 3541 #undef WRITE_BYTE_FIELD
3540 3542
3541 3543
3542 } } // namespace v8::internal 3544 } } // namespace v8::internal
3543 3545
3544 #endif // V8_OBJECTS_INL_H_ 3546 #endif // V8_OBJECTS_INL_H_
OLDNEW
« no previous file with comments | « no previous file | src/version.cc » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698