Chromium Code Reviews
chromiumcodereview-hr@appspot.gserviceaccount.com (chromiumcodereview-hr) | Please choose your nickname with Settings | Help | Chromium Project | Gerrit Changes | Sign out
(147)

Side by Side Diff: src/platform-posix.cc

Issue 9666052: Landing for pliard@chromium.org: Remove static initializers in v8. (Closed) Base URL: http://v8.googlecode.com/svn/branches/bleeding_edge/
Patch Set: Created 8 years, 9 months ago
Use n/p to move between diff chunks; N/P to move between comments. Draft comments are only viewable by you.
Jump to:
View unified diff | Download patch | Annotate | Revision Log
« no previous file with comments | « src/platform-openbsd.cc ('k') | src/platform-solaris.cc » ('j') | no next file with comments »
Toggle Intra-line Diffs ('i') | Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
OLDNEW
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 289 matching lines...) Expand 10 before | Expand all | Expand 10 after
300 str[str.length() - 1] = '\0'; 300 str[str.length() - 1] = '\0';
301 return -1; 301 return -1;
302 } else { 302 } else {
303 return n; 303 return n;
304 } 304 }
305 } 305 }
306 306
307 307
308 #if defined(V8_TARGET_ARCH_IA32) 308 #if defined(V8_TARGET_ARCH_IA32)
309 static OS::MemCopyFunction memcopy_function = NULL; 309 static OS::MemCopyFunction memcopy_function = NULL;
310 static Mutex* memcopy_function_mutex = OS::CreateMutex(); 310 static LazyMutex memcopy_function_mutex = LAZY_MUTEX_INITIALIZER;
311 // Defined in codegen-ia32.cc. 311 // Defined in codegen-ia32.cc.
312 OS::MemCopyFunction CreateMemCopyFunction(); 312 OS::MemCopyFunction CreateMemCopyFunction();
313 313
314 // Copy memory area to disjoint memory area. 314 // Copy memory area to disjoint memory area.
315 void OS::MemCopy(void* dest, const void* src, size_t size) { 315 void OS::MemCopy(void* dest, const void* src, size_t size) {
316 if (memcopy_function == NULL) { 316 if (memcopy_function == NULL) {
317 ScopedLock lock(memcopy_function_mutex); 317 ScopedLock lock(memcopy_function_mutex.Pointer());
318 if (memcopy_function == NULL) { 318 if (memcopy_function == NULL) {
319 OS::MemCopyFunction temp = CreateMemCopyFunction(); 319 OS::MemCopyFunction temp = CreateMemCopyFunction();
320 MemoryBarrier(); 320 MemoryBarrier();
321 memcopy_function = temp; 321 memcopy_function = temp;
322 } 322 }
323 } 323 }
324 // Note: here we rely on dependent reads being ordered. This is true 324 // Note: here we rely on dependent reads being ordered. This is true
325 // on all architectures we currently support. 325 // on all architectures we currently support.
326 (*memcopy_function)(dest, src, size); 326 (*memcopy_function)(dest, src, size);
327 #ifdef DEBUG 327 #ifdef DEBUG
(...skipping 187 matching lines...) Expand 10 before | Expand all | Expand 10 after
515 return ntohl(value); 515 return ntohl(value);
516 } 516 }
517 517
518 518
519 Socket* OS::CreateSocket() { 519 Socket* OS::CreateSocket() {
520 return new POSIXSocket(); 520 return new POSIXSocket();
521 } 521 }
522 522
523 523
524 } } // namespace v8::internal 524 } } // namespace v8::internal
OLDNEW
« no previous file with comments | « src/platform-openbsd.cc ('k') | src/platform-solaris.cc » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698