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

Side by Side Diff: src/unique.h

Issue 24072016: Use Unique<Cell> and Unique<PropertyCell> in LoadGlobalCell and StoreGlobalCell. (Closed) Base URL: https://v8.googlecode.com/svn/branches/bleeding_edge
Patch Set: Created 7 years, 3 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/mips/lithium-codegen-mips.cc ('k') | src/x64/lithium-codegen-x64.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 2013 the V8 project authors. All rights reserved. 1 // Copyright 2013 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 72 matching lines...) Expand 10 before | Expand all | Expand 10 after
83 T* a = NULL; 83 T* a = NULL;
84 S* b = NULL; 84 S* b = NULL;
85 a = b; // Fake assignment to enforce type checks. 85 a = b; // Fake assignment to enforce type checks.
86 USE(a); 86 USE(a);
87 #endif 87 #endif
88 raw_address_ = uniq.raw_address_; 88 raw_address_ = uniq.raw_address_;
89 handle_ = uniq.handle_; 89 handle_ = uniq.handle_;
90 } 90 }
91 91
92 template <typename U> 92 template <typename U>
93 bool operator==(const Unique<U>& other) const { 93 inline bool operator==(const Unique<U>& other) const {
94 ASSERT(IsInitialized() && other.IsInitialized()); 94 ASSERT(IsInitialized() && other.IsInitialized());
95 return raw_address_ == other.raw_address_; 95 return raw_address_ == other.raw_address_;
96 } 96 }
97 97
98 template <typename U> 98 template <typename U>
99 bool operator!=(const Unique<U>& other) const { 99 inline bool operator!=(const Unique<U>& other) const {
100 ASSERT(IsInitialized() && other.IsInitialized()); 100 ASSERT(IsInitialized() && other.IsInitialized());
101 return raw_address_ != other.raw_address_; 101 return raw_address_ != other.raw_address_;
102 } 102 }
103 103
104 intptr_t Hashcode() const { 104 inline intptr_t Hashcode() const {
105 ASSERT(IsInitialized()); 105 ASSERT(IsInitialized());
106 return reinterpret_cast<intptr_t>(raw_address_); 106 return reinterpret_cast<intptr_t>(raw_address_);
107 } 107 }
108 108
109 bool IsNull() const { 109 inline bool IsNull() const {
110 ASSERT(IsInitialized()); 110 ASSERT(IsInitialized());
111 return raw_address_ == NULL; 111 return raw_address_ == NULL;
112 } 112 }
113 113
114 // Extract the handle from this Unique in order to dereference it. 114 // Extract the handle from this Unique in order to dereference it.
115 // WARNING: Only do this if you have access to the heap. 115 // WARNING: Only do this if you have access to the heap.
116 Handle<T> handle() const { 116 inline Handle<T> handle() const {
117 return handle_; 117 return handle_;
118 } 118 }
119 119
120 bool IsInitialized() const { 120 inline bool IsInitialized() const {
121 return raw_address_ != NULL || handle_.is_null(); 121 return raw_address_ != NULL || handle_.is_null();
122 } 122 }
123 123
124 // TODO(titzer): this is a hack to migrate to Unique<T> incrementally. 124 // TODO(titzer): this is a hack to migrate to Unique<T> incrementally.
125 static Unique<T> CreateUninitialized(Handle<T> handle) { 125 static Unique<T> CreateUninitialized(Handle<T> handle) {
126 return Unique<T>(static_cast<Address>(NULL), handle); 126 return Unique<T>(static_cast<Address>(NULL), handle);
127 } 127 }
128 128
129 friend class UniqueSet<T>; // Uses internal details for speed. 129 friend class UniqueSet<T>; // Uses internal details for speed.
130 template <class U> 130 template <class U>
(...skipping 165 matching lines...) Expand 10 before | Expand all | Expand 10 after
296 capacity_ = new_capacity; 296 capacity_ = new_capacity;
297 array_ = new_array; 297 array_ = new_array;
298 } 298 }
299 } 299 }
300 }; 300 };
301 301
302 302
303 } } // namespace v8::internal 303 } } // namespace v8::internal
304 304
305 #endif // V8_HYDROGEN_UNIQUE_H_ 305 #endif // V8_HYDROGEN_UNIQUE_H_
OLDNEW
« no previous file with comments | « src/mips/lithium-codegen-mips.cc ('k') | src/x64/lithium-codegen-x64.cc » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698