OLD | NEW |
---|---|
1 // Copyright 2015 the V8 project authors. All rights reserved. | 1 // Copyright 2015 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/objects.h" | 5 #include "src/objects.h" |
6 | 6 |
7 #include <cmath> | 7 #include <cmath> |
8 #include <iomanip> | 8 #include <iomanip> |
9 #include <sstream> | 9 #include <sstream> |
10 | 10 |
(...skipping 1505 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... | |
1516 Simd128Value* a = Simd128Value::cast(this); | 1516 Simd128Value* a = Simd128Value::cast(this); |
1517 Simd128Value* b = Simd128Value::cast(other); | 1517 Simd128Value* b = Simd128Value::cast(other); |
1518 return a->map() == b->map() && a->BitwiseEquals(b); | 1518 return a->map() == b->map() && a->BitwiseEquals(b); |
1519 } | 1519 } |
1520 return false; | 1520 return false; |
1521 } | 1521 } |
1522 | 1522 |
1523 | 1523 |
1524 MaybeHandle<Object> Object::ArraySpeciesConstructor( | 1524 MaybeHandle<Object> Object::ArraySpeciesConstructor( |
1525 Isolate* isolate, Handle<Object> original_array) { | 1525 Isolate* isolate, Handle<Object> original_array) { |
1526 Handle<Context> native_context = isolate->native_context(); | |
1527 Handle<Object> default_species = isolate->array_function(); | 1526 Handle<Object> default_species = isolate->array_function(); |
1528 if (!FLAG_harmony_species) { | 1527 if (!FLAG_harmony_species) { |
1529 return default_species; | 1528 return default_species; |
1530 } | 1529 } |
1531 if (original_array->IsJSArray() && | 1530 if (original_array->IsJSArray() && |
1532 Handle<JSReceiver>::cast(original_array)->map()->new_target_is_base() && | 1531 Handle<JSReceiver>::cast(original_array)->map()->new_target_is_base() && |
1533 isolate->IsArraySpeciesLookupChainIntact()) { | 1532 isolate->IsArraySpeciesLookupChainIntact()) { |
1534 return default_species; | 1533 return default_species; |
1535 } | 1534 } |
1536 Handle<Object> constructor = isolate->factory()->undefined_value(); | 1535 Handle<Object> constructor = isolate->factory()->undefined_value(); |
1537 Maybe<bool> is_array = Object::IsArray(original_array); | 1536 Maybe<bool> is_array = Object::IsArray(original_array); |
1538 MAYBE_RETURN_NULL(is_array); | 1537 MAYBE_RETURN_NULL(is_array); |
1539 if (is_array.FromJust()) { | 1538 if (is_array.FromJust()) { |
1540 ASSIGN_RETURN_ON_EXCEPTION( | 1539 ASSIGN_RETURN_ON_EXCEPTION( |
1541 isolate, constructor, | 1540 isolate, constructor, |
1542 Object::GetProperty(original_array, | 1541 Object::GetProperty(original_array, |
1543 isolate->factory()->constructor_string()), | 1542 isolate->factory()->constructor_string()), |
1544 Object); | 1543 Object); |
1545 if (constructor->IsConstructor()) { | 1544 if (constructor->IsConstructor()) { |
1546 Handle<Context> constructor_context; | 1545 Handle<Context> constructor_context; |
1547 ASSIGN_RETURN_ON_EXCEPTION( | 1546 ASSIGN_RETURN_ON_EXCEPTION( |
1548 isolate, constructor_context, | 1547 isolate, constructor_context, |
1549 JSReceiver::GetFunctionRealm(Handle<JSReceiver>::cast(constructor)), | 1548 JSReceiver::GetFunctionRealm(Handle<JSReceiver>::cast(constructor)), |
1550 Object); | 1549 Object); |
1551 if (*constructor_context != *native_context && | 1550 if (*constructor_context != *isolate->native_context() && |
1552 *constructor == constructor_context->array_function()) { | 1551 *constructor == constructor_context->array_function()) { |
1553 constructor = isolate->factory()->undefined_value(); | 1552 constructor = isolate->factory()->undefined_value(); |
1554 } | 1553 } |
1555 } | 1554 } |
1556 if (constructor->IsJSReceiver()) { | 1555 if (constructor->IsJSReceiver()) { |
1557 ASSIGN_RETURN_ON_EXCEPTION( | 1556 ASSIGN_RETURN_ON_EXCEPTION( |
1558 isolate, constructor, | 1557 isolate, constructor, |
1559 JSReceiver::GetProperty(Handle<JSReceiver>::cast(constructor), | 1558 JSReceiver::GetProperty(Handle<JSReceiver>::cast(constructor), |
1560 isolate->factory()->species_symbol()), | 1559 isolate->factory()->species_symbol()), |
1561 Object); | 1560 Object); |
(...skipping 2940 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... | |
4502 if (FLAG_trace_js_array_abuse && !array->HasFixedTypedArrayElements()) { | 4501 if (FLAG_trace_js_array_abuse && !array->HasFixedTypedArrayElements()) { |
4503 CheckArrayAbuse(array, "elements write", it->index(), false); | 4502 CheckArrayAbuse(array, "elements write", it->index(), false); |
4504 } | 4503 } |
4505 } | 4504 } |
4506 | 4505 |
4507 Maybe<bool> result = JSObject::AddDataElement(receiver, it->index(), value, | 4506 Maybe<bool> result = JSObject::AddDataElement(receiver, it->index(), value, |
4508 attributes, should_throw); | 4507 attributes, should_throw); |
4509 JSObject::ValidateElements(receiver); | 4508 JSObject::ValidateElements(receiver); |
4510 return result; | 4509 return result; |
4511 } else { | 4510 } else { |
4511 it->isolate()->UpdateArrayIsConcatSpreadableProtectorOnAddProperty( | |
4512 receiver, it->name()); | |
Toon Verwaest
2016/03/31 08:09:46
This is by far not enough. Reuse dehrenberg's Look
| |
4512 // Migrate to the most up-to-date map that will be able to store |value| | 4513 // Migrate to the most up-to-date map that will be able to store |value| |
4513 // under it->name() with |attributes|. | 4514 // under it->name() with |attributes|. |
4514 it->PrepareTransitionToDataProperty(receiver, value, attributes, | 4515 it->PrepareTransitionToDataProperty(receiver, value, attributes, |
4515 store_mode); | 4516 store_mode); |
4516 DCHECK_EQ(LookupIterator::TRANSITION, it->state()); | 4517 DCHECK_EQ(LookupIterator::TRANSITION, it->state()); |
4517 it->ApplyTransitionToDataProperty(receiver); | 4518 it->ApplyTransitionToDataProperty(receiver); |
4518 | 4519 |
4519 // TODO(verwaest): Encapsulate dictionary handling better. | 4520 // TODO(verwaest): Encapsulate dictionary handling better. |
4520 if (receiver->map()->is_dictionary_map()) { | 4521 if (receiver->map()->is_dictionary_map()) { |
4521 // TODO(dcarney): just populate TransitionPropertyCell here? | 4522 // TODO(dcarney): just populate TransitionPropertyCell here? |
(...skipping 15238 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... | |
19760 if (cell->value() != *new_value) { | 19761 if (cell->value() != *new_value) { |
19761 cell->set_value(*new_value); | 19762 cell->set_value(*new_value); |
19762 Isolate* isolate = cell->GetIsolate(); | 19763 Isolate* isolate = cell->GetIsolate(); |
19763 cell->dependent_code()->DeoptimizeDependentCodeGroup( | 19764 cell->dependent_code()->DeoptimizeDependentCodeGroup( |
19764 isolate, DependentCode::kPropertyCellChangedGroup); | 19765 isolate, DependentCode::kPropertyCellChangedGroup); |
19765 } | 19766 } |
19766 } | 19767 } |
19767 | 19768 |
19768 } // namespace internal | 19769 } // namespace internal |
19769 } // namespace v8 | 19770 } // namespace v8 |
OLD | NEW |