OLD | NEW |
1 // Copyright 2012 the V8 project authors. All rights reserved. | 1 // Copyright 2012 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 12466 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
12477 isolate->debug()->ClearStepping(); | 12477 isolate->debug()->ClearStepping(); |
12478 return isolate->heap()->undefined_value(); | 12478 return isolate->heap()->undefined_value(); |
12479 } | 12479 } |
12480 | 12480 |
12481 | 12481 |
12482 // Helper function to find or create the arguments object for | 12482 // Helper function to find or create the arguments object for |
12483 // Runtime_DebugEvaluate. | 12483 // Runtime_DebugEvaluate. |
12484 static Handle<JSObject> MaterializeArgumentsObject( | 12484 static Handle<JSObject> MaterializeArgumentsObject( |
12485 Isolate* isolate, | 12485 Isolate* isolate, |
12486 Handle<JSObject> target, | 12486 Handle<JSObject> target, |
12487 Handle<JSFunction> function, | 12487 Handle<JSFunction> function) { |
12488 FrameInspector* frame_inspector) { | |
12489 // Do not materialize the arguments object for eval or top-level code. | 12488 // Do not materialize the arguments object for eval or top-level code. |
12490 // Skip if "arguments" is already taken. | 12489 // Skip if "arguments" is already taken. |
12491 if (!function->shared()->is_function() || | 12490 if (!function->shared()->is_function() || |
12492 target->HasLocalProperty(isolate->heap()->arguments_string())) { | 12491 target->HasLocalProperty(isolate->heap()->arguments_string())) { |
12493 return target; | 12492 return target; |
12494 } | 12493 } |
12495 | 12494 |
12496 // FunctionGetArguments can't return a non-Object. | 12495 // FunctionGetArguments can't throw an exception. |
12497 Handle<JSObject> arguments(JSObject::cast( | 12496 Handle<JSObject> arguments = Handle<JSObject>::cast( |
12498 Accessors::FunctionGetArguments(frame_inspector->GetFunction(), | 12497 Accessors::FunctionGetArguments(function)); |
12499 NULL)->ToObjectUnchecked()), isolate); | |
12500 SetProperty(isolate, | 12498 SetProperty(isolate, |
12501 target, | 12499 target, |
12502 isolate->factory()->arguments_string(), | 12500 isolate->factory()->arguments_string(), |
12503 arguments, | 12501 arguments, |
12504 ::NONE, | 12502 ::NONE, |
12505 kNonStrictMode); | 12503 kNonStrictMode); |
12506 return target; | 12504 return target; |
12507 } | 12505 } |
12508 | 12506 |
12509 | 12507 |
(...skipping 83 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
12593 ASSERT(!context.is_null()); | 12591 ASSERT(!context.is_null()); |
12594 | 12592 |
12595 // Materialize stack locals and the arguments object. | 12593 // Materialize stack locals and the arguments object. |
12596 Handle<JSObject> materialized = | 12594 Handle<JSObject> materialized = |
12597 isolate->factory()->NewJSObject(isolate->object_function()); | 12595 isolate->factory()->NewJSObject(isolate->object_function()); |
12598 | 12596 |
12599 materialized = MaterializeStackLocalsWithFrameInspector( | 12597 materialized = MaterializeStackLocalsWithFrameInspector( |
12600 isolate, materialized, function, &frame_inspector); | 12598 isolate, materialized, function, &frame_inspector); |
12601 RETURN_IF_EMPTY_HANDLE(isolate, materialized); | 12599 RETURN_IF_EMPTY_HANDLE(isolate, materialized); |
12602 | 12600 |
12603 materialized = MaterializeArgumentsObject( | 12601 materialized = MaterializeArgumentsObject(isolate, materialized, function); |
12604 isolate, materialized, function, &frame_inspector); | |
12605 RETURN_IF_EMPTY_HANDLE(isolate, materialized); | 12602 RETURN_IF_EMPTY_HANDLE(isolate, materialized); |
12606 | 12603 |
12607 // Add the materialized object in a with-scope to shadow the stack locals. | 12604 // Add the materialized object in a with-scope to shadow the stack locals. |
12608 context = isolate->factory()->NewWithContext(function, context, materialized); | 12605 context = isolate->factory()->NewWithContext(function, context, materialized); |
12609 | 12606 |
12610 Handle<Object> receiver(frame->receiver(), isolate); | 12607 Handle<Object> receiver(frame->receiver(), isolate); |
12611 Object* evaluate_result_object; | 12608 Object* evaluate_result_object; |
12612 { MaybeObject* maybe_result = | 12609 { MaybeObject* maybe_result = |
12613 DebugEvaluate(isolate, context, context_extension, receiver, source); | 12610 DebugEvaluate(isolate, context, context_extension, receiver, source); |
12614 if (!maybe_result->ToObject(&evaluate_result_object)) return maybe_result; | 12611 if (!maybe_result->ToObject(&evaluate_result_object)) return maybe_result; |
(...skipping 1371 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
13986 // Handle last resort GC and make sure to allow future allocations | 13983 // Handle last resort GC and make sure to allow future allocations |
13987 // to grow the heap without causing GCs (if possible). | 13984 // to grow the heap without causing GCs (if possible). |
13988 isolate->counters()->gc_last_resort_from_js()->Increment(); | 13985 isolate->counters()->gc_last_resort_from_js()->Increment(); |
13989 isolate->heap()->CollectAllGarbage(Heap::kNoGCFlags, | 13986 isolate->heap()->CollectAllGarbage(Heap::kNoGCFlags, |
13990 "Runtime::PerformGC"); | 13987 "Runtime::PerformGC"); |
13991 } | 13988 } |
13992 } | 13989 } |
13993 | 13990 |
13994 | 13991 |
13995 } } // namespace v8::internal | 13992 } } // namespace v8::internal |
OLD | NEW |