OLD | NEW |
---|---|
1 // Copyright 2013 the V8 project authors. All rights reserved. | 1 // Copyright 2013 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 <iomanip> | 5 #include <iomanip> |
6 #include <sstream> | 6 #include <sstream> |
7 | 7 |
8 #include "src/v8.h" | 8 #include "src/v8.h" |
9 | 9 |
10 #include "src/accessors.h" | 10 #include "src/accessors.h" |
(...skipping 64 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... | |
75 if (object->IsJSReceiver()) return Handle<JSReceiver>::cast(object); | 75 if (object->IsJSReceiver()) return Handle<JSReceiver>::cast(object); |
76 Handle<JSFunction> constructor; | 76 Handle<JSFunction> constructor; |
77 if (object->IsNumber()) { | 77 if (object->IsNumber()) { |
78 constructor = handle(native_context->number_function(), isolate); | 78 constructor = handle(native_context->number_function(), isolate); |
79 } else if (object->IsBoolean()) { | 79 } else if (object->IsBoolean()) { |
80 constructor = handle(native_context->boolean_function(), isolate); | 80 constructor = handle(native_context->boolean_function(), isolate); |
81 } else if (object->IsString()) { | 81 } else if (object->IsString()) { |
82 constructor = handle(native_context->string_function(), isolate); | 82 constructor = handle(native_context->string_function(), isolate); |
83 } else if (object->IsSymbol()) { | 83 } else if (object->IsSymbol()) { |
84 constructor = handle(native_context->symbol_function(), isolate); | 84 constructor = handle(native_context->symbol_function(), isolate); |
85 } else if (object->IsFloat32x4()) { | 85 } else if (object->IsSimd128Value()) { |
86 constructor = handle(native_context->float32x4_function(), isolate); | 86 if (object->IsFloat32x4()) { |
87 constructor = handle(native_context->float32x4_function(), isolate); | |
88 } else if (object->IsInt32x4()) { | |
89 constructor = handle(native_context->int32x4_function(), isolate); | |
90 } else if (object->IsBool32x4()) { | |
91 constructor = handle(native_context->bool32x4_function(), isolate); | |
92 } else if (object->IsInt16x8()) { | |
93 constructor = handle(native_context->int16x8_function(), isolate); | |
94 } else if (object->IsBool16x8()) { | |
95 constructor = handle(native_context->bool16x8_function(), isolate); | |
96 } else if (object->IsInt8x16()) { | |
97 constructor = handle(native_context->int8x16_function(), isolate); | |
98 } else if (object->IsBool8x16()) { | |
99 constructor = handle(native_context->bool8x16_function(), isolate); | |
100 } else { | |
101 UNREACHABLE(); | |
102 return MaybeHandle<JSReceiver>(); | |
rossberg
2015/07/29 14:37:55
Nit: the return here is redundant.
bbudge
2015/07/30 13:46:58
Done.
| |
103 } | |
87 } else { | 104 } else { |
88 return MaybeHandle<JSReceiver>(); | 105 return MaybeHandle<JSReceiver>(); |
89 } | 106 } |
90 Handle<JSObject> result = isolate->factory()->NewJSObject(constructor); | 107 Handle<JSObject> result = isolate->factory()->NewJSObject(constructor); |
91 Handle<JSValue>::cast(result)->set_value(*object); | 108 Handle<JSValue>::cast(result)->set_value(*object); |
92 return result; | 109 return result; |
93 } | 110 } |
94 | 111 |
95 | 112 |
96 bool Object::BooleanValue() { | 113 bool Object::BooleanValue() { |
97 if (IsBoolean()) return IsTrue(); | 114 if (IsBoolean()) return IsTrue(); |
98 if (IsSmi()) return Smi::cast(this)->value() != 0; | 115 if (IsSmi()) return Smi::cast(this)->value() != 0; |
99 if (IsUndefined() || IsNull()) return false; | 116 if (IsUndefined() || IsNull()) return false; |
100 if (IsUndetectableObject()) return false; // Undetectable object is false. | 117 if (IsUndetectableObject()) return false; // Undetectable object is false. |
101 if (IsString()) return String::cast(this)->length() != 0; | 118 if (IsString()) return String::cast(this)->length() != 0; |
102 if (IsHeapNumber()) return HeapNumber::cast(this)->HeapNumberBooleanValue(); | 119 if (IsHeapNumber()) return HeapNumber::cast(this)->HeapNumberBooleanValue(); |
103 if (IsFloat32x4()) return true; // Simd value types always evaluate to true. | 120 if (IsSimd128Value()) return true; // Simd value types evaluate to true. |
104 return true; | 121 return true; |
105 } | 122 } |
106 | 123 |
107 | 124 |
108 bool Object::IsCallable() const { | 125 bool Object::IsCallable() const { |
109 const Object* fun = this; | 126 const Object* fun = this; |
110 while (fun->IsJSFunctionProxy()) { | 127 while (fun->IsJSFunctionProxy()) { |
111 fun = JSFunctionProxy::cast(fun)->call_trap(); | 128 fun = JSFunctionProxy::cast(fun)->call_trap(); |
112 } | 129 } |
113 return fun->IsJSFunction() || | 130 return fun->IsJSFunction() || |
(...skipping 508 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... | |
622 } | 639 } |
623 if (heap_object->IsString()) { | 640 if (heap_object->IsString()) { |
624 return context->string_function()->initial_map(); | 641 return context->string_function()->initial_map(); |
625 } | 642 } |
626 if (heap_object->IsSymbol()) { | 643 if (heap_object->IsSymbol()) { |
627 return context->symbol_function()->initial_map(); | 644 return context->symbol_function()->initial_map(); |
628 } | 645 } |
629 if (heap_object->IsBoolean()) { | 646 if (heap_object->IsBoolean()) { |
630 return context->boolean_function()->initial_map(); | 647 return context->boolean_function()->initial_map(); |
631 } | 648 } |
632 if (heap_object->IsFloat32x4()) { | 649 if (heap_object->IsSimd128Value()) { |
633 return context->float32x4_function()->initial_map(); | 650 if (heap_object->IsFloat32x4()) { |
651 return context->float32x4_function()->initial_map(); | |
652 } else if (heap_object->IsInt32x4()) { | |
653 return context->int32x4_function()->initial_map(); | |
654 } else if (heap_object->IsBool32x4()) { | |
655 return context->bool32x4_function()->initial_map(); | |
656 } else if (heap_object->IsInt16x8()) { | |
657 return context->int16x8_function()->initial_map(); | |
658 } else if (heap_object->IsBool16x8()) { | |
659 return context->bool16x8_function()->initial_map(); | |
660 } else if (heap_object->IsInt8x16()) { | |
661 return context->int8x16_function()->initial_map(); | |
662 } else if (heap_object->IsBool8x16()) { | |
663 return context->bool8x16_function()->initial_map(); | |
664 } else { | |
665 UNREACHABLE(); | |
666 } | |
634 } | 667 } |
635 return isolate->heap()->null_value()->map(); | 668 return isolate->heap()->null_value()->map(); |
636 } | 669 } |
637 | 670 |
638 | 671 |
639 Object* Object::GetHash() { | 672 Object* Object::GetHash() { |
640 Object* hash = GetSimpleHash(); | 673 Object* hash = GetSimpleHash(); |
641 if (hash->IsSmi()) return hash; | 674 if (hash->IsSmi()) return hash; |
642 | 675 |
643 DCHECK(IsJSReceiver()); | 676 DCHECK(IsJSReceiver()); |
(...skipping 19 matching lines...) Expand all Loading... | |
663 return Smi::FromInt(hash & Smi::kMaxValue); | 696 return Smi::FromInt(hash & Smi::kMaxValue); |
664 } | 697 } |
665 if (IsName()) { | 698 if (IsName()) { |
666 uint32_t hash = Name::cast(this)->Hash(); | 699 uint32_t hash = Name::cast(this)->Hash(); |
667 return Smi::FromInt(hash); | 700 return Smi::FromInt(hash); |
668 } | 701 } |
669 if (IsOddball()) { | 702 if (IsOddball()) { |
670 uint32_t hash = Oddball::cast(this)->to_string()->Hash(); | 703 uint32_t hash = Oddball::cast(this)->to_string()->Hash(); |
671 return Smi::FromInt(hash); | 704 return Smi::FromInt(hash); |
672 } | 705 } |
673 if (IsFloat32x4()) { | 706 if (IsSimd128Value()) { |
674 Float32x4* simd = Float32x4::cast(this); | 707 uint32_t hash = Simd128Value::cast(this)->Hash(); |
675 uint32_t seed = v8::internal::kZeroHashSeed; | |
676 uint32_t hash; | |
677 hash = ComputeIntegerHash(bit_cast<uint32_t>(simd->get_lane(0)), seed); | |
678 hash = ComputeIntegerHash(bit_cast<uint32_t>(simd->get_lane(1)), hash * 31); | |
679 hash = ComputeIntegerHash(bit_cast<uint32_t>(simd->get_lane(2)), hash * 31); | |
680 hash = ComputeIntegerHash(bit_cast<uint32_t>(simd->get_lane(3)), hash * 31); | |
681 return Smi::FromInt(hash & Smi::kMaxValue); | 708 return Smi::FromInt(hash & Smi::kMaxValue); |
682 } | 709 } |
683 DCHECK(IsJSReceiver()); | 710 DCHECK(IsJSReceiver()); |
684 JSReceiver* receiver = JSReceiver::cast(this); | 711 JSReceiver* receiver = JSReceiver::cast(this); |
685 return receiver->GetHeap()->undefined_value(); | 712 return receiver->GetHeap()->undefined_value(); |
686 } | 713 } |
687 | 714 |
688 | 715 |
689 Handle<Smi> Object::GetOrCreateHash(Isolate* isolate, Handle<Object> object) { | 716 Handle<Smi> Object::GetOrCreateHash(Isolate* isolate, Handle<Object> object) { |
690 Handle<Object> hash(object->GetSimpleHash(), isolate); | 717 Handle<Object> hash(object->GetSimpleHash(), isolate); |
691 if (hash->IsSmi()) return Handle<Smi>::cast(hash); | 718 if (hash->IsSmi()) return Handle<Smi>::cast(hash); |
692 | 719 |
693 DCHECK(object->IsJSReceiver()); | 720 DCHECK(object->IsJSReceiver()); |
694 return JSReceiver::GetOrCreateIdentityHash(Handle<JSReceiver>::cast(object)); | 721 return JSReceiver::GetOrCreateIdentityHash(Handle<JSReceiver>::cast(object)); |
695 } | 722 } |
696 | 723 |
697 | 724 |
698 bool Object::SameValue(Object* other) { | 725 bool Object::SameValue(Object* other) { |
699 if (other == this) return true; | 726 if (other == this) return true; |
700 | 727 |
701 // The object is either a number, a name, an odd-ball, | 728 // The object is either a number, a name, an odd-ball, |
702 // a real JS object, or a Harmony proxy. | 729 // a real JS object, or a Harmony proxy. |
703 if (IsNumber() && other->IsNumber()) { | 730 if (IsNumber() && other->IsNumber()) { |
704 return v8::internal::SameValue(Number(), other->Number()); | 731 double this_value = Number(); |
732 double other_value = other->Number(); | |
733 // SameValue(NaN, NaN) is true. | |
734 if (this_value != other_value) { | |
735 return std::isnan(this_value) && std::isnan(other_value); | |
736 } | |
737 // SameValue(0.0, -0.0) is false. | |
738 return (std::signbit(this_value) == std::signbit(other_value)); | |
705 } | 739 } |
706 if (IsString() && other->IsString()) { | 740 if (IsString() && other->IsString()) { |
707 return String::cast(this)->Equals(String::cast(other)); | 741 return String::cast(this)->Equals(String::cast(other)); |
708 } | 742 } |
709 if (IsFloat32x4() && other->IsFloat32x4()) { | 743 if (IsSimd128Value() && other->IsSimd128Value()) { |
710 Float32x4* x = Float32x4::cast(this); | 744 if (IsFloat32x4() && other->IsFloat32x4()) { |
711 Float32x4* y = Float32x4::cast(other); | 745 Float32x4* x = Float32x4::cast(this); |
712 return v8::internal::SameValue(x->get_lane(0), y->get_lane(0)) && | 746 Float32x4* y = Float32x4::cast(other); |
713 v8::internal::SameValue(x->get_lane(1), y->get_lane(1)) && | 747 return x->SameValue(y); |
714 v8::internal::SameValue(x->get_lane(2), y->get_lane(2)) && | 748 } else { |
715 v8::internal::SameValue(x->get_lane(3), y->get_lane(3)); | 749 Simd128Value* x = Simd128Value::cast(this); |
750 Simd128Value* y = Simd128Value::cast(other); | |
751 return x->map()->instance_type() == y->map()->instance_type() && | |
752 x->SameValueZero(y); | |
753 } | |
716 } | 754 } |
717 return false; | 755 return false; |
718 } | 756 } |
719 | 757 |
720 | 758 |
721 bool Object::SameValueZero(Object* other) { | 759 bool Object::SameValueZero(Object* other) { |
722 if (other == this) return true; | 760 if (other == this) return true; |
723 | 761 |
724 // The object is either a number, a name, an odd-ball, | 762 // The object is either a number, a name, an odd-ball, |
725 // a real JS object, or a Harmony proxy. | 763 // a real JS object, or a Harmony proxy. |
726 if (IsNumber() && other->IsNumber()) { | 764 if (IsNumber() && other->IsNumber()) { |
727 return v8::internal::SameValueZero(Number(), other->Number()); | 765 double this_value = Number(); |
766 double other_value = other->Number(); | |
767 // +0 == -0 is true | |
768 return this_value == other_value || | |
769 (std::isnan(this_value) && std::isnan(other_value)); | |
728 } | 770 } |
729 if (IsString() && other->IsString()) { | 771 if (IsString() && other->IsString()) { |
730 return String::cast(this)->Equals(String::cast(other)); | 772 return String::cast(this)->Equals(String::cast(other)); |
731 } | 773 } |
732 if (IsFloat32x4() && other->IsFloat32x4()) { | 774 if (IsSimd128Value() && other->IsSimd128Value()) { |
733 Float32x4* x = Float32x4::cast(this); | 775 if (IsFloat32x4() && other->IsFloat32x4()) { |
734 Float32x4* y = Float32x4::cast(other); | 776 Float32x4* x = Float32x4::cast(this); |
735 return v8::internal::SameValueZero(x->get_lane(0), y->get_lane(0)) && | 777 Float32x4* y = Float32x4::cast(other); |
736 v8::internal::SameValueZero(x->get_lane(1), y->get_lane(1)) && | 778 return x->SameValueZero(y); |
737 v8::internal::SameValueZero(x->get_lane(2), y->get_lane(2)) && | 779 } else { |
738 v8::internal::SameValueZero(x->get_lane(3), y->get_lane(3)); | 780 Simd128Value* x = Simd128Value::cast(this); |
781 Simd128Value* y = Simd128Value::cast(other); | |
782 return x->map()->instance_type() == y->map()->instance_type() && | |
783 x->SameValueZero(y); | |
784 } | |
739 } | 785 } |
740 return false; | 786 return false; |
741 } | 787 } |
742 | 788 |
743 | 789 |
744 void Object::ShortPrint(FILE* out) { | 790 void Object::ShortPrint(FILE* out) { |
745 OFStream os(out); | 791 OFStream os(out); |
746 os << Brief(this); | 792 os << Brief(this); |
747 } | 793 } |
748 | 794 |
(...skipping 591 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... | |
1340 HeapNumber::cast(this)->HeapNumberPrint(os); | 1386 HeapNumber::cast(this)->HeapNumberPrint(os); |
1341 os << ">"; | 1387 os << ">"; |
1342 break; | 1388 break; |
1343 } | 1389 } |
1344 case MUTABLE_HEAP_NUMBER_TYPE: { | 1390 case MUTABLE_HEAP_NUMBER_TYPE: { |
1345 os << "<MutableNumber: "; | 1391 os << "<MutableNumber: "; |
1346 HeapNumber::cast(this)->HeapNumberPrint(os); | 1392 HeapNumber::cast(this)->HeapNumberPrint(os); |
1347 os << '>'; | 1393 os << '>'; |
1348 break; | 1394 break; |
1349 } | 1395 } |
1350 case FLOAT32X4_TYPE: { | 1396 case FLOAT32X4_TYPE: |
1351 os << "<Float32x4: "; | 1397 os << "<Float32x4>"; |
1352 Float32x4::cast(this)->Float32x4Print(os); | |
1353 os << ">"; | |
1354 break; | 1398 break; |
1355 } | 1399 case INT32X4_TYPE: |
1400 os << "<Int32x4>"; | |
1401 break; | |
1402 case BOOL32X4_TYPE: | |
1403 os << "<Bool32x4>"; | |
1404 break; | |
1405 case INT16X8_TYPE: | |
1406 os << "<Int16x8>"; | |
1407 break; | |
1408 case BOOL16X8_TYPE: | |
1409 os << "<Bool16x8>"; | |
1410 break; | |
1411 case INT8X16_TYPE: | |
1412 os << "<Int8x16>"; | |
1413 break; | |
1414 case BOOL8X16_TYPE: | |
1415 os << "<Bool8x16>"; | |
1416 break; | |
1356 case JS_PROXY_TYPE: | 1417 case JS_PROXY_TYPE: |
1357 os << "<JSProxy>"; | 1418 os << "<JSProxy>"; |
1358 break; | 1419 break; |
1359 case JS_FUNCTION_PROXY_TYPE: | 1420 case JS_FUNCTION_PROXY_TYPE: |
1360 os << "<JSFunctionProxy>"; | 1421 os << "<JSFunctionProxy>"; |
1361 break; | 1422 break; |
1362 case FOREIGN_TYPE: | 1423 case FOREIGN_TYPE: |
1363 os << "<Foreign>"; | 1424 os << "<Foreign>"; |
1364 break; | 1425 break; |
1365 case CELL_TYPE: { | 1426 case CELL_TYPE: { |
(...skipping 124 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... | |
1490 case WEAK_CELL_TYPE: | 1551 case WEAK_CELL_TYPE: |
1491 WeakCell::BodyDescriptor::IterateBody(this, v); | 1552 WeakCell::BodyDescriptor::IterateBody(this, v); |
1492 break; | 1553 break; |
1493 case SYMBOL_TYPE: | 1554 case SYMBOL_TYPE: |
1494 Symbol::BodyDescriptor::IterateBody(this, v); | 1555 Symbol::BodyDescriptor::IterateBody(this, v); |
1495 break; | 1556 break; |
1496 | 1557 |
1497 case HEAP_NUMBER_TYPE: | 1558 case HEAP_NUMBER_TYPE: |
1498 case MUTABLE_HEAP_NUMBER_TYPE: | 1559 case MUTABLE_HEAP_NUMBER_TYPE: |
1499 case FLOAT32X4_TYPE: | 1560 case FLOAT32X4_TYPE: |
1561 case INT32X4_TYPE: | |
1562 case BOOL32X4_TYPE: | |
1563 case INT16X8_TYPE: | |
1564 case BOOL16X8_TYPE: | |
1565 case INT8X16_TYPE: | |
1566 case BOOL8X16_TYPE: | |
1500 case FILLER_TYPE: | 1567 case FILLER_TYPE: |
1501 case BYTE_ARRAY_TYPE: | 1568 case BYTE_ARRAY_TYPE: |
1502 case BYTECODE_ARRAY_TYPE: | 1569 case BYTECODE_ARRAY_TYPE: |
1503 case FREE_SPACE_TYPE: | 1570 case FREE_SPACE_TYPE: |
1504 break; | 1571 break; |
1505 | 1572 |
1506 #define TYPED_ARRAY_CASE(Type, type, TYPE, ctype, size) \ | 1573 #define TYPED_ARRAY_CASE(Type, type, TYPE, ctype, size) \ |
1507 case FIXED_##TYPE##_ARRAY_TYPE: \ | 1574 case FIXED_##TYPE##_ARRAY_TYPE: \ |
1508 reinterpret_cast<FixedTypedArrayBase*>(this) \ | 1575 reinterpret_cast<FixedTypedArrayBase*>(this) \ |
1509 ->FixedTypedArrayBaseIterateBody(v); \ | 1576 ->FixedTypedArrayBaseIterateBody(v); \ |
(...skipping 28 matching lines...) Expand all Loading... | |
1538 bool HeapNumber::HeapNumberBooleanValue() { | 1605 bool HeapNumber::HeapNumberBooleanValue() { |
1539 return DoubleToBoolean(value()); | 1606 return DoubleToBoolean(value()); |
1540 } | 1607 } |
1541 | 1608 |
1542 | 1609 |
1543 void HeapNumber::HeapNumberPrint(std::ostream& os) { // NOLINT | 1610 void HeapNumber::HeapNumberPrint(std::ostream& os) { // NOLINT |
1544 os << value(); | 1611 os << value(); |
1545 } | 1612 } |
1546 | 1613 |
1547 | 1614 |
1548 void Float32x4::Float32x4Print(std::ostream& os) { // NOLINT | 1615 #define FIELD_ADDR_CONST(p, offset) \ |
1549 char arr[100]; | 1616 (reinterpret_cast<const byte*>(p) + offset - kHeapObjectTag) |
1550 Vector<char> buffer(arr, arraysize(arr)); | 1617 |
1551 os << std::string(DoubleToCString(get_lane(0), buffer)) << ", " | 1618 #define READ_INT32_FIELD(p, offset) \ |
1552 << std::string(DoubleToCString(get_lane(1), buffer)) << ", " | 1619 (*reinterpret_cast<const int32_t*>(FIELD_ADDR_CONST(p, offset))) |
1553 << std::string(DoubleToCString(get_lane(2), buffer)) << ", " | 1620 |
1554 << std::string(DoubleToCString(get_lane(3), buffer)); | 1621 #define READ_INT64_FIELD(p, offset) \ |
1622 (*reinterpret_cast<const int64_t*>(FIELD_ADDR_CONST(p, offset))) | |
1623 | |
1624 | |
1625 bool Simd128Value::BitwiseEquals(const Simd128Value* other) const { | |
1626 return READ_INT64_FIELD(this, kValueOffset) == | |
1627 READ_INT64_FIELD(other, kValueOffset) && | |
1628 READ_INT64_FIELD(this, kValueOffset + kInt64Size) == | |
1629 READ_INT64_FIELD(other, kValueOffset + kInt64Size); | |
1555 } | 1630 } |
1556 | 1631 |
1557 | 1632 |
1633 uint32_t Simd128Value::Hash() const { | |
1634 uint32_t seed = v8::internal::kZeroHashSeed; | |
1635 uint32_t hash; | |
1636 hash = ComputeIntegerHash(READ_INT32_FIELD(this, kValueOffset), seed); | |
1637 hash = ComputeIntegerHash( | |
1638 READ_INT32_FIELD(this, kValueOffset + 1 * kInt32Size), hash * 31); | |
1639 hash = ComputeIntegerHash( | |
1640 READ_INT32_FIELD(this, kValueOffset + 2 * kInt32Size), hash * 31); | |
1641 hash = ComputeIntegerHash( | |
1642 READ_INT32_FIELD(this, kValueOffset + 3 * kInt32Size), hash * 31); | |
1643 return hash; | |
1644 } | |
1645 | |
1646 | |
1647 bool Float32x4::SameValue(const Float32x4* other) const { | |
1648 for (int i = 0; i < 4; i++) { | |
1649 float x = this->get_lane(i); | |
1650 float y = other->get_lane(i); | |
1651 // Implements the ES5 SameValue operation for floating point types. | |
1652 // http://www.ecma-international.org/ecma-262/6.0/#sec-samevalue | |
1653 if (x != y && !(std::isnan(x) && std::isnan(y))) return false; | |
1654 if (std::signbit(x) != std::signbit(y)) return false; | |
1655 } | |
1656 return true; | |
1657 } | |
1658 | |
1659 | |
1660 bool Float32x4::SameValueZero(const Float32x4* other) const { | |
1661 for (int i = 0; i < 4; i++) { | |
1662 float x = this->get_lane(i); | |
1663 float y = other->get_lane(i); | |
1664 // Implements the ES6 SameValueZero operation for floating point types. | |
1665 // http://www.ecma-international.org/ecma-262/6.0/#sec-samevaluezero | |
1666 if (x != y && !(std::isnan(x) && std::isnan(y))) return false; | |
1667 // SameValueZero doesn't distinguish between 0 and -0. | |
1668 } | |
1669 return true; | |
1670 } | |
1671 | |
1672 | |
1558 String* JSReceiver::class_name() { | 1673 String* JSReceiver::class_name() { |
1559 if (IsJSFunction() || IsJSFunctionProxy()) { | 1674 if (IsJSFunction() || IsJSFunctionProxy()) { |
1560 return GetHeap()->Function_string(); | 1675 return GetHeap()->Function_string(); |
1561 } | 1676 } |
1562 Object* maybe_constructor = map()->GetConstructor(); | 1677 Object* maybe_constructor = map()->GetConstructor(); |
1563 if (maybe_constructor->IsJSFunction()) { | 1678 if (maybe_constructor->IsJSFunction()) { |
1564 JSFunction* constructor = JSFunction::cast(maybe_constructor); | 1679 JSFunction* constructor = JSFunction::cast(maybe_constructor); |
1565 return String::cast(constructor->shared()->instance_class_name()); | 1680 return String::cast(constructor->shared()->instance_class_name()); |
1566 } | 1681 } |
1567 // If the constructor is not present, return "Object". | 1682 // If the constructor is not present, return "Object". |
(...skipping 14192 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... | |
15760 if (cell->value() != *new_value) { | 15875 if (cell->value() != *new_value) { |
15761 cell->set_value(*new_value); | 15876 cell->set_value(*new_value); |
15762 Isolate* isolate = cell->GetIsolate(); | 15877 Isolate* isolate = cell->GetIsolate(); |
15763 cell->dependent_code()->DeoptimizeDependentCodeGroup( | 15878 cell->dependent_code()->DeoptimizeDependentCodeGroup( |
15764 isolate, DependentCode::kPropertyCellChangedGroup); | 15879 isolate, DependentCode::kPropertyCellChangedGroup); |
15765 } | 15880 } |
15766 } | 15881 } |
15767 | 15882 |
15768 } // namespace internal | 15883 } // namespace internal |
15769 } // namespace v8 | 15884 } // namespace v8 |
OLD | NEW |