Commit b2abc0e3 authored by jkummerow's avatar jkummerow Committed by Commit bot

Use C++ implementation of Object.definePropert{y,ies}

For now, only rewire builtins in v8natives.js to call the new runtime functions.

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

Cr-Commit-Position: refs/heads/master@{#31413}
parent a64d387a
......@@ -1032,6 +1032,9 @@ function ObjectCreate(proto, properties) {
// ES5 section 15.2.3.6.
function ObjectDefineProperty(obj, p, attributes) {
// The new pure-C++ implementation doesn't support Proxies yet, nor O.o.
// TODO(jkummerow): Implement missing features and remove fallback path.
if (%_IsJSProxy(obj) || %IsObserved(obj)) {
if (!IS_SPEC_OBJECT(obj)) {
throw MakeTypeError(kCalledOnNonObject, "Object.defineProperty");
}
......@@ -1068,6 +1071,8 @@ function ObjectDefineProperty(obj, p, attributes) {
DefineOwnProperty(obj, name, desc, true);
}
return obj;
}
return %ObjectDefineProperty(obj, p, attributes);
}
......@@ -1095,6 +1100,9 @@ function GetOwnEnumerablePropertyNames(object) {
// ES5 section 15.2.3.7.
function ObjectDefineProperties(obj, properties) {
// The new pure-C++ implementation doesn't support Proxies yet, nor O.o.
// TODO(jkummerow): Implement missing features and remove fallback path.
if (%_IsJSProxy(obj) || %_IsJSProxy(properties) || %IsObserved(obj)) {
if (!IS_SPEC_OBJECT(obj)) {
throw MakeTypeError(kCalledOnNonObject, "Object.defineProperties");
}
......@@ -1108,6 +1116,8 @@ function ObjectDefineProperties(obj, properties) {
DefineOwnProperty(obj, names[i], descriptors[i], true);
}
return obj;
}
return %ObjectDefineProperties(obj, properties);
}
......
......@@ -6515,7 +6515,7 @@ bool JSArray::ArraySetLength(Isolate* isolate, Handle<JSArray> a,
if (!success && should_throw == THROW_ON_ERROR) {
isolate->Throw(*isolate->factory()->NewTypeError(
MessageTemplate::kStrictDeleteProperty,
isolate->factory()->NewNumberFromUint(actual_new_len - 1)));
isolate->factory()->NewNumberFromUint(actual_new_len - 1), a));
}
return success;
}
......@@ -7783,7 +7783,10 @@ MaybeHandle<FixedArray> JSReceiver::GetKeys(Handle<JSReceiver> object,
DCHECK(filter == INCLUDE_SYMBOLS);
PropertyAttributes attr_filter =
static_cast<PropertyAttributes>(DONT_ENUM | PRIVATE_SYMBOL);
JSObject::CollectOwnElementKeys(current, &accumulator, attr_filter);
Handle<FixedArray> property_keys = isolate->factory()->NewFixedArray(
current->NumberOfOwnProperties(attr_filter));
current->GetOwnPropertyNames(*property_keys, 0, attr_filter);
accumulator.AddKeys(property_keys);
}
// Add the property keys from the interceptor.
......
......@@ -4,6 +4,7 @@
#include "src/property-descriptor.h"
#include "src/bootstrapper.h"
#include "src/factory.h"
#include "src/isolate-inl.h"
#include "src/lookup.h"
......@@ -43,6 +44,9 @@ bool ToPropertyDescriptorFastPath(Isolate* isolate, Handle<Object> obj,
if (map->instance_type() != JS_OBJECT_TYPE) return false;
if (map->is_access_check_needed()) return false;
if (map->prototype() != *isolate->initial_object_prototype()) return false;
// During bootstrapping, the object_function_prototype_map hasn't been
// set up yet.
if (isolate->bootstrapper()->IsActive()) return false;
if (JSObject::cast(map->prototype())->map() !=
isolate->native_context()->object_function_prototype_map()) {
return false;
......
......@@ -8728,9 +8728,10 @@ TEST(AccessControlES5) {
CHECK_EQ(42, g_echo_value);
v8::Handle<Value> value;
CompileRun("Object.defineProperty(other, 'accessible_prop', {value: -1})");
value = CompileRun("other.accessible_prop == 42");
CompileRun("Object.defineProperty(other, 'accessible_prop', {value: 43})");
value = CompileRun("other.accessible_prop == 43");
CHECK(value->IsTrue());
CHECK_EQ(43, g_echo_value); // Make sure we didn't overwrite the setter.
}
......
......@@ -33,30 +33,6 @@
'intl402/11.2.3_b': [FAIL],
'intl402/12.2.3_b': [FAIL],
# BUG(v8:4267)
'built-ins/Object/defineProperties/15.2.3.7-6-a-112': [FAIL],
'built-ins/Object/defineProperties/15.2.3.7-6-a-113': [FAIL],
'built-ins/Object/defineProperties/15.2.3.7-6-a-164': [FAIL],
'built-ins/Object/defineProperties/15.2.3.7-6-a-165': [FAIL],
'built-ins/Object/defineProperties/15.2.3.7-6-a-166': [FAIL],
'built-ins/Object/defineProperties/15.2.3.7-6-a-168': [FAIL],
'built-ins/Object/defineProperties/15.2.3.7-6-a-169': [FAIL],
'built-ins/Object/defineProperties/15.2.3.7-6-a-170': [FAIL],
'built-ins/Object/defineProperties/15.2.3.7-6-a-172': [FAIL],
'built-ins/Object/defineProperties/15.2.3.7-6-a-173': [FAIL],
'built-ins/Object/defineProperties/15.2.3.7-6-a-175': [FAIL],
'built-ins/Object/defineProperties/15.2.3.7-6-a-176': [FAIL],
'built-ins/Object/defineProperty/15.2.3.6-4-116': [FAIL],
'built-ins/Object/defineProperty/15.2.3.6-4-117': [FAIL],
'built-ins/Object/defineProperty/15.2.3.6-4-168': [FAIL],
'built-ins/Object/defineProperty/15.2.3.6-4-169': [FAIL],
'built-ins/Object/defineProperty/15.2.3.6-4-170': [FAIL],
'built-ins/Object/defineProperty/15.2.3.6-4-172': [FAIL],
'built-ins/Object/defineProperty/15.2.3.6-4-173': [FAIL],
'built-ins/Object/defineProperty/15.2.3.6-4-174': [FAIL],
'built-ins/Object/defineProperty/15.2.3.6-4-176': [FAIL],
'built-ins/Object/defineProperty/15.2.3.6-4-177': [FAIL],
# Unicode canonicalization is not available with i18n turned off.
'built-ins/String/prototype/localeCompare/15.5.4.9_CE': [['no_i18n', SKIP]],
......
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment