Changeset 35245 in webkit for trunk/JavaScriptCore/VM/CodeBlock.cpp
- Timestamp:
- Jul 18, 2008, 6:44:24 PM (17 years ago)
- File:
-
- 1 edited
Legend:
- Unmodified
- Added
- Removed
-
trunk/JavaScriptCore/VM/CodeBlock.cpp
r35231 r35245 655 655 int CodeBlock::lineNumberForVPC(const Instruction* vPC) 656 656 { 657 ASSERT(lineInfo.size()); 657 658 unsigned instructionOffset = vPC - instructions.begin(); 658 659 ASSERT(instructionOffset < instructions.size()); … … 670 671 high = mid; 671 672 } 672 673 673 return lineInfo[low - 1].lineNumber; 674 674 } 675 675 676 int CodeBlock::expressionRangeForVPC(const Instruction* vPC, int& divot, int& startOffset, int& endOffset) 677 { 678 unsigned instructionOffset = vPC - instructions.begin(); 679 ASSERT(instructionOffset < instructions.size()); 680 681 if (!expressionInfo.size()) { 682 // We didn't think anything could throw. Apparently we were wrong. 683 startOffset = 0; 684 endOffset = 0; 685 divot = 0; 686 return lineNumberForVPC(vPC); 687 } 688 689 int low = 0; 690 int high = expressionInfo.size(); 691 while (low < high) { 692 int mid = low + (high - low) / 2; 693 if (expressionInfo[mid].instructionOffset <= instructionOffset) 694 low = mid + 1; 695 else 696 high = mid; 697 } 698 699 ASSERT(low); 700 if (!low) { 701 startOffset = 0; 702 endOffset = 0; 703 divot = 0; 704 return lineNumberForVPC(vPC); 705 } 706 707 startOffset = expressionInfo[low - 1].startOffset; 708 endOffset = expressionInfo[low - 1].endOffset; 709 divot = expressionInfo[low - 1].divotPoint + sourceOffset; 710 return lineNumberForVPC(vPC); 711 } 712 676 713 } // namespace KJS
Note:
See TracChangeset
for help on using the changeset viewer.