| 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 "hydrogen.h" | 5 #include "hydrogen.h" |
| 6 | 6 |
| 7 #include <algorithm> | 7 #include <algorithm> |
| 8 | 8 |
| 9 #include "v8.h" | 9 #include "v8.h" |
| 10 #include "allocation-site-scopes.h" | 10 #include "allocation-site-scopes.h" |
| (...skipping 2179 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 2190 // In case val is stored into a fast smi array, assure that the value is a smi | 2190 // In case val is stored into a fast smi array, assure that the value is a smi |
| 2191 // before manipulating the backing store. Otherwise the actual store may | 2191 // before manipulating the backing store. Otherwise the actual store may |
| 2192 // deopt, leaving the backing store in an invalid state. | 2192 // deopt, leaving the backing store in an invalid state. |
| 2193 if (access_type == STORE && IsFastSmiElementsKind(elements_kind) && | 2193 if (access_type == STORE && IsFastSmiElementsKind(elements_kind) && |
| 2194 !val->type().IsSmi()) { | 2194 !val->type().IsSmi()) { |
| 2195 val = AddUncasted<HForceRepresentation>(val, Representation::Smi()); | 2195 val = AddUncasted<HForceRepresentation>(val, Representation::Smi()); |
| 2196 } | 2196 } |
| 2197 | 2197 |
| 2198 if (IsGrowStoreMode(store_mode)) { | 2198 if (IsGrowStoreMode(store_mode)) { |
| 2199 NoObservableSideEffectsScope no_effects(this); | 2199 NoObservableSideEffectsScope no_effects(this); |
| 2200 Representation representation = HStoreKeyed::RequiredValueRepresentation( |
| 2201 elements_kind, STORE_TO_INITIALIZED_ENTRY); |
| 2202 val = AddUncasted<HForceRepresentation>(val, representation); |
| 2200 elements = BuildCheckForCapacityGrow(checked_object, elements, | 2203 elements = BuildCheckForCapacityGrow(checked_object, elements, |
| 2201 elements_kind, length, key, | 2204 elements_kind, length, key, |
| 2202 is_js_array, access_type); | 2205 is_js_array, access_type); |
| 2203 checked_key = key; | 2206 checked_key = key; |
| 2204 } else { | 2207 } else { |
| 2205 checked_key = Add<HBoundsCheck>(key, length); | 2208 checked_key = Add<HBoundsCheck>(key, length); |
| 2206 | 2209 |
| 2207 if (access_type == STORE && (fast_elements || fast_smi_only_elements)) { | 2210 if (access_type == STORE && (fast_elements || fast_smi_only_elements)) { |
| 2208 if (store_mode == STORE_NO_TRANSITION_HANDLE_COW) { | 2211 if (store_mode == STORE_NO_TRANSITION_HANDLE_COW) { |
| 2209 NoObservableSideEffectsScope no_effects(this); | 2212 NoObservableSideEffectsScope no_effects(this); |
| (...skipping 151 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 2361 ElementsKind elements_kind, | 2364 ElementsKind elements_kind, |
| 2362 PropertyAccessType access_type, | 2365 PropertyAccessType access_type, |
| 2363 LoadKeyedHoleMode load_mode) { | 2366 LoadKeyedHoleMode load_mode) { |
| 2364 if (access_type == STORE) { | 2367 if (access_type == STORE) { |
| 2365 ASSERT(val != NULL); | 2368 ASSERT(val != NULL); |
| 2366 if (elements_kind == EXTERNAL_UINT8_CLAMPED_ELEMENTS || | 2369 if (elements_kind == EXTERNAL_UINT8_CLAMPED_ELEMENTS || |
| 2367 elements_kind == UINT8_CLAMPED_ELEMENTS) { | 2370 elements_kind == UINT8_CLAMPED_ELEMENTS) { |
| 2368 val = Add<HClampToUint8>(val); | 2371 val = Add<HClampToUint8>(val); |
| 2369 } | 2372 } |
| 2370 return Add<HStoreKeyed>(elements, checked_key, val, elements_kind, | 2373 return Add<HStoreKeyed>(elements, checked_key, val, elements_kind, |
| 2371 elements_kind == FAST_SMI_ELEMENTS | 2374 STORE_TO_INITIALIZED_ENTRY); |
| 2372 ? STORE_TO_INITIALIZED_ENTRY | |
| 2373 : INITIALIZING_STORE); | |
| 2374 } | 2375 } |
| 2375 | 2376 |
| 2376 ASSERT(access_type == LOAD); | 2377 ASSERT(access_type == LOAD); |
| 2377 ASSERT(val == NULL); | 2378 ASSERT(val == NULL); |
| 2378 HLoadKeyed* load = Add<HLoadKeyed>( | 2379 HLoadKeyed* load = Add<HLoadKeyed>( |
| 2379 elements, checked_key, dependency, elements_kind, load_mode); | 2380 elements, checked_key, dependency, elements_kind, load_mode); |
| 2380 if (FLAG_opt_safe_uint32_operations && | 2381 if (FLAG_opt_safe_uint32_operations && |
| 2381 (elements_kind == EXTERNAL_UINT32_ELEMENTS || | 2382 (elements_kind == EXTERNAL_UINT32_ELEMENTS || |
| 2382 elements_kind == UINT32_ELEMENTS)) { | 2383 elements_kind == UINT32_ELEMENTS)) { |
| 2383 graph()->RecordUint32Instruction(load); | 2384 graph()->RecordUint32Instruction(load); |
| (...skipping 9258 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 11642 if (ShouldProduceTraceOutput()) { | 11643 if (ShouldProduceTraceOutput()) { |
| 11643 isolate()->GetHTracer()->TraceHydrogen(name(), graph_); | 11644 isolate()->GetHTracer()->TraceHydrogen(name(), graph_); |
| 11644 } | 11645 } |
| 11645 | 11646 |
| 11646 #ifdef DEBUG | 11647 #ifdef DEBUG |
| 11647 graph_->Verify(false); // No full verify. | 11648 graph_->Verify(false); // No full verify. |
| 11648 #endif | 11649 #endif |
| 11649 } | 11650 } |
| 11650 | 11651 |
| 11651 } } // namespace v8::internal | 11652 } } // namespace v8::internal |
| OLD | NEW |