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 67 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
78 // simple object or array literal. | 78 // simple object or array literal. |
79 Handle<FixedArray> array = Handle<FixedArray>::cast(value); | 79 Handle<FixedArray> array = Handle<FixedArray>::cast(value); |
80 ASSIGN_RETURN_ON_EXCEPTION( | 80 ASSIGN_RETURN_ON_EXCEPTION( |
81 isolate, value, CreateLiteralBoilerplate(isolate, literals, array), | 81 isolate, value, CreateLiteralBoilerplate(isolate, literals, array), |
82 Object); | 82 Object); |
83 } | 83 } |
84 MaybeHandle<Object> maybe_result; | 84 MaybeHandle<Object> maybe_result; |
85 uint32_t element_index = 0; | 85 uint32_t element_index = 0; |
86 if (key->ToArrayIndex(&element_index)) { | 86 if (key->ToArrayIndex(&element_index)) { |
87 // Array index (uint32). | 87 // Array index (uint32). |
88 if (value->IsUninitialized()) value = handle(Smi::FromInt(0), isolate); | 88 if (value->IsUninitialized(isolate)) { |
| 89 value = handle(Smi::FromInt(0), isolate); |
| 90 } |
89 maybe_result = JSObject::SetOwnElementIgnoreAttributes( | 91 maybe_result = JSObject::SetOwnElementIgnoreAttributes( |
90 boilerplate, element_index, value, NONE); | 92 boilerplate, element_index, value, NONE); |
91 } else { | 93 } else { |
92 Handle<String> name = Handle<String>::cast(key); | 94 Handle<String> name = Handle<String>::cast(key); |
93 DCHECK(!name->AsArrayIndex(&element_index)); | 95 DCHECK(!name->AsArrayIndex(&element_index)); |
94 maybe_result = JSObject::SetOwnPropertyIgnoreAttributes(boilerplate, name, | 96 maybe_result = JSObject::SetOwnPropertyIgnoreAttributes(boilerplate, name, |
95 value, NONE); | 97 value, NONE); |
96 } | 98 } |
97 RETURN_ON_EXCEPTION(isolate, maybe_result, Object); | 99 RETURN_ON_EXCEPTION(isolate, maybe_result, Object); |
98 } | 100 } |
(...skipping 246 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
345 | 347 |
346 Handle<LiteralsArray> literals(closure->literals(), isolate); | 348 Handle<LiteralsArray> literals(closure->literals(), isolate); |
347 RETURN_RESULT_OR_FAILURE( | 349 RETURN_RESULT_OR_FAILURE( |
348 isolate, | 350 isolate, |
349 CreateArrayLiteralImpl(isolate, literals, literals_index, elements, | 351 CreateArrayLiteralImpl(isolate, literals, literals_index, elements, |
350 ArrayLiteral::kShallowElements)); | 352 ArrayLiteral::kShallowElements)); |
351 } | 353 } |
352 | 354 |
353 } // namespace internal | 355 } // namespace internal |
354 } // namespace v8 | 356 } // namespace v8 |
OLD | NEW |