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 1587 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... | |
1598 Simd128Value* a = Simd128Value::cast(this); | 1598 Simd128Value* a = Simd128Value::cast(this); |
1599 Simd128Value* b = Simd128Value::cast(other); | 1599 Simd128Value* b = Simd128Value::cast(other); |
1600 return a->map()->instance_type() == b->map()->instance_type() && | 1600 return a->map()->instance_type() == b->map()->instance_type() && |
1601 a->BitwiseEquals(b); | 1601 a->BitwiseEquals(b); |
1602 } | 1602 } |
1603 } | 1603 } |
1604 return false; | 1604 return false; |
1605 } | 1605 } |
1606 | 1606 |
1607 | 1607 |
1608 MaybeHandle<Object> Object::ArraySpeciesConstructor( | |
1609 Isolate* isolate, Handle<Object> original_array) { | |
1610 Handle<Context> native_context = isolate->native_context(); | |
1611 if (!FLAG_harmony_species) { | |
1612 return Handle<Object>(native_context->array_function(), isolate); | |
1613 } | |
1614 Handle<Object> constructor = isolate->factory()->undefined_value(); | |
1615 Maybe<bool> is_array = Object::IsArray(original_array); | |
1616 MAYBE_RETURN_NULL(is_array); | |
1617 if (is_array.FromJust()) { | |
1618 ASSIGN_RETURN_ON_EXCEPTION( | |
1619 isolate, constructor, | |
1620 Object::GetProperty(original_array, | |
1621 isolate->factory()->constructor_string()), | |
1622 Object); | |
1623 if (constructor->IsConstructor()) { | |
1624 Handle<Context> constructor_context; | |
1625 ASSIGN_RETURN_ON_EXCEPTION( | |
1626 isolate, constructor_context, | |
1627 JSReceiver::GetFunctionRealm(Handle<JSReceiver>::cast(constructor)), | |
adamk
2016/01/07 01:11:04
Did this need changing to make proxies work? Can y
Dan Ehrenberg
2016/01/07 01:35:17
Yeah, you caught me. I couldn't think of a great t
adamk
2016/01/07 01:38:30
Not crashing is sufficient to allay my fears.
| |
1628 Object); | |
1629 if (*constructor_context != *native_context && | |
1630 *constructor == constructor_context->array_function()) { | |
1631 constructor = isolate->factory()->undefined_value(); | |
1632 } | |
1633 } | |
1634 if (constructor->IsJSReceiver()) { | |
1635 ASSIGN_RETURN_ON_EXCEPTION( | |
1636 isolate, constructor, | |
1637 Object::GetProperty(constructor, | |
1638 isolate->factory()->species_symbol()), | |
1639 Object); | |
1640 if (constructor->IsNull()) { | |
1641 constructor = isolate->factory()->undefined_value(); | |
1642 } | |
1643 } | |
1644 } | |
1645 if (constructor->IsUndefined()) { | |
1646 return Handle<Object>(native_context->array_function(), isolate); | |
1647 } else { | |
1648 if (!constructor->IsConstructor()) { | |
1649 return isolate->Throw<Object>(isolate->factory()->NewTypeError( | |
adamk
2016/01/07 01:11:04
Looks like there's a macro for this:
THROW_NEW_ER
Dan Ehrenberg
2016/01/07 01:35:17
OK, sure.
adamk
2016/01/07 01:38:30
Sorry, it's the week of macros!
| |
1650 MessageTemplate::kSpeciesNotConstructor)); | |
1651 } | |
1652 return constructor; | |
1653 } | |
1654 } | |
1655 | |
1656 | |
1608 void Object::ShortPrint(FILE* out) { | 1657 void Object::ShortPrint(FILE* out) { |
1609 OFStream os(out); | 1658 OFStream os(out); |
1610 os << Brief(this); | 1659 os << Brief(this); |
1611 } | 1660 } |
1612 | 1661 |
1613 | 1662 |
1614 void Object::ShortPrint(StringStream* accumulator) { | 1663 void Object::ShortPrint(StringStream* accumulator) { |
1615 std::ostringstream os; | 1664 std::ostringstream os; |
1616 os << Brief(this); | 1665 os << Brief(this); |
1617 accumulator->Add(os.str().c_str()); | 1666 accumulator->Add(os.str().c_str()); |
(...skipping 17936 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... | |
19554 if (cell->value() != *new_value) { | 19603 if (cell->value() != *new_value) { |
19555 cell->set_value(*new_value); | 19604 cell->set_value(*new_value); |
19556 Isolate* isolate = cell->GetIsolate(); | 19605 Isolate* isolate = cell->GetIsolate(); |
19557 cell->dependent_code()->DeoptimizeDependentCodeGroup( | 19606 cell->dependent_code()->DeoptimizeDependentCodeGroup( |
19558 isolate, DependentCode::kPropertyCellChangedGroup); | 19607 isolate, DependentCode::kPropertyCellChangedGroup); |
19559 } | 19608 } |
19560 } | 19609 } |
19561 | 19610 |
19562 } // namespace internal | 19611 } // namespace internal |
19563 } // namespace v8 | 19612 } // namespace v8 |
OLD | NEW |