From 2923136f95c2504716440b8e4401939109ab239f Mon Sep 17 00:00:00 2001 From: "yangguo@chromium.org" Date: Thu, 27 Oct 2011 07:59:12 +0000 Subject: [PATCH] Fixing performance regression in issue 1787. BUG=v8:1787 Review URL: http://codereview.chromium.org/8390050 git-svn-id: http://v8.googlecode.com/svn/branches/bleeding_edge@9812 ce2b1a6d-e550-0410-aec6-3dcde31c8c00 --- src/arm/code-stubs-arm.cc | 15 +++++++++++++-- src/ia32/code-stubs-ia32.cc | 5 +++++ src/x64/code-stubs-x64.cc | 5 +++++ 3 files changed, 23 insertions(+), 2 deletions(-) diff --git a/src/arm/code-stubs-arm.cc b/src/arm/code-stubs-arm.cc index 412ba00fc..cb3bc88a7 100644 --- a/src/arm/code-stubs-arm.cc +++ b/src/arm/code-stubs-arm.cc @@ -6839,6 +6839,11 @@ void StringDictionaryLookupStub::GeneratePositiveLookup(MacroAssembler* masm, Register name, Register scratch1, Register scratch2) { + ASSERT(!elements.is(scratch1)); + ASSERT(!elements.is(scratch2)); + ASSERT(!name.is(scratch1)); + ASSERT(!name.is(scratch2)); + // Assert that name contains a string. if (FLAG_debug_code) __ AbortIfNotString(name); @@ -6882,8 +6887,14 @@ void StringDictionaryLookupStub::GeneratePositiveLookup(MacroAssembler* masm, ~(scratch1.bit() | scratch2.bit()); __ stm(db_w, sp, spill_mask); - __ Move(r0, elements); - __ Move(r1, name); + if (name.is(r0)) { + ASSERT(!elements.is(r1)); + __ Move(r1, name); + __ Move(r0, elements); + } else { + __ Move(r0, elements); + __ Move(r1, name); + } StringDictionaryLookupStub stub(POSITIVE_LOOKUP); __ CallStub(&stub); __ tst(r0, Operand(r0)); diff --git a/src/ia32/code-stubs-ia32.cc b/src/ia32/code-stubs-ia32.cc index d7d1d9c3c..37b519aad 100644 --- a/src/ia32/code-stubs-ia32.cc +++ b/src/ia32/code-stubs-ia32.cc @@ -6673,6 +6673,11 @@ void StringDictionaryLookupStub::GeneratePositiveLookup(MacroAssembler* masm, Register name, Register r0, Register r1) { + ASSERT(!elements.is(r0)); + ASSERT(!elements.is(r1)); + ASSERT(!name.is(r0)); + ASSERT(!name.is(r1)); + // Assert that name contains a string. if (FLAG_debug_code) __ AbortIfNotString(name); diff --git a/src/x64/code-stubs-x64.cc b/src/x64/code-stubs-x64.cc index 3dfebeec4..f62c5172e 100644 --- a/src/x64/code-stubs-x64.cc +++ b/src/x64/code-stubs-x64.cc @@ -5595,6 +5595,11 @@ void StringDictionaryLookupStub::GeneratePositiveLookup(MacroAssembler* masm, Register name, Register r0, Register r1) { + ASSERT(!elements.is(r0)); + ASSERT(!elements.is(r1)); + ASSERT(!name.is(r0)); + ASSERT(!name.is(r1)); + // Assert that name contains a string. if (FLAG_debug_code) __ AbortIfNotString(name); -- 2.34.1