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

Unified Diff: src/scanner.cc

Issue 198713002: move remaining uses of scanner literals into scanner (Closed) Base URL: https://v8.googlecode.com/svn/branches/bleeding_edge
Patch Set: Created 6 years, 9 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/scanner.h ('k') | test/cctest/test-parsing.cc » ('j') | no next file with comments »
Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
Index: src/scanner.cc
diff --git a/src/scanner.cc b/src/scanner.cc
index 45e0cae876865c1ad274bea312a3bca9c9b5659a..a48be2989a93cade754a797fad648b79cf00dcd4 100644
--- a/src/scanner.cc
+++ b/src/scanner.cc
@@ -36,6 +36,7 @@
#include "conversions-inl.h"
#include "list-inl.h"
#include "v8.h"
+#include "parser.h"
namespace v8 {
namespace internal {
@@ -1115,18 +1116,6 @@ bool Scanner::ScanRegExpFlags() {
}
-Handle<String> Scanner::AllocateLiteralString(Isolate* isolate,
- PretenureFlag tenured) {
- if (is_literal_one_byte()) {
- return isolate->factory()->NewStringFromOneByte(
- Vector<const uint8_t>::cast(literal_one_byte_string()), tenured);
- } else {
- return isolate->factory()->NewStringFromTwoByte(
- literal_utf16_string(), tenured);
- }
-}
-
-
Handle<String> Scanner::AllocateNextLiteralString(Isolate* isolate,
PretenureFlag tenured) {
if (is_next_literal_one_byte()) {
@@ -1158,6 +1147,28 @@ double Scanner::DoubleValue() {
}
+int Scanner::FindNumber(DuplicateFinder* finder, int value) {
+ return finder->AddNumber(literal_one_byte_string(), value);
+}
+
+
+int Scanner::FindSymbol(DuplicateFinder* finder, int value) {
+ if (is_literal_one_byte()) {
+ return finder->AddAsciiSymbol(literal_one_byte_string(), value);
+ }
+ return finder->AddUtf16Symbol(literal_utf16_string(), value);
+}
+
+
+void Scanner::LogSymbol(ParserRecorder* log, int position) {
+ if (is_literal_one_byte()) {
+ log->LogAsciiSymbol(position, literal_one_byte_string());
+ } else {
+ log->LogUtf16Symbol(position, literal_utf16_string());
+ }
+}
+
+
int DuplicateFinder::AddAsciiSymbol(Vector<const char> key, int value) {
return AddSymbol(Vector<const byte>::cast(key), true, value);
}
« no previous file with comments | « src/scanner.h ('k') | test/cctest/test-parsing.cc » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698