Commit 6ffcdddb authored by Nico Hartmann's avatar Nico Hartmann Committed by V8 LUCI CQ

Revert "[runtime] Reset clobbered argument in DefineClass"

This reverts commit 9b5f3985.

Reason for revert: https://ci.chromium.org/ui/p/v8/builders/ci/V8%20Linux64%20GC%20Stress%20-%20custom%20snapshot/39804/overview

Original change's description:
> [runtime] Reset clobbered argument in DefineClass
>
> The caller of DefineClass may not expect its arguments to be mutated, so
> add an arguments mutation scope which resets the argument clobbered by
> DefineClass.
>
> Bug: chromium:1268738
> Change-Id: I03e9cd82535ca1f83353012a92e80f822566e64e
> Reviewed-on: https://chromium-review.googlesource.com/c/v8/v8/+/3283077
> Auto-Submit: Leszek Swirski <leszeks@chromium.org>
> Commit-Queue: Igor Sheludko <ishell@chromium.org>
> Reviewed-by: Igor Sheludko <ishell@chromium.org>
> Cr-Commit-Position: refs/heads/main@{#77921}

Bug: chromium:1268738
Change-Id: I878bd78f8ed265c18cd01e3105a69c8a8f876208
No-Presubmit: true
No-Tree-Checks: true
No-Try: true
Reviewed-on: https://chromium-review.googlesource.com/c/v8/v8/+/3284886
Owners-Override: Nico Hartmann <nicohartmann@chromium.org>
Bot-Commit: Rubber Stamper <rubber-stamper@appspot.gserviceaccount.com>
Reviewed-by: 's avatarNico Hartmann <nicohartmann@chromium.org>
Commit-Queue: Nico Hartmann <nicohartmann@chromium.org>
Cr-Commit-Position: refs/heads/main@{#77924}
parent 1c218f40
...@@ -33,21 +33,6 @@ namespace internal { ...@@ -33,21 +33,6 @@ namespace internal {
template <ArgumentsType arguments_type> template <ArgumentsType arguments_type>
class Arguments { class Arguments {
public: public:
// Scope to temporarily change the value of an argument.
class ChangeValueScope {
public:
ChangeValueScope(Arguments* args, int index, Object value)
: location_(args->address_of_arg_at(index)) {
old_value_ = *location_;
*location_ = value.ptr();
}
~ChangeValueScope() { *location_ = old_value_; }
private:
Address* location_;
Address old_value_;
};
Arguments(int length, Address* arguments) Arguments(int length, Address* arguments)
: length_(length), arguments_(arguments) { : length_(length), arguments_(arguments) {
DCHECK_GE(length_, 0); DCHECK_GE(length_, 0);
...@@ -66,6 +51,10 @@ class Arguments { ...@@ -66,6 +51,10 @@ class Arguments {
inline double number_at(int index) const; inline double number_at(int index) const;
inline void set_at(int index, Object value) {
*address_of_arg_at(index) = value.ptr();
}
inline FullObjectSlot slot_at(int index) const { inline FullObjectSlot slot_at(int index) const {
return FullObjectSlot(address_of_arg_at(index)); return FullObjectSlot(address_of_arg_at(index));
} }
......
...@@ -629,12 +629,7 @@ MaybeHandle<Object> DefineClass(Isolate* isolate, ...@@ -629,12 +629,7 @@ MaybeHandle<Object> DefineClass(Isolate* isolate,
Handle<JSObject> prototype = CreateClassPrototype(isolate); Handle<JSObject> prototype = CreateClassPrototype(isolate);
DCHECK_EQ(*constructor, args[ClassBoilerplate::kConstructorArgumentIndex]); DCHECK_EQ(*constructor, args[ClassBoilerplate::kConstructorArgumentIndex]);
// Temporarily change ClassBoilerplate::kPrototypeArgumentIndex for the args.set_at(ClassBoilerplate::kPrototypeArgumentIndex, *prototype);
// subsequent calls, but use a scope to make sure to change it back before
// returning, to not corrupt the caller's argument frame (in particular, for
// the interpreter, to not clobber the register frame).
RuntimeArguments::ChangeValueScope set_prototype_value_scope(
&args, ClassBoilerplate::kPrototypeArgumentIndex, *prototype);
if (!InitClassConstructor(isolate, class_boilerplate, constructor_parent, if (!InitClassConstructor(isolate, class_boilerplate, constructor_parent,
constructor, args) || constructor, args) ||
......
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