Chromium Code Reviews
chromiumcodereview-hr@appspot.gserviceaccount.com (chromiumcodereview-hr) | Please choose your nickname with Settings | Help | Chromium Project | Gerrit Changes | Sign out
(329)

Side by Side Diff: src/x64/assembler-x64.h

Issue 113767: Implementation of a few more assembly instructions on x64 (Closed) Base URL: http://v8.googlecode.com/svn/branches/bleeding_edge/
Patch Set: '' Created 11 years, 7 months ago
Use n/p to move between diff chunks; N/P to move between comments. Draft comments are only viewable by you.
Jump to:
View unified diff | Download patch | Annotate | Revision Log
« no previous file with comments | « no previous file | src/x64/assembler-x64.cc » ('j') | no next file with comments »
Toggle Intra-line Diffs ('i') | Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
OLDNEW
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 419 matching lines...) Expand 10 before | Expand all | Expand 10 after
430 private: 430 private:
431 static uint64_t supported_; 431 static uint64_t supported_;
432 static uint64_t enabled_; 432 static uint64_t enabled_;
433 }; 433 };
434 434
435 435
436 class Assembler : public Malloced { 436 class Assembler : public Malloced {
437 private: 437 private:
438 // The relocation writer's position is kGap bytes below the end of 438 // The relocation writer's position is kGap bytes below the end of
439 // the generated instructions. This leaves enough space for the 439 // the generated instructions. This leaves enough space for the
440 // longest possible ia32 instruction (17 bytes as of 9/26/06) and 440 // longest possible x64 instruction (There is a 15 byte limit on
441 // instruction length, ruling out some otherwise valid instructions) and
441 // allows for a single, fast space check per instruction. 442 // allows for a single, fast space check per instruction.
442 static const int kGap = 32; 443 static const int kGap = 32;
443 444
444 public: 445 public:
445 // Create an assembler. Instructions and relocation information are emitted 446 // Create an assembler. Instructions and relocation information are emitted
446 // into a buffer, with the instructions starting from the beginning and the 447 // into a buffer, with the instructions starting from the beginning and the
447 // relocation information starting from the end of the buffer. See CodeDesc 448 // relocation information starting from the end of the buffer. See CodeDesc
448 // for a detailed comment on the layout (globals.h). 449 // for a detailed comment on the layout (globals.h).
449 // 450 //
450 // If the provided buffer is NULL, the assembler allocates and grows its own 451 // If the provided buffer is NULL, the assembler allocates and grows its own
(...skipping 17 matching lines...) Expand all
468 inline static void set_target_address_at(Address pc, Address target); 469 inline static void set_target_address_at(Address pc, Address target);
469 470
470 // Distance between the address of the code target in the call instruction 471 // Distance between the address of the code target in the call instruction
471 // and the return address 472 // and the return address
472 static const int kTargetAddrToReturnAddrDist = kPointerSize; 473 static const int kTargetAddrToReturnAddrDist = kPointerSize;
473 474
474 475
475 // --------------------------------------------------------------------------- 476 // ---------------------------------------------------------------------------
476 // Code generation 477 // Code generation
477 // 478 //
478 // - function names correspond one-to-one to ia32 instruction mnemonics 479 // Function names correspond one-to-one to x64 instruction mnemonics.
479 // - unless specified otherwise, instructions operate on 32bit operands 480 // Unless specified otherwise, instructions operate on 64-bit operands.
480 // - instructions on 8bit (byte) operands/registers have a trailing '_b' 481 //
481 // - instructions on 16bit (word) operands/registers have a trailing '_w' 482 // If we need versions of an assembly instruction that operate on different
482 // - naming conflicts with C++ keywords are resolved via a trailing '_' 483 // width arguments, we add a single-letter suffix specifying the width.
483 484 // This is done for the following instructions: mov, cmp.
484 // NOTE ON INTERFACE: Currently, the interface is not very consistent 485 // There are no versions of these instructions without the suffix.
485 // in the sense that some operations (e.g. mov()) can be called in more 486 // - Instructions on 8-bit (byte) operands/registers have a trailing 'b'.
486 // the one way to generate the same instruction: The Register argument 487 // - Instructions on 16-bit (word) operands/registers have a trailing 'w'.
487 // can in some cases be replaced with an Operand(Register) argument. 488 // - Instructions on 32-bit (doubleword) operands/registers use 'l'.
488 // This should be cleaned up and made more orthogonal. The questions 489 // - Instructions on 64-bit (quadword) operands/registers use 'q'.
489 // is: should we always use Operands instead of Registers where an 490 //
490 // Operand is possible, or should we have a Register (overloaded) form 491 // Some mnemonics, such as "and", are the same as C++ keywords.
491 // instead? We must be careful to make sure that the selected instruction 492 // Naming conflicts with C++ keywords are resolved by adding a trailing '_'.
492 // is obvious from the parameters to avoid hard-to-find code generation
493 // bugs.
494 493
495 // Insert the smallest number of nop instructions 494 // Insert the smallest number of nop instructions
496 // possible to align the pc offset to a multiple 495 // possible to align the pc offset to a multiple
497 // of m. m must be a power of 2. 496 // of m. m must be a power of 2.
498 void Align(int m); 497 void Align(int m);
499 498
500 // Stack 499 // Stack
501 void pushad(); 500 void pushad();
502 void popad(); 501 void popad();
503 502
(...skipping 41 matching lines...) Expand 10 before | Expand all | Expand 10 after
545 void cmov(Condition cc, Register dst, Handle<Object> handle); 544 void cmov(Condition cc, Register dst, Handle<Object> handle);
546 void cmov(Condition cc, Register dst, const Operand& src); 545 void cmov(Condition cc, Register dst, const Operand& src);
547 546
548 // Exchange two registers 547 // Exchange two registers
549 void xchg(Register dst, Register src); 548 void xchg(Register dst, Register src);
550 549
551 // Arithmetics 550 // Arithmetics
552 void adc(Register dst, int32_t imm32); 551 void adc(Register dst, int32_t imm32);
553 void adc(Register dst, const Operand& src); 552 void adc(Register dst, const Operand& src);
554 553
554 void add(Register dst, Register src);
555 void add(Register dst, const Operand& src); 555 void add(Register dst, const Operand& src);
556 void add(const Operand& dst, const Immediate& x); 556 void add(const Operand& dst, const Immediate& x);
557 557
558 void and_(Register dst, int32_t imm32); 558 void and_(Register dst, int32_t imm32);
559 void and_(Register dst, const Operand& src); 559 void and_(Register dst, const Operand& src);
560 void and_(const Operand& src, Register dst); 560 void and_(const Operand& src, Register dst);
561 void and_(const Operand& dst, const Immediate& x); 561 void and_(const Operand& dst, const Immediate& x);
562 562
563 void cmpb(const Operand& op, int8_t imm8); 563 void cmpb(const Operand& op, int8_t imm8);
564 void cmpb_al(const Operand& op); 564 void cmpb_al(const Operand& op);
(...skipping 337 matching lines...) Expand 10 before | Expand all | Expand 10 after
902 private: 902 private:
903 Assembler* assembler_; 903 Assembler* assembler_;
904 #ifdef DEBUG 904 #ifdef DEBUG
905 int space_before_; 905 int space_before_;
906 #endif 906 #endif
907 }; 907 };
908 908
909 } } // namespace v8::internal 909 } } // namespace v8::internal
910 910
911 #endif // V8_X64_ASSEMBLER_X64_H_ 911 #endif // V8_X64_ASSEMBLER_X64_H_
OLDNEW
« no previous file with comments | « no previous file | src/x64/assembler-x64.cc » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698