| OLD | NEW |
| 1 // Copyright 2013 the V8 project authors. All rights reserved. | 1 // Copyright 2013 the V8 project authors. All rights reserved. |
| 2 // Use of this source code is governed by a BSD-style license that can be | 2 // Use of this source code is governed by a BSD-style license that can be |
| 3 // found in the LICENSE file. | 3 // found in the LICENSE file. |
| 4 | 4 |
| 5 #include "src/hydrogen.h" | 5 #include "src/hydrogen.h" |
| 6 | 6 |
| 7 #include <algorithm> | 7 #include <algorithm> |
| 8 | 8 |
| 9 #include "src/v8.h" | 9 #include "src/v8.h" |
| 10 | 10 |
| (...skipping 2461 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 2472 // In case val is stored into a fast smi array, assure that the value is a smi | 2472 // In case val is stored into a fast smi array, assure that the value is a smi |
| 2473 // before manipulating the backing store. Otherwise the actual store may | 2473 // before manipulating the backing store. Otherwise the actual store may |
| 2474 // deopt, leaving the backing store in an invalid state. | 2474 // deopt, leaving the backing store in an invalid state. |
| 2475 if (access_type == STORE && IsFastSmiElementsKind(elements_kind) && | 2475 if (access_type == STORE && IsFastSmiElementsKind(elements_kind) && |
| 2476 !val->type().IsSmi()) { | 2476 !val->type().IsSmi()) { |
| 2477 val = AddUncasted<HForceRepresentation>(val, Representation::Smi()); | 2477 val = AddUncasted<HForceRepresentation>(val, Representation::Smi()); |
| 2478 } | 2478 } |
| 2479 | 2479 |
| 2480 if (IsGrowStoreMode(store_mode)) { | 2480 if (IsGrowStoreMode(store_mode)) { |
| 2481 NoObservableSideEffectsScope no_effects(this); | 2481 NoObservableSideEffectsScope no_effects(this); |
| 2482 Representation representation = HStoreKeyed::RequiredValueRepresentation( |
| 2483 elements_kind, STORE_TO_INITIALIZED_ENTRY); |
| 2484 val = AddUncasted<HForceRepresentation>(val, representation); |
| 2482 elements = BuildCheckForCapacityGrow(checked_object, elements, | 2485 elements = BuildCheckForCapacityGrow(checked_object, elements, |
| 2483 elements_kind, length, key, | 2486 elements_kind, length, key, |
| 2484 is_js_array, access_type); | 2487 is_js_array, access_type); |
| 2485 checked_key = key; | 2488 checked_key = key; |
| 2486 } else { | 2489 } else { |
| 2487 checked_key = Add<HBoundsCheck>(key, length); | 2490 checked_key = Add<HBoundsCheck>(key, length); |
| 2488 | 2491 |
| 2489 if (access_type == STORE && (fast_elements || fast_smi_only_elements)) { | 2492 if (access_type == STORE && (fast_elements || fast_smi_only_elements)) { |
| 2490 if (store_mode == STORE_NO_TRANSITION_HANDLE_COW) { | 2493 if (store_mode == STORE_NO_TRANSITION_HANDLE_COW) { |
| 2491 NoObservableSideEffectsScope no_effects(this); | 2494 NoObservableSideEffectsScope no_effects(this); |
| (...skipping 176 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 2668 ElementsKind elements_kind, | 2671 ElementsKind elements_kind, |
| 2669 PropertyAccessType access_type, | 2672 PropertyAccessType access_type, |
| 2670 LoadKeyedHoleMode load_mode) { | 2673 LoadKeyedHoleMode load_mode) { |
| 2671 if (access_type == STORE) { | 2674 if (access_type == STORE) { |
| 2672 ASSERT(val != NULL); | 2675 ASSERT(val != NULL); |
| 2673 if (elements_kind == EXTERNAL_UINT8_CLAMPED_ELEMENTS || | 2676 if (elements_kind == EXTERNAL_UINT8_CLAMPED_ELEMENTS || |
| 2674 elements_kind == UINT8_CLAMPED_ELEMENTS) { | 2677 elements_kind == UINT8_CLAMPED_ELEMENTS) { |
| 2675 val = Add<HClampToUint8>(val); | 2678 val = Add<HClampToUint8>(val); |
| 2676 } | 2679 } |
| 2677 return Add<HStoreKeyed>(elements, checked_key, val, elements_kind, | 2680 return Add<HStoreKeyed>(elements, checked_key, val, elements_kind, |
| 2678 elements_kind == FAST_SMI_ELEMENTS | 2681 STORE_TO_INITIALIZED_ENTRY); |
| 2679 ? STORE_TO_INITIALIZED_ENTRY | |
| 2680 : INITIALIZING_STORE); | |
| 2681 } | 2682 } |
| 2682 | 2683 |
| 2683 ASSERT(access_type == LOAD); | 2684 ASSERT(access_type == LOAD); |
| 2684 ASSERT(val == NULL); | 2685 ASSERT(val == NULL); |
| 2685 HLoadKeyed* load = Add<HLoadKeyed>( | 2686 HLoadKeyed* load = Add<HLoadKeyed>( |
| 2686 elements, checked_key, dependency, elements_kind, load_mode); | 2687 elements, checked_key, dependency, elements_kind, load_mode); |
| 2687 if (FLAG_opt_safe_uint32_operations && | 2688 if (FLAG_opt_safe_uint32_operations && |
| 2688 (elements_kind == EXTERNAL_UINT32_ELEMENTS || | 2689 (elements_kind == EXTERNAL_UINT32_ELEMENTS || |
| 2689 elements_kind == UINT32_ELEMENTS)) { | 2690 elements_kind == UINT32_ELEMENTS)) { |
| 2690 graph()->RecordUint32Instruction(load); | 2691 graph()->RecordUint32Instruction(load); |
| (...skipping 9783 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 12474 if (ShouldProduceTraceOutput()) { | 12475 if (ShouldProduceTraceOutput()) { |
| 12475 isolate()->GetHTracer()->TraceHydrogen(name(), graph_); | 12476 isolate()->GetHTracer()->TraceHydrogen(name(), graph_); |
| 12476 } | 12477 } |
| 12477 | 12478 |
| 12478 #ifdef DEBUG | 12479 #ifdef DEBUG |
| 12479 graph_->Verify(false); // No full verify. | 12480 graph_->Verify(false); // No full verify. |
| 12480 #endif | 12481 #endif |
| 12481 } | 12482 } |
| 12482 | 12483 |
| 12483 } } // namespace v8::internal | 12484 } } // namespace v8::internal |
| OLD | NEW |