| 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 526 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 537 is_simple = false; | 537 is_simple = false; |
| 538 } | 538 } |
| 539 | 539 |
| 540 JSObject::AddDataElement(array, array_index, boilerplate_value, NONE) | 540 JSObject::AddDataElement(array, array_index, boilerplate_value, NONE) |
| 541 .Assert(); | 541 .Assert(); |
| 542 } | 542 } |
| 543 | 543 |
| 544 if (array_index != values()->length()) { | 544 if (array_index != values()->length()) { |
| 545 JSArray::SetLength(array, array_index); | 545 JSArray::SetLength(array, array_index); |
| 546 } | 546 } |
| 547 JSObject::ValidateElements(array); |
| 547 Handle<FixedArrayBase> element_values(array->elements()); | 548 Handle<FixedArrayBase> element_values(array->elements()); |
| 548 | 549 |
| 549 // Simple and shallow arrays can be lazily copied, we transform the | 550 // Simple and shallow arrays can be lazily copied, we transform the |
| 550 // elements array to a copy-on-write array. | 551 // elements array to a copy-on-write array. |
| 551 if (is_simple && depth_acc == 1 && array_index > 0 && | 552 if (is_simple && depth_acc == 1 && array_index > 0 && |
| 552 array->HasFastSmiOrObjectElements()) { | 553 array->HasFastSmiOrObjectElements()) { |
| 553 element_values->set_map(isolate->heap()->fixed_cow_array_map()); | 554 element_values->set_map(isolate->heap()->fixed_cow_array_map()); |
| 554 } | 555 } |
| 555 | 556 |
| 556 // Remember both the literal's constant values as well as the ElementsKind | 557 // Remember both the literal's constant values as well as the ElementsKind |
| (...skipping 585 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 1142 bool Literal::Match(void* literal1, void* literal2) { | 1143 bool Literal::Match(void* literal1, void* literal2) { |
| 1143 const AstValue* x = static_cast<Literal*>(literal1)->raw_value(); | 1144 const AstValue* x = static_cast<Literal*>(literal1)->raw_value(); |
| 1144 const AstValue* y = static_cast<Literal*>(literal2)->raw_value(); | 1145 const AstValue* y = static_cast<Literal*>(literal2)->raw_value(); |
| 1145 return (x->IsString() && y->IsString() && x->AsString() == y->AsString()) || | 1146 return (x->IsString() && y->IsString() && x->AsString() == y->AsString()) || |
| 1146 (x->IsNumber() && y->IsNumber() && x->AsNumber() == y->AsNumber()); | 1147 (x->IsNumber() && y->IsNumber() && x->AsNumber() == y->AsNumber()); |
| 1147 } | 1148 } |
| 1148 | 1149 |
| 1149 | 1150 |
| 1150 } // namespace internal | 1151 } // namespace internal |
| 1151 } // namespace v8 | 1152 } // namespace v8 |
| OLD | NEW |