OLD | NEW |
1 // Copyright 2014 the V8 project authors. All rights reserved. | 1 // Copyright 2014 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/runtime/runtime-utils.h" | 5 #include "src/runtime/runtime-utils.h" |
6 | 6 |
7 #include "src/allocation-site-scopes.h" | 7 #include "src/allocation-site-scopes.h" |
8 #include "src/arguments.h" | 8 #include "src/arguments.h" |
9 #include "src/ast/ast.h" | 9 #include "src/ast/ast.h" |
10 #include "src/isolate-inl.h" | 10 #include "src/isolate-inl.h" |
(...skipping 141 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
152 | 152 |
153 ElementsKind constant_elements_kind = | 153 ElementsKind constant_elements_kind = |
154 static_cast<ElementsKind>(Smi::cast(elements->get(0))->value()); | 154 static_cast<ElementsKind>(Smi::cast(elements->get(0))->value()); |
155 Handle<FixedArrayBase> constant_elements_values( | 155 Handle<FixedArrayBase> constant_elements_values( |
156 FixedArrayBase::cast(elements->get(1))); | 156 FixedArrayBase::cast(elements->get(1))); |
157 | 157 |
158 { | 158 { |
159 DisallowHeapAllocation no_gc; | 159 DisallowHeapAllocation no_gc; |
160 DCHECK(IsFastElementsKind(constant_elements_kind)); | 160 DCHECK(IsFastElementsKind(constant_elements_kind)); |
161 Context* native_context = isolate->context()->native_context(); | 161 Context* native_context = isolate->context()->native_context(); |
162 Object* maps_array = is_strong | 162 Strength strength = is_strong ? Strength::STRONG : Strength::WEAK; |
163 ? native_context->js_array_strong_maps() | 163 Object* map = native_context->get( |
164 : native_context->js_array_maps(); | 164 Context::ArrayMapIndex(constant_elements_kind, strength)); |
165 DCHECK(!maps_array->IsUndefined()); | |
166 Object* map = FixedArray::cast(maps_array)->get(constant_elements_kind); | |
167 object->set_map(Map::cast(map)); | 165 object->set_map(Map::cast(map)); |
168 } | 166 } |
169 | 167 |
170 Handle<FixedArrayBase> copied_elements_values; | 168 Handle<FixedArrayBase> copied_elements_values; |
171 if (IsFastDoubleElementsKind(constant_elements_kind)) { | 169 if (IsFastDoubleElementsKind(constant_elements_kind)) { |
172 copied_elements_values = isolate->factory()->CopyFixedDoubleArray( | 170 copied_elements_values = isolate->factory()->CopyFixedDoubleArray( |
173 Handle<FixedDoubleArray>::cast(constant_elements_values)); | 171 Handle<FixedDoubleArray>::cast(constant_elements_values)); |
174 } else { | 172 } else { |
175 DCHECK(IsFastSmiOrObjectElementsKind(constant_elements_kind)); | 173 DCHECK(IsFastSmiOrObjectElementsKind(constant_elements_kind)); |
176 const bool is_cow = (constant_elements_values->map() == | 174 const bool is_cow = (constant_elements_values->map() == |
(...skipping 274 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
451 JSObject::TransitionElementsKind(boilerplate_object, transitioned_kind); | 449 JSObject::TransitionElementsKind(boilerplate_object, transitioned_kind); |
452 } | 450 } |
453 } | 451 } |
454 FixedArray* object_array = FixedArray::cast(object->elements()); | 452 FixedArray* object_array = FixedArray::cast(object->elements()); |
455 object_array->set(store_index, *value); | 453 object_array->set(store_index, *value); |
456 } | 454 } |
457 return *object; | 455 return *object; |
458 } | 456 } |
459 } // namespace internal | 457 } // namespace internal |
460 } // namespace v8 | 458 } // namespace v8 |
OLD | NEW |