Chromium Code Reviews| Index: src/platform-posix.cc |
| diff --git a/src/platform-posix.cc b/src/platform-posix.cc |
| index 1dd486ebd6a11259b15d5555ed0de78c28eeaa4b..2c50ae1904fd45263aa5c7d6c3da167ca26c5fdb 100644 |
| --- a/src/platform-posix.cc |
| +++ b/src/platform-posix.cc |
| @@ -1,4 +1,4 @@ |
| -// Copyright 2009 the V8 project authors. All rights reserved. |
| +// Copyright 2011 the V8 project authors. All rights reserved. |
| // Redistribution and use in source and binary forms, with or without |
| // modification, are permitted provided that the following conditions are |
| // met: |
| @@ -205,6 +205,28 @@ int OS::VSNPrintF(Vector<char> str, |
| } |
| +#if defined(V8_TARGET_ARCH_IA32) |
| +static OS::MemCopyFunction memcopy_function = NULL; |
| +static Mutex* memcopy_function_mutex = OS::CreateMutex(); |
| +// Defined in codegen-ia32.cc. |
| +OS::MemCopyFunction CreateMemCopyFunction(); |
| + |
| +// Copy memory area to disjoint memory area. |
| +void OS::MemCopy(void* dest, const void* src, size_t size) { |
|
Vitaly Repeshko
2011/03/30 10:17:19
Why does this have to be in platform files? It'd b
William Hesse
2011/03/30 11:26:44
It depends on whether it is an inline function or
Vitaly Repeshko
2011/03/30 12:25:01
I think creating v8utils.cc is a better solution.
|
| + if (memcopy_function == NULL) { |
| + ScopedLock lock(memcopy_function_mutex); |
| + Isolate::EnsureDefaultIsolate(); |
| + if (memcopy_function == NULL) { |
| + memcopy_function = CreateMemCopyFunction(); |
|
Vitaly Repeshko
2011/03/30 10:17:19
You need a memory barrier between function creatio
William Hesse
2011/03/30 11:26:44
Done.
William Hesse
2011/03/30 11:26:44
We end the function CreateMemCopyFunction() with a
Vitaly Repeshko
2011/03/30 12:25:01
Well, strictly speaking we need both CPU and compi
|
| + } |
| + } |
| + (*memcopy_function)(dest, src, size); |
| +#ifdef DEBUG |
| + CHECK_EQ(0, memcmp(dest, src, size)); |
| +#endif |
| +} |
| +#endif // V8_TARGET_ARCH_IA32 |
| + |
| // ---------------------------------------------------------------------------- |
| // POSIX string support. |
| // |