OLD | NEW |
1 // Copyright 2009 the V8 project authors. All rights reserved. | 1 // Copyright 2009 the V8 project authors. All rights reserved. |
2 // Redistribution and use in source and binary forms, with or without | 2 // Redistribution and use in source and binary forms, with or without |
3 // modification, are permitted provided that the following conditions are | 3 // modification, are permitted provided that the following conditions are |
4 // met: | 4 // met: |
5 // | 5 // |
6 // * Redistributions of source code must retain the above copyright | 6 // * Redistributions of source code must retain the above copyright |
7 // notice, this list of conditions and the following disclaimer. | 7 // notice, this list of conditions and the following disclaimer. |
8 // * Redistributions in binary form must reproduce the above | 8 // * Redistributions in binary form must reproduce the above |
9 // copyright notice, this list of conditions and the following | 9 // copyright notice, this list of conditions and the following |
10 // disclaimer in the documentation and/or other materials provided | 10 // disclaimer in the documentation and/or other materials provided |
(...skipping 136 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
147 static const char kCodeLogExt[] = ".code"; | 147 static const char kCodeLogExt[] = ".code"; |
148 | 148 |
149 | 149 |
150 void Log::OpenFile(const char* name) { | 150 void Log::OpenFile(const char* name) { |
151 ASSERT(!IsEnabled()); | 151 ASSERT(!IsEnabled()); |
152 output_handle_ = OS::FOpen(name, OS::LogFileOpenMode); | 152 output_handle_ = OS::FOpen(name, OS::LogFileOpenMode); |
153 if (FLAG_ll_prof) { | 153 if (FLAG_ll_prof) { |
154 // Open a file for logging the contents of code objects so that | 154 // Open a file for logging the contents of code objects so that |
155 // they can be disassembled later. | 155 // they can be disassembled later. |
156 size_t name_len = strlen(name); | 156 size_t name_len = strlen(name); |
157 ScopedVector<char> code_name(name_len + sizeof(kCodeLogExt)); | 157 ScopedVector<char> code_name( |
| 158 static_cast<int>(name_len + sizeof(kCodeLogExt))); |
158 memcpy(code_name.start(), name, name_len); | 159 memcpy(code_name.start(), name, name_len); |
159 memcpy(code_name.start() + name_len, kCodeLogExt, sizeof(kCodeLogExt)); | 160 memcpy(code_name.start() + name_len, kCodeLogExt, sizeof(kCodeLogExt)); |
160 output_code_handle_ = OS::FOpen(code_name.start(), OS::LogFileOpenMode); | 161 output_code_handle_ = OS::FOpen(code_name.start(), OS::LogFileOpenMode); |
161 } | 162 } |
162 Write = WriteToFile; | 163 Write = WriteToFile; |
163 Init(); | 164 Init(); |
164 } | 165 } |
165 | 166 |
166 | 167 |
167 void Log::OpenMemoryBuffer() { | 168 void Log::OpenMemoryBuffer() { |
(...skipping 335 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
503 PrintBackwardReference(backref, best.distance, best.copy_from_pos); | 504 PrintBackwardReference(backref, best.distance, best.copy_from_pos); |
504 ASSERT(strlen(backref.start()) - best.backref_size == 0); | 505 ASSERT(strlen(backref.start()) - best.backref_size == 0); |
505 prev_record->Truncate(static_cast<int>(unchanged_len + best.backref_size)); | 506 prev_record->Truncate(static_cast<int>(unchanged_len + best.backref_size)); |
506 } | 507 } |
507 return true; | 508 return true; |
508 } | 509 } |
509 | 510 |
510 #endif // ENABLE_LOGGING_AND_PROFILING | 511 #endif // ENABLE_LOGGING_AND_PROFILING |
511 | 512 |
512 } } // namespace v8::internal | 513 } } // namespace v8::internal |
OLD | NEW |