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

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

Issue 803973002: MIPS: [turbofan] Remove the no-context hack for JSToNumber. (Closed) Base URL: https://chromium.googlesource.com/v8/v8.git@master
Patch Set: Created 6 years 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/mips64/code-stubs-mips64.cc » ('j') | no next file with comments »
Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
Index: src/mips/code-stubs-mips.cc
diff --git a/src/mips/code-stubs-mips.cc b/src/mips/code-stubs-mips.cc
index e2b47c74c9c01299f3412111edf07b8eef5dfc66..97eed7470725f5ab2c1cb194ab78da0e25dfabaa 100644
--- a/src/mips/code-stubs-mips.cc
+++ b/src/mips/code-stubs-mips.cc
@@ -3340,20 +3340,43 @@ void SubStringStub::Generate(MacroAssembler* masm) {
void ToNumberStub::Generate(MacroAssembler* masm) {
// The ToNumber stub takes one argument in a0.
- Label check_heap_number, call_builtin;
- __ JumpIfNotSmi(a0, &check_heap_number);
+ Label not_smi;
+ __ JumpIfNotSmi(a0, &not_smi);
__ Ret(USE_DELAY_SLOT);
__ mov(v0, a0);
+ __ bind(&not_smi);
- __ bind(&check_heap_number);
+ Label not_heap_number;
__ lw(a1, FieldMemOperand(a0, HeapObject::kMapOffset));
- __ LoadRoot(at, Heap::kHeapNumberMapRootIndex);
- __ Branch(&call_builtin, ne, a1, Operand(at));
+ __ lbu(a1, FieldMemOperand(a1, Map::kInstanceTypeOffset));
+ // a0: object
+ // a1: instance type.
+ __ Branch(&not_heap_number, ne, a1, Operand(HEAP_NUMBER_TYPE));
+ __ Ret(USE_DELAY_SLOT);
+ __ mov(v0, a0);
+ __ bind(&not_heap_number);
+
+ Label not_string, slow_string;
+ __ Branch(&not_string, hs, a1, Operand(FIRST_NONSTRING_TYPE));
+ // Check if string has a cached array index.
+ __ lw(a2, FieldMemOperand(a0, String::kHashFieldOffset));
+ __ And(at, a2, Operand(String::kContainsCachedArrayIndexMask));
+ __ Branch(&slow_string, ne, at, Operand(zero_reg));
+ __ IndexFromHash(a2, a0);
__ Ret(USE_DELAY_SLOT);
__ mov(v0, a0);
+ __ bind(&slow_string);
+ __ push(a0); // Push argument.
+ __ TailCallRuntime(Runtime::kStringToNumber, 1, 1);
+ __ bind(&not_string);
+
+ Label not_oddball;
+ __ Branch(&not_oddball, ne, a1, Operand(ODDBALL_TYPE));
+ __ Ret(USE_DELAY_SLOT);
+ __ lw(v0, FieldMemOperand(a0, Oddball::kToNumberOffset));
+ __ bind(&not_oddball);
- __ bind(&call_builtin);
- __ push(a0);
+ __ push(a0); // Push argument.
__ InvokeBuiltin(Builtins::TO_NUMBER, JUMP_FUNCTION);
}
« no previous file with comments | « no previous file | src/mips64/code-stubs-mips64.cc » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698