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(isolate)) { | 88 if (value->IsUninitialized()) value = handle(Smi::FromInt(0), isolate); |
89 value = handle(Smi::FromInt(0), isolate); | |
90 } | |
91 maybe_result = JSObject::SetOwnElementIgnoreAttributes( | 89 maybe_result = JSObject::SetOwnElementIgnoreAttributes( |
92 boilerplate, element_index, value, NONE); | 90 boilerplate, element_index, value, NONE); |
93 } else { | 91 } else { |
94 Handle<String> name = Handle<String>::cast(key); | 92 Handle<String> name = Handle<String>::cast(key); |
95 DCHECK(!name->AsArrayIndex(&element_index)); | 93 DCHECK(!name->AsArrayIndex(&element_index)); |
96 maybe_result = JSObject::SetOwnPropertyIgnoreAttributes(boilerplate, name, | 94 maybe_result = JSObject::SetOwnPropertyIgnoreAttributes(boilerplate, name, |
97 value, NONE); | 95 value, NONE); |
98 } | 96 } |
99 RETURN_ON_EXCEPTION(isolate, maybe_result, Object); | 97 RETURN_ON_EXCEPTION(isolate, maybe_result, Object); |
100 } | 98 } |
(...skipping 246 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
347 | 345 |
348 Handle<LiteralsArray> literals(closure->literals(), isolate); | 346 Handle<LiteralsArray> literals(closure->literals(), isolate); |
349 RETURN_RESULT_OR_FAILURE( | 347 RETURN_RESULT_OR_FAILURE( |
350 isolate, | 348 isolate, |
351 CreateArrayLiteralImpl(isolate, literals, literals_index, elements, | 349 CreateArrayLiteralImpl(isolate, literals, literals_index, elements, |
352 ArrayLiteral::kShallowElements)); | 350 ArrayLiteral::kShallowElements)); |
353 } | 351 } |
354 | 352 |
355 } // namespace internal | 353 } // namespace internal |
356 } // namespace v8 | 354 } // namespace v8 |
OLD | NEW |