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 9324 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
9335 // Find position within function. The script position might be before the | 9335 // Find position within function. The script position might be before the |
9336 // source position of the first function. | 9336 // source position of the first function. |
9337 int position; | 9337 int position; |
9338 if (shared->start_position() > source_position) { | 9338 if (shared->start_position() > source_position) { |
9339 position = 0; | 9339 position = 0; |
9340 } else { | 9340 } else { |
9341 position = source_position - shared->start_position(); | 9341 position = source_position - shared->start_position(); |
9342 } | 9342 } |
9343 Debug::SetBreakPoint(shared, break_point_object_arg, &position); | 9343 Debug::SetBreakPoint(shared, break_point_object_arg, &position); |
9344 position += shared->start_position(); | 9344 position += shared->start_position(); |
| 9345 |
| 9346 // The result position may become beyond script source end. |
| 9347 // This is expected when the function is toplevel. This may become |
| 9348 // a problem later when actual position gets converted into line/column. |
| 9349 if (shared->is_toplevel() && position == shared->end_position()) { |
| 9350 position = shared->end_position() - 1; |
| 9351 } |
9345 return Smi::FromInt(position); | 9352 return Smi::FromInt(position); |
9346 } | 9353 } |
9347 return Heap::undefined_value(); | 9354 return Heap::undefined_value(); |
9348 } | 9355 } |
9349 | 9356 |
9350 | 9357 |
9351 // Clear a break point | 9358 // Clear a break point |
9352 // args[0]: number: break point object | 9359 // args[0]: number: break point object |
9353 static Object* Runtime_ClearBreakPoint(Arguments args) { | 9360 static Object* Runtime_ClearBreakPoint(Arguments args) { |
9354 HandleScope scope; | 9361 HandleScope scope; |
(...skipping 1189 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
10544 } else { | 10551 } else { |
10545 // Handle last resort GC and make sure to allow future allocations | 10552 // Handle last resort GC and make sure to allow future allocations |
10546 // to grow the heap without causing GCs (if possible). | 10553 // to grow the heap without causing GCs (if possible). |
10547 Counters::gc_last_resort_from_js.Increment(); | 10554 Counters::gc_last_resort_from_js.Increment(); |
10548 Heap::CollectAllGarbage(false); | 10555 Heap::CollectAllGarbage(false); |
10549 } | 10556 } |
10550 } | 10557 } |
10551 | 10558 |
10552 | 10559 |
10553 } } // namespace v8::internal | 10560 } } // namespace v8::internal |
OLD | NEW |