| OLD | NEW |
| 1 // Copyright 2012 the V8 project authors. All rights reserved. | 1 // Copyright 2012 the V8 project authors. All rights reserved. |
| 2 // Use of this source code is governed by a BSD-style license that can be | 2 // Use of this source code is governed by a BSD-style license that can be |
| 3 // found in the LICENSE file. | 3 // found in the LICENSE file. |
| 4 | 4 |
| 5 #include <stdlib.h> | 5 #include <stdlib.h> |
| 6 #include <limits> | 6 #include <limits> |
| 7 | 7 |
| 8 #include "src/v8.h" | 8 #include "src/v8.h" |
| 9 | 9 |
| 10 #include "src/accessors.h" | 10 #include "src/accessors.h" |
| (...skipping 3585 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 3596 char pattern, | 3596 char pattern, |
| 3597 ZoneList<int>* indices, | 3597 ZoneList<int>* indices, |
| 3598 unsigned int limit, | 3598 unsigned int limit, |
| 3599 Zone* zone) { | 3599 Zone* zone) { |
| 3600 ASSERT(limit > 0); | 3600 ASSERT(limit > 0); |
| 3601 // Collect indices of pattern in subject using memchr. | 3601 // Collect indices of pattern in subject using memchr. |
| 3602 // Stop after finding at most limit values. | 3602 // Stop after finding at most limit values. |
| 3603 const uint8_t* subject_start = subject.start(); | 3603 const uint8_t* subject_start = subject.start(); |
| 3604 const uint8_t* subject_end = subject_start + subject.length(); | 3604 const uint8_t* subject_end = subject_start + subject.length(); |
| 3605 const uint8_t* pos = subject_start; | 3605 const uint8_t* pos = subject_start; |
| 3606 while (limit > 0) { | 3606 while ((limit > 0) && (subject_end > pos)) { |
| 3607 pos = reinterpret_cast<const uint8_t*>( | 3607 pos = reinterpret_cast<const uint8_t*>( |
| 3608 memchr(pos, pattern, subject_end - pos)); | 3608 memchr(pos, pattern, subject_end - pos)); |
| 3609 if (pos == NULL) return; | 3609 if (pos == NULL) return; |
| 3610 indices->Add(static_cast<int>(pos - subject_start), zone); | 3610 indices->Add(static_cast<int>(pos - subject_start), zone); |
| 3611 pos++; | 3611 pos++; |
| 3612 limit--; | 3612 limit--; |
| 3613 } | 3613 } |
| 3614 } | 3614 } |
| 3615 | 3615 |
| 3616 | 3616 |
| (...skipping 11468 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 15085 } | 15085 } |
| 15086 return NULL; | 15086 return NULL; |
| 15087 } | 15087 } |
| 15088 | 15088 |
| 15089 | 15089 |
| 15090 const Runtime::Function* Runtime::FunctionForId(Runtime::FunctionId id) { | 15090 const Runtime::Function* Runtime::FunctionForId(Runtime::FunctionId id) { |
| 15091 return &(kIntrinsicFunctions[static_cast<int>(id)]); | 15091 return &(kIntrinsicFunctions[static_cast<int>(id)]); |
| 15092 } | 15092 } |
| 15093 | 15093 |
| 15094 } } // namespace v8::internal | 15094 } } // namespace v8::internal |
| OLD | NEW |