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

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

Issue 4108008: Fix memory corruption in JSFunctionResultCache::Clear. (Closed) Base URL: http://v8.googlecode.com/svn/branches/2.3/
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 1919 matching lines...) Expand 10 before | Expand all | Expand 10 after
1930 1930
1931 void JSFunctionResultCache::MakeZeroSize() { 1931 void JSFunctionResultCache::MakeZeroSize() {
1932 set(kFingerIndex, Smi::FromInt(kEntriesIndex)); 1932 set(kFingerIndex, Smi::FromInt(kEntriesIndex));
1933 set(kCacheSizeIndex, Smi::FromInt(kEntriesIndex)); 1933 set(kCacheSizeIndex, Smi::FromInt(kEntriesIndex));
1934 } 1934 }
1935 1935
1936 1936
1937 void JSFunctionResultCache::Clear() { 1937 void JSFunctionResultCache::Clear() {
1938 int cache_size = Smi::cast(get(kCacheSizeIndex))->value(); 1938 int cache_size = Smi::cast(get(kCacheSizeIndex))->value();
1939 Object** entries_start = RawField(this, OffsetOfElementAt(kEntriesIndex)); 1939 Object** entries_start = RawField(this, OffsetOfElementAt(kEntriesIndex));
1940 MemsetPointer(entries_start, Heap::the_hole_value(), cache_size); 1940 MemsetPointer(entries_start,
1941 Heap::the_hole_value(),
1942 cache_size - kEntriesIndex);
1941 MakeZeroSize(); 1943 MakeZeroSize();
1942 } 1944 }
1943 1945
1944 1946
1945 byte ByteArray::get(int index) { 1947 byte ByteArray::get(int index) {
1946 ASSERT(index >= 0 && index < this->length()); 1948 ASSERT(index >= 0 && index < this->length());
1947 return READ_BYTE_FIELD(this, kHeaderSize + index * kCharSize); 1949 return READ_BYTE_FIELD(this, kHeaderSize + index * kCharSize);
1948 } 1950 }
1949 1951
1950 1952
(...skipping 1540 matching lines...) Expand 10 before | Expand all | Expand 10 after
3491 #undef WRITE_INT_FIELD 3493 #undef WRITE_INT_FIELD
3492 #undef READ_SHORT_FIELD 3494 #undef READ_SHORT_FIELD
3493 #undef WRITE_SHORT_FIELD 3495 #undef WRITE_SHORT_FIELD
3494 #undef READ_BYTE_FIELD 3496 #undef READ_BYTE_FIELD
3495 #undef WRITE_BYTE_FIELD 3497 #undef WRITE_BYTE_FIELD
3496 3498
3497 3499
3498 } } // namespace v8::internal 3500 } } // namespace v8::internal
3499 3501
3500 #endif // V8_OBJECTS_INL_H_ 3502 #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