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 2597 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
2608 | 2608 |
2609 int String::WriteAscii(char* buffer, int start, int length) const { | 2609 int String::WriteAscii(char* buffer, int start, int length) const { |
2610 if (IsDeadCheck("v8::String::WriteAscii()")) return 0; | 2610 if (IsDeadCheck("v8::String::WriteAscii()")) return 0; |
2611 LOG_API("String::WriteAscii"); | 2611 LOG_API("String::WriteAscii"); |
2612 ENTER_V8; | 2612 ENTER_V8; |
2613 ASSERT(start >= 0 && length >= -1); | 2613 ASSERT(start >= 0 && length >= -1); |
2614 i::Handle<i::String> str = Utils::OpenHandle(this); | 2614 i::Handle<i::String> str = Utils::OpenHandle(this); |
2615 StringTracker::RecordWrite(str); | 2615 StringTracker::RecordWrite(str); |
2616 // Flatten the string for efficiency. This applies whether we are | 2616 // Flatten the string for efficiency. This applies whether we are |
2617 // using StringInputBuffer or Get(i) to access the characters. | 2617 // using StringInputBuffer or Get(i) to access the characters. |
2618 str->TryFlattenIfNotFlat(); | 2618 str->TryFlatten(); |
2619 int end = length; | 2619 int end = length; |
2620 if ( (length == -1) || (length > str->length() - start) ) | 2620 if ( (length == -1) || (length > str->length() - start) ) |
2621 end = str->length() - start; | 2621 end = str->length() - start; |
2622 if (end < 0) return 0; | 2622 if (end < 0) return 0; |
2623 write_input_buffer.Reset(start, *str); | 2623 write_input_buffer.Reset(start, *str); |
2624 int i; | 2624 int i; |
2625 for (i = 0; i < end; i++) { | 2625 for (i = 0; i < end; i++) { |
2626 char c = static_cast<char>(write_input_buffer.GetNext()); | 2626 char c = static_cast<char>(write_input_buffer.GetNext()); |
2627 if (c == '\0') c = ' '; | 2627 if (c == '\0') c = ' '; |
2628 buffer[i] = c; | 2628 buffer[i] = c; |
(...skipping 1315 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
3944 | 3944 |
3945 | 3945 |
3946 char* HandleScopeImplementer::Iterate(ObjectVisitor* v, char* storage) { | 3946 char* HandleScopeImplementer::Iterate(ObjectVisitor* v, char* storage) { |
3947 HandleScopeImplementer* thread_local = | 3947 HandleScopeImplementer* thread_local = |
3948 reinterpret_cast<HandleScopeImplementer*>(storage); | 3948 reinterpret_cast<HandleScopeImplementer*>(storage); |
3949 thread_local->IterateThis(v); | 3949 thread_local->IterateThis(v); |
3950 return storage + ArchiveSpacePerThread(); | 3950 return storage + ArchiveSpacePerThread(); |
3951 } | 3951 } |
3952 | 3952 |
3953 } } // namespace v8::internal | 3953 } } // namespace v8::internal |
OLD | NEW |