Revert "Change SetProperty/SetSuperProperty to infer language mode when possible"
This reverts commit 0896599f6f
.
Reason for revert: Speculative revert, seems to cause a layout test failure blocking the LKGR - https://ci.chromium.org/p/v8/builders/luci.v8.ci/V8-Blink%20Linux%2064/29320
Original change's description:
> Change SetProperty/SetSuperProperty to infer language mode when possible
>
> In most cases, the language mode can be inferred from the closure and
> the context. Computing the language mode instead of passing it around
> simplifies the ICs and will make it possible to go towards lazily
> allocating feedback vectors. Currently ICs obtain the language mode from
> the feedback vectors and with lazy feedback allocation we may not always
> have feedback vectors. Since computing language mode is a bit expensive
> we want to defer it as far as possible.
>
> In Array builtins and other builtins like Reflect.Set we need to force a
> language mode when setting the properties. To support these cases the
> SetProperty methods allow the language mode to be overridden when needed.
>
> This is a first cl in a series of cls, that will defer the language mode
> computation further and remove language mode where it is not needed.
>
> BUG: v8:8580
> Change-Id: I9c2396e3bcfe77c3c9d6760c46d86954d54744b9
> Reviewed-on: https://chromium-review.googlesource.com/c/1409426
> Reviewed-by: Michael Lippautz <mlippautz@chromium.org>
> Reviewed-by: Jakob Gruber <jgruber@chromium.org>
> Reviewed-by: Toon Verwaest <verwaest@chromium.org>
> Commit-Queue: Mythri Alle <mythria@chromium.org>
> Cr-Commit-Position: refs/heads/master@{#58893}
TBR=mlippautz@chromium.org,mythria@chromium.org,jgruber@chromium.org,verwaest@chromium.org
Change-Id: I2e0f80a4577a8ca86c05a62205f9dfa488418a52
No-Presubmit: true
No-Tree-Checks: true
No-Try: true
Reviewed-on: https://chromium-review.googlesource.com/c/1420758
Reviewed-by: Maya Lekova <mslekova@chromium.org>
Commit-Queue: Maya Lekova <mslekova@chromium.org>
Cr-Commit-Position: refs/heads/master@{#58911}
This commit is contained in:
parent
c7b4febca5
commit
697885b9df
@ -796,8 +796,7 @@ MaybeHandle<JSReceiver> ClearInternalStackTrace(Isolate* isolate,
|
||||
isolate,
|
||||
Object::SetProperty(
|
||||
isolate, error, isolate->factory()->stack_trace_symbol(),
|
||||
isolate->factory()->undefined_value(), StoreOrigin::kMaybeKeyed,
|
||||
Just(LanguageMode::kStrict)),
|
||||
isolate->factory()->undefined_value(), LanguageMode::kStrict),
|
||||
JSReceiver);
|
||||
return error;
|
||||
}
|
||||
|
@ -176,8 +176,7 @@ V8_WARN_UNUSED_RESULT MaybeHandle<Object> SetLengthProperty(
|
||||
|
||||
return Object::SetProperty(
|
||||
isolate, receiver, isolate->factory()->length_string(),
|
||||
isolate->factory()->NewNumber(length), StoreOrigin::kMaybeKeyed,
|
||||
Just(LanguageMode::kStrict));
|
||||
isolate->factory()->NewNumber(length), LanguageMode::kStrict);
|
||||
}
|
||||
|
||||
V8_WARN_UNUSED_RESULT Object GenericArrayFill(Isolate* isolate,
|
||||
@ -193,7 +192,7 @@ V8_WARN_UNUSED_RESULT Object GenericArrayFill(Isolate* isolate,
|
||||
// b. Perform ? Set(O, Pk, value, true).
|
||||
RETURN_FAILURE_ON_EXCEPTION(
|
||||
isolate, Object::SetPropertyOrElement(isolate, receiver, index, value,
|
||||
Just(LanguageMode::kStrict)));
|
||||
LanguageMode::kStrict));
|
||||
|
||||
// c. Increase k by 1.
|
||||
++start;
|
||||
@ -340,8 +339,8 @@ V8_WARN_UNUSED_RESULT Object GenericArrayPush(Isolate* isolate,
|
||||
isolate, receiver, isolate->factory()->NewNumber(length), &success);
|
||||
// Must succeed since we always pass a valid key.
|
||||
DCHECK(success);
|
||||
MAYBE_RETURN(Object::SetProperty(&it, element, StoreOrigin::kMaybeKeyed,
|
||||
Just(LanguageMode::kStrict)),
|
||||
MAYBE_RETURN(Object::SetProperty(&it, element, LanguageMode::kStrict,
|
||||
StoreOrigin::kMaybeKeyed),
|
||||
ReadOnlyRoots(isolate).exception());
|
||||
}
|
||||
|
||||
@ -354,8 +353,7 @@ V8_WARN_UNUSED_RESULT Object GenericArrayPush(Isolate* isolate,
|
||||
RETURN_FAILURE_ON_EXCEPTION(
|
||||
isolate, Object::SetProperty(isolate, receiver,
|
||||
isolate->factory()->length_string(),
|
||||
final_length, StoreOrigin::kMaybeKeyed,
|
||||
Just(LanguageMode::kStrict)));
|
||||
final_length, LanguageMode::kStrict));
|
||||
|
||||
// 8. Return len.
|
||||
return *final_length;
|
||||
@ -410,8 +408,7 @@ V8_WARN_UNUSED_RESULT Object GenericArrayPop(Isolate* isolate,
|
||||
RETURN_FAILURE_ON_EXCEPTION(
|
||||
isolate, Object::SetProperty(
|
||||
isolate, receiver, isolate->factory()->length_string(),
|
||||
Handle<Smi>(Smi::zero(), isolate),
|
||||
StoreOrigin::kMaybeKeyed, Just(LanguageMode::kStrict)));
|
||||
Handle<Smi>(Smi::zero(), isolate), LanguageMode::kStrict));
|
||||
|
||||
// b. Return undefined.
|
||||
return ReadOnlyRoots(isolate).undefined_value();
|
||||
@ -438,8 +435,7 @@ V8_WARN_UNUSED_RESULT Object GenericArrayPop(Isolate* isolate,
|
||||
RETURN_FAILURE_ON_EXCEPTION(
|
||||
isolate, Object::SetProperty(isolate, receiver,
|
||||
isolate->factory()->length_string(),
|
||||
new_length, StoreOrigin::kMaybeKeyed,
|
||||
Just(LanguageMode::kStrict)));
|
||||
new_length, LanguageMode::kStrict));
|
||||
|
||||
// f. Return element.
|
||||
return *element;
|
||||
@ -530,7 +526,7 @@ V8_WARN_UNUSED_RESULT Object GenericArrayShift(Isolate* isolate,
|
||||
// ii. Perform ? Set(O, to, fromVal, true).
|
||||
RETURN_FAILURE_ON_EXCEPTION(
|
||||
isolate, Object::SetPropertyOrElement(isolate, receiver, to, from_val,
|
||||
Just(LanguageMode::kStrict)));
|
||||
LanguageMode::kStrict));
|
||||
} else { // e. Else fromPresent is false,
|
||||
// i. Perform ? DeletePropertyOrThrow(O, to).
|
||||
MAYBE_RETURN(JSReceiver::DeletePropertyOrElement(receiver, to,
|
||||
@ -735,9 +731,9 @@ class ArrayConcatVisitor {
|
||||
isolate_->factory()->NewNumber(static_cast<double>(index_offset_));
|
||||
RETURN_ON_EXCEPTION(
|
||||
isolate_,
|
||||
Object::SetProperty(
|
||||
isolate_, result, isolate_->factory()->length_string(), length,
|
||||
StoreOrigin::kMaybeKeyed, Just(LanguageMode::kStrict)),
|
||||
Object::SetProperty(isolate_, result,
|
||||
isolate_->factory()->length_string(), length,
|
||||
LanguageMode::kStrict),
|
||||
JSReceiver);
|
||||
return result;
|
||||
}
|
||||
|
@ -218,7 +218,7 @@ BUILTIN(ReflectSet) {
|
||||
LookupIterator it = LookupIterator::PropertyOrElement(
|
||||
isolate, receiver, name, Handle<JSReceiver>::cast(target));
|
||||
Maybe<bool> result = Object::SetSuperProperty(
|
||||
&it, value, StoreOrigin::kMaybeKeyed, Just(LanguageMode::kSloppy));
|
||||
&it, value, LanguageMode::kSloppy, StoreOrigin::kMaybeKeyed);
|
||||
MAYBE_RETURN(result, ReadOnlyRoots(isolate).exception());
|
||||
return *isolate->factory()->ToBoolean(result.FromJust());
|
||||
}
|
||||
|
@ -1724,8 +1724,7 @@ void Debug::OnException(Handle<Object> exception, Handle<Object> promise,
|
||||
Handle<JSObject> jspromise = Handle<JSObject>::cast(promise);
|
||||
// Mark the promise as already having triggered a message.
|
||||
Handle<Symbol> key = isolate_->factory()->promise_debug_marker_symbol();
|
||||
Object::SetProperty(isolate_, jspromise, key, key, StoreOrigin::kMaybeKeyed,
|
||||
Just(LanguageMode::kStrict))
|
||||
Object::SetProperty(isolate_, jspromise, key, key, LanguageMode::kStrict)
|
||||
.Assert();
|
||||
// Check whether the promise reject is considered an uncaught exception.
|
||||
uncaught = !isolate_->PromiseHasUserDefinedRejectHandler(jspromise);
|
||||
|
@ -3874,11 +3874,11 @@ Handle<JSObject> Factory::NewArgumentsObject(Handle<JSFunction> callee,
|
||||
Handle<JSObject> result = NewJSObjectFromMap(map);
|
||||
Handle<Smi> value(Smi::FromInt(length), isolate());
|
||||
Object::SetProperty(isolate(), result, length_string(), value,
|
||||
StoreOrigin::kMaybeKeyed, Just(LanguageMode::kStrict))
|
||||
LanguageMode::kStrict)
|
||||
.Assert();
|
||||
if (!strict_mode_callee) {
|
||||
Object::SetProperty(isolate(), result, callee_string(), callee,
|
||||
StoreOrigin::kMaybeKeyed, Just(LanguageMode::kStrict))
|
||||
LanguageMode::kStrict)
|
||||
.Assert();
|
||||
}
|
||||
return result;
|
||||
|
12
src/ic/ic.cc
12
src/ic/ic.cc
@ -1402,7 +1402,8 @@ MaybeHandle<Object> StoreIC::Store(Handle<Object> object, Handle<Name> name,
|
||||
if (MigrateDeprecated(object)) {
|
||||
Handle<Object> result;
|
||||
ASSIGN_RETURN_ON_EXCEPTION(
|
||||
isolate(), result, Object::SetProperty(isolate(), object, name, value),
|
||||
isolate(), result,
|
||||
Object::SetProperty(isolate(), object, name, value, language_mode()),
|
||||
Object);
|
||||
return result;
|
||||
}
|
||||
@ -1442,7 +1443,8 @@ MaybeHandle<Object> StoreIC::Store(Handle<Object> object, Handle<Name> name,
|
||||
}
|
||||
if (use_ic) UpdateCaches(&it, value, store_origin);
|
||||
|
||||
MAYBE_RETURN_NULL(Object::SetProperty(&it, value, store_origin));
|
||||
MAYBE_RETURN_NULL(
|
||||
Object::SetProperty(&it, value, language_mode(), store_origin));
|
||||
return value;
|
||||
}
|
||||
|
||||
@ -2857,6 +2859,7 @@ RUNTIME_FUNCTION(Runtime_StorePropertyWithInterceptor) {
|
||||
Handle<JSObject> receiver = args.at<JSObject>(3);
|
||||
Handle<Name> name = args.at<Name>(4);
|
||||
FeedbackSlot vector_slot = FeedbackVector::ToSlot(slot->value());
|
||||
LanguageMode language_mode = GetLanguageMode(vector, isolate->context());
|
||||
|
||||
// TODO(ishell): Cache interceptor_holder in the store handler like we do
|
||||
// for LoadHandler::kInterceptor case.
|
||||
@ -2889,8 +2892,9 @@ RUNTIME_FUNCTION(Runtime_StorePropertyWithInterceptor) {
|
||||
DCHECK_EQ(LookupIterator::INTERCEPTOR, it.state());
|
||||
it.Next();
|
||||
|
||||
MAYBE_RETURN(Object::SetProperty(&it, value, StoreOrigin::kNamed),
|
||||
ReadOnlyRoots(isolate).exception());
|
||||
MAYBE_RETURN(
|
||||
Object::SetProperty(&it, value, language_mode, StoreOrigin::kNamed),
|
||||
ReadOnlyRoots(isolate).exception());
|
||||
return *value;
|
||||
}
|
||||
|
||||
|
@ -940,12 +940,10 @@ MaybeHandle<JSReceiver> Isolate::CaptureAndSetDetailedStackTrace(
|
||||
Handle<FixedArray> stack_trace = CaptureCurrentStackTrace(
|
||||
stack_trace_for_uncaught_exceptions_frame_limit_,
|
||||
stack_trace_for_uncaught_exceptions_options_);
|
||||
RETURN_ON_EXCEPTION(
|
||||
this,
|
||||
Object::SetProperty(this, error_object, key, stack_trace,
|
||||
StoreOrigin::kMaybeKeyed,
|
||||
Just(LanguageMode::kStrict)),
|
||||
JSReceiver);
|
||||
RETURN_ON_EXCEPTION(this,
|
||||
Object::SetProperty(this, error_object, key,
|
||||
stack_trace, LanguageMode::kStrict),
|
||||
JSReceiver);
|
||||
}
|
||||
return error_object;
|
||||
}
|
||||
@ -959,8 +957,7 @@ MaybeHandle<JSReceiver> Isolate::CaptureAndSetSimpleStackTrace(
|
||||
CaptureSimpleStackTrace(error_object, mode, caller);
|
||||
RETURN_ON_EXCEPTION(this,
|
||||
Object::SetProperty(this, error_object, key, stack_trace,
|
||||
StoreOrigin::kMaybeKeyed,
|
||||
Just(LanguageMode::kStrict)),
|
||||
LanguageMode::kStrict),
|
||||
JSReceiver);
|
||||
return error_object;
|
||||
}
|
||||
|
@ -698,7 +698,7 @@ MaybeHandle<Object> Object::SetElement(Isolate* isolate, Handle<Object> object,
|
||||
LanguageMode language_mode) {
|
||||
LookupIterator it(isolate, object, index);
|
||||
MAYBE_RETURN_NULL(
|
||||
SetProperty(&it, value, StoreOrigin::kMaybeKeyed, Just(language_mode)));
|
||||
SetProperty(&it, value, language_mode, StoreOrigin::kMaybeKeyed));
|
||||
return value;
|
||||
}
|
||||
|
||||
@ -1177,12 +1177,14 @@ MaybeHandle<Object> Object::GetPropertyOrElement(Isolate* isolate,
|
||||
return GetProperty(&it);
|
||||
}
|
||||
|
||||
MaybeHandle<Object> Object::SetPropertyOrElement(
|
||||
Isolate* isolate, Handle<Object> object, Handle<Name> name,
|
||||
Handle<Object> value, Maybe<LanguageMode> language_mode,
|
||||
StoreOrigin store_origin) {
|
||||
MaybeHandle<Object> Object::SetPropertyOrElement(Isolate* isolate,
|
||||
Handle<Object> object,
|
||||
Handle<Name> name,
|
||||
Handle<Object> value,
|
||||
LanguageMode language_mode,
|
||||
StoreOrigin store_origin) {
|
||||
LookupIterator it = LookupIterator::PropertyOrElement(isolate, object, name);
|
||||
MAYBE_RETURN_NULL(SetProperty(&it, value, store_origin, language_mode));
|
||||
MAYBE_RETURN_NULL(SetProperty(&it, value, language_mode, store_origin));
|
||||
return value;
|
||||
}
|
||||
|
||||
|
@ -122,36 +122,6 @@
|
||||
namespace v8 {
|
||||
namespace internal {
|
||||
|
||||
namespace {
|
||||
LanguageMode GetLanguageMode(Isolate* isolate,
|
||||
Maybe<LanguageMode> language_mode) {
|
||||
if (language_mode.IsJust()) return language_mode.FromJust();
|
||||
|
||||
LanguageMode mode = isolate->context()->scope_info()->language_mode();
|
||||
for (StackFrameIterator it(isolate); !it.done(); it.Advance()) {
|
||||
if (!(it.frame()->is_optimized() || it.frame()->is_interpreted())) {
|
||||
continue;
|
||||
}
|
||||
// Get the language mode from closure.
|
||||
JavaScriptFrame* js_frame = static_cast<JavaScriptFrame*>(it.frame());
|
||||
std::vector<SharedFunctionInfo> functions;
|
||||
js_frame->GetFunctions(&functions);
|
||||
LanguageMode closure_language_mode = functions.back()->language_mode();
|
||||
if (closure_language_mode > mode) {
|
||||
mode = closure_language_mode;
|
||||
}
|
||||
break;
|
||||
}
|
||||
return mode;
|
||||
}
|
||||
|
||||
ShouldThrow GetShouldThrow(Isolate* isolate,
|
||||
Maybe<LanguageMode> language_mode) {
|
||||
return is_sloppy(GetLanguageMode(isolate, language_mode)) ? kDontThrow
|
||||
: kThrowOnError;
|
||||
}
|
||||
} // namespace
|
||||
|
||||
bool ComparisonResultToBool(Operation op, ComparisonResult result) {
|
||||
switch (op) {
|
||||
case Operation::kLessThan:
|
||||
@ -1832,6 +1802,7 @@ MaybeHandle<Object> Object::GetPropertyWithDefinedGetter(
|
||||
return Execution::Call(isolate, getter, receiver, 0, nullptr);
|
||||
}
|
||||
|
||||
|
||||
Maybe<bool> Object::SetPropertyWithDefinedSetter(Handle<Object> receiver,
|
||||
Handle<JSReceiver> setter,
|
||||
Handle<Object> value,
|
||||
@ -2298,7 +2269,7 @@ V8_WARN_UNUSED_RESULT Maybe<bool> FastAssign(
|
||||
if (use_set) {
|
||||
LookupIterator it(target, next_key, target);
|
||||
Maybe<bool> result = Object::SetProperty(
|
||||
&it, prop_value, StoreOrigin::kNamed, Just(LanguageMode::kStrict));
|
||||
&it, prop_value, LanguageMode::kStrict, StoreOrigin::kNamed);
|
||||
if (result.IsNothing()) return result;
|
||||
if (stable) stable = from->map() == *map;
|
||||
} else {
|
||||
@ -5204,20 +5175,21 @@ Maybe<bool> JSObject::SetPropertyWithInterceptor(LookupIterator* it,
|
||||
|
||||
MaybeHandle<Object> Object::SetProperty(Isolate* isolate, Handle<Object> object,
|
||||
Handle<Name> name, Handle<Object> value,
|
||||
StoreOrigin store_origin,
|
||||
Maybe<LanguageMode> language_mode) {
|
||||
LanguageMode language_mode,
|
||||
StoreOrigin store_origin) {
|
||||
LookupIterator it(isolate, object, name);
|
||||
MAYBE_RETURN_NULL(SetProperty(&it, value, store_origin, language_mode));
|
||||
MAYBE_RETURN_NULL(SetProperty(&it, value, language_mode, store_origin));
|
||||
return value;
|
||||
}
|
||||
|
||||
Maybe<bool> Object::SetPropertyInternal(LookupIterator* it,
|
||||
Handle<Object> value,
|
||||
Maybe<LanguageMode> language_mode,
|
||||
LanguageMode language_mode,
|
||||
StoreOrigin store_origin, bool* found) {
|
||||
it->UpdateProtector();
|
||||
DCHECK(it->IsFound());
|
||||
ShouldThrow should_throw = GetShouldThrow(it->isolate(), language_mode);
|
||||
ShouldThrow should_throw =
|
||||
is_sloppy(language_mode) ? kDontThrow : kThrowOnError;
|
||||
|
||||
// Make sure that the top context does not change when doing callbacks or
|
||||
// interceptor calls.
|
||||
@ -5243,9 +5215,8 @@ Maybe<bool> Object::SetPropertyInternal(LookupIterator* it,
|
||||
receiver = handle(JSGlobalObject::cast(*receiver)->global_proxy(),
|
||||
it->isolate());
|
||||
}
|
||||
return JSProxy::SetProperty(
|
||||
it->GetHolder<JSProxy>(), it->GetName(), value, receiver,
|
||||
GetLanguageMode(it->isolate(), language_mode));
|
||||
return JSProxy::SetProperty(it->GetHolder<JSProxy>(), it->GetName(),
|
||||
value, receiver, language_mode);
|
||||
}
|
||||
|
||||
case LookupIterator::INTERCEPTOR: {
|
||||
@ -5328,8 +5299,8 @@ Maybe<bool> Object::SetPropertyInternal(LookupIterator* it,
|
||||
}
|
||||
|
||||
Maybe<bool> Object::SetProperty(LookupIterator* it, Handle<Object> value,
|
||||
StoreOrigin store_origin,
|
||||
Maybe<LanguageMode> language_mode) {
|
||||
LanguageMode language_mode,
|
||||
StoreOrigin store_origin) {
|
||||
if (it->IsFound()) {
|
||||
bool found = true;
|
||||
Maybe<bool> result =
|
||||
@ -5340,21 +5311,20 @@ Maybe<bool> Object::SetProperty(LookupIterator* it, Handle<Object> value,
|
||||
// If the receiver is the JSGlobalObject, the store was contextual. In case
|
||||
// the property did not exist yet on the global object itself, we have to
|
||||
// throw a reference error in strict mode. In sloppy mode, we continue.
|
||||
if (is_strict(GetLanguageMode(it->isolate(), language_mode)) &&
|
||||
it->GetReceiver()->IsJSGlobalObject()) {
|
||||
if (is_strict(language_mode) && it->GetReceiver()->IsJSGlobalObject()) {
|
||||
it->isolate()->Throw(*it->isolate()->factory()->NewReferenceError(
|
||||
MessageTemplate::kNotDefined, it->name()));
|
||||
return Nothing<bool>();
|
||||
}
|
||||
|
||||
return AddDataProperty(it, value, NONE,
|
||||
GetShouldThrow(it->isolate(), language_mode),
|
||||
store_origin);
|
||||
ShouldThrow should_throw =
|
||||
is_sloppy(language_mode) ? kDontThrow : kThrowOnError;
|
||||
return AddDataProperty(it, value, NONE, should_throw, store_origin);
|
||||
}
|
||||
|
||||
Maybe<bool> Object::SetSuperProperty(LookupIterator* it, Handle<Object> value,
|
||||
StoreOrigin store_origin,
|
||||
Maybe<LanguageMode> language_mode) {
|
||||
LanguageMode language_mode,
|
||||
StoreOrigin store_origin) {
|
||||
Isolate* isolate = it->isolate();
|
||||
|
||||
if (it->IsFound()) {
|
||||
@ -5369,7 +5339,8 @@ Maybe<bool> Object::SetSuperProperty(LookupIterator* it, Handle<Object> value,
|
||||
// The property either doesn't exist on the holder or exists there as a data
|
||||
// property.
|
||||
|
||||
ShouldThrow should_throw = GetShouldThrow(it->isolate(), language_mode);
|
||||
ShouldThrow should_throw =
|
||||
is_sloppy(language_mode) ? kDontThrow : kThrowOnError;
|
||||
|
||||
if (!it->GetReceiver()->IsJSReceiver()) {
|
||||
return WriteToReadOnlyProperty(it, value, should_throw);
|
||||
@ -6091,8 +6062,8 @@ Maybe<bool> JSProxy::SetProperty(Handle<JSProxy> proxy, Handle<Name> name,
|
||||
if (trap->IsUndefined(isolate)) {
|
||||
LookupIterator it =
|
||||
LookupIterator::PropertyOrElement(isolate, receiver, name, target);
|
||||
return Object::SetSuperProperty(&it, value, StoreOrigin::kMaybeKeyed,
|
||||
Just(language_mode));
|
||||
return Object::SetSuperProperty(&it, value, language_mode,
|
||||
StoreOrigin::kMaybeKeyed);
|
||||
}
|
||||
|
||||
Handle<Object> trap_result;
|
||||
@ -16626,7 +16597,7 @@ MaybeHandle<Object> JSPromise::Resolve(Handle<JSPromise> promise,
|
||||
// Mark the dependency of the new {promise} on the {resolution}.
|
||||
Object::SetProperty(isolate, resolution,
|
||||
isolate->factory()->promise_handled_by_symbol(),
|
||||
promise)
|
||||
promise, LanguageMode::kStrict)
|
||||
.Check();
|
||||
}
|
||||
isolate->native_context()->microtask_queue()->EnqueueMicrotask(*task);
|
||||
@ -16949,7 +16920,8 @@ MaybeHandle<JSRegExp> JSRegExp::Initialize(Handle<JSRegExp> regexp,
|
||||
RETURN_ON_EXCEPTION(
|
||||
isolate,
|
||||
Object::SetProperty(isolate, regexp, factory->lastIndex_string(),
|
||||
Handle<Smi>(Smi::zero(), isolate)),
|
||||
Handle<Smi>(Smi::zero(), isolate),
|
||||
LanguageMode::kStrict),
|
||||
JSRegExp);
|
||||
}
|
||||
|
||||
|
@ -784,21 +784,20 @@ class Object {
|
||||
// argument. These cases are either in accordance with the spec or not
|
||||
// covered by it (eg., concerning API callbacks).
|
||||
V8_WARN_UNUSED_RESULT static Maybe<bool> SetProperty(
|
||||
LookupIterator* it, Handle<Object> value, StoreOrigin store_origin,
|
||||
Maybe<LanguageMode> language_mode = Nothing<LanguageMode>());
|
||||
LookupIterator* it, Handle<Object> value, LanguageMode language_mode,
|
||||
StoreOrigin store_origin);
|
||||
V8_WARN_UNUSED_RESULT static MaybeHandle<Object> SetProperty(
|
||||
Isolate* isolate, Handle<Object> object, Handle<Name> name,
|
||||
Handle<Object> value, StoreOrigin store_origin = StoreOrigin::kMaybeKeyed,
|
||||
Maybe<LanguageMode> language_mode = Nothing<LanguageMode>());
|
||||
Handle<Object> value, LanguageMode language_mode,
|
||||
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,
|
||||
Maybe<LanguageMode> language_mode = Nothing<LanguageMode>(),
|
||||
Handle<Object> value, LanguageMode language_mode,
|
||||
StoreOrigin store_origin = StoreOrigin::kMaybeKeyed);
|
||||
|
||||
V8_WARN_UNUSED_RESULT static Maybe<bool> SetSuperProperty(
|
||||
LookupIterator* it, Handle<Object> value, StoreOrigin store_origin,
|
||||
Maybe<LanguageMode> language_mode = Nothing<LanguageMode>());
|
||||
LookupIterator* it, Handle<Object> value, LanguageMode language_mode,
|
||||
StoreOrigin store_origin);
|
||||
|
||||
V8_WARN_UNUSED_RESULT static Maybe<bool> CannotCreateProperty(
|
||||
Isolate* isolate, Handle<Object> receiver, Handle<Object> name,
|
||||
@ -980,8 +979,8 @@ class Object {
|
||||
// Helper for SetProperty and SetSuperProperty.
|
||||
// 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,
|
||||
Maybe<LanguageMode> language_mode, StoreOrigin store_origin, bool* found);
|
||||
LookupIterator* it, Handle<Object> value, LanguageMode language_mode,
|
||||
StoreOrigin store_origin, bool* found);
|
||||
|
||||
V8_WARN_UNUSED_RESULT static MaybeHandle<Name> ConvertToName(
|
||||
Isolate* isolate, Handle<Object> input);
|
||||
|
@ -120,18 +120,18 @@ void PendingCompilationErrorHandler::ThrowPendingError(Isolate* isolate,
|
||||
Handle<Name> key_start_pos = factory->error_start_pos_symbol();
|
||||
Object::SetProperty(isolate, jserror, key_start_pos,
|
||||
handle(Smi::FromInt(location.start_pos()), isolate),
|
||||
StoreOrigin::kMaybeKeyed, Just(LanguageMode::kStrict))
|
||||
LanguageMode::kSloppy)
|
||||
.Check();
|
||||
|
||||
Handle<Name> key_end_pos = factory->error_end_pos_symbol();
|
||||
Object::SetProperty(isolate, jserror, key_end_pos,
|
||||
handle(Smi::FromInt(location.end_pos()), isolate),
|
||||
StoreOrigin::kMaybeKeyed, Just(LanguageMode::kStrict))
|
||||
LanguageMode::kSloppy)
|
||||
.Check();
|
||||
|
||||
Handle<Name> key_script = factory->error_script_symbol();
|
||||
Object::SetProperty(isolate, jserror, key_script, script,
|
||||
StoreOrigin::kMaybeKeyed, Just(LanguageMode::kStrict))
|
||||
LanguageMode::kSloppy)
|
||||
.Check();
|
||||
|
||||
isolate->Throw(*error, &location);
|
||||
|
@ -51,9 +51,9 @@ MaybeHandle<Object> RegExpUtils::SetLastIndex(Isolate* isolate,
|
||||
JSRegExp::cast(*recv)->set_last_index(*value_as_object, SKIP_WRITE_BARRIER);
|
||||
return recv;
|
||||
} else {
|
||||
return Object::SetProperty(
|
||||
isolate, recv, isolate->factory()->lastIndex_string(), value_as_object,
|
||||
StoreOrigin::kMaybeKeyed, Just(LanguageMode::kStrict));
|
||||
return Object::SetProperty(isolate, recv,
|
||||
isolate->factory()->lastIndex_string(),
|
||||
value_as_object, LanguageMode::kStrict);
|
||||
}
|
||||
}
|
||||
|
||||
|
@ -770,22 +770,25 @@ namespace {
|
||||
|
||||
MaybeHandle<Object> StoreToSuper(Isolate* isolate, Handle<JSObject> home_object,
|
||||
Handle<Object> receiver, Handle<Name> name,
|
||||
Handle<Object> value) {
|
||||
Handle<Object> value,
|
||||
LanguageMode language_mode) {
|
||||
Handle<JSReceiver> holder;
|
||||
ASSIGN_RETURN_ON_EXCEPTION(isolate, holder,
|
||||
GetSuperHolder(isolate, receiver, home_object,
|
||||
SuperMode::kStore, name, 0),
|
||||
Object);
|
||||
LookupIterator it(receiver, name, holder);
|
||||
MAYBE_RETURN(Object::SetSuperProperty(&it, value, StoreOrigin::kNamed),
|
||||
MaybeHandle<Object>());
|
||||
MAYBE_RETURN(
|
||||
Object::SetSuperProperty(&it, value, language_mode, StoreOrigin::kNamed),
|
||||
MaybeHandle<Object>());
|
||||
return value;
|
||||
}
|
||||
|
||||
MaybeHandle<Object> StoreElementToSuper(Isolate* isolate,
|
||||
Handle<JSObject> home_object,
|
||||
Handle<Object> receiver, uint32_t index,
|
||||
Handle<Object> value) {
|
||||
Handle<Object> value,
|
||||
LanguageMode language_mode) {
|
||||
Handle<JSReceiver> holder;
|
||||
ASSIGN_RETURN_ON_EXCEPTION(
|
||||
isolate, holder,
|
||||
@ -793,7 +796,8 @@ MaybeHandle<Object> StoreElementToSuper(Isolate* isolate,
|
||||
MaybeHandle<Name>(), index),
|
||||
Object);
|
||||
LookupIterator it(isolate, receiver, index, holder);
|
||||
MAYBE_RETURN(Object::SetSuperProperty(&it, value, StoreOrigin::kMaybeKeyed),
|
||||
MAYBE_RETURN(Object::SetSuperProperty(&it, value, language_mode,
|
||||
StoreOrigin::kMaybeKeyed),
|
||||
MaybeHandle<Object>());
|
||||
return value;
|
||||
}
|
||||
@ -809,11 +813,11 @@ RUNTIME_FUNCTION(Runtime_StoreToSuper_Strict) {
|
||||
CONVERT_ARG_HANDLE_CHECKED(Object, value, 3);
|
||||
|
||||
RETURN_RESULT_OR_FAILURE(
|
||||
isolate, StoreToSuper(isolate, home_object, receiver, name, value));
|
||||
isolate, StoreToSuper(isolate, home_object, receiver, name, value,
|
||||
LanguageMode::kStrict));
|
||||
}
|
||||
|
||||
// TODO(mythria): Now that we don't need language mode merge this and
|
||||
// Runtime_StoreToSuper_Strict functions.
|
||||
|
||||
RUNTIME_FUNCTION(Runtime_StoreToSuper_Sloppy) {
|
||||
HandleScope scope(isolate);
|
||||
DCHECK_EQ(4, args.length());
|
||||
@ -823,29 +827,32 @@ RUNTIME_FUNCTION(Runtime_StoreToSuper_Sloppy) {
|
||||
CONVERT_ARG_HANDLE_CHECKED(Object, value, 3);
|
||||
|
||||
RETURN_RESULT_OR_FAILURE(
|
||||
isolate, StoreToSuper(isolate, home_object, receiver, name, value));
|
||||
isolate, StoreToSuper(isolate, home_object, receiver, name, value,
|
||||
LanguageMode::kSloppy));
|
||||
}
|
||||
|
||||
static MaybeHandle<Object> StoreKeyedToSuper(Isolate* isolate,
|
||||
Handle<JSObject> home_object,
|
||||
Handle<Object> receiver,
|
||||
Handle<Object> key,
|
||||
Handle<Object> value) {
|
||||
static MaybeHandle<Object> StoreKeyedToSuper(
|
||||
Isolate* isolate, Handle<JSObject> home_object, Handle<Object> receiver,
|
||||
Handle<Object> key, Handle<Object> value, LanguageMode language_mode) {
|
||||
uint32_t index = 0;
|
||||
|
||||
if (key->ToArrayIndex(&index)) {
|
||||
return StoreElementToSuper(isolate, home_object, receiver, index, value);
|
||||
return StoreElementToSuper(isolate, home_object, receiver, index, value,
|
||||
language_mode);
|
||||
}
|
||||
Handle<Name> name;
|
||||
ASSIGN_RETURN_ON_EXCEPTION(isolate, name, Object::ToName(isolate, key),
|
||||
Object);
|
||||
// TODO(verwaest): Unify using LookupIterator.
|
||||
if (name->AsArrayIndex(&index)) {
|
||||
return StoreElementToSuper(isolate, home_object, receiver, index, value);
|
||||
return StoreElementToSuper(isolate, home_object, receiver, index, value,
|
||||
language_mode);
|
||||
}
|
||||
return StoreToSuper(isolate, home_object, receiver, name, value);
|
||||
return StoreToSuper(isolate, home_object, receiver, name, value,
|
||||
language_mode);
|
||||
}
|
||||
|
||||
|
||||
RUNTIME_FUNCTION(Runtime_StoreKeyedToSuper_Strict) {
|
||||
HandleScope scope(isolate);
|
||||
DCHECK_EQ(4, args.length());
|
||||
@ -855,11 +862,11 @@ RUNTIME_FUNCTION(Runtime_StoreKeyedToSuper_Strict) {
|
||||
CONVERT_ARG_HANDLE_CHECKED(Object, value, 3);
|
||||
|
||||
RETURN_RESULT_OR_FAILURE(
|
||||
isolate, StoreKeyedToSuper(isolate, home_object, receiver, key, value));
|
||||
isolate, StoreKeyedToSuper(isolate, home_object, receiver, key, value,
|
||||
LanguageMode::kStrict));
|
||||
}
|
||||
|
||||
// TODO(mythria): Now that we don't need language mode merge this and
|
||||
// Runtime_StoreKeyedToSuper_Strict functions.
|
||||
|
||||
RUNTIME_FUNCTION(Runtime_StoreKeyedToSuper_Sloppy) {
|
||||
HandleScope scope(isolate);
|
||||
DCHECK_EQ(4, args.length());
|
||||
@ -869,7 +876,8 @@ RUNTIME_FUNCTION(Runtime_StoreKeyedToSuper_Sloppy) {
|
||||
CONVERT_ARG_HANDLE_CHECKED(Object, value, 3);
|
||||
|
||||
RETURN_RESULT_OR_FAILURE(
|
||||
isolate, StoreKeyedToSuper(isolate, home_object, receiver, key, value));
|
||||
isolate, StoreKeyedToSuper(isolate, home_object, receiver, key, value,
|
||||
LanguageMode::kSloppy));
|
||||
}
|
||||
|
||||
} // namespace internal
|
||||
|
@ -370,7 +370,8 @@ MaybeHandle<Object> Runtime::SetObjectProperty(Isolate* isolate,
|
||||
Object);
|
||||
}
|
||||
|
||||
MAYBE_RETURN_NULL(Object::SetProperty(&it, value, store_origin));
|
||||
MAYBE_RETURN_NULL(
|
||||
Object::SetProperty(&it, value, language_mode, store_origin));
|
||||
|
||||
return value;
|
||||
}
|
||||
|
@ -158,17 +158,16 @@ Handle<JSPromise> AwaitPromisesInitCommon(Isolate* isolate,
|
||||
Object::SetProperty(
|
||||
isolate, reject_handler,
|
||||
isolate->factory()->promise_forwarding_handler_symbol(),
|
||||
isolate->factory()->true_value(), StoreOrigin::kMaybeKeyed,
|
||||
Just(LanguageMode::kStrict))
|
||||
isolate->factory()->true_value(), LanguageMode::kStrict)
|
||||
.Check();
|
||||
Handle<JSPromise>::cast(value)->set_handled_hint(is_predicted_as_caught);
|
||||
}
|
||||
|
||||
// Mark the dependency to {outer_promise} in case the {throwaway}
|
||||
// Promise is found on the Promise stack
|
||||
Object::SetProperty(
|
||||
isolate, throwaway, isolate->factory()->promise_handled_by_symbol(),
|
||||
outer_promise, StoreOrigin::kMaybeKeyed, Just(LanguageMode::kStrict))
|
||||
Object::SetProperty(isolate, throwaway,
|
||||
isolate->factory()->promise_handled_by_symbol(),
|
||||
outer_promise, LanguageMode::kStrict)
|
||||
.Check();
|
||||
}
|
||||
|
||||
|
@ -61,7 +61,6 @@ RUNTIME_FUNCTION(Runtime_GetPropertyWithReceiver) {
|
||||
&it, static_cast<OnNonExistent>(on_non_existent->value())));
|
||||
}
|
||||
|
||||
// TODO(mythria): Remove language_mode parameter.
|
||||
RUNTIME_FUNCTION(Runtime_SetPropertyWithReceiver) {
|
||||
HandleScope scope(isolate);
|
||||
|
||||
@ -70,6 +69,7 @@ RUNTIME_FUNCTION(Runtime_SetPropertyWithReceiver) {
|
||||
CONVERT_ARG_HANDLE_CHECKED(Object, key, 1);
|
||||
CONVERT_ARG_HANDLE_CHECKED(Object, value, 2);
|
||||
CONVERT_ARG_HANDLE_CHECKED(Object, receiver, 3);
|
||||
CONVERT_LANGUAGE_MODE_ARG_CHECKED(language_mode, 4);
|
||||
|
||||
bool success = false;
|
||||
LookupIterator it = LookupIterator::PropertyOrElement(isolate, receiver, key,
|
||||
@ -78,8 +78,8 @@ RUNTIME_FUNCTION(Runtime_SetPropertyWithReceiver) {
|
||||
DCHECK(isolate->has_pending_exception());
|
||||
return ReadOnlyRoots(isolate).exception();
|
||||
}
|
||||
Maybe<bool> result =
|
||||
Object::SetSuperProperty(&it, value, StoreOrigin::kMaybeKeyed);
|
||||
Maybe<bool> result = Object::SetSuperProperty(&it, value, language_mode,
|
||||
StoreOrigin::kMaybeKeyed);
|
||||
MAYBE_RETURN(result, ReadOnlyRoots(isolate).exception());
|
||||
return *isolate->factory()->ToBoolean(result.FromJust());
|
||||
}
|
||||
|
@ -948,9 +948,9 @@ MaybeHandle<Object> StoreLookupSlot(
|
||||
object = handle(context->global_object(), isolate);
|
||||
}
|
||||
|
||||
ASSIGN_RETURN_ON_EXCEPTION(isolate, value,
|
||||
Object::SetProperty(isolate, object, name, value),
|
||||
Object);
|
||||
ASSIGN_RETURN_ON_EXCEPTION(
|
||||
isolate, value,
|
||||
Object::SetProperty(isolate, object, name, value, language_mode), Object);
|
||||
return value;
|
||||
}
|
||||
|
||||
|
@ -128,14 +128,12 @@ RUNTIME_FUNCTION(Runtime_WasmThrowCreate) {
|
||||
MessageTemplate::kWasmExceptionError);
|
||||
CHECK(!Object::SetProperty(isolate, exception,
|
||||
isolate->factory()->wasm_exception_tag_symbol(),
|
||||
tag, StoreOrigin::kMaybeKeyed,
|
||||
Just(LanguageMode::kStrict))
|
||||
tag, LanguageMode::kStrict)
|
||||
.is_null());
|
||||
Handle<FixedArray> values = isolate->factory()->NewFixedArray(size);
|
||||
CHECK(!Object::SetProperty(isolate, exception,
|
||||
isolate->factory()->wasm_exception_values_symbol(),
|
||||
values, StoreOrigin::kMaybeKeyed,
|
||||
Just(LanguageMode::kStrict))
|
||||
values, LanguageMode::kStrict)
|
||||
.is_null());
|
||||
return *exception;
|
||||
}
|
||||
|
@ -367,11 +367,16 @@ TEST(GarbageCollection) {
|
||||
HandleScope inner_scope(isolate);
|
||||
// Allocate a function and keep it in global object's property.
|
||||
Handle<JSFunction> function = factory->NewFunctionForTest(name);
|
||||
Object::SetProperty(isolate, global, name, function).Check();
|
||||
Object::SetProperty(isolate, global, name, function, LanguageMode::kSloppy)
|
||||
.Check();
|
||||
// Allocate an object. Unrooted after leaving the scope.
|
||||
Handle<JSObject> obj = factory->NewJSObject(function);
|
||||
Object::SetProperty(isolate, obj, prop_name, twenty_three).Check();
|
||||
Object::SetProperty(isolate, obj, prop_namex, twenty_four).Check();
|
||||
Object::SetProperty(isolate, obj, prop_name, twenty_three,
|
||||
LanguageMode::kSloppy)
|
||||
.Check();
|
||||
Object::SetProperty(isolate, obj, prop_namex, twenty_four,
|
||||
LanguageMode::kSloppy)
|
||||
.Check();
|
||||
|
||||
CHECK_EQ(Smi::FromInt(23),
|
||||
*Object::GetProperty(isolate, obj, prop_name).ToHandleChecked());
|
||||
@ -393,8 +398,11 @@ TEST(GarbageCollection) {
|
||||
HandleScope inner_scope(isolate);
|
||||
// Allocate another object, make it reachable from global.
|
||||
Handle<JSObject> obj = factory->NewJSObject(function);
|
||||
Object::SetProperty(isolate, global, obj_name, obj).Check();
|
||||
Object::SetProperty(isolate, obj, prop_name, twenty_three).Check();
|
||||
Object::SetProperty(isolate, global, obj_name, obj, LanguageMode::kSloppy)
|
||||
.Check();
|
||||
Object::SetProperty(isolate, obj, prop_name, twenty_three,
|
||||
LanguageMode::kSloppy)
|
||||
.Check();
|
||||
}
|
||||
|
||||
// After gc, it should survive.
|
||||
@ -935,11 +943,15 @@ TEST(FunctionAllocation) {
|
||||
|
||||
Handle<String> prop_name = factory->InternalizeUtf8String("theSlot");
|
||||
Handle<JSObject> obj = factory->NewJSObject(function);
|
||||
Object::SetProperty(isolate, obj, prop_name, twenty_three).Check();
|
||||
Object::SetProperty(isolate, obj, prop_name, twenty_three,
|
||||
LanguageMode::kSloppy)
|
||||
.Check();
|
||||
CHECK_EQ(Smi::FromInt(23),
|
||||
*Object::GetProperty(isolate, obj, prop_name).ToHandleChecked());
|
||||
// Check that we can add properties to function objects.
|
||||
Object::SetProperty(isolate, function, prop_name, twenty_four).Check();
|
||||
Object::SetProperty(isolate, function, prop_name, twenty_four,
|
||||
LanguageMode::kSloppy)
|
||||
.Check();
|
||||
CHECK_EQ(
|
||||
Smi::FromInt(24),
|
||||
*Object::GetProperty(isolate, function, prop_name).ToHandleChecked());
|
||||
@ -970,7 +982,7 @@ TEST(ObjectProperties) {
|
||||
CHECK(Just(false) == JSReceiver::HasOwnProperty(obj, first));
|
||||
|
||||
// add first
|
||||
Object::SetProperty(isolate, obj, first, one).Check();
|
||||
Object::SetProperty(isolate, obj, first, one, LanguageMode::kSloppy).Check();
|
||||
CHECK(Just(true) == JSReceiver::HasOwnProperty(obj, first));
|
||||
|
||||
// delete first
|
||||
@ -979,8 +991,8 @@ TEST(ObjectProperties) {
|
||||
CHECK(Just(false) == JSReceiver::HasOwnProperty(obj, first));
|
||||
|
||||
// add first and then second
|
||||
Object::SetProperty(isolate, obj, first, one).Check();
|
||||
Object::SetProperty(isolate, obj, second, two).Check();
|
||||
Object::SetProperty(isolate, obj, first, one, LanguageMode::kSloppy).Check();
|
||||
Object::SetProperty(isolate, obj, second, two, LanguageMode::kSloppy).Check();
|
||||
CHECK(Just(true) == JSReceiver::HasOwnProperty(obj, first));
|
||||
CHECK(Just(true) == JSReceiver::HasOwnProperty(obj, second));
|
||||
|
||||
@ -994,8 +1006,8 @@ TEST(ObjectProperties) {
|
||||
CHECK(Just(false) == JSReceiver::HasOwnProperty(obj, second));
|
||||
|
||||
// add first and then second
|
||||
Object::SetProperty(isolate, obj, first, one).Check();
|
||||
Object::SetProperty(isolate, obj, second, two).Check();
|
||||
Object::SetProperty(isolate, obj, first, one, LanguageMode::kSloppy).Check();
|
||||
Object::SetProperty(isolate, obj, second, two, LanguageMode::kSloppy).Check();
|
||||
CHECK(Just(true) == JSReceiver::HasOwnProperty(obj, first));
|
||||
CHECK(Just(true) == JSReceiver::HasOwnProperty(obj, second));
|
||||
|
||||
@ -1011,14 +1023,15 @@ TEST(ObjectProperties) {
|
||||
// check string and internalized string match
|
||||
const char* string1 = "fisk";
|
||||
Handle<String> s1 = factory->NewStringFromAsciiChecked(string1);
|
||||
Object::SetProperty(isolate, obj, s1, one).Check();
|
||||
Object::SetProperty(isolate, obj, s1, one, LanguageMode::kSloppy).Check();
|
||||
Handle<String> s1_string = factory->InternalizeUtf8String(string1);
|
||||
CHECK(Just(true) == JSReceiver::HasOwnProperty(obj, s1_string));
|
||||
|
||||
// check internalized string and string match
|
||||
const char* string2 = "fugl";
|
||||
Handle<String> s2_string = factory->InternalizeUtf8String(string2);
|
||||
Object::SetProperty(isolate, obj, s2_string, one).Check();
|
||||
Object::SetProperty(isolate, obj, s2_string, one, LanguageMode::kSloppy)
|
||||
.Check();
|
||||
Handle<String> s2 = factory->NewStringFromAsciiChecked(string2);
|
||||
CHECK(Just(true) == JSReceiver::HasOwnProperty(obj, s2));
|
||||
}
|
||||
@ -1039,7 +1052,9 @@ TEST(JSObjectMaps) {
|
||||
|
||||
// Set a propery
|
||||
Handle<Smi> twenty_three(Smi::FromInt(23), isolate);
|
||||
Object::SetProperty(isolate, obj, prop_name, twenty_three).Check();
|
||||
Object::SetProperty(isolate, obj, prop_name, twenty_three,
|
||||
LanguageMode::kSloppy)
|
||||
.Check();
|
||||
CHECK_EQ(Smi::FromInt(23),
|
||||
*Object::GetProperty(isolate, obj, prop_name).ToHandleChecked());
|
||||
|
||||
@ -1120,8 +1135,8 @@ TEST(JSObjectCopy) {
|
||||
Handle<Smi> one(Smi::FromInt(1), isolate);
|
||||
Handle<Smi> two(Smi::FromInt(2), isolate);
|
||||
|
||||
Object::SetProperty(isolate, obj, first, one).Check();
|
||||
Object::SetProperty(isolate, obj, second, two).Check();
|
||||
Object::SetProperty(isolate, obj, first, one, LanguageMode::kSloppy).Check();
|
||||
Object::SetProperty(isolate, obj, second, two, LanguageMode::kSloppy).Check();
|
||||
|
||||
Object::SetElement(isolate, obj, 0, first, LanguageMode::kSloppy).Check();
|
||||
Object::SetElement(isolate, obj, 1, second, LanguageMode::kSloppy).Check();
|
||||
@ -1146,8 +1161,10 @@ TEST(JSObjectCopy) {
|
||||
CHECK_EQ(*value1, *value2);
|
||||
|
||||
// Flip the values.
|
||||
Object::SetProperty(isolate, clone, first, two).Check();
|
||||
Object::SetProperty(isolate, clone, second, one).Check();
|
||||
Object::SetProperty(isolate, clone, first, two, LanguageMode::kSloppy)
|
||||
.Check();
|
||||
Object::SetProperty(isolate, clone, second, one, LanguageMode::kSloppy)
|
||||
.Check();
|
||||
|
||||
Object::SetElement(isolate, clone, 0, second, LanguageMode::kSloppy).Check();
|
||||
Object::SetElement(isolate, clone, 1, first, LanguageMode::kSloppy).Check();
|
||||
@ -2965,7 +2982,9 @@ static void AddPropertyTo(
|
||||
FLAG_gc_global = true;
|
||||
FLAG_retain_maps_for_n_gc = 0;
|
||||
CcTest::heap()->set_allocation_timeout(gc_count);
|
||||
Object::SetProperty(isolate, object, prop_name, twenty_three).Check();
|
||||
Object::SetProperty(isolate, object, prop_name, twenty_three,
|
||||
LanguageMode::kSloppy)
|
||||
.Check();
|
||||
}
|
||||
|
||||
|
||||
@ -4835,7 +4854,8 @@ TEST(Regress442710) {
|
||||
Handle<JSArray> array = factory->NewJSArray(2);
|
||||
|
||||
Handle<String> name = factory->InternalizeUtf8String("testArray");
|
||||
Object::SetProperty(isolate, global, name, array).Check();
|
||||
Object::SetProperty(isolate, global, name, array, LanguageMode::kSloppy)
|
||||
.Check();
|
||||
CompileRun("testArray[0] = 1; testArray[1] = 2; testArray.shift();");
|
||||
CcTest::CollectGarbage(OLD_SPACE);
|
||||
}
|
||||
|
@ -330,16 +330,25 @@ HEAP_TEST(InvalidatedSlotsFastToSlow) {
|
||||
// Start incremental marking.
|
||||
heap::SimulateIncrementalMarking(heap);
|
||||
// Set properties to point to the evacuation candidate.
|
||||
Object::SetProperty(isolate, obj, prop_name1, evacuated).Check();
|
||||
Object::SetProperty(isolate, obj, prop_name2, evacuated).Check();
|
||||
Object::SetProperty(isolate, obj, prop_name3, evacuated).Check();
|
||||
Object::SetProperty(isolate, obj, prop_name1, evacuated,
|
||||
LanguageMode::kSloppy)
|
||||
.Check();
|
||||
Object::SetProperty(isolate, obj, prop_name2, evacuated,
|
||||
LanguageMode::kSloppy)
|
||||
.Check();
|
||||
Object::SetProperty(isolate, obj, prop_name3, evacuated,
|
||||
LanguageMode::kSloppy)
|
||||
.Check();
|
||||
|
||||
{
|
||||
HandleScope scope(isolate);
|
||||
Handle<HeapObject> dead = factory->NewFixedArray(1);
|
||||
Object::SetProperty(isolate, obj, prop_name1, dead).Check();
|
||||
Object::SetProperty(isolate, obj, prop_name2, dead).Check();
|
||||
Object::SetProperty(isolate, obj, prop_name3, dead).Check();
|
||||
Object::SetProperty(isolate, obj, prop_name1, dead, LanguageMode::kSloppy)
|
||||
.Check();
|
||||
Object::SetProperty(isolate, obj, prop_name2, dead, LanguageMode::kSloppy)
|
||||
.Check();
|
||||
Object::SetProperty(isolate, obj, prop_name3, dead, LanguageMode::kSloppy)
|
||||
.Check();
|
||||
Handle<Map> map(obj->map(), isolate);
|
||||
Handle<Map> normalized_map =
|
||||
Map::Normalize(isolate, map, CLEAR_INOBJECT_PROPERTIES, "testing");
|
||||
|
@ -165,7 +165,9 @@ HEAP_TEST(MarkCompactCollector) {
|
||||
// allocate a garbage
|
||||
Handle<String> func_name = factory->InternalizeUtf8String("theFunction");
|
||||
Handle<JSFunction> function = factory->NewFunctionForTest(func_name);
|
||||
Object::SetProperty(isolate, global, func_name, function).Check();
|
||||
Object::SetProperty(isolate, global, func_name, function,
|
||||
LanguageMode::kSloppy)
|
||||
.Check();
|
||||
|
||||
factory->NewJSObject(function);
|
||||
}
|
||||
@ -182,10 +184,13 @@ HEAP_TEST(MarkCompactCollector) {
|
||||
Handle<JSObject> obj = factory->NewJSObject(function);
|
||||
|
||||
Handle<String> obj_name = factory->InternalizeUtf8String("theObject");
|
||||
Object::SetProperty(isolate, global, obj_name, obj).Check();
|
||||
Object::SetProperty(isolate, global, obj_name, obj, LanguageMode::kSloppy)
|
||||
.Check();
|
||||
Handle<String> prop_name = factory->InternalizeUtf8String("theSlot");
|
||||
Handle<Smi> twenty_three(Smi::FromInt(23), isolate);
|
||||
Object::SetProperty(isolate, obj, prop_name, twenty_three).Check();
|
||||
Object::SetProperty(isolate, obj, prop_name, twenty_three,
|
||||
LanguageMode::kSloppy)
|
||||
.Check();
|
||||
}
|
||||
|
||||
CcTest::CollectGarbage(OLD_SPACE);
|
||||
|
@ -132,8 +132,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),
|
||||
StoreOrigin::kMaybeKeyed,
|
||||
Just(LanguageMode::kStrict))
|
||||
LanguageMode::kStrict, StoreOrigin::kMaybeKeyed)
|
||||
.FromJust());
|
||||
|
||||
{
|
||||
@ -192,7 +191,7 @@ TEST(GetBoolOption) {
|
||||
Handle<Object> false_value =
|
||||
handle(i::ReadOnlyRoots(isolate).false_value(), isolate);
|
||||
Object::SetProperty(isolate, options, key, false_value,
|
||||
StoreOrigin::kMaybeKeyed, Just(LanguageMode::kStrict))
|
||||
LanguageMode::kStrict)
|
||||
.Assert();
|
||||
bool result = false;
|
||||
Maybe<bool> found =
|
||||
@ -206,7 +205,7 @@ TEST(GetBoolOption) {
|
||||
Handle<Object> true_value =
|
||||
handle(i::ReadOnlyRoots(isolate).true_value(), isolate);
|
||||
Object::SetProperty(isolate, options, key, true_value,
|
||||
StoreOrigin::kMaybeKeyed, Just(LanguageMode::kStrict))
|
||||
LanguageMode::kStrict)
|
||||
.Assert();
|
||||
bool result = false;
|
||||
Maybe<bool> found =
|
||||
|
Loading…
Reference in New Issue
Block a user