From: sgjesse@chromium.org Date: Tue, 22 Mar 2011 11:50:39 +0000 (+0000) Subject: Rename memory.h to v8memory.h X-Git-Tag: upstream/4.7.83~19855 X-Git-Url: http://review.tizen.org/git/?a=commitdiff_plain;h=63867eea606d513786bf73e56805b3fd54215fbb;p=platform%2Fupstream%2Fv8.git Rename memory.h to v8memory.h This is to avoid name collision with system include file named memory.h causing problems on some platforms. Review URL: http://codereview.chromium.org/6716020 git-svn-id: http://v8.googlecode.com/svn/branches/bleeding_edge@7301 ce2b1a6d-e550-0410-aec6-3dcde31c8c00 --- diff --git a/src/arm/frames-arm.h b/src/arm/frames-arm.h index 152172300..4aa8d6aa9 100644 --- a/src/arm/frames-arm.h +++ b/src/arm/frames-arm.h @@ -28,8 +28,6 @@ #ifndef V8_ARM_FRAMES_ARM_H_ #define V8_ARM_FRAMES_ARM_H_ -#include "memory.h" - namespace v8 { namespace internal { diff --git a/src/frames-inl.h b/src/frames-inl.h index f708f857e..e6eaec0e0 100644 --- a/src/frames-inl.h +++ b/src/frames-inl.h @@ -29,8 +29,8 @@ #define V8_FRAMES_INL_H_ #include "frames.h" - #include "isolate.h" +#include "v8memory.h" #if V8_TARGET_ARCH_IA32 #include "ia32/frames-ia32.h" diff --git a/src/ia32/frames-ia32.h b/src/ia32/frames-ia32.h index 69f9a0072..80846949a 100644 --- a/src/ia32/frames-ia32.h +++ b/src/ia32/frames-ia32.h @@ -28,8 +28,6 @@ #ifndef V8_IA32_FRAMES_IA32_H_ #define V8_IA32_FRAMES_IA32_H_ -#include "memory.h" - namespace v8 { namespace internal { diff --git a/src/liveedit.cc b/src/liveedit.cc index 4d44bf861..555e082a3 100644 --- a/src/liveedit.cc +++ b/src/liveedit.cc @@ -35,10 +35,10 @@ #include "debug.h" #include "deoptimizer.h" #include "global-handles.h" -#include "memory.h" #include "parser.h" #include "scopeinfo.h" #include "scopes.h" +#include "v8memory.h" namespace v8 { namespace internal { diff --git a/src/memory.h b/src/memory.h deleted file mode 100644 index 901e78d29..000000000 --- a/src/memory.h +++ /dev/null @@ -1,82 +0,0 @@ -// Copyright 2006-2008 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. - -#ifndef V8_MEMORY_H_ -#define V8_MEMORY_H_ - -namespace v8 { -namespace internal { - -// Memory provides an interface to 'raw' memory. It encapsulates the casts -// that typically are needed when incompatible pointer types are used. - -class Memory { - public: - static uint8_t& uint8_at(Address addr) { - return *reinterpret_cast(addr); - } - - static uint16_t& uint16_at(Address addr) { - return *reinterpret_cast(addr); - } - - static uint32_t& uint32_at(Address addr) { - return *reinterpret_cast(addr); - } - - static int32_t& int32_at(Address addr) { - return *reinterpret_cast(addr); - } - - static uint64_t& uint64_at(Address addr) { - return *reinterpret_cast(addr); - } - - static int& int_at(Address addr) { - return *reinterpret_cast(addr); - } - - static double& double_at(Address addr) { - return *reinterpret_cast(addr); - } - - static Address& Address_at(Address addr) { - return *reinterpret_cast(addr); - } - - static Object*& Object_at(Address addr) { - return *reinterpret_cast(addr); - } - - static Handle& Object_Handle_at(Address addr) { - return *reinterpret_cast*>(addr); - } -}; - -} } // namespace v8::internal - -#endif // V8_MEMORY_H_ diff --git a/src/objects-inl.h b/src/objects-inl.h index e39474dc8..ca065902c 100644 --- a/src/objects-inl.h +++ b/src/objects-inl.h @@ -39,10 +39,10 @@ #include "contexts.h" #include "conversions-inl.h" #include "heap.h" -#include "memory.h" #include "isolate.h" #include "property.h" #include "spaces.h" +#include "v8memory.h" namespace v8 { namespace internal { diff --git a/src/spaces-inl.h b/src/spaces-inl.h index 4afd80eee..070f97057 100644 --- a/src/spaces-inl.h +++ b/src/spaces-inl.h @@ -29,8 +29,8 @@ #define V8_SPACES_INL_H_ #include "isolate.h" -#include "memory.h" #include "spaces.h" +#include "v8memory.h" namespace v8 { namespace internal { diff --git a/src/v8memory.h b/src/v8memory.h new file mode 100644 index 000000000..901e78d29 --- /dev/null +++ b/src/v8memory.h @@ -0,0 +1,82 @@ +// Copyright 2006-2008 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. + +#ifndef V8_MEMORY_H_ +#define V8_MEMORY_H_ + +namespace v8 { +namespace internal { + +// Memory provides an interface to 'raw' memory. It encapsulates the casts +// that typically are needed when incompatible pointer types are used. + +class Memory { + public: + static uint8_t& uint8_at(Address addr) { + return *reinterpret_cast(addr); + } + + static uint16_t& uint16_at(Address addr) { + return *reinterpret_cast(addr); + } + + static uint32_t& uint32_at(Address addr) { + return *reinterpret_cast(addr); + } + + static int32_t& int32_at(Address addr) { + return *reinterpret_cast(addr); + } + + static uint64_t& uint64_at(Address addr) { + return *reinterpret_cast(addr); + } + + static int& int_at(Address addr) { + return *reinterpret_cast(addr); + } + + static double& double_at(Address addr) { + return *reinterpret_cast(addr); + } + + static Address& Address_at(Address addr) { + return *reinterpret_cast(addr); + } + + static Object*& Object_at(Address addr) { + return *reinterpret_cast(addr); + } + + static Handle& Object_Handle_at(Address addr) { + return *reinterpret_cast*>(addr); + } +}; + +} } // namespace v8::internal + +#endif // V8_MEMORY_H_ diff --git a/src/x64/assembler-x64-inl.h b/src/x64/assembler-x64-inl.h index af9f7cf02..439236a9b 100644 --- a/src/x64/assembler-x64-inl.h +++ b/src/x64/assembler-x64-inl.h @@ -30,7 +30,7 @@ #include "cpu.h" #include "debug.h" -#include "memory.h" +#include "v8memory.h" namespace v8 { namespace internal { diff --git a/src/x64/frames-x64.h b/src/x64/frames-x64.h index 6a605d8b0..81be81919 100644 --- a/src/x64/frames-x64.h +++ b/src/x64/frames-x64.h @@ -28,8 +28,6 @@ #ifndef V8_X64_FRAMES_X64_H_ #define V8_X64_FRAMES_X64_H_ -#include "memory.h" - namespace v8 { namespace internal { diff --git a/tools/gyp/v8.gyp b/tools/gyp/v8.gyp index cf40e4f24..e82b09868 100644 --- a/tools/gyp/v8.gyp +++ b/tools/gyp/v8.gyp @@ -457,7 +457,6 @@ '../../src/macro-assembler.h', '../../src/mark-compact.cc', '../../src/mark-compact.h', - '../../src/memory.h', '../../src/messages.cc', '../../src/messages.h', '../../src/natives.h', @@ -546,6 +545,7 @@ '../../src/v8.h', '../../src/v8checks.h', '../../src/v8globals.h', + '../../src/v8memory.h', '../../src/v8threads.cc', '../../src/v8threads.h', '../../src/v8utils.h', diff --git a/tools/v8.xcodeproj/project.pbxproj b/tools/v8.xcodeproj/project.pbxproj index 3204dbf60..f7eafbd1e 100644 --- a/tools/v8.xcodeproj/project.pbxproj +++ b/tools/v8.xcodeproj/project.pbxproj @@ -761,7 +761,7 @@ 897FF1580E719B8F00D62E90 /* macro-assembler.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; path = "macro-assembler.h"; sourceTree = ""; }; 897FF1590E719B8F00D62E90 /* mark-compact.cc */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.cpp.cpp; path = "mark-compact.cc"; sourceTree = ""; }; 897FF15A0E719B8F00D62E90 /* mark-compact.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; path = "mark-compact.h"; sourceTree = ""; }; - 897FF15B0E719B8F00D62E90 /* memory.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; path = memory.h; sourceTree = ""; }; + 897FF15B0E719B8F00D62E90 /* v8memory.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; path = v8memory.h; sourceTree = ""; }; 897FF15C0E719B8F00D62E90 /* messages.cc */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.cpp.cpp; path = messages.cc; sourceTree = ""; }; 897FF15D0E719B8F00D62E90 /* messages.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; path = messages.h; sourceTree = ""; }; 897FF15E0E719B8F00D62E90 /* mksnapshot.cc */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.cpp.cpp; path = mksnapshot.cc; sourceTree = ""; }; @@ -1218,7 +1218,7 @@ 897FF1580E719B8F00D62E90 /* macro-assembler.h */, 897FF1590E719B8F00D62E90 /* mark-compact.cc */, 897FF15A0E719B8F00D62E90 /* mark-compact.h */, - 897FF15B0E719B8F00D62E90 /* memory.h */, + 897FF15B0E719B8F00D62E90 /* v8memory.h */, 897FF15C0E719B8F00D62E90 /* messages.cc */, 897FF15D0E719B8F00D62E90 /* messages.h */, 897FF15E0E719B8F00D62E90 /* mksnapshot.cc */, diff --git a/tools/visual_studio/v8_base.vcproj b/tools/visual_studio/v8_base.vcproj index 5f76069d3..015661676 100644 --- a/tools/visual_studio/v8_base.vcproj +++ b/tools/visual_studio/v8_base.vcproj @@ -781,7 +781,7 @@ >