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/ast.h" | 5 #include "src/ast.h" |
6 | 6 |
7 #include <cmath> // For isfinite. | 7 #include <cmath> // For isfinite. |
8 #include "src/builtins.h" | 8 #include "src/builtins.h" |
9 #include "src/code-stubs.h" | 9 #include "src/code-stubs.h" |
10 #include "src/contexts.h" | 10 #include "src/contexts.h" |
(...skipping 523 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
534 Expression* element = values()->at(array_index); | 534 Expression* element = values()->at(array_index); |
535 if (element->IsSpread()) break; | 535 if (element->IsSpread()) break; |
536 MaterializedLiteral* m_literal = element->AsMaterializedLiteral(); | 536 MaterializedLiteral* m_literal = element->AsMaterializedLiteral(); |
537 if (m_literal != NULL) { | 537 if (m_literal != NULL) { |
538 m_literal->BuildConstants(isolate); | 538 m_literal->BuildConstants(isolate); |
539 if (m_literal->depth() + 1 > depth_acc) { | 539 if (m_literal->depth() + 1 > depth_acc) { |
540 depth_acc = m_literal->depth() + 1; | 540 depth_acc = m_literal->depth() + 1; |
541 } | 541 } |
542 } | 542 } |
543 Handle<Object> boilerplate_value = GetBoilerplateValue(element, isolate); | 543 Handle<Object> boilerplate_value = GetBoilerplateValue(element, isolate); |
| 544 |
544 if (boilerplate_value->IsTheHole()) { | 545 if (boilerplate_value->IsTheHole()) { |
545 is_holey = true; | 546 is_holey = true; |
546 } else if (boilerplate_value->IsUninitialized()) { | 547 continue; |
| 548 } |
| 549 |
| 550 if (boilerplate_value->IsUninitialized()) { |
| 551 boilerplate_value = handle(Smi::FromInt(0), isolate); |
547 is_simple = false; | 552 is_simple = false; |
548 JSObject::SetOwnElement(array, array_index, | |
549 handle(Smi::FromInt(0), isolate), | |
550 SLOPPY).Assert(); | |
551 } else { | |
552 JSObject::SetOwnElement(array, array_index, boilerplate_value, SLOPPY) | |
553 .Assert(); | |
554 } | 553 } |
| 554 |
| 555 JSObject::AddDataElement(array, array_index, boilerplate_value, NONE) |
| 556 .Assert(); |
555 } | 557 } |
556 | 558 |
557 if (array_index != values()->length()) { | 559 if (array_index != values()->length()) { |
558 JSArray::SetElementsLength( | 560 JSArray::SetElementsLength( |
559 array, handle(Smi::FromInt(array_index), isolate)).Assert(); | 561 array, handle(Smi::FromInt(array_index), isolate)).Assert(); |
560 } | 562 } |
561 Handle<FixedArrayBase> element_values(array->elements()); | 563 Handle<FixedArrayBase> element_values(array->elements()); |
562 | 564 |
563 // Simple and shallow arrays can be lazily copied, we transform the | 565 // Simple and shallow arrays can be lazily copied, we transform the |
564 // elements array to a copy-on-write array. | 566 // elements array to a copy-on-write array. |
(...skipping 591 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
1156 bool Literal::Match(void* literal1, void* literal2) { | 1158 bool Literal::Match(void* literal1, void* literal2) { |
1157 const AstValue* x = static_cast<Literal*>(literal1)->raw_value(); | 1159 const AstValue* x = static_cast<Literal*>(literal1)->raw_value(); |
1158 const AstValue* y = static_cast<Literal*>(literal2)->raw_value(); | 1160 const AstValue* y = static_cast<Literal*>(literal2)->raw_value(); |
1159 return (x->IsString() && y->IsString() && x->AsString() == y->AsString()) || | 1161 return (x->IsString() && y->IsString() && x->AsString() == y->AsString()) || |
1160 (x->IsNumber() && y->IsNumber() && x->AsNumber() == y->AsNumber()); | 1162 (x->IsNumber() && y->IsNumber() && x->AsNumber() == y->AsNumber()); |
1161 } | 1163 } |
1162 | 1164 |
1163 | 1165 |
1164 } // namespace internal | 1166 } // namespace internal |
1165 } // namespace v8 | 1167 } // namespace v8 |
OLD | NEW |