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 9369 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
9380 // Find position within function. The script position might be before the | 9380 // Find position within function. The script position might be before the |
9381 // source position of the first function. | 9381 // source position of the first function. |
9382 int position; | 9382 int position; |
9383 if (shared->start_position() > source_position) { | 9383 if (shared->start_position() > source_position) { |
9384 position = 0; | 9384 position = 0; |
9385 } else { | 9385 } else { |
9386 position = source_position - shared->start_position(); | 9386 position = source_position - shared->start_position(); |
9387 } | 9387 } |
9388 Debug::SetBreakPoint(shared, break_point_object_arg, &position); | 9388 Debug::SetBreakPoint(shared, break_point_object_arg, &position); |
9389 position += shared->start_position(); | 9389 position += shared->start_position(); |
9390 | |
9391 // The result position may become beyond script source end. | |
9392 // This is expected when the function is toplevel. This may become | |
9393 // a problem later when actual position gets converted into line/column. | |
9394 if (shared->is_toplevel() && position == shared->end_position()) { | |
9395 position = shared->end_position() - 1; | |
9396 } | |
9397 return Smi::FromInt(position); | 9390 return Smi::FromInt(position); |
9398 } | 9391 } |
9399 return Heap::undefined_value(); | 9392 return Heap::undefined_value(); |
9400 } | 9393 } |
9401 | 9394 |
9402 | 9395 |
9403 // Clear a break point | 9396 // Clear a break point |
9404 // args[0]: number: break point object | 9397 // args[0]: number: break point object |
9405 static Object* Runtime_ClearBreakPoint(Arguments args) { | 9398 static Object* Runtime_ClearBreakPoint(Arguments args) { |
9406 HandleScope scope; | 9399 HandleScope scope; |
(...skipping 1189 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
10596 } else { | 10589 } else { |
10597 // Handle last resort GC and make sure to allow future allocations | 10590 // Handle last resort GC and make sure to allow future allocations |
10598 // to grow the heap without causing GCs (if possible). | 10591 // to grow the heap without causing GCs (if possible). |
10599 Counters::gc_last_resort_from_js.Increment(); | 10592 Counters::gc_last_resort_from_js.Increment(); |
10600 Heap::CollectAllGarbage(false); | 10593 Heap::CollectAllGarbage(false); |
10601 } | 10594 } |
10602 } | 10595 } |
10603 | 10596 |
10604 | 10597 |
10605 } } // namespace v8::internal | 10598 } } // namespace v8::internal |
OLD | NEW |