Chromium Code Reviews
chromiumcodereview-hr@appspot.gserviceaccount.com (chromiumcodereview-hr) | Please choose your nickname with Settings | Help | Chromium Project | Gerrit Changes | Sign out
(59)

Side by Side Diff: src/objects.cc

Issue 897593002: Compute the same hash for all NaN values. (Closed) Base URL: https://chromium.googlesource.com/v8/v8.git@master
Patch Set: Created 5 years, 10 months ago
Use n/p to move between diff chunks; N/P to move between comments. Draft comments are only viewable by you.
Jump to:
View unified diff | Download patch
« no previous file with comments | « no previous file | test/mjsunit/regress/regress-3859.js » ('j') | no next file with comments »
Toggle Intra-line Diffs ('i') | Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
OLDNEW
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 699 matching lines...) Expand 10 before | Expand all | Expand 10 after
710 return context->boolean_function()->initial_map(); 710 return context->boolean_function()->initial_map();
711 } 711 }
712 return isolate->heap()->null_value()->map(); 712 return isolate->heap()->null_value()->map();
713 } 713 }
714 714
715 715
716 Object* Object::GetHash() { 716 Object* Object::GetHash() {
717 // The object is either a number, a name, an odd-ball, 717 // The object is either a number, a name, an odd-ball,
718 // a real JS object, or a Harmony proxy. 718 // a real JS object, or a Harmony proxy.
719 if (IsNumber()) { 719 if (IsNumber()) {
720 uint32_t hash = ComputeLongHash(double_to_uint64(Number())); 720 uint32_t hash = std::isnan(Number())
721 ? Smi::kMaxValue
722 : ComputeLongHash(double_to_uint64(Number()));
721 return Smi::FromInt(hash & Smi::kMaxValue); 723 return Smi::FromInt(hash & Smi::kMaxValue);
722 } 724 }
723 if (IsName()) { 725 if (IsName()) {
724 uint32_t hash = Name::cast(this)->Hash(); 726 uint32_t hash = Name::cast(this)->Hash();
725 return Smi::FromInt(hash); 727 return Smi::FromInt(hash);
726 } 728 }
727 if (IsOddball()) { 729 if (IsOddball()) {
728 uint32_t hash = Oddball::cast(this)->to_string()->Hash(); 730 uint32_t hash = Oddball::cast(this)->to_string()->Hash();
729 return Smi::FromInt(hash); 731 return Smi::FromInt(hash);
730 } 732 }
(...skipping 16155 matching lines...) Expand 10 before | Expand all | Expand 10 after
16886 Handle<DependentCode> codes = 16888 Handle<DependentCode> codes =
16887 DependentCode::Insert(handle(cell->dependent_code(), info->isolate()), 16889 DependentCode::Insert(handle(cell->dependent_code(), info->isolate()),
16888 DependentCode::kPropertyCellChangedGroup, 16890 DependentCode::kPropertyCellChangedGroup,
16889 info->object_wrapper()); 16891 info->object_wrapper());
16890 if (*codes != cell->dependent_code()) cell->set_dependent_code(*codes); 16892 if (*codes != cell->dependent_code()) cell->set_dependent_code(*codes);
16891 info->dependencies(DependentCode::kPropertyCellChangedGroup)->Add( 16893 info->dependencies(DependentCode::kPropertyCellChangedGroup)->Add(
16892 cell, info->zone()); 16894 cell, info->zone());
16893 } 16895 }
16894 16896
16895 } } // namespace v8::internal 16897 } } // namespace v8::internal
OLDNEW
« no previous file with comments | « no previous file | test/mjsunit/regress/regress-3859.js » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698