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

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

Issue 801333002: [turbofan] Remove the no-context hack for JSToNumber. (Closed) Base URL: https://chromium.googlesource.com/v8/v8.git@master
Patch Set: Improve ARM 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 | « src/arm/code-stubs-arm.cc ('k') | src/compiler/js-generic-lowering.h » ('j') | no next file with comments »
Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
Index: src/arm64/code-stubs-arm64.cc
diff --git a/src/arm64/code-stubs-arm64.cc b/src/arm64/code-stubs-arm64.cc
index 6392640741ba3513f025927b0365e5abd0d50bfe..e773b531a1e2784ca34a05626728621c5fd4adc2 100644
--- a/src/arm64/code-stubs-arm64.cc
+++ b/src/arm64/code-stubs-arm64.cc
@@ -3887,16 +3887,43 @@ void SubStringStub::Generate(MacroAssembler* masm) {
void ToNumberStub::Generate(MacroAssembler* masm) {
// The ToNumber stub takes one argument in x0.
- Label check_heap_number, call_builtin;
- __ JumpIfNotSmi(x0, &check_heap_number);
+ Label not_smi;
+ __ JumpIfNotSmi(x0, &not_smi);
__ Ret();
-
- __ bind(&check_heap_number);
- __ JumpIfNotHeapNumber(x0, &call_builtin);
+ __ Bind(&not_smi);
+
+ Label not_heap_number;
+ __ Ldr(x1, FieldMemOperand(x0, HeapObject::kMapOffset));
+ __ Ldrb(x1, FieldMemOperand(x1, Map::kInstanceTypeOffset));
+ // x0: object
+ // x1: instance type
+ __ Cmp(x1, HEAP_NUMBER_TYPE);
+ __ B(ne, &not_heap_number);
+ __ Ret();
+ __ Bind(&not_heap_number);
+
+ Label not_string, slow_string;
+ __ Cmp(x1, FIRST_NONSTRING_TYPE);
+ __ B(hs, &not_string);
+ // Check if string has a cached array index.
+ __ Ldr(x2, FieldMemOperand(x0, String::kHashFieldOffset));
+ __ Tst(x2, Operand(String::kContainsCachedArrayIndexMask));
+ __ B(ne, &slow_string);
+ __ IndexFromHash(x2, x0);
+ __ Ret();
+ __ Bind(&slow_string);
+ __ Push(x0); // Push argument.
+ __ TailCallRuntime(Runtime::kStringToNumber, 1, 1);
+ __ Bind(&not_string);
+
+ Label not_oddball;
+ __ Cmp(x1, ODDBALL_TYPE);
+ __ B(ne, &not_oddball);
+ __ Ldr(x0, FieldMemOperand(x0, Oddball::kToNumberOffset));
__ Ret();
+ __ Bind(&not_oddball);
- __ bind(&call_builtin);
- __ push(x0);
+ __ Push(x0); // Push argument.
__ InvokeBuiltin(Builtins::TO_NUMBER, JUMP_FUNCTION);
}
« no previous file with comments | « src/arm/code-stubs-arm.cc ('k') | src/compiler/js-generic-lowering.h » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698