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

Unified Diff: src/runtime.cc

Issue 384003003: Replace AddProperty by AddNamedProperty to speed up the common case (Closed) Base URL: https://v8.googlecode.com/svn/branches/bleeding_edge
Patch Set: Created 6 years, 5 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/runtime.h ('k') | src/string.js » ('j') | no next file with comments »
Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
Index: src/runtime.cc
diff --git a/src/runtime.cc b/src/runtime.cc
index 17358e41feb4fc36d26760e0260115277c56b759..687fd7176316b4f7f3e1c115b6eefc43f737d291 100644
--- a/src/runtime.cc
+++ b/src/runtime.cc
@@ -5316,12 +5316,12 @@ RUNTIME_FUNCTION(Runtime_SetHiddenProperty) {
}
-RUNTIME_FUNCTION(Runtime_AddProperty) {
+RUNTIME_FUNCTION(Runtime_AddNamedProperty) {
HandleScope scope(isolate);
RUNTIME_ASSERT(args.length() == 4);
CONVERT_ARG_HANDLE_CHECKED(JSObject, object, 0);
- CONVERT_ARG_HANDLE_CHECKED(Object, key, 1);
+ CONVERT_ARG_HANDLE_CHECKED(Name, key, 1);
CONVERT_ARG_HANDLE_CHECKED(Object, value, 2);
CONVERT_SMI_ARG_CHECKED(unchecked_attributes, 3);
RUNTIME_ASSERT(
@@ -5331,27 +5331,17 @@ RUNTIME_FUNCTION(Runtime_AddProperty) {
static_cast<PropertyAttributes>(unchecked_attributes);
#ifdef DEBUG
- bool duplicate;
uint32_t index = 0;
- if (key->IsName() || !key->ToArrayIndex(&index)) {
- if (key->IsNumber()) {
- ASSIGN_RETURN_FAILURE_ON_EXCEPTION(isolate, key,
- Execution::ToString(isolate, key));
- }
- LookupIterator it(object, Handle<Name>::cast(key),
- LookupIterator::CHECK_OWN_REAL);
- JSReceiver::GetPropertyAttributes(&it);
- duplicate = it.IsFound();
- } else {
- duplicate = JSReceiver::HasOwnElement(object, index);
- }
- RUNTIME_ASSERT(!duplicate);
+ ASSERT(!key->ToArrayIndex(&index));
+ LookupIterator it(object, key, LookupIterator::CHECK_OWN_REAL);
+ JSReceiver::GetPropertyAttributes(&it);
+ RUNTIME_ASSERT(!it.IsFound());
#endif
Handle<Object> result;
ASSIGN_RETURN_FAILURE_ON_EXCEPTION(
isolate, result,
- Runtime::DefineObjectProperty(object, key, value, attributes));
+ JSObject::SetOwnPropertyIgnoreAttributes(object, key, value, attributes));
return *result;
}
« no previous file with comments | « src/runtime.h ('k') | src/string.js » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698