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

Unified Diff: src/assembler-ia32.cc

Issue 88025: * Add code to check coverage of generated code on IA32 port.... (Closed) Base URL: http://v8.googlecode.com/svn/branches/bleeding_edge/
Patch Set: Created 11 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 side-by-side diff with in-line comments
Download patch
« no previous file with comments | « no previous file | src/builtins-ia32.cc » ('j') | src/codegen-ia32.cc » ('J')
Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
Index: src/assembler-ia32.cc
===================================================================
--- src/assembler-ia32.cc (revision 1748)
+++ src/assembler-ia32.cc (working copy)
@@ -283,6 +283,10 @@
*pc_++ = (x)
+#ifdef GENERATED_CODE_COVERAGE
+static void InitCoverageLog();
+#endif
+
// spare_buffer_
static byte* spare_buffer_ = NULL;
@@ -329,6 +333,9 @@
current_position_ = RelocInfo::kNoPosition;
written_statement_position_ = current_statement_position_;
written_position_ = current_position_;
+#ifdef GENERATED_CODE_COVERAGE
+ InitCoverageLog();
+#endif
}
@@ -2202,4 +2209,31 @@
long_at_put(position, label_loc);
}
+
+#ifdef GENERATED_CODE_COVERAGE
+static FILE* coverage_log = NULL;
+
+
+static void InitCoverageLog() {
+ char* file_name = getenv("V8_GENERATED_CODE_COVERAGE_LOG");
+ if (file_name != NULL) {
+ coverage_log = fopen(file_name, "aw+");
+ }
+}
+
+
+void LogGeneratedCodeCoverage(const char* file_line) {
+ const char* return_address = (&file_line)[-1];
Christian Plesner Hansen 2009/04/21 11:47:32 Maybe check or assert that coverage_log is set?
+ char* push_insn = const_cast<char*>(return_address - 12);
+ push_insn[0] = 0xeb; // Relative branch insn.
+ push_insn[1] = 13; // Skip over coverage insns.
+ fprintf(coverage_log, "%s\n", file_line);
+ fflush(coverage_log);
+}
+
+
+byte* ia32_coverage_function =
Christian Plesner Hansen 2009/04/21 11:47:32 As discussed, there must be a way to make this nas
+ reinterpret_cast<byte*>(FUNCTION_ADDR(LogGeneratedCodeCoverage));
+#endif
+
} } // namespace v8::internal
« no previous file with comments | « no previous file | src/builtins-ia32.cc » ('j') | src/codegen-ia32.cc » ('J')

Powered by Google App Engine
This is Rietveld 408576698