OLD | NEW |
1 // Copyright 2009 the V8 project authors. All rights reserved. | 1 // Copyright 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 471 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
482 // Convert code position into line number. | 482 // Convert code position into line number. |
483 int GetScriptLineNumber(Handle<Script> script, int code_pos) { | 483 int GetScriptLineNumber(Handle<Script> script, int code_pos) { |
484 InitScriptLineEnds(script); | 484 InitScriptLineEnds(script); |
485 AssertNoAllocation no_allocation; | 485 AssertNoAllocation no_allocation; |
486 FixedArray* line_ends_array = FixedArray::cast(script->line_ends()); | 486 FixedArray* line_ends_array = FixedArray::cast(script->line_ends()); |
487 const int line_ends_len = line_ends_array->length(); | 487 const int line_ends_len = line_ends_array->length(); |
488 | 488 |
489 if (!line_ends_len) | 489 if (!line_ends_len) |
490 return -1; | 490 return -1; |
491 | 491 |
492 if ((Smi::cast(line_ends_array->get(0)))->value() > code_pos) | 492 if ((Smi::cast(line_ends_array->get(0)))->value() >= code_pos) |
493 return script->line_offset()->value(); | 493 return script->line_offset()->value(); |
494 | 494 |
495 int left = 0; | 495 int left = 0; |
496 int right = line_ends_len; | 496 int right = line_ends_len; |
497 while (int half = (right - left) / 2) { | 497 while (int half = (right - left) / 2) { |
498 if ((Smi::cast(line_ends_array->get(left + half)))->value() > code_pos) { | 498 if ((Smi::cast(line_ends_array->get(left + half)))->value() > code_pos) { |
499 right -= half; | 499 right -= half; |
500 } else { | 500 } else { |
501 left += half; | 501 left += half; |
502 } | 502 } |
(...skipping 325 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
828 Handle<Map> new_map = Factory::CopyMapDropTransitions(old_map); | 828 Handle<Map> new_map = Factory::CopyMapDropTransitions(old_map); |
829 obj->set_map(*new_map); | 829 obj->set_map(*new_map); |
830 new_map->set_needs_loading(true); | 830 new_map->set_needs_loading(true); |
831 // Store the lazy loading info in the constructor field. We'll | 831 // Store the lazy loading info in the constructor field. We'll |
832 // reestablish the constructor from the fixed array after loading. | 832 // reestablish the constructor from the fixed array after loading. |
833 new_map->set_constructor(*arr); | 833 new_map->set_constructor(*arr); |
834 ASSERT(!obj->IsLoaded()); | 834 ASSERT(!obj->IsLoaded()); |
835 } | 835 } |
836 | 836 |
837 } } // namespace v8::internal | 837 } } // namespace v8::internal |
OLD | NEW |