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

Side by Side Diff: src/contexts.h

Issue 7167006: Merge arguments branch to bleeding merge. (Closed) Base URL: https://v8.googlecode.com/svn/branches/bleeding_edge
Patch Set: Fix test arguments.js." Created 9 years, 6 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/compiler.cc ('k') | src/contexts.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 2011 the V8 project authors. All rights reserved. 1 // Copyright 2011 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 70 matching lines...) Expand 10 before | Expand all | Expand 10 after
81 V(STRICT_MODE_FUNCTION_MAP_INDEX, Map, strict_mode_function_map) \ 81 V(STRICT_MODE_FUNCTION_MAP_INDEX, Map, strict_mode_function_map) \
82 V(FUNCTION_WITHOUT_PROTOTYPE_MAP_INDEX, Map, function_without_prototype_map) \ 82 V(FUNCTION_WITHOUT_PROTOTYPE_MAP_INDEX, Map, function_without_prototype_map) \
83 V(STRICT_MODE_FUNCTION_WITHOUT_PROTOTYPE_MAP_INDEX, Map, \ 83 V(STRICT_MODE_FUNCTION_WITHOUT_PROTOTYPE_MAP_INDEX, Map, \
84 strict_mode_function_without_prototype_map) \ 84 strict_mode_function_without_prototype_map) \
85 V(FUNCTION_INSTANCE_MAP_INDEX, Map, function_instance_map) \ 85 V(FUNCTION_INSTANCE_MAP_INDEX, Map, function_instance_map) \
86 V(STRICT_MODE_FUNCTION_INSTANCE_MAP_INDEX, Map, \ 86 V(STRICT_MODE_FUNCTION_INSTANCE_MAP_INDEX, Map, \
87 strict_mode_function_instance_map) \ 87 strict_mode_function_instance_map) \
88 V(JS_ARRAY_MAP_INDEX, Map, js_array_map)\ 88 V(JS_ARRAY_MAP_INDEX, Map, js_array_map)\
89 V(REGEXP_RESULT_MAP_INDEX, Map, regexp_result_map)\ 89 V(REGEXP_RESULT_MAP_INDEX, Map, regexp_result_map)\
90 V(ARGUMENTS_BOILERPLATE_INDEX, JSObject, arguments_boilerplate) \ 90 V(ARGUMENTS_BOILERPLATE_INDEX, JSObject, arguments_boilerplate) \
91 V(ALIASED_ARGUMENTS_BOILERPLATE_INDEX, JSObject, \
92 aliased_arguments_boilerplate) \
91 V(STRICT_MODE_ARGUMENTS_BOILERPLATE_INDEX, JSObject, \ 93 V(STRICT_MODE_ARGUMENTS_BOILERPLATE_INDEX, JSObject, \
92 strict_mode_arguments_boilerplate) \ 94 strict_mode_arguments_boilerplate) \
93 V(MESSAGE_LISTENERS_INDEX, JSObject, message_listeners) \ 95 V(MESSAGE_LISTENERS_INDEX, JSObject, message_listeners) \
94 V(MAKE_MESSAGE_FUN_INDEX, JSFunction, make_message_fun) \ 96 V(MAKE_MESSAGE_FUN_INDEX, JSFunction, make_message_fun) \
95 V(GET_STACK_TRACE_LINE_INDEX, JSFunction, get_stack_trace_line_fun) \ 97 V(GET_STACK_TRACE_LINE_INDEX, JSFunction, get_stack_trace_line_fun) \
96 V(CONFIGURE_GLOBAL_INDEX, JSFunction, configure_global_fun) \ 98 V(CONFIGURE_GLOBAL_INDEX, JSFunction, configure_global_fun) \
97 V(FUNCTION_CACHE_INDEX, JSObject, function_cache) \ 99 V(FUNCTION_CACHE_INDEX, JSObject, function_cache) \
98 V(JSFUNCTION_RESULT_CACHES_INDEX, FixedArray, jsfunction_result_caches) \ 100 V(JSFUNCTION_RESULT_CACHES_INDEX, FixedArray, jsfunction_result_caches) \
99 V(NORMALIZED_MAP_CACHE_INDEX, NormalizedMapCache, normalized_map_cache) \ 101 V(NORMALIZED_MAP_CACHE_INDEX, NormalizedMapCache, normalized_map_cache) \
100 V(RUNTIME_CONTEXT_INDEX, Context, runtime_context) \ 102 V(RUNTIME_CONTEXT_INDEX, Context, runtime_context) \
(...skipping 73 matching lines...) Expand 10 before | Expand all | Expand 10 after
174 ASSERT(context->IsContext()); 176 ASSERT(context->IsContext());
175 return reinterpret_cast<Context*>(context); 177 return reinterpret_cast<Context*>(context);
176 } 178 }
177 179
178 // The default context slot layout; indices are FixedArray slot indices. 180 // The default context slot layout; indices are FixedArray slot indices.
179 enum { 181 enum {
180 // These slots are in all contexts. 182 // These slots are in all contexts.
181 CLOSURE_INDEX, 183 CLOSURE_INDEX,
182 FCONTEXT_INDEX, 184 FCONTEXT_INDEX,
183 PREVIOUS_INDEX, 185 PREVIOUS_INDEX,
184 // The extension slot is used for either the global object (in global
185 // contexts), eval extension object (function contexts), subject of with
186 // (with contexts), or the variable name (catch contexts).
187 EXTENSION_INDEX, 186 EXTENSION_INDEX,
188 GLOBAL_INDEX, 187 GLOBAL_INDEX,
189 MIN_CONTEXT_SLOTS, 188 MIN_CONTEXT_SLOTS,
190 189
191 // This slot holds the thrown value in catch contexts.
192 THROWN_OBJECT_INDEX = MIN_CONTEXT_SLOTS,
193
194 // These slots are only in global contexts. 190 // These slots are only in global contexts.
195 GLOBAL_PROXY_INDEX = MIN_CONTEXT_SLOTS, 191 GLOBAL_PROXY_INDEX = MIN_CONTEXT_SLOTS,
196 SECURITY_TOKEN_INDEX, 192 SECURITY_TOKEN_INDEX,
197 ARGUMENTS_BOILERPLATE_INDEX, 193 ARGUMENTS_BOILERPLATE_INDEX,
194 ALIASED_ARGUMENTS_BOILERPLATE_INDEX,
198 STRICT_MODE_ARGUMENTS_BOILERPLATE_INDEX, 195 STRICT_MODE_ARGUMENTS_BOILERPLATE_INDEX,
199 JS_ARRAY_MAP_INDEX, 196 JS_ARRAY_MAP_INDEX,
200 REGEXP_RESULT_MAP_INDEX, 197 REGEXP_RESULT_MAP_INDEX,
201 FUNCTION_MAP_INDEX, 198 FUNCTION_MAP_INDEX,
202 STRICT_MODE_FUNCTION_MAP_INDEX, 199 STRICT_MODE_FUNCTION_MAP_INDEX,
203 FUNCTION_WITHOUT_PROTOTYPE_MAP_INDEX, 200 FUNCTION_WITHOUT_PROTOTYPE_MAP_INDEX,
204 STRICT_MODE_FUNCTION_WITHOUT_PROTOTYPE_MAP_INDEX, 201 STRICT_MODE_FUNCTION_WITHOUT_PROTOTYPE_MAP_INDEX,
205 FUNCTION_INSTANCE_MAP_INDEX, 202 FUNCTION_INSTANCE_MAP_INDEX,
206 STRICT_MODE_FUNCTION_INSTANCE_MAP_INDEX, 203 STRICT_MODE_FUNCTION_INSTANCE_MAP_INDEX,
207 INITIAL_OBJECT_PROTOTYPE_INDEX, 204 INITIAL_OBJECT_PROTOTYPE_INDEX,
(...skipping 56 matching lines...) Expand 10 before | Expand all | Expand 10 after
264 Context* fcontext() { return Context::cast(get(FCONTEXT_INDEX)); } 261 Context* fcontext() { return Context::cast(get(FCONTEXT_INDEX)); }
265 void set_fcontext(Context* context) { set(FCONTEXT_INDEX, context); } 262 void set_fcontext(Context* context) { set(FCONTEXT_INDEX, context); }
266 263
267 Context* previous() { 264 Context* previous() {
268 Object* result = unchecked_previous(); 265 Object* result = unchecked_previous();
269 ASSERT(IsBootstrappingOrContext(result)); 266 ASSERT(IsBootstrappingOrContext(result));
270 return reinterpret_cast<Context*>(result); 267 return reinterpret_cast<Context*>(result);
271 } 268 }
272 void set_previous(Context* context) { set(PREVIOUS_INDEX, context); } 269 void set_previous(Context* context) { set(PREVIOUS_INDEX, context); }
273 270
274 bool has_extension() { return extension() != NULL; } 271 bool has_extension() { return unchecked_extension() != NULL; }
275 Object* extension() { return get(EXTENSION_INDEX); } 272 JSObject* extension() { return JSObject::cast(unchecked_extension()); }
276 void set_extension(Object* object) { set(EXTENSION_INDEX, object); } 273 void set_extension(JSObject* object) { set(EXTENSION_INDEX, object); }
277 274
278 GlobalObject* global() { 275 GlobalObject* global() {
279 Object* result = get(GLOBAL_INDEX); 276 Object* result = get(GLOBAL_INDEX);
280 ASSERT(IsBootstrappingOrGlobalObject(result)); 277 ASSERT(IsBootstrappingOrGlobalObject(result));
281 return reinterpret_cast<GlobalObject*>(result); 278 return reinterpret_cast<GlobalObject*>(result);
282 } 279 }
283 void set_global(GlobalObject* global) { set(GLOBAL_INDEX, global); } 280 void set_global(GlobalObject* global) { set(GLOBAL_INDEX, global); }
284 281
285 // Returns a JSGlobalProxy object or null. 282 // Returns a JSGlobalProxy object or null.
286 JSObject* global_proxy(); 283 JSObject* global_proxy();
287 void set_global_proxy(JSObject* global); 284 void set_global_proxy(JSObject* global);
288 285
289 // The builtins object. 286 // The builtins object.
290 JSBuiltinsObject* builtins(); 287 JSBuiltinsObject* builtins();
291 288
292 // Compute the global context by traversing the context chain. 289 // Compute the global context by traversing the context chain.
293 Context* global_context(); 290 Context* global_context();
294 291
295 // Predicates for context types. IsGlobalContext is defined on Object 292 // Predicates for context types. IsGlobalContext is defined on Object
296 // because we frequently have to know if arbitrary objects are global 293 // because we frequently have to know if arbitrary objects are global
297 // contexts. 294 // contexts.
298 bool IsFunctionContext() { 295 bool IsFunctionContext() {
299 Map* map = this->map(); 296 Map* map = this->map();
300 return map == map->GetHeap()->function_context_map(); 297 return map == map->GetHeap()->function_context_map();
301 } 298 }
302 bool IsCatchContext() { 299 bool IsCatchContext() {
303 Map* map = this->map(); 300 Map* map = this->map();
304 return map == map->GetHeap()->catch_context_map(); 301 return map == map->GetHeap()->catch_context_map();
305 } 302 }
306 bool IsWithContext() {
307 Map* map = this->map();
308 return map == map->GetHeap()->with_context_map();
309 }
310 303
311 // Tells whether the global context is marked with out of memory. 304 // Tells whether the global context is marked with out of memory.
312 inline bool has_out_of_memory(); 305 inline bool has_out_of_memory();
313 306
314 // Mark the global context with out of memory. 307 // Mark the global context with out of memory.
315 inline void mark_out_of_memory(); 308 inline void mark_out_of_memory();
316 309
317 // The exception holder is the object used as a with object in 310 // The exception holder is the object used as a with object in
318 // the implementation of a catch block. 311 // the implementation of a catch block.
319 bool is_exception_holder(Object* object) { 312 bool is_exception_holder(Object* object) {
(...skipping 68 matching lines...) Expand 10 before | Expand all | Expand 10 after
388 kHeaderSize, kSize, kSize> ScavengeBodyDescriptor; 381 kHeaderSize, kSize, kSize> ScavengeBodyDescriptor;
389 382
390 typedef FixedBodyDescriptor< 383 typedef FixedBodyDescriptor<
391 kHeaderSize, 384 kHeaderSize,
392 kHeaderSize + FIRST_WEAK_SLOT * kPointerSize, 385 kHeaderSize + FIRST_WEAK_SLOT * kPointerSize,
393 kSize> MarkCompactBodyDescriptor; 386 kSize> MarkCompactBodyDescriptor;
394 387
395 private: 388 private:
396 // Unchecked access to the slots. 389 // Unchecked access to the slots.
397 Object* unchecked_previous() { return get(PREVIOUS_INDEX); } 390 Object* unchecked_previous() { return get(PREVIOUS_INDEX); }
391 Object* unchecked_extension() { return get(EXTENSION_INDEX); }
398 392
399 #ifdef DEBUG 393 #ifdef DEBUG
400 // Bootstrapping-aware type checks. 394 // Bootstrapping-aware type checks.
401 static bool IsBootstrappingOrContext(Object* object); 395 static bool IsBootstrappingOrContext(Object* object);
402 static bool IsBootstrappingOrGlobalObject(Object* object); 396 static bool IsBootstrappingOrGlobalObject(Object* object);
403 #endif 397 #endif
404 }; 398 };
405 399
406 } } // namespace v8::internal 400 } } // namespace v8::internal
407 401
408 #endif // V8_CONTEXTS_H_ 402 #endif // V8_CONTEXTS_H_
OLDNEW
« no previous file with comments | « src/compiler.cc ('k') | src/contexts.cc » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698