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

Side by Side Diff: src/deoptimizer.cc

Issue 8917014: Guard against undefined fields in global context. (Closed) Base URL: https://v8.googlecode.com/svn/branches/bleeding_edge
Patch Set: Address comments. Created 9 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 | « src/assembler.cc ('k') | src/heap.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 246 matching lines...) Expand 10 before | Expand all | Expand 10 after
257 GlobalObject::cast(object)->global_context(), visitor); 257 GlobalObject::cast(object)->global_context(), visitor);
258 } 258 }
259 } 259 }
260 260
261 261
262 void Deoptimizer::VisitAllOptimizedFunctions( 262 void Deoptimizer::VisitAllOptimizedFunctions(
263 OptimizedFunctionVisitor* visitor) { 263 OptimizedFunctionVisitor* visitor) {
264 AssertNoAllocation no_allocation; 264 AssertNoAllocation no_allocation;
265 265
266 // Run through the list of all global contexts and deoptimize. 266 // Run through the list of all global contexts and deoptimize.
267 Object* global = Isolate::Current()->heap()->global_contexts_list(); 267 Object* context = Isolate::Current()->heap()->global_contexts_list();
268 while (!global->IsUndefined()) { 268 while (!context->IsUndefined()) {
269 VisitAllOptimizedFunctionsForGlobalObject(Context::cast(global)->global(), 269 // GC can happen when the context is not fully initialized,
270 visitor); 270 // so the global field of the context can be undefined.
271 global = Context::cast(global)->get(Context::NEXT_CONTEXT_LINK); 271 Object* global = Context::cast(context)->get(Context::GLOBAL_INDEX);
272 if (!global->IsUndefined()) {
273 VisitAllOptimizedFunctionsForGlobalObject(JSObject::cast(global),
274 visitor);
275 }
276 context = Context::cast(context)->get(Context::NEXT_CONTEXT_LINK);
272 } 277 }
273 } 278 }
274 279
275 280
276 void Deoptimizer::HandleWeakDeoptimizedCode( 281 void Deoptimizer::HandleWeakDeoptimizedCode(
277 v8::Persistent<v8::Value> obj, void* data) { 282 v8::Persistent<v8::Value> obj, void* data) {
278 DeoptimizingCodeListNode* node = 283 DeoptimizingCodeListNode* node =
279 reinterpret_cast<DeoptimizingCodeListNode*>(data); 284 reinterpret_cast<DeoptimizingCodeListNode*>(data);
280 RemoveDeoptimizingCode(*node->code()); 285 RemoveDeoptimizingCode(*node->code());
281 #ifdef DEBUG 286 #ifdef DEBUG
(...skipping 1211 matching lines...) Expand 10 before | Expand all | Expand 10 after
1493 1498
1494 void DeoptimizedFrameInfo::Iterate(ObjectVisitor* v) { 1499 void DeoptimizedFrameInfo::Iterate(ObjectVisitor* v) {
1495 v->VisitPointer(BitCast<Object**>(&function_)); 1500 v->VisitPointer(BitCast<Object**>(&function_));
1496 v->VisitPointers(parameters_, parameters_ + parameters_count_); 1501 v->VisitPointers(parameters_, parameters_ + parameters_count_);
1497 v->VisitPointers(expression_stack_, expression_stack_ + expression_count_); 1502 v->VisitPointers(expression_stack_, expression_stack_ + expression_count_);
1498 } 1503 }
1499 1504
1500 #endif // ENABLE_DEBUGGER_SUPPORT 1505 #endif // ENABLE_DEBUGGER_SUPPORT
1501 1506
1502 } } // namespace v8::internal 1507 } } // namespace v8::internal
OLDNEW
« no previous file with comments | « src/assembler.cc ('k') | src/heap.cc » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698