Commit f46c6037 authored by Junliang Yan's avatar Junliang Yan Committed by Commit Bot

s390: Remove experiment for restricting constructor return values

Port 813094ac

Original Commit Message:

    This is not web compatible, so let's delete the code.

R=gsathya@chromium.org, joransiu@ca.ibm.com, michael_dawson@ca.ibm.com
BUG=
LOG=N

Change-Id: I8cbe561b176c25900d4e40eb8912e5c0b4c44410
Reviewed-on: https://chromium-review.googlesource.com/1069170Reviewed-by: 's avatarJoran Siu <joransiu@ca.ibm.com>
Commit-Queue: Junliang Yan <jyan@ca.ibm.com>
Cr-Commit-Position: refs/heads/master@{#53290}
parent 3cd0a367
...@@ -249,9 +249,10 @@ void Generate_JSBuiltinsConstructStubHelper(MacroAssembler* masm) { ...@@ -249,9 +249,10 @@ void Generate_JSBuiltinsConstructStubHelper(MacroAssembler* masm) {
__ Ret(); __ Ret();
} }
} // namespace
// The construct stub for ES5 constructor functions and ES6 class constructors. // The construct stub for ES5 constructor functions and ES6 class constructors.
void Generate_JSConstructStubGeneric(MacroAssembler* masm, void Builtins::Generate_JSConstructStubGeneric(MacroAssembler* masm) {
bool restrict_constructor_return) {
// ----------- S t a t e ------------- // ----------- S t a t e -------------
// -- r2: number of arguments (untagged) // -- r2: number of arguments (untagged)
// -- r3: constructor function // -- r3: constructor function
...@@ -383,7 +384,7 @@ void Generate_JSConstructStubGeneric(MacroAssembler* masm, ...@@ -383,7 +384,7 @@ void Generate_JSConstructStubGeneric(MacroAssembler* masm,
// If the result is an object (in the ECMA sense), we should get rid // If the result is an object (in the ECMA sense), we should get rid
// of the receiver and use the result; see ECMA-262 section 13.2.2-7 // of the receiver and use the result; see ECMA-262 section 13.2.2-7
// on page 74. // on page 74.
Label use_receiver, do_throw, other_result, leave_frame; Label use_receiver, do_throw, leave_frame;
// If the result is undefined, we jump out to using the implicit receiver. // If the result is undefined, we jump out to using the implicit receiver.
__ JumpIfRoot(r2, Heap::kUndefinedValueRootIndex, &use_receiver); __ JumpIfRoot(r2, Heap::kUndefinedValueRootIndex, &use_receiver);
...@@ -392,26 +393,15 @@ void Generate_JSConstructStubGeneric(MacroAssembler* masm, ...@@ -392,26 +393,15 @@ void Generate_JSConstructStubGeneric(MacroAssembler* masm,
// is a valid receiver. // is a valid receiver.
// If the result is a smi, it is *not* an object in the ECMA sense. // If the result is a smi, it is *not* an object in the ECMA sense.
__ JumpIfSmi(r2, &other_result); __ JumpIfSmi(r2, &use_receiver);
// If the type of the result (stored in its map) is less than // If the type of the result (stored in its map) is less than
// FIRST_JS_RECEIVER_TYPE, it is not an object in the ECMA sense. // FIRST_JS_RECEIVER_TYPE, it is not an object in the ECMA sense.
STATIC_ASSERT(LAST_JS_RECEIVER_TYPE == LAST_TYPE); STATIC_ASSERT(LAST_JS_RECEIVER_TYPE == LAST_TYPE);
__ CompareObjectType(r2, r6, r6, FIRST_JS_RECEIVER_TYPE); __ CompareObjectType(r2, r6, r6, FIRST_JS_RECEIVER_TYPE);
__ bge(&leave_frame); __ bge(&leave_frame);
__ b(&use_receiver);
__ bind(&other_result);
// The result is now neither undefined nor an object.
if (restrict_constructor_return) {
// Throw if constructor function is a class constructor
__ LoadP(r6, MemOperand(fp, ConstructFrameConstants::kConstructorOffset));
__ LoadP(r6, FieldMemOperand(r6, JSFunction::kSharedFunctionInfoOffset));
__ LoadlW(r6, FieldMemOperand(r6, SharedFunctionInfo::kFlagsOffset));
__ TestBitMask(r6, SharedFunctionInfo::IsClassConstructorBit::kMask, r0);
__ beq(&use_receiver);
} else {
__ b(&use_receiver);
}
__ bind(&do_throw); __ bind(&do_throw);
__ CallRuntime(Runtime::kThrowConstructorReturnedNonObject); __ CallRuntime(Runtime::kThrowConstructorReturnedNonObject);
...@@ -435,16 +425,7 @@ void Generate_JSConstructStubGeneric(MacroAssembler* masm, ...@@ -435,16 +425,7 @@ void Generate_JSConstructStubGeneric(MacroAssembler* masm,
__ AddP(sp, sp, Operand(kPointerSize)); __ AddP(sp, sp, Operand(kPointerSize));
__ Ret(); __ Ret();
} }
} // namespace
void Builtins::Generate_JSConstructStubGenericRestrictedReturn(
MacroAssembler* masm) {
Generate_JSConstructStubGeneric(masm, true);
}
void Builtins::Generate_JSConstructStubGenericUnrestrictedReturn(
MacroAssembler* masm) {
Generate_JSConstructStubGeneric(masm, false);
}
void Builtins::Generate_JSBuiltinsConstructStub(MacroAssembler* masm) { void Builtins::Generate_JSBuiltinsConstructStub(MacroAssembler* masm) {
Generate_JSBuiltinsConstructStubHelper(masm); Generate_JSBuiltinsConstructStubHelper(masm);
} }
...@@ -2402,7 +2383,7 @@ void Builtins::Generate_ConstructFunction(MacroAssembler* masm) { ...@@ -2402,7 +2383,7 @@ void Builtins::Generate_ConstructFunction(MacroAssembler* masm) {
RelocInfo::CODE_TARGET); RelocInfo::CODE_TARGET);
__ bind(&call_generic_stub); __ bind(&call_generic_stub);
__ Jump(masm->isolate()->builtins()->JSConstructStubGeneric(), __ Jump(BUILTIN_CODE(masm->isolate(), JSConstructStubGeneric),
RelocInfo::CODE_TARGET); RelocInfo::CODE_TARGET);
} }
......
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