| OLD | NEW |
| 1 // Copyright 2011 the V8 project authors. All rights reserved. | 1 // Copyright 2011 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 199 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 210 static Mutex* memcopy_function_mutex = OS::CreateMutex(); | 210 static Mutex* memcopy_function_mutex = OS::CreateMutex(); |
| 211 // Defined in codegen-ia32.cc. | 211 // Defined in codegen-ia32.cc. |
| 212 OS::MemCopyFunction CreateMemCopyFunction(); | 212 OS::MemCopyFunction CreateMemCopyFunction(); |
| 213 | 213 |
| 214 // Copy memory area to disjoint memory area. | 214 // Copy memory area to disjoint memory area. |
| 215 void OS::MemCopy(void* dest, const void* src, size_t size) { | 215 void OS::MemCopy(void* dest, const void* src, size_t size) { |
| 216 if (memcopy_function == NULL) { | 216 if (memcopy_function == NULL) { |
| 217 ScopedLock lock(memcopy_function_mutex); | 217 ScopedLock lock(memcopy_function_mutex); |
| 218 Isolate::EnsureDefaultIsolate(); | 218 Isolate::EnsureDefaultIsolate(); |
| 219 if (memcopy_function == NULL) { | 219 if (memcopy_function == NULL) { |
| 220 Release_Store(reinterpret_cast<AtomicWord*>(&memcopy_function), | 220 OS::MemCopyFunction temp = CreateMemCopyFunction(); |
| 221 reinterpret_cast<AtomicWord>(CreateMemCopyFunction())); | 221 MemoryBarrier(); |
| 222 memcopy_function = temp; |
| 222 } | 223 } |
| 223 } | 224 } |
| 224 (*memcopy_function)(dest, src, size); | 225 (*memcopy_function)(dest, src, size); |
| 225 #ifdef DEBUG | 226 #ifdef DEBUG |
| 226 CHECK_EQ(0, memcmp(dest, src, size)); | 227 CHECK_EQ(0, memcmp(dest, src, size)); |
| 227 #endif | 228 #endif |
| 228 } | 229 } |
| 229 #endif // V8_TARGET_ARCH_IA32 | 230 #endif // V8_TARGET_ARCH_IA32 |
| 230 | 231 |
| 231 // ---------------------------------------------------------------------------- | 232 // ---------------------------------------------------------------------------- |
| (...skipping 181 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 413 return ntohl(value); | 414 return ntohl(value); |
| 414 } | 415 } |
| 415 | 416 |
| 416 | 417 |
| 417 Socket* OS::CreateSocket() { | 418 Socket* OS::CreateSocket() { |
| 418 return new POSIXSocket(); | 419 return new POSIXSocket(); |
| 419 } | 420 } |
| 420 | 421 |
| 421 | 422 |
| 422 } } // namespace v8::internal | 423 } } // namespace v8::internal |
| OLD | NEW |