| 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 505 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 516 if ((Smi::cast(line_ends_array->get(left + half)))->value() > code_pos) { | 516 if ((Smi::cast(line_ends_array->get(left + half)))->value() > code_pos) { |
| 517 right -= half; | 517 right -= half; |
| 518 } else { | 518 } else { |
| 519 left += half; | 519 left += half; |
| 520 } | 520 } |
| 521 } | 521 } |
| 522 return right + script->line_offset()->value(); | 522 return right + script->line_offset()->value(); |
| 523 } | 523 } |
| 524 | 524 |
| 525 | 525 |
| 526 int GetScriptLineNumberSafe(Handle<Script> script, int code_pos) { |
| 527 AssertNoAllocation no_allocation; |
| 528 if (!script->line_ends()->IsUndefined()) { |
| 529 return GetScriptLineNumber(script, code_pos); |
| 530 } |
| 531 // Slow mode: we do not have line_ends. We have to iterate through source. |
| 532 if (!script->source()->IsString()) { |
| 533 return -1; |
| 534 } |
| 535 String* source = String::cast(script->source()); |
| 536 int line = 0; |
| 537 int len = source->length(); |
| 538 for (int pos = 0; pos < len; pos++) { |
| 539 if (pos == code_pos) { |
| 540 break; |
| 541 } |
| 542 if (source->Get(pos) == '\n') { |
| 543 line++; |
| 544 } |
| 545 } |
| 546 return line; |
| 547 } |
| 548 |
| 549 |
| 526 void CustomArguments::IterateInstance(ObjectVisitor* v) { | 550 void CustomArguments::IterateInstance(ObjectVisitor* v) { |
| 527 v->VisitPointers(values_, values_ + 4); | 551 v->VisitPointers(values_, values_ + 4); |
| 528 } | 552 } |
| 529 | 553 |
| 530 | 554 |
| 531 // Compute the property keys from the interceptor. | 555 // Compute the property keys from the interceptor. |
| 532 v8::Handle<v8::Array> GetKeysForNamedInterceptor(Handle<JSObject> receiver, | 556 v8::Handle<v8::Array> GetKeysForNamedInterceptor(Handle<JSObject> receiver, |
| 533 Handle<JSObject> object) { | 557 Handle<JSObject> object) { |
| 534 Handle<InterceptorInfo> interceptor(object->GetNamedInterceptor()); | 558 Handle<InterceptorInfo> interceptor(object->GetNamedInterceptor()); |
| 535 CustomArguments args(interceptor->data(), *receiver, *object); | 559 CustomArguments args(interceptor->data(), *receiver, *object); |
| (...skipping 227 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 763 | 787 |
| 764 OptimizedObjectForAddingMultipleProperties:: | 788 OptimizedObjectForAddingMultipleProperties:: |
| 765 ~OptimizedObjectForAddingMultipleProperties() { | 789 ~OptimizedObjectForAddingMultipleProperties() { |
| 766 // Reoptimize the object to allow fast property access. | 790 // Reoptimize the object to allow fast property access. |
| 767 if (has_been_transformed_) { | 791 if (has_been_transformed_) { |
| 768 TransformToFastProperties(object_, unused_property_fields_); | 792 TransformToFastProperties(object_, unused_property_fields_); |
| 769 } | 793 } |
| 770 } | 794 } |
| 771 | 795 |
| 772 } } // namespace v8::internal | 796 } } // namespace v8::internal |
| OLD | NEW |