OLD | NEW |
1 // Copyright 2012 the V8 project authors. All rights reserved. | 1 // Copyright 2012 the V8 project authors. All rights reserved. |
2 // Use of this source code is governed by a BSD-style license that can be | 2 // Use of this source code is governed by a BSD-style license that can be |
3 // found in the LICENSE file. | 3 // found in the LICENSE file. |
4 | 4 |
5 #include "src/x64/assembler-x64.h" | 5 #include "src/x64/assembler-x64.h" |
6 | 6 |
7 #include <cstring> | 7 #include <cstring> |
8 | 8 |
9 #if V8_TARGET_ARCH_X64 | 9 #if V8_TARGET_ARCH_X64 |
10 | 10 |
(...skipping 371 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
382 | 382 |
383 // Some internal data structures overflow for very large buffers, | 383 // Some internal data structures overflow for very large buffers, |
384 // they must ensure that kMaximalBufferSize is not too large. | 384 // they must ensure that kMaximalBufferSize is not too large. |
385 if ((desc.buffer_size > kMaximalBufferSize) || | 385 if ((desc.buffer_size > kMaximalBufferSize) || |
386 (desc.buffer_size > isolate()->heap()->MaxOldGenerationSize())) { | 386 (desc.buffer_size > isolate()->heap()->MaxOldGenerationSize())) { |
387 V8::FatalProcessOutOfMemory("Assembler::GrowBuffer"); | 387 V8::FatalProcessOutOfMemory("Assembler::GrowBuffer"); |
388 } | 388 } |
389 | 389 |
390 // Set up new buffer. | 390 // Set up new buffer. |
391 desc.buffer = NewArray<byte>(desc.buffer_size); | 391 desc.buffer = NewArray<byte>(desc.buffer_size); |
| 392 desc.origin = this; |
392 desc.instr_size = pc_offset(); | 393 desc.instr_size = pc_offset(); |
393 desc.reloc_size = | 394 desc.reloc_size = |
394 static_cast<int>((buffer_ + buffer_size_) - (reloc_info_writer.pos())); | 395 static_cast<int>((buffer_ + buffer_size_) - (reloc_info_writer.pos())); |
395 | 396 |
396 // Clear the buffer in debug mode. Use 'int3' instructions to make | 397 // Clear the buffer in debug mode. Use 'int3' instructions to make |
397 // sure to get into problems if we ever run uninitialized code. | 398 // sure to get into problems if we ever run uninitialized code. |
398 #ifdef DEBUG | 399 #ifdef DEBUG |
399 memset(desc.buffer, 0xCC, desc.buffer_size); | 400 memset(desc.buffer, 0xCC, desc.buffer_size); |
400 #endif | 401 #endif |
401 | 402 |
(...skipping 3707 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
4109 void Assembler::RecordRelocInfo(RelocInfo::Mode rmode, intptr_t data) { | 4110 void Assembler::RecordRelocInfo(RelocInfo::Mode rmode, intptr_t data) { |
4110 DCHECK(!RelocInfo::IsNone(rmode)); | 4111 DCHECK(!RelocInfo::IsNone(rmode)); |
4111 // Don't record external references unless the heap will be serialized. | 4112 // Don't record external references unless the heap will be serialized. |
4112 if (rmode == RelocInfo::EXTERNAL_REFERENCE && | 4113 if (rmode == RelocInfo::EXTERNAL_REFERENCE && |
4113 !serializer_enabled() && !emit_debug_code()) { | 4114 !serializer_enabled() && !emit_debug_code()) { |
4114 return; | 4115 return; |
4115 } else if (rmode == RelocInfo::CODE_AGE_SEQUENCE) { | 4116 } else if (rmode == RelocInfo::CODE_AGE_SEQUENCE) { |
4116 // Don't record psuedo relocation info for code age sequence mode. | 4117 // Don't record psuedo relocation info for code age sequence mode. |
4117 return; | 4118 return; |
4118 } | 4119 } |
4119 RelocInfo rinfo(pc_, rmode, data, NULL); | 4120 RelocInfo rinfo(isolate(), pc_, rmode, data, NULL); |
4120 reloc_info_writer.Write(&rinfo); | 4121 reloc_info_writer.Write(&rinfo); |
4121 } | 4122 } |
4122 | 4123 |
4123 | 4124 |
4124 const int RelocInfo::kApplyMask = RelocInfo::kCodeTargetMask | | 4125 const int RelocInfo::kApplyMask = RelocInfo::kCodeTargetMask | |
4125 1 << RelocInfo::RUNTIME_ENTRY | | 4126 1 << RelocInfo::RUNTIME_ENTRY | |
4126 1 << RelocInfo::INTERNAL_REFERENCE | | 4127 1 << RelocInfo::INTERNAL_REFERENCE | |
4127 1 << RelocInfo::CODE_AGE_SEQUENCE; | 4128 1 << RelocInfo::CODE_AGE_SEQUENCE; |
4128 | 4129 |
4129 | 4130 |
4130 bool RelocInfo::IsCodedSpecially() { | 4131 bool RelocInfo::IsCodedSpecially() { |
4131 // The deserializer needs to know whether a pointer is specially coded. Being | 4132 // The deserializer needs to know whether a pointer is specially coded. Being |
4132 // specially coded on x64 means that it is a relative 32 bit address, as used | 4133 // specially coded on x64 means that it is a relative 32 bit address, as used |
4133 // by branch instructions. | 4134 // by branch instructions. |
4134 return (1 << rmode_) & kApplyMask; | 4135 return (1 << rmode_) & kApplyMask; |
4135 } | 4136 } |
4136 | 4137 |
4137 | 4138 |
4138 bool RelocInfo::IsInConstantPool() { | 4139 bool RelocInfo::IsInConstantPool() { |
4139 return false; | 4140 return false; |
4140 } | 4141 } |
4141 | 4142 |
4142 | 4143 |
4143 } // namespace internal | 4144 } // namespace internal |
4144 } // namespace v8 | 4145 } // namespace v8 |
4145 | 4146 |
4146 #endif // V8_TARGET_ARCH_X64 | 4147 #endif // V8_TARGET_ARCH_X64 |
OLD | NEW |