Revision: 19952
Author: [email protected]
Date: Fri Mar 14 20:56:01 2014 UTC
Log: Experimental parser: fix generated lexer build after merge
[email protected]
BUG=
Review URL: https://codereview.chromium.org/200323005
http://code.google.com/p/v8/source/detail?r=19952
Modified:
/branches/experimental/parser/src/lexer/lexer.cc
/branches/experimental/parser/src/lexer/lexer.h
=======================================
--- /branches/experimental/parser/src/lexer/lexer.cc Fri Mar 14 20:36:21
2014 UTC
+++ /branches/experimental/parser/src/lexer/lexer.cc Fri Mar 14 20:56:01
2014 UTC
@@ -29,6 +29,7 @@
#include "lexer.h"
#include "char-predicates-inl.h"
#include "scanner-character-streams.h"
+#include "parser.h"
namespace v8 {
namespace internal {
@@ -524,6 +525,59 @@
two_byte_string_ = buffer.two_byte_literal();
}
}
+
+
+Handle<String> LexerBase::AllocateNextLiteralString(Isolate* isolate,
+ PretenureFlag tenured) {
+ if (is_next_literal_one_byte()) {
+ return isolate->factory()->NewStringFromOneByte(
+ Vector<const uint8_t>::cast(next_literal_one_byte_string()),
tenured);
+ } else {
+ return isolate->factory()->NewStringFromTwoByte(
+ next_literal_two_byte_string(), tenured);
+ }
+}
+
+
+Handle<String> LexerBase::AllocateInternalizedString(Isolate* isolate) {
+ if (is_literal_one_byte()) {
+ return isolate->factory()->InternalizeOneByteString(
+ literal_one_byte_string());
+ } else {
+ return isolate->factory()->InternalizeTwoByteString(
+ literal_two_byte_string());
+ }
+}
+
+
+double LexerBase::DoubleValue() {
+ ASSERT(is_literal_one_byte());
+ return StringToDouble(
+ unicode_cache_, Vector<const char>::cast(literal_one_byte_string()),
+ ALLOW_HEX | ALLOW_OCTAL | ALLOW_IMPLICIT_OCTAL | ALLOW_BINARY);
+}
+
+
+int LexerBase::FindNumber(DuplicateFinder* finder, int value) {
+ return finder->AddNumber(literal_one_byte_string(), value);
+}
+
+
+int LexerBase::FindSymbol(DuplicateFinder* finder, int value) {
+ if (is_literal_one_byte()) {
+ return finder->AddOneByteSymbol(literal_one_byte_string(), value);
+ }
+ return finder->AddTwoByteSymbol(literal_two_byte_string(), value);
+}
+
+
+void LexerBase::LogSymbol(ParserRecorder* log, int position) {
+ if (is_literal_one_byte()) {
+ log->LogOneByteSymbol(position, literal_one_byte_string());
+ } else {
+ log->LogTwoByteSymbol(position, literal_two_byte_string());
+ }
+}
static inline bool IsOneByte(const uint8_t* cursor, const uint8_t* end) {
=======================================
--- /branches/experimental/parser/src/lexer/lexer.h Wed Mar 5 14:15:39
2014 UTC
+++ /branches/experimental/parser/src/lexer/lexer.h Fri Mar 14 20:56:01
2014 UTC
@@ -172,6 +172,37 @@
return literal.length() == keyword.length() &&
(memcmp(literal.start(), keyword.start(), literal.length()) == 0);
}
+
+ Handle<String> AllocateNextLiteralString(Isolate* isolate,
+ PretenureFlag tenured);
+ Handle<String> AllocateInternalizedString(Isolate* isolate);
+
+ double DoubleValue();
+ bool UnescapedLiteralMatches(const char* data, int length) {
+ if (is_literal_one_byte() &&
+ literal_length() == length &&
+ !literal_contains_escapes()) {
+ const char* token =
+ reinterpret_cast<const char*>(literal_one_byte_string().start());
+ return !strncmp(token, data, length);
+ }
+ return false;
+ }
+ void IsGetOrSet(bool* is_get, bool* is_set) {
+ if (is_literal_one_byte() &&
+ literal_length() == 3 &&
+ !literal_contains_escapes()) {
+ const char* token =
+ reinterpret_cast<const char*>(literal_one_byte_string().start());
+ *is_get = strncmp(token, "get", 3) == 0;
+ *is_set = !*is_get && strncmp(token, "set", 3) == 0;
+ }
+ }
+
+ int FindNumber(DuplicateFinder* finder, int value);
+ int FindSymbol(DuplicateFinder* finder, int value);
+
+ void LogSymbol(ParserRecorder* log, int position);
bool HarmonyScoping() const {
return harmony_scoping_;
@@ -426,22 +457,6 @@
inline bool HasAnyLineTerminatorBeforeNext() const {
return lexer_->HasAnyLineTerminatorBeforeNext();
}
-
- inline Vector<const char> literal_ascii_string() {
- return Vector<const char>::cast(lexer_->literal_one_byte_string());
- }
-
- inline Vector<const uc16> literal_utf16_string() {
- return lexer_->literal_two_byte_string();
- }
-
- inline int literal_length() {
- return lexer_->literal_length();
- }
-
- inline bool is_literal_ascii() {
- return lexer_->is_literal_one_byte();
- }
inline bool is_literal_contextual_keyword(
Vector<const char>& keyword) { // NOLINT
@@ -453,26 +468,37 @@
return lexer_->literal_contains_escapes();
}
- inline Vector<const char> next_literal_ascii_string() {
- return Vector<const
char>::cast(lexer_->next_literal_one_byte_string());
+ inline bool is_next_contextual_keyword(
+ Vector<const char>& keyword) { // NOLINT
+ return lexer_->is_next_contextual_keyword(
+ Vector<const uint8_t>::cast(keyword));
}
- inline Vector<const uc16> next_literal_utf16_string() {
- return lexer_->next_literal_two_byte_string();
+ inline Handle<String> AllocateNextLiteralString(Isolate* isolate,
+ PretenureFlag tenured) {
+ return lexer_->AllocateNextLiteralString(isolate, tenured);
+ }
+ inline Handle<String> AllocateInternalizedString(Isolate* isolate) {
+ return lexer_->AllocateInternalizedString(isolate);
}
- inline int next_literal_length() {
- return lexer_->next_literal_length();
+ inline double DoubleValue() { return lexer_->DoubleValue(); }
+ inline bool UnescapedLiteralMatches(const char* data, int length) {
+ return lexer_->UnescapedLiteralMatches(data, length);
+ }
+ inline void IsGetOrSet(bool* is_get, bool* is_set) {
+ lexer_->IsGetOrSet(is_get, is_set);
}
- inline bool is_next_literal_ascii() {
- return lexer_->is_next_literal_one_byte();
+ inline int FindNumber(DuplicateFinder* finder, int value) {
+ return lexer_->FindNumber(finder, value);
+ }
+ inline int FindSymbol(DuplicateFinder* finder, int value) {
+ return lexer_->FindSymbol(finder, value);
}
- inline bool is_next_contextual_keyword(
- Vector<const char>& keyword) { // NOLINT
- return lexer_->is_next_contextual_keyword(
- Vector<const uint8_t>::cast(keyword));
+ inline void LogSymbol(ParserRecorder* log, int position) {
+ lexer_->LogSymbol(log, position);
}
private:
--
--
v8-dev mailing list
[email protected]
http://groups.google.com/group/v8-dev
---
You received this message because you are subscribed to the Google Groups "v8-dev" group.
To unsubscribe from this group and stop receiving emails from it, send an email
to [email protected].
For more options, visit https://groups.google.com/d/optout.