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 #include "src/allocation-site-scopes.h" | 10 #include "src/allocation-site-scopes.h" |
(...skipping 2387 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
2398 // In case val is stored into a fast smi array, assure that the value is a smi | 2398 // In case val is stored into a fast smi array, assure that the value is a smi |
2399 // before manipulating the backing store. Otherwise the actual store may | 2399 // before manipulating the backing store. Otherwise the actual store may |
2400 // deopt, leaving the backing store in an invalid state. | 2400 // deopt, leaving the backing store in an invalid state. |
2401 if (access_type == STORE && IsFastSmiElementsKind(elements_kind) && | 2401 if (access_type == STORE && IsFastSmiElementsKind(elements_kind) && |
2402 !val->type().IsSmi()) { | 2402 !val->type().IsSmi()) { |
2403 val = AddUncasted<HForceRepresentation>(val, Representation::Smi()); | 2403 val = AddUncasted<HForceRepresentation>(val, Representation::Smi()); |
2404 } | 2404 } |
2405 | 2405 |
2406 if (IsGrowStoreMode(store_mode)) { | 2406 if (IsGrowStoreMode(store_mode)) { |
2407 NoObservableSideEffectsScope no_effects(this); | 2407 NoObservableSideEffectsScope no_effects(this); |
| 2408 Representation representation = HStoreKeyed::RequiredValueRepresentation( |
| 2409 elements_kind, STORE_TO_INITIALIZED_ENTRY); |
| 2410 val = AddUncasted<HForceRepresentation>(val, representation); |
2408 elements = BuildCheckForCapacityGrow(checked_object, elements, | 2411 elements = BuildCheckForCapacityGrow(checked_object, elements, |
2409 elements_kind, length, key, | 2412 elements_kind, length, key, |
2410 is_js_array, access_type); | 2413 is_js_array, access_type); |
2411 checked_key = key; | 2414 checked_key = key; |
2412 } else { | 2415 } else { |
2413 checked_key = Add<HBoundsCheck>(key, length); | 2416 checked_key = Add<HBoundsCheck>(key, length); |
2414 | 2417 |
2415 if (access_type == STORE && (fast_elements || fast_smi_only_elements)) { | 2418 if (access_type == STORE && (fast_elements || fast_smi_only_elements)) { |
2416 if (store_mode == STORE_NO_TRANSITION_HANDLE_COW) { | 2419 if (store_mode == STORE_NO_TRANSITION_HANDLE_COW) { |
2417 NoObservableSideEffectsScope no_effects(this); | 2420 NoObservableSideEffectsScope no_effects(this); |
(...skipping 176 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
2594 ElementsKind elements_kind, | 2597 ElementsKind elements_kind, |
2595 PropertyAccessType access_type, | 2598 PropertyAccessType access_type, |
2596 LoadKeyedHoleMode load_mode) { | 2599 LoadKeyedHoleMode load_mode) { |
2597 if (access_type == STORE) { | 2600 if (access_type == STORE) { |
2598 ASSERT(val != NULL); | 2601 ASSERT(val != NULL); |
2599 if (elements_kind == EXTERNAL_UINT8_CLAMPED_ELEMENTS || | 2602 if (elements_kind == EXTERNAL_UINT8_CLAMPED_ELEMENTS || |
2600 elements_kind == UINT8_CLAMPED_ELEMENTS) { | 2603 elements_kind == UINT8_CLAMPED_ELEMENTS) { |
2601 val = Add<HClampToUint8>(val); | 2604 val = Add<HClampToUint8>(val); |
2602 } | 2605 } |
2603 return Add<HStoreKeyed>(elements, checked_key, val, elements_kind, | 2606 return Add<HStoreKeyed>(elements, checked_key, val, elements_kind, |
2604 elements_kind == FAST_SMI_ELEMENTS | 2607 STORE_TO_INITIALIZED_ENTRY); |
2605 ? STORE_TO_INITIALIZED_ENTRY | |
2606 : INITIALIZING_STORE); | |
2607 } | 2608 } |
2608 | 2609 |
2609 ASSERT(access_type == LOAD); | 2610 ASSERT(access_type == LOAD); |
2610 ASSERT(val == NULL); | 2611 ASSERT(val == NULL); |
2611 HLoadKeyed* load = Add<HLoadKeyed>( | 2612 HLoadKeyed* load = Add<HLoadKeyed>( |
2612 elements, checked_key, dependency, elements_kind, load_mode); | 2613 elements, checked_key, dependency, elements_kind, load_mode); |
2613 if (FLAG_opt_safe_uint32_operations && | 2614 if (FLAG_opt_safe_uint32_operations && |
2614 (elements_kind == EXTERNAL_UINT32_ELEMENTS || | 2615 (elements_kind == EXTERNAL_UINT32_ELEMENTS || |
2615 elements_kind == UINT32_ELEMENTS)) { | 2616 elements_kind == UINT32_ELEMENTS)) { |
2616 graph()->RecordUint32Instruction(load); | 2617 graph()->RecordUint32Instruction(load); |
(...skipping 9729 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
12346 if (ShouldProduceTraceOutput()) { | 12347 if (ShouldProduceTraceOutput()) { |
12347 isolate()->GetHTracer()->TraceHydrogen(name(), graph_); | 12348 isolate()->GetHTracer()->TraceHydrogen(name(), graph_); |
12348 } | 12349 } |
12349 | 12350 |
12350 #ifdef DEBUG | 12351 #ifdef DEBUG |
12351 graph_->Verify(false); // No full verify. | 12352 graph_->Verify(false); // No full verify. |
12352 #endif | 12353 #endif |
12353 } | 12354 } |
12354 | 12355 |
12355 } } // namespace v8::internal | 12356 } } // namespace v8::internal |
OLD | NEW |