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

Side by Side Diff: src/contexts.h

Issue 3764011: Link all global contexts into a weak list. (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
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 207 matching lines...) Expand 10 before | Expand all | Expand 10 after
218 NORMALIZED_MAP_CACHE_INDEX, 218 NORMALIZED_MAP_CACHE_INDEX,
219 RUNTIME_CONTEXT_INDEX, 219 RUNTIME_CONTEXT_INDEX,
220 CALL_AS_FUNCTION_DELEGATE_INDEX, 220 CALL_AS_FUNCTION_DELEGATE_INDEX,
221 CALL_AS_CONSTRUCTOR_DELEGATE_INDEX, 221 CALL_AS_CONSTRUCTOR_DELEGATE_INDEX,
222 SCRIPT_FUNCTION_INDEX, 222 SCRIPT_FUNCTION_INDEX,
223 OPAQUE_REFERENCE_FUNCTION_INDEX, 223 OPAQUE_REFERENCE_FUNCTION_INDEX,
224 CONTEXT_EXTENSION_FUNCTION_INDEX, 224 CONTEXT_EXTENSION_FUNCTION_INDEX,
225 OUT_OF_MEMORY_INDEX, 225 OUT_OF_MEMORY_INDEX,
226 MAP_CACHE_INDEX, 226 MAP_CACHE_INDEX,
227 CONTEXT_DATA_INDEX, 227 CONTEXT_DATA_INDEX,
228 GLOBAL_CONTEXT_SLOTS 228
229 // Properties from here get weak reference treatment by the GC.
230 NEXT_CONTEXT_LINK, // Weak.
231
232 // Total number of slots.
233 GLOBAL_CONTEXT_SLOTS,
234
235 FIRST_WEAK_SLOT = NEXT_CONTEXT_LINK
229 }; 236 };
230 237
231 // Direct slot access. 238 // Direct slot access.
232 JSFunction* closure() { return JSFunction::cast(get(CLOSURE_INDEX)); } 239 JSFunction* closure() { return JSFunction::cast(get(CLOSURE_INDEX)); }
233 void set_closure(JSFunction* closure) { set(CLOSURE_INDEX, closure); } 240 void set_closure(JSFunction* closure) { set(CLOSURE_INDEX, closure); }
234 241
235 Context* fcontext() { return Context::cast(get(FCONTEXT_INDEX)); } 242 Context* fcontext() { return Context::cast(get(FCONTEXT_INDEX)); }
236 void set_fcontext(Context* context) { set(FCONTEXT_INDEX, context); } 243 void set_fcontext(Context* context) { set(FCONTEXT_INDEX, context); }
237 244
238 Context* previous() { 245 Context* previous() {
(...skipping 87 matching lines...) Expand 10 before | Expand all | Expand 10 after
326 // does not contain a with statement the property is global unless 333 // does not contain a with statement the property is global unless
327 // it is shadowed by a property in an extension object introduced by 334 // it is shadowed by a property in an extension object introduced by
328 // eval. 335 // eval.
329 bool GlobalIfNotShadowedByEval(Handle<String> name); 336 bool GlobalIfNotShadowedByEval(Handle<String> name);
330 337
331 // Code generation support. 338 // Code generation support.
332 static int SlotOffset(int index) { 339 static int SlotOffset(int index) {
333 return kHeaderSize + index * kPointerSize - kHeapObjectTag; 340 return kHeaderSize + index * kPointerSize - kHeapObjectTag;
334 } 341 }
335 342
343 static const int kSize = kHeaderSize + GLOBAL_CONTEXT_SLOTS * kPointerSize;
344
345 // GC support.
Søren Thygesen Gjesse 2010/10/18 14:31:10 Maybe extend the comment to say that during scaven
346 typedef FixedBodyDescriptor<
347 kHeaderSize, kSize, kSize> ScavengeBodyDescriptor;
348
349 typedef FixedBodyDescriptor<
350 kHeaderSize,
351 kHeaderSize + FIRST_WEAK_SLOT * kPointerSize,
352 kSize> MarkCompactBodyDescriptor;
353
336 private: 354 private:
337 // Unchecked access to the slots. 355 // Unchecked access to the slots.
338 Object* unchecked_previous() { return get(PREVIOUS_INDEX); } 356 Object* unchecked_previous() { return get(PREVIOUS_INDEX); }
339 Object* unchecked_extension() { return get(EXTENSION_INDEX); } 357 Object* unchecked_extension() { return get(EXTENSION_INDEX); }
340 358
341 #ifdef DEBUG 359 #ifdef DEBUG
342 // Bootstrapping-aware type checks. 360 // Bootstrapping-aware type checks.
343 static bool IsBootstrappingOrContext(Object* object); 361 static bool IsBootstrappingOrContext(Object* object);
344 static bool IsBootstrappingOrGlobalObject(Object* object); 362 static bool IsBootstrappingOrGlobalObject(Object* object);
345 #endif 363 #endif
346 }; 364 };
347 365
348 } } // namespace v8::internal 366 } } // namespace v8::internal
349 367
350 #endif // V8_CONTEXTS_H_ 368 #endif // V8_CONTEXTS_H_
OLDNEW
« no previous file with comments | « src/bootstrapper.cc ('k') | src/heap.h » ('j') | src/mark-compact.cc » ('J')

Powered by Google App Engine
This is Rietveld 408576698