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

Unified Diff: src/ia32/assembler-ia32.cc

Issue 419343003: when open macro GENERATED_CODE_COVERAGE, fix compiler error and fd leak (Closed) Base URL: https://github.com/v8/v8.git@master
Patch Set: Created 6 years, 5 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 | « src/ia32/assembler-ia32.h ('k') | src/mips/simulator-mips.cc » ('j') | no next file with comments »
Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
Index: src/ia32/assembler-ia32.cc
diff --git a/src/ia32/assembler-ia32.cc b/src/ia32/assembler-ia32.cc
index 6497ba6db0a980e8af1c3b0153ea18a84b18db9d..465f1490de9c2b3b180438a28ae4808fa42505b2 100644
--- a/src/ia32/assembler-ia32.cc
+++ b/src/ia32/assembler-ia32.cc
@@ -235,6 +235,7 @@ Register Operand::reg() const {
#ifdef GENERATED_CODE_COVERAGE
static void InitCoverageLog();
+static void DeinitCoverageLog();
#endif
Assembler::Assembler(Isolate* isolate, void* buffer, int buffer_size)
@@ -256,6 +257,11 @@ Assembler::Assembler(Isolate* isolate, void* buffer, int buffer_size)
#endif
}
+Assembler::~Assembler() {
+#ifdef GENERATED_CODE_COVERAGE
+ DeinitCoverageLog();
+#endif
+}
void Assembler::GetCode(CodeDesc* desc) {
// Finalize code (at this point overflow() may be true, but the gap ensures
@@ -2622,11 +2628,17 @@ static FILE* coverage_log = NULL;
static void InitCoverageLog() {
char* file_name = getenv("V8_GENERATED_CODE_COVERAGE_LOG");
- if (file_name != NULL) {
+ if (file_name != NULL && NULL == coverage_log) {
coverage_log = fopen(file_name, "aw+");
}
}
+static void DeinitCoverageLog() {
+ if (coverage_log != NULL) {
+ fclose(coverage_log);
+ coverage_log = NULL;
+ }
+}
void LogGeneratedCodeCoverage(const char* file_line) {
const char* return_address = (&file_line)[-1];
« no previous file with comments | « src/ia32/assembler-ia32.h ('k') | src/mips/simulator-mips.cc » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698