| OLD | NEW |
| 1 // Copyright 2016 the V8 project authors. All rights reserved. | 1 // Copyright 2016 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/ic/keyed-store-generic.h" | 5 #include "src/ic/keyed-store-generic.h" |
| 6 | 6 |
| 7 #include "src/code-factory.h" | 7 #include "src/code-factory.h" |
| 8 #include "src/code-stub-assembler.h" | 8 #include "src/code-stub-assembler.h" |
| 9 #include "src/contexts.h" | 9 #include "src/contexts.h" |
| 10 #include "src/ic/accessor-assembler-impl.h" | 10 #include "src/ic/accessor-assembler-impl.h" |
| (...skipping 264 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 275 Label must_transition(this); | 275 Label must_transition(this); |
| 276 STATIC_ASSERT(FAST_SMI_ELEMENTS == 0); | 276 STATIC_ASSERT(FAST_SMI_ELEMENTS == 0); |
| 277 STATIC_ASSERT(FAST_HOLEY_SMI_ELEMENTS == 1); | 277 STATIC_ASSERT(FAST_HOLEY_SMI_ELEMENTS == 1); |
| 278 GotoIf(Int32LessThanOrEqual(elements_kind, | 278 GotoIf(Int32LessThanOrEqual(elements_kind, |
| 279 Int32Constant(FAST_HOLEY_SMI_ELEMENTS)), | 279 Int32Constant(FAST_HOLEY_SMI_ELEMENTS)), |
| 280 &must_transition); | 280 &must_transition); |
| 281 if (update_length == kBumpLengthWithGap) { | 281 if (update_length == kBumpLengthWithGap) { |
| 282 TryChangeToHoleyMap(receiver, receiver_map, elements_kind, context, | 282 TryChangeToHoleyMap(receiver, receiver_map, elements_kind, context, |
| 283 FAST_ELEMENTS, slow); | 283 FAST_ELEMENTS, slow); |
| 284 } | 284 } |
| 285 Store(MachineRepresentation::kTagged, elements, offset, value); | 285 Store(elements, offset, value); |
| 286 MaybeUpdateLengthAndReturn(receiver, intptr_index, value, update_length); | 286 MaybeUpdateLengthAndReturn(receiver, intptr_index, value, update_length); |
| 287 | 287 |
| 288 Bind(&must_transition); | 288 Bind(&must_transition); |
| 289 } | 289 } |
| 290 | 290 |
| 291 // Transition to the required ElementsKind. | 291 // Transition to the required ElementsKind. |
| 292 { | 292 { |
| 293 Label transition_to_double(this), transition_to_object(this); | 293 Label transition_to_double(this), transition_to_object(this); |
| 294 Node* native_context = LoadNativeContext(context); | 294 Node* native_context = LoadNativeContext(context); |
| 295 Branch(WordEqual(LoadMap(value), LoadRoot(Heap::kHeapNumberMapRootIndex)), | 295 Branch(WordEqual(LoadMap(value), LoadRoot(Heap::kHeapNumberMapRootIndex)), |
| (...skipping 23 matching lines...) Expand all Loading... |
| 319 { | 319 { |
| 320 // If we're adding holes at the end, always transition to a holey | 320 // If we're adding holes at the end, always transition to a holey |
| 321 // elements kind, otherwise try to remain packed. | 321 // elements kind, otherwise try to remain packed. |
| 322 ElementsKind target_kind = update_length == kBumpLengthWithGap | 322 ElementsKind target_kind = update_length == kBumpLengthWithGap |
| 323 ? FAST_HOLEY_ELEMENTS | 323 ? FAST_HOLEY_ELEMENTS |
| 324 : FAST_ELEMENTS; | 324 : FAST_ELEMENTS; |
| 325 TryRewriteElements(receiver, receiver_map, elements, native_context, | 325 TryRewriteElements(receiver, receiver_map, elements, native_context, |
| 326 FAST_SMI_ELEMENTS, target_kind, slow); | 326 FAST_SMI_ELEMENTS, target_kind, slow); |
| 327 // The elements backing store didn't change, no reload necessary. | 327 // The elements backing store didn't change, no reload necessary. |
| 328 CSA_ASSERT(this, WordEqual(elements, LoadElements(receiver))); | 328 CSA_ASSERT(this, WordEqual(elements, LoadElements(receiver))); |
| 329 Store(MachineRepresentation::kTagged, elements, offset, value); | 329 Store(elements, offset, value); |
| 330 MaybeUpdateLengthAndReturn(receiver, intptr_index, value, | 330 MaybeUpdateLengthAndReturn(receiver, intptr_index, value, |
| 331 update_length); | 331 update_length); |
| 332 } | 332 } |
| 333 } | 333 } |
| 334 } | 334 } |
| 335 | 335 |
| 336 Bind(&check_double_elements); | 336 Bind(&check_double_elements); |
| 337 Node* fixed_double_array_map = LoadRoot(Heap::kFixedDoubleArrayMapRootIndex); | 337 Node* fixed_double_array_map = LoadRoot(Heap::kFixedDoubleArrayMapRootIndex); |
| 338 GotoIf(WordNotEqual(elements_map, fixed_double_array_map), | 338 GotoIf(WordNotEqual(elements_map, fixed_double_array_map), |
| 339 &check_cow_elements); | 339 &check_cow_elements); |
| (...skipping 43 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 383 Node* native_context = LoadNativeContext(context); | 383 Node* native_context = LoadNativeContext(context); |
| 384 ElementsKind target_kind = update_length == kBumpLengthWithGap | 384 ElementsKind target_kind = update_length == kBumpLengthWithGap |
| 385 ? FAST_HOLEY_ELEMENTS | 385 ? FAST_HOLEY_ELEMENTS |
| 386 : FAST_ELEMENTS; | 386 : FAST_ELEMENTS; |
| 387 TryRewriteElements(receiver, receiver_map, elements, native_context, | 387 TryRewriteElements(receiver, receiver_map, elements, native_context, |
| 388 FAST_DOUBLE_ELEMENTS, target_kind, slow); | 388 FAST_DOUBLE_ELEMENTS, target_kind, slow); |
| 389 // Reload migrated elements. | 389 // Reload migrated elements. |
| 390 Node* fast_elements = LoadElements(receiver); | 390 Node* fast_elements = LoadElements(receiver); |
| 391 Node* fast_offset = ElementOffsetFromIndex( | 391 Node* fast_offset = ElementOffsetFromIndex( |
| 392 intptr_index, FAST_ELEMENTS, INTPTR_PARAMETERS, kHeaderSize); | 392 intptr_index, FAST_ELEMENTS, INTPTR_PARAMETERS, kHeaderSize); |
| 393 Store(MachineRepresentation::kTagged, fast_elements, fast_offset, value); | 393 Store(fast_elements, fast_offset, value); |
| 394 MaybeUpdateLengthAndReturn(receiver, intptr_index, value, update_length); | 394 MaybeUpdateLengthAndReturn(receiver, intptr_index, value, update_length); |
| 395 } | 395 } |
| 396 } | 396 } |
| 397 | 397 |
| 398 Bind(&check_cow_elements); | 398 Bind(&check_cow_elements); |
| 399 { | 399 { |
| 400 // TODO(jkummerow): Use GrowElementsCapacity instead of bailing out. | 400 // TODO(jkummerow): Use GrowElementsCapacity instead of bailing out. |
| 401 Goto(slow); | 401 Goto(slow); |
| 402 } | 402 } |
| 403 } | 403 } |
| (...skipping 375 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 779 Bind(&slow); | 779 Bind(&slow); |
| 780 { | 780 { |
| 781 Comment("KeyedStoreGeneric_slow"); | 781 Comment("KeyedStoreGeneric_slow"); |
| 782 TailCallRuntime(Runtime::kSetProperty, context, receiver, name, value, | 782 TailCallRuntime(Runtime::kSetProperty, context, receiver, name, value, |
| 783 SmiConstant(language_mode)); | 783 SmiConstant(language_mode)); |
| 784 } | 784 } |
| 785 } | 785 } |
| 786 | 786 |
| 787 } // namespace internal | 787 } // namespace internal |
| 788 } // namespace v8 | 788 } // namespace v8 |
| OLD | NEW |