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

Unified Diff: src/smart-pointers.h

Issue 10701054: Enable stub generation using Hydrogen/Lithium (again) (Closed) Base URL: https://v8.googlecode.com/svn/branches/bleeding_edge
Patch Set: Review feedback Created 8 years, 1 month 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 side-by-side diff with in-line comments
Download patch
Index: src/smart-pointers.h
diff --git a/src/smart-pointers.h b/src/smart-pointers.h
index 345c4d47fb73e8d3e0c10c7f80fc87530876dbb3..a800fc964537d4241ad97d0801183cce7c622a28 100644
--- a/src/smart-pointers.h
+++ b/src/smart-pointers.h
@@ -63,6 +63,11 @@ class SmartPointerBase {
return p_[i];
}
+ // You can use [n] to index as if it was a plain pointer
Jakob Kummerow 2012/11/28 16:28:22 nit: trailing full stop please.
danno 2012/11/30 16:23:24 Done.
+ const inline T& operator[](size_t i) const {
+ return p_[i];
+ }
+
// We don't have implicit conversion to a T* since that hinders migration:
// You would not be able to change a method from returning a T* to
// returning an SmartArrayPointer<T> and then get errors wherever it is used.
@@ -77,6 +82,11 @@ class SmartPointerBase {
return temp;
}
+ inline void Reset(T* new_value) {
+ if (p_) Deallocator::Delete(p_);
+ p_ = new_value;
+ }
+
// Assignment requires an empty (NULL) SmartArrayPointer as the receiver. Like
// the copy constructor it removes the pointer in the original to avoid
// double freeing.

Powered by Google App Engine
This is Rietveld 408576698