diff options
Diffstat (limited to 'chromium/v8/src/platform-macos.cc')
-rw-r--r-- | chromium/v8/src/platform-macos.cc | 58 |
1 files changed, 16 insertions, 42 deletions
diff --git a/chromium/v8/src/platform-macos.cc b/chromium/v8/src/platform-macos.cc index 5ffc3fc54c4..4301875b9b6 100644 --- a/chromium/v8/src/platform-macos.cc +++ b/chromium/v8/src/platform-macos.cc @@ -1,32 +1,9 @@ // Copyright 2012 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: -// -// * Redistributions of source code must retain the above copyright -// notice, this list of conditions and the following disclaimer. -// * Redistributions in binary form must reproduce the above -// copyright notice, this list of conditions and the following -// disclaimer in the documentation and/or other materials provided -// with the distribution. -// * Neither the name of Google Inc. nor the names of its -// contributors may be used to endorse or promote products derived -// from this software without specific prior written permission. -// -// THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS -// "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT -// LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR -// A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT -// OWNER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, -// SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT -// LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, -// DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY -// THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT -// (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE -// OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. - -// Platform specific code for MacOS goes here. For the POSIX comaptible parts -// the implementation is in platform-posix.cc. +// Use of this source code is governed by a BSD-style license that can be +// found in the LICENSE file. + +// Platform-specific code for MacOS goes here. For the POSIX-compatible +// parts, the implementation is in platform-posix.cc. #include <dlfcn.h> #include <unistd.h> @@ -56,11 +33,9 @@ #undef MAP_TYPE -#include "v8.h" +#include "src/v8.h" -#include "platform.h" -#include "simulator.h" -#include "vm-state-inl.h" +#include "src/platform.h" namespace v8 { @@ -86,10 +61,7 @@ void* OS::Allocate(const size_t requested, MAP_PRIVATE | MAP_ANON, kMmapFd, kMmapFdOffset); - if (mbase == MAP_FAILED) { - LOG(Isolate::Current(), StringEvent("OS::Allocate", "mmap failed")); - return NULL; - } + if (mbase == MAP_FAILED) return NULL; *allocated = msize; return mbase; } @@ -153,7 +125,8 @@ PosixMemoryMappedFile::~PosixMemoryMappedFile() { } -void OS::LogSharedLibraryAddresses(Isolate* isolate) { +std::vector<OS::SharedLibraryAddress> OS::GetSharedLibraryAddresses() { + std::vector<SharedLibraryAddress> result; unsigned int images_count = _dyld_image_count(); for (unsigned int i = 0; i < images_count; ++i) { const mach_header* header = _dyld_get_image_header(i); @@ -172,9 +145,10 @@ void OS::LogSharedLibraryAddresses(Isolate* isolate) { if (code_ptr == NULL) continue; const uintptr_t slide = _dyld_get_image_vmaddr_slide(i); const uintptr_t start = reinterpret_cast<uintptr_t>(code_ptr) + slide; - LOG(isolate, - SharedLibraryEvent(_dyld_get_image_name(i), start, start + size)); + result.push_back( + SharedLibraryAddress(_dyld_get_image_name(i), start, start + size)); } + return result; } @@ -182,16 +156,16 @@ void OS::SignalCodeMovingGC() { } -const char* OS::LocalTimezone(double time) { +const char* OS::LocalTimezone(double time, TimezoneCache* cache) { if (std::isnan(time)) return ""; - time_t tv = static_cast<time_t>(floor(time/msPerSecond)); + time_t tv = static_cast<time_t>(std::floor(time/msPerSecond)); struct tm* t = localtime(&tv); if (NULL == t) return ""; return t->tm_zone; } -double OS::LocalTimeOffset() { +double OS::LocalTimeOffset(TimezoneCache* cache) { time_t tv = time(NULL); struct tm* t = localtime(&tv); // tm_gmtoff includes any daylight savings offset, so subtract it. |