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

Unified Diff: src/json-parser.h

Issue 12210083: Renamed "symbols" to "internalized strings" throughout the code base, (Closed) Base URL: https://v8.googlecode.com/svn/branches/bleeding_edge
Patch Set: Addressed Yang's comments Created 7 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/isolate.cc ('k') | src/json-stringifier.h » ('j') | no next file with comments »
Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
Index: src/json-parser.h
diff --git a/src/json-parser.h b/src/json-parser.h
index ccb32866f9268d3e7fc780d811fbdb1da8fdf6d3..62329662eb8f8e3adfccdba2b5435451b5961bc4 100644
--- a/src/json-parser.h
+++ b/src/json-parser.h
@@ -102,10 +102,10 @@ class JsonParser BASE_EMBEDDED {
Handle<String> ParseJsonString() {
return ScanJsonString<false>();
}
- Handle<String> ParseJsonSymbol() {
+ Handle<String> ParseJsonInternalizedString() {
return ScanJsonString<true>();
}
- template <bool is_symbol>
+ template <bool is_internalized>
Handle<String> ScanJsonString();
// Creates a new string and copies prefix[start..end] into the beginning
// of it. Then scans the rest of the string, adding characters after the
@@ -338,14 +338,14 @@ Handle<Object> JsonParser<seq_ascii>::ParseJsonObject() {
c0_ = '"';
#endif
- Handle<String> key = ParseJsonSymbol();
+ Handle<String> key = ParseJsonInternalizedString();
if (key.is_null() || c0_ != ':') return ReportUnexpectedCharacter();
AdvanceSkipWhitespace();
Handle<Object> value = ParseJsonValue();
if (value.is_null()) return ReportUnexpectedCharacter();
- if (key->Equals(isolate()->heap()->Proto_symbol())) {
+ if (key->Equals(isolate()->heap()->proto_string())) {
prototype = value;
} else {
if (JSObject::TryTransitionToField(json_object, key)) {
@@ -606,7 +606,7 @@ Handle<String> JsonParser<seq_ascii>::SlowScanJsonString(
template <bool seq_ascii>
-template <bool is_symbol>
+template <bool is_internalized>
Handle<String> JsonParser<seq_ascii>::ScanJsonString() {
ASSERT_EQ('"', c0_);
Advance();
@@ -615,10 +615,10 @@ Handle<String> JsonParser<seq_ascii>::ScanJsonString() {
return factory()->empty_string();
}
- if (seq_ascii && is_symbol) {
- // Fast path for existing symbols. If the the string being parsed is not
- // a known symbol, contains backslashes or unexpectedly reaches the end of
- // string, return with an empty handle.
+ if (seq_ascii && is_internalized) {
+ // Fast path for existing internalized strings. If the the string being
+ // parsed is not a known internalized string, contains backslashes or
+ // unexpectedly reaches the end of string, return with an empty handle.
uint32_t running_hash = isolate()->heap()->HashSeed();
int position = position_;
uc32 c0 = c0_;
@@ -652,12 +652,12 @@ Handle<String> JsonParser<seq_ascii>::ScanJsonString() {
? StringHasher::GetHashCore(running_hash) : length;
Vector<const uint8_t> string_vector(
seq_source_->GetChars() + position_, length);
- SymbolTable* symbol_table = isolate()->heap()->symbol_table();
- uint32_t capacity = symbol_table->Capacity();
- uint32_t entry = SymbolTable::FirstProbe(hash, capacity);
+ StringTable* string_table = isolate()->heap()->string_table();
+ uint32_t capacity = string_table->Capacity();
+ uint32_t entry = StringTable::FirstProbe(hash, capacity);
uint32_t count = 1;
while (true) {
- Object* element = symbol_table->KeyAt(entry);
+ Object* element = string_table->KeyAt(entry);
if (element == isolate()->heap()->undefined_value()) {
// Lookup failure.
break;
@@ -670,7 +670,7 @@ Handle<String> JsonParser<seq_ascii>::ScanJsonString() {
AdvanceSkipWhitespace();
return Handle<String>(String::cast(element), isolate());
}
- entry = SymbolTable::NextProbe(entry, count++, capacity);
+ entry = StringTable::NextProbe(entry, count++, capacity);
}
}
@@ -695,8 +695,8 @@ Handle<String> JsonParser<seq_ascii>::ScanJsonString() {
} while (c0_ != '"');
int length = position_ - beg_pos;
Handle<String> result;
- if (seq_ascii && is_symbol) {
- result = factory()->LookupOneByteSymbol(seq_source_, beg_pos, length);
+ if (seq_ascii && is_internalized) {
+ result = factory()->InternalizeOneByteString(seq_source_, beg_pos, length);
} else {
result = factory()->NewRawOneByteString(length, pretenure_);
uint8_t* dest = SeqOneByteString::cast(*result)->GetChars();
« no previous file with comments | « src/isolate.cc ('k') | src/json-stringifier.h » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698