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

Side by Side Diff: src/contexts.h

Issue 7152002: Change the representation of catch contexts. (Closed) Base URL: https://v8.googlecode.com/svn/branches/bleeding_edge
Patch Set: 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 | « no previous file | src/contexts.cc » ('j') | src/contexts.cc » ('J')
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 163 matching lines...) Expand 10 before | Expand all | Expand 10 after
174 ASSERT(context->IsContext()); 174 ASSERT(context->IsContext());
175 return reinterpret_cast<Context*>(context); 175 return reinterpret_cast<Context*>(context);
176 } 176 }
177 177
178 // The default context slot layout; indices are FixedArray slot indices. 178 // The default context slot layout; indices are FixedArray slot indices.
179 enum { 179 enum {
180 // These slots are in all contexts. 180 // These slots are in all contexts.
181 CLOSURE_INDEX, 181 CLOSURE_INDEX,
182 FCONTEXT_INDEX, 182 FCONTEXT_INDEX,
183 PREVIOUS_INDEX, 183 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).
184 EXTENSION_INDEX, 187 EXTENSION_INDEX,
185 GLOBAL_INDEX, 188 GLOBAL_INDEX,
186 MIN_CONTEXT_SLOTS, 189 MIN_CONTEXT_SLOTS,
187 190
191 // This slot holds the thrown value in catch contexts.
192 THROWN_OBJECT_INDEX = MIN_CONTEXT_SLOTS,
193
188 // These slots are only in global contexts. 194 // These slots are only in global contexts.
189 GLOBAL_PROXY_INDEX = MIN_CONTEXT_SLOTS, 195 GLOBAL_PROXY_INDEX = MIN_CONTEXT_SLOTS,
190 SECURITY_TOKEN_INDEX, 196 SECURITY_TOKEN_INDEX,
191 ARGUMENTS_BOILERPLATE_INDEX, 197 ARGUMENTS_BOILERPLATE_INDEX,
192 STRICT_MODE_ARGUMENTS_BOILERPLATE_INDEX, 198 STRICT_MODE_ARGUMENTS_BOILERPLATE_INDEX,
193 JS_ARRAY_MAP_INDEX, 199 JS_ARRAY_MAP_INDEX,
194 REGEXP_RESULT_MAP_INDEX, 200 REGEXP_RESULT_MAP_INDEX,
195 FUNCTION_MAP_INDEX, 201 FUNCTION_MAP_INDEX,
196 STRICT_MODE_FUNCTION_MAP_INDEX, 202 STRICT_MODE_FUNCTION_MAP_INDEX,
197 FUNCTION_WITHOUT_PROTOTYPE_MAP_INDEX, 203 FUNCTION_WITHOUT_PROTOTYPE_MAP_INDEX,
(...skipping 60 matching lines...) Expand 10 before | Expand all | Expand 10 after
258 Context* fcontext() { return Context::cast(get(FCONTEXT_INDEX)); } 264 Context* fcontext() { return Context::cast(get(FCONTEXT_INDEX)); }
259 void set_fcontext(Context* context) { set(FCONTEXT_INDEX, context); } 265 void set_fcontext(Context* context) { set(FCONTEXT_INDEX, context); }
260 266
261 Context* previous() { 267 Context* previous() {
262 Object* result = unchecked_previous(); 268 Object* result = unchecked_previous();
263 ASSERT(IsBootstrappingOrContext(result)); 269 ASSERT(IsBootstrappingOrContext(result));
264 return reinterpret_cast<Context*>(result); 270 return reinterpret_cast<Context*>(result);
265 } 271 }
266 void set_previous(Context* context) { set(PREVIOUS_INDEX, context); } 272 void set_previous(Context* context) { set(PREVIOUS_INDEX, context); }
267 273
268 bool has_extension() { return unchecked_extension() != NULL; } 274 bool has_extension() { return extension() != NULL; }
269 JSObject* extension() { return JSObject::cast(unchecked_extension()); } 275 Object* extension() { return get(EXTENSION_INDEX); }
270 void set_extension(JSObject* object) { set(EXTENSION_INDEX, object); } 276 void set_extension(Object* object) { set(EXTENSION_INDEX, object); }
271 277
272 GlobalObject* global() { 278 GlobalObject* global() {
273 Object* result = get(GLOBAL_INDEX); 279 Object* result = get(GLOBAL_INDEX);
274 ASSERT(IsBootstrappingOrGlobalObject(result)); 280 ASSERT(IsBootstrappingOrGlobalObject(result));
275 return reinterpret_cast<GlobalObject*>(result); 281 return reinterpret_cast<GlobalObject*>(result);
276 } 282 }
277 void set_global(GlobalObject* global) { set(GLOBAL_INDEX, global); } 283 void set_global(GlobalObject* global) { set(GLOBAL_INDEX, global); }
278 284
279 // Returns a JSGlobalProxy object or null. 285 // Returns a JSGlobalProxy object or null.
280 JSObject* global_proxy(); 286 JSObject* global_proxy();
(...skipping 97 matching lines...) Expand 10 before | Expand all | Expand 10 after
378 kHeaderSize, kSize, kSize> ScavengeBodyDescriptor; 384 kHeaderSize, kSize, kSize> ScavengeBodyDescriptor;
379 385
380 typedef FixedBodyDescriptor< 386 typedef FixedBodyDescriptor<
381 kHeaderSize, 387 kHeaderSize,
382 kHeaderSize + FIRST_WEAK_SLOT * kPointerSize, 388 kHeaderSize + FIRST_WEAK_SLOT * kPointerSize,
383 kSize> MarkCompactBodyDescriptor; 389 kSize> MarkCompactBodyDescriptor;
384 390
385 private: 391 private:
386 // Unchecked access to the slots. 392 // Unchecked access to the slots.
387 Object* unchecked_previous() { return get(PREVIOUS_INDEX); } 393 Object* unchecked_previous() { return get(PREVIOUS_INDEX); }
388 Object* unchecked_extension() { return get(EXTENSION_INDEX); }
389 394
390 #ifdef DEBUG 395 #ifdef DEBUG
391 // Bootstrapping-aware type checks. 396 // Bootstrapping-aware type checks.
392 static bool IsBootstrappingOrContext(Object* object); 397 static bool IsBootstrappingOrContext(Object* object);
393 static bool IsBootstrappingOrGlobalObject(Object* object); 398 static bool IsBootstrappingOrGlobalObject(Object* object);
394 #endif 399 #endif
395 }; 400 };
396 401
397 } } // namespace v8::internal 402 } } // namespace v8::internal
398 403
399 #endif // V8_CONTEXTS_H_ 404 #endif // V8_CONTEXTS_H_
OLDNEW
« no previous file with comments | « no previous file | src/contexts.cc » ('j') | src/contexts.cc » ('J')

Powered by Google App Engine
This is Rietveld 408576698