OLD | NEW |
1 // Copyright 2011 the V8 project authors. All rights reserved. | 1 // Copyright 2011 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 "src/messages.h" | 5 #include "src/messages.h" |
6 | 6 |
7 #include <memory> | 7 #include <memory> |
8 | 8 |
9 #include "src/api.h" | 9 #include "src/api.h" |
10 #include "src/execution.h" | 10 #include "src/execution.h" |
(...skipping 481 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
492 Handle<String> column_string = isolate->factory()->NumberToString( | 492 Handle<String> column_string = isolate->factory()->NumberToString( |
493 handle(Smi::FromInt(column_number), isolate), isolate); | 493 handle(Smi::FromInt(column_number), isolate), isolate); |
494 builder->AppendString(column_string); | 494 builder->AppendString(column_string); |
495 } | 495 } |
496 } | 496 } |
497 } | 497 } |
498 | 498 |
499 int StringIndexOf(Isolate* isolate, Handle<String> subject, | 499 int StringIndexOf(Isolate* isolate, Handle<String> subject, |
500 Handle<String> pattern) { | 500 Handle<String> pattern) { |
501 if (pattern->length() > subject->length()) return -1; | 501 if (pattern->length() > subject->length()) return -1; |
502 return String::IndexOf(isolate, subject, pattern, 0); | 502 Object* index = String::IndexOf(isolate, subject, pattern, |
| 503 isolate->factory()->undefined_value()); |
| 504 int index_int; |
| 505 if (index->ToInt32(&index_int)) return index_int; |
| 506 return -1; |
503 } | 507 } |
504 | 508 |
505 // Returns true iff | 509 // Returns true iff |
506 // 1. the subject ends with '.' + pattern, or | 510 // 1. the subject ends with '.' + pattern, or |
507 // 2. subject == pattern. | 511 // 2. subject == pattern. |
508 bool StringEndsWithMethodName(Isolate* isolate, Handle<String> subject, | 512 bool StringEndsWithMethodName(Isolate* isolate, Handle<String> subject, |
509 Handle<String> pattern) { | 513 Handle<String> pattern) { |
510 if (String::Equals(subject, pattern)) return true; | 514 if (String::Equals(subject, pattern)) return true; |
511 | 515 |
512 FlatStringReader subject_reader(isolate, String::Flatten(subject)); | 516 FlatStringReader subject_reader(isolate, String::Flatten(subject)); |
(...skipping 586 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
1099 DCHECK(mode != SKIP_UNTIL_SEEN); | 1103 DCHECK(mode != SKIP_UNTIL_SEEN); |
1100 | 1104 |
1101 Handle<Object> no_caller; | 1105 Handle<Object> no_caller; |
1102 Handle<String> msg = FormatMessage(isolate, template_index, arg0, arg1, arg2); | 1106 Handle<String> msg = FormatMessage(isolate, template_index, arg0, arg1, arg2); |
1103 return ErrorUtils::Construct(isolate, constructor, constructor, msg, mode, | 1107 return ErrorUtils::Construct(isolate, constructor, constructor, msg, mode, |
1104 no_caller, false); | 1108 no_caller, false); |
1105 } | 1109 } |
1106 | 1110 |
1107 } // namespace internal | 1111 } // namespace internal |
1108 } // namespace v8 | 1112 } // namespace v8 |
OLD | NEW |