| OLD | NEW |
| 1 // Copyright 2015 the V8 project authors. All rights reserved. | 1 // Copyright 2015 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/debug/debug-evaluate.h" | 5 #include "src/debug/debug-evaluate.h" |
| 6 | 6 |
| 7 #include "src/accessors.h" | 7 #include "src/accessors.h" |
| 8 #include "src/contexts.h" | 8 #include "src/contexts.h" |
| 9 #include "src/debug/debug.h" | 9 #include "src/debug/debug.h" |
| 10 #include "src/debug/debug-frames.h" | 10 #include "src/debug/debug-frames.h" |
| (...skipping 262 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 273 | 273 |
| 274 | 274 |
| 275 Handle<Context> DebugEvaluate::ContextBuilder::MaterializeReceiver( | 275 Handle<Context> DebugEvaluate::ContextBuilder::MaterializeReceiver( |
| 276 Handle<Context> target, Handle<JSFunction> function) { | 276 Handle<Context> target, Handle<JSFunction> function) { |
| 277 Handle<SharedFunctionInfo> shared(function->shared()); | 277 Handle<SharedFunctionInfo> shared(function->shared()); |
| 278 Handle<ScopeInfo> scope_info(shared->scope_info()); | 278 Handle<ScopeInfo> scope_info(shared->scope_info()); |
| 279 Handle<Object> receiver; | 279 Handle<Object> receiver; |
| 280 switch (scope_info->scope_type()) { | 280 switch (scope_info->scope_type()) { |
| 281 case FUNCTION_SCOPE: { | 281 case FUNCTION_SCOPE: { |
| 282 VariableMode mode; | 282 VariableMode mode; |
| 283 VariableLocation location; | |
| 284 InitializationFlag init_flag; | 283 InitializationFlag init_flag; |
| 285 MaybeAssignedFlag maybe_assigned_flag; | 284 MaybeAssignedFlag maybe_assigned_flag; |
| 286 | 285 |
| 287 // Don't bother creating a fake context node if "this" is in the context | 286 // Don't bother creating a fake context node if "this" is in the context |
| 288 // already. | 287 // already. |
| 289 if (ScopeInfo::ContextSlotIndex( | 288 if (ScopeInfo::ContextSlotIndex(scope_info, |
| 290 scope_info, isolate_->factory()->this_string(), &mode, &location, | 289 isolate_->factory()->this_string(), &mode, |
| 291 &init_flag, &maybe_assigned_flag) >= 0) { | 290 &init_flag, &maybe_assigned_flag) >= 0) { |
| 292 return target; | 291 return target; |
| 293 } | 292 } |
| 294 receiver = handle(frame_->receiver(), isolate_); | 293 receiver = handle(frame_->receiver(), isolate_); |
| 295 break; | 294 break; |
| 296 } | 295 } |
| 297 case MODULE_SCOPE: | 296 case MODULE_SCOPE: |
| 298 receiver = isolate_->factory()->undefined_value(); | 297 receiver = isolate_->factory()->undefined_value(); |
| 299 break; | 298 break; |
| 300 case SCRIPT_SCOPE: | 299 case SCRIPT_SCOPE: |
| 301 receiver = handle(function->global_proxy(), isolate_); | 300 receiver = handle(function->global_proxy(), isolate_); |
| 302 break; | 301 break; |
| 303 default: | 302 default: |
| 304 // For eval code, arrow functions, and the like, there's no "this" binding | 303 // For eval code, arrow functions, and the like, there's no "this" binding |
| 305 // to materialize. | 304 // to materialize. |
| 306 return target; | 305 return target; |
| 307 } | 306 } |
| 308 | 307 |
| 309 return isolate_->factory()->NewCatchContext( | 308 return isolate_->factory()->NewCatchContext( |
| 310 function, target, isolate_->factory()->this_string(), receiver); | 309 function, target, isolate_->factory()->this_string(), receiver); |
| 311 } | 310 } |
| 312 | 311 |
| 313 } // namespace internal | 312 } // namespace internal |
| 314 } // namespace v8 | 313 } // namespace v8 |
| OLD | NEW |