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 84 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
95 if (IsSmi()) return Smi::cast(this)->value() != 0; | 95 if (IsSmi()) return Smi::cast(this)->value() != 0; |
96 if (IsUndefined() || IsNull()) return false; | 96 if (IsUndefined() || IsNull()) return false; |
97 if (IsUndetectableObject()) return false; // Undetectable object is false. | 97 if (IsUndetectableObject()) return false; // Undetectable object is false. |
98 if (IsString()) return String::cast(this)->length() != 0; | 98 if (IsString()) return String::cast(this)->length() != 0; |
99 if (IsHeapNumber()) return HeapNumber::cast(this)->HeapNumberBooleanValue(); | 99 if (IsHeapNumber()) return HeapNumber::cast(this)->HeapNumberBooleanValue(); |
100 if (IsSimd128Value()) return true; // Simd value types evaluate to true. | 100 if (IsSimd128Value()) return true; // Simd value types evaluate to true. |
101 return true; | 101 return true; |
102 } | 102 } |
103 | 103 |
104 | 104 |
| 105 bool Object::StrictEquals(Object* that) { |
| 106 if (this->IsNumber()) { |
| 107 if (!that->IsNumber()) return false; |
| 108 double const x = this->Number(); |
| 109 double const y = that->Number(); |
| 110 // Must check explicitly for NaN:s on Windows, but -0 works fine. |
| 111 return x == y && !std::isnan(x) && !std::isnan(y); |
| 112 } else if (this->IsString()) { |
| 113 if (!that->IsString()) return false; |
| 114 return String::cast(this)->Equals(String::cast(that)); |
| 115 } else if (this->IsSimd128Value()) { |
| 116 if (!that->IsSimd128Value()) return false; |
| 117 return Simd128Value::cast(this)->Equals(Simd128Value::cast(that)); |
| 118 } |
| 119 return this == that; |
| 120 } |
| 121 |
| 122 |
105 bool Object::IsCallable() const { | 123 bool Object::IsCallable() const { |
106 const Object* fun = this; | 124 const Object* fun = this; |
107 while (fun->IsJSFunctionProxy()) { | 125 while (fun->IsJSFunctionProxy()) { |
108 fun = JSFunctionProxy::cast(fun)->call_trap(); | 126 fun = JSFunctionProxy::cast(fun)->call_trap(); |
109 } | 127 } |
110 return fun->IsJSFunction() || | 128 return fun->IsJSFunction() || |
111 (fun->IsHeapObject() && | 129 (fun->IsHeapObject() && |
112 HeapObject::cast(fun)->map()->has_instance_call_handler()); | 130 HeapObject::cast(fun)->map()->has_instance_call_handler()); |
113 } | 131 } |
114 | 132 |
(...skipping 15584 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
15699 if (cell->value() != *new_value) { | 15717 if (cell->value() != *new_value) { |
15700 cell->set_value(*new_value); | 15718 cell->set_value(*new_value); |
15701 Isolate* isolate = cell->GetIsolate(); | 15719 Isolate* isolate = cell->GetIsolate(); |
15702 cell->dependent_code()->DeoptimizeDependentCodeGroup( | 15720 cell->dependent_code()->DeoptimizeDependentCodeGroup( |
15703 isolate, DependentCode::kPropertyCellChangedGroup); | 15721 isolate, DependentCode::kPropertyCellChangedGroup); |
15704 } | 15722 } |
15705 } | 15723 } |
15706 | 15724 |
15707 } // namespace internal | 15725 } // namespace internal |
15708 } // namespace v8 | 15726 } // namespace v8 |
OLD | NEW |