OLD | NEW |
1 // Copyright 2010 the V8 project authors. All rights reserved. | 1 // Copyright 2010 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 4496 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
4507 reinterpret_cast<const uc16*>(ext->resource()->data()); | 4507 reinterpret_cast<const uc16*>(ext->resource()->data()); |
4508 return Vector<const uc16>(start + offset, length); | 4508 return Vector<const uc16>(start + offset, length); |
4509 } | 4509 } |
4510 | 4510 |
4511 | 4511 |
4512 SmartPointer<char> String::ToCString(AllowNullsFlag allow_nulls, | 4512 SmartPointer<char> String::ToCString(AllowNullsFlag allow_nulls, |
4513 RobustnessFlag robust_flag, | 4513 RobustnessFlag robust_flag, |
4514 int offset, | 4514 int offset, |
4515 int length, | 4515 int length, |
4516 int* length_return) { | 4516 int* length_return) { |
4517 ASSERT(NativeAllocationChecker::allocation_allowed()); | |
4518 if (robust_flag == ROBUST_STRING_TRAVERSAL && !LooksValid()) { | 4517 if (robust_flag == ROBUST_STRING_TRAVERSAL && !LooksValid()) { |
4519 return SmartPointer<char>(NULL); | 4518 return SmartPointer<char>(NULL); |
4520 } | 4519 } |
4521 Heap* heap = GetHeap(); | 4520 Heap* heap = GetHeap(); |
4522 | 4521 |
4523 // Negative length means the to the end of the string. | 4522 // Negative length means the to the end of the string. |
4524 if (length < 0) length = kMaxInt - offset; | 4523 if (length < 0) length = kMaxInt - offset; |
4525 | 4524 |
4526 // Compute the size of the UTF-8 string. Start at the specified offset. | 4525 // Compute the size of the UTF-8 string. Start at the specified offset. |
4527 Access<StringInputBuffer> buffer( | 4526 Access<StringInputBuffer> buffer( |
(...skipping 59 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
4587 case kConsStringTag: | 4586 case kConsStringTag: |
4588 UNREACHABLE(); | 4587 UNREACHABLE(); |
4589 return NULL; | 4588 return NULL; |
4590 } | 4589 } |
4591 UNREACHABLE(); | 4590 UNREACHABLE(); |
4592 return NULL; | 4591 return NULL; |
4593 } | 4592 } |
4594 | 4593 |
4595 | 4594 |
4596 SmartPointer<uc16> String::ToWideCString(RobustnessFlag robust_flag) { | 4595 SmartPointer<uc16> String::ToWideCString(RobustnessFlag robust_flag) { |
4597 ASSERT(NativeAllocationChecker::allocation_allowed()); | |
4598 if (robust_flag == ROBUST_STRING_TRAVERSAL && !LooksValid()) { | 4596 if (robust_flag == ROBUST_STRING_TRAVERSAL && !LooksValid()) { |
4599 return SmartPointer<uc16>(); | 4597 return SmartPointer<uc16>(); |
4600 } | 4598 } |
4601 Heap* heap = GetHeap(); | 4599 Heap* heap = GetHeap(); |
4602 | 4600 |
4603 Access<StringInputBuffer> buffer( | 4601 Access<StringInputBuffer> buffer( |
4604 heap->isolate()->objects_string_input_buffer()); | 4602 heap->isolate()->objects_string_input_buffer()); |
4605 buffer->Reset(this); | 4603 buffer->Reset(this); |
4606 | 4604 |
4607 uc16* result = NewArray<uc16>(length() + 1); | 4605 uc16* result = NewArray<uc16>(length() + 1); |
(...skipping 5648 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
10256 if (break_point_objects()->IsUndefined()) return 0; | 10254 if (break_point_objects()->IsUndefined()) return 0; |
10257 // Single beak point. | 10255 // Single beak point. |
10258 if (!break_point_objects()->IsFixedArray()) return 1; | 10256 if (!break_point_objects()->IsFixedArray()) return 1; |
10259 // Multiple break points. | 10257 // Multiple break points. |
10260 return FixedArray::cast(break_point_objects())->length(); | 10258 return FixedArray::cast(break_point_objects())->length(); |
10261 } | 10259 } |
10262 #endif | 10260 #endif |
10263 | 10261 |
10264 | 10262 |
10265 } } // namespace v8::internal | 10263 } } // namespace v8::internal |
OLD | NEW |