[Runtime] Use Runtime_SetNamedProperty for property stores in one-shot code.
- Rename Runtime_SetProperty to Runtime_SetKeyedProperty - Create Runtime_SetNamedProperty and use it for SetNamed property in one-shot code. - Rename Object::StoreFromKeyed enum to StoreOrigin Bug: v8:8072, chromium:876839 Cq-Include-Trybots: luci.chromium.try:linux_chromium_rel_ng;luci.v8.try:v8_linux_noi18n_rel_ng Change-Id: I22132380ca4b6ce1e0a14a38cca849814559cdcf Reviewed-on: https://chromium-review.googlesource.com/1207870 Reviewed-by: Camillo Bruni <cbruni@chromium.org> Reviewed-by: Ross McIlroy <rmcilroy@chromium.org> Reviewed-by: Yang Guo <yangguo@chromium.org> Reviewed-by: Igor Sheludko <ishell@chromium.org> Commit-Queue: Chandan Reddy <chandanreddy@google.com> Cr-Commit-Position: refs/heads/master@{#55790}
This commit is contained in:
parent
515fef86c3
commit
f79caee25f
@ -114,9 +114,8 @@ MaybeHandle<Object> DefineDataProperty(Isolate* isolate,
|
||||
}
|
||||
#endif
|
||||
|
||||
MAYBE_RETURN_NULL(
|
||||
Object::AddDataProperty(&it, value, attributes, kThrowOnError,
|
||||
Object::CERTAINLY_NOT_STORE_FROM_KEYED));
|
||||
MAYBE_RETURN_NULL(Object::AddDataProperty(
|
||||
&it, value, attributes, kThrowOnError, StoreOrigin::kNamed));
|
||||
return value;
|
||||
}
|
||||
|
||||
|
@ -4023,7 +4023,8 @@ Maybe<bool> v8::Object::Set(v8::Local<v8::Context> context,
|
||||
auto value_obj = Utils::OpenHandle(*value);
|
||||
has_pending_exception =
|
||||
i::Runtime::SetObjectProperty(isolate, self, key_obj, value_obj,
|
||||
i::LanguageMode::kSloppy)
|
||||
i::LanguageMode::kSloppy,
|
||||
i::StoreOrigin::kMaybeKeyed)
|
||||
.is_null();
|
||||
RETURN_ON_FAILED_EXECUTION_PRIMITIVE(bool);
|
||||
return Just(true);
|
||||
|
@ -341,7 +341,7 @@ V8_WARN_UNUSED_RESULT Object* GenericArrayPush(Isolate* isolate,
|
||||
// Must succeed since we always pass a valid key.
|
||||
DCHECK(success);
|
||||
MAYBE_RETURN(Object::SetProperty(&it, element, LanguageMode::kStrict,
|
||||
Object::MAY_BE_STORE_FROM_KEYED),
|
||||
StoreOrigin::kMaybeKeyed),
|
||||
ReadOnlyRoots(isolate).exception());
|
||||
}
|
||||
|
||||
|
@ -218,7 +218,7 @@ BUILTIN(ReflectSet) {
|
||||
LookupIterator it = LookupIterator::PropertyOrElement(
|
||||
isolate, receiver, name, Handle<JSReceiver>::cast(target));
|
||||
Maybe<bool> result = Object::SetSuperProperty(
|
||||
&it, value, LanguageMode::kSloppy, Object::MAY_BE_STORE_FROM_KEYED);
|
||||
&it, value, LanguageMode::kSloppy, StoreOrigin::kMaybeKeyed);
|
||||
MAYBE_RETURN(result, ReadOnlyRoots(isolate).exception());
|
||||
return *isolate->factory()->ToBoolean(result.FromJust());
|
||||
}
|
||||
|
@ -377,16 +377,16 @@ bool BuiltinToIntrinsicHasNoSideEffect(Builtins::Name builtin_id,
|
||||
if (IntrinsicHasNoSideEffect(intrinsic_id)) return true;
|
||||
|
||||
// Whitelist intrinsics called from specific builtins.
|
||||
#define BUILTIN_INTRINSIC_WHITELIST(V, W) \
|
||||
/* Arrays */ \
|
||||
V(Builtins::kArrayFilter, W(CreateDataProperty)) \
|
||||
V(Builtins::kArrayMap, W(CreateDataProperty)) \
|
||||
V(Builtins::kArrayPrototypeSlice, W(CreateDataProperty) W(SetProperty)) \
|
||||
/* TypedArrays */ \
|
||||
V(Builtins::kTypedArrayConstructor, \
|
||||
W(TypedArrayCopyElements) W(ThrowInvalidTypedArrayAlignment)) \
|
||||
V(Builtins::kTypedArrayPrototypeFilter, W(TypedArrayCopyElements)) \
|
||||
V(Builtins::kTypedArrayPrototypeMap, W(SetProperty))
|
||||
#define BUILTIN_INTRINSIC_WHITELIST(V, W) \
|
||||
/* Arrays */ \
|
||||
V(Builtins::kArrayFilter, W(CreateDataProperty)) \
|
||||
V(Builtins::kArrayMap, W(CreateDataProperty)) \
|
||||
V(Builtins::kArrayPrototypeSlice, W(CreateDataProperty) W(SetKeyedProperty)) \
|
||||
/* TypedArrays */ \
|
||||
V(Builtins::kTypedArrayConstructor, \
|
||||
W(TypedArrayCopyElements) W(ThrowInvalidTypedArrayAlignment)) \
|
||||
V(Builtins::kTypedArrayPrototypeFilter, W(TypedArrayCopyElements)) \
|
||||
V(Builtins::kTypedArrayPrototypeMap, W(SetKeyedProperty))
|
||||
|
||||
#define CASE(Builtin, ...) \
|
||||
case Builtin: \
|
||||
|
@ -335,6 +335,10 @@ inline LanguageMode stricter_language_mode(LanguageMode mode1,
|
||||
static_cast<int>(mode2));
|
||||
}
|
||||
|
||||
// A non-keyed store is of the form a.x = foo or a["x"] = foo whereas
|
||||
// a keyed store is of the form a[expression] = foo.
|
||||
enum class StoreOrigin { kMaybeKeyed, kNamed };
|
||||
|
||||
enum TypeofMode : int { INSIDE_TYPEOF, NOT_INSIDE_TYPEOF };
|
||||
|
||||
// Enums used by CEntry.
|
||||
|
60
src/ic/ic.cc
60
src/ic/ic.cc
@ -1260,9 +1260,8 @@ MaybeHandle<Object> KeyedLoadIC::Load(Handle<Object> object,
|
||||
return result;
|
||||
}
|
||||
|
||||
|
||||
bool StoreIC::LookupForWrite(LookupIterator* it, Handle<Object> value,
|
||||
JSReceiver::StoreFromKeyed store_mode) {
|
||||
StoreOrigin store_origin) {
|
||||
// Disable ICs for non-JSObjects for now.
|
||||
Handle<Object> object = it->GetReceiver();
|
||||
if (object->IsJSProxy()) return true;
|
||||
@ -1319,7 +1318,7 @@ bool StoreIC::LookupForWrite(LookupIterator* it, Handle<Object> value,
|
||||
|
||||
if (it->ExtendingNonExtensible(receiver)) return false;
|
||||
it->PrepareTransitionToDataProperty(receiver, value, NONE,
|
||||
store_mode);
|
||||
store_origin);
|
||||
return it->IsCacheableTransition();
|
||||
}
|
||||
}
|
||||
@ -1328,7 +1327,7 @@ bool StoreIC::LookupForWrite(LookupIterator* it, Handle<Object> value,
|
||||
|
||||
receiver = it->GetStoreTarget<JSObject>();
|
||||
if (it->ExtendingNonExtensible(receiver)) return false;
|
||||
it->PrepareTransitionToDataProperty(receiver, value, NONE, store_mode);
|
||||
it->PrepareTransitionToDataProperty(receiver, value, NONE, store_origin);
|
||||
return it->IsCacheableTransition();
|
||||
}
|
||||
|
||||
@ -1381,7 +1380,7 @@ MaybeHandle<Object> StoreGlobalIC::Store(Handle<Name> name,
|
||||
|
||||
MaybeHandle<Object> StoreIC::Store(Handle<Object> object, Handle<Name> name,
|
||||
Handle<Object> value,
|
||||
JSReceiver::StoreFromKeyed store_mode) {
|
||||
StoreOrigin store_origin) {
|
||||
// TODO(verwaest): Let SetProperty do the migration, since storing a property
|
||||
// might deprecate the current map again, if value does not fit.
|
||||
if (MigrateDeprecated(object)) {
|
||||
@ -1424,15 +1423,15 @@ MaybeHandle<Object> StoreIC::Store(Handle<Object> object, Handle<Name> name,
|
||||
use_ic = false;
|
||||
}
|
||||
}
|
||||
if (use_ic) UpdateCaches(&it, value, store_mode);
|
||||
if (use_ic) UpdateCaches(&it, value, store_origin);
|
||||
|
||||
MAYBE_RETURN_NULL(
|
||||
Object::SetProperty(&it, value, language_mode(), store_mode));
|
||||
Object::SetProperty(&it, value, language_mode(), store_origin));
|
||||
return value;
|
||||
}
|
||||
|
||||
void StoreIC::UpdateCaches(LookupIterator* lookup, Handle<Object> value,
|
||||
JSReceiver::StoreFromKeyed store_mode) {
|
||||
StoreOrigin store_origin) {
|
||||
if (state() == UNINITIALIZED && !IsStoreGlobalIC()) {
|
||||
// This is the first time we execute this inline cache. Transition
|
||||
// to premonomorphic state to delay setting the monomorphic state.
|
||||
@ -1443,7 +1442,7 @@ void StoreIC::UpdateCaches(LookupIterator* lookup, Handle<Object> value,
|
||||
}
|
||||
|
||||
MaybeObjectHandle handler;
|
||||
if (LookupForWrite(lookup, value, store_mode)) {
|
||||
if (LookupForWrite(lookup, value, store_origin)) {
|
||||
if (IsStoreGlobalIC()) {
|
||||
if (lookup->state() == LookupIterator::DATA &&
|
||||
lookup->GetReceiver().is_identical_to(lookup->GetHolder<Object>())) {
|
||||
@ -1988,8 +1987,9 @@ MaybeHandle<Object> KeyedStoreIC::Store(Handle<Object> object,
|
||||
if (MigrateDeprecated(object)) {
|
||||
Handle<Object> result;
|
||||
ASSIGN_RETURN_ON_EXCEPTION(
|
||||
isolate(), result, Runtime::SetObjectProperty(isolate(), object, key,
|
||||
value, language_mode()),
|
||||
isolate(), result,
|
||||
Runtime::SetObjectProperty(isolate(), object, key, value,
|
||||
language_mode(), StoreOrigin::kMaybeKeyed),
|
||||
Object);
|
||||
return result;
|
||||
}
|
||||
@ -2004,11 +2004,10 @@ MaybeHandle<Object> KeyedStoreIC::Store(Handle<Object> object,
|
||||
if ((key->IsInternalizedString() &&
|
||||
!String::cast(*key)->AsArrayIndex(&index)) ||
|
||||
key->IsSymbol()) {
|
||||
ASSIGN_RETURN_ON_EXCEPTION(
|
||||
isolate(), store_handle,
|
||||
StoreIC::Store(object, Handle<Name>::cast(key), value,
|
||||
JSReceiver::MAY_BE_STORE_FROM_KEYED),
|
||||
Object);
|
||||
ASSIGN_RETURN_ON_EXCEPTION(isolate(), store_handle,
|
||||
StoreIC::Store(object, Handle<Name>::cast(key),
|
||||
value, StoreOrigin::kMaybeKeyed),
|
||||
Object);
|
||||
if (vector_needs_update()) {
|
||||
if (ConfigureVectorState(MEGAMORPHIC, key)) {
|
||||
set_slow_stub_reason("unhandled internalized string key");
|
||||
@ -2062,10 +2061,11 @@ MaybeHandle<Object> KeyedStoreIC::Store(Handle<Object> object,
|
||||
bool receiver_was_cow =
|
||||
object->IsJSArray() &&
|
||||
Handle<JSArray>::cast(object)->elements()->IsCowArray();
|
||||
ASSIGN_RETURN_ON_EXCEPTION(isolate(), store_handle,
|
||||
Runtime::SetObjectProperty(isolate(), object, key,
|
||||
value, language_mode()),
|
||||
Object);
|
||||
ASSIGN_RETURN_ON_EXCEPTION(
|
||||
isolate(), store_handle,
|
||||
Runtime::SetObjectProperty(isolate(), object, key, value, language_mode(),
|
||||
StoreOrigin::kMaybeKeyed),
|
||||
Object);
|
||||
|
||||
if (use_ic) {
|
||||
if (!old_receiver_map.is_null()) {
|
||||
@ -2359,7 +2359,8 @@ RUNTIME_FUNCTION(Runtime_StoreGlobalIC_Slow) {
|
||||
LanguageMode language_mode = vector->GetLanguageMode(vector_slot);
|
||||
RETURN_RESULT_OR_FAILURE(
|
||||
isolate,
|
||||
Runtime::SetObjectProperty(isolate, global, name, value, language_mode));
|
||||
Runtime::SetObjectProperty(isolate, global, name, value, language_mode,
|
||||
StoreOrigin::kMaybeKeyed));
|
||||
}
|
||||
|
||||
RUNTIME_FUNCTION(Runtime_KeyedStoreIC_Miss) {
|
||||
@ -2406,7 +2407,8 @@ RUNTIME_FUNCTION(Runtime_KeyedStoreIC_Slow) {
|
||||
LanguageMode language_mode = GetLanguageModeFromSlotKind(kind);
|
||||
RETURN_RESULT_OR_FAILURE(
|
||||
isolate,
|
||||
Runtime::SetObjectProperty(isolate, object, key, value, language_mode));
|
||||
Runtime::SetObjectProperty(isolate, object, key, value, language_mode,
|
||||
StoreOrigin::kMaybeKeyed));
|
||||
}
|
||||
|
||||
RUNTIME_FUNCTION(Runtime_StoreInArrayLiteralIC_Slow) {
|
||||
@ -2446,7 +2448,8 @@ RUNTIME_FUNCTION(Runtime_ElementsTransitionAndStoreIC_Miss) {
|
||||
LanguageMode language_mode = GetLanguageModeFromSlotKind(kind);
|
||||
RETURN_RESULT_OR_FAILURE(
|
||||
isolate,
|
||||
Runtime::SetObjectProperty(isolate, object, key, value, language_mode));
|
||||
Runtime::SetObjectProperty(isolate, object, key, value, language_mode,
|
||||
StoreOrigin::kMaybeKeyed));
|
||||
}
|
||||
}
|
||||
|
||||
@ -2595,8 +2598,9 @@ RUNTIME_FUNCTION(Runtime_StoreCallbackProperty) {
|
||||
|
||||
if (V8_UNLIKELY(FLAG_runtime_stats)) {
|
||||
RETURN_RESULT_OR_FAILURE(
|
||||
isolate, Runtime::SetObjectProperty(isolate, receiver, name, value,
|
||||
language_mode));
|
||||
isolate,
|
||||
Runtime::SetObjectProperty(isolate, receiver, name, value,
|
||||
language_mode, StoreOrigin::kMaybeKeyed));
|
||||
}
|
||||
|
||||
DCHECK(info->IsCompatibleReceiver(*receiver));
|
||||
@ -2747,9 +2751,9 @@ RUNTIME_FUNCTION(Runtime_StorePropertyWithInterceptor) {
|
||||
DCHECK_EQ(LookupIterator::INTERCEPTOR, it.state());
|
||||
it.Next();
|
||||
|
||||
MAYBE_RETURN(Object::SetProperty(&it, value, language_mode,
|
||||
JSReceiver::CERTAINLY_NOT_STORE_FROM_KEYED),
|
||||
ReadOnlyRoots(isolate).exception());
|
||||
MAYBE_RETURN(
|
||||
Object::SetProperty(&it, value, language_mode, StoreOrigin::kNamed),
|
||||
ReadOnlyRoots(isolate).exception());
|
||||
return *value;
|
||||
}
|
||||
|
||||
|
@ -296,11 +296,10 @@ class StoreIC : public IC {
|
||||
|
||||
V8_WARN_UNUSED_RESULT MaybeHandle<Object> Store(
|
||||
Handle<Object> object, Handle<Name> name, Handle<Object> value,
|
||||
JSReceiver::StoreFromKeyed store_mode =
|
||||
JSReceiver::CERTAINLY_NOT_STORE_FROM_KEYED);
|
||||
StoreOrigin store_origin = StoreOrigin::kNamed);
|
||||
|
||||
bool LookupForWrite(LookupIterator* it, Handle<Object> value,
|
||||
JSReceiver::StoreFromKeyed store_mode);
|
||||
StoreOrigin store_origin);
|
||||
|
||||
protected:
|
||||
// Stub accessors.
|
||||
@ -312,7 +311,7 @@ class StoreIC : public IC {
|
||||
// Update the inline cache and the global stub cache based on the
|
||||
// lookup result.
|
||||
void UpdateCaches(LookupIterator* lookup, Handle<Object> value,
|
||||
JSReceiver::StoreFromKeyed store_mode);
|
||||
StoreOrigin store_origin);
|
||||
|
||||
private:
|
||||
MaybeObjectHandle ComputeHandler(LookupIterator* lookup);
|
||||
|
@ -952,7 +952,7 @@ void KeyedStoreGenericAssembler::KeyedStoreGeneric(
|
||||
{
|
||||
Comment("KeyedStoreGeneric_slow");
|
||||
if (language_mode.IsJust()) {
|
||||
TailCallRuntime(Runtime::kSetProperty, context, receiver, key, value,
|
||||
TailCallRuntime(Runtime::kSetKeyedProperty, context, receiver, key, value,
|
||||
SmiConstant(language_mode.FromJust()));
|
||||
} else {
|
||||
TVARIABLE(Smi, var_language_mode, SmiConstant(LanguageMode::kStrict));
|
||||
@ -961,7 +961,7 @@ void KeyedStoreGenericAssembler::KeyedStoreGeneric(
|
||||
var_language_mode = SmiConstant(LanguageMode::kSloppy);
|
||||
Goto(&call_runtime);
|
||||
BIND(&call_runtime);
|
||||
TailCallRuntime(Runtime::kSetProperty, context, receiver, key, value,
|
||||
TailCallRuntime(Runtime::kSetKeyedProperty, context, receiver, key, value,
|
||||
var_language_mode.value());
|
||||
}
|
||||
}
|
||||
@ -1048,8 +1048,8 @@ void KeyedStoreGenericAssembler::SetProperty(TNode<Context> context,
|
||||
|
||||
BIND(&slow);
|
||||
{
|
||||
CallRuntime(Runtime::kSetProperty, context, receiver, unique_name, value,
|
||||
SmiConstant(language_mode));
|
||||
CallRuntime(Runtime::kSetKeyedProperty, context, receiver, unique_name,
|
||||
value, SmiConstant(language_mode));
|
||||
Goto(&done);
|
||||
}
|
||||
|
||||
|
@ -2231,7 +2231,7 @@ void BytecodeGenerator::VisitObjectLiteral(ObjectLiteral* expr) {
|
||||
builder()
|
||||
->LoadLiteral(Smi::FromEnum(LanguageMode::kSloppy))
|
||||
.StoreAccumulatorInRegister(args[3])
|
||||
.CallRuntime(Runtime::kSetProperty, args);
|
||||
.CallRuntime(Runtime::kSetKeyedProperty, args);
|
||||
Register value = args[2];
|
||||
VisitSetHomeObject(value, literal, property);
|
||||
}
|
||||
@ -2894,7 +2894,7 @@ void BytecodeGenerator::BuildStoreNamedProperty(Property* property,
|
||||
.StoreAccumulatorInRegister(args[1])
|
||||
.LoadLiteral(Smi::FromEnum(language_mode()))
|
||||
.StoreAccumulatorInRegister(args[3])
|
||||
.CallRuntime(Runtime::kSetProperty, args);
|
||||
.CallRuntime(Runtime::kSetNamedProperty, args);
|
||||
} else {
|
||||
FeedbackSlot slot = GetCachedStoreICSlot(property->obj(), name);
|
||||
builder()->StoreNamedProperty(object, name, feedback_index(slot),
|
||||
|
@ -535,7 +535,7 @@ void LookupIterator::ReconfigureDataProperty(Handle<Object> value,
|
||||
// via a trap. Adding properties to primitive values is not observable.
|
||||
void LookupIterator::PrepareTransitionToDataProperty(
|
||||
Handle<JSReceiver> receiver, Handle<Object> value,
|
||||
PropertyAttributes attributes, Object::StoreFromKeyed store_mode) {
|
||||
PropertyAttributes attributes, StoreOrigin store_origin) {
|
||||
DCHECK_IMPLIES(receiver->IsJSProxy(), name()->IsPrivate());
|
||||
DCHECK(receiver.is_identical_to(GetStoreTarget<JSReceiver>()));
|
||||
if (state_ == TRANSITION) return;
|
||||
@ -589,7 +589,7 @@ void LookupIterator::PrepareTransitionToDataProperty(
|
||||
|
||||
Handle<Map> transition =
|
||||
Map::TransitionToDataProperty(isolate_, map, name_, value, attributes,
|
||||
kDefaultFieldConstness, store_mode);
|
||||
kDefaultFieldConstness, store_origin);
|
||||
state_ = TRANSITION;
|
||||
transition_ = transition;
|
||||
|
||||
|
@ -160,7 +160,7 @@ class V8_EXPORT_PRIVATE LookupIterator final {
|
||||
void PrepareTransitionToDataProperty(Handle<JSReceiver> receiver,
|
||||
Handle<Object> value,
|
||||
PropertyAttributes attributes,
|
||||
Object::StoreFromKeyed store_mode);
|
||||
StoreOrigin store_origin);
|
||||
inline bool IsCacheableTransition();
|
||||
void ApplyTransitionToDataProperty(Handle<JSReceiver> receiver);
|
||||
void ReconfigureDataProperty(Handle<Object> value,
|
||||
|
@ -764,7 +764,7 @@ MaybeHandle<Object> Object::SetElement(Isolate* isolate, Handle<Object> object,
|
||||
LanguageMode language_mode) {
|
||||
LookupIterator it(isolate, object, index);
|
||||
MAYBE_RETURN_NULL(
|
||||
SetProperty(&it, value, language_mode, MAY_BE_STORE_FROM_KEYED));
|
||||
SetProperty(&it, value, language_mode, StoreOrigin::kMaybeKeyed));
|
||||
return value;
|
||||
}
|
||||
|
||||
@ -2730,9 +2730,9 @@ MaybeHandle<Object> Object::SetPropertyOrElement(Isolate* isolate,
|
||||
Handle<Name> name,
|
||||
Handle<Object> value,
|
||||
LanguageMode language_mode,
|
||||
StoreFromKeyed store_mode) {
|
||||
StoreOrigin store_origin) {
|
||||
LookupIterator it = LookupIterator::PropertyOrElement(isolate, object, name);
|
||||
MAYBE_RETURN_NULL(SetProperty(&it, value, language_mode, store_mode));
|
||||
MAYBE_RETURN_NULL(SetProperty(&it, value, language_mode, store_origin));
|
||||
return value;
|
||||
}
|
||||
|
||||
|
@ -2222,9 +2222,8 @@ V8_WARN_UNUSED_RESULT Maybe<bool> FastAssign(
|
||||
|
||||
if (use_set) {
|
||||
LookupIterator it(target, next_key, target);
|
||||
Maybe<bool> result =
|
||||
Object::SetProperty(&it, prop_value, LanguageMode::kStrict,
|
||||
Object::CERTAINLY_NOT_STORE_FROM_KEYED);
|
||||
Maybe<bool> result = Object::SetProperty(
|
||||
&it, prop_value, LanguageMode::kStrict, StoreOrigin::kNamed);
|
||||
if (result.IsNothing()) return result;
|
||||
if (stable) stable = from->map() == *map;
|
||||
} else {
|
||||
@ -2287,7 +2286,8 @@ Maybe<bool> JSReceiver::SetOrCopyDataProperties(
|
||||
ASSIGN_RETURN_ON_EXCEPTION_VALUE(
|
||||
isolate, status,
|
||||
Runtime::SetObjectProperty(isolate, target, next_key, prop_value,
|
||||
LanguageMode::kStrict),
|
||||
LanguageMode::kStrict,
|
||||
StoreOrigin::kMaybeKeyed),
|
||||
Nothing<bool>());
|
||||
} else {
|
||||
if (excluded_properties != nullptr &&
|
||||
@ -5014,18 +5014,16 @@ Maybe<bool> JSObject::SetPropertyWithInterceptor(LookupIterator* it,
|
||||
MaybeHandle<Object> Object::SetProperty(Isolate* isolate, Handle<Object> object,
|
||||
Handle<Name> name, Handle<Object> value,
|
||||
LanguageMode language_mode,
|
||||
StoreFromKeyed store_mode) {
|
||||
StoreOrigin store_origin) {
|
||||
LookupIterator it(isolate, object, name);
|
||||
MAYBE_RETURN_NULL(SetProperty(&it, value, language_mode, store_mode));
|
||||
MAYBE_RETURN_NULL(SetProperty(&it, value, language_mode, store_origin));
|
||||
return value;
|
||||
}
|
||||
|
||||
|
||||
Maybe<bool> Object::SetPropertyInternal(LookupIterator* it,
|
||||
Handle<Object> value,
|
||||
LanguageMode language_mode,
|
||||
StoreFromKeyed store_mode,
|
||||
bool* found) {
|
||||
StoreOrigin store_origin, bool* found) {
|
||||
it->UpdateProtector();
|
||||
DCHECK(it->IsFound());
|
||||
ShouldThrow should_throw =
|
||||
@ -5130,14 +5128,13 @@ Maybe<bool> Object::SetPropertyInternal(LookupIterator* it,
|
||||
return Nothing<bool>();
|
||||
}
|
||||
|
||||
|
||||
Maybe<bool> Object::SetProperty(LookupIterator* it, Handle<Object> value,
|
||||
LanguageMode language_mode,
|
||||
StoreFromKeyed store_mode) {
|
||||
StoreOrigin store_origin) {
|
||||
if (it->IsFound()) {
|
||||
bool found = true;
|
||||
Maybe<bool> result =
|
||||
SetPropertyInternal(it, value, language_mode, store_mode, &found);
|
||||
SetPropertyInternal(it, value, language_mode, store_origin, &found);
|
||||
if (found) return result;
|
||||
}
|
||||
|
||||
@ -5152,19 +5149,18 @@ Maybe<bool> Object::SetProperty(LookupIterator* it, Handle<Object> value,
|
||||
|
||||
ShouldThrow should_throw =
|
||||
is_sloppy(language_mode) ? kDontThrow : kThrowOnError;
|
||||
return AddDataProperty(it, value, NONE, should_throw, store_mode);
|
||||
return AddDataProperty(it, value, NONE, should_throw, store_origin);
|
||||
}
|
||||
|
||||
|
||||
Maybe<bool> Object::SetSuperProperty(LookupIterator* it, Handle<Object> value,
|
||||
LanguageMode language_mode,
|
||||
StoreFromKeyed store_mode) {
|
||||
StoreOrigin store_origin) {
|
||||
Isolate* isolate = it->isolate();
|
||||
|
||||
if (it->IsFound()) {
|
||||
bool found = true;
|
||||
Maybe<bool> result =
|
||||
SetPropertyInternal(it, value, language_mode, store_mode, &found);
|
||||
SetPropertyInternal(it, value, language_mode, store_origin, &found);
|
||||
if (found) return result;
|
||||
}
|
||||
|
||||
@ -5243,7 +5239,7 @@ Maybe<bool> Object::SetSuperProperty(LookupIterator* it, Handle<Object> value,
|
||||
}
|
||||
}
|
||||
|
||||
return AddDataProperty(&own_lookup, value, NONE, should_throw, store_mode);
|
||||
return AddDataProperty(&own_lookup, value, NONE, should_throw, store_origin);
|
||||
}
|
||||
|
||||
Maybe<bool> Object::CannotCreateProperty(Isolate* isolate,
|
||||
@ -5340,11 +5336,10 @@ Maybe<bool> Object::SetDataProperty(LookupIterator* it, Handle<Object> value) {
|
||||
return Just(true);
|
||||
}
|
||||
|
||||
|
||||
Maybe<bool> Object::AddDataProperty(LookupIterator* it, Handle<Object> value,
|
||||
PropertyAttributes attributes,
|
||||
ShouldThrow should_throw,
|
||||
StoreFromKeyed store_mode) {
|
||||
StoreOrigin store_origin) {
|
||||
if (!it->GetReceiver()->IsJSReceiver()) {
|
||||
return CannotCreateProperty(it->isolate(), it->GetReceiver(), it->GetName(),
|
||||
value, should_throw);
|
||||
@ -5406,7 +5401,7 @@ Maybe<bool> Object::AddDataProperty(LookupIterator* it, Handle<Object> value,
|
||||
// Migrate to the most up-to-date map that will be able to store |value|
|
||||
// under it->name() with |attributes|.
|
||||
it->PrepareTransitionToDataProperty(receiver, value, attributes,
|
||||
store_mode);
|
||||
store_origin);
|
||||
DCHECK_EQ(LookupIterator::TRANSITION, it->state());
|
||||
it->ApplyTransitionToDataProperty(receiver);
|
||||
|
||||
@ -5885,7 +5880,7 @@ Maybe<bool> JSProxy::SetProperty(Handle<JSProxy> proxy, Handle<Name> name,
|
||||
LookupIterator it =
|
||||
LookupIterator::PropertyOrElement(isolate, receiver, name, target);
|
||||
return Object::SetSuperProperty(&it, value, language_mode,
|
||||
Object::MAY_BE_STORE_FROM_KEYED);
|
||||
StoreOrigin::kMaybeKeyed);
|
||||
}
|
||||
|
||||
Handle<Object> trap_result;
|
||||
@ -6251,7 +6246,7 @@ void JSObject::AddProperty(Isolate* isolate, Handle<JSObject> object,
|
||||
DCHECK(object->map()->is_extensible() || name->IsPrivate());
|
||||
#endif
|
||||
CHECK(AddDataProperty(&it, value, attributes, kThrowOnError,
|
||||
CERTAINLY_NOT_STORE_FROM_KEYED)
|
||||
StoreOrigin::kNamed)
|
||||
.IsJust());
|
||||
}
|
||||
|
||||
@ -6354,7 +6349,7 @@ Maybe<bool> JSObject::DefineOwnPropertyIgnoreAttributes(
|
||||
}
|
||||
|
||||
return AddDataProperty(it, value, attributes, should_throw,
|
||||
CERTAINLY_NOT_STORE_FROM_KEYED);
|
||||
StoreOrigin::kNamed);
|
||||
}
|
||||
|
||||
MaybeHandle<Object> JSObject::SetOwnPropertyIgnoreAttributes(
|
||||
@ -9968,7 +9963,7 @@ Handle<Map> Map::TransitionToDataProperty(Isolate* isolate, Handle<Map> map,
|
||||
Handle<Object> value,
|
||||
PropertyAttributes attributes,
|
||||
PropertyConstness constness,
|
||||
StoreFromKeyed store_mode) {
|
||||
StoreOrigin store_origin) {
|
||||
RuntimeCallTimerScope stats_scope(
|
||||
isolate, *map,
|
||||
map->is_prototype_map()
|
||||
@ -9997,7 +9992,7 @@ Handle<Map> Map::TransitionToDataProperty(Isolate* isolate, Handle<Map> map,
|
||||
|
||||
TransitionFlag flag = INSERT_TRANSITION;
|
||||
MaybeHandle<Map> maybe_map;
|
||||
if (!map->TooManyFastProperties(store_mode)) {
|
||||
if (!map->TooManyFastProperties(store_origin)) {
|
||||
if (!FLAG_track_constant_fields && value->IsJSFunction()) {
|
||||
maybe_map =
|
||||
Map::CopyWithConstant(isolate, map, name, value, attributes, flag);
|
||||
@ -10173,7 +10168,7 @@ Handle<Map> Map::TransitionToAccessorProperty(Isolate* isolate, Handle<Map> map,
|
||||
|
||||
pair = AccessorPair::Copy(isolate, Handle<AccessorPair>::cast(maybe_pair));
|
||||
} else if (map->NumberOfOwnDescriptors() >= kMaxNumberOfDescriptors ||
|
||||
map->TooManyFastProperties(CERTAINLY_NOT_STORE_FROM_KEYED)) {
|
||||
map->TooManyFastProperties(StoreOrigin::kNamed)) {
|
||||
return Map::Normalize(isolate, map, CLEAR_INOBJECT_PROPERTIES,
|
||||
"TooManyAccessors");
|
||||
} else {
|
||||
|
@ -1144,13 +1144,6 @@ class Object {
|
||||
V8_INLINE bool IsNullOrUndefined(ReadOnlyRoots roots) const;
|
||||
V8_INLINE bool IsNullOrUndefined() const;
|
||||
|
||||
// A non-keyed store is of the form a.x = foo or a["x"] = foo whereas
|
||||
// a keyed store is of the form a[expression] = foo.
|
||||
enum StoreFromKeyed {
|
||||
MAY_BE_STORE_FROM_KEYED,
|
||||
CERTAINLY_NOT_STORE_FROM_KEYED
|
||||
};
|
||||
|
||||
enum class Conversion { kToNumber, kToNumeric };
|
||||
|
||||
#define RETURN_FAILURE(isolate, should_throw, call) \
|
||||
@ -1357,19 +1350,19 @@ class Object {
|
||||
// covered by it (eg., concerning API callbacks).
|
||||
V8_WARN_UNUSED_RESULT static Maybe<bool> SetProperty(
|
||||
LookupIterator* it, Handle<Object> value, LanguageMode language_mode,
|
||||
StoreFromKeyed store_mode);
|
||||
StoreOrigin store_origin);
|
||||
V8_WARN_UNUSED_RESULT static MaybeHandle<Object> SetProperty(
|
||||
Isolate* isolate, Handle<Object> object, Handle<Name> name,
|
||||
Handle<Object> value, LanguageMode language_mode,
|
||||
StoreFromKeyed store_mode = MAY_BE_STORE_FROM_KEYED);
|
||||
StoreOrigin store_origin = StoreOrigin::kMaybeKeyed);
|
||||
V8_WARN_UNUSED_RESULT static inline MaybeHandle<Object> SetPropertyOrElement(
|
||||
Isolate* isolate, Handle<Object> object, Handle<Name> name,
|
||||
Handle<Object> value, LanguageMode language_mode,
|
||||
StoreFromKeyed store_mode = MAY_BE_STORE_FROM_KEYED);
|
||||
StoreOrigin store_origin = StoreOrigin::kMaybeKeyed);
|
||||
|
||||
V8_WARN_UNUSED_RESULT static Maybe<bool> SetSuperProperty(
|
||||
LookupIterator* it, Handle<Object> value, LanguageMode language_mode,
|
||||
StoreFromKeyed store_mode);
|
||||
StoreOrigin store_origin);
|
||||
|
||||
V8_WARN_UNUSED_RESULT static Maybe<bool> CannotCreateProperty(
|
||||
Isolate* isolate, Handle<Object> receiver, Handle<Object> name,
|
||||
@ -1386,7 +1379,7 @@ class Object {
|
||||
LookupIterator* it, Handle<Object> value);
|
||||
V8_WARN_UNUSED_RESULT static Maybe<bool> AddDataProperty(
|
||||
LookupIterator* it, Handle<Object> value, PropertyAttributes attributes,
|
||||
ShouldThrow should_throw, StoreFromKeyed store_mode);
|
||||
ShouldThrow should_throw, StoreOrigin store_origin);
|
||||
V8_WARN_UNUSED_RESULT static inline MaybeHandle<Object> GetPropertyOrElement(
|
||||
Isolate* isolate, Handle<Object> object, Handle<Name> name);
|
||||
V8_WARN_UNUSED_RESULT static inline MaybeHandle<Object> GetPropertyOrElement(
|
||||
@ -1508,7 +1501,7 @@ class Object {
|
||||
// Return value is only meaningful if [found] is set to true on return.
|
||||
V8_WARN_UNUSED_RESULT static Maybe<bool> SetPropertyInternal(
|
||||
LookupIterator* it, Handle<Object> value, LanguageMode language_mode,
|
||||
StoreFromKeyed store_mode, bool* found);
|
||||
StoreOrigin store_origin, bool* found);
|
||||
|
||||
V8_WARN_UNUSED_RESULT static MaybeHandle<Name> ConvertToName(
|
||||
Isolate* isolate, Handle<Object> input);
|
||||
|
@ -136,10 +136,10 @@ bool Map::IsUnboxedDoubleField(FieldIndex index) const {
|
||||
return !layout_descriptor()->IsTagged(index.property_index());
|
||||
}
|
||||
|
||||
bool Map::TooManyFastProperties(StoreFromKeyed store_mode) const {
|
||||
bool Map::TooManyFastProperties(StoreOrigin store_origin) const {
|
||||
if (UnusedPropertyFields() != 0) return false;
|
||||
if (is_prototype_map()) return false;
|
||||
int minimum = store_mode == CERTAINLY_NOT_STORE_FROM_KEYED ? 128 : 12;
|
||||
int minimum = store_origin == StoreOrigin::kNamed ? 128 : 12;
|
||||
int limit = Max(minimum, GetInObjectProperties());
|
||||
int external = NumberOfFields() - GetInObjectProperties();
|
||||
return external > limit;
|
||||
|
@ -693,13 +693,13 @@ class Map : public HeapObject {
|
||||
// Maximal number of fast properties. Used to restrict the number of map
|
||||
// transitions to avoid an explosion in the number of maps for objects used as
|
||||
// dictionaries.
|
||||
inline bool TooManyFastProperties(StoreFromKeyed store_mode) const;
|
||||
inline bool TooManyFastProperties(StoreOrigin store_origin) const;
|
||||
static Handle<Map> TransitionToDataProperty(Isolate* isolate, Handle<Map> map,
|
||||
Handle<Name> name,
|
||||
Handle<Object> value,
|
||||
PropertyAttributes attributes,
|
||||
PropertyConstness constness,
|
||||
StoreFromKeyed store_mode);
|
||||
StoreOrigin store_origin);
|
||||
static Handle<Map> TransitionToAccessorProperty(
|
||||
Isolate* isolate, Handle<Map> map, Handle<Name> name, int descriptor,
|
||||
Handle<Object> getter, Handle<Object> setter,
|
||||
|
@ -731,9 +731,9 @@ MaybeHandle<Object> StoreToSuper(Isolate* isolate, Handle<JSObject> home_object,
|
||||
SuperMode::kStore, name, 0),
|
||||
Object);
|
||||
LookupIterator it(receiver, name, holder);
|
||||
MAYBE_RETURN(Object::SetSuperProperty(&it, value, language_mode,
|
||||
Object::CERTAINLY_NOT_STORE_FROM_KEYED),
|
||||
MaybeHandle<Object>());
|
||||
MAYBE_RETURN(
|
||||
Object::SetSuperProperty(&it, value, language_mode, StoreOrigin::kNamed),
|
||||
MaybeHandle<Object>());
|
||||
return value;
|
||||
}
|
||||
|
||||
@ -750,7 +750,7 @@ MaybeHandle<Object> StoreElementToSuper(Isolate* isolate,
|
||||
Object);
|
||||
LookupIterator it(isolate, receiver, index, holder);
|
||||
MAYBE_RETURN(Object::SetSuperProperty(&it, value, language_mode,
|
||||
Object::MAY_BE_STORE_FROM_KEYED),
|
||||
StoreOrigin::kMaybeKeyed),
|
||||
MaybeHandle<Object>());
|
||||
return value;
|
||||
}
|
||||
|
@ -342,7 +342,8 @@ MaybeHandle<Object> Runtime::SetObjectProperty(Isolate* isolate,
|
||||
Handle<Object> object,
|
||||
Handle<Object> key,
|
||||
Handle<Object> value,
|
||||
LanguageMode language_mode) {
|
||||
LanguageMode language_mode,
|
||||
StoreOrigin store_origin) {
|
||||
if (object->IsNullOrUndefined(isolate)) {
|
||||
THROW_NEW_ERROR(
|
||||
isolate,
|
||||
@ -364,8 +365,9 @@ MaybeHandle<Object> Runtime::SetObjectProperty(Isolate* isolate,
|
||||
Object);
|
||||
}
|
||||
|
||||
MAYBE_RETURN_NULL(Object::SetProperty(&it, value, language_mode,
|
||||
Object::MAY_BE_STORE_FROM_KEYED));
|
||||
MAYBE_RETURN_NULL(
|
||||
Object::SetProperty(&it, value, language_mode, store_origin));
|
||||
|
||||
return value;
|
||||
}
|
||||
|
||||
@ -604,8 +606,7 @@ RUNTIME_FUNCTION(Runtime_AddElement) {
|
||||
object, index, value, NONE));
|
||||
}
|
||||
|
||||
|
||||
RUNTIME_FUNCTION(Runtime_SetProperty) {
|
||||
RUNTIME_FUNCTION(Runtime_SetKeyedProperty) {
|
||||
HandleScope scope(isolate);
|
||||
DCHECK_EQ(4, args.length());
|
||||
|
||||
@ -616,9 +617,23 @@ RUNTIME_FUNCTION(Runtime_SetProperty) {
|
||||
|
||||
RETURN_RESULT_OR_FAILURE(
|
||||
isolate,
|
||||
Runtime::SetObjectProperty(isolate, object, key, value, language_mode));
|
||||
Runtime::SetObjectProperty(isolate, object, key, value, language_mode,
|
||||
StoreOrigin::kMaybeKeyed));
|
||||
}
|
||||
|
||||
RUNTIME_FUNCTION(Runtime_SetNamedProperty) {
|
||||
HandleScope scope(isolate);
|
||||
DCHECK_EQ(4, args.length());
|
||||
|
||||
CONVERT_ARG_HANDLE_CHECKED(Object, object, 0);
|
||||
CONVERT_ARG_HANDLE_CHECKED(Object, key, 1);
|
||||
CONVERT_ARG_HANDLE_CHECKED(Object, value, 2);
|
||||
CONVERT_LANGUAGE_MODE_ARG_CHECKED(language_mode, 3);
|
||||
|
||||
RETURN_RESULT_OR_FAILURE(
|
||||
isolate, Runtime::SetObjectProperty(isolate, object, key, value,
|
||||
language_mode, StoreOrigin::kNamed));
|
||||
}
|
||||
|
||||
namespace {
|
||||
|
||||
@ -1234,7 +1249,7 @@ RUNTIME_FUNCTION(Runtime_AddPrivateField) {
|
||||
}
|
||||
|
||||
CHECK(Object::AddDataProperty(&it, value, NONE, kDontThrow,
|
||||
Object::MAY_BE_STORE_FROM_KEYED)
|
||||
StoreOrigin::kMaybeKeyed)
|
||||
.FromJust());
|
||||
return ReadOnlyRoots(isolate).undefined_value();
|
||||
}
|
||||
|
@ -77,8 +77,8 @@ RUNTIME_FUNCTION(Runtime_SetPropertyWithReceiver) {
|
||||
DCHECK(isolate->has_pending_exception());
|
||||
return ReadOnlyRoots(isolate).exception();
|
||||
}
|
||||
Maybe<bool> result = Object::SetSuperProperty(
|
||||
&it, value, language_mode, Object::MAY_BE_STORE_FROM_KEYED);
|
||||
Maybe<bool> result = Object::SetSuperProperty(&it, value, language_mode,
|
||||
StoreOrigin::kMaybeKeyed);
|
||||
MAYBE_RETURN(result, ReadOnlyRoots(isolate).exception());
|
||||
return *isolate->factory()->ToBoolean(result.FromJust());
|
||||
}
|
||||
|
@ -331,7 +331,8 @@ namespace internal {
|
||||
F(SameValue, 2, 1) \
|
||||
F(SameValueZero, 2, 1) \
|
||||
F(SetDataProperties, 2, 1) \
|
||||
F(SetProperty, 4, 1) \
|
||||
F(SetKeyedProperty, 4, 1) \
|
||||
F(SetNamedProperty, 4, 1) \
|
||||
F(ShrinkPropertyDictionary, 1, 1) \
|
||||
F(ToFastProperties, 1, 1) \
|
||||
F(ToInteger, 1, 1) \
|
||||
@ -687,7 +688,8 @@ class Runtime : public AllStatic {
|
||||
|
||||
V8_WARN_UNUSED_RESULT static MaybeHandle<Object> SetObjectProperty(
|
||||
Isolate* isolate, Handle<Object> object, Handle<Object> key,
|
||||
Handle<Object> value, LanguageMode language_mode);
|
||||
Handle<Object> value, LanguageMode language_mode,
|
||||
StoreOrigin store_origin);
|
||||
|
||||
V8_WARN_UNUSED_RESULT static MaybeHandle<Object> GetObjectProperty(
|
||||
Isolate* isolate, Handle<Object> object, Handle<Object> key,
|
||||
|
@ -37,7 +37,7 @@ bytecodes: [
|
||||
B(LdaZero),
|
||||
B(Star), R(5),
|
||||
B(Mov), R(1), R(2),
|
||||
/* 50 E> */ B(CallRuntime), U16(Runtime::kSetProperty), R(2), U8(4),
|
||||
/* 50 E> */ B(CallRuntime), U16(Runtime::kSetNamedProperty), R(2), U8(4),
|
||||
/* 63 S> */ B(LdaGlobal), U8(0), U8(2),
|
||||
B(Star), R(1),
|
||||
/* 70 E> */ B(LdaGlobal), U8(0), U8(2),
|
||||
@ -52,7 +52,7 @@ bytecodes: [
|
||||
B(LdaZero),
|
||||
B(Star), R(5),
|
||||
B(Mov), R(1), R(2),
|
||||
/* 68 E> */ B(CallRuntime), U16(Runtime::kSetProperty), R(2), U8(4),
|
||||
/* 68 E> */ B(CallRuntime), U16(Runtime::kSetNamedProperty), R(2), U8(4),
|
||||
/* 84 S> */ B(LdaConstant), U8(3),
|
||||
B(Star), R(3),
|
||||
B(Mov), R(0), R(2),
|
||||
@ -301,7 +301,7 @@ bytecodes: [
|
||||
B(LdaZero),
|
||||
B(Star), R(5),
|
||||
B(Mov), R(1), R(2),
|
||||
/* 126 E> */ B(CallRuntime), U16(Runtime::kSetProperty), R(2), U8(4),
|
||||
/* 126 E> */ B(CallRuntime), U16(Runtime::kSetNamedProperty), R(2), U8(4),
|
||||
B(Jump), U8(40),
|
||||
/* 158 S> */ B(LdaGlobal), U8(1), U8(2),
|
||||
B(Star), R(1),
|
||||
@ -317,7 +317,7 @@ bytecodes: [
|
||||
B(LdaZero),
|
||||
B(Star), R(5),
|
||||
B(Mov), R(1), R(2),
|
||||
/* 163 E> */ B(CallRuntime), U16(Runtime::kSetProperty), R(2), U8(4),
|
||||
/* 163 E> */ B(CallRuntime), U16(Runtime::kSetNamedProperty), R(2), U8(4),
|
||||
/* 189 S> */ B(LdaConstant), U8(4),
|
||||
B(Star), R(3),
|
||||
B(Mov), R(0), R(2),
|
||||
|
@ -246,7 +246,7 @@ bytecodes: [
|
||||
B(Star), R(5),
|
||||
B(Mov), R(1), R(2),
|
||||
B(Mov), R(0), R(4),
|
||||
/* 57 E> */ B(CallRuntime), U16(Runtime::kSetProperty), R(2), U8(4),
|
||||
/* 57 E> */ B(CallRuntime), U16(Runtime::kSetKeyedProperty), R(2), U8(4),
|
||||
B(Ldar), R(2),
|
||||
/* 61 S> */ B(Return),
|
||||
]
|
||||
|
@ -55,7 +55,7 @@ bytecodes: [
|
||||
B(LdaZero),
|
||||
B(Star), R(5),
|
||||
B(Mov), R(1), R(2),
|
||||
/* 94 E> */ B(CallRuntime), U16(Runtime::kSetProperty), R(2), U8(4),
|
||||
/* 94 E> */ B(CallRuntime), U16(Runtime::kSetNamedProperty), R(2), U8(4),
|
||||
/* 105 S> */ B(LdaGlobal), U8(1), U8(3),
|
||||
B(Star), R(1),
|
||||
/* 114 E> */ B(LdaGlobal), U8(1), U8(3),
|
||||
@ -71,7 +71,7 @@ bytecodes: [
|
||||
B(Star), R(6),
|
||||
B(Mov), R(1), R(3),
|
||||
B(Mov), R(2), R(5),
|
||||
/* 112 E> */ B(CallRuntime), U16(Runtime::kSetProperty), R(3), U8(4),
|
||||
/* 112 E> */ B(CallRuntime), U16(Runtime::kSetNamedProperty), R(3), U8(4),
|
||||
B(Mov), R(5), R(0),
|
||||
B(Ldar), R(0),
|
||||
/* 128 S> */ B(Return),
|
||||
@ -338,7 +338,7 @@ bytecodes: [
|
||||
B(Star), R(6),
|
||||
B(Mov), R(1), R(3),
|
||||
B(Mov), R(2), R(5),
|
||||
/* 96 E> */ B(CallRuntime), U16(Runtime::kSetProperty), R(3), U8(4),
|
||||
/* 96 E> */ B(CallRuntime), U16(Runtime::kSetNamedProperty), R(3), U8(4),
|
||||
B(Mov), R(5), R(0),
|
||||
B(Ldar), R(2),
|
||||
B(Jump), U8(34),
|
||||
@ -352,7 +352,7 @@ bytecodes: [
|
||||
B(Star), R(6),
|
||||
B(Mov), R(1), R(3),
|
||||
B(Mov), R(2), R(5),
|
||||
/* 131 E> */ B(CallRuntime), U16(Runtime::kSetProperty), R(3), U8(4),
|
||||
/* 131 E> */ B(CallRuntime), U16(Runtime::kSetNamedProperty), R(3), U8(4),
|
||||
B(Mov), R(5), R(0),
|
||||
B(Ldar), R(2),
|
||||
B(Ldar), R(0),
|
||||
|
@ -23877,8 +23877,9 @@ TEST(AccessCheckThrows) {
|
||||
CheckCorrectThrow("JSON.stringify(other)");
|
||||
CheckCorrectThrow("has_own_property(other, 'x')");
|
||||
CheckCorrectThrow("%GetProperty(other, 'x')");
|
||||
CheckCorrectThrow("%SetProperty(other, 'x', 'foo', 0)");
|
||||
CheckCorrectThrow("%SetKeyedProperty(other, 'x', 'foo', 0)");
|
||||
CheckCorrectThrow("%AddNamedProperty(other, 'x', 'foo', 1)");
|
||||
CheckCorrectThrow("%SetNamedProperty(other, 'y', 'foo', 1)");
|
||||
STATIC_ASSERT(static_cast<int>(i::LanguageMode::kSloppy) == 0);
|
||||
STATIC_ASSERT(static_cast<int>(i::LanguageMode::kStrict) == 1);
|
||||
CheckCorrectThrow("%DeleteProperty(other, 'x', 0)"); // 0 == SLOPPY
|
||||
|
@ -55,7 +55,7 @@ static void SetGlobalProperty(const char* name, Object* value) {
|
||||
isolate->factory()->InternalizeUtf8String(name);
|
||||
Handle<JSObject> global(isolate->context()->global_object(), isolate);
|
||||
Runtime::SetObjectProperty(isolate, global, internalized_name, object,
|
||||
LanguageMode::kSloppy)
|
||||
LanguageMode::kSloppy, StoreOrigin::kMaybeKeyed)
|
||||
.Check();
|
||||
}
|
||||
|
||||
|
@ -370,9 +370,8 @@ class Expectations {
|
||||
heap_type);
|
||||
|
||||
Handle<String> name = MakeName("prop", property_index);
|
||||
return Map::TransitionToDataProperty(
|
||||
isolate_, map, name, value, attributes, constness,
|
||||
Object::CERTAINLY_NOT_STORE_FROM_KEYED);
|
||||
return Map::TransitionToDataProperty(isolate_, map, name, value, attributes,
|
||||
constness, StoreOrigin::kNamed);
|
||||
}
|
||||
|
||||
Handle<Map> TransitionToDataConstant(Handle<Map> map,
|
||||
@ -383,9 +382,9 @@ class Expectations {
|
||||
SetDataConstant(property_index, attributes, value);
|
||||
|
||||
Handle<String> name = MakeName("prop", property_index);
|
||||
return Map::TransitionToDataProperty(
|
||||
isolate_, map, name, value, attributes, PropertyConstness::kConst,
|
||||
Object::CERTAINLY_NOT_STORE_FROM_KEYED);
|
||||
return Map::TransitionToDataProperty(isolate_, map, name, value, attributes,
|
||||
PropertyConstness::kConst,
|
||||
StoreOrigin::kNamed);
|
||||
}
|
||||
|
||||
Handle<Map> FollowDataTransition(Handle<Map> map,
|
||||
|
@ -125,8 +125,7 @@ TEST(GetStringOption) {
|
||||
Handle<String> key = isolate->factory()->NewStringFromAsciiChecked("foo");
|
||||
v8::internal::LookupIterator it(isolate, options, key);
|
||||
CHECK(Object::SetProperty(&it, Handle<Smi>(Smi::FromInt(42), isolate),
|
||||
LanguageMode::kStrict,
|
||||
AllocationMemento::MAY_BE_STORE_FROM_KEYED)
|
||||
LanguageMode::kStrict, StoreOrigin::kMaybeKeyed)
|
||||
.FromJust());
|
||||
|
||||
{
|
||||
|
@ -16,4 +16,4 @@ f(str, 0);
|
||||
f(str, 0);
|
||||
|
||||
// This is just to trigger elements validation, object already broken.
|
||||
%SetProperty(str, 1, 'y', 0);
|
||||
%SetKeyedProperty(str, 1, 'y', 0);
|
||||
|
Loading…
Reference in New Issue
Block a user