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

Side by Side Diff: src/contexts.cc

Issue 7230047: Remove the fcontext field from all contexts. (Closed) Base URL: https://v8.googlecode.com/svn/branches/bleeding_edge
Patch Set: Created 9 years, 5 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
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 16 matching lines...) Expand all
27 27
28 #include "v8.h" 28 #include "v8.h"
29 29
30 #include "bootstrapper.h" 30 #include "bootstrapper.h"
31 #include "debug.h" 31 #include "debug.h"
32 #include "scopeinfo.h" 32 #include "scopeinfo.h"
33 33
34 namespace v8 { 34 namespace v8 {
35 namespace internal { 35 namespace internal {
36 36
37 Context* Context::declaration_context() {
38 Context* current = this;
39 while (!current->IsFunctionContext() && !current->IsGlobalContext()) {
40 current = current->previous();
41 ASSERT(current->closure() == closure());
42 }
43 return current;
44 }
45
46
37 JSBuiltinsObject* Context::builtins() { 47 JSBuiltinsObject* Context::builtins() {
38 GlobalObject* object = global(); 48 GlobalObject* object = global();
39 if (object->IsJSGlobalObject()) { 49 if (object->IsJSGlobalObject()) {
40 return JSGlobalObject::cast(object)->builtins(); 50 return JSGlobalObject::cast(object)->builtins();
41 } else { 51 } else {
42 ASSERT(object->IsJSBuiltinsObject()); 52 ASSERT(object->IsJSBuiltinsObject());
43 return JSBuiltinsObject::cast(object); 53 return JSBuiltinsObject::cast(object);
44 } 54 }
45 } 55 }
46 56
(...skipping 192 matching lines...) Expand 10 before | Expand all | Expand 10 after
239 // No local or potential with statement found so the variable is 249 // No local or potential with statement found so the variable is
240 // global unless it is shadowed by an eval-introduced variable. 250 // global unless it is shadowed by an eval-introduced variable.
241 return true; 251 return true;
242 } 252 }
243 253
244 254
245 void Context::ComputeEvalScopeInfo(bool* outer_scope_calls_eval, 255 void Context::ComputeEvalScopeInfo(bool* outer_scope_calls_eval,
246 bool* outer_scope_calls_non_strict_eval) { 256 bool* outer_scope_calls_non_strict_eval) {
247 // Skip up the context chain checking all the function contexts to see 257 // Skip up the context chain checking all the function contexts to see
248 // whether they call eval. 258 // whether they call eval.
249 Context* context = fcontext(); 259 Context* context = this;
250 while (!context->IsGlobalContext()) { 260 while (!context->IsGlobalContext()) {
251 Handle<SerializedScopeInfo> scope_info( 261 if (context->IsFunctionContext()) {
252 context->closure()->shared()->scope_info()); 262 Handle<SerializedScopeInfo> scope_info(
253 if (scope_info->CallsEval()) { 263 context->closure()->shared()->scope_info());
254 *outer_scope_calls_eval = true; 264 if (scope_info->CallsEval()) {
255 if (!scope_info->IsStrictMode()) { 265 *outer_scope_calls_eval = true;
256 // No need to go further since the answers will not change 266 if (!scope_info->IsStrictMode()) {
257 // from here. 267 // No need to go further since the answers will not change from
258 *outer_scope_calls_non_strict_eval = true; 268 // here.
259 return; 269 *outer_scope_calls_non_strict_eval = true;
270 return;
271 }
260 } 272 }
261 } 273 }
262 context = context->previous()->fcontext(); 274 context = context->previous();
263 } 275 }
264 } 276 }
265 277
266 278
267 void Context::AddOptimizedFunction(JSFunction* function) { 279 void Context::AddOptimizedFunction(JSFunction* function) {
268 ASSERT(IsGlobalContext()); 280 ASSERT(IsGlobalContext());
269 #ifdef DEBUG 281 #ifdef DEBUG
270 Object* element = get(OPTIMIZED_FUNCTIONS_LIST); 282 Object* element = get(OPTIMIZED_FUNCTIONS_LIST);
271 while (!element->IsUndefined()) { 283 while (!element->IsUndefined()) {
272 CHECK(element != function); 284 CHECK(element != function);
(...skipping 66 matching lines...) Expand 10 before | Expand all | Expand 10 after
339 // During bootstrapping we allow all objects to pass as global 351 // During bootstrapping we allow all objects to pass as global
340 // objects. This is necessary to fix circular dependencies. 352 // objects. This is necessary to fix circular dependencies.
341 Isolate* isolate = Isolate::Current(); 353 Isolate* isolate = Isolate::Current();
342 return isolate->heap()->gc_state() != Heap::NOT_IN_GC || 354 return isolate->heap()->gc_state() != Heap::NOT_IN_GC ||
343 isolate->bootstrapper()->IsActive() || 355 isolate->bootstrapper()->IsActive() ||
344 object->IsGlobalObject(); 356 object->IsGlobalObject();
345 } 357 }
346 #endif 358 #endif
347 359
348 } } // namespace v8::internal 360 } } // namespace v8::internal
OLDNEW
« src/arm/full-codegen-arm.cc ('K') | « src/contexts.h ('k') | src/heap.cc » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698