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

Unified Diff: src/x87/assembler-x87.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/x87/assembler-x87.h ('k') | no next file » | no next file with comments »
Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
Index: src/x87/assembler-x87.cc
diff --git a/src/x87/assembler-x87.cc b/src/x87/assembler-x87.cc
index 557be236ba062f1b3d3495d5cd3d46b51c00bc01..a599c7fb415418f2103f13b91c09536c6d00d47d 100644
--- a/src/x87/assembler-x87.cc
+++ b/src/x87/assembler-x87.cc
@@ -230,6 +230,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)
@@ -251,6 +252,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
@@ -2005,11 +2011,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/x87/assembler-x87.h ('k') | no next file » | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698