Land change to notify valgrind when we modify code on x86. This does

not seem to impact performance and makes it a lot easier for people
embedding V8 to run their application under valgrind.

If we observe a negative performance impact, we will need to revise
this again.

Review URL: http://codereview.chromium.org/13612.

git-svn-id: http://v8.googlecode.com/svn/branches/bleeding_edge@2662 ce2b1a6d-e550-0410-aec6-3dcde31c8c00
This commit is contained in:
ager@chromium.org 2009-08-11 15:23:06 +00:00
parent 6a8a7d580e
commit f39651cbcd
3 changed files with 3943 additions and 0 deletions

View File

@ -20,6 +20,12 @@ are:
copyrighted by Douglas Crockford and Baruch Even and released under
an MIT license.
- Valgrind client API header, located at third_party/valgrind/valgrind.h
This is release under the BSD license.
- Valgrind client API header, located at third_party/valgrind/valgrind.h
This is release under the BSD license.
These libraries have their own licenses; we recommend you read them,
as their terms may differ from the terms below.

View File

@ -27,6 +27,10 @@
// CPU specific code for ia32 independent of OS goes here.
#ifdef __GNUC__
#include "third_party/valgrind/valgrind.h"
#endif
#include "v8.h"
#include "cpu.h"
@ -49,6 +53,15 @@ void CPU::FlushICache(void* start, size_t size) {
// If flushing of the instruction cache becomes necessary Windows has the
// API function FlushInstructionCache.
// By default, valgrind only checks the stack for writes that might need to
// invalidate already cached translated code. This leads to random
// instability when code patches or moves are sometimes unnoticed. One
// solution is to run valgrind with --smc-check=all, but this comes at a big
// performance cost. We can notify valgrind to invalidate its cache.
#ifdef VALGRIND_DISCARD_TRANSLATIONS
VALGRIND_DISCARD_TRANSLATIONS(start, size);
#endif
}

3924
src/third_party/valgrind/valgrind.h vendored Normal file

File diff suppressed because it is too large Load Diff