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 12211 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
12222 isolate->set_context(*top->context()); | 12222 isolate->set_context(*top->context()); |
12223 } | 12223 } |
12224 | 12224 |
12225 // Get the global context now set to the top context from before the | 12225 // Get the global context now set to the top context from before the |
12226 // debugger was invoked. | 12226 // debugger was invoked. |
12227 Handle<Context> context = isolate->global_context(); | 12227 Handle<Context> context = isolate->global_context(); |
12228 | 12228 |
12229 bool is_global = true; | 12229 bool is_global = true; |
12230 | 12230 |
12231 if (additional_context->IsJSObject()) { | 12231 if (additional_context->IsJSObject()) { |
12232 // Create a function context first, than put 'with' context on top of it. | 12232 // Create a new with context with the additional context information between |
12233 Handle<JSFunction> go_between = isolate->factory()->NewFunction( | 12233 // the context of the debugged function and the eval code to be executed. |
12234 isolate->factory()->empty_string(), | 12234 context = isolate->factory()->NewWithContext( |
12235 isolate->factory()->undefined_value()); | 12235 Handle<JSFunction>(context->closure()), |
12236 go_between->set_context(*context); | 12236 context, |
12237 context = | 12237 Handle<JSObject>::cast(additional_context)); |
12238 isolate->factory()->NewFunctionContext( | |
12239 Context::MIN_CONTEXT_SLOTS, go_between); | |
12240 context->set_extension(JSObject::cast(*additional_context)); | |
12241 is_global = false; | 12238 is_global = false; |
12242 } | 12239 } |
12243 | 12240 |
12244 // Compile the source to be evaluated. | 12241 // Compile the source to be evaluated. |
12245 // Currently, the eval code will be executed in non-strict mode, | 12242 // Currently, the eval code will be executed in non-strict mode, |
12246 // even in the strict code context. | 12243 // even in the strict code context. |
12247 Handle<SharedFunctionInfo> shared = | 12244 Handle<SharedFunctionInfo> shared = |
12248 Compiler::CompileEval(source, | 12245 Compiler::CompileEval(source, |
12249 context, | 12246 context, |
12250 is_global, | 12247 is_global, |
(...skipping 1327 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
13578 } else { | 13575 } else { |
13579 // Handle last resort GC and make sure to allow future allocations | 13576 // Handle last resort GC and make sure to allow future allocations |
13580 // to grow the heap without causing GCs (if possible). | 13577 // to grow the heap without causing GCs (if possible). |
13581 isolate->counters()->gc_last_resort_from_js()->Increment(); | 13578 isolate->counters()->gc_last_resort_from_js()->Increment(); |
13582 isolate->heap()->CollectAllGarbage(Heap::kNoGCFlags); | 13579 isolate->heap()->CollectAllGarbage(Heap::kNoGCFlags); |
13583 } | 13580 } |
13584 } | 13581 } |
13585 | 13582 |
13586 | 13583 |
13587 } } // namespace v8::internal | 13584 } } // namespace v8::internal |
OLD | NEW |