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

Side by Side Diff: src/contexts.h

Issue 109013: Add the ability to set embedder data on created contexts from the API (Closed) Base URL: http://v8.googlecode.com/svn/branches/bleeding_edge/
Patch Set: '' Created 11 years, 7 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/bootstrapper.cc ('k') | src/debug.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 76 matching lines...) Expand 10 before | Expand all | Expand 10 after
87 V(MAKE_MESSAGE_FUN_INDEX, JSFunction, make_message_fun) \ 87 V(MAKE_MESSAGE_FUN_INDEX, JSFunction, make_message_fun) \
88 V(GET_STACK_TRACE_LINE_INDEX, JSFunction, get_stack_trace_line_fun) \ 88 V(GET_STACK_TRACE_LINE_INDEX, JSFunction, get_stack_trace_line_fun) \
89 V(CONFIGURE_GLOBAL_INDEX, JSFunction, configure_global_fun) \ 89 V(CONFIGURE_GLOBAL_INDEX, JSFunction, configure_global_fun) \
90 V(FUNCTION_CACHE_INDEX, JSObject, function_cache) \ 90 V(FUNCTION_CACHE_INDEX, JSObject, function_cache) \
91 V(RUNTIME_CONTEXT_INDEX, Context, runtime_context) \ 91 V(RUNTIME_CONTEXT_INDEX, Context, runtime_context) \
92 V(CALL_AS_FUNCTION_DELEGATE_INDEX, JSFunction, call_as_function_delegate) \ 92 V(CALL_AS_FUNCTION_DELEGATE_INDEX, JSFunction, call_as_function_delegate) \
93 V(EMPTY_SCRIPT_INDEX, Script, empty_script) \ 93 V(EMPTY_SCRIPT_INDEX, Script, empty_script) \
94 V(SCRIPT_FUNCTION_INDEX, JSFunction, script_function) \ 94 V(SCRIPT_FUNCTION_INDEX, JSFunction, script_function) \
95 V(CONTEXT_EXTENSION_FUNCTION_INDEX, JSFunction, context_extension_function) \ 95 V(CONTEXT_EXTENSION_FUNCTION_INDEX, JSFunction, context_extension_function) \
96 V(OUT_OF_MEMORY_INDEX, Object, out_of_memory) \ 96 V(OUT_OF_MEMORY_INDEX, Object, out_of_memory) \
97 V(MAP_CACHE_INDEX, Object, map_cache) 97 V(MAP_CACHE_INDEX, Object, map_cache) \
98 V(CONTEXT_DATA_INDEX, Object, data)
98 99
99 // JSFunctions are pairs (context, function code), sometimes also called 100 // JSFunctions are pairs (context, function code), sometimes also called
100 // closures. A Context object is used to represent function contexts and 101 // closures. A Context object is used to represent function contexts and
101 // dynamically pushed 'with' contexts (or 'scopes' in ECMA-262 speak). 102 // dynamically pushed 'with' contexts (or 'scopes' in ECMA-262 speak).
102 // 103 //
103 // At runtime, the contexts build a stack in parallel to the execution 104 // At runtime, the contexts build a stack in parallel to the execution
104 // stack, with the top-most context being the current context. All contexts 105 // stack, with the top-most context being the current context. All contexts
105 // have the following slots: 106 // have the following slots:
106 // 107 //
107 // [ closure ] This is the current function. It is the same for all 108 // [ closure ] This is the current function. It is the same for all
(...skipping 98 matching lines...) Expand 10 before | Expand all | Expand 10 after
206 GET_STACK_TRACE_LINE_INDEX, 207 GET_STACK_TRACE_LINE_INDEX,
207 CONFIGURE_GLOBAL_INDEX, 208 CONFIGURE_GLOBAL_INDEX,
208 FUNCTION_CACHE_INDEX, 209 FUNCTION_CACHE_INDEX,
209 RUNTIME_CONTEXT_INDEX, 210 RUNTIME_CONTEXT_INDEX,
210 CALL_AS_FUNCTION_DELEGATE_INDEX, 211 CALL_AS_FUNCTION_DELEGATE_INDEX,
211 EMPTY_SCRIPT_INDEX, 212 EMPTY_SCRIPT_INDEX,
212 SCRIPT_FUNCTION_INDEX, 213 SCRIPT_FUNCTION_INDEX,
213 CONTEXT_EXTENSION_FUNCTION_INDEX, 214 CONTEXT_EXTENSION_FUNCTION_INDEX,
214 OUT_OF_MEMORY_INDEX, 215 OUT_OF_MEMORY_INDEX,
215 MAP_CACHE_INDEX, 216 MAP_CACHE_INDEX,
217 CONTEXT_DATA_INDEX,
216 GLOBAL_CONTEXT_SLOTS 218 GLOBAL_CONTEXT_SLOTS
217 }; 219 };
218 220
219 // Direct slot access. 221 // Direct slot access.
220 JSFunction* closure() { return JSFunction::cast(get(CLOSURE_INDEX)); } 222 JSFunction* closure() { return JSFunction::cast(get(CLOSURE_INDEX)); }
221 void set_closure(JSFunction* closure) { set(CLOSURE_INDEX, closure); } 223 void set_closure(JSFunction* closure) { set(CLOSURE_INDEX, closure); }
222 224
223 Context* fcontext() { return Context::cast(get(FCONTEXT_INDEX)); } 225 Context* fcontext() { return Context::cast(get(FCONTEXT_INDEX)); }
224 void set_fcontext(Context* context) { set(FCONTEXT_INDEX, context); } 226 void set_fcontext(Context* context) { set(FCONTEXT_INDEX, context); }
225 227
(...skipping 102 matching lines...) Expand 10 before | Expand all | Expand 10 after
328 #ifdef DEBUG 330 #ifdef DEBUG
329 // Bootstrapping-aware type checks. 331 // Bootstrapping-aware type checks.
330 static bool IsBootstrappingOrContext(Object* object); 332 static bool IsBootstrappingOrContext(Object* object);
331 static bool IsBootstrappingOrGlobalObject(Object* object); 333 static bool IsBootstrappingOrGlobalObject(Object* object);
332 #endif 334 #endif
333 }; 335 };
334 336
335 } } // namespace v8::internal 337 } } // namespace v8::internal
336 338
337 #endif // V8_CONTEXTS_H_ 339 #endif // V8_CONTEXTS_H_
OLDNEW
« no previous file with comments | « src/bootstrapper.cc ('k') | src/debug.h » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698