| 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 387 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 398 // | 398 // |
| 399 // If the provided buffer is not NULL, the assembler uses the provided buffer | 399 // If the provided buffer is not NULL, the assembler uses the provided buffer |
| 400 // for code generation and assumes its size to be buffer_size. If the buffer | 400 // for code generation and assumes its size to be buffer_size. If the buffer |
| 401 // is too small, a fatal error occurs. No deallocation of the buffer is done | 401 // is too small, a fatal error occurs. No deallocation of the buffer is done |
| 402 // upon destruction of the assembler. | 402 // upon destruction of the assembler. |
| 403 Assembler(void* buffer, int buffer_size); | 403 Assembler(void* buffer, int buffer_size); |
| 404 ~Assembler(); | 404 ~Assembler(); |
| 405 | 405 |
| 406 // GetCode emits any pending (non-emitted) code and fills the descriptor | 406 // GetCode emits any pending (non-emitted) code and fills the descriptor |
| 407 // desc. GetCode() is idempotent; it returns the same result if no other | 407 // desc. GetCode() is idempotent; it returns the same result if no other |
| 408 // Assembler functions are invoked inbetween GetCode() calls. | 408 // Assembler functions are invoked in between GetCode() calls. |
| 409 void GetCode(CodeDesc* desc); | 409 void GetCode(CodeDesc* desc); |
| 410 | 410 |
| 411 // Read/Modify the code target in the branch/call instruction at pc. | 411 // Read/Modify the code target in the branch/call instruction at pc. |
| 412 inline static Address target_address_at(Address pc); | 412 inline static Address target_address_at(Address pc); |
| 413 inline static void set_target_address_at(Address pc, Address target); | 413 inline static void set_target_address_at(Address pc, Address target); |
| 414 | 414 |
| 415 // Distance between the address of the code target in the call instruction | 415 // Distance between the address of the code target in the call instruction |
| 416 // and the return address | 416 // and the return address |
| 417 static const int kTargetAddrToReturnAddrDist = kPointerSize; | 417 static const int kTargetAddrToReturnAddrDist = kPointerSize; |
| 418 | 418 |
| 419 | 419 |
| 420 // --------------------------------------------------------------------------- | 420 // --------------------------------------------------------------------------- |
| 421 // Code generation | 421 // Code generation |
| 422 // | 422 // |
| 423 // - function names correspond one-to-one to ia32 instruction mnemonics | 423 // - function names correspond one-to-one to ia32 instruction mnemonics |
| 424 // - unless specified otherwise, instructions operate on 32bit operands | 424 // - unless specified otherwise, instructions operate on 32bit operands |
| 425 // - instructions on 8bit (byte) operands/registers have a trailing '_b' | 425 // - instructions on 8bit (byte) operands/registers have a trailing '_b' |
| 426 // - instructions on 16bit (word) operands/registers have a trailing '_w' | 426 // - instructions on 16bit (word) operands/registers have a trailing '_w' |
| 427 // - naming conflicts with C++ keywords are resolved via a trailing '_' | 427 // - naming conflicts with C++ keywords are resolved via a trailing '_' |
| 428 | 428 |
| 429 // NOTE ON INTERFACE: Currently, the interface is not very consistent | 429 // NOTE ON INTERFACE: Currently, the interface is not very consistent |
| 430 // in the sense that some operations (e.g. mov()) can be called in more | 430 // in the sense that some operations (e.g. mov()) can be called in more |
| 431 // the one way to generate the same instruction: The Register argument | 431 // the one way to generate the same instruction: The Register argument |
| 432 // can in some cases be replaced with an Operand(Register) argument. | 432 // can in some cases be replaced with an Operand(Register) argument. |
| 433 // This should be cleaned up and made more othogonal. The questions | 433 // This should be cleaned up and made more orthogonal. The questions |
| 434 // is: should we always use Operands instead of Registers where an | 434 // is: should we always use Operands instead of Registers where an |
| 435 // Operand is possible, or should we have a Register (overloaded) form | 435 // Operand is possible, or should we have a Register (overloaded) form |
| 436 // instead? We must be carefull to make sure that the selected instruction | 436 // instead? We must be careful to make sure that the selected instruction |
| 437 // is obvious from the parameters to avoid hard-to-find code generation | 437 // is obvious from the parameters to avoid hard-to-find code generation |
| 438 // bugs. | 438 // bugs. |
| 439 | 439 |
| 440 // Insert the smallest number of nop instructions | 440 // Insert the smallest number of nop instructions |
| 441 // possible to align the pc offset to a multiple | 441 // possible to align the pc offset to a multiple |
| 442 // of m. m must be a power of 2. | 442 // of m. m must be a power of 2. |
| 443 void Align(int m); | 443 void Align(int m); |
| 444 | 444 |
| 445 // Stack | 445 // Stack |
| 446 void pushad(); | 446 void pushad(); |
| (...skipping 383 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 830 private: | 830 private: |
| 831 Assembler* assembler_; | 831 Assembler* assembler_; |
| 832 #ifdef DEBUG | 832 #ifdef DEBUG |
| 833 int space_before_; | 833 int space_before_; |
| 834 #endif | 834 #endif |
| 835 }; | 835 }; |
| 836 | 836 |
| 837 } } // namespace v8::internal | 837 } } // namespace v8::internal |
| 838 | 838 |
| 839 #endif // V8_ASSEMBLER_IA32_H_ | 839 #endif // V8_ASSEMBLER_IA32_H_ |
| OLD | NEW |