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

Side by Side Diff: src/trusted/validator/x86/x86_insts.c

Issue 7980021: Speed up x86-64 validator by inlining heavily called routines. Speeds up (Closed) Base URL: svn://svn.chromium.org/native_client/trunk/src/native_client/
Patch Set: Created 9 years, 3 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
OLDNEW
1 /* 1 /*
2 * Copyright (c) 2011 The Native Client Authors. All rights reserved. 2 * Copyright (c) 2011 The Native Client Authors. All rights reserved.
3 * Use of this source code is governed by a BSD-style license that can be 3 * Use of this source code is governed by a BSD-style license that can be
4 * found in the LICENSE file. 4 * found in the LICENSE file.
5 */ 5 */
6 6
7 #include "native_client/src/trusted/validator/x86/x86_insts.h" 7 #include "native_client/src/trusted/validator/x86/x86_insts.h"
8 #include "native_client/src/trusted/validator/x86/x86_insts_inl.h"
8 9
9 /* Defines the range of possible (initial) opcodes for x87 instructions. */ 10 /* Defines the range of possible (initial) opcodes for x87 instructions. */
10 const uint8_t kFirstX87Opcode = 0xd8; 11 const uint8_t kFirstX87Opcode = 0xd8;
11 const uint8_t kLastX87Opcode = 0xdf; 12 const uint8_t kLastX87Opcode = 0xdf;
12 13
13 /* Defines the opcode for the WAIT instruction. 14 /* Defines the opcode for the WAIT instruction.
14 * Note: WAIT is an x87 instruction but not in the coproc opcode space. 15 * Note: WAIT is an x87 instruction but not in the coproc opcode space.
15 */ 16 */
16 const uint8_t kWAITOp = 0x9b; 17 const uint8_t kWAITOp = 0x9b;
17 18
18 const uint8_t kTwoByteOpcodeByte1 = 0x0f; 19 const uint8_t kTwoByteOpcodeByte1 = 0x0f;
19 const uint8_t k3DNowOpcodeByte2 = 0x0f; 20 const uint8_t k3DNowOpcodeByte2 = 0x0f;
20 const int kMaxPrefixBytes = 4; 21 const int kMaxPrefixBytes = 4;
21 22
22 /* Accessors for the ModRm byte. */ 23 /* Accessors for the ModRm byte. */
23 uint8_t modrm_mod(uint8_t modrm) { return ((modrm >> 6) & 0x03);} 24 uint8_t modrm_mod(uint8_t modrm) {
24 uint8_t modrm_rm(uint8_t modrm) { return (modrm & 0x07); } 25 return modrm_modInline(modrm);
25 uint8_t modrm_reg(uint8_t modrm) { return ((modrm >> 3) & 0x07); } 26 }
26 uint8_t modrm_opcode(uint8_t modrm) { return modrm_reg(modrm); } 27
28 uint8_t modrm_rm(uint8_t modrm) {
29 return modrm_rmInline(modrm);
30 }
31
32 uint8_t modrm_reg(uint8_t modrm) {
33 return modrm_regInline(modrm);
34 }
35
36 uint8_t modrm_opcode(uint8_t modrm) {
37 return modrm_opcodeInline(modrm);
38 }
27 39
28 /* Accessors for the Sib byte. */ 40 /* Accessors for the Sib byte. */
29 uint8_t sib_ss(uint8_t sib) { return ((sib >> 6) & 0x03); } 41 uint8_t sib_ss(uint8_t sib) { return ((sib >> 6) & 0x03); }
30 uint8_t sib_index(uint8_t sib) { return ((sib >> 3) & 0x07); } 42 uint8_t sib_index(uint8_t sib) { return ((sib >> 3) & 0x07); }
31 uint8_t sib_base(uint8_t sib) { return (sib & 0x07); } 43 uint8_t sib_base(uint8_t sib) { return (sib & 0x07); }
32 44
33 /* Defines the corresponding mask for the bits of the the Rex prefix. */ 45 /* Defines the corresponding mask for the bits of the the Rex prefix. */
34 #define NaClRexWMask 0x8 46 #define NaClRexWMask 0x8
35 #define NaClRexRMask 0x4 47 #define NaClRexRMask 0x4
36 #define NaClRexXMask 0x2 48 #define NaClRexXMask 0x2
(...skipping 11 matching lines...) Expand all
48 return NaClHasBit(prefix, NaClRexRMask); 60 return NaClHasBit(prefix, NaClRexRMask);
49 } 61 }
50 62
51 uint8_t NaClRexX(uint8_t prefix) { 63 uint8_t NaClRexX(uint8_t prefix) {
52 return NaClHasBit(prefix, NaClRexXMask); 64 return NaClHasBit(prefix, NaClRexXMask);
53 } 65 }
54 66
55 uint8_t NaClRexB(uint8_t prefix) { 67 uint8_t NaClRexB(uint8_t prefix) {
56 return NaClHasBit(prefix, NaClRexBMask); 68 return NaClHasBit(prefix, NaClRexBMask);
57 } 69 }
OLDNEW

Powered by Google App Engine
This is Rietveld 408576698