Index: src/runtime.cc |
diff --git a/src/runtime.cc b/src/runtime.cc |
index 3c9a10dbfffe66f4b4579660ec8da1241f6ea717..93e0199ea86002108136da7df2bb08f080e74eeb 100644 |
--- a/src/runtime.cc |
+++ b/src/runtime.cc |
@@ -7970,35 +7970,6 @@ class ActivationsFinder : public ThreadVisitor { |
}; |
-static void MaterializeArgumentsObjectInFrame(Isolate* isolate, |
- JavaScriptFrame* frame) { |
- Handle<JSFunction> function(JSFunction::cast(frame->function()), isolate); |
- Handle<Object> arguments; |
- for (int i = frame->ComputeExpressionsCount() - 1; i >= 0; --i) { |
- if (frame->GetExpression(i) == isolate->heap()->arguments_marker()) { |
- if (arguments.is_null()) { |
- // FunctionGetArguments can't throw an exception, so cast away the |
- // doubt with an assert. |
- arguments = Handle<Object>( |
- Accessors::FunctionGetArguments(*function, |
- NULL)->ToObjectUnchecked()); |
- ASSERT(*arguments != isolate->heap()->null_value()); |
- ASSERT(*arguments != isolate->heap()->undefined_value()); |
- } |
- frame->SetExpression(i, *arguments); |
- if (FLAG_trace_deopt) { |
- PrintF("Materializing arguments object for frame %p - %p: %p ", |
- reinterpret_cast<void*>(frame->sp()), |
- reinterpret_cast<void*>(frame->fp()), |
- reinterpret_cast<void*>(*arguments)); |
- arguments->ShortPrint(); |
- PrintF("\n"); |
- } |
- } |
- } |
-} |
- |
- |
RUNTIME_FUNCTION(MaybeObject*, Runtime_NotifyDeoptimized) { |
HandleScope scope(isolate); |
ASSERT(args.length() == 1); |
@@ -8007,25 +7978,16 @@ RUNTIME_FUNCTION(MaybeObject*, Runtime_NotifyDeoptimized) { |
static_cast<Deoptimizer::BailoutType>(args.smi_at(0)); |
Deoptimizer* deoptimizer = Deoptimizer::Grab(isolate); |
ASSERT(isolate->heap()->IsAllocationAllowed()); |
- int jsframes = deoptimizer->jsframe_count(); |
+ JavaScriptFrameIterator it(isolate); |
- deoptimizer->MaterializeHeapNumbers(); |
+ // Make sure to materialize objects before causing any allocation. |
+ deoptimizer->MaterializeHeapObjects(&it); |
delete deoptimizer; |
- JavaScriptFrameIterator it(isolate); |
- for (int i = 0; i < jsframes - 1; i++) { |
- MaterializeArgumentsObjectInFrame(isolate, it.frame()); |
- it.Advance(); |
- } |
- |
JavaScriptFrame* frame = it.frame(); |
RUNTIME_ASSERT(frame->function()->IsJSFunction()); |
Handle<JSFunction> function(JSFunction::cast(frame->function()), isolate); |
- MaterializeArgumentsObjectInFrame(isolate, frame); |
- |
- if (type == Deoptimizer::EAGER) { |
- RUNTIME_ASSERT(function->IsOptimized()); |
- } |
+ RUNTIME_ASSERT(type != Deoptimizer::EAGER || function->IsOptimized()); |
// Avoid doing too much work when running with --always-opt and keep |
// the optimized code around. |