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 are | 5 // modification, are permitted provided that the following conditions are |
6 // met: | 6 // 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 360 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
371 #endif | 371 #endif |
372 }; | 372 }; |
373 private: | 373 private: |
374 static uint64_t supported_; | 374 static uint64_t supported_; |
375 static uint64_t enabled_; | 375 static uint64_t enabled_; |
376 }; | 376 }; |
377 | 377 |
378 | 378 |
379 class Assembler : public Malloced { | 379 class Assembler : public Malloced { |
380 private: | 380 private: |
381 // The relocation writer's position is kGap bytes below the end of | 381 // We check before assembling an instruction that there is sufficient |
| 382 // space to write an instruction and its relocation information. |
| 383 // The relocation writer's position must be kGap bytes above the end of |
382 // the generated instructions. This leaves enough space for the | 384 // the generated instructions. This leaves enough space for the |
383 // longest possible x64 instruction (There is a 15 byte limit on | 385 // longest possible x64 instruction, 15 bytes, and the longest possible |
384 // instruction length, ruling out some otherwise valid instructions) and | 386 // relocation information encoding, RelocInfoWriter::kMaxLength == 16. |
385 // allows for a single, fast space check per instruction. | 387 // (There is a 15 byte limit on x64 instruction length that rules out some |
| 388 // otherwise valid instructions.) |
| 389 // This allows for a single, fast space check per instruction. |
386 static const int kGap = 32; | 390 static const int kGap = 32; |
387 | 391 |
388 public: | 392 public: |
389 // Create an assembler. Instructions and relocation information are emitted | 393 // Create an assembler. Instructions and relocation information are emitted |
390 // into a buffer, with the instructions starting from the beginning and the | 394 // into a buffer, with the instructions starting from the beginning and the |
391 // relocation information starting from the end of the buffer. See CodeDesc | 395 // relocation information starting from the end of the buffer. See CodeDesc |
392 // for a detailed comment on the layout (globals.h). | 396 // for a detailed comment on the layout (globals.h). |
393 // | 397 // |
394 // If the provided buffer is NULL, the assembler allocates and grows its own | 398 // If the provided buffer is NULL, the assembler allocates and grows its own |
395 // buffer, and buffer_size determines the initial buffer size. The buffer is | 399 // buffer, and buffer_size determines the initial buffer size. The buffer is |
(...skipping 707 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
1103 private: | 1107 private: |
1104 Assembler* assembler_; | 1108 Assembler* assembler_; |
1105 #ifdef DEBUG | 1109 #ifdef DEBUG |
1106 int space_before_; | 1110 int space_before_; |
1107 #endif | 1111 #endif |
1108 }; | 1112 }; |
1109 | 1113 |
1110 } } // namespace v8::internal | 1114 } } // namespace v8::internal |
1111 | 1115 |
1112 #endif // V8_X64_ASSEMBLER_X64_H_ | 1116 #endif // V8_X64_ASSEMBLER_X64_H_ |
OLD | NEW |