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

Unified Diff: src/interface.cc

Issue 345513003: Revert "Parser: Delay internalizing strings and values." (r21841) (Closed) Base URL: https://v8.googlecode.com/svn/branches/bleeding_edge
Patch Set: Created 6 years, 6 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/interface.h ('k') | src/objects.cc » ('j') | no next file with comments »
Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
Index: src/interface.cc
diff --git a/src/interface.cc b/src/interface.cc
index f58dbc972131fc7b4f0a51c37aa1d5ebbe333760..d6e84068e9a86de4fc4cf827ea2435b8c7b30b3c 100644
--- a/src/interface.cc
+++ b/src/interface.cc
@@ -9,6 +9,15 @@
namespace v8 {
namespace internal {
+static bool Match(void* key1, void* key2) {
+ String* name1 = *static_cast<String**>(key1);
+ String* name2 = *static_cast<String**>(key2);
+ ASSERT(name1->IsInternalizedString());
+ ASSERT(name2->IsInternalizedString());
+ return name1 == name2;
+}
+
+
Interface* Interface::Lookup(Handle<String> name, Zone* zone) {
ASSERT(IsModule());
ZoneHashMap* map = Chase()->exports_;
@@ -38,8 +47,8 @@ int Nesting::current_ = 0;
#endif
-void Interface::DoAdd(const void* name, uint32_t hash, Interface* interface,
- Zone* zone, bool* ok) {
+void Interface::DoAdd(
+ void* name, uint32_t hash, Interface* interface, Zone* zone, bool* ok) {
MakeModule(ok);
if (!*ok) return;
@@ -48,9 +57,8 @@ void Interface::DoAdd(const void* name, uint32_t hash, Interface* interface,
PrintF("%*s# Adding...\n", Nesting::current(), "");
PrintF("%*sthis = ", Nesting::current(), "");
this->Print(Nesting::current());
- const AstString* symbol = static_cast<const AstString*>(name);
- PrintF("%*s%.*s : ", Nesting::current(), "", symbol->length(),
- symbol->raw_data());
+ PrintF("%*s%s : ", Nesting::current(), "",
+ (*static_cast<String**>(name))->ToAsciiArray());
interface->Print(Nesting::current());
}
#endif
@@ -60,12 +68,10 @@ void Interface::DoAdd(const void* name, uint32_t hash, Interface* interface,
if (*map == NULL) {
*map = new(zone->New(sizeof(ZoneHashMap)))
- ZoneHashMap(ZoneHashMap::PointersMatch,
- ZoneHashMap::kDefaultHashMapCapacity, allocator);
+ ZoneHashMap(Match, ZoneHashMap::kDefaultHashMapCapacity, allocator);
}
- ZoneHashMap::Entry* p =
- (*map)->Lookup(const_cast<void*>(name), hash, !IsFrozen(), allocator);
+ ZoneHashMap::Entry* p = (*map)->Lookup(name, hash, !IsFrozen(), allocator);
if (p == NULL) {
// This didn't have name but was frozen already, that's an error.
*ok = false;
« no previous file with comments | « src/interface.h ('k') | src/objects.cc » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698