Chromium Code Reviews
chromiumcodereview-hr@appspot.gserviceaccount.com (chromiumcodereview-hr) | Please choose your nickname with Settings | Help | Chromium Project | Gerrit Changes | Sign out
(487)

Unified Diff: src/s390/code-stubs-s390.cc

Issue 1825593003: S390: [stubs] Split ToNumberStub into reusable subparts. (Closed) Base URL: https://chromium.googlesource.com/v8/v8.git@master
Patch Set: PS1 Created 4 years, 9 months ago
Use n/p to move between diff chunks; N/P to move between comments. Draft comments are only viewable by you.
Jump to:
View side-by-side diff with in-line comments
Download patch
« no previous file with comments | « no previous file | src/s390/macro-assembler-s390.h » ('j') | src/s390/macro-assembler-s390.cc » ('J')
Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
Index: src/s390/code-stubs-s390.cc
diff --git a/src/s390/code-stubs-s390.cc b/src/s390/code-stubs-s390.cc
index 95eaec12443cb239c9da224c51561608cee8c4ee..177505fb16b83bbbaa7e5f94d978a998820c109a 100644
--- a/src/s390/code-stubs-s390.cc
+++ b/src/s390/code-stubs-s390.cc
@@ -2712,10 +2712,9 @@ void SubStringStub::Generate(MacroAssembler* masm) {
void ToNumberStub::Generate(MacroAssembler* masm) {
// The ToNumber stub takes one argument in r2.
- Label not_smi;
- __ JumpIfNotSmi(r2, &not_smi);
- __ b(r14);
- __ bind(&not_smi);
+ STATIC_ASSERT(kSmiTag == 0);
+ __ TestIfSmi(r2);
+ __ Ret(eq);
__ CompareObjectType(r2, r3, r3, HEAP_NUMBER_TYPE);
// r2: receiver
@@ -2725,19 +2724,19 @@ void ToNumberStub::Generate(MacroAssembler* masm) {
__ Ret();
__ bind(&not_heap_number);
- Label not_string, slow_string;
- __ CmpLogicalP(r3, Operand(FIRST_NONSTRING_TYPE));
- __ bge(&not_string, Label::kNear);
- // Check if string has a cached array index.
- __ LoadlW(r4, FieldMemOperand(r2, String::kHashFieldOffset));
- __ AndP(r0, r4, Operand(String::kContainsCachedArrayIndexMask));
- __ bne(&slow_string, Label::kNear);
- __ IndexFromHash(r4, r2);
- __ b(r14);
- __ bind(&slow_string);
- __ push(r2); // Push argument.
- __ TailCallRuntime(Runtime::kStringToNumber);
- __ bind(&not_string);
+ NonNumberToNumberStub stub(masm->isolate());
+ __ TailCallStub(&stub);
+}
+
+void NonNumberToNumberStub::Generate(MacroAssembler* masm) {
+ // The NonNumberToNumber stub takes one argument in r2.
+ __ AssertNotNumber(r2);
+
+ __ CompareObjectType(r2, r3, r3, FIRST_NONSTRING_TYPE);
+ // r2: receiver
+ // r3: receiver instance type
+ StringToNumberStub stub(masm->isolate());
+ __ TailCallStub(&stub, lt);
Label not_oddball;
__ CmpP(r3, Operand(ODDBALL_TYPE));
@@ -2750,6 +2749,23 @@ void ToNumberStub::Generate(MacroAssembler* masm) {
__ 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 ToLengthStub::Generate(MacroAssembler* masm) {
// The ToLength stub takes one argument in r2.
Label not_smi;
« no previous file with comments | « no previous file | src/s390/macro-assembler-s390.h » ('j') | src/s390/macro-assembler-s390.cc » ('J')

Powered by Google App Engine
This is Rietveld 408576698