From b2ff7a09b5313dbed881ff335fceea6d06a1da44 Mon Sep 17 00:00:00 2001 From: "danno@chromium.org" Date: Sat, 16 Nov 2013 15:22:09 +0000 Subject: [PATCH] Correct r17804 to match latest version of uploaded CL TBR=mvstanton@chromium.org Review URL: https://codereview.chromium.org/73923004 git-svn-id: http://v8.googlecode.com/svn/branches/bleeding_edge@17807 ce2b1a6d-e550-0410-aec6-3dcde31c8c00 --- src/arm/macro-assembler-arm.cc | 3 + src/code-stubs-hydrogen.cc | 127 ++------------------------------------- src/ia32/macro-assembler-ia32.cc | 5 +- src/x64/code-stubs-x64.cc | 2 +- src/x64/macro-assembler-x64.cc | 3 + 5 files changed, 14 insertions(+), 126 deletions(-) diff --git a/src/arm/macro-assembler-arm.cc b/src/arm/macro-assembler-arm.cc index cd416e4..ad5bd76 100644 --- a/src/arm/macro-assembler-arm.cc +++ b/src/arm/macro-assembler-arm.cc @@ -1500,6 +1500,9 @@ void MacroAssembler::CheckAccessGlobalProxy(Register holder_reg, } +// Compute the hash code from the untagged key. This must be kept in sync with +// ComputeIntegerHash in utils.h and KeyedLoadGenericElementStub in +// code-stub-hydrogen.cc void MacroAssembler::GetNumberHash(Register t0, Register scratch) { // First of all we assign the hash seed to scratch. LoadRoot(scratch, Heap::kHashSeedRootIndex); diff --git a/src/code-stubs-hydrogen.cc b/src/code-stubs-hydrogen.cc index 45974d2..a992dcb 100644 --- a/src/code-stubs-hydrogen.cc +++ b/src/code-stubs-hydrogen.cc @@ -210,7 +210,7 @@ bool CodeStubGraphBuilderBase::BuildGraph() { template class CodeStubGraphBuilder: public CodeStubGraphBuilderBase { public: - explicit CodeStubGraphBuilder(Isolate* isolate, Stub* stub) + CodeStubGraphBuilder(Isolate* isolate, Stub* stub) : CodeStubGraphBuilderBase(isolate, stub) {} protected: @@ -1303,133 +1303,14 @@ Handle FastNewClosureStub::GenerateCode(Isolate* isolate) { } -template <> -class CodeStubGraphBuilder - : public CodeStubGraphBuilderBase { - public: - explicit CodeStubGraphBuilder(Isolate* isolate, - KeyedLoadDictionaryElementStub* stub) - : CodeStubGraphBuilderBase(isolate, stub) {} - - protected: - HValue* BuildCodeStubHelper(HValue* dictionary, - HValue* key, - HValue* hash, - HValue* mask, - int current_probe); - - virtual HValue* BuildCodeStub(); - - KeyedLoadDictionaryElementStub* casted_stub() { - return static_cast(stub()); - } -}; - - -HValue* CodeStubGraphBuilder:: - BuildCodeStubHelper( - HValue* elements, - HValue* key, - HValue* hash, - HValue* mask, - int current_probe) { - if (current_probe == kNumberDictionaryProbes) { - return NULL; - } - - int32_t offset = SeededNumberDictionary::GetProbeOffset(current_probe); - HValue* raw_index = (current_probe == 0) - ? hash - : Add(hash, Add(offset)); - raw_index = Add(Token::BIT_AND, raw_index, mask); - int32_t entry_size = SeededNumberDictionary::kEntrySize; - raw_index = Add(raw_index, Add(entry_size)); - raw_index->ClearFlag(HValue::kCanOverflow); - - int32_t base_offset = SeededNumberDictionary::kElementsStartIndex; - HValue* key_index = Add(raw_index, Add(base_offset)); - key_index->ClearFlag(HValue::kCanOverflow); - - HValue* candidate_key = Add(elements, key_index, - static_cast(NULL), - FAST_SMI_ELEMENTS); - - IfBuilder key_compare(this); - key_compare.IfNot(key, candidate_key); - key_compare.Then(); - { - // Key at the current probe doesn't match, try at the next probe. - HValue* result = BuildCodeStubHelper(elements, key, hash, mask, - current_probe + 1); - if (result == NULL) { - key_compare.Deopt("probes exhausted in keyed load dictionary lookup"); - result = graph()->GetConstantUndefined(); - } else { - Push(result); - } - } - key_compare.Else(); - { - // Key at current probe matches. Details must be zero, otherwise the - // dictionary element requires special handling. - HValue* details_index = Add(raw_index, - Add(base_offset + 2)); - details_index->ClearFlag(HValue::kCanOverflow); - - HValue* details = Add(elements, details_index, - static_cast(NULL), - FAST_SMI_ELEMENTS); - IfBuilder details_compare(this); - details_compare.If(details, - graph()->GetConstant0(), - Token::NE); - details_compare.ThenDeopt("keyed load dictionary element not fast case"); - - details_compare.Else(); - { - // Key matches and details are zero --> fast case. Load and return the - // value. - HValue* result_index = Add(raw_index, - Add(base_offset + 1)); - result_index->ClearFlag(HValue::kCanOverflow); - - Push(Add(elements, result_index, - static_cast(NULL), - FAST_ELEMENTS)); - } - details_compare.End(); - } - key_compare.End(); - - return Pop(); -} - - +template<> HValue* CodeStubGraphBuilder::BuildCodeStub() { - KeyedLoadDictionaryElementStub* stub = casted_stub(); - - HValue* dictionary = GetParameter(0); + HValue* receiver = GetParameter(0); HValue* key = GetParameter(1); - USE(stub); - USE(dictionary); - - HValue* elements = AddLoadElements(dictionary); Add(key); - HValue* hash = BuildElementIndexHash(key); - - HValue* capacity = Add( - elements, - Add(NameDictionary::kCapacityIndex), - static_cast(NULL), - FAST_SMI_ELEMENTS); - - HValue* mask = Add(capacity, graph()->GetConstant1()); - mask->ChangeRepresentation(Representation::Integer32()); - mask->ClearFlag(HValue::kCanOverflow); - - return BuildCodeStubHelper(elements, key, hash, mask, 0); + return BuildUncheckedDictionaryElementLoad(receiver, key); } diff --git a/src/ia32/macro-assembler-ia32.cc b/src/ia32/macro-assembler-ia32.cc index 8ebef68..a46f8d9 100644 --- a/src/ia32/macro-assembler-ia32.cc +++ b/src/ia32/macro-assembler-ia32.cc @@ -1412,8 +1412,9 @@ void MacroAssembler::CheckAccessGlobalProxy(Register holder_reg, } -// Compute the hash code from the untagged key. This must be kept in sync -// with ComputeIntegerHash in utils.h. +// Compute the hash code from the untagged key. This must be kept in sync with +// ComputeIntegerHash in utils.h and KeyedLoadGenericElementStub in +// code-stub-hydrogen.cc // // Note: r0 will contain hash code void MacroAssembler::GetNumberHash(Register r0, Register scratch) { diff --git a/src/x64/code-stubs-x64.cc b/src/x64/code-stubs-x64.cc index 671119c..8712e27 100644 --- a/src/x64/code-stubs-x64.cc +++ b/src/x64/code-stubs-x64.cc @@ -117,7 +117,7 @@ void KeyedLoadFastElementStub::InitializeInterfaceDescriptor( void KeyedLoadDictionaryElementStub::InitializeInterfaceDescriptor( Isolate* isolate, CodeStubInterfaceDescriptor* descriptor) { - static Register registers[] = { rdx, rcx }; + static Register registers[] = { rdx, rax }; descriptor->register_param_count_ = 2; descriptor->register_params_ = registers; descriptor->deoptimization_handler_ = diff --git a/src/x64/macro-assembler-x64.cc b/src/x64/macro-assembler-x64.cc index 99562f0..fd857d3 100644 --- a/src/x64/macro-assembler-x64.cc +++ b/src/x64/macro-assembler-x64.cc @@ -3906,6 +3906,9 @@ void MacroAssembler::CheckAccessGlobalProxy(Register holder_reg, } +// Compute the hash code from the untagged key. This must be kept in sync with +// ComputeIntegerHash in utils.h and KeyedLoadGenericElementStub in +// code-stub-hydrogen.cc void MacroAssembler::GetNumberHash(Register r0, Register scratch) { // First of all we assign the hash seed to scratch. LoadRoot(scratch, Heap::kHashSeedRootIndex); -- 2.7.4