| 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 1478 matching lines...) Expand 10 before | Expand all | Expand 10 after  Loading... | 
| 1489     // SameValue(NaN, NaN) is true. | 1489     // SameValue(NaN, NaN) is true. | 
| 1490     if (this_value != other_value) { | 1490     if (this_value != other_value) { | 
| 1491       return std::isnan(this_value) && std::isnan(other_value); | 1491       return std::isnan(this_value) && std::isnan(other_value); | 
| 1492     } | 1492     } | 
| 1493     // SameValue(0.0, -0.0) is false. | 1493     // SameValue(0.0, -0.0) is false. | 
| 1494     return (std::signbit(this_value) == std::signbit(other_value)); | 1494     return (std::signbit(this_value) == std::signbit(other_value)); | 
| 1495   } | 1495   } | 
| 1496   if (IsString() && other->IsString()) { | 1496   if (IsString() && other->IsString()) { | 
| 1497     return String::cast(this)->Equals(String::cast(other)); | 1497     return String::cast(this)->Equals(String::cast(other)); | 
| 1498   } | 1498   } | 
| 1499   if (IsSimd128Value() && other->IsSimd128Value()) { | 1499   if (IsFloat32x4() && other->IsFloat32x4()) { | 
| 1500     if (IsFloat32x4() && other->IsFloat32x4()) { | 1500     Float32x4* a = Float32x4::cast(this); | 
| 1501       Float32x4* a = Float32x4::cast(this); | 1501     Float32x4* b = Float32x4::cast(other); | 
| 1502       Float32x4* b = Float32x4::cast(other); | 1502     for (int i = 0; i < 4; i++) { | 
| 1503       for (int i = 0; i < 4; i++) { | 1503       float x = a->get_lane(i); | 
| 1504         float x = a->get_lane(i); | 1504       float y = b->get_lane(i); | 
| 1505         float y = b->get_lane(i); | 1505       // Implements the ES5 SameValue operation for floating point types. | 
| 1506         // Implements the ES5 SameValue operation for floating point types. | 1506       // http://www.ecma-international.org/ecma-262/6.0/#sec-samevalue | 
| 1507         // http://www.ecma-international.org/ecma-262/6.0/#sec-samevalue | 1507       if (x != y && !(std::isnan(x) && std::isnan(y))) return false; | 
| 1508         if (x != y && !(std::isnan(x) && std::isnan(y))) return false; | 1508       if (std::signbit(x) != std::signbit(y)) return false; | 
| 1509         if (std::signbit(x) != std::signbit(y)) return false; |  | 
| 1510       } |  | 
| 1511       return true; |  | 
| 1512     } else { |  | 
| 1513       Simd128Value* a = Simd128Value::cast(this); |  | 
| 1514       Simd128Value* b = Simd128Value::cast(other); |  | 
| 1515       return a->map()->instance_type() == b->map()->instance_type() && |  | 
| 1516              a->BitwiseEquals(b); |  | 
| 1517     } | 1509     } | 
|  | 1510     return true; | 
|  | 1511   } else if (IsSimd128Value() && other->IsSimd128Value()) { | 
|  | 1512     Simd128Value* a = Simd128Value::cast(this); | 
|  | 1513     Simd128Value* b = Simd128Value::cast(other); | 
|  | 1514     return a->map() == b->map() && a->BitwiseEquals(b); | 
| 1518   } | 1515   } | 
| 1519   return false; | 1516   return false; | 
| 1520 } | 1517 } | 
| 1521 | 1518 | 
| 1522 | 1519 | 
| 1523 bool Object::SameValueZero(Object* other) { | 1520 bool Object::SameValueZero(Object* other) { | 
| 1524   if (other == this) return true; | 1521   if (other == this) return true; | 
| 1525 | 1522 | 
| 1526   // The object is either a number, a name, an odd-ball, | 1523   // The object is either a number, a name, an odd-ball, | 
| 1527   // a real JS object, or a Harmony proxy. | 1524   // a real JS object, or a Harmony proxy. | 
| 1528   if (IsNumber() && other->IsNumber()) { | 1525   if (IsNumber() && other->IsNumber()) { | 
| 1529     double this_value = Number(); | 1526     double this_value = Number(); | 
| 1530     double other_value = other->Number(); | 1527     double other_value = other->Number(); | 
| 1531     // +0 == -0 is true | 1528     // +0 == -0 is true | 
| 1532     return this_value == other_value || | 1529     return this_value == other_value || | 
| 1533            (std::isnan(this_value) && std::isnan(other_value)); | 1530            (std::isnan(this_value) && std::isnan(other_value)); | 
| 1534   } | 1531   } | 
| 1535   if (IsString() && other->IsString()) { | 1532   if (IsString() && other->IsString()) { | 
| 1536     return String::cast(this)->Equals(String::cast(other)); | 1533     return String::cast(this)->Equals(String::cast(other)); | 
| 1537   } | 1534   } | 
| 1538   if (IsSimd128Value() && other->IsSimd128Value()) { | 1535   if (IsFloat32x4() && other->IsFloat32x4()) { | 
| 1539     if (IsFloat32x4() && other->IsFloat32x4()) { | 1536     Float32x4* a = Float32x4::cast(this); | 
| 1540       Float32x4* a = Float32x4::cast(this); | 1537     Float32x4* b = Float32x4::cast(other); | 
| 1541       Float32x4* b = Float32x4::cast(other); | 1538     for (int i = 0; i < 4; i++) { | 
| 1542       for (int i = 0; i < 4; i++) { | 1539       float x = a->get_lane(i); | 
| 1543         float x = a->get_lane(i); | 1540       float y = b->get_lane(i); | 
| 1544         float y = b->get_lane(i); | 1541       // Implements the ES6 SameValueZero operation for floating point types. | 
| 1545         // Implements the ES6 SameValueZero operation for floating point types. | 1542       // http://www.ecma-international.org/ecma-262/6.0/#sec-samevaluezero | 
| 1546         // http://www.ecma-international.org/ecma-262/6.0/#sec-samevaluezero | 1543       if (x != y && !(std::isnan(x) && std::isnan(y))) return false; | 
| 1547         if (x != y && !(std::isnan(x) && std::isnan(y))) return false; | 1544       // SameValueZero doesn't distinguish between 0 and -0. | 
| 1548         // SameValueZero doesn't distinguish between 0 and -0. |  | 
| 1549       } |  | 
| 1550       return true; |  | 
| 1551     } else { |  | 
| 1552       Simd128Value* a = Simd128Value::cast(this); |  | 
| 1553       Simd128Value* b = Simd128Value::cast(other); |  | 
| 1554       return a->map()->instance_type() == b->map()->instance_type() && |  | 
| 1555              a->BitwiseEquals(b); |  | 
| 1556     } | 1545     } | 
|  | 1546     return true; | 
|  | 1547   } else if (IsSimd128Value() && other->IsSimd128Value()) { | 
|  | 1548     Simd128Value* a = Simd128Value::cast(this); | 
|  | 1549     Simd128Value* b = Simd128Value::cast(other); | 
|  | 1550     return a->map() == b->map() && a->BitwiseEquals(b); | 
| 1557   } | 1551   } | 
| 1558   return false; | 1552   return false; | 
| 1559 } | 1553 } | 
| 1560 | 1554 | 
| 1561 | 1555 | 
| 1562 MaybeHandle<Object> Object::ArraySpeciesConstructor( | 1556 MaybeHandle<Object> Object::ArraySpeciesConstructor( | 
| 1563     Isolate* isolate, Handle<Object> original_array) { | 1557     Isolate* isolate, Handle<Object> original_array) { | 
| 1564   Handle<Context> native_context = isolate->native_context(); | 1558   Handle<Context> native_context = isolate->native_context(); | 
| 1565   if (!FLAG_harmony_species) { | 1559   if (!FLAG_harmony_species) { | 
| 1566     return Handle<Object>(native_context->array_function(), isolate); | 1560     return Handle<Object>(native_context->array_function(), isolate); | 
| (...skipping 18355 matching lines...) Expand 10 before | Expand all | Expand 10 after  Loading... | 
| 19922   if (cell->value() != *new_value) { | 19916   if (cell->value() != *new_value) { | 
| 19923     cell->set_value(*new_value); | 19917     cell->set_value(*new_value); | 
| 19924     Isolate* isolate = cell->GetIsolate(); | 19918     Isolate* isolate = cell->GetIsolate(); | 
| 19925     cell->dependent_code()->DeoptimizeDependentCodeGroup( | 19919     cell->dependent_code()->DeoptimizeDependentCodeGroup( | 
| 19926         isolate, DependentCode::kPropertyCellChangedGroup); | 19920         isolate, DependentCode::kPropertyCellChangedGroup); | 
| 19927   } | 19921   } | 
| 19928 } | 19922 } | 
| 19929 | 19923 | 
| 19930 }  // namespace internal | 19924 }  // namespace internal | 
| 19931 }  // namespace v8 | 19925 }  // namespace v8 | 
| OLD | NEW | 
|---|