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 276 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
287 } | 287 } |
288 return Smi::FromInt(n); | 288 return Smi::FromInt(n); |
289 } | 289 } |
290 | 290 |
291 | 291 |
292 class FrameInspector { | 292 class FrameInspector { |
293 public: | 293 public: |
294 FrameInspector(JavaScriptFrame* frame, int inlined_jsframe_index, | 294 FrameInspector(JavaScriptFrame* frame, int inlined_jsframe_index, |
295 Isolate* isolate) | 295 Isolate* isolate) |
296 : frame_(frame), deoptimized_frame_(NULL), isolate_(isolate) { | 296 : frame_(frame), deoptimized_frame_(NULL), isolate_(isolate) { |
| 297 has_adapted_arguments_ = frame_->has_adapted_arguments(); |
| 298 is_bottommost_ = inlined_jsframe_index == 0; |
| 299 is_optimized_ = frame_->is_optimized(); |
297 // Calculate the deoptimized frame. | 300 // Calculate the deoptimized frame. |
298 if (frame->is_optimized()) { | 301 if (frame->is_optimized()) { |
| 302 // TODO(turbofan): Revisit once we support deoptimization. |
| 303 if (frame->LookupCode()->is_turbofanned() && !FLAG_turbo_deoptimization) { |
| 304 is_optimized_ = false; |
| 305 return; |
| 306 } |
| 307 |
299 deoptimized_frame_ = Deoptimizer::DebuggerInspectableFrame( | 308 deoptimized_frame_ = Deoptimizer::DebuggerInspectableFrame( |
300 frame, inlined_jsframe_index, isolate); | 309 frame, inlined_jsframe_index, isolate); |
301 } | 310 } |
302 has_adapted_arguments_ = frame_->has_adapted_arguments(); | |
303 is_bottommost_ = inlined_jsframe_index == 0; | |
304 is_optimized_ = frame_->is_optimized(); | |
305 } | 311 } |
306 | 312 |
307 ~FrameInspector() { | 313 ~FrameInspector() { |
308 // Get rid of the calculated deoptimized frame if any. | 314 // Get rid of the calculated deoptimized frame if any. |
309 if (deoptimized_frame_ != NULL) { | 315 if (deoptimized_frame_ != NULL) { |
310 Deoptimizer::DeleteDebuggerInspectableFrame(deoptimized_frame_, isolate_); | 316 Deoptimizer::DeleteDebuggerInspectableFrame(deoptimized_frame_, isolate_); |
311 } | 317 } |
312 } | 318 } |
313 | 319 |
314 int GetParametersCount() { | 320 int GetParametersCount() { |
315 return is_optimized_ ? deoptimized_frame_->parameters_count() | 321 return is_optimized_ ? deoptimized_frame_->parameters_count() |
316 : frame_->ComputeParametersCount(); | 322 : frame_->ComputeParametersCount(); |
317 } | 323 } |
318 int expression_count() { return deoptimized_frame_->expression_count(); } | 324 int expression_count() { return deoptimized_frame_->expression_count(); } |
319 Object* GetFunction() { | 325 Object* GetFunction() { |
320 return is_optimized_ ? deoptimized_frame_->GetFunction() | 326 return is_optimized_ ? deoptimized_frame_->GetFunction() |
321 : frame_->function(); | 327 : frame_->function(); |
322 } | 328 } |
323 Object* GetParameter(int index) { | 329 Object* GetParameter(int index) { |
324 return is_optimized_ ? deoptimized_frame_->GetParameter(index) | 330 return is_optimized_ ? deoptimized_frame_->GetParameter(index) |
325 : frame_->GetParameter(index); | 331 : frame_->GetParameter(index); |
326 } | 332 } |
327 Object* GetExpression(int index) { | 333 Object* GetExpression(int index) { |
| 334 // TODO(turbofan): Revisit once we support deoptimization. |
| 335 if (frame_->LookupCode()->is_turbofanned() && !FLAG_turbo_deoptimization) { |
| 336 return isolate_->heap()->undefined_value(); |
| 337 } |
328 return is_optimized_ ? deoptimized_frame_->GetExpression(index) | 338 return is_optimized_ ? deoptimized_frame_->GetExpression(index) |
329 : frame_->GetExpression(index); | 339 : frame_->GetExpression(index); |
330 } | 340 } |
331 int GetSourcePosition() { | 341 int GetSourcePosition() { |
332 return is_optimized_ ? deoptimized_frame_->GetSourcePosition() | 342 return is_optimized_ ? deoptimized_frame_->GetSourcePosition() |
333 : frame_->LookupCode()->SourcePosition(frame_->pc()); | 343 : frame_->LookupCode()->SourcePosition(frame_->pc()); |
334 } | 344 } |
335 bool IsConstructor() { | 345 bool IsConstructor() { |
336 return is_optimized_ && !is_bottommost_ | 346 return is_optimized_ && !is_bottommost_ |
337 ? deoptimized_frame_->HasConstructStub() | 347 ? deoptimized_frame_->HasConstructStub() |
(...skipping 2471 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
2809 return Smi::FromInt(isolate->debug()->is_active()); | 2819 return Smi::FromInt(isolate->debug()->is_active()); |
2810 } | 2820 } |
2811 | 2821 |
2812 | 2822 |
2813 RUNTIME_FUNCTION(Runtime_DebugBreakInOptimizedCode) { | 2823 RUNTIME_FUNCTION(Runtime_DebugBreakInOptimizedCode) { |
2814 UNIMPLEMENTED(); | 2824 UNIMPLEMENTED(); |
2815 return NULL; | 2825 return NULL; |
2816 } | 2826 } |
2817 } | 2827 } |
2818 } // namespace v8::internal | 2828 } // namespace v8::internal |
OLD | NEW |