1 // Copyright 2011 the V8 project authors. All rights reserved.
2 // Use of this source code is governed by a BSD-style license that can be
3 // found in the LICENSE file.
11 // Memory provides an interface to 'raw' memory. It encapsulates the casts
12 // that typically are needed when incompatible pointer types are used.
16 static uint8_t& uint8_at(Address addr) {
17 return *reinterpret_cast<uint8_t*>(addr);
20 static uint16_t& uint16_at(Address addr) {
21 return *reinterpret_cast<uint16_t*>(addr);
24 static uint32_t& uint32_at(Address addr) {
25 return *reinterpret_cast<uint32_t*>(addr);
28 static int32_t& int32_at(Address addr) {
29 return *reinterpret_cast<int32_t*>(addr);
32 static uint64_t& uint64_at(Address addr) {
33 return *reinterpret_cast<uint64_t*>(addr);
36 static int& int_at(Address addr) {
37 return *reinterpret_cast<int*>(addr);
40 static unsigned& unsigned_at(Address addr) {
41 return *reinterpret_cast<unsigned*>(addr);
44 static intptr_t& intptr_at(Address addr) {
45 return *reinterpret_cast<intptr_t*>(addr);
48 static uintptr_t& uintptr_at(Address addr) {
49 return *reinterpret_cast<uintptr_t*>(addr);
52 static double& double_at(Address addr) {
53 return *reinterpret_cast<double*>(addr);
56 static Address& Address_at(Address addr) {
57 return *reinterpret_cast<Address*>(addr);
60 static Object*& Object_at(Address addr) {
61 return *reinterpret_cast<Object**>(addr);
64 static Handle<Object>& Object_Handle_at(Address addr) {
65 return *reinterpret_cast<Handle<Object>*>(addr);
69 } } // namespace v8::internal
71 #endif // V8_MEMORY_H_