| OLD | NEW |
| 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 210 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 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 | 228 |
| 229 // Properties from here are treated as weak references by the full GC. | 229 // Properties from here are treated as weak references by the full GC. |
| 230 // Scavenge treats them as strong references. | 230 // Scavenge treats them as strong references. |
| 231 NEXT_CONTEXT_LINK, | 231 OPTIMIZED_FUNCTIONS_LIST, // Weak. |
| 232 NEXT_CONTEXT_LINK, // Weak. |
| 232 | 233 |
| 233 // Total number of slots. | 234 // Total number of slots. |
| 234 GLOBAL_CONTEXT_SLOTS, | 235 GLOBAL_CONTEXT_SLOTS, |
| 235 | 236 |
| 236 FIRST_WEAK_SLOT = NEXT_CONTEXT_LINK | 237 FIRST_WEAK_SLOT = OPTIMIZED_FUNCTIONS_LIST |
| 237 }; | 238 }; |
| 238 | 239 |
| 239 // Direct slot access. | 240 // Direct slot access. |
| 240 JSFunction* closure() { return JSFunction::cast(get(CLOSURE_INDEX)); } | 241 JSFunction* closure() { return JSFunction::cast(get(CLOSURE_INDEX)); } |
| 241 void set_closure(JSFunction* closure) { set(CLOSURE_INDEX, closure); } | 242 void set_closure(JSFunction* closure) { set(CLOSURE_INDEX, closure); } |
| 242 | 243 |
| 243 Context* fcontext() { return Context::cast(get(FCONTEXT_INDEX)); } | 244 Context* fcontext() { return Context::cast(get(FCONTEXT_INDEX)); } |
| 244 void set_fcontext(Context* context) { set(FCONTEXT_INDEX, context); } | 245 void set_fcontext(Context* context) { set(FCONTEXT_INDEX, context); } |
| 245 | 246 |
| 246 Context* previous() { | 247 Context* previous() { |
| (...skipping 32 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 279 | 280 |
| 280 // Mark the global context with out of memory. | 281 // Mark the global context with out of memory. |
| 281 inline void mark_out_of_memory(); | 282 inline void mark_out_of_memory(); |
| 282 | 283 |
| 283 // The exception holder is the object used as a with object in | 284 // The exception holder is the object used as a with object in |
| 284 // the implementation of a catch block. | 285 // the implementation of a catch block. |
| 285 bool is_exception_holder(Object* object) { | 286 bool is_exception_holder(Object* object) { |
| 286 return IsCatchContext() && extension() == object; | 287 return IsCatchContext() && extension() == object; |
| 287 } | 288 } |
| 288 | 289 |
| 290 // A global context hold a list of all functions which have been optimized. |
| 291 void AddOptimizedFunction(JSFunction* function); |
| 292 void RemoveOptimizedFunction(JSFunction* function); |
| 293 Object* OptimizedFunctionsListHead(); |
| 294 void ClearOptimizedFunctions(); |
| 295 |
| 289 #define GLOBAL_CONTEXT_FIELD_ACCESSORS(index, type, name) \ | 296 #define GLOBAL_CONTEXT_FIELD_ACCESSORS(index, type, name) \ |
| 290 void set_##name(type* value) { \ | 297 void set_##name(type* value) { \ |
| 291 ASSERT(IsGlobalContext()); \ | 298 ASSERT(IsGlobalContext()); \ |
| 292 set(index, value); \ | 299 set(index, value); \ |
| 293 } \ | 300 } \ |
| 294 type* name() { \ | 301 type* name() { \ |
| 295 ASSERT(IsGlobalContext()); \ | 302 ASSERT(IsGlobalContext()); \ |
| 296 return type::cast(get(index)); \ | 303 return type::cast(get(index)); \ |
| 297 } | 304 } |
| 298 GLOBAL_CONTEXT_FIELDS(GLOBAL_CONTEXT_FIELD_ACCESSORS) | 305 GLOBAL_CONTEXT_FIELDS(GLOBAL_CONTEXT_FIELD_ACCESSORS) |
| (...skipping 56 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 355 #ifdef DEBUG | 362 #ifdef DEBUG |
| 356 // Bootstrapping-aware type checks. | 363 // Bootstrapping-aware type checks. |
| 357 static bool IsBootstrappingOrContext(Object* object); | 364 static bool IsBootstrappingOrContext(Object* object); |
| 358 static bool IsBootstrappingOrGlobalObject(Object* object); | 365 static bool IsBootstrappingOrGlobalObject(Object* object); |
| 359 #endif | 366 #endif |
| 360 }; | 367 }; |
| 361 | 368 |
| 362 } } // namespace v8::internal | 369 } } // namespace v8::internal |
| 363 | 370 |
| 364 #endif // V8_CONTEXTS_H_ | 371 #endif // V8_CONTEXTS_H_ |
| OLD | NEW |