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

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

Issue 3117007: Allow compiling with strict aliasing enabled on GCC 4.4. (Closed)
Patch Set: Created 10 years, 4 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
« no previous file with comments | « src/utils.h ('k') | tools/gyp/v8.gyp » ('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 2009 the V8 project authors. All rights reserved. 1 // Copyright 2009 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 235 matching lines...) Expand 10 before | Expand all | Expand 10 after
246 bool has_sib = ((modrm & 0x07) == 0x04); 246 bool has_sib = ((modrm & 0x07) == 0x04);
247 byte mode = modrm & 0xC0; 247 byte mode = modrm & 0xC0;
248 int disp_offset = has_sib ? 2 : 1; 248 int disp_offset = has_sib ? 2 : 1;
249 int base_reg = (has_sib ? operand.buf_[1] : modrm) & 0x07; 249 int base_reg = (has_sib ? operand.buf_[1] : modrm) & 0x07;
250 // Mode 0 with rbp/r13 as ModR/M or SIB base register always has a 32-bit 250 // Mode 0 with rbp/r13 as ModR/M or SIB base register always has a 32-bit
251 // displacement. 251 // displacement.
252 bool is_baseless = (mode == 0) && (base_reg == 0x05); // No base or RIP base. 252 bool is_baseless = (mode == 0) && (base_reg == 0x05); // No base or RIP base.
253 int32_t disp_value = 0; 253 int32_t disp_value = 0;
254 if (mode == 0x80 || is_baseless) { 254 if (mode == 0x80 || is_baseless) {
255 // Mode 2 or mode 0 with rbp/r13 as base: Word displacement. 255 // Mode 2 or mode 0 with rbp/r13 as base: Word displacement.
256 disp_value = *reinterpret_cast<const int32_t*>(&operand.buf_[disp_offset]); 256 disp_value = *BitCast<const int32_t*>(&operand.buf_[disp_offset]);
257 } else if (mode == 0x40) { 257 } else if (mode == 0x40) {
258 // Mode 1: Byte displacement. 258 // Mode 1: Byte displacement.
259 disp_value = static_cast<signed char>(operand.buf_[disp_offset]); 259 disp_value = static_cast<signed char>(operand.buf_[disp_offset]);
260 } 260 }
261 261
262 // Write new operand with same registers, but with modified displacement. 262 // Write new operand with same registers, but with modified displacement.
263 ASSERT(offset >= 0 ? disp_value + offset > disp_value 263 ASSERT(offset >= 0 ? disp_value + offset > disp_value
264 : disp_value + offset < disp_value); // No overflow. 264 : disp_value + offset < disp_value); // No overflow.
265 disp_value += offset; 265 disp_value += offset;
266 rex_ = operand.rex_; 266 rex_ = operand.rex_;
(...skipping 2682 matching lines...) Expand 10 before | Expand all | Expand 10 after
2949 // specially coded on x64 means that it is a relative 32 bit address, as used 2949 // specially coded on x64 means that it is a relative 32 bit address, as used
2950 // by branch instructions. 2950 // by branch instructions.
2951 return (1 << rmode_) & kApplyMask; 2951 return (1 << rmode_) & kApplyMask;
2952 } 2952 }
2953 2953
2954 2954
2955 2955
2956 } } // namespace v8::internal 2956 } } // namespace v8::internal
2957 2957
2958 #endif // V8_TARGET_ARCH_X64 2958 #endif // V8_TARGET_ARCH_X64
OLDNEW
« no previous file with comments | « src/utils.h ('k') | tools/gyp/v8.gyp » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698