OLD | NEW |
1 // Copyright 2010 the V8 project authors. All rights reserved. | 1 // Copyright 2010 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 10158 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
10169 | 10169 |
10170 #define __ masm. | 10170 #define __ masm. |
10171 | 10171 |
10172 | 10172 |
10173 static void MemCopyWrapper(void* dest, const void* src, size_t size) { | 10173 static void MemCopyWrapper(void* dest, const void* src, size_t size) { |
10174 memcpy(dest, src, size); | 10174 memcpy(dest, src, size); |
10175 } | 10175 } |
10176 | 10176 |
10177 | 10177 |
10178 OS::MemCopyFunction CreateMemCopyFunction() { | 10178 OS::MemCopyFunction CreateMemCopyFunction() { |
10179 HandleScope scope; | |
10180 size_t actual_size; | 10179 size_t actual_size; |
10181 // Allocate buffer in executable space. | 10180 // Allocate buffer in executable space. |
10182 byte* buffer = static_cast<byte*>(OS::Allocate(1 * KB, | 10181 byte* buffer = static_cast<byte*>(OS::Allocate(1 * KB, |
10183 &actual_size, | 10182 &actual_size, |
10184 true)); | 10183 true)); |
10185 if (buffer == NULL) return &MemCopyWrapper; | 10184 if (buffer == NULL) return &MemCopyWrapper; |
10186 MacroAssembler masm(buffer, static_cast<int>(actual_size)); | 10185 MacroAssembler masm(NULL, buffer, static_cast<int>(actual_size)); |
10187 | 10186 |
10188 // Generated code is put into a fixed, unmovable, buffer, and not into | 10187 // Generated code is put into a fixed, unmovable, buffer, and not into |
10189 // the V8 heap. We can't, and don't, refer to any relocatable addresses | 10188 // the V8 heap. We can't, and don't, refer to any relocatable addresses |
10190 // (e.g. the JavaScript nan-object). | 10189 // (e.g. the JavaScript nan-object). |
10191 | 10190 |
10192 // 32-bit C declaration function calls pass arguments on stack. | 10191 // 32-bit C declaration function calls pass arguments on stack. |
10193 | 10192 |
10194 // Stack layout: | 10193 // Stack layout: |
10195 // esp[12]: Third argument, size. | 10194 // esp[12]: Third argument, size. |
10196 // esp[8]: Second argument, source pointer. | 10195 // esp[8]: Second argument, source pointer. |
(...skipping 180 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
10377 | 10376 |
10378 CPU::FlushICache(buffer, actual_size); | 10377 CPU::FlushICache(buffer, actual_size); |
10379 return FUNCTION_CAST<OS::MemCopyFunction>(buffer); | 10378 return FUNCTION_CAST<OS::MemCopyFunction>(buffer); |
10380 } | 10379 } |
10381 | 10380 |
10382 #undef __ | 10381 #undef __ |
10383 | 10382 |
10384 } } // namespace v8::internal | 10383 } } // namespace v8::internal |
10385 | 10384 |
10386 #endif // V8_TARGET_ARCH_IA32 | 10385 #endif // V8_TARGET_ARCH_IA32 |
OLD | NEW |