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