| OLD | NEW |
| 1 // Copyright 2006-2008 the V8 project authors. All rights reserved. | 1 // Copyright 2006-2008 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 37 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 48 // This is used during building, but not at runtime by V8. | 48 // This is used during building, but not at runtime by V8. |
| 49 class SerializationAddressMapper { | 49 class SerializationAddressMapper { |
| 50 public: | 50 public: |
| 51 static bool IsMapped(HeapObject* obj) { | 51 static bool IsMapped(HeapObject* obj) { |
| 52 EnsureMapExists(); | 52 EnsureMapExists(); |
| 53 return serialization_map_->Lookup(Key(obj), Hash(obj), false) != NULL; | 53 return serialization_map_->Lookup(Key(obj), Hash(obj), false) != NULL; |
| 54 } | 54 } |
| 55 | 55 |
| 56 static int MappedTo(HeapObject* obj) { | 56 static int MappedTo(HeapObject* obj) { |
| 57 ASSERT(IsMapped(obj)); | 57 ASSERT(IsMapped(obj)); |
| 58 return reinterpret_cast<int>(serialization_map_->Lookup(Key(obj), | 58 return reinterpret_cast<intptr_t>(serialization_map_->Lookup(Key(obj), |
| 59 Hash(obj), | 59 Hash(obj), |
| 60 false)->value); | 60 false)->value); |
| 61 } | 61 } |
| 62 | 62 |
| 63 static void Map(HeapObject* obj, int to) { | 63 static void Map(HeapObject* obj, int to) { |
| 64 EnsureMapExists(); | 64 EnsureMapExists(); |
| 65 ASSERT(!IsMapped(obj)); | 65 ASSERT(!IsMapped(obj)); |
| 66 HashMap::Entry* entry = | 66 HashMap::Entry* entry = |
| 67 serialization_map_->Lookup(Key(obj), Hash(obj), true); | 67 serialization_map_->Lookup(Key(obj), Hash(obj), true); |
| 68 entry->value = Value(to); | 68 entry->value = Value(to); |
| 69 } | 69 } |
| 70 | 70 |
| 71 static void Zap() { | 71 static void Zap() { |
| 72 if (serialization_map_ != NULL) { | 72 if (serialization_map_ != NULL) { |
| 73 delete serialization_map_; | 73 delete serialization_map_; |
| 74 } | 74 } |
| 75 serialization_map_ = NULL; | 75 serialization_map_ = NULL; |
| 76 } | 76 } |
| 77 | 77 |
| 78 private: | 78 private: |
| 79 static bool SerializationMatchFun(void* key1, void* key2) { | 79 static bool SerializationMatchFun(void* key1, void* key2) { |
| 80 return key1 == key2; | 80 return key1 == key2; |
| 81 } | 81 } |
| 82 | 82 |
| 83 static uint32_t Hash(HeapObject* obj) { | 83 static uint32_t Hash(HeapObject* obj) { |
| 84 return reinterpret_cast<uint32_t>(obj->address()); | 84 return reinterpret_cast<intptr_t>(obj->address()); |
| 85 } | 85 } |
| 86 | 86 |
| 87 static void* Key(HeapObject* obj) { | 87 static void* Key(HeapObject* obj) { |
| 88 return reinterpret_cast<void*>(obj->address()); | 88 return reinterpret_cast<void*>(obj->address()); |
| 89 } | 89 } |
| 90 | 90 |
| 91 static void* Value(int v) { | 91 static void* Value(int v) { |
| 92 return reinterpret_cast<void*>(v); | 92 return reinterpret_cast<void*>(v); |
| 93 } | 93 } |
| 94 | 94 |
| (...skipping 1118 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 1213 fullness_[space] = RoundUp(fullness_[space], Page::kPageSize); | 1213 fullness_[space] = RoundUp(fullness_[space], Page::kPageSize); |
| 1214 } | 1214 } |
| 1215 } | 1215 } |
| 1216 int allocation_address = fullness_[space]; | 1216 int allocation_address = fullness_[space]; |
| 1217 fullness_[space] = allocation_address + size; | 1217 fullness_[space] = allocation_address + size; |
| 1218 return allocation_address; | 1218 return allocation_address; |
| 1219 } | 1219 } |
| 1220 | 1220 |
| 1221 | 1221 |
| 1222 } } // namespace v8::internal | 1222 } } // namespace v8::internal |
| OLD | NEW |