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 539 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
550 if (boilerplate_value->IsUninitialized()) { | 550 if (boilerplate_value->IsUninitialized()) { |
551 boilerplate_value = handle(Smi::FromInt(0), isolate); | 551 boilerplate_value = handle(Smi::FromInt(0), isolate); |
552 is_simple = false; | 552 is_simple = false; |
553 } | 553 } |
554 | 554 |
555 JSObject::AddDataElement(array, array_index, boilerplate_value, NONE) | 555 JSObject::AddDataElement(array, array_index, boilerplate_value, NONE) |
556 .Assert(); | 556 .Assert(); |
557 } | 557 } |
558 | 558 |
559 if (array_index != values()->length()) { | 559 if (array_index != values()->length()) { |
560 JSArray::SetElementsLength( | 560 JSArray::SetLength(array, array_index); |
561 array, handle(Smi::FromInt(array_index), isolate)).Assert(); | |
562 } | 561 } |
563 Handle<FixedArrayBase> element_values(array->elements()); | 562 Handle<FixedArrayBase> element_values(array->elements()); |
564 | 563 |
565 // Simple and shallow arrays can be lazily copied, we transform the | 564 // Simple and shallow arrays can be lazily copied, we transform the |
566 // elements array to a copy-on-write array. | 565 // elements array to a copy-on-write array. |
567 if (is_simple && depth_acc == 1 && array_index > 0 && | 566 if (is_simple && depth_acc == 1 && array_index > 0 && |
568 array->HasFastSmiOrObjectElements()) { | 567 array->HasFastSmiOrObjectElements()) { |
569 element_values->set_map(isolate->heap()->fixed_cow_array_map()); | 568 element_values->set_map(isolate->heap()->fixed_cow_array_map()); |
570 } | 569 } |
571 | 570 |
(...skipping 586 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
1158 bool Literal::Match(void* literal1, void* literal2) { | 1157 bool Literal::Match(void* literal1, void* literal2) { |
1159 const AstValue* x = static_cast<Literal*>(literal1)->raw_value(); | 1158 const AstValue* x = static_cast<Literal*>(literal1)->raw_value(); |
1160 const AstValue* y = static_cast<Literal*>(literal2)->raw_value(); | 1159 const AstValue* y = static_cast<Literal*>(literal2)->raw_value(); |
1161 return (x->IsString() && y->IsString() && x->AsString() == y->AsString()) || | 1160 return (x->IsString() && y->IsString() && x->AsString() == y->AsString()) || |
1162 (x->IsNumber() && y->IsNumber() && x->AsNumber() == y->AsNumber()); | 1161 (x->IsNumber() && y->IsNumber() && x->AsNumber() == y->AsNumber()); |
1163 } | 1162 } |
1164 | 1163 |
1165 | 1164 |
1166 } // namespace internal | 1165 } // namespace internal |
1167 } // namespace v8 | 1166 } // namespace v8 |
OLD | NEW |