OLD | NEW |
1 // Copyright (c) 1994-2006 Sun Microsystems Inc. | 1 // Copyright (c) 1994-2006 Sun Microsystems Inc. |
2 // All Rights Reserved. | 2 // All Rights Reserved. |
3 // | 3 // |
4 // Redistribution and use in source and binary forms, with or without | 4 // Redistribution and use in source and binary forms, with or without |
5 // modification, are permitted provided that the following conditions | 5 // modification, are permitted provided that the following conditions |
6 // are met: | 6 // are met: |
7 // | 7 // |
8 // - Redistributions of source code must retain the above copyright notice, | 8 // - Redistributions of source code must retain the above copyright notice, |
9 // this list of conditions and the following disclaimer. | 9 // this list of conditions and the following disclaimer. |
10 // | 10 // |
(...skipping 2164 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
2175 if (rmode == RelocInfo::EXTERNAL_REFERENCE && | 2175 if (rmode == RelocInfo::EXTERNAL_REFERENCE && |
2176 !Serializer::enabled() && | 2176 !Serializer::enabled() && |
2177 !FLAG_debug_code) { | 2177 !FLAG_debug_code) { |
2178 return; | 2178 return; |
2179 } | 2179 } |
2180 RelocInfo rinfo(pc_, rmode, data); | 2180 RelocInfo rinfo(pc_, rmode, data); |
2181 reloc_info_writer.Write(&rinfo); | 2181 reloc_info_writer.Write(&rinfo); |
2182 } | 2182 } |
2183 | 2183 |
2184 | 2184 |
2185 void Assembler::WriteInternalReference(int position, const Label& bound_label) { | |
2186 ASSERT(bound_label.is_bound()); | |
2187 ASSERT(0 <= position); | |
2188 ASSERT(position + static_cast<int>(sizeof(uint32_t)) <= pc_offset()); | |
2189 ASSERT(long_at(position) == 0); // only initialize once! | |
2190 | |
2191 uint32_t label_loc = reinterpret_cast<uint32_t>(addr_at(bound_label.pos())); | |
2192 long_at_put(position, label_loc); | |
2193 } | |
2194 | |
2195 | |
2196 #ifdef GENERATED_CODE_COVERAGE | 2185 #ifdef GENERATED_CODE_COVERAGE |
2197 static FILE* coverage_log = NULL; | 2186 static FILE* coverage_log = NULL; |
2198 | 2187 |
2199 | 2188 |
2200 static void InitCoverageLog() { | 2189 static void InitCoverageLog() { |
2201 char* file_name = getenv("V8_GENERATED_CODE_COVERAGE_LOG"); | 2190 char* file_name = getenv("V8_GENERATED_CODE_COVERAGE_LOG"); |
2202 if (file_name != NULL) { | 2191 if (file_name != NULL) { |
2203 coverage_log = fopen(file_name, "aw+"); | 2192 coverage_log = fopen(file_name, "aw+"); |
2204 } | 2193 } |
2205 } | 2194 } |
2206 | 2195 |
2207 | 2196 |
2208 void LogGeneratedCodeCoverage(const char* file_line) { | 2197 void LogGeneratedCodeCoverage(const char* file_line) { |
2209 const char* return_address = (&file_line)[-1]; | 2198 const char* return_address = (&file_line)[-1]; |
2210 char* push_insn = const_cast<char*>(return_address - 12); | 2199 char* push_insn = const_cast<char*>(return_address - 12); |
2211 push_insn[0] = 0xeb; // Relative branch insn. | 2200 push_insn[0] = 0xeb; // Relative branch insn. |
2212 push_insn[1] = 13; // Skip over coverage insns. | 2201 push_insn[1] = 13; // Skip over coverage insns. |
2213 if (coverage_log != NULL) { | 2202 if (coverage_log != NULL) { |
2214 fprintf(coverage_log, "%s\n", file_line); | 2203 fprintf(coverage_log, "%s\n", file_line); |
2215 fflush(coverage_log); | 2204 fflush(coverage_log); |
2216 } | 2205 } |
2217 } | 2206 } |
2218 | 2207 |
2219 #endif | 2208 #endif |
2220 | 2209 |
2221 } } // namespace v8::internal | 2210 } } // namespace v8::internal |
OLD | NEW |