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 46 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
57 double fast_exp_simulator(double x) { | 57 double fast_exp_simulator(double x) { |
58 return Simulator::current(Isolate::Current())->CallFP( | 58 return Simulator::current(Isolate::Current())->CallFP( |
59 fast_exp_mips_machine_code, x, 0); | 59 fast_exp_mips_machine_code, x, 0); |
60 } | 60 } |
61 #endif | 61 #endif |
62 | 62 |
63 | 63 |
64 UnaryMathFunction CreateExpFunction() { | 64 UnaryMathFunction CreateExpFunction() { |
65 if (!FLAG_fast_math) return &exp; | 65 if (!FLAG_fast_math) return &exp; |
66 size_t actual_size; | 66 size_t actual_size; |
67 byte* buffer = static_cast<byte*>(OS::Allocate(1 * KB, &actual_size, true)); | 67 byte* buffer = static_cast<byte*>(VirtualMemory::AllocateRegion( |
| 68 1 * KB, &actual_size, VirtualMemory::EXECUTABLE)); |
68 if (buffer == NULL) return &exp; | 69 if (buffer == NULL) return &exp; |
69 ExternalReference::InitializeMathExpData(); | 70 ExternalReference::InitializeMathExpData(); |
70 | 71 |
71 MacroAssembler masm(NULL, buffer, static_cast<int>(actual_size)); | 72 MacroAssembler masm(NULL, buffer, static_cast<int>(actual_size)); |
72 | 73 |
73 { | 74 { |
74 DoubleRegister input = f12; | 75 DoubleRegister input = f12; |
75 DoubleRegister result = f0; | 76 DoubleRegister result = f0; |
76 DoubleRegister double_scratch1 = f4; | 77 DoubleRegister double_scratch1 = f4; |
77 DoubleRegister double_scratch2 = f6; | 78 DoubleRegister double_scratch2 = f6; |
(...skipping 17 matching lines...) Expand all Loading... |
95 __ Move(v0, v1, result); | 96 __ Move(v0, v1, result); |
96 } | 97 } |
97 __ Ret(); | 98 __ Ret(); |
98 } | 99 } |
99 | 100 |
100 CodeDesc desc; | 101 CodeDesc desc; |
101 masm.GetCode(&desc); | 102 masm.GetCode(&desc); |
102 ASSERT(!RelocInfo::RequiresRelocation(desc)); | 103 ASSERT(!RelocInfo::RequiresRelocation(desc)); |
103 | 104 |
104 CPU::FlushICache(buffer, actual_size); | 105 CPU::FlushICache(buffer, actual_size); |
105 OS::ProtectCode(buffer, actual_size); | 106 bool result = VirtualMemory::WriteProtectRegion(buffer, actual_size); |
| 107 ASSERT(result); |
| 108 USE(result); |
106 | 109 |
107 #if !defined(USE_SIMULATOR) | 110 #if !defined(USE_SIMULATOR) |
108 return FUNCTION_CAST<UnaryMathFunction>(buffer); | 111 return FUNCTION_CAST<UnaryMathFunction>(buffer); |
109 #else | 112 #else |
110 fast_exp_mips_machine_code = buffer; | 113 fast_exp_mips_machine_code = buffer; |
111 return &fast_exp_simulator; | 114 return &fast_exp_simulator; |
112 #endif | 115 #endif |
113 } | 116 } |
114 | 117 |
115 | 118 |
(...skipping 543 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
659 patcher.masm()->dd(reinterpret_cast<uint32_t>(stub->instruction_start())); | 662 patcher.masm()->dd(reinterpret_cast<uint32_t>(stub->instruction_start())); |
660 } | 663 } |
661 } | 664 } |
662 | 665 |
663 | 666 |
664 #undef __ | 667 #undef __ |
665 | 668 |
666 } } // namespace v8::internal | 669 } } // namespace v8::internal |
667 | 670 |
668 #endif // V8_TARGET_ARCH_MIPS | 671 #endif // V8_TARGET_ARCH_MIPS |
OLD | NEW |