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

Unified Diff: src/mips/simulator-mips.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.cc ('k') | src/mips64/simulator-mips64.cc » ('j') | no next file with comments »
Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
Index: src/mips/simulator-mips.cc
diff --git a/src/mips/simulator-mips.cc b/src/mips/simulator-mips.cc
index 052eaed8272f7224d1fc7830dc92c48770cb108f..83af5868153aa6914bc6c237c152d3663be65959 100644
--- a/src/mips/simulator-mips.cc
+++ b/src/mips/simulator-mips.cc
@@ -93,11 +93,17 @@ static FILE* coverage_log = NULL;
static void InitializeCoverage() {
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 MipsDebugger::Stop(Instruction* instr) {
// Get the stop code.
@@ -131,6 +137,7 @@ void MipsDebugger::Stop(Instruction* instr) {
#define UNSUPPORTED() printf("Unsupported instruction.\n");
static void InitializeCoverage() {}
+static void DeinitCoverageLog() {}
void MipsDebugger::Stop(Instruction* instr) {
@@ -903,6 +910,7 @@ Simulator::Simulator(Isolate* isolate) : isolate_(isolate) {
Simulator::~Simulator() {
+ DeinitCoverageLog();
}
« no previous file with comments | « src/ia32/assembler-ia32.cc ('k') | src/mips64/simulator-mips64.cc » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698