| 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 12122 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 12133 | 12133 |
| 12134 | 12134 |
| 12135 void String::PrintOn(FILE* file) { | 12135 void String::PrintOn(FILE* file) { |
| 12136 int length = this->length(); | 12136 int length = this->length(); |
| 12137 for (int i = 0; i < length; i++) { | 12137 for (int i = 0; i < length; i++) { |
| 12138 PrintF(file, "%c", Get(i)); | 12138 PrintF(file, "%c", Get(i)); |
| 12139 } | 12139 } |
| 12140 } | 12140 } |
| 12141 | 12141 |
| 12142 | 12142 |
| 12143 inline static uint32_t ObjectAddressForHashing(Object* object) { | |
| 12144 uint32_t value = static_cast<uint32_t>(reinterpret_cast<uintptr_t>(object)); | |
| 12145 return value & MemoryChunk::kAlignmentMask; | |
| 12146 } | |
| 12147 | |
| 12148 | |
| 12149 int Map::Hash() { | 12143 int Map::Hash() { |
| 12150 // For performance reasons we only hash the 3 most variable fields of a map: | 12144 // For performance reasons we only hash the 3 most variable fields of a map: |
| 12151 // constructor, prototype and bit_field2. For predictability reasons we | 12145 // constructor, prototype and bit_field2. For predictability reasons we |
| 12152 // use objects' offsets in respective pages for hashing instead of raw | 12146 // use objects' offsets in respective pages for hashing instead of raw |
| 12153 // addresses. | 12147 // addresses. |
| 12154 | 12148 |
| 12155 // Shift away the tag. | 12149 // Shift away the tag. |
| 12156 int hash = ObjectAddressForHashing(GetConstructor()) >> 2; | 12150 int hash = ObjectAddressForHashing(GetConstructor()) >> 2; |
| 12157 | 12151 |
| 12158 // XOR-ing the prototype and constructor directly yields too many zero bits | 12152 // XOR-ing the prototype and constructor directly yields too many zero bits |
| (...skipping 7449 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 19608 if (cell->value() != *new_value) { | 19602 if (cell->value() != *new_value) { |
| 19609 cell->set_value(*new_value); | 19603 cell->set_value(*new_value); |
| 19610 Isolate* isolate = cell->GetIsolate(); | 19604 Isolate* isolate = cell->GetIsolate(); |
| 19611 cell->dependent_code()->DeoptimizeDependentCodeGroup( | 19605 cell->dependent_code()->DeoptimizeDependentCodeGroup( |
| 19612 isolate, DependentCode::kPropertyCellChangedGroup); | 19606 isolate, DependentCode::kPropertyCellChangedGroup); |
| 19613 } | 19607 } |
| 19614 } | 19608 } |
| 19615 | 19609 |
| 19616 } // namespace internal | 19610 } // namespace internal |
| 19617 } // namespace v8 | 19611 } // namespace v8 |
| OLD | NEW |