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 364 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
375 | 375 |
376 | 376 |
377 void Assembler::Align(int m) { | 377 void Assembler::Align(int m) { |
378 ASSERT(IsPowerOf2(m)); | 378 ASSERT(IsPowerOf2(m)); |
379 while ((pc_offset() & (m - 1)) != 0) { | 379 while ((pc_offset() & (m - 1)) != 0) { |
380 nop(); | 380 nop(); |
381 } | 381 } |
382 } | 382 } |
383 | 383 |
384 | 384 |
| 385 void Assembler::CodeTargetAlign() { |
| 386 Align(16); // Preferred alignment of jump targets on x64. |
| 387 } |
| 388 |
| 389 |
385 void Assembler::bind_to(Label* L, int pos) { | 390 void Assembler::bind_to(Label* L, int pos) { |
386 ASSERT(!L->is_bound()); // Label may only be bound once. | 391 ASSERT(!L->is_bound()); // Label may only be bound once. |
387 last_pc_ = NULL; | 392 last_pc_ = NULL; |
388 ASSERT(0 <= pos && pos <= pc_offset()); // Position must be valid. | 393 ASSERT(0 <= pos && pos <= pc_offset()); // Position must be valid. |
389 if (L->is_linked()) { | 394 if (L->is_linked()) { |
390 int current = L->pos(); | 395 int current = L->pos(); |
391 int next = long_at(current); | 396 int next = long_at(current); |
392 while (next != current) { | 397 while (next != current) { |
393 // Relative address, relative to point after address. | 398 // Relative address, relative to point after address. |
394 int imm32 = pos - (current + sizeof(int32_t)); | 399 int imm32 = pos - (current + sizeof(int32_t)); |
(...skipping 2469 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
2864 // specially coded on x64 means that it is a relative 32 bit address, as used | 2869 // specially coded on x64 means that it is a relative 32 bit address, as used |
2865 // by branch instructions. | 2870 // by branch instructions. |
2866 return (1 << rmode_) & kApplyMask; | 2871 return (1 << rmode_) & kApplyMask; |
2867 } | 2872 } |
2868 | 2873 |
2869 | 2874 |
2870 | 2875 |
2871 } } // namespace v8::internal | 2876 } } // namespace v8::internal |
2872 | 2877 |
2873 #endif // V8_TARGET_ARCH_X64 | 2878 #endif // V8_TARGET_ARCH_X64 |
OLD | NEW |