| 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 140 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 151 for (int i = 0; i < fixed_array_values->length(); i++) { | 151 for (int i = 0; i < fixed_array_values->length(); i++) { |
| 152 DCHECK(!fixed_array_values->get(i)->IsFixedArray()); | 152 DCHECK(!fixed_array_values->get(i)->IsFixedArray()); |
| 153 } | 153 } |
| 154 #endif | 154 #endif |
| 155 } else { | 155 } else { |
| 156 Handle<FixedArray> fixed_array_values = | 156 Handle<FixedArray> fixed_array_values = |
| 157 Handle<FixedArray>::cast(constant_elements_values); | 157 Handle<FixedArray>::cast(constant_elements_values); |
| 158 Handle<FixedArray> fixed_array_values_copy = | 158 Handle<FixedArray> fixed_array_values_copy = |
| 159 isolate->factory()->CopyFixedArray(fixed_array_values); | 159 isolate->factory()->CopyFixedArray(fixed_array_values); |
| 160 copied_elements_values = fixed_array_values_copy; | 160 copied_elements_values = fixed_array_values_copy; |
| 161 for (int i = 0; i < fixed_array_values->length(); i++) { | 161 FOR_WITH_HANDLE_SCOPE( |
| 162 HandleScope scope(isolate); | 162 isolate, int, i = 0, i, i < fixed_array_values->length(), i++, { |
| 163 if (fixed_array_values->get(i)->IsFixedArray()) { | 163 if (fixed_array_values->get(i)->IsFixedArray()) { |
| 164 // The value contains the constant_properties of a | 164 // The value contains the constant_properties of a |
| 165 // simple object or array literal. | 165 // simple object or array literal. |
| 166 Handle<FixedArray> fa(FixedArray::cast(fixed_array_values->get(i))); | 166 Handle<FixedArray> fa( |
| 167 Handle<Object> result; | 167 FixedArray::cast(fixed_array_values->get(i))); |
| 168 ASSIGN_RETURN_ON_EXCEPTION( | 168 Handle<Object> result; |
| 169 isolate, result, CreateLiteralBoilerplate(isolate, literals, fa), | 169 ASSIGN_RETURN_ON_EXCEPTION( |
| 170 Object); | 170 isolate, result, |
| 171 fixed_array_values_copy->set(i, *result); | 171 CreateLiteralBoilerplate(isolate, literals, fa), Object); |
| 172 } | 172 fixed_array_values_copy->set(i, *result); |
| 173 } | 173 } |
| 174 }); |
| 174 } | 175 } |
| 175 } | 176 } |
| 176 object->set_elements(*copied_elements_values); | 177 object->set_elements(*copied_elements_values); |
| 177 object->set_length(Smi::FromInt(copied_elements_values->length())); | 178 object->set_length(Smi::FromInt(copied_elements_values->length())); |
| 178 | 179 |
| 179 JSObject::ValidateElements(object); | 180 JSObject::ValidateElements(object); |
| 180 return object; | 181 return object; |
| 181 } | 182 } |
| 182 | 183 |
| 183 MUST_USE_RESULT static MaybeHandle<Object> CreateLiteralBoilerplate( | 184 MUST_USE_RESULT static MaybeHandle<Object> CreateLiteralBoilerplate( |
| (...skipping 169 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 353 Handle<LiteralsArray> literals(closure->literals(), isolate); | 354 Handle<LiteralsArray> literals(closure->literals(), isolate); |
| 354 ASSIGN_RETURN_FAILURE_ON_EXCEPTION( | 355 ASSIGN_RETURN_FAILURE_ON_EXCEPTION( |
| 355 isolate, result, | 356 isolate, result, |
| 356 CreateArrayLiteralImpl(isolate, literals, literals_index, elements, | 357 CreateArrayLiteralImpl(isolate, literals, literals_index, elements, |
| 357 ArrayLiteral::kShallowElements)); | 358 ArrayLiteral::kShallowElements)); |
| 358 return *result; | 359 return *result; |
| 359 } | 360 } |
| 360 | 361 |
| 361 } // namespace internal | 362 } // namespace internal |
| 362 } // namespace v8 | 363 } // namespace v8 |
| OLD | NEW |