Commit cb05c2df authored by jyan's avatar jyan Committed by Commit bot

S390: [stubs] StringToNumberStub --> StringToNumber builtin.

port 546dd77f

Original Commit Message:
  Since some builtins use StringToNumberStub (so the code is always there),
  it makes more sense to have StringToNumber builtin.

R=jarin@chromium.org, joransiu@ca.ibm.com, jyan@ca.ibm.com, michael_dawson@ca.ibm.com, mbrandy@us.ibm.com, bjaideep@ca.ibm.com
BUG=

Review-Url: https://codereview.chromium.org/2052833003
Cr-Commit-Position: refs/heads/master@{#36872}
parent 9dc62d27
...@@ -2717,6 +2717,24 @@ void Builtins::Generate_AllocateInOldSpace(MacroAssembler* masm) { ...@@ -2717,6 +2717,24 @@ void Builtins::Generate_AllocateInOldSpace(MacroAssembler* masm) {
__ TailCallRuntime(Runtime::kAllocateInTargetSpace); __ TailCallRuntime(Runtime::kAllocateInTargetSpace);
} }
// static
void Builtins::Generate_StringToNumber(MacroAssembler* masm) {
// The StringToNumber stub takes one argument in r2.
__ AssertString(r2);
// Check if string has a cached array index.
Label runtime;
__ LoadlW(r4, FieldMemOperand(r2, String::kHashFieldOffset));
__ And(r0, r4, Operand(String::kContainsCachedArrayIndexMask));
__ bne(&runtime);
__ IndexFromHash(r4, r2);
__ Ret();
__ bind(&runtime);
__ push(r2); // Push argument.
__ TailCallRuntime(Runtime::kStringToNumber);
}
void Builtins::Generate_ArgumentsAdaptorTrampoline(MacroAssembler* masm) { void Builtins::Generate_ArgumentsAdaptorTrampoline(MacroAssembler* masm) {
// ----------- S t a t e ------------- // ----------- S t a t e -------------
// -- r2 : actual number of arguments // -- r2 : actual number of arguments
......
...@@ -2591,8 +2591,7 @@ void NonNumberToNumberStub::Generate(MacroAssembler* masm) { ...@@ -2591,8 +2591,7 @@ void NonNumberToNumberStub::Generate(MacroAssembler* masm) {
__ CompareObjectType(r2, r3, r3, FIRST_NONSTRING_TYPE); __ CompareObjectType(r2, r3, r3, FIRST_NONSTRING_TYPE);
// r2: receiver // r2: receiver
// r3: receiver instance type // r3: receiver instance type
StringToNumberStub stub(masm->isolate()); __ Jump(isolate()->builtins()->StringToNumber(), RelocInfo::CODE_TARGET, lt);
__ TailCallStub(&stub, lt);
Label not_oddball; Label not_oddball;
__ CmpP(r3, Operand(ODDBALL_TYPE)); __ CmpP(r3, Operand(ODDBALL_TYPE));
...@@ -2605,23 +2604,6 @@ void NonNumberToNumberStub::Generate(MacroAssembler* masm) { ...@@ -2605,23 +2604,6 @@ void NonNumberToNumberStub::Generate(MacroAssembler* masm) {
__ TailCallRuntime(Runtime::kToNumber); __ TailCallRuntime(Runtime::kToNumber);
} }
void StringToNumberStub::Generate(MacroAssembler* masm) {
// The StringToNumber stub takes one argument in r2.
__ AssertString(r2);
// Check if string has a cached array index.
Label runtime;
__ LoadlW(r4, FieldMemOperand(r2, String::kHashFieldOffset));
__ And(r0, r4, Operand(String::kContainsCachedArrayIndexMask));
__ bne(&runtime);
__ IndexFromHash(r4, r2);
__ Ret();
__ bind(&runtime);
__ push(r2); // Push argument.
__ TailCallRuntime(Runtime::kStringToNumber);
}
void ToStringStub::Generate(MacroAssembler* masm) { void ToStringStub::Generate(MacroAssembler* masm) {
// The ToString stub takes one argument in r2. // The ToString stub takes one argument in r2.
Label done; Label done;
......
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