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/builtins/builtins-utils.h" | 5 #include "src/builtins/builtins-utils.h" |
6 #include "src/builtins/builtins.h" | 6 #include "src/builtins/builtins.h" |
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/promise-utils.h" | 9 #include "src/promise-utils.h" |
10 | 10 |
(...skipping 360 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
371 compiler::Node* promise, compiler::Node* value) { | 371 compiler::Node* promise, compiler::Node* value) { |
372 typedef compiler::Node Node; | 372 typedef compiler::Node Node; |
373 | 373 |
374 Node* elements = a->LoadObjectField(promise, offset); | 374 Node* elements = a->LoadObjectField(promise, offset); |
375 Node* length = a->LoadFixedArrayBaseLength(elements); | 375 Node* length = a->LoadFixedArrayBaseLength(elements); |
376 CodeStubAssembler::ParameterMode mode = a->OptimalParameterMode(); | 376 CodeStubAssembler::ParameterMode mode = a->OptimalParameterMode(); |
377 length = a->UntagParameter(length, mode); | 377 length = a->UntagParameter(length, mode); |
378 | 378 |
379 Node* delta = a->IntPtrOrSmiConstant(1, mode); | 379 Node* delta = a->IntPtrOrSmiConstant(1, mode); |
380 Node* new_capacity = a->IntPtrAdd(length, delta); | 380 Node* new_capacity = a->IntPtrAdd(length, delta); |
381 ElementsKind kind = FAST_ELEMENTS; | |
382 | 381 |
383 Node* new_elements = a->AllocateFixedArray(kind, new_capacity, mode); | 382 const ElementsKind kind = FAST_ELEMENTS; |
| 383 const WriteBarrierMode barrier_mode = UPDATE_WRITE_BARRIER; |
| 384 const CodeStubAssembler::AllocationFlags flags = |
| 385 CodeStubAssembler::kAllowLargeObjectAllocation; |
| 386 int additional_offset = 0; |
384 | 387 |
385 a->CopyFixedArrayElements(kind, elements, new_elements, length, | 388 Node* new_elements = a->AllocateFixedArray(kind, new_capacity, mode, flags); |
386 UPDATE_WRITE_BARRIER, mode); | 389 |
387 a->StoreFixedArrayElement(new_elements, length, value, UPDATE_WRITE_BARRIER, | 390 a->CopyFixedArrayElements(kind, elements, new_elements, length, barrier_mode, |
388 0, mode); | 391 mode); |
| 392 a->StoreFixedArrayElement(new_elements, length, value, barrier_mode, |
| 393 additional_offset, mode); |
389 | 394 |
390 a->StoreObjectField(promise, offset, new_elements); | 395 a->StoreObjectField(promise, offset, new_elements); |
391 } | 396 } |
392 | 397 |
393 compiler::Node* InternalPerformPromiseThen(CodeStubAssembler* a, | 398 compiler::Node* InternalPerformPromiseThen(CodeStubAssembler* a, |
394 compiler::Node* context, | 399 compiler::Node* context, |
395 compiler::Node* promise, | 400 compiler::Node* promise, |
396 compiler::Node* on_resolve, | 401 compiler::Node* on_resolve, |
397 compiler::Node* on_reject, | 402 compiler::Node* on_reject, |
398 compiler::Node* deferred) { | 403 compiler::Node* deferred) { |
(...skipping 259 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
658 // 5. Return PerformPromiseThen(promise, onFulfilled, onRejected, | 663 // 5. Return PerformPromiseThen(promise, onFulfilled, onRejected, |
659 // resultCapability). | 664 // resultCapability). |
660 a.Bind(&perform_promise_then); | 665 a.Bind(&perform_promise_then); |
661 Node* const result = InternalPerformPromiseThen( | 666 Node* const result = InternalPerformPromiseThen( |
662 &a, context, promise, on_resolve, on_reject, var_deferred.value()); | 667 &a, context, promise, on_resolve, on_reject, var_deferred.value()); |
663 a.Return(result); | 668 a.Return(result); |
664 } | 669 } |
665 | 670 |
666 } // namespace internal | 671 } // namespace internal |
667 } // namespace v8 | 672 } // namespace v8 |
OLD | NEW |