Commit c082b74c authored by Mythri's avatar Mythri Committed by Commit Bot

Cleanup after removing language mode parameter from SetProperty

SetProperty now infers the language mode from the closure and the context
So we no longer have to pass around the language mode. Cleanup by
removing the parameter where it is no longer needed.

Bug: v8:8580
Change-Id: I89452b5a762eb48a911f158d22c7bfa9e3bb1be4
Reviewed-on: https://chromium-review.googlesource.com/c/1421840
Commit-Queue: Mythri Alle <mythria@chromium.org>
Reviewed-by: 's avatarRoss McIlroy <rmcilroy@chromium.org>
Reviewed-by: 's avatarGeorg Neis <neis@chromium.org>
Reviewed-by: 's avatarToon Verwaest <verwaest@chromium.org>
Cr-Commit-Position: refs/heads/master@{#59089}
parent 08f68102
......@@ -70,19 +70,18 @@ void Builtins::Generate_StoreIC_Uninitialized(
StoreICUninitializedGenerator::Generate(state);
}
// TODO(mythria): Check if we can remove feedback vector and slot parameters in
// descriptor.
void HandlerBuiltinsAssembler::Generate_KeyedStoreIC_Slow() {
typedef StoreWithVectorDescriptor Descriptor;
Node* receiver = Parameter(Descriptor::kReceiver);
Node* name = Parameter(Descriptor::kName);
Node* value = Parameter(Descriptor::kValue);
Node* slot = Parameter(Descriptor::kSlot);
Node* vector = Parameter(Descriptor::kVector);
Node* context = Parameter(Descriptor::kContext);
// The slow case calls into the runtime to complete the store without causing
// an IC miss that would otherwise cause a transition to the generic stub.
TailCallRuntime(Runtime::kKeyedStoreIC_Slow, context, value, slot, vector,
receiver, name);
TailCallRuntime(Runtime::kKeyedStoreIC_Slow, context, value, receiver, name);
}
TF_BUILTIN(KeyedStoreIC_Slow, HandlerBuiltinsAssembler) {
......
......@@ -627,7 +627,7 @@ TF_BUILTIN(ProxySetProperty, ProxiesCodeStubAssembler) {
{
// 7.a. Return ? target.[[Set]](P, V, Receiver).
CallRuntime(Runtime::kSetPropertyWithReceiver, context, target, name, value,
receiver, language_mode);
receiver);
Return(value);
}
......
......@@ -241,8 +241,6 @@ void JSGenericLowering::LowerJSStoreNamed(Node* node) {
Node* outer_state = frame_state->InputAt(kFrameStateOuterStateInput);
node->InsertInput(zone(), 1, jsgraph()->HeapConstant(p.name()));
if (!p.feedback().IsValid()) {
node->InsertInput(
zone(), 3, jsgraph()->SmiConstant(static_cast<int>(p.language_mode())));
ReplaceWithRuntimeCall(node, Runtime::kSetNamedProperty);
return;
}
......
......@@ -831,13 +831,8 @@ void AccessorAssembler::HandleStoreICNativeDataProperty(
Node* accessor_info = LoadDescriptorValue(LoadMap(holder), descriptor);
CSA_CHECK(this, IsAccessorInfo(accessor_info));
// TODO(8580): Get the language mode lazily when required to avoid the
// computation of GetLanguageMode here. Also make the computation of
// language mode not dependent on vector.
Node* language_mode = GetLanguageMode(p->vector, p->slot);
TailCallRuntime(Runtime::kStoreCallbackProperty, p->context, p->receiver,
holder, accessor_info, p->name, p->value, language_mode);
holder, accessor_info, p->name, p->value);
}
void AccessorAssembler::HandleStoreICHandlerCase(
......@@ -1476,7 +1471,7 @@ void AccessorAssembler::HandleStoreToProxy(const StoreICParameters* p,
BIND(&to_name_failed);
TailCallRuntime(Runtime::kSetPropertyWithReceiver, p->context, proxy,
p->name, p->value, p->receiver, language_mode);
p->name, p->value, p->receiver);
} else {
Node* name = CallBuiltin(Builtins::kToName, p->context, p->name);
TailCallBuiltin(Builtins::kProxySetProperty, p->context, proxy, name,
......
......@@ -2352,6 +2352,7 @@ RUNTIME_FUNCTION(Runtime_StoreICNoFeedback_Miss) {
NamedPropertyType property_type =
static_cast<NamedPropertyType>(is_own_property_value);
// TODO(mythria): Replace StoreNamedStrict/Sloppy with StoreNamed.
FeedbackSlotKind kind = FeedbackSlotKind::kStoreNamedStrict;
if (property_type == NamedPropertyType::kOwn) {
kind = FeedbackSlotKind::kStoreOwnNamed;
......@@ -2384,6 +2385,7 @@ RUNTIME_FUNCTION(Runtime_StoreGlobalICNoFeedback_Miss) {
Handle<Object> value = args.at(0);
Handle<Name> key = args.at<Name>(1);
// TODO(mythria): Replace StoreGlobalStrict/Sloppy with StoreNamed.
StoreGlobalIC ic(isolate, Handle<FeedbackVector>(), FeedbackSlot(),
FeedbackSlotKind::kStoreGlobalStrict);
RETURN_RESULT_OR_FAILURE(isolate, ic.Store(key, value));
......@@ -2480,8 +2482,7 @@ RUNTIME_FUNCTION(Runtime_KeyedStoreICNoFeedback_Miss) {
Handle<Object> receiver = args.at(1);
Handle<Object> key = args.at(2);
// TODO(mythria): Replace StoreKeyedStrict and StoreKeyedSloppy with
// StoreKeyed.
// TODO(mythria): Replace StoreKeyedStrict/Sloppy with StoreKeyed.
KeyedStoreIC ic(isolate, Handle<FeedbackVector>(), FeedbackSlot(),
FeedbackSlotKind::kStoreKeyedStrict);
RETURN_RESULT_OR_FAILURE(isolate, ic.Store(receiver, key, value));
......@@ -2509,14 +2510,13 @@ RUNTIME_FUNCTION(Runtime_StoreInArrayLiteralIC_Miss) {
return *value;
}
// TODO(mythria): We don't need feedback and slot here. Remove those arguments.
RUNTIME_FUNCTION(Runtime_KeyedStoreIC_Slow) {
HandleScope scope(isolate);
DCHECK_EQ(5, args.length());
DCHECK_EQ(3, args.length());
// Runtime functions don't follow the IC's calling convention.
Handle<Object> value = args.at(0);
Handle<Object> object = args.at(3);
Handle<Object> key = args.at(4);
Handle<Object> object = args.at(1);
Handle<Object> key = args.at(2);
RETURN_RESULT_OR_FAILURE(
isolate, Runtime::SetObjectProperty(isolate, object, key, value,
StoreOrigin::kMaybeKeyed));
......
......@@ -1020,19 +1020,8 @@ void KeyedStoreGenericAssembler::KeyedStoreGeneric(
{
if (IsKeyedStore()) {
Comment("KeyedStoreGeneric_slow");
if (language_mode.IsJust()) {
TailCallRuntime(Runtime::kSetKeyedProperty, context, receiver, key,
value, SmiConstant(language_mode.FromJust()));
} else {
TVARIABLE(Smi, var_language_mode, SmiConstant(LanguageMode::kStrict));
Label call_runtime(this);
BranchIfStrictMode(vector, slot, &call_runtime);
var_language_mode = SmiConstant(LanguageMode::kSloppy);
Goto(&call_runtime);
BIND(&call_runtime);
TailCallRuntime(Runtime::kSetKeyedProperty, context, receiver, key,
value, var_language_mode.value());
}
TailCallRuntime(Runtime::kSetKeyedProperty, context, receiver, key,
value);
} else {
DCHECK(IsStoreInLiteral());
TailCallRuntime(Runtime::kStoreDataPropertyInLiteral, context, receiver,
......@@ -1127,7 +1116,7 @@ void KeyedStoreGenericAssembler::SetProperty(TNode<Context> context,
unique_name, value);
} else {
CallRuntime(Runtime::kSetKeyedProperty, context, receiver, unique_name,
value, SmiConstant(language_mode));
value);
}
Goto(&done);
}
......
......@@ -2349,7 +2349,7 @@ void BytecodeGenerator::VisitObjectLiteral(ObjectLiteral* expr) {
VisitForEffect(property->value());
}
} else {
RegisterList args = register_allocator()->NewRegisterList(4);
RegisterList args = register_allocator()->NewRegisterList(3);
builder()->MoveRegister(literal, args[0]);
builder()->SetExpressionPosition(property->key());
......@@ -2357,10 +2357,7 @@ void BytecodeGenerator::VisitObjectLiteral(ObjectLiteral* expr) {
builder()->SetExpressionPosition(property->value());
VisitForRegisterValue(property->value(), args[2]);
if (property->emit_store()) {
builder()
->LoadLiteral(Smi::FromEnum(LanguageMode::kSloppy))
.StoreAccumulatorInRegister(args[3])
.CallRuntime(Runtime::kSetKeyedProperty, args);
builder()->CallRuntime(Runtime::kSetKeyedProperty, args);
Register value = args[2];
VisitSetHomeObject(value, literal, property);
}
......@@ -3645,13 +3642,13 @@ void BytecodeGenerator::BuildAssignment(
case NAMED_SUPER_PROPERTY: {
builder()
->StoreAccumulatorInRegister(lhs_data.super_property_args()[3])
.CallRuntime(StoreToSuperRuntimeId(), lhs_data.super_property_args());
.CallRuntime(Runtime::kStoreToSuper, lhs_data.super_property_args());
break;
}
case KEYED_SUPER_PROPERTY: {
builder()
->StoreAccumulatorInRegister(lhs_data.super_property_args()[3])
.CallRuntime(StoreKeyedToSuperRuntimeId(),
.CallRuntime(Runtime::kStoreKeyedToSuper,
lhs_data.super_property_args());
break;
}
......@@ -4747,13 +4744,13 @@ void BytecodeGenerator::VisitCountOperation(CountOperation* expr) {
case NAMED_SUPER_PROPERTY: {
builder()
->StoreAccumulatorInRegister(super_property_args[3])
.CallRuntime(StoreToSuperRuntimeId(), super_property_args);
.CallRuntime(Runtime::kStoreToSuper, super_property_args);
break;
}
case KEYED_SUPER_PROPERTY: {
builder()
->StoreAccumulatorInRegister(super_property_args[3])
.CallRuntime(StoreKeyedToSuperRuntimeId(), super_property_args);
.CallRuntime(Runtime::kStoreKeyedToSuper, super_property_args);
break;
}
}
......@@ -5860,16 +5857,6 @@ FeedbackSlot BytecodeGenerator::GetDummyCompareICSlot() {
return dummy_feedback_slot_.Get();
}
Runtime::FunctionId BytecodeGenerator::StoreToSuperRuntimeId() {
return is_strict(language_mode()) ? Runtime::kStoreToSuper_Strict
: Runtime::kStoreToSuper_Sloppy;
}
Runtime::FunctionId BytecodeGenerator::StoreKeyedToSuperRuntimeId() {
return is_strict(language_mode()) ? Runtime::kStoreKeyedToSuper_Strict
: Runtime::kStoreKeyedToSuper_Sloppy;
}
} // namespace interpreter
} // namespace internal
} // namespace v8
......@@ -658,11 +658,10 @@ IGNITION_HANDLER(StaNamedPropertyNoFeedback,
Node* object = LoadRegisterAtOperandIndex(0);
Node* name = LoadConstantPoolEntryAtOperandIndex(1);
Node* value = GetAccumulator();
Node* language_mode = SmiFromInt32(BytecodeOperandFlag(2));
Node* context = GetContext();
Node* result = CallRuntime(Runtime::kSetNamedProperty, context, object, name,
value, language_mode);
Node* result =
CallRuntime(Runtime::kSetNamedProperty, context, object, name, value);
SetAccumulator(result);
Dispatch();
}
......
......@@ -801,21 +801,7 @@ MaybeHandle<Object> StoreElementToSuper(Isolate* isolate,
} // anonymous namespace
RUNTIME_FUNCTION(Runtime_StoreToSuper_Strict) {
HandleScope scope(isolate);
DCHECK_EQ(4, args.length());
CONVERT_ARG_HANDLE_CHECKED(Object, receiver, 0);
CONVERT_ARG_HANDLE_CHECKED(JSObject, home_object, 1);
CONVERT_ARG_HANDLE_CHECKED(Name, name, 2);
CONVERT_ARG_HANDLE_CHECKED(Object, value, 3);
RETURN_RESULT_OR_FAILURE(
isolate, StoreToSuper(isolate, home_object, receiver, name, value));
}
// TODO(mythria): Now that we don't need language mode merge this and
// Runtime_StoreToSuper_Strict functions.
RUNTIME_FUNCTION(Runtime_StoreToSuper_Sloppy) {
RUNTIME_FUNCTION(Runtime_StoreToSuper) {
HandleScope scope(isolate);
DCHECK_EQ(4, args.length());
CONVERT_ARG_HANDLE_CHECKED(Object, receiver, 0);
......@@ -847,21 +833,7 @@ static MaybeHandle<Object> StoreKeyedToSuper(Isolate* isolate,
return StoreToSuper(isolate, home_object, receiver, name, value);
}
RUNTIME_FUNCTION(Runtime_StoreKeyedToSuper_Strict) {
HandleScope scope(isolate);
DCHECK_EQ(4, args.length());
CONVERT_ARG_HANDLE_CHECKED(Object, receiver, 0);
CONVERT_ARG_HANDLE_CHECKED(JSObject, home_object, 1);
CONVERT_ARG_HANDLE_CHECKED(Object, key, 2);
CONVERT_ARG_HANDLE_CHECKED(Object, value, 3);
RETURN_RESULT_OR_FAILURE(
isolate, StoreKeyedToSuper(isolate, home_object, receiver, key, value));
}
// TODO(mythria): Now that we don't need language mode merge this and
// Runtime_StoreKeyedToSuper_Strict functions.
RUNTIME_FUNCTION(Runtime_StoreKeyedToSuper_Sloppy) {
RUNTIME_FUNCTION(Runtime_StoreKeyedToSuper) {
HandleScope scope(isolate);
DCHECK_EQ(4, args.length());
CONVERT_ARG_HANDLE_CHECKED(Object, receiver, 0);
......
......@@ -544,10 +544,9 @@ RUNTIME_FUNCTION(Runtime_GetProperty) {
isolate, Runtime::GetObjectProperty(isolate, receiver_obj, key_obj));
}
// TODO(mythria): Remove language mode parameter to SetKeyedProperty
RUNTIME_FUNCTION(Runtime_SetKeyedProperty) {
HandleScope scope(isolate);
DCHECK_EQ(4, args.length());
DCHECK_EQ(3, args.length());
CONVERT_ARG_HANDLE_CHECKED(Object, object, 0);
CONVERT_ARG_HANDLE_CHECKED(Object, key, 1);
......@@ -558,10 +557,9 @@ RUNTIME_FUNCTION(Runtime_SetKeyedProperty) {
StoreOrigin::kMaybeKeyed));
}
// TODO(mythria): Remove language mode parameter to SetNamedProperty
RUNTIME_FUNCTION(Runtime_SetNamedProperty) {
HandleScope scope(isolate);
DCHECK_EQ(4, args.length());
DCHECK_EQ(3, args.length());
CONVERT_ARG_HANDLE_CHECKED(Object, object, 0);
CONVERT_ARG_HANDLE_CHECKED(Object, key, 1);
......
......@@ -61,11 +61,10 @@ 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);
DCHECK_EQ(5, args.length());
DCHECK_EQ(4, args.length());
CONVERT_ARG_HANDLE_CHECKED(JSReceiver, holder, 0);
CONVERT_ARG_HANDLE_CHECKED(Object, key, 1);
CONVERT_ARG_HANDLE_CHECKED(Object, value, 2);
......
......@@ -85,10 +85,8 @@ namespace internal {
F(HomeObjectSymbol, 0, 1) \
F(LoadFromSuper, 3, 1) \
F(LoadKeyedFromSuper, 3, 1) \
F(StoreKeyedToSuper_Sloppy, 4, 1) \
F(StoreKeyedToSuper_Strict, 4, 1) \
F(StoreToSuper_Sloppy, 4, 1) \
F(StoreToSuper_Strict, 4, 1) \
F(StoreKeyedToSuper, 4, 1) \
F(StoreToSuper, 4, 1) \
F(ThrowConstructorNonCallableError, 1, 1) \
F(ThrowNotSuperConstructor, 2, 1) \
F(ThrowStaticPrototypeError, 0, 1) \
......@@ -316,8 +314,8 @@ namespace internal {
F(OptimizeObjectForAddingMultipleProperties, 2, 1) \
F(PerformSideEffectCheckForObject, 1, 1) \
F(SetDataProperties, 2, 1) \
F(SetKeyedProperty, 4, 1) \
F(SetNamedProperty, 4, 1) \
F(SetKeyedProperty, 3, 1) \
F(SetNamedProperty, 3, 1) \
F(StoreDataPropertyInLiteral, 3, 1) \
F(ShrinkPropertyDictionary, 1, 1) \
F(ToFastProperties, 1, 1) \
......@@ -363,7 +361,7 @@ namespace internal {
F(IsJSProxy, 1, 1) \
F(JSProxyGetHandler, 1, 1) \
F(JSProxyGetTarget, 1, 1) \
F(SetPropertyWithReceiver, 5, 1)
F(SetPropertyWithReceiver, 4, 1)
#define FOR_EACH_INTRINSIC_REGEXP(F, I) \
I(IsRegExp, 1, 1) \
......@@ -556,7 +554,7 @@ namespace internal {
F(KeyedStoreIC_Miss, 5, 1) \
F(KeyedStoreICNoFeedback_Miss, 3, 1) \
F(StoreInArrayLiteralIC_Miss, 5, 1) \
F(KeyedStoreIC_Slow, 5, 1) \
F(KeyedStoreIC_Slow, 3, 1) \
F(LoadAccessorProperty, 4, 1) \
F(LoadCallbackProperty, 4, 1) \
F(LoadElementWithInterceptor, 2, 1) \
......
......@@ -74,7 +74,7 @@ bytecodes: [
B(LdaSmi), I8(2),
B(Star), R(4),
B(Mov), R(this), R(1),
/* 138 E> */ B(CallRuntime), U16(Runtime::kStoreToSuper_Strict), R(1), U8(4),
/* 138 E> */ B(CallRuntime), U16(Runtime::kStoreToSuper), R(1), U8(4),
/* 143 S> */ B(LdaConstant), U8(0),
/* 150 E> */ B(LdaKeyedProperty), R(closure), U8(2),
B(Star), R(2),
......
......@@ -240,9 +240,9 @@ handlers: [
snippet: "
var a = 1; return { 1: a };
"
frame size: 6
frame size: 5
parameter count: 1
bytecode array length: 32
bytecode array length: 29
bytecodes: [
/* 30 E> */ B(StackCheck),
/* 42 S> */ B(LdaSmi), I8(1),
......@@ -251,11 +251,9 @@ bytecodes: [
B(Star), R(1),
B(LdaSmi), I8(1),
B(Star), R(3),
B(LdaZero),
B(Star), R(5),
B(Mov), R(1), R(2),
B(Mov), R(0), R(4),
/* 57 E> */ B(CallRuntime), U16(Runtime::kSetKeyedProperty), R(2), U8(4),
/* 57 E> */ B(CallRuntime), U16(Runtime::kSetKeyedProperty), R(2), U8(3),
B(Ldar), R(2),
/* 61 S> */ B(Return),
]
......
......@@ -23504,8 +23504,8 @@ TEST(AccessCheckThrows) {
CheckCorrectThrow("JSON.stringify(other)");
CheckCorrectThrow("has_own_property(other, 'x')");
CheckCorrectThrow("%GetProperty(other, 'x')");
CheckCorrectThrow("%SetKeyedProperty(other, 'x', 'foo', 0)");
CheckCorrectThrow("%SetNamedProperty(other, 'y', 'foo', 1)");
CheckCorrectThrow("%SetKeyedProperty(other, 'x', 'foo')");
CheckCorrectThrow("%SetNamedProperty(other, 'y', 'foo')");
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
......@@ -16,4 +16,4 @@ f(str, 0);
f(str, 0);
// This is just to trigger elements validation, object already broken.
%SetKeyedProperty(str, 1, 'y', 0);
%SetKeyedProperty(str, 1, 'y');
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