Index: src/runtime.cc |
diff --git a/src/runtime.cc b/src/runtime.cc |
index 019851e466a363948a3338c171eeac531b0290c4..97b146ae57249ed878ca8d106c0239c82eec2178 100644 |
--- a/src/runtime.cc |
+++ b/src/runtime.cc |
@@ -8431,6 +8431,27 @@ 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); |
+ } |
+ } |
+} |
+ |
+ |
RUNTIME_FUNCTION(MaybeObject*, Runtime_NotifyDeoptimized) { |
HandleScope scope(isolate); |
ASSERT(args.length() == 1); |
@@ -8446,26 +8467,15 @@ RUNTIME_FUNCTION(MaybeObject*, Runtime_NotifyDeoptimized) { |
JavaScriptFrameIterator it(isolate); |
JavaScriptFrame* frame = NULL; |
- for (int i = 0; i < jsframes - 1; i++) it.Advance(); |
+ for (int i = 0; i < jsframes - 1; i++) { |
+ MaterializeArgumentsObjectInFrame(isolate, it.frame()); |
+ it.Advance(); |
+ } |
frame = it.frame(); |
RUNTIME_ASSERT(frame->function()->IsJSFunction()); |
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); |
- } |
- } |
+ MaterializeArgumentsObjectInFrame(isolate, frame); |
if (type == Deoptimizer::EAGER) { |
RUNTIME_ASSERT(function->IsOptimized()); |