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

Side by Side Diff: src/handles.h

Issue 6614010: [Isolates] Merge 6700:7030 from bleeding_edge to isolates. (Closed) Base URL: http://v8.googlecode.com/svn/branches/experimental/isolates/
Patch Set: '' Created 9 years, 9 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/gdb-jit.cc ('k') | src/handles.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 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 21 matching lines...) Expand all
32 32
33 namespace v8 { 33 namespace v8 {
34 namespace internal { 34 namespace internal {
35 35
36 // ---------------------------------------------------------------------------- 36 // ----------------------------------------------------------------------------
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<typename 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 INLINE(Handle(T* obj, Isolate* isolate));
48 48
49 INLINE(Handle()) : location_(NULL) {} 49 INLINE(Handle()) : location_(NULL) {}
50 50
51 // Constructor for handling automatic up casting. 51 // Constructor for handling automatic up casting.
52 // Ex. Handle<JSFunction> can be passed when Handle<Object> is expected. 52 // Ex. Handle<JSFunction> can be passed when Handle<Object> is expected.
(...skipping 67 matching lines...) Expand 10 before | Expand all | Expand 10 after
120 template <typename T> 120 template <typename T>
121 static inline T** CreateHandle(T* value, Isolate* isolate); 121 static inline T** CreateHandle(T* value, Isolate* isolate);
122 122
123 // Deallocates any extensions used by the current scope. 123 // Deallocates any extensions used by the current scope.
124 static void DeleteExtensions(Isolate* isolate); 124 static void DeleteExtensions(Isolate* isolate);
125 125
126 static Address current_next_address(); 126 static Address current_next_address();
127 static Address current_limit_address(); 127 static Address current_limit_address();
128 static Address current_level_address(); 128 static Address current_level_address();
129 129
130 // Closes the HandleScope (invalidating all handles
131 // created in the scope of the HandleScope) and returns
132 // a Handle backed by the parent scope holding the
133 // value of the argument handle.
134 template <typename T>
135 Handle<T> CloseAndEscape(Handle<T> handle_value);
136
130 private: 137 private:
131 // Prevent heap allocation or illegal handle scopes. 138 // Prevent heap allocation or illegal handle scopes.
132 HandleScope(const HandleScope&); 139 HandleScope(const HandleScope&);
133 void operator=(const HandleScope&); 140 void operator=(const HandleScope&);
134 void* operator new(size_t size); 141 void* operator new(size_t size);
135 void operator delete(void* size_t); 142 void operator delete(void* size_t);
136 143
144 inline void CloseScope();
145
137 Isolate* isolate_; 146 Isolate* isolate_;
138 Object** prev_next_; 147 Object** prev_next_;
139 Object** prev_limit_; 148 Object** prev_limit_;
140 149
141 // Extend the handle scope making room for more handles. 150 // Extend the handle scope making room for more handles.
142 static internal::Object** Extend(); 151 static internal::Object** Extend();
143 152
144 // Zaps the handles in the half-open interval [start, end). 153 // Zaps the handles in the half-open interval [start, end).
145 static void ZapRange(internal::Object** start, internal::Object** end); 154 static void ZapRange(internal::Object** start, internal::Object** end);
146 155
(...skipping 22 matching lines...) Expand all
169 // Flattens a string. 178 // Flattens a string.
170 void FlattenString(Handle<String> str); 179 void FlattenString(Handle<String> str);
171 180
172 // Flattens a string and returns the underlying external or sequential 181 // Flattens a string and returns the underlying external or sequential
173 // string. 182 // string.
174 Handle<String> FlattenGetString(Handle<String> str); 183 Handle<String> FlattenGetString(Handle<String> str);
175 184
176 Handle<Object> SetProperty(Handle<JSObject> object, 185 Handle<Object> SetProperty(Handle<JSObject> object,
177 Handle<String> key, 186 Handle<String> key,
178 Handle<Object> value, 187 Handle<Object> value,
179 PropertyAttributes attributes); 188 PropertyAttributes attributes,
189 StrictModeFlag strict);
180 190
181 Handle<Object> SetProperty(Handle<Object> object, 191 Handle<Object> SetProperty(Handle<Object> object,
182 Handle<Object> key, 192 Handle<Object> key,
183 Handle<Object> value, 193 Handle<Object> value,
184 PropertyAttributes attributes); 194 PropertyAttributes attributes,
195 StrictModeFlag strict);
185 196
186 Handle<Object> ForceSetProperty(Handle<JSObject> object, 197 Handle<Object> ForceSetProperty(Handle<JSObject> object,
187 Handle<Object> key, 198 Handle<Object> key,
188 Handle<Object> value, 199 Handle<Object> value,
189 PropertyAttributes attributes); 200 PropertyAttributes attributes);
190 201
191 Handle<Object> SetNormalizedProperty(Handle<JSObject> object, 202 Handle<Object> SetNormalizedProperty(Handle<JSObject> object,
192 Handle<String> key, 203 Handle<String> key,
193 Handle<Object> value, 204 Handle<Object> value,
194 PropertyDetails details); 205 PropertyDetails details);
195 206
196 Handle<Object> ForceDeleteProperty(Handle<JSObject> object, 207 Handle<Object> ForceDeleteProperty(Handle<JSObject> object,
197 Handle<Object> key); 208 Handle<Object> key);
198 209
199 Handle<Object> SetLocalPropertyIgnoreAttributes( 210 Handle<Object> SetLocalPropertyIgnoreAttributes(
200 Handle<JSObject> object, 211 Handle<JSObject> object,
201 Handle<String> key, 212 Handle<String> key,
202 Handle<Object> value, 213 Handle<Object> value,
203 PropertyAttributes attributes); 214 PropertyAttributes attributes);
204 215
216 // Used to set local properties on the object we totally control
217 // and which therefore has no accessors and alikes.
218 void SetLocalPropertyNoThrow(Handle<JSObject> object,
219 Handle<String> key,
220 Handle<Object> value,
221 PropertyAttributes attributes = NONE);
222
205 Handle<Object> SetPropertyWithInterceptor(Handle<JSObject> object, 223 Handle<Object> SetPropertyWithInterceptor(Handle<JSObject> object,
206 Handle<String> key, 224 Handle<String> key,
207 Handle<Object> value, 225 Handle<Object> value,
208 PropertyAttributes attributes); 226 PropertyAttributes attributes,
227 StrictModeFlag strict);
209 228
210 Handle<Object> SetElement(Handle<JSObject> object, 229 Handle<Object> SetElement(Handle<JSObject> object,
211 uint32_t index, 230 uint32_t index,
212 Handle<Object> value); 231 Handle<Object> value);
213 232
214 Handle<Object> SetOwnElement(Handle<JSObject> object, 233 Handle<Object> SetOwnElement(Handle<JSObject> object,
215 uint32_t index, 234 uint32_t index,
216 Handle<Object> value); 235 Handle<Object> value);
217 236
218 Handle<Object> GetProperty(Handle<JSObject> obj, 237 Handle<Object> GetProperty(Handle<JSObject> obj,
(...skipping 100 matching lines...) Expand 10 before | Expand all | Expand 10 after
319 bool EnsureCompiled(Handle<SharedFunctionInfo> shared, 338 bool EnsureCompiled(Handle<SharedFunctionInfo> shared,
320 ClearExceptionFlag flag); 339 ClearExceptionFlag flag);
321 340
322 bool CompileLazyShared(Handle<SharedFunctionInfo> shared, 341 bool CompileLazyShared(Handle<SharedFunctionInfo> shared,
323 ClearExceptionFlag flag); 342 ClearExceptionFlag flag);
324 343
325 bool CompileLazy(Handle<JSFunction> function, ClearExceptionFlag flag); 344 bool CompileLazy(Handle<JSFunction> function, ClearExceptionFlag flag);
326 345
327 bool CompileLazyInLoop(Handle<JSFunction> function, ClearExceptionFlag flag); 346 bool CompileLazyInLoop(Handle<JSFunction> function, ClearExceptionFlag flag);
328 347
329 bool CompileOptimized(Handle<JSFunction> function, int osr_ast_id); 348 bool CompileOptimized(Handle<JSFunction> function,
349 int osr_ast_id,
350 ClearExceptionFlag flag);
330 351
331 class NoHandleAllocation BASE_EMBEDDED { 352 class NoHandleAllocation BASE_EMBEDDED {
332 public: 353 public:
333 #ifndef DEBUG 354 #ifndef DEBUG
334 NoHandleAllocation() {} 355 NoHandleAllocation() {}
335 ~NoHandleAllocation() {} 356 ~NoHandleAllocation() {}
336 #else 357 #else
337 inline NoHandleAllocation(); 358 inline NoHandleAllocation();
338 inline ~NoHandleAllocation(); 359 inline ~NoHandleAllocation();
339 private: 360 private:
(...skipping 16 matching lines...) Expand all
356 private: 377 private:
357 bool has_been_transformed_; // Tells whether the object has been transformed. 378 bool has_been_transformed_; // Tells whether the object has been transformed.
358 int unused_property_fields_; // Captures the unused number of field. 379 int unused_property_fields_; // Captures the unused number of field.
359 Handle<JSObject> object_; // The object being optimized. 380 Handle<JSObject> object_; // The object being optimized.
360 }; 381 };
361 382
362 383
363 } } // namespace v8::internal 384 } } // namespace v8::internal
364 385
365 #endif // V8_HANDLES_H_ 386 #endif // V8_HANDLES_H_
OLDNEW
« no previous file with comments | « src/gdb-jit.cc ('k') | src/handles.cc » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698