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

Unified Diff: src/api-natives.cc

Issue 1178893002: Introduce LookupIterator::PropertyOrElement which converts name to index if possible. (Closed) Base URL: https://chromium.googlesource.com/v8/v8.git@master
Patch Set: Created 5 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 | « no previous file | src/json-stringifier.h » ('j') | no next file with comments »
Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
Index: src/api-natives.cc
diff --git a/src/api-natives.cc b/src/api-natives.cc
index 74518447ea329a61a703cd66fa459d5ca2b1ee4f..72c9208992c72662f38c7a4381153b8326eb2e12 100644
--- a/src/api-natives.cc
+++ b/src/api-natives.cc
@@ -67,7 +67,7 @@ MaybeHandle<Object> DefineAccessorProperty(
MaybeHandle<Object> DefineDataProperty(Isolate* isolate,
Handle<JSObject> object,
- Handle<Name> key,
+ Handle<Name> name,
Handle<Object> prop_data,
Smi* unchecked_attributes) {
DCHECK((unchecked_attributes->value() &
@@ -78,20 +78,18 @@ MaybeHandle<Object> DefineDataProperty(Isolate* isolate,
Handle<Object> value;
ASSIGN_RETURN_ON_EXCEPTION(isolate, value,
- Instantiate(isolate, prop_data, key), Object);
+ Instantiate(isolate, prop_data, name), Object);
- uint32_t index = 0;
- LookupIterator::Configuration c = LookupIterator::OWN_SKIP_INTERCEPTOR;
- LookupIterator it = key->AsArrayIndex(&index)
- ? LookupIterator(isolate, object, index, c)
- : LookupIterator(object, key, c);
+ LookupIterator it = LookupIterator::PropertyOrElement(
+ isolate, object, name, LookupIterator::OWN_SKIP_INTERCEPTOR);
#ifdef DEBUG
Maybe<PropertyAttributes> maybe = JSReceiver::GetPropertyAttributes(&it);
DCHECK(maybe.IsJust());
if (it.IsFound()) {
THROW_NEW_ERROR(
- isolate, NewTypeError(MessageTemplate::kDuplicateTemplateProperty, key),
+ isolate,
+ NewTypeError(MessageTemplate::kDuplicateTemplateProperty, name),
Object);
}
#endif
« no previous file with comments | « no previous file | src/json-stringifier.h » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698