OLD | NEW |
---|---|
1 // Copyright 2012 the V8 project authors. All rights reserved. | 1 // Copyright 2012 the V8 project authors. All rights reserved. |
2 // Redistribution and use in source and binary forms, with or without | 2 // Redistribution and use in source and binary forms, with or without |
3 // modification, are permitted provided that the following conditions are | 3 // modification, are permitted provided that the following conditions are |
4 // met: | 4 // met: |
5 // | 5 // |
6 // * Redistributions of source code must retain the above copyright | 6 // * Redistributions of source code must retain the above copyright |
7 // notice, this list of conditions and the following disclaimer. | 7 // notice, this list of conditions and the following disclaimer. |
8 // * Redistributions in binary form must reproduce the above | 8 // * Redistributions in binary form must reproduce the above |
9 // copyright notice, this list of conditions and the following | 9 // copyright notice, this list of conditions and the following |
10 // disclaimer in the documentation and/or other materials provided | 10 // disclaimer in the documentation and/or other materials provided |
(...skipping 11546 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... | |
11557 for (ScopeIterator it(isolate, frame, 0); | 11557 for (ScopeIterator it(isolate, frame, 0); |
11558 !it.Done(); | 11558 !it.Done(); |
11559 it.Next()) { | 11559 it.Next()) { |
11560 n++; | 11560 n++; |
11561 } | 11561 } |
11562 | 11562 |
11563 return Smi::FromInt(n); | 11563 return Smi::FromInt(n); |
11564 } | 11564 } |
11565 | 11565 |
11566 | 11566 |
11567 RUNTIME_FUNCTION(MaybeObject*, Runtime_GetStepInPositions) { | |
11568 HandleScope scope(isolate); | |
11569 ASSERT(args.length() == 2); | |
11570 | |
11571 // Check arguments. | |
11572 Object* check; | |
11573 { MaybeObject* maybe_check = Runtime_CheckExecutionState( | |
11574 RUNTIME_ARGUMENTS(isolate, args)); | |
11575 if (!maybe_check->ToObject(&check)) return maybe_check; | |
11576 } | |
11577 CONVERT_SMI_ARG_CHECKED(wrapped_id, 1); | |
11578 | |
11579 // Get the frame where the debugging is performed. | |
11580 StackFrame::Id id = UnwrapFrameId(wrapped_id); | |
11581 JavaScriptFrameIterator frame_it(isolate, id); | |
11582 JavaScriptFrame* frame = frame_it.frame(); | |
11583 | |
11584 Handle<SharedFunctionInfo> shared = | |
11585 Handle<SharedFunctionInfo>(JSFunction::cast(frame->function())->shared()); | |
11586 Handle<DebugInfo> debug_info = Debug::GetDebugInfo(shared); | |
11587 | |
11588 int len = 0; | |
11589 Handle<JSArray> array(isolate->factory()->NewJSArray(10)); | |
11590 // Find the break point where execution has stopped. | |
11591 BreakLocationIterator break_location_iterator(debug_info, | |
11592 ALL_BREAK_LOCATIONS); | |
11593 | |
11594 break_location_iterator.FindBreakLocationFromAddress(frame->pc()); | |
11595 int current_statement_pos = break_location_iterator.statement_position(); | |
11596 | |
11597 while (!break_location_iterator.Done()) { | |
11598 if (break_location_iterator.IsStepInLocation(isolate)) { | |
11599 Smi* position_value = Smi::FromInt(break_location_iterator.position()); | |
11600 JSObject::SetElement(array, len, | |
11601 Handle<Object>(position_value, isolate), | |
11602 NONE, kNonStrictMode); | |
11603 len++; | |
11604 } | |
11605 // Advance iterator. | |
11606 break_location_iterator.Next(); | |
11607 if (current_statement_pos != | |
11608 break_location_iterator.statement_position()) { | |
11609 break; | |
11610 } | |
11611 } | |
11612 return *array; | |
11613 } | |
Yang
2013/06/14 13:41:12
Am I understanding this correctly that you are loo
Peter.Rybin
2013/06/14 19:48:01
No, it's absolutely fine. The things is that in so
| |
11614 | |
11615 | |
11567 static const int kScopeDetailsTypeIndex = 0; | 11616 static const int kScopeDetailsTypeIndex = 0; |
11568 static const int kScopeDetailsObjectIndex = 1; | 11617 static const int kScopeDetailsObjectIndex = 1; |
11569 static const int kScopeDetailsSize = 2; | 11618 static const int kScopeDetailsSize = 2; |
11570 | 11619 |
11571 | 11620 |
11572 static MaybeObject* MaterializeScopeDetails(Isolate* isolate, | 11621 static MaybeObject* MaterializeScopeDetails(Isolate* isolate, |
11573 ScopeIterator* it) { | 11622 ScopeIterator* it) { |
11574 // Calculate the size of the result. | 11623 // Calculate the size of the result. |
11575 int details_size = kScopeDetailsSize; | 11624 int details_size = kScopeDetailsSize; |
11576 Handle<FixedArray> details = isolate->factory()->NewFixedArray(details_size); | 11625 Handle<FixedArray> details = isolate->factory()->NewFixedArray(details_size); |
(...skipping 2056 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... | |
13633 // Handle last resort GC and make sure to allow future allocations | 13682 // Handle last resort GC and make sure to allow future allocations |
13634 // to grow the heap without causing GCs (if possible). | 13683 // to grow the heap without causing GCs (if possible). |
13635 isolate->counters()->gc_last_resort_from_js()->Increment(); | 13684 isolate->counters()->gc_last_resort_from_js()->Increment(); |
13636 isolate->heap()->CollectAllGarbage(Heap::kNoGCFlags, | 13685 isolate->heap()->CollectAllGarbage(Heap::kNoGCFlags, |
13637 "Runtime::PerformGC"); | 13686 "Runtime::PerformGC"); |
13638 } | 13687 } |
13639 } | 13688 } |
13640 | 13689 |
13641 | 13690 |
13642 } } // namespace v8::internal | 13691 } } // namespace v8::internal |
OLD | NEW |