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

Unified Diff: src/runtime.cc

Issue 147443008: Revert "Fix inconsistencies wrt whitespaces." (Closed) Base URL: https://v8.googlecode.com/svn/branches/bleeding_edge
Patch Set: Created 6 years, 10 months 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 side-by-side diff with in-line comments
Download patch
« no previous file with comments | « src/jsregexp.cc ('k') | src/scanner.h » ('j') | no next file with comments »
Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
Index: src/runtime.cc
diff --git a/src/runtime.cc b/src/runtime.cc
index 05de32d60949a941b68c75a4044ed2a59858ab5a..3596add429ee9335994c525ad946be41648d6842 100644
--- a/src/runtime.cc
+++ b/src/runtime.cc
@@ -6105,10 +6105,8 @@ RUNTIME_FUNCTION(MaybeObject*, Runtime_StringToNumber) {
// Fast check for a junk value. A valid string may start from a
// whitespace, a sign ('+' or '-'), the decimal point, a decimal digit or
// the 'I' character ('Infinity'). All of that have codes not greater than
- // '9' except 'I', NBSP and NEL.
- if (data[start_pos] != 'I' &&
- data[start_pos] != 0xa0 &&
- data[start_pos] != 0x85) {
+ // '9' except 'I' and  .
+ if (data[start_pos] != 'I' && data[start_pos] != 0xa0) {
return isolate->heap()->nan_value();
}
} else if (len - start_pos < 10 && AreDigits(data, start_pos, len)) {
@@ -6543,6 +6541,11 @@ RUNTIME_FUNCTION(MaybeObject*, Runtime_StringToUpperCase) {
}
+static inline bool IsTrimWhiteSpace(unibrow::uchar c) {
+ return unibrow::WhiteSpace::Is(c) || c == 0x200b || c == 0xfeff;
+}
+
+
RUNTIME_FUNCTION(MaybeObject*, Runtime_StringTrim) {
HandleScope scope(isolate);
ASSERT(args.length() == 3);
@@ -6555,17 +6558,15 @@ RUNTIME_FUNCTION(MaybeObject*, Runtime_StringTrim) {
int length = string->length();
int left = 0;
- UnicodeCache* unicode_cache = isolate->unicode_cache();
if (trimLeft) {
- while (left < length && unicode_cache->IsWhiteSpace(string->Get(left))) {
+ while (left < length && IsTrimWhiteSpace(string->Get(left))) {
left++;
}
}
int right = length;
if (trimRight) {
- while (right > left &&
- unicode_cache->IsWhiteSpace(string->Get(right - 1))) {
+ while (right > left && IsTrimWhiteSpace(string->Get(right - 1))) {
right--;
}
}
« no previous file with comments | « src/jsregexp.cc ('k') | src/scanner.h » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698