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 378 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
389 #endif | 389 #endif |
390 }; | 390 }; |
391 private: | 391 private: |
392 static uint64_t supported_; | 392 static uint64_t supported_; |
393 static uint64_t enabled_; | 393 static uint64_t enabled_; |
394 }; | 394 }; |
395 | 395 |
396 | 396 |
397 class Assembler : public Malloced { | 397 class Assembler : public Malloced { |
398 private: | 398 private: |
399 // The relocation writer's position is kGap bytes below the end of | 399 // We check before assembling an instruction that there is sufficient |
| 400 // space to write an instruction and its relocation information. |
| 401 // The relocation writer's position must be kGap bytes above the end of |
400 // the generated instructions. This leaves enough space for the | 402 // the generated instructions. This leaves enough space for the |
401 // longest possible ia32 instruction (17 bytes as of 9/26/06) and | 403 // longest possible ia32 instruction, 15 bytes, and the longest possible |
402 // allows for a single, fast space check per instruction. | 404 // relocation information encoding, RelocInfoWriter::kMaxLength == 16. |
| 405 // (There is a 15 byte limit on ia32 instruction length that rules out some |
| 406 // otherwise valid instructions.) |
| 407 // This allows for a single, fast space check per instruction. |
403 static const int kGap = 32; | 408 static const int kGap = 32; |
404 | 409 |
405 public: | 410 public: |
406 // Create an assembler. Instructions and relocation information are emitted | 411 // Create an assembler. Instructions and relocation information are emitted |
407 // into a buffer, with the instructions starting from the beginning and the | 412 // into a buffer, with the instructions starting from the beginning and the |
408 // relocation information starting from the end of the buffer. See CodeDesc | 413 // relocation information starting from the end of the buffer. See CodeDesc |
409 // for a detailed comment on the layout (globals.h). | 414 // for a detailed comment on the layout (globals.h). |
410 // | 415 // |
411 // If the provided buffer is NULL, the assembler allocates and grows its own | 416 // If the provided buffer is NULL, the assembler allocates and grows its own |
412 // buffer, and buffer_size determines the initial buffer size. The buffer is | 417 // buffer, and buffer_size determines the initial buffer size. The buffer is |
(...skipping 439 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
852 private: | 857 private: |
853 Assembler* assembler_; | 858 Assembler* assembler_; |
854 #ifdef DEBUG | 859 #ifdef DEBUG |
855 int space_before_; | 860 int space_before_; |
856 #endif | 861 #endif |
857 }; | 862 }; |
858 | 863 |
859 } } // namespace v8::internal | 864 } } // namespace v8::internal |
860 | 865 |
861 #endif // V8_IA32_ASSEMBLER_IA32_H_ | 866 #endif // V8_IA32_ASSEMBLER_IA32_H_ |
OLD | NEW |