| OLD | NEW |
| 1 // Copyright 2013 the V8 project authors. All rights reserved. | 1 // Copyright 2013 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 375 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 386 // Move the code to the _deoptimized_ code list. | 386 // Move the code to the _deoptimized_ code list. |
| 387 code->set_next_code_link(context->DeoptimizedCodeListHead()); | 387 code->set_next_code_link(context->DeoptimizedCodeListHead()); |
| 388 context->SetDeoptimizedCodeListHead(code); | 388 context->SetDeoptimizedCodeListHead(code); |
| 389 } else { | 389 } else { |
| 390 // Not marked; preserve this element. | 390 // Not marked; preserve this element. |
| 391 prev = code; | 391 prev = code; |
| 392 } | 392 } |
| 393 element = next; | 393 element = next; |
| 394 } | 394 } |
| 395 | 395 |
| 396 #ifdef DEBUG |
| 397 // Make sure all activations of optimized code can deopt at their current PC. |
| 398 for (StackFrameIterator it(isolate, isolate->thread_local_top()); |
| 399 !it.done(); it.Advance()) { |
| 400 StackFrame::Type type = it.frame()->type(); |
| 401 if (type == StackFrame::OPTIMIZED) { |
| 402 Code* code = it.frame()->LookupCode(); |
| 403 if (FLAG_trace_deopt) { |
| 404 JSFunction* function = |
| 405 static_cast<OptimizedFrame*>(it.frame())->function(); |
| 406 CodeTracer::Scope scope(isolate->GetCodeTracer()); |
| 407 PrintF(scope.file(), "[deoptimizer patches for lazy deopt: "); |
| 408 function->PrintName(scope.file()); |
| 409 PrintF(scope.file(), |
| 410 " / %" V8PRIxPTR "]\n", reinterpret_cast<intptr_t>(function)); |
| 411 } |
| 412 SafepointEntry safepoint = code->GetSafepointEntry(it.frame()->pc()); |
| 413 int deopt_index = safepoint.deoptimization_index(); |
| 414 CHECK(deopt_index != Safepoint::kNoDeoptimizationIndex); |
| 415 } |
| 416 } |
| 417 #endif |
| 418 |
| 396 // TODO(titzer): we need a handle scope only because of the macro assembler, | 419 // TODO(titzer): we need a handle scope only because of the macro assembler, |
| 397 // which is only used in EnsureCodeForDeoptimizationEntry. | 420 // which is only used in EnsureCodeForDeoptimizationEntry. |
| 398 HandleScope scope(isolate); | 421 HandleScope scope(isolate); |
| 422 |
| 399 // Now patch all the codes for deoptimization. | 423 // Now patch all the codes for deoptimization. |
| 400 for (int i = 0; i < codes.length(); i++) { | 424 for (int i = 0; i < codes.length(); i++) { |
| 401 // It is finally time to die, code object. | 425 // It is finally time to die, code object. |
| 402 // Do platform-specific patching to force any activations to lazy deopt. | 426 // Do platform-specific patching to force any activations to lazy deopt. |
| 403 PatchCodeForDeoptimization(isolate, codes[i]); | 427 PatchCodeForDeoptimization(isolate, codes[i]); |
| 404 | 428 |
| 405 // We might be in the middle of incremental marking with compaction. | 429 // We might be in the middle of incremental marking with compaction. |
| 406 // Tell collector to treat this code object in a special way and | 430 // Tell collector to treat this code object in a special way and |
| 407 // ignore all slots that might have been recorded on it. | 431 // ignore all slots that might have been recorded on it. |
| 408 isolate->heap()->mark_compact_collector()->InvalidateCode(codes[i]); | 432 isolate->heap()->mark_compact_collector()->InvalidateCode(codes[i]); |
| (...skipping 2646 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 3055 | 3079 |
| 3056 void DeoptimizedFrameInfo::Iterate(ObjectVisitor* v) { | 3080 void DeoptimizedFrameInfo::Iterate(ObjectVisitor* v) { |
| 3057 v->VisitPointer(BitCast<Object**>(&function_)); | 3081 v->VisitPointer(BitCast<Object**>(&function_)); |
| 3058 v->VisitPointers(parameters_, parameters_ + parameters_count_); | 3082 v->VisitPointers(parameters_, parameters_ + parameters_count_); |
| 3059 v->VisitPointers(expression_stack_, expression_stack_ + expression_count_); | 3083 v->VisitPointers(expression_stack_, expression_stack_ + expression_count_); |
| 3060 } | 3084 } |
| 3061 | 3085 |
| 3062 #endif // ENABLE_DEBUGGER_SUPPORT | 3086 #endif // ENABLE_DEBUGGER_SUPPORT |
| 3063 | 3087 |
| 3064 } } // namespace v8::internal | 3088 } } // namespace v8::internal |
| OLD | NEW |