Object.defineProperty shouldn't be a hint that we're constructing a dictionary.
BUG=362870 LOG=y R=bmeurer@chromium.org Review URL: https://codereview.chromium.org/261583004 git-svn-id: http://v8.googlecode.com/svn/branches/bleeding_edge@21109 ce2b1a6d-e550-0410-aec6-3dcde31c8c00
This commit is contained in:
parent
b7148380cc
commit
7bfc426fc9
@ -4306,7 +4306,8 @@ MaybeHandle<Object> JSObject::SetLocalPropertyIgnoreAttributes(
|
|||||||
PropertyAttributes attributes,
|
PropertyAttributes attributes,
|
||||||
ValueType value_type,
|
ValueType value_type,
|
||||||
StoreMode mode,
|
StoreMode mode,
|
||||||
ExtensibilityCheck extensibility_check) {
|
ExtensibilityCheck extensibility_check,
|
||||||
|
StoreFromKeyed store_from_keyed) {
|
||||||
Isolate* isolate = object->GetIsolate();
|
Isolate* isolate = object->GetIsolate();
|
||||||
|
|
||||||
// Make sure that the top context does not change when doing callbacks or
|
// Make sure that the top context does not change when doing callbacks or
|
||||||
@ -4347,7 +4348,7 @@ MaybeHandle<Object> JSObject::SetLocalPropertyIgnoreAttributes(
|
|||||||
? OMIT_TRANSITION : INSERT_TRANSITION;
|
? OMIT_TRANSITION : INSERT_TRANSITION;
|
||||||
// Neither properties nor transitions found.
|
// Neither properties nor transitions found.
|
||||||
return AddProperty(object, name, value, attributes, SLOPPY,
|
return AddProperty(object, name, value, attributes, SLOPPY,
|
||||||
MAY_BE_STORE_FROM_KEYED, extensibility_check, value_type, mode, flag);
|
store_from_keyed, extensibility_check, value_type, mode, flag);
|
||||||
}
|
}
|
||||||
|
|
||||||
Handle<Object> old_value = isolate->factory()->the_hole_value();
|
Handle<Object> old_value = isolate->factory()->the_hole_value();
|
||||||
|
@ -2159,7 +2159,8 @@ class JSObject: public JSReceiver {
|
|||||||
PropertyAttributes attributes,
|
PropertyAttributes attributes,
|
||||||
ValueType value_type = OPTIMAL_REPRESENTATION,
|
ValueType value_type = OPTIMAL_REPRESENTATION,
|
||||||
StoreMode mode = ALLOW_AS_CONSTANT,
|
StoreMode mode = ALLOW_AS_CONSTANT,
|
||||||
ExtensibilityCheck extensibility_check = PERFORM_EXTENSIBILITY_CHECK);
|
ExtensibilityCheck extensibility_check = PERFORM_EXTENSIBILITY_CHECK,
|
||||||
|
StoreFromKeyed store_mode = MAY_BE_STORE_FROM_KEYED);
|
||||||
|
|
||||||
static inline Handle<String> ExpectedTransitionKey(Handle<Map> map);
|
static inline Handle<String> ExpectedTransitionKey(Handle<Map> map);
|
||||||
static inline Handle<Map> ExpectedTransitionTarget(Handle<Map> map);
|
static inline Handle<Map> ExpectedTransitionTarget(Handle<Map> map);
|
||||||
|
@ -5290,7 +5290,9 @@ RUNTIME_FUNCTION(Runtime_DefineOrRedefineDataProperty) {
|
|||||||
Handle<Object> result;
|
Handle<Object> result;
|
||||||
ASSIGN_RETURN_FAILURE_ON_EXCEPTION(
|
ASSIGN_RETURN_FAILURE_ON_EXCEPTION(
|
||||||
isolate, result,
|
isolate, result,
|
||||||
Runtime::ForceSetObjectProperty(js_object, name, obj_value, attr));
|
Runtime::ForceSetObjectProperty(
|
||||||
|
js_object, name, obj_value, attr,
|
||||||
|
JSReceiver::CERTAINLY_NOT_STORE_FROM_KEYED));
|
||||||
return *result;
|
return *result;
|
||||||
}
|
}
|
||||||
|
|
||||||
@ -5402,10 +5404,12 @@ MaybeHandle<Object> Runtime::SetObjectProperty(Isolate* isolate,
|
|||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
MaybeHandle<Object> Runtime::ForceSetObjectProperty(Handle<JSObject> js_object,
|
MaybeHandle<Object> Runtime::ForceSetObjectProperty(
|
||||||
Handle<Object> key,
|
Handle<JSObject> js_object,
|
||||||
Handle<Object> value,
|
Handle<Object> key,
|
||||||
PropertyAttributes attr) {
|
Handle<Object> value,
|
||||||
|
PropertyAttributes attr,
|
||||||
|
JSReceiver::StoreFromKeyed store_from_keyed) {
|
||||||
Isolate* isolate = js_object->GetIsolate();
|
Isolate* isolate = js_object->GetIsolate();
|
||||||
// Check if the given key is an array index.
|
// Check if the given key is an array index.
|
||||||
uint32_t index;
|
uint32_t index;
|
||||||
@ -5433,7 +5437,9 @@ MaybeHandle<Object> Runtime::ForceSetObjectProperty(Handle<JSObject> js_object,
|
|||||||
} else {
|
} else {
|
||||||
if (name->IsString()) name = String::Flatten(Handle<String>::cast(name));
|
if (name->IsString()) name = String::Flatten(Handle<String>::cast(name));
|
||||||
return JSObject::SetLocalPropertyIgnoreAttributes(
|
return JSObject::SetLocalPropertyIgnoreAttributes(
|
||||||
js_object, name, value, attr);
|
js_object, name, value, attr, Object::OPTIMAL_REPRESENTATION,
|
||||||
|
ALLOW_AS_CONSTANT, JSReceiver::PERFORM_EXTENSIBILITY_CHECK,
|
||||||
|
store_from_keyed);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
@ -5447,8 +5453,10 @@ MaybeHandle<Object> Runtime::ForceSetObjectProperty(Handle<JSObject> js_object,
|
|||||||
return JSObject::SetElement(js_object, index, value, attr,
|
return JSObject::SetElement(js_object, index, value, attr,
|
||||||
SLOPPY, false, DEFINE_PROPERTY);
|
SLOPPY, false, DEFINE_PROPERTY);
|
||||||
} else {
|
} else {
|
||||||
return JSObject::SetLocalPropertyIgnoreAttributes(js_object, name, value,
|
return JSObject::SetLocalPropertyIgnoreAttributes(
|
||||||
attr);
|
js_object, name, value, attr, Object::OPTIMAL_REPRESENTATION,
|
||||||
|
ALLOW_AS_CONSTANT, JSReceiver::PERFORM_EXTENSIBILITY_CHECK,
|
||||||
|
store_from_keyed);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -820,7 +820,9 @@ class Runtime : public AllStatic {
|
|||||||
Handle<JSObject> object,
|
Handle<JSObject> object,
|
||||||
Handle<Object> key,
|
Handle<Object> key,
|
||||||
Handle<Object> value,
|
Handle<Object> value,
|
||||||
PropertyAttributes attr);
|
PropertyAttributes attr,
|
||||||
|
JSReceiver::StoreFromKeyed store_from_keyed
|
||||||
|
= JSReceiver::MAY_BE_STORE_FROM_KEYED);
|
||||||
|
|
||||||
MUST_USE_RESULT static MaybeHandle<Object> DeleteObjectProperty(
|
MUST_USE_RESULT static MaybeHandle<Object> DeleteObjectProperty(
|
||||||
Isolate* isolate,
|
Isolate* isolate,
|
||||||
|
18
test/mjsunit/regress/regress-362870.js
Normal file
18
test/mjsunit/regress/regress-362870.js
Normal file
@ -0,0 +1,18 @@
|
|||||||
|
// Copyright 2014 the V8 project authors. All rights reserved.
|
||||||
|
// Use of this source code is governed by a BSD-style license that can be
|
||||||
|
// found in the LICENSE file.
|
||||||
|
|
||||||
|
// Flags: --allow-natives-syntax
|
||||||
|
|
||||||
|
// Adding a property via Object.defineProperty should not be taken as hint that
|
||||||
|
// we construct a dictionary, quite the opposite.
|
||||||
|
var obj = {};
|
||||||
|
|
||||||
|
for (var i = 0; i < 100; i++) {
|
||||||
|
Object.defineProperty(obj, "x" + i, { value: 31415 });
|
||||||
|
Object.defineProperty(obj, "y" + i, {
|
||||||
|
get: function() { return 42; },
|
||||||
|
set: function(value) { }
|
||||||
|
});
|
||||||
|
assertTrue(%HasFastProperties(obj));
|
||||||
|
}
|
Loading…
Reference in New Issue
Block a user