| 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 <sstream> | 5 #include <sstream> |
| 6 | 6 |
| 7 #include "src/v8.h" | 7 #include "src/v8.h" |
| 8 | 8 |
| 9 #include "src/accessors.h" | 9 #include "src/accessors.h" |
| 10 #include "src/allocation-site-scopes.h" | 10 #include "src/allocation-site-scopes.h" |
| (...skipping 780 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 791 if (heap_object->IsBoolean()) { | 791 if (heap_object->IsBoolean()) { |
| 792 return context->boolean_function()->initial_map(); | 792 return context->boolean_function()->initial_map(); |
| 793 } | 793 } |
| 794 return isolate->heap()->null_value()->map(); | 794 return isolate->heap()->null_value()->map(); |
| 795 } | 795 } |
| 796 | 796 |
| 797 | 797 |
| 798 Object* Object::GetHash() { | 798 Object* Object::GetHash() { |
| 799 // The object is either a number, a name, an odd-ball, | 799 // The object is either a number, a name, an odd-ball, |
| 800 // a real JS object, or a Harmony proxy. | 800 // a real JS object, or a Harmony proxy. |
| 801 if (IsNumber()) { | 801 if (IsSmi()) { |
| 802 uint32_t hash = std::isnan(Number()) | 802 int num = Smi::cast(this)->value(); |
| 803 ? Smi::kMaxValue | 803 uint32_t hash = ComputeLongHash(double_to_uint64(static_cast<double>(num))); |
| 804 : ComputeLongHash(double_to_uint64(Number())); | 804 return Smi::FromInt(hash & Smi::kMaxValue); |
| 805 } |
| 806 if (IsHeapNumber()) { |
| 807 double num = HeapNumber::cast(this)->value(); |
| 808 if (std::isnan(num)) return Smi::FromInt(Smi::kMaxValue); |
| 809 if (i::IsMinusZero(num)) num = 0; |
| 810 uint32_t hash = ComputeLongHash(double_to_uint64(num)); |
| 805 return Smi::FromInt(hash & Smi::kMaxValue); | 811 return Smi::FromInt(hash & Smi::kMaxValue); |
| 806 } | 812 } |
| 807 if (IsName()) { | 813 if (IsName()) { |
| 808 uint32_t hash = Name::cast(this)->Hash(); | 814 uint32_t hash = Name::cast(this)->Hash(); |
| 809 return Smi::FromInt(hash); | 815 return Smi::FromInt(hash); |
| 810 } | 816 } |
| 811 if (IsOddball()) { | 817 if (IsOddball()) { |
| 812 uint32_t hash = Oddball::cast(this)->to_string()->Hash(); | 818 uint32_t hash = Oddball::cast(this)->to_string()->Hash(); |
| 813 return Smi::FromInt(hash); | 819 return Smi::FromInt(hash); |
| 814 } | 820 } |
| (...skipping 16510 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 17325 CompilationInfo* info) { | 17331 CompilationInfo* info) { |
| 17326 Handle<DependentCode> codes = DependentCode::InsertCompilationInfo( | 17332 Handle<DependentCode> codes = DependentCode::InsertCompilationInfo( |
| 17327 handle(cell->dependent_code(), info->isolate()), | 17333 handle(cell->dependent_code(), info->isolate()), |
| 17328 DependentCode::kPropertyCellChangedGroup, info->object_wrapper()); | 17334 DependentCode::kPropertyCellChangedGroup, info->object_wrapper()); |
| 17329 if (*codes != cell->dependent_code()) cell->set_dependent_code(*codes); | 17335 if (*codes != cell->dependent_code()) cell->set_dependent_code(*codes); |
| 17330 info->dependencies(DependentCode::kPropertyCellChangedGroup)->Add( | 17336 info->dependencies(DependentCode::kPropertyCellChangedGroup)->Add( |
| 17331 cell, info->zone()); | 17337 cell, info->zone()); |
| 17332 } | 17338 } |
| 17333 | 17339 |
| 17334 } } // namespace v8::internal | 17340 } } // namespace v8::internal |
| OLD | NEW |