From 44f576ba6570fdd8de3eac63b35dd4b14976cf54 Mon Sep 17 00:00:00 2001 From: "bmeurer@chromium.org" Date: Mon, 22 Jul 2013 08:20:47 +0000 Subject: [PATCH] Replace BuildExternalArrayElementAccess() with AddExternalArrayElementAccess(). This is trivial cleanup. All calls to BuildExternalArrayElementAccess() pass the result to AddInstruction(). R=svenpanne@chromium.org Review URL: https://codereview.chromium.org/19658004 git-svn-id: http://v8.googlecode.com/svn/branches/bleeding_edge@15791 ce2b1a6d-e550-0410-aec6-3dcde31c8c00 --- src/hydrogen.cc | 119 +++++++++++++++++++++++++++----------------------------- src/hydrogen.h | 16 ++++---- 2 files changed, 65 insertions(+), 70 deletions(-) diff --git a/src/hydrogen.cc b/src/hydrogen.cc index 2cae332..57220e0 100644 --- a/src/hydrogen.cc +++ b/src/hydrogen.cc @@ -1051,59 +1051,6 @@ HValue* HGraphBuilder::BuildCheckMap(HValue* obj, } -HInstruction* HGraphBuilder::BuildExternalArrayElementAccess( - HValue* external_elements, - HValue* checked_key, - HValue* val, - HValue* dependency, - ElementsKind elements_kind, - bool is_store) { - Zone* zone = this->zone(); - if (is_store) { - ASSERT(val != NULL); - switch (elements_kind) { - case EXTERNAL_PIXEL_ELEMENTS: { - val = Add(val); - break; - } - case EXTERNAL_BYTE_ELEMENTS: - case EXTERNAL_UNSIGNED_BYTE_ELEMENTS: - case EXTERNAL_SHORT_ELEMENTS: - case EXTERNAL_UNSIGNED_SHORT_ELEMENTS: - case EXTERNAL_INT_ELEMENTS: - case EXTERNAL_UNSIGNED_INT_ELEMENTS: { - break; - } - case EXTERNAL_FLOAT_ELEMENTS: - case EXTERNAL_DOUBLE_ELEMENTS: - break; - case FAST_SMI_ELEMENTS: - case FAST_ELEMENTS: - case FAST_DOUBLE_ELEMENTS: - case FAST_HOLEY_SMI_ELEMENTS: - case FAST_HOLEY_ELEMENTS: - case FAST_HOLEY_DOUBLE_ELEMENTS: - case DICTIONARY_ELEMENTS: - case NON_STRICT_ARGUMENTS_ELEMENTS: - UNREACHABLE(); - break; - } - return new(zone) HStoreKeyed(external_elements, checked_key, - val, elements_kind); - } else { - ASSERT(val == NULL); - HLoadKeyed* load = - new(zone) HLoadKeyed( - external_elements, checked_key, dependency, elements_kind); - if (FLAG_opt_safe_uint32_operations && - elements_kind == EXTERNAL_UNSIGNED_INT_ELEMENTS) { - graph()->RecordUint32Instruction(load); - } - return load; - } -} - - HValue* HGraphBuilder::BuildCheckForCapacityGrow(HValue* object, HValue* elements, ElementsKind kind, @@ -1286,10 +1233,8 @@ HInstruction* HGraphBuilder::BuildUncheckedMonomorphicElementAccess( HValue* bounds_check = negative_checker.If( key, graph()->GetConstant0(), Token::GTE); negative_checker.Then(); - HInstruction* result = BuildExternalArrayElementAccess( - external_elements, key, val, bounds_check, - elements_kind, is_store); - AddInstruction(result); + HInstruction* result = AddExternalArrayElementAccess( + external_elements, key, val, bounds_check, elements_kind, is_store); negative_checker.ElseDeopt(); length_checker.End(); return result; @@ -1298,9 +1243,9 @@ HInstruction* HGraphBuilder::BuildUncheckedMonomorphicElementAccess( checked_key = Add(key, length); HLoadExternalArrayPointer* external_elements = Add(elements); - return AddInstruction(BuildExternalArrayElementAccess( - external_elements, checked_key, val, mapcheck, - elements_kind, is_store)); + return AddExternalArrayElementAccess( + external_elements, checked_key, val, + mapcheck, elements_kind, is_store); } } ASSERT(fast_smi_only_elements || @@ -1435,6 +1380,56 @@ HInnerAllocatedObject* HGraphBuilder::BuildJSArrayHeader(HValue* array, } +HInstruction* HGraphBuilder::AddExternalArrayElementAccess( + HValue* external_elements, + HValue* checked_key, + HValue* val, + HValue* dependency, + ElementsKind elements_kind, + bool is_store) { + if (is_store) { + ASSERT(val != NULL); + switch (elements_kind) { + case EXTERNAL_PIXEL_ELEMENTS: { + val = Add(val); + break; + } + case EXTERNAL_BYTE_ELEMENTS: + case EXTERNAL_UNSIGNED_BYTE_ELEMENTS: + case EXTERNAL_SHORT_ELEMENTS: + case EXTERNAL_UNSIGNED_SHORT_ELEMENTS: + case EXTERNAL_INT_ELEMENTS: + case EXTERNAL_UNSIGNED_INT_ELEMENTS: { + break; + } + case EXTERNAL_FLOAT_ELEMENTS: + case EXTERNAL_DOUBLE_ELEMENTS: + break; + case FAST_SMI_ELEMENTS: + case FAST_ELEMENTS: + case FAST_DOUBLE_ELEMENTS: + case FAST_HOLEY_SMI_ELEMENTS: + case FAST_HOLEY_ELEMENTS: + case FAST_HOLEY_DOUBLE_ELEMENTS: + case DICTIONARY_ELEMENTS: + case NON_STRICT_ARGUMENTS_ELEMENTS: + UNREACHABLE(); + break; + } + return Add(external_elements, checked_key, val, elements_kind); + } else { + ASSERT(val == NULL); + HLoadKeyed* load = Add(external_elements, checked_key, + dependency, elements_kind); + if (FLAG_opt_safe_uint32_operations && + elements_kind == EXTERNAL_UNSIGNED_INT_ELEMENTS) { + graph()->RecordUint32Instruction(load); + } + return load; + } +} + + HInstruction* HGraphBuilder::AddFastElementAccess( HValue* elements, HValue* checked_key, @@ -5721,9 +5716,9 @@ HValue* HOptimizedGraphBuilder::HandlePolymorphicElementAccess( checked_key = Add(key, length); HLoadExternalArrayPointer* external_elements = Add(elements); - access = AddInstruction(BuildExternalArrayElementAccess( + access = AddExternalArrayElementAccess( external_elements, checked_key, val, - mapcompare, elements_kind, is_store)); + mapcompare, elements_kind, is_store); } *has_side_effects |= access->HasObservableSideEffects(); // The caller will use has_side_effects and add a correct Simulate. diff --git a/src/hydrogen.h b/src/hydrogen.h index a9fcf4a..797b444 100644 --- a/src/hydrogen.h +++ b/src/hydrogen.h @@ -1046,14 +1046,6 @@ class HGraphBuilder { HValue* BuildCheckMap(HValue* obj, Handle map); // Building common constructs - HInstruction* BuildExternalArrayElementAccess( - HValue* external_elements, - HValue* checked_key, - HValue* val, - HValue* dependency, - ElementsKind elements_kind, - bool is_store); - HValue* BuildCheckForCapacityGrow(HValue* object, HValue* elements, ElementsKind kind, @@ -1094,6 +1086,14 @@ class HGraphBuilder { HObjectAccess access, Representation representation); + HInstruction* AddExternalArrayElementAccess( + HValue* external_elements, + HValue* checked_key, + HValue* val, + HValue* dependency, + ElementsKind elements_kind, + bool is_store); + HInstruction* AddFastElementAccess( HValue* elements, HValue* checked_key, -- 2.7.4