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

Side by Side Diff: trunk/src/contexts.cc

Issue 505062: Merge r3505 and r3509 to trunk. (Closed) Base URL: http://v8.googlecode.com/svn/branches/bleeding_edge/
Patch Set: Created 11 years 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 | trunk/src/execution.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 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 34 matching lines...) Expand 10 before | Expand all | Expand 10 after
45 } 45 }
46 46
47 47
48 Context* Context::global_context() { 48 Context* Context::global_context() {
49 // Fast case: the global object for this context has been set. In 49 // Fast case: the global object for this context has been set. In
50 // that case, the global object has a direct pointer to the global 50 // that case, the global object has a direct pointer to the global
51 // context. 51 // context.
52 if (global()->IsGlobalObject()) { 52 if (global()->IsGlobalObject()) {
53 return global()->global_context(); 53 return global()->global_context();
54 } 54 }
55
55 // During bootstrapping, the global object might not be set and we 56 // During bootstrapping, the global object might not be set and we
56 // have to search the context chain to find the global context. 57 // have to search the context chain to find the global context.
58 ASSERT(Bootstrapper::IsActive());
57 Context* current = this; 59 Context* current = this;
58 while (!current->IsGlobalContext()) { 60 while (!current->IsGlobalContext()) {
59 current = Context::cast(JSFunction::cast(current->closure())->context()); 61 JSFunction* closure = JSFunction::cast(current->closure());
62 current = Context::cast(closure->context());
60 } 63 }
61 return current; 64 return current;
62 } 65 }
63 66
64 67
65 JSObject* Context::global_proxy() { 68 JSObject* Context::global_proxy() {
66 return global_context()->global_proxy_object(); 69 return global_context()->global_proxy_object();
67 } 70 }
68 71
69 void Context::set_global_proxy(JSObject* object) { 72 void Context::set_global_proxy(JSObject* object) {
(...skipping 174 matching lines...) Expand 10 before | Expand all | Expand 10 after
244 247
245 248
246 bool Context::IsBootstrappingOrGlobalObject(Object* object) { 249 bool Context::IsBootstrappingOrGlobalObject(Object* object) {
247 // During bootstrapping we allow all objects to pass as global 250 // During bootstrapping we allow all objects to pass as global
248 // objects. This is necessary to fix circular dependencies. 251 // objects. This is necessary to fix circular dependencies.
249 return Bootstrapper::IsActive() || object->IsGlobalObject(); 252 return Bootstrapper::IsActive() || object->IsGlobalObject();
250 } 253 }
251 #endif 254 #endif
252 255
253 } } // namespace v8::internal 256 } } // namespace v8::internal
OLDNEW
« no previous file with comments | « no previous file | trunk/src/execution.cc » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698