Chromium Code Reviews
chromiumcodereview-hr@appspot.gserviceaccount.com (chromiumcodereview-hr) | Please choose your nickname with Settings | Help | Chromium Project | Gerrit Changes | Sign out
(66)

Side by Side Diff: src/conversions.cc

Issue 385004: Remove sliced string string type... (Closed) Base URL: http://v8.googlecode.com/svn/branches/bleeding_edge/
Patch Set: Created 11 years, 1 month ago
Use n/p to move between diff chunks; N/P to move between comments. Draft comments are only viewable by you.
Jump to:
View unified diff | Download patch | Annotate | Revision Log
« no previous file with comments | « no previous file | src/factory.h » ('j') | no next file with comments »
Toggle Intra-line Diffs ('i') | Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
OLDNEW
1 // Copyright 2006-2008 the V8 project authors. All rights reserved. 1 // Copyright 2006-2008 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 107 matching lines...) Expand 10 before | Expand all | Expand 10 after
118 } 118 }
119 119
120 120
121 static inline bool SubStringEquals(String* str, int index, const char* other) { 121 static inline bool SubStringEquals(String* str, int index, const char* other) {
122 HandleScope scope; 122 HandleScope scope;
123 int str_length = str->length(); 123 int str_length = str->length();
124 int other_length = strlen(other); 124 int other_length = strlen(other);
125 int end = index + other_length < str_length ? 125 int end = index + other_length < str_length ?
126 index + other_length : 126 index + other_length :
127 str_length; 127 str_length;
128 Handle<String> slice = 128 Handle<String> substring =
129 Factory::NewStringSlice(Handle<String>(str), index, end); 129 Factory::NewSubString(Handle<String>(str), index, end);
130 return slice->IsEqualTo(Vector<const char>(other, other_length)); 130 return substring->IsEqualTo(Vector<const char>(other, other_length));
131 } 131 }
132 132
133 133
134 // Check if a string should be parsed as an octal number. The string 134 // Check if a string should be parsed as an octal number. The string
135 // can be either a char* or a String*. 135 // can be either a char* or a String*.
136 template<class S> 136 template<class S>
137 static bool ShouldParseOctal(S* s, int i) { 137 static bool ShouldParseOctal(S* s, int i) {
138 int index = i; 138 int index = i;
139 int len = GetLength(s); 139 int len = GetLength(s);
140 if (index < len && GetChar(s, index) != '0') return false; 140 if (index < len && GetChar(s, index) != '0') return false;
(...skipping 558 matching lines...) Expand 10 before | Expand all | Expand 10 after
699 // Allocate result and fill in the parts. 699 // Allocate result and fill in the parts.
700 StringBuilder builder(result_size + 1); 700 StringBuilder builder(result_size + 1);
701 builder.AddSubstring(integer_buffer + integer_pos + 1, integer_part_size); 701 builder.AddSubstring(integer_buffer + integer_pos + 1, integer_part_size);
702 if (decimal_pos > 0) builder.AddCharacter('.'); 702 if (decimal_pos > 0) builder.AddCharacter('.');
703 builder.AddSubstring(decimal_buffer, decimal_pos); 703 builder.AddSubstring(decimal_buffer, decimal_pos);
704 return builder.Finalize(); 704 return builder.Finalize();
705 } 705 }
706 706
707 707
708 } } // namespace v8::internal 708 } } // namespace v8::internal
OLDNEW
« no previous file with comments | « no previous file | src/factory.h » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698