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

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

Issue 6347067: Fix potential overwriting of debug jumps of following code. (Closed) Base URL: https://v8.googlecode.com/svn/branches/bleeding_edge/build-x64
Patch Set: Created 9 years, 10 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 // Copyright 2010 the V8 project authors. All rights reserved. 1 // Copyright 2010 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 396 matching lines...) Expand 10 before | Expand all | Expand 10 after
407 desc->instr_size = pc_offset(); 407 desc->instr_size = pc_offset();
408 ASSERT(desc->instr_size > 0); // Zero-size code objects upset the system. 408 ASSERT(desc->instr_size > 0); // Zero-size code objects upset the system.
409 desc->reloc_size = 409 desc->reloc_size =
410 static_cast<int>((buffer_ + buffer_size_) - reloc_info_writer.pos()); 410 static_cast<int>((buffer_ + buffer_size_) - reloc_info_writer.pos());
411 desc->origin = this; 411 desc->origin = this;
412 412
413 Counters::reloc_info_size.Increment(desc->reloc_size); 413 Counters::reloc_info_size.Increment(desc->reloc_size);
414 } 414 }
415 415
416 416
417 void Assembler::Pad(int n) {
Rico 2011/02/02 11:35:37 Not used
Lasse Reichstein 2011/02/03 14:14:12 Removed.
418 ASSERT(n > 0);
419 while (n > 9) {
420 nop(9);
421 n -= 9;
422 }
423 nop(n);
424 }
425
426
417 void Assembler::Align(int m) { 427 void Assembler::Align(int m) {
418 ASSERT(IsPowerOf2(m)); 428 ASSERT(IsPowerOf2(m));
419 int delta = (m - (pc_offset() & (m - 1))) & (m - 1); 429 int delta = (m - (pc_offset() & (m - 1))) & (m - 1);
420 while (delta >= 9) { 430 while (delta >= 9) {
421 nop(9); 431 nop(9);
422 delta -= 9; 432 delta -= 9;
423 } 433 }
424 if (delta > 0) { 434 if (delta > 0) {
425 nop(delta); 435 nop(delta);
426 } 436 }
(...skipping 482 matching lines...) Expand 10 before | Expand all | Expand 10 after
909 positions_recorder()->WriteRecordedPositions(); 919 positions_recorder()->WriteRecordedPositions();
910 EnsureSpace ensure_space(this); 920 EnsureSpace ensure_space(this);
911 last_pc_ = pc_; 921 last_pc_ = pc_;
912 // Opcode: FF /2 m64. 922 // Opcode: FF /2 m64.
913 emit_optional_rex_32(op); 923 emit_optional_rex_32(op);
914 emit(0xFF); 924 emit(0xFF);
915 emit_operand(0x2, op); 925 emit_operand(0x2, op);
916 } 926 }
917 927
918 928
929 void Assembler::call(Address target) {
930 positions_recorder()->WriteRecordedPositions();
931 EnsureSpace ensure_space(this);
932 last_pc_ = pc_;
933 // 1110 1000 #32-bit disp.
934 emit(0xE8);
935 Address source = pc_ + 4;
936 intptr_t displacement = target - source;
937 ASSERT(is_int32(displacement));
938 emitl(static_cast<int32_t>(displacement));
939 }
940
941
919 void Assembler::clc() { 942 void Assembler::clc() {
920 EnsureSpace ensure_space(this); 943 EnsureSpace ensure_space(this);
921 last_pc_ = pc_; 944 last_pc_ = pc_;
922 emit(0xF8); 945 emit(0xF8);
923 } 946 }
924 947
925 void Assembler::cdq() { 948 void Assembler::cdq() {
926 EnsureSpace ensure_space(this); 949 EnsureSpace ensure_space(this);
927 last_pc_ = pc_; 950 last_pc_ = pc_;
928 emit(0x99); 951 emit(0x99);
(...skipping 2160 matching lines...) Expand 10 before | Expand all | Expand 10 after
3089 // specially coded on x64 means that it is a relative 32 bit address, as used 3112 // specially coded on x64 means that it is a relative 32 bit address, as used
3090 // by branch instructions. 3113 // by branch instructions.
3091 return (1 << rmode_) & kApplyMask; 3114 return (1 << rmode_) & kApplyMask;
3092 } 3115 }
3093 3116
3094 3117
3095 3118
3096 } } // namespace v8::internal 3119 } } // namespace v8::internal
3097 3120
3098 #endif // V8_TARGET_ARCH_X64 3121 #endif // V8_TARGET_ARCH_X64
OLDNEW

Powered by Google App Engine
This is Rietveld 408576698