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

Side by Side Diff: src/a64/instructions-a64.h

Issue 195873009: Speed up A64 simulator by removing useless memcpy. (Closed) Base URL: https://v8.googlecode.com/svn/branches/bleeding_edge
Patch Set: Rebased Created 6 years, 9 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 | no next file » | no next file with comments »
Toggle Intra-line Diffs ('i') | Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
OLDNEW
1 // Copyright 2013 the V8 project authors. All rights reserved. 1 // Copyright 2013 the V8 project authors. All rights reserved.
2 // Redistribution and use in source and binary forms, with or without 2 // Redistribution and use in source and binary forms, with or without
3 // modification, are permitted provided that the following conditions are 3 // modification, are permitted provided that the following conditions are
4 // met: 4 // met:
5 // 5 //
6 // * Redistributions of source code must retain the above copyright 6 // * Redistributions of source code must retain the above copyright
7 // notice, this list of conditions and the following disclaimer. 7 // notice, this list of conditions and the following disclaimer.
8 // * Redistributions in binary form must reproduce the above 8 // * Redistributions in binary form must reproduce the above
9 // copyright notice, this list of conditions and the following 9 // copyright notice, this list of conditions and the following
10 // disclaimer in the documentation and/or other materials provided 10 // disclaimer in the documentation and/or other materials provided
(...skipping 101 matching lines...) Expand 10 before | Expand all | Expand 10 after
112 112
113 enum Reg31Mode { 113 enum Reg31Mode {
114 Reg31IsStackPointer, 114 Reg31IsStackPointer,
115 Reg31IsZeroRegister 115 Reg31IsZeroRegister
116 }; 116 };
117 117
118 // Instructions. --------------------------------------------------------------- 118 // Instructions. ---------------------------------------------------------------
119 119
120 class Instruction { 120 class Instruction {
121 public: 121 public:
122 Instr InstructionBits() const { 122 V8_INLINE Instr InstructionBits() const {
123 Instr bits; 123 return *reinterpret_cast<const Instr*>(this);
124 memcpy(&bits, this, sizeof(bits));
125 return bits;
126 } 124 }
127 125
128 void SetInstructionBits(Instr new_instr) { 126 V8_INLINE void SetInstructionBits(Instr new_instr) {
129 memcpy(this, &new_instr, sizeof(new_instr)); 127 *reinterpret_cast<Instr*>(this) = new_instr;
130 } 128 }
131 129
132 int Bit(int pos) const { 130 int Bit(int pos) const {
133 return (InstructionBits() >> pos) & 1; 131 return (InstructionBits() >> pos) & 1;
134 } 132 }
135 133
136 uint32_t Bits(int msb, int lsb) const { 134 uint32_t Bits(int msb, int lsb) const {
137 return unsigned_bitextract_32(msb, lsb, InstructionBits()); 135 return unsigned_bitextract_32(msb, lsb, InstructionBits());
138 } 136 }
139 137
(...skipping 222 matching lines...) Expand 10 before | Expand all | Expand 10 after
362 // a PC-relative addressing instruction. 360 // a PC-relative addressing instruction.
363 void SetImmPCOffsetTarget(Instruction* target); 361 void SetImmPCOffsetTarget(Instruction* target);
364 // Patch a literal load instruction to load from 'source'. 362 // Patch a literal load instruction to load from 'source'.
365 void SetImmLLiteral(Instruction* source); 363 void SetImmLLiteral(Instruction* source);
366 364
367 uint8_t* LiteralAddress() { 365 uint8_t* LiteralAddress() {
368 int offset = ImmLLiteral() << kLiteralEntrySizeLog2; 366 int offset = ImmLLiteral() << kLiteralEntrySizeLog2;
369 return reinterpret_cast<uint8_t*>(this) + offset; 367 return reinterpret_cast<uint8_t*>(this) + offset;
370 } 368 }
371 369
372 uint32_t Literal32() {
373 uint32_t literal;
374 memcpy(&literal, LiteralAddress(), sizeof(literal));
375
376 return literal;
377 }
378
379 uint64_t Literal64() {
380 uint64_t literal;
381 memcpy(&literal, LiteralAddress(), sizeof(literal));
382
383 return literal;
384 }
385
386 float LiteralFP32() {
387 return rawbits_to_float(Literal32());
388 }
389
390 double LiteralFP64() {
391 return rawbits_to_double(Literal64());
392 }
393
394 Instruction* NextInstruction() { 370 Instruction* NextInstruction() {
395 return this + kInstructionSize; 371 return this + kInstructionSize;
396 } 372 }
397 373
398 Instruction* InstructionAtOffset(int64_t offset) { 374 Instruction* InstructionAtOffset(int64_t offset) {
399 ASSERT(IsAligned(reinterpret_cast<uintptr_t>(this) + offset, 375 ASSERT(IsAligned(reinterpret_cast<uintptr_t>(this) + offset,
400 kInstructionSize)); 376 kInstructionSize));
401 return this + offset; 377 return this + offset;
402 } 378 }
403 379
(...skipping 107 matching lines...) Expand 10 before | Expand all | Expand 10 after
511 TRACE_ENABLE = 1 << 6, 487 TRACE_ENABLE = 1 << 6,
512 TRACE_DISABLE = 2 << 6, 488 TRACE_DISABLE = 2 << 6,
513 TRACE_OVERRIDE = 3 << 6 489 TRACE_OVERRIDE = 3 << 6
514 }; 490 };
515 491
516 492
517 } } // namespace v8::internal 493 } } // namespace v8::internal
518 494
519 495
520 #endif // V8_A64_INSTRUCTIONS_A64_H_ 496 #endif // V8_A64_INSTRUCTIONS_A64_H_
OLDNEW
« no previous file with comments | « no previous file | no next file » | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698