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 38 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
49 // must always be allocated via Heap::AllocateContext() or | 49 // must always be allocated via Heap::AllocateContext() or |
50 // Factory::NewContext. | 50 // Factory::NewContext. |
51 | 51 |
52 // Comment for special_function_table: | 52 // Comment for special_function_table: |
53 // Table for providing optimized/specialized functions. | 53 // Table for providing optimized/specialized functions. |
54 // The array contains triplets [object, general_function, optimized_function]. | 54 // The array contains triplets [object, general_function, optimized_function]. |
55 // Primarily added to support built-in optimized variants of | 55 // Primarily added to support built-in optimized variants of |
56 // Array.prototype.{push,pop}. | 56 // Array.prototype.{push,pop}. |
57 | 57 |
58 #define GLOBAL_CONTEXT_FIELDS(V) \ | 58 #define GLOBAL_CONTEXT_FIELDS(V) \ |
| 59 V(GLOBAL_PROXY_INDEX, JSObject, global_proxy_object) \ |
| 60 V(SECURITY_TOKEN_INDEX, Object, security_token) \ |
59 V(BOOLEAN_FUNCTION_INDEX, JSFunction, boolean_function) \ | 61 V(BOOLEAN_FUNCTION_INDEX, JSFunction, boolean_function) \ |
60 V(NUMBER_FUNCTION_INDEX, JSFunction, number_function) \ | 62 V(NUMBER_FUNCTION_INDEX, JSFunction, number_function) \ |
61 V(STRING_FUNCTION_INDEX, JSFunction, string_function) \ | 63 V(STRING_FUNCTION_INDEX, JSFunction, string_function) \ |
62 V(OBJECT_FUNCTION_INDEX, JSFunction, object_function) \ | 64 V(OBJECT_FUNCTION_INDEX, JSFunction, object_function) \ |
63 V(ARRAY_FUNCTION_INDEX, JSFunction, array_function) \ | 65 V(ARRAY_FUNCTION_INDEX, JSFunction, array_function) \ |
64 V(DATE_FUNCTION_INDEX, JSFunction, date_function) \ | 66 V(DATE_FUNCTION_INDEX, JSFunction, date_function) \ |
65 V(REGEXP_FUNCTION_INDEX, JSFunction, regexp_function) \ | 67 V(REGEXP_FUNCTION_INDEX, JSFunction, regexp_function) \ |
66 V(INITIAL_OBJECT_PROTOTYPE_INDEX, JSObject, initial_object_prototype) \ | 68 V(INITIAL_OBJECT_PROTOTYPE_INDEX, JSObject, initial_object_prototype) \ |
67 V(CREATE_DATE_FUN_INDEX, JSFunction, create_date_fun) \ | 69 V(CREATE_DATE_FUN_INDEX, JSFunction, create_date_fun) \ |
68 V(TO_NUMBER_FUN_INDEX, JSFunction, to_number_fun) \ | 70 V(TO_NUMBER_FUN_INDEX, JSFunction, to_number_fun) \ |
(...skipping 96 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
165 enum { | 167 enum { |
166 // These slots are in all contexts. | 168 // These slots are in all contexts. |
167 CLOSURE_INDEX, | 169 CLOSURE_INDEX, |
168 FCONTEXT_INDEX, | 170 FCONTEXT_INDEX, |
169 PREVIOUS_INDEX, | 171 PREVIOUS_INDEX, |
170 EXTENSION_INDEX, | 172 EXTENSION_INDEX, |
171 GLOBAL_INDEX, | 173 GLOBAL_INDEX, |
172 MIN_CONTEXT_SLOTS, | 174 MIN_CONTEXT_SLOTS, |
173 | 175 |
174 // These slots are only in global contexts. | 176 // These slots are only in global contexts. |
175 ARGUMENTS_BOILERPLATE_INDEX = MIN_CONTEXT_SLOTS, | 177 GLOBAL_PROXY_INDEX = MIN_CONTEXT_SLOTS, |
| 178 SECURITY_TOKEN_INDEX, |
| 179 ARGUMENTS_BOILERPLATE_INDEX, |
176 JS_ARRAY_MAP_INDEX, | 180 JS_ARRAY_MAP_INDEX, |
177 FUNCTION_MAP_INDEX, | 181 FUNCTION_MAP_INDEX, |
178 FUNCTION_INSTANCE_MAP_INDEX, | 182 FUNCTION_INSTANCE_MAP_INDEX, |
179 INITIAL_OBJECT_PROTOTYPE_INDEX, | 183 INITIAL_OBJECT_PROTOTYPE_INDEX, |
180 BOOLEAN_FUNCTION_INDEX, | 184 BOOLEAN_FUNCTION_INDEX, |
181 NUMBER_FUNCTION_INDEX, | 185 NUMBER_FUNCTION_INDEX, |
182 STRING_FUNCTION_INDEX, | 186 STRING_FUNCTION_INDEX, |
183 OBJECT_FUNCTION_INDEX, | 187 OBJECT_FUNCTION_INDEX, |
184 ARRAY_FUNCTION_INDEX, | 188 ARRAY_FUNCTION_INDEX, |
185 DATE_FUNCTION_INDEX, | 189 DATE_FUNCTION_INDEX, |
(...skipping 43 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
229 JSObject* extension() { | 233 JSObject* extension() { |
230 return reinterpret_cast<JSObject*>(get(EXTENSION_INDEX)); | 234 return reinterpret_cast<JSObject*>(get(EXTENSION_INDEX)); |
231 } | 235 } |
232 void set_extension(JSObject* object) { set(EXTENSION_INDEX, object); } | 236 void set_extension(JSObject* object) { set(EXTENSION_INDEX, object); } |
233 | 237 |
234 GlobalObject* global() { | 238 GlobalObject* global() { |
235 return reinterpret_cast<GlobalObject*>(get(GLOBAL_INDEX)); | 239 return reinterpret_cast<GlobalObject*>(get(GLOBAL_INDEX)); |
236 } | 240 } |
237 void set_global(GlobalObject* global) { set(GLOBAL_INDEX, global); } | 241 void set_global(GlobalObject* global) { set(GLOBAL_INDEX, global); } |
238 | 242 |
| 243 // Returns a JSGlobalProxy object or null. |
| 244 JSObject* global_proxy(); |
| 245 void set_global_proxy(JSObject* global); |
| 246 |
239 // The builtins object. | 247 // The builtins object. |
240 JSBuiltinsObject* builtins(); | 248 JSBuiltinsObject* builtins(); |
241 | 249 |
242 // Compute the global context by traversing the context chain. | 250 // Compute the global context by traversing the context chain. |
243 Context* global_context(); | 251 Context* global_context(); |
244 | 252 |
245 // Tells if this is a function context (as opposed to a 'with' context). | 253 // Tells if this is a function context (as opposed to a 'with' context). |
246 bool is_function_context() { return previous() == NULL; } | 254 bool is_function_context() { return previous() == NULL; } |
247 | 255 |
248 // Tells whether the global context is marked with out of memory. | 256 // Tells whether the global context is marked with out of memory. |
(...skipping 44 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
293 | 301 |
294 // Code generation support. | 302 // Code generation support. |
295 static int SlotOffset(int index) { | 303 static int SlotOffset(int index) { |
296 return kHeaderSize + index * kPointerSize - kHeapObjectTag; | 304 return kHeaderSize + index * kPointerSize - kHeapObjectTag; |
297 } | 305 } |
298 }; | 306 }; |
299 | 307 |
300 } } // namespace v8::internal | 308 } } // namespace v8::internal |
301 | 309 |
302 #endif // V8_CONTEXTS_H_ | 310 #endif // V8_CONTEXTS_H_ |
OLD | NEW |