| OLD | NEW | 
|---|
| 1 // Copyright 2006-2009 the V8 project authors. All rights reserved. | 1 // Copyright 2006-2009 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 9869 matching lines...) Expand 10 before | Expand all | Expand 10 after  Loading... | 
| 9880 // A testing entry. Returns statement position which is the closest to | 9880 // A testing entry. Returns statement position which is the closest to | 
| 9881 // source_position. | 9881 // source_position. | 
| 9882 static MaybeObject* Runtime_GetFunctionCodePositionFromSource(Arguments args) { | 9882 static MaybeObject* Runtime_GetFunctionCodePositionFromSource(Arguments args) { | 
| 9883   ASSERT(args.length() == 2); | 9883   ASSERT(args.length() == 2); | 
| 9884   HandleScope scope; | 9884   HandleScope scope; | 
| 9885   CONVERT_ARG_CHECKED(JSFunction, function, 0); | 9885   CONVERT_ARG_CHECKED(JSFunction, function, 0); | 
| 9886   CONVERT_NUMBER_CHECKED(int32_t, source_position, Int32, args[1]); | 9886   CONVERT_NUMBER_CHECKED(int32_t, source_position, Int32, args[1]); | 
| 9887 | 9887 | 
| 9888   Handle<Code> code(function->code()); | 9888   Handle<Code> code(function->code()); | 
| 9889 | 9889 | 
| 9890   RelocIterator it(*code, 1 << RelocInfo::STATEMENT_POSITION); | 9890   RelocIterator it(*code, RelocInfo::ModeMask(RelocInfo::STATEMENT_POSITION)); | 
| 9891   int closest_pc = 0; | 9891   int closest_pc = 0; | 
| 9892   int distance = kMaxInt; | 9892   int distance = kMaxInt; | 
| 9893   while (!it.done()) { | 9893   while (!it.done()) { | 
| 9894     int statement_position = static_cast<int>(it.rinfo()->data()); | 9894     int statement_position = static_cast<int>(it.rinfo()->data()); | 
| 9895     // Check if this break point is closer that what was previously found. | 9895     // Check if this break point is closer that what was previously found. | 
| 9896     if (source_position <= statement_position && | 9896     if (source_position <= statement_position && | 
| 9897         statement_position - source_position < distance) { | 9897         statement_position - source_position < distance) { | 
| 9898       closest_pc = | 9898       closest_pc = | 
| 9899           static_cast<int>(it.rinfo()->pc() - code->instruction_start()); | 9899           static_cast<int>(it.rinfo()->pc() - code->instruction_start()); | 
| 9900       distance = statement_position - source_position; | 9900       distance = statement_position - source_position; | 
| (...skipping 424 matching lines...) Expand 10 before | Expand all | Expand 10 after  Loading... | 
| 10325   } else { | 10325   } else { | 
| 10326     // Handle last resort GC and make sure to allow future allocations | 10326     // Handle last resort GC and make sure to allow future allocations | 
| 10327     // to grow the heap without causing GCs (if possible). | 10327     // to grow the heap without causing GCs (if possible). | 
| 10328     Counters::gc_last_resort_from_js.Increment(); | 10328     Counters::gc_last_resort_from_js.Increment(); | 
| 10329     Heap::CollectAllGarbage(false); | 10329     Heap::CollectAllGarbage(false); | 
| 10330   } | 10330   } | 
| 10331 } | 10331 } | 
| 10332 | 10332 | 
| 10333 | 10333 | 
| 10334 } }  // namespace v8::internal | 10334 } }  // namespace v8::internal | 
| OLD | NEW | 
|---|