OLD | NEW |
1 // Copyright 2012 the V8 project authors. All rights reserved. | 1 // Copyright 2012 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/code-stubs.h" | 5 #include "src/code-stubs.h" |
6 | 6 |
7 #include <sstream> | 7 #include <sstream> |
8 | 8 |
9 #include "src/ast/ast.h" | 9 #include "src/ast/ast.h" |
10 #include "src/bootstrapper.h" | 10 #include "src/bootstrapper.h" |
(...skipping 2724 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
2735 compiler::Node* boilerplate_elements, | 2735 compiler::Node* boilerplate_elements, |
2736 compiler::Node* allocation_site, | 2736 compiler::Node* allocation_site, |
2737 compiler::Node* capacity, | 2737 compiler::Node* capacity, |
2738 ElementsKind kind) { | 2738 ElementsKind kind) { |
2739 typedef compiler::Node Node; | 2739 typedef compiler::Node Node; |
2740 typedef CodeStubAssembler::ParameterMode ParameterMode; | 2740 typedef CodeStubAssembler::ParameterMode ParameterMode; |
2741 | 2741 |
2742 ParameterMode param_mode = assembler->OptimalParameterMode(); | 2742 ParameterMode param_mode = assembler->OptimalParameterMode(); |
2743 | 2743 |
2744 Node* length = assembler->LoadJSArrayLength(boilerplate); | 2744 Node* length = assembler->LoadJSArrayLength(boilerplate); |
2745 capacity = assembler->UntagParameter(capacity, param_mode); | 2745 capacity = assembler->TaggedToParameter(capacity, param_mode); |
2746 | 2746 |
2747 Node *array, *elements; | 2747 Node *array, *elements; |
2748 std::tie(array, elements) = | 2748 std::tie(array, elements) = |
2749 assembler->AllocateUninitializedJSArrayWithElements( | 2749 assembler->AllocateUninitializedJSArrayWithElements( |
2750 kind, boilerplate_map, length, allocation_site, capacity, param_mode); | 2750 kind, boilerplate_map, length, allocation_site, capacity, param_mode); |
2751 | 2751 |
2752 assembler->Comment("copy elements header"); | 2752 assembler->Comment("copy elements header"); |
2753 // Header consists of map and length. | 2753 // Header consists of map and length. |
2754 STATIC_ASSERT(FixedArrayBase::kHeaderSize == 2 * kPointerSize); | 2754 STATIC_ASSERT(FixedArrayBase::kHeaderSize == 2 * kPointerSize); |
2755 assembler->StoreMap(elements, assembler->LoadMap(boilerplate_elements)); | 2755 assembler->StoreMap(elements, assembler->LoadMap(boilerplate_elements)); |
2756 { | 2756 { |
2757 int offset = FixedArrayBase::kLengthOffset; | 2757 int offset = FixedArrayBase::kLengthOffset; |
2758 assembler->StoreObjectFieldNoWriteBarrier( | 2758 assembler->StoreObjectFieldNoWriteBarrier( |
2759 elements, offset, | 2759 elements, offset, |
2760 assembler->LoadObjectField(boilerplate_elements, offset)); | 2760 assembler->LoadObjectField(boilerplate_elements, offset)); |
2761 } | 2761 } |
2762 | 2762 |
2763 length = assembler->UntagParameter(length, param_mode); | 2763 length = assembler->TaggedToParameter(length, param_mode); |
2764 | 2764 |
2765 assembler->Comment("copy boilerplate elements"); | 2765 assembler->Comment("copy boilerplate elements"); |
2766 assembler->CopyFixedArrayElements(kind, boilerplate_elements, elements, | 2766 assembler->CopyFixedArrayElements(kind, boilerplate_elements, elements, |
2767 length, SKIP_WRITE_BARRIER, param_mode); | 2767 length, SKIP_WRITE_BARRIER, param_mode); |
2768 assembler->IncrementCounter( | 2768 assembler->IncrementCounter( |
2769 assembler->isolate()->counters()->inlined_copied_elements(), 1); | 2769 assembler->isolate()->counters()->inlined_copied_elements(), 1); |
2770 | 2770 |
2771 return array; | 2771 return array; |
2772 } | 2772 } |
2773 | 2773 |
(...skipping 446 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
3220 } | 3220 } |
3221 | 3221 |
3222 ArrayConstructorStub::ArrayConstructorStub(Isolate* isolate) | 3222 ArrayConstructorStub::ArrayConstructorStub(Isolate* isolate) |
3223 : PlatformCodeStub(isolate) {} | 3223 : PlatformCodeStub(isolate) {} |
3224 | 3224 |
3225 InternalArrayConstructorStub::InternalArrayConstructorStub(Isolate* isolate) | 3225 InternalArrayConstructorStub::InternalArrayConstructorStub(Isolate* isolate) |
3226 : PlatformCodeStub(isolate) {} | 3226 : PlatformCodeStub(isolate) {} |
3227 | 3227 |
3228 } // namespace internal | 3228 } // namespace internal |
3229 } // namespace v8 | 3229 } // namespace v8 |
OLD | NEW |