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

Unified Diff: src/transitions.cc

Issue 1704353002: [runtime] Force internalize names used before lookup in in DescriptorArray and TransitionArray (Closed) Base URL: https://chromium.googlesource.com/v8/v8.git@master
Patch Set: Created 4 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/property.h ('k') | src/transitions-inl.h » ('j') | no next file with comments »
Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
Index: src/transitions.cc
diff --git a/src/transitions.cc b/src/transitions.cc
index fc24b288677f62d78dab2aed40786ed4c001e62e..e63769e4af9640f1330e87fe4e701bf153a15d36 100644
--- a/src/transitions.cc
+++ b/src/transitions.cc
@@ -159,20 +159,21 @@ void TransitionArray::Insert(Handle<Map> map, Handle<Name> name,
// static
Map* TransitionArray::SearchTransition(Map* map, PropertyKind kind, Name* name,
PropertyAttributes attributes) {
+ DCHECK(name->IsUniqueName());
Object* raw_transitions = map->raw_transitions();
if (IsSimpleTransition(raw_transitions)) {
Map* target = GetSimpleTransition(raw_transitions);
Name* key = GetSimpleTransitionKey(target);
- if (!key->Equals(name)) return NULL;
+ if (key != name) return nullptr;
PropertyDetails details = GetSimpleTargetDetails(target);
- if (details.attributes() != attributes) return NULL;
- if (details.kind() != kind) return NULL;
+ if (details.attributes() != attributes) return nullptr;
+ if (details.kind() != kind) return nullptr;
return target;
}
if (IsFullTransitionArray(raw_transitions)) {
TransitionArray* transitions = TransitionArray::cast(raw_transitions);
int transition = transitions->Search(kind, name, attributes);
- if (transition == kNotFound) return NULL;
+ if (transition == kNotFound) return nullptr;
return transitions->GetTarget(transition);
}
return NULL;
@@ -195,6 +196,7 @@ Map* TransitionArray::SearchSpecial(Map* map, Symbol* name) {
// static
Handle<Map> TransitionArray::FindTransitionToField(Handle<Map> map,
Handle<Name> name) {
+ DCHECK(name->IsUniqueName());
DisallowHeapAllocation no_gc;
Map* target = SearchTransition(*map, kData, *name, NONE);
if (target == NULL) return Handle<Map>::null();
@@ -545,9 +547,7 @@ int TransitionArray::Search(PropertyKind kind, Name* name,
PropertyAttributes attributes,
int* out_insertion_index) {
int transition = SearchName(name, out_insertion_index);
- if (transition == kNotFound) {
- return kNotFound;
- }
+ if (transition == kNotFound) return kNotFound;
return SearchDetails(transition, kind, attributes, out_insertion_index);
}
} // namespace internal
« no previous file with comments | « src/property.h ('k') | src/transitions-inl.h » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698