From 40ad4cc7f184f7b1f52eb17a72c013ef1c8de866 Mon Sep 17 00:00:00 2001 From: "palfia@homejinni.com" Date: Wed, 25 Sep 2013 00:41:37 +0000 Subject: [PATCH] MIPS: Turn the NumberToStringStub into a hydrogen stub. Port r16910 (5a0dd952) Original commit message: This adds a BuildLookupNumberStringCache() in Hydrogen, which will be used by the hydrogen version of StringAddStub, in addition to the hydrogen version of NumberToStringStub. BUG= R=plind44@gmail.com Review URL: https://codereview.chromium.org/24436004 git-svn-id: http://v8.googlecode.com/svn/branches/bleeding_edge@16926 ce2b1a6d-e550-0410-aec6-3dcde31c8c00 --- src/mips/code-stubs-mips.cc | 25 ++++++++++--------------- src/mips/code-stubs-mips.h | 12 ------------ src/mips/full-codegen-mips.cc | 5 +++-- src/mips/lithium-codegen-mips.cc | 5 ----- 4 files changed, 13 insertions(+), 34 deletions(-) diff --git a/src/mips/code-stubs-mips.cc b/src/mips/code-stubs-mips.cc index ea104fb..9ee9697 100644 --- a/src/mips/code-stubs-mips.cc +++ b/src/mips/code-stubs-mips.cc @@ -60,6 +60,16 @@ void ToNumberStub::InitializeInterfaceDescriptor( } +void NumberToStringStub::InitializeInterfaceDescriptor( + Isolate* isolate, + CodeStubInterfaceDescriptor* descriptor) { + static Register registers[] = { a0 }; + descriptor->register_param_count_ = 1; + descriptor->register_params_ = registers; + descriptor->deoptimization_handler_ = NULL; +} + + void FastCloneShallowArrayStub::InitializeInterfaceDescriptor( Isolate* isolate, CodeStubInterfaceDescriptor* descriptor) { @@ -994,21 +1004,6 @@ static void EmitCheckForInternalizedStringsOrObjects(MacroAssembler* masm, } -void NumberToStringStub::Generate(MacroAssembler* masm) { - Label runtime; - - __ lw(a1, MemOperand(sp, 0)); - - // Generate code to lookup number in the number string cache. - __ LookupNumberStringCache(a1, v0, a2, a3, t0, &runtime); - __ DropAndRet(1); - - __ bind(&runtime); - // Handle number to string in the runtime system if not found in the cache. - __ TailCallRuntime(Runtime::kNumberToString, 1, 1); -} - - static void ICCompareStub_CheckInputType(MacroAssembler* masm, Register input, Register scratch, diff --git a/src/mips/code-stubs-mips.h b/src/mips/code-stubs-mips.h index 627244c..91a18d9 100644 --- a/src/mips/code-stubs-mips.h +++ b/src/mips/code-stubs-mips.h @@ -268,18 +268,6 @@ class WriteInt32ToHeapNumberStub : public PlatformCodeStub { }; -class NumberToStringStub: public PlatformCodeStub { - public: - NumberToStringStub() { } - - private: - Major MajorKey() { return NumberToString; } - int MinorKey() { return 0; } - - void Generate(MacroAssembler* masm); -}; - - class RecordWriteStub: public PlatformCodeStub { public: RecordWriteStub(Register object, diff --git a/src/mips/full-codegen-mips.cc b/src/mips/full-codegen-mips.cc index 853ee08..f889470 100644 --- a/src/mips/full-codegen-mips.cc +++ b/src/mips/full-codegen-mips.cc @@ -3611,8 +3611,9 @@ void FullCodeGenerator::EmitNumberToString(CallRuntime* expr) { ZoneList* args = expr->arguments(); ASSERT_EQ(args->length(), 1); - // Load the argument on the stack and call the stub. - VisitForStackValue(args->at(0)); + // Load the argument into a0 and call the stub. + VisitForAccumulatorValue(args->at(0)); + __ mov(a0, result_register()); NumberToStringStub stub; __ CallStub(&stub); diff --git a/src/mips/lithium-codegen-mips.cc b/src/mips/lithium-codegen-mips.cc index 69a3c89..c869184 100644 --- a/src/mips/lithium-codegen-mips.cc +++ b/src/mips/lithium-codegen-mips.cc @@ -1063,11 +1063,6 @@ void LCodeGen::DoCallStub(LCallStub* instr) { CallCode(stub.GetCode(isolate()), RelocInfo::CODE_TARGET, instr); break; } - case CodeStub::NumberToString: { - NumberToStringStub stub; - CallCode(stub.GetCode(isolate()), RelocInfo::CODE_TARGET, instr); - break; - } case CodeStub::StringCompare: { StringCompareStub stub; CallCode(stub.GetCode(isolate()), RelocInfo::CODE_TARGET, instr); -- 2.7.4