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

Unified Diff: src/profile-generator.cc

Issue 12330012: ES6 symbols: Allow symbols as property names (Closed) Base URL: https://v8.googlecode.com/svn/branches/bleeding_edge
Patch Set: Platform ports 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/profile-generator.h ('k') | src/profile-generator-inl.h » ('j') | no next file with comments »
Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
Index: src/profile-generator.cc
diff --git a/src/profile-generator.cc b/src/profile-generator.cc
index 6b1476f773535eec38864457e934506e8865a57a..85e6a12cea530e1a348dd2c4e2194c484b4f863c 100644
--- a/src/profile-generator.cc
+++ b/src/profile-generator.cc
@@ -154,14 +154,17 @@ const char* StringsStorage::GetVFormatted(const char* format, va_list args) {
}
-const char* StringsStorage::GetName(String* name) {
+const char* StringsStorage::GetName(Name* name) {
if (name->IsString()) {
- int length = Min(kMaxNameSize, name->length());
+ String* str = String::cast(name);
+ int length = Min(kMaxNameSize, str->length());
SmartArrayPointer<char> data =
- name->ToCString(DISALLOW_NULLS, ROBUST_STRING_TRAVERSAL, 0, length);
+ str->ToCString(DISALLOW_NULLS, ROBUST_STRING_TRAVERSAL, 0, length);
uint32_t hash = StringHasher::HashSequentialString(
*data, length, name->GetHeap()->HashSeed());
return AddOrDisposeString(data.Detach(), hash);
+ } else if (name->IsSymbol()) {
+ return "<symbol>";
}
return "";
}
@@ -783,7 +786,7 @@ List<CpuProfile*>* CpuProfilesCollection::Profiles(int security_token_id) {
CodeEntry* CpuProfilesCollection::NewCodeEntry(Logger::LogEventsAndTags tag,
- String* name,
+ Name* name,
String* resource_name,
int line_number) {
CodeEntry* entry = new CodeEntry(tag,
@@ -812,7 +815,7 @@ CodeEntry* CpuProfilesCollection::NewCodeEntry(Logger::LogEventsAndTags tag,
CodeEntry* CpuProfilesCollection::NewCodeEntry(Logger::LogEventsAndTags tag,
const char* name_prefix,
- String* name) {
+ Name* name) {
CodeEntry* entry = new CodeEntry(tag,
name_prefix,
GetName(name),
@@ -2213,7 +2216,7 @@ void V8HeapExplorer::ExtractPropertyReferences(JSObject* js_obj, int entry) {
case FIELD: {
int index = descs->GetFieldIndex(i);
- String* k = descs->GetKey(i);
+ Name* k = descs->GetKey(i);
if (index < js_obj->map()->inobject_properties()) {
Object* value = js_obj->InObjectPropertyAt(index);
if (k != heap_->hidden_string()) {
@@ -2271,7 +2274,7 @@ void V8HeapExplorer::ExtractPropertyReferences(JSObject* js_obj, int entry) {
}
}
} else {
- StringDictionary* dictionary = js_obj->property_dictionary();
+ NameDictionary* dictionary = js_obj->property_dictionary();
int length = dictionary->Capacity();
for (int i = 0; i < length; ++i) {
Object* k = dictionary->KeyAt(i);
@@ -2581,20 +2584,21 @@ void V8HeapExplorer::SetWeakReference(HeapObject* parent_obj,
void V8HeapExplorer::SetPropertyReference(HeapObject* parent_obj,
int parent_entry,
- String* reference_name,
+ Name* reference_name,
Object* child_obj,
const char* name_format_string,
int field_offset) {
HeapEntry* child_entry = GetEntry(child_obj);
if (child_entry != NULL) {
- HeapGraphEdge::Type type = reference_name->length() > 0 ?
- HeapGraphEdge::kProperty : HeapGraphEdge::kInternal;
- const char* name = name_format_string != NULL ?
- collection_->names()->GetFormatted(
- name_format_string,
- *reference_name->ToCString(DISALLOW_NULLS,
- ROBUST_STRING_TRAVERSAL)) :
- collection_->names()->GetName(reference_name);
+ HeapGraphEdge::Type type =
+ reference_name->IsSymbol() || String::cast(reference_name)->length() > 0
+ ? HeapGraphEdge::kProperty : HeapGraphEdge::kInternal;
+ const char* name = name_format_string != NULL && reference_name->IsString()
+ ? collection_->names()->GetFormatted(
+ name_format_string,
+ *String::cast(reference_name)->ToCString(
+ DISALLOW_NULLS, ROBUST_STRING_TRAVERSAL))
+ : collection_->names()->GetName(reference_name);
filler_->SetNamedReference(type,
parent_entry,
« no previous file with comments | « src/profile-generator.h ('k') | src/profile-generator-inl.h » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698