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-frames.h" | 5 #include "src/debug/debug-frames.h" |
6 | 6 |
7 #include "src/frames-inl.h" | 7 #include "src/frames-inl.h" |
8 | 8 |
9 namespace v8 { | 9 namespace v8 { |
10 namespace internal { | 10 namespace internal { |
(...skipping 115 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
126 DCHECK(!value->IsTheHole()); | 126 DCHECK(!value->IsTheHole()); |
127 | 127 |
128 JSObject::SetOwnPropertyIgnoreAttributes(target, name, value, NONE).Check(); | 128 JSObject::SetOwnPropertyIgnoreAttributes(target, name, value, NONE).Check(); |
129 } | 129 } |
130 | 130 |
131 // Second fill all stack locals. | 131 // Second fill all stack locals. |
132 for (int i = 0; i < scope_info->StackLocalCount(); ++i) { | 132 for (int i = 0; i < scope_info->StackLocalCount(); ++i) { |
133 if (scope_info->LocalIsSynthetic(i)) continue; | 133 if (scope_info->LocalIsSynthetic(i)) continue; |
134 Handle<String> name(scope_info->StackLocalName(i)); | 134 Handle<String> name(scope_info->StackLocalName(i)); |
135 Handle<Object> value = GetExpression(scope_info->StackLocalIndex(i)); | 135 Handle<Object> value = GetExpression(scope_info->StackLocalIndex(i)); |
| 136 // TODO(yangguo): We convert optimized out values to {undefined} when they |
| 137 // are passed to the debugger. Eventually we should handle them somehow. |
136 if (value->IsTheHole()) value = isolate_->factory()->undefined_value(); | 138 if (value->IsTheHole()) value = isolate_->factory()->undefined_value(); |
137 | 139 if (value->IsOptimizedOut()) value = isolate_->factory()->undefined_value(); |
138 JSObject::SetOwnPropertyIgnoreAttributes(target, name, value, NONE).Check(); | 140 JSObject::SetOwnPropertyIgnoreAttributes(target, name, value, NONE).Check(); |
139 } | 141 } |
140 } | 142 } |
141 | 143 |
142 | 144 |
143 void FrameInspector::MaterializeStackLocals(Handle<JSObject> target, | 145 void FrameInspector::MaterializeStackLocals(Handle<JSObject> target, |
144 Handle<JSFunction> function) { | 146 Handle<JSFunction> function) { |
145 Handle<SharedFunctionInfo> shared(function->shared()); | 147 Handle<SharedFunctionInfo> shared(function->shared()); |
146 Handle<ScopeInfo> scope_info(shared->scope_info()); | 148 Handle<ScopeInfo> scope_info(shared->scope_info()); |
147 MaterializeStackLocals(target, scope_info); | 149 MaterializeStackLocals(target, scope_info); |
(...skipping 67 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
215 if (!frames[i].function()->shared()->IsSubjectToDebugging()) continue; | 217 if (!frames[i].function()->shared()->IsSubjectToDebugging()) continue; |
216 if (++count == index) return i; | 218 if (++count == index) return i; |
217 } | 219 } |
218 } | 220 } |
219 return -1; | 221 return -1; |
220 } | 222 } |
221 | 223 |
222 | 224 |
223 } // namespace internal | 225 } // namespace internal |
224 } // namespace v8 | 226 } // namespace v8 |
OLD | NEW |