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 188 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
199 #endif | 199 #endif |
200 | 200 |
201 // Patch the code. | 201 // Patch the code. |
202 patcher.masm()->call(target, RelocInfo::NONE); | 202 patcher.masm()->call(target, RelocInfo::NONE); |
203 | 203 |
204 // Check that the size of the code generated is as expected. | 204 // Check that the size of the code generated is as expected. |
205 ASSERT_EQ(kCallCodeSize, | 205 ASSERT_EQ(kCallCodeSize, |
206 patcher.masm()->SizeOfCodeGeneratedSince(&check_codesize)); | 206 patcher.masm()->SizeOfCodeGeneratedSince(&check_codesize)); |
207 | 207 |
208 // Add the requested number of int3 instructions after the call. | 208 // Add the requested number of int3 instructions after the call. |
| 209 ASSERT_GE(guard_bytes, 0); |
209 for (int i = 0; i < guard_bytes; i++) { | 210 for (int i = 0; i < guard_bytes; i++) { |
210 patcher.masm()->int3(); | 211 patcher.masm()->int3(); |
211 } | 212 } |
212 } | 213 } |
213 | 214 |
214 | 215 |
215 // ----------------------------------------------------------------------------- | 216 // ----------------------------------------------------------------------------- |
216 // Implementation of Operand | 217 // Implementation of Operand |
217 | 218 |
218 Operand::Operand(Register base, int32_t disp, RelocInfo::Mode rmode) { | 219 Operand::Operand(Register base, int32_t disp, RelocInfo::Mode rmode) { |
(...skipping 2145 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
2364 } | 2365 } |
2365 | 2366 |
2366 | 2367 |
2367 void Assembler::RecordJSReturn() { | 2368 void Assembler::RecordJSReturn() { |
2368 WriteRecordedPositions(); | 2369 WriteRecordedPositions(); |
2369 EnsureSpace ensure_space(this); | 2370 EnsureSpace ensure_space(this); |
2370 RecordRelocInfo(RelocInfo::JS_RETURN); | 2371 RecordRelocInfo(RelocInfo::JS_RETURN); |
2371 } | 2372 } |
2372 | 2373 |
2373 | 2374 |
| 2375 void Assembler::RecordDebugBreakSlot() { |
| 2376 WriteRecordedPositions(); |
| 2377 EnsureSpace ensure_space(this); |
| 2378 RecordRelocInfo(RelocInfo::DEBUG_BREAK_SLOT); |
| 2379 } |
| 2380 |
| 2381 |
2374 void Assembler::RecordComment(const char* msg) { | 2382 void Assembler::RecordComment(const char* msg) { |
2375 if (FLAG_debug_code) { | 2383 if (FLAG_debug_code) { |
2376 EnsureSpace ensure_space(this); | 2384 EnsureSpace ensure_space(this); |
2377 RecordRelocInfo(RelocInfo::COMMENT, reinterpret_cast<intptr_t>(msg)); | 2385 RecordRelocInfo(RelocInfo::COMMENT, reinterpret_cast<intptr_t>(msg)); |
2378 } | 2386 } |
2379 } | 2387 } |
2380 | 2388 |
2381 | 2389 |
2382 void Assembler::RecordPosition(int pos) { | 2390 void Assembler::RecordPosition(int pos) { |
2383 ASSERT(pos != RelocInfo::kNoPosition); | 2391 ASSERT(pos != RelocInfo::kNoPosition); |
2384 ASSERT(pos >= 0); | 2392 ASSERT(pos >= 0); |
2385 current_position_ = pos; | 2393 current_position_ = pos; |
2386 } | 2394 } |
2387 | 2395 |
2388 | 2396 |
2389 void Assembler::RecordStatementPosition(int pos) { | 2397 void Assembler::RecordStatementPosition(int pos) { |
2390 ASSERT(pos != RelocInfo::kNoPosition); | 2398 ASSERT(pos != RelocInfo::kNoPosition); |
2391 ASSERT(pos >= 0); | 2399 ASSERT(pos >= 0); |
2392 current_statement_position_ = pos; | 2400 current_statement_position_ = pos; |
2393 } | 2401 } |
2394 | 2402 |
2395 | 2403 |
2396 void Assembler::WriteRecordedPositions() { | 2404 bool Assembler::WriteRecordedPositions() { |
| 2405 bool written = false; |
| 2406 |
2397 // Write the statement position if it is different from what was written last | 2407 // Write the statement position if it is different from what was written last |
2398 // time. | 2408 // time. |
2399 if (current_statement_position_ != written_statement_position_) { | 2409 if (current_statement_position_ != written_statement_position_) { |
2400 EnsureSpace ensure_space(this); | 2410 EnsureSpace ensure_space(this); |
2401 RecordRelocInfo(RelocInfo::STATEMENT_POSITION, current_statement_position_); | 2411 RecordRelocInfo(RelocInfo::STATEMENT_POSITION, current_statement_position_); |
2402 written_statement_position_ = current_statement_position_; | 2412 written_statement_position_ = current_statement_position_; |
| 2413 written = true; |
2403 } | 2414 } |
2404 | 2415 |
2405 // Write the position if it is different from what was written last time and | 2416 // Write the position if it is different from what was written last time and |
2406 // also different from the written statement position. | 2417 // also different from the written statement position. |
2407 if (current_position_ != written_position_ && | 2418 if (current_position_ != written_position_ && |
2408 current_position_ != written_statement_position_) { | 2419 current_position_ != written_statement_position_) { |
2409 EnsureSpace ensure_space(this); | 2420 EnsureSpace ensure_space(this); |
2410 RecordRelocInfo(RelocInfo::POSITION, current_position_); | 2421 RecordRelocInfo(RelocInfo::POSITION, current_position_); |
2411 written_position_ = current_position_; | 2422 written_position_ = current_position_; |
| 2423 written = true; |
2412 } | 2424 } |
| 2425 |
| 2426 // Return whether something was written. |
| 2427 return written; |
2413 } | 2428 } |
2414 | 2429 |
2415 | 2430 |
2416 void Assembler::GrowBuffer() { | 2431 void Assembler::GrowBuffer() { |
2417 ASSERT(overflow()); | 2432 ASSERT(overflow()); |
2418 if (!own_buffer_) FATAL("external code buffer is too small"); | 2433 if (!own_buffer_) FATAL("external code buffer is too small"); |
2419 | 2434 |
2420 // Compute new buffer size. | 2435 // Compute new buffer size. |
2421 CodeDesc desc; // the new buffer | 2436 CodeDesc desc; // the new buffer |
2422 if (buffer_size_ < 4*KB) { | 2437 if (buffer_size_ < 4*KB) { |
(...skipping 160 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
2583 fprintf(coverage_log, "%s\n", file_line); | 2598 fprintf(coverage_log, "%s\n", file_line); |
2584 fflush(coverage_log); | 2599 fflush(coverage_log); |
2585 } | 2600 } |
2586 } | 2601 } |
2587 | 2602 |
2588 #endif | 2603 #endif |
2589 | 2604 |
2590 } } // namespace v8::internal | 2605 } } // namespace v8::internal |
2591 | 2606 |
2592 #endif // V8_TARGET_ARCH_IA32 | 2607 #endif // V8_TARGET_ARCH_IA32 |
OLD | NEW |