OLD | NEW |
1 // Copyright 2012 the V8 project authors. All rights reserved. | 1 // Copyright 2012 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 <stdlib.h> | 5 #include <stdlib.h> |
6 #include <limits> | 6 #include <limits> |
7 | 7 |
8 #include "src/v8.h" | 8 #include "src/v8.h" |
9 | 9 |
10 #include "src/accessors.h" | 10 #include "src/accessors.h" |
(...skipping 11175 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
11186 int GetSourcePosition() { | 11186 int GetSourcePosition() { |
11187 return is_optimized_ | 11187 return is_optimized_ |
11188 ? deoptimized_frame_->GetSourcePosition() | 11188 ? deoptimized_frame_->GetSourcePosition() |
11189 : frame_->LookupCode()->SourcePosition(frame_->pc()); | 11189 : frame_->LookupCode()->SourcePosition(frame_->pc()); |
11190 } | 11190 } |
11191 bool IsConstructor() { | 11191 bool IsConstructor() { |
11192 return is_optimized_ && !is_bottommost_ | 11192 return is_optimized_ && !is_bottommost_ |
11193 ? deoptimized_frame_->HasConstructStub() | 11193 ? deoptimized_frame_->HasConstructStub() |
11194 : frame_->IsConstructor(); | 11194 : frame_->IsConstructor(); |
11195 } | 11195 } |
| 11196 Object* GetContext() { |
| 11197 return is_optimized_ ? deoptimized_frame_->GetContext() : frame_->context(); |
| 11198 } |
11196 | 11199 |
11197 // To inspect all the provided arguments the frame might need to be | 11200 // To inspect all the provided arguments the frame might need to be |
11198 // replaced with the arguments frame. | 11201 // replaced with the arguments frame. |
11199 void SetArgumentsFrame(JavaScriptFrame* frame) { | 11202 void SetArgumentsFrame(JavaScriptFrame* frame) { |
11200 DCHECK(has_adapted_arguments_); | 11203 DCHECK(has_adapted_arguments_); |
11201 frame_ = frame; | 11204 frame_ = frame; |
11202 is_optimized_ = frame_->is_optimized(); | 11205 is_optimized_ = frame_->is_optimized(); |
11203 DCHECK(!is_optimized_); | 11206 DCHECK(!is_optimized_); |
11204 } | 11207 } |
11205 | 11208 |
(...skipping 128 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
11334 // Use the value from the stack. | 11337 // Use the value from the stack. |
11335 if (scope_info->LocalIsSynthetic(i)) | 11338 if (scope_info->LocalIsSynthetic(i)) |
11336 continue; | 11339 continue; |
11337 locals->set(local * 2, scope_info->LocalName(i)); | 11340 locals->set(local * 2, scope_info->LocalName(i)); |
11338 locals->set(local * 2 + 1, frame_inspector.GetExpression(i)); | 11341 locals->set(local * 2 + 1, frame_inspector.GetExpression(i)); |
11339 local++; | 11342 local++; |
11340 } | 11343 } |
11341 if (local < local_count) { | 11344 if (local < local_count) { |
11342 // Get the context containing declarations. | 11345 // Get the context containing declarations. |
11343 Handle<Context> context( | 11346 Handle<Context> context( |
11344 Context::cast(it.frame()->context())->declaration_context()); | 11347 Context::cast(frame_inspector.GetContext())->declaration_context()); |
11345 for (; i < scope_info->LocalCount(); ++i) { | 11348 for (; i < scope_info->LocalCount(); ++i) { |
11346 if (scope_info->LocalIsSynthetic(i)) | 11349 if (scope_info->LocalIsSynthetic(i)) |
11347 continue; | 11350 continue; |
11348 Handle<String> name(scope_info->LocalName(i)); | 11351 Handle<String> name(scope_info->LocalName(i)); |
11349 VariableMode mode; | 11352 VariableMode mode; |
11350 InitializationFlag init_flag; | 11353 InitializationFlag init_flag; |
11351 MaybeAssignedFlag maybe_assigned_flag; | 11354 MaybeAssignedFlag maybe_assigned_flag; |
11352 locals->set(local * 2, *name); | 11355 locals->set(local * 2, *name); |
11353 int context_slot_index = ScopeInfo::ContextSlotIndex( | 11356 int context_slot_index = ScopeInfo::ContextSlotIndex( |
11354 scope_info, name, &mode, &init_flag, &maybe_assigned_flag); | 11357 scope_info, name, &mode, &init_flag, &maybe_assigned_flag); |
(...skipping 1664 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
13019 Handle<JSFunction> function(JSFunction::cast(frame_inspector.GetFunction())); | 13022 Handle<JSFunction> function(JSFunction::cast(frame_inspector.GetFunction())); |
13020 | 13023 |
13021 // Traverse the saved contexts chain to find the active context for the | 13024 // Traverse the saved contexts chain to find the active context for the |
13022 // selected frame. | 13025 // selected frame. |
13023 SaveContext* save = FindSavedContextForFrame(isolate, frame); | 13026 SaveContext* save = FindSavedContextForFrame(isolate, frame); |
13024 | 13027 |
13025 SaveContext savex(isolate); | 13028 SaveContext savex(isolate); |
13026 isolate->set_context(*(save->context())); | 13029 isolate->set_context(*(save->context())); |
13027 | 13030 |
13028 // Evaluate on the context of the frame. | 13031 // Evaluate on the context of the frame. |
13029 Handle<Context> context(Context::cast(frame->context())); | 13032 Handle<Context> context(Context::cast(frame_inspector.GetContext())); |
13030 DCHECK(!context.is_null()); | 13033 DCHECK(!context.is_null()); |
13031 | 13034 |
13032 // Materialize stack locals and the arguments object. | 13035 // Materialize stack locals and the arguments object. |
13033 Handle<JSObject> materialized = | 13036 Handle<JSObject> materialized = |
13034 isolate->factory()->NewJSObject(isolate->object_function()); | 13037 isolate->factory()->NewJSObject(isolate->object_function()); |
13035 | 13038 |
13036 ASSIGN_RETURN_FAILURE_ON_EXCEPTION( | 13039 ASSIGN_RETURN_FAILURE_ON_EXCEPTION( |
13037 isolate, materialized, | 13040 isolate, materialized, |
13038 MaterializeStackLocalsWithFrameInspector( | 13041 MaterializeStackLocalsWithFrameInspector( |
13039 isolate, materialized, function, &frame_inspector)); | 13042 isolate, materialized, function, &frame_inspector)); |
(...skipping 2612 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
15652 } | 15655 } |
15653 return NULL; | 15656 return NULL; |
15654 } | 15657 } |
15655 | 15658 |
15656 | 15659 |
15657 const Runtime::Function* Runtime::FunctionForId(Runtime::FunctionId id) { | 15660 const Runtime::Function* Runtime::FunctionForId(Runtime::FunctionId id) { |
15658 return &(kIntrinsicFunctions[static_cast<int>(id)]); | 15661 return &(kIntrinsicFunctions[static_cast<int>(id)]); |
15659 } | 15662 } |
15660 | 15663 |
15661 } } // namespace v8::internal | 15664 } } // namespace v8::internal |
OLD | NEW |