Commit 5fd2af24 authored by Toon Verwaest's avatar Toon Verwaest Committed by Commit Bot

[asmjs] Use char predicates to scan asm.js rather than manually compare

Change-Id: I142735622cb741fa8d84ec1036febb720a467363
Reviewed-on: https://chromium-review.googlesource.com/1109918Reviewed-by: 's avatarBen Titzer <titzer@chromium.org>
Commit-Queue: Toon Verwaest <verwaest@chromium.org>
Cr-Commit-Position: refs/heads/master@{#53928}
parent 41f1952c
...@@ -4,6 +4,7 @@ ...@@ -4,6 +4,7 @@
#include "src/asmjs/asm-scanner.h" #include "src/asmjs/asm-scanner.h"
#include "src/char-predicates-inl.h"
#include "src/conversions.h" #include "src/conversions.h"
#include "src/flags.h" #include "src/flags.h"
#include "src/parsing/scanner.h" #include "src/parsing/scanner.h"
...@@ -413,16 +414,13 @@ void AsmJsScanner::ConsumeCompareOrShift(uc32 ch) { ...@@ -413,16 +414,13 @@ void AsmJsScanner::ConsumeCompareOrShift(uc32 ch) {
} }
bool AsmJsScanner::IsIdentifierStart(uc32 ch) { bool AsmJsScanner::IsIdentifierStart(uc32 ch) {
return (ch >= 'A' && ch <= 'Z') || (ch >= 'a' && ch <= 'z') || ch == '_' || return IsInRange(AsciiAlphaToLower(ch), 'a', 'z') || ch == '_' || ch == '$';
ch == '$';
} }
bool AsmJsScanner::IsIdentifierPart(uc32 ch) { bool AsmJsScanner::IsIdentifierPart(uc32 ch) { return IsAsciiIdentifier(ch); }
return IsIdentifierStart(ch) || (ch >= '0' && ch <= '9');
}
bool AsmJsScanner::IsNumberStart(uc32 ch) { bool AsmJsScanner::IsNumberStart(uc32 ch) {
return ch == '.' || (ch >= '0' && ch <= '9'); return ch == '.' || IsDecimalDigit(ch);
} }
} // namespace internal } // namespace internal
......
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment