| 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/x87/codegen-x87.h" | 5 #include "src/x87/codegen-x87.h" |
| 6 | 6 |
| 7 #if V8_TARGET_ARCH_X87 | 7 #if V8_TARGET_ARCH_X87 |
| 8 | 8 |
| 9 #include "src/codegen.h" | 9 #include "src/codegen.h" |
| 10 #include "src/heap/heap.h" | 10 #include "src/heap/heap.h" |
| (...skipping 28 matching lines...) Expand all Loading... |
| 39 } | 39 } |
| 40 | 40 |
| 41 | 41 |
| 42 UnaryMathFunction CreateSqrtFunction() { | 42 UnaryMathFunction CreateSqrtFunction() { |
| 43 size_t actual_size; | 43 size_t actual_size; |
| 44 // Allocate buffer in executable space. | 44 // Allocate buffer in executable space. |
| 45 byte* buffer = | 45 byte* buffer = |
| 46 static_cast<byte*>(base::OS::Allocate(1 * KB, &actual_size, true)); | 46 static_cast<byte*>(base::OS::Allocate(1 * KB, &actual_size, true)); |
| 47 if (buffer == NULL) return &std::sqrt; | 47 if (buffer == NULL) return &std::sqrt; |
| 48 | 48 |
| 49 MacroAssembler masm(NULL, buffer, static_cast<int>(actual_size)); | 49 MacroAssembler masm(NULL, buffer, static_cast<int>(actual_size), false); |
| 50 // Load double input into registers. | 50 // Load double input into registers. |
| 51 __ fld_d(MemOperand(esp, 4)); | 51 __ fld_d(MemOperand(esp, 4)); |
| 52 __ X87SetFPUCW(0x027F); | 52 __ X87SetFPUCW(0x027F); |
| 53 __ fsqrt(); | 53 __ fsqrt(); |
| 54 __ X87SetFPUCW(0x037F); | 54 __ X87SetFPUCW(0x037F); |
| 55 __ Ret(); | 55 __ Ret(); |
| 56 | 56 |
| 57 CodeDesc desc; | 57 CodeDesc desc; |
| 58 masm.GetCode(&desc); | 58 masm.GetCode(&desc); |
| 59 DCHECK(!RelocInfo::RequiresRelocation(desc)); | 59 DCHECK(!RelocInfo::RequiresRelocation(desc)); |
| (...skipping 33 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 93 byte* buffer_; | 93 byte* buffer_; |
| 94 }; | 94 }; |
| 95 | 95 |
| 96 | 96 |
| 97 MemMoveFunction CreateMemMoveFunction() { | 97 MemMoveFunction CreateMemMoveFunction() { |
| 98 size_t actual_size; | 98 size_t actual_size; |
| 99 // Allocate buffer in executable space. | 99 // Allocate buffer in executable space. |
| 100 byte* buffer = | 100 byte* buffer = |
| 101 static_cast<byte*>(base::OS::Allocate(1 * KB, &actual_size, true)); | 101 static_cast<byte*>(base::OS::Allocate(1 * KB, &actual_size, true)); |
| 102 if (buffer == NULL) return NULL; | 102 if (buffer == NULL) return NULL; |
| 103 MacroAssembler masm(NULL, buffer, static_cast<int>(actual_size)); | 103 MacroAssembler masm(NULL, buffer, static_cast<int>(actual_size), false); |
| 104 LabelConverter conv(buffer); | 104 LabelConverter conv(buffer); |
| 105 | 105 |
| 106 // Generated code is put into a fixed, unmovable buffer, and not into | 106 // Generated code is put into a fixed, unmovable buffer, and not into |
| 107 // the V8 heap. We can't, and don't, refer to any relocatable addresses | 107 // the V8 heap. We can't, and don't, refer to any relocatable addresses |
| 108 // (e.g. the JavaScript nan-object). | 108 // (e.g. the JavaScript nan-object). |
| 109 | 109 |
| 110 // 32-bit C declaration function calls pass arguments on stack. | 110 // 32-bit C declaration function calls pass arguments on stack. |
| 111 | 111 |
| 112 // Stack layout: | 112 // Stack layout: |
| 113 // esp[12]: Third argument, size. | 113 // esp[12]: Third argument, size. |
| (...skipping 527 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 641 CodePatcher patcher(sequence, young_length); | 641 CodePatcher patcher(sequence, young_length); |
| 642 patcher.masm()->call(stub->instruction_start(), RelocInfo::NONE32); | 642 patcher.masm()->call(stub->instruction_start(), RelocInfo::NONE32); |
| 643 } | 643 } |
| 644 } | 644 } |
| 645 | 645 |
| 646 | 646 |
| 647 } // namespace internal | 647 } // namespace internal |
| 648 } // namespace v8 | 648 } // namespace v8 |
| 649 | 649 |
| 650 #endif // V8_TARGET_ARCH_X87 | 650 #endif // V8_TARGET_ARCH_X87 |
| OLD | NEW |