OLD | NEW |
1 // Copyright 2012 the V8 project authors. All rights reserved. | 1 // Copyright 2012 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 378 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
389 // Compute new buffer size. | 389 // Compute new buffer size. |
390 CodeDesc desc; // the new buffer | 390 CodeDesc desc; // the new buffer |
391 if (buffer_size_ < 4*KB) { | 391 if (buffer_size_ < 4*KB) { |
392 desc.buffer_size = 4*KB; | 392 desc.buffer_size = 4*KB; |
393 } else { | 393 } else { |
394 desc.buffer_size = 2*buffer_size_; | 394 desc.buffer_size = 2*buffer_size_; |
395 } | 395 } |
396 // Some internal data structures overflow for very large buffers, | 396 // Some internal data structures overflow for very large buffers, |
397 // they must ensure that kMaximalBufferSize is not too large. | 397 // they must ensure that kMaximalBufferSize is not too large. |
398 if ((desc.buffer_size > kMaximalBufferSize) || | 398 if ((desc.buffer_size > kMaximalBufferSize) || |
399 (desc.buffer_size > HEAP->MaxOldGenerationSize())) { | 399 (desc.buffer_size > isolate()->heap()->MaxOldGenerationSize())) { |
400 V8::FatalProcessOutOfMemory("Assembler::GrowBuffer"); | 400 V8::FatalProcessOutOfMemory("Assembler::GrowBuffer"); |
401 } | 401 } |
402 | 402 |
403 // Set up new buffer. | 403 // Set up new buffer. |
404 desc.buffer = NewArray<byte>(desc.buffer_size); | 404 desc.buffer = NewArray<byte>(desc.buffer_size); |
405 desc.instr_size = pc_offset(); | 405 desc.instr_size = pc_offset(); |
406 desc.reloc_size = | 406 desc.reloc_size = |
407 static_cast<int>((buffer_ + buffer_size_) - (reloc_info_writer.pos())); | 407 static_cast<int>((buffer_ + buffer_size_) - (reloc_info_writer.pos())); |
408 | 408 |
409 // Clear the buffer in debug mode. Use 'int3' instructions to make | 409 // Clear the buffer in debug mode. Use 'int3' instructions to make |
(...skipping 1116 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
1526 // If there is no relocation info, emit the value of the handle efficiently | 1526 // If there is no relocation info, emit the value of the handle efficiently |
1527 // (possibly using less that 8 bytes for the value). | 1527 // (possibly using less that 8 bytes for the value). |
1528 if (RelocInfo::IsNone(mode)) { | 1528 if (RelocInfo::IsNone(mode)) { |
1529 // There is no possible reason to store a heap pointer without relocation | 1529 // There is no possible reason to store a heap pointer without relocation |
1530 // info, so it must be a smi. | 1530 // info, so it must be a smi. |
1531 ASSERT(value->IsSmi()); | 1531 ASSERT(value->IsSmi()); |
1532 movq(dst, reinterpret_cast<int64_t>(*value), RelocInfo::NONE64); | 1532 movq(dst, reinterpret_cast<int64_t>(*value), RelocInfo::NONE64); |
1533 } else { | 1533 } else { |
1534 EnsureSpace ensure_space(this); | 1534 EnsureSpace ensure_space(this); |
1535 ASSERT(value->IsHeapObject()); | 1535 ASSERT(value->IsHeapObject()); |
1536 ASSERT(!HEAP->InNewSpace(*value)); | 1536 ASSERT(!isolate()->heap()->InNewSpace(*value)); |
1537 emit_rex_64(dst); | 1537 emit_rex_64(dst); |
1538 emit(0xB8 | dst.low_bits()); | 1538 emit(0xB8 | dst.low_bits()); |
1539 emitp(value.location(), mode); | 1539 emitp(value.location(), mode); |
1540 } | 1540 } |
1541 } | 1541 } |
1542 | 1542 |
1543 | 1543 |
1544 void Assembler::movsxbq(Register dst, const Operand& src) { | 1544 void Assembler::movsxbq(Register dst, const Operand& src) { |
1545 EnsureSpace ensure_space(this); | 1545 EnsureSpace ensure_space(this); |
1546 emit_rex_64(dst, src); | 1546 emit_rex_64(dst, src); |
(...skipping 1500 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
3047 bool RelocInfo::IsCodedSpecially() { | 3047 bool RelocInfo::IsCodedSpecially() { |
3048 // The deserializer needs to know whether a pointer is specially coded. Being | 3048 // The deserializer needs to know whether a pointer is specially coded. Being |
3049 // specially coded on x64 means that it is a relative 32 bit address, as used | 3049 // specially coded on x64 means that it is a relative 32 bit address, as used |
3050 // by branch instructions. | 3050 // by branch instructions. |
3051 return (1 << rmode_) & kApplyMask; | 3051 return (1 << rmode_) & kApplyMask; |
3052 } | 3052 } |
3053 | 3053 |
3054 } } // namespace v8::internal | 3054 } } // namespace v8::internal |
3055 | 3055 |
3056 #endif // V8_TARGET_ARCH_X64 | 3056 #endif // V8_TARGET_ARCH_X64 |
OLD | NEW |