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

Side by Side Diff: src/handles.h

Issue 3418033: [Isolates] Add isolate parameter to handle constructor. (Closed)
Patch Set: Created 10 years, 2 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
« no previous file with comments | « src/api.cc ('k') | src/handles-inl.h » ('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 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 26 matching lines...) Expand all
37 // A Handle provides a reference to an object that survives relocation by 37 // A Handle provides a reference to an object that survives relocation by
38 // the garbage collector. 38 // the garbage collector.
39 // Handles are only valid within a HandleScope. 39 // Handles are only valid within a HandleScope.
40 // When a handle is created for an object a cell is allocated in the heap. 40 // When a handle is created for an object a cell is allocated in the heap.
41 41
42 template<class T> 42 template<class T>
43 class Handle { 43 class Handle {
44 public: 44 public:
45 INLINE(explicit Handle(T** location)) { location_ = location; } 45 INLINE(explicit Handle(T** location)) { location_ = location; }
46 INLINE(explicit Handle(T* obj)); 46 INLINE(explicit Handle(T* obj));
47 INLINE(Handle(T* obj, Isolate* isolate));
47 48
48 INLINE(Handle()) : location_(NULL) {} 49 INLINE(Handle()) : location_(NULL) {}
49 50
50 // Constructor for handling automatic up casting. 51 // Constructor for handling automatic up casting.
51 // Ex. Handle<JSFunction> can be passed when Handle<Object> is expected. 52 // Ex. Handle<JSFunction> can be passed when Handle<Object> is expected.
52 template <class S> Handle(Handle<S> handle) { 53 template <class S> Handle(Handle<S> handle) {
53 #ifdef DEBUG 54 #ifdef DEBUG
54 T* a = NULL; 55 T* a = NULL;
55 S* b = NULL; 56 S* b = NULL;
56 a = b; // Fake assignment to enforce type checks. 57 a = b; // Fake assignment to enforce type checks.
(...skipping 54 matching lines...) Expand 10 before | Expand all | Expand 10 after
111 112
112 ~HandleScope() { 113 ~HandleScope() {
113 Leave(&previous_); 114 Leave(&previous_);
114 } 115 }
115 116
116 // Counts the number of allocated handles. 117 // Counts the number of allocated handles.
117 static int NumberOfHandles(); 118 static int NumberOfHandles();
118 119
119 // Creates a new handle with the given value. 120 // Creates a new handle with the given value.
120 template <typename T> 121 template <typename T>
121 static inline T** CreateHandle(T* value); 122 static inline T** CreateHandle(T* value, Isolate* isolate);
122 123
123 // Deallocates any extensions used by the current scope. 124 // Deallocates any extensions used by the current scope.
124 static void DeleteExtensions(Isolate* isolate); 125 static void DeleteExtensions(Isolate* isolate);
125 126
126 static Address current_extensions_address(); 127 static Address current_extensions_address();
127 static Address current_next_address(); 128 static Address current_next_address();
128 static Address current_limit_address(); 129 static Address current_limit_address();
129 130
130 private: 131 private:
131 // Prevent heap allocation or illegal handle scopes. 132 // Prevent heap allocation or illegal handle scopes.
(...skipping 224 matching lines...) Expand 10 before | Expand all | Expand 10 after
356 private: 357 private:
357 bool has_been_transformed_; // Tells whether the object has been transformed. 358 bool has_been_transformed_; // Tells whether the object has been transformed.
358 int unused_property_fields_; // Captures the unused number of field. 359 int unused_property_fields_; // Captures the unused number of field.
359 Handle<JSObject> object_; // The object being optimized. 360 Handle<JSObject> object_; // The object being optimized.
360 }; 361 };
361 362
362 363
363 } } // namespace v8::internal 364 } } // namespace v8::internal
364 365
365 #endif // V8_HANDLES_H_ 366 #endif // V8_HANDLES_H_
OLDNEW
« no previous file with comments | « src/api.cc ('k') | src/handles-inl.h » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698