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

Unified Diff: src/arm64/lithium-codegen-arm64.cc

Issue 1114563003: Optimize the typeof operator. (Closed) Base URL: https://chromium.googlesource.com/v8/v8.git@master
Patch Set: Ports. Created 5 years, 8 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
Index: src/arm64/lithium-codegen-arm64.cc
diff --git a/src/arm64/lithium-codegen-arm64.cc b/src/arm64/lithium-codegen-arm64.cc
index 13da0b99b1fad3d81514f65db56d079c7c6d1480..f3aab34b57da714c0b9bd1e402eba31bd79a5a92 100644
--- a/src/arm64/lithium-codegen-arm64.cc
+++ b/src/arm64/lithium-codegen-arm64.cc
@@ -5782,9 +5782,17 @@ void LCodeGen::DoTruncateDoubleToIntOrSmi(LTruncateDoubleToIntOrSmi* instr) {
void LCodeGen::DoTypeof(LTypeof* instr) {
- Register input = ToRegister(instr->value());
- __ Push(input);
- CallRuntime(Runtime::kTypeof, 1, instr);
+ DCHECK(ToRegister(instr->value()).is(x3));
+ DCHECK(ToRegister(instr->result()).is(x0));
+ Label end, do_call;
+ Register value_register = ToRegister(instr->value());
+ __ JumpIfNotSmi(value_register, &do_call);
+ __ Mov(x0, Immediate(isolate()->factory()->number_string()));
+ __ B(&end);
+ __ Bind(&do_call);
+ TypeofStub stub(isolate());
+ CallCode(stub.GetCode(), RelocInfo::CODE_TARGET, instr);
+ __ Bind(&end);
}
« no previous file with comments | « src/arm64/lithium-arm64.cc ('k') | src/code-factory.h » ('j') | src/mips/lithium-codegen-mips.cc » ('J')

Powered by Google App Engine
This is Rietveld 408576698