OLD | NEW |
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 11416 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
11427 RETURN_IF_EMPTY_HANDLE(isolate, local_scope); | 11427 RETURN_IF_EMPTY_HANDLE(isolate, local_scope); |
11428 | 11428 |
11429 // Allocate a new context for the debug evaluation and set the extension | 11429 // Allocate a new context for the debug evaluation and set the extension |
11430 // object build. | 11430 // object build. |
11431 Handle<Context> context = | 11431 Handle<Context> context = |
11432 isolate->factory()->NewFunctionContext(Context::MIN_CONTEXT_SLOTS, | 11432 isolate->factory()->NewFunctionContext(Context::MIN_CONTEXT_SLOTS, |
11433 go_between); | 11433 go_between); |
11434 context->set_extension(*local_scope); | 11434 context->set_extension(*local_scope); |
11435 // Copy any with contexts present and chain them in front of this context. | 11435 // Copy any with contexts present and chain them in front of this context. |
11436 Handle<Context> frame_context(Context::cast(frame->context())); | 11436 Handle<Context> frame_context(Context::cast(frame->context())); |
11437 Handle<Context> function_context(frame_context->declaration_context()); | 11437 Handle<Context> function_context; |
| 11438 // Get the function's context if it has one. |
| 11439 if (scope_info->HasHeapAllocatedLocals()) { |
| 11440 function_context = Handle<Context>(frame_context->declaration_context()); |
| 11441 } |
11438 context = CopyWithContextChain(isolate, go_between, frame_context, context); | 11442 context = CopyWithContextChain(isolate, go_between, frame_context, context); |
11439 | 11443 |
11440 if (additional_context->IsJSObject()) { | 11444 if (additional_context->IsJSObject()) { |
11441 Handle<JSObject> extension = Handle<JSObject>::cast(additional_context); | 11445 Handle<JSObject> extension = Handle<JSObject>::cast(additional_context); |
11442 context = | 11446 context = |
11443 isolate->factory()->NewWithContext(go_between, context, extension); | 11447 isolate->factory()->NewWithContext(go_between, context, extension); |
11444 } | 11448 } |
11445 | 11449 |
11446 // Wrap the evaluation statement in a new function compiled in the newly | 11450 // Wrap the evaluation statement in a new function compiled in the newly |
11447 // created context. The function has one parameter which has to be called | 11451 // created context. The function has one parameter which has to be called |
(...skipping 1375 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
12823 } else { | 12827 } else { |
12824 // Handle last resort GC and make sure to allow future allocations | 12828 // Handle last resort GC and make sure to allow future allocations |
12825 // to grow the heap without causing GCs (if possible). | 12829 // to grow the heap without causing GCs (if possible). |
12826 isolate->counters()->gc_last_resort_from_js()->Increment(); | 12830 isolate->counters()->gc_last_resort_from_js()->Increment(); |
12827 isolate->heap()->CollectAllGarbage(false); | 12831 isolate->heap()->CollectAllGarbage(false); |
12828 } | 12832 } |
12829 } | 12833 } |
12830 | 12834 |
12831 | 12835 |
12832 } } // namespace v8::internal | 12836 } } // namespace v8::internal |
OLD | NEW |