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