| OLD | NEW |
| 1 // Copyright 2014 the V8 project authors. All rights reserved. | 1 // Copyright 2014 the V8 project authors. All rights reserved. |
| 2 // Use of this source code is governed by a BSD-style license that can be | 2 // Use of this source code is governed by a BSD-style license that can be |
| 3 // found in the LICENSE file. | 3 // found in the LICENSE file. |
| 4 | 4 |
| 5 #include "src/v8.h" | 5 #include "src/v8.h" |
| 6 | 6 |
| 7 #include "src/accessors.h" | 7 #include "src/accessors.h" |
| 8 #include "src/arguments.h" | 8 #include "src/arguments.h" |
| 9 #include "src/compiler.h" | 9 #include "src/compiler.h" |
| 10 #include "src/debug.h" | 10 #include "src/debug.h" |
| (...skipping 2482 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 2493 : isolate_(isolate), | 2493 : isolate_(isolate), |
| 2494 frame_(frame), | 2494 frame_(frame), |
| 2495 inlined_jsframe_index_(inlined_jsframe_index) { | 2495 inlined_jsframe_index_(inlined_jsframe_index) { |
| 2496 FrameInspector frame_inspector(frame, inlined_jsframe_index, isolate); | 2496 FrameInspector frame_inspector(frame, inlined_jsframe_index, isolate); |
| 2497 Handle<JSFunction> function = | 2497 Handle<JSFunction> function = |
| 2498 handle(JSFunction::cast(frame_inspector.GetFunction())); | 2498 handle(JSFunction::cast(frame_inspector.GetFunction())); |
| 2499 Handle<Context> outer_context = handle(function->context(), isolate); | 2499 Handle<Context> outer_context = handle(function->context(), isolate); |
| 2500 outer_info_ = handle(function->shared()); | 2500 outer_info_ = handle(function->shared()); |
| 2501 Handle<Context> inner_context; | 2501 Handle<Context> inner_context; |
| 2502 | 2502 |
| 2503 // The "this" binding, if any, can't be bound via "with". If we need to, | |
| 2504 // add another node onto the outer context to bind "this". | |
| 2505 if (!MaterializeReceiver(isolate, outer_context, function, frame) | |
| 2506 .ToHandle(&outer_context)) | |
| 2507 return; | |
| 2508 | |
| 2509 bool stop = false; | 2503 bool stop = false; |
| 2510 for (ScopeIterator it(isolate, frame, inlined_jsframe_index); | 2504 for (ScopeIterator it(isolate, frame, inlined_jsframe_index); |
| 2511 !it.Failed() && !it.Done() && !stop; it.Next()) { | 2505 !it.Failed() && !it.Done() && !stop; it.Next()) { |
| 2512 ScopeIterator::ScopeType scope_type = it.Type(); | 2506 ScopeIterator::ScopeType scope_type = it.Type(); |
| 2513 | 2507 |
| 2514 if (scope_type == ScopeIterator::ScopeTypeLocal) { | 2508 if (scope_type == ScopeIterator::ScopeTypeLocal) { |
| 2509 Handle<Context> parent_context = |
| 2510 it.HasContext() ? it.CurrentContext() : outer_context; |
| 2511 |
| 2512 // The "this" binding, if any, can't be bound via "with". If we need |
| 2513 // to, add another node onto the outer context to bind "this". |
| 2514 if (!MaterializeReceiver(isolate, parent_context, function, frame) |
| 2515 .ToHandle(&parent_context)) |
| 2516 return; |
| 2517 |
| 2515 Handle<JSObject> materialized_function = | 2518 Handle<JSObject> materialized_function = |
| 2516 NewJSObjectWithNullProto(isolate); | 2519 NewJSObjectWithNullProto(isolate); |
| 2517 | 2520 |
| 2518 if (!MaterializeStackLocalsWithFrameInspector( | 2521 if (!MaterializeStackLocalsWithFrameInspector( |
| 2519 isolate, materialized_function, function, &frame_inspector) | 2522 isolate, materialized_function, function, &frame_inspector) |
| 2520 .ToHandle(&materialized_function)) | 2523 .ToHandle(&materialized_function)) |
| 2521 return; | 2524 return; |
| 2522 | 2525 |
| 2523 if (!MaterializeArgumentsObject(isolate, materialized_function, | 2526 if (!MaterializeArgumentsObject(isolate, materialized_function, |
| 2524 function) | 2527 function) |
| 2525 .ToHandle(&materialized_function)) | 2528 .ToHandle(&materialized_function)) |
| 2526 return; | 2529 return; |
| 2527 | 2530 |
| 2528 Handle<Context> parent_context = | |
| 2529 it.HasContext() ? it.CurrentContext() : outer_context; | |
| 2530 Handle<Context> with_context = isolate->factory()->NewWithContext( | 2531 Handle<Context> with_context = isolate->factory()->NewWithContext( |
| 2531 function, parent_context, materialized_function); | 2532 function, parent_context, materialized_function); |
| 2532 | 2533 |
| 2533 ContextChainElement context_chain_element; | 2534 ContextChainElement context_chain_element; |
| 2534 context_chain_element.original_context = it.CurrentContext(); | 2535 context_chain_element.original_context = it.CurrentContext(); |
| 2535 context_chain_element.materialized_object = materialized_function; | 2536 context_chain_element.materialized_object = materialized_function; |
| 2536 context_chain_element.scope_info = it.CurrentScopeInfo(); | 2537 context_chain_element.scope_info = it.CurrentScopeInfo(); |
| 2537 context_chain_.Add(context_chain_element); | 2538 context_chain_.Add(context_chain_element); |
| 2538 | 2539 |
| 2539 stop = true; | 2540 stop = true; |
| (...skipping 670 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 3210 return Smi::FromInt(isolate->debug()->is_active()); | 3211 return Smi::FromInt(isolate->debug()->is_active()); |
| 3211 } | 3212 } |
| 3212 | 3213 |
| 3213 | 3214 |
| 3214 RUNTIME_FUNCTION(Runtime_DebugBreakInOptimizedCode) { | 3215 RUNTIME_FUNCTION(Runtime_DebugBreakInOptimizedCode) { |
| 3215 UNIMPLEMENTED(); | 3216 UNIMPLEMENTED(); |
| 3216 return NULL; | 3217 return NULL; |
| 3217 } | 3218 } |
| 3218 } // namespace internal | 3219 } // namespace internal |
| 3219 } // namespace v8 | 3220 } // namespace v8 |
| OLD | NEW |