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