Revert of [runtime] Migrate Object.getOwnPropertyNames to C++. (patchset #2 id:20001 of https://codereview.chromium.org/1605803002/ )

Reason for revert:
Breaks roll: https://codereview.chromium.org/1603953002/

Original issue's description:
> [runtime] Migrate Object.getOwnPropertyNames to C++.
>
> The Object.getOwnPropertyNames method always calls into C++ anyway,
> so there's no point in having the JavaScript wrapper around at all.
>
> Drive-by-fix: Inline GetOwnEnumerablePropertyNames into its single
> call site.
>
> R=yangguo@chromium.org
>
> Committed: https://crrev.com/bf027fe756f62b4abcac8aa08134c8c5ed055620
> Cr-Commit-Position: refs/heads/master@{#33380}

TBR=yangguo@chromium.org,bmeurer@chromium.org
# Not skipping CQ checks because original CL landed more than 1 days ago.

Review URL: https://codereview.chromium.org/1609173002

Cr-Commit-Position: refs/heads/master@{#33399}
This commit is contained in:
hablich 2016-01-20 00:43:52 -08:00 committed by Commit bot
parent ffa9e82235
commit 98cd565ff2
4 changed files with 18 additions and 25 deletions

View File

@ -1100,8 +1100,6 @@ void Genesis::InitializeGlobal(Handle<JSGlobalObject> global_object,
native_context()->set_object_freeze(*object_freeze);
SimpleInstallFunction(object_function, "getOwnPropertyDescriptor",
Builtins::kObjectGetOwnPropertyDescriptor, 2, false);
SimpleInstallFunction(object_function, "getOwnPropertyNames",
Builtins::kObjectGetOwnPropertyNames, 1, false);
SimpleInstallFunction(object_function, "getOwnPropertySymbols",
Builtins::kObjectGetOwnPropertySymbols, 1, false);
Handle<JSFunction> object_is_extensible =

View File

@ -1590,11 +1590,8 @@ BUILTIN(ObjectGetOwnPropertyDescriptor) {
}
namespace {
Object* GetOwnPropertyKeys(Isolate* isolate,
BuiltinArguments<BuiltinExtraArguments::kNone> args,
PropertyFilter filter) {
// ES6 section 19.1.2.8 Object.getOwnPropertySymbols ( O )
BUILTIN(ObjectGetOwnPropertySymbols) {
HandleScope scope(isolate);
Handle<Object> object = args.atOrUndefined(isolate, 1);
Handle<JSReceiver> receiver;
@ -1602,25 +1599,11 @@ Object* GetOwnPropertyKeys(Isolate* isolate,
Object::ToObject(isolate, object));
Handle<FixedArray> keys;
ASSIGN_RETURN_FAILURE_ON_EXCEPTION(
isolate, keys, JSReceiver::GetKeys(receiver, JSReceiver::OWN_ONLY, filter,
CONVERT_TO_STRING));
isolate, keys, JSReceiver::GetKeys(receiver, JSReceiver::OWN_ONLY,
SKIP_STRINGS, CONVERT_TO_STRING));
return *isolate->factory()->NewJSArrayWithElements(keys);
}
} // namespace
// ES6 section 19.1.2.7 Object.getOwnPropertyNames ( O )
BUILTIN(ObjectGetOwnPropertyNames) {
return GetOwnPropertyKeys(isolate, args, SKIP_SYMBOLS);
}
// ES6 section 19.1.2.8 Object.getOwnPropertySymbols ( O )
BUILTIN(ObjectGetOwnPropertySymbols) {
return GetOwnPropertyKeys(isolate, args, SKIP_STRINGS);
}
// ES6 section 19.1.2.11 Object.isExtensible ( O )
BUILTIN(ObjectIsExtensible) {

View File

@ -111,7 +111,6 @@ inline bool operator&(BuiltinExtraArguments lhs, BuiltinExtraArguments rhs) {
V(ObjectCreate, kNone) \
V(ObjectFreeze, kNone) \
V(ObjectGetOwnPropertyDescriptor, kNone) \
V(ObjectGetOwnPropertyNames, kNone) \
V(ObjectGetOwnPropertySymbols, kNone) \
V(ObjectIsExtensible, kNone) \
V(ObjectIsFrozen, kNone) \

View File

@ -772,6 +772,13 @@ function ObjectSetPrototypeOf(obj, proto) {
}
// ES5 section 15.2.3.4.
function ObjectGetOwnPropertyNames(obj) {
obj = TO_OBJECT(obj);
return %GetOwnPropertyKeys(obj, PROPERTY_FILTER_SKIP_SYMBOLS);
}
// ES5 section 15.2.3.6.
function ObjectDefineProperty(obj, p, attributes) {
// The new pure-C++ implementation doesn't support O.o.
@ -789,6 +796,11 @@ function ObjectDefineProperty(obj, p, attributes) {
}
function GetOwnEnumerablePropertyNames(object) {
return %GetOwnPropertyKeys(object, PROPERTY_FILTER_ONLY_ENUMERABLE);
}
// ES5 section 15.2.3.7.
function ObjectDefineProperties(obj, properties) {
// The new pure-C++ implementation doesn't support O.o.
@ -798,7 +810,7 @@ function ObjectDefineProperties(obj, properties) {
throw MakeTypeError(kCalledOnNonObject, "Object.defineProperties");
}
var props = TO_OBJECT(properties);
var names = %GetOwnPropertyKeys(props, PROPERTY_FILTER_ONLY_ENUMERABLE);
var names = GetOwnEnumerablePropertyNames(props);
var descriptors = new InternalArray();
for (var i = 0; i < names.length; i++) {
descriptors.push(ToPropertyDescriptor(props[names[i]]));
@ -871,6 +883,7 @@ utils.InstallFunctions(GlobalObject, DONT_ENUM, [
"defineProperties", ObjectDefineProperties,
"getPrototypeOf", ObjectGetPrototypeOf,
"setPrototypeOf", ObjectSetPrototypeOf,
"getOwnPropertyNames", ObjectGetOwnPropertyNames,
// getOwnPropertySymbols is added in symbol.js.
"is", SameValue, // ECMA-262, Edition 6, section 19.1.2.10
// deliverChangeRecords, getNotifier, observe and unobserve are added