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 "src/objects.h" | 5 #include "src/objects.h" |
6 | 6 |
7 #include <iomanip> | 7 #include <iomanip> |
8 #include <sstream> | 8 #include <sstream> |
9 | 9 |
10 #include "src/accessors.h" | 10 #include "src/accessors.h" |
(...skipping 15135 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
15146 } | 15146 } |
15147 | 15147 |
15148 | 15148 |
15149 void JSMap::Clear(Handle<JSMap> map) { | 15149 void JSMap::Clear(Handle<JSMap> map) { |
15150 Handle<OrderedHashMap> table(OrderedHashMap::cast(map->table())); | 15150 Handle<OrderedHashMap> table(OrderedHashMap::cast(map->table())); |
15151 table = OrderedHashMap::Clear(table); | 15151 table = OrderedHashMap::Clear(table); |
15152 map->set_table(*table); | 15152 map->set_table(*table); |
15153 } | 15153 } |
15154 | 15154 |
15155 | 15155 |
| 15156 void JSWeakCollection::Initialize(Handle<JSWeakCollection> weak_collection, |
| 15157 Isolate* isolate) { |
| 15158 DCHECK_EQ(0, weak_collection->map()->GetInObjectProperties()); |
| 15159 Handle<ObjectHashTable> table = ObjectHashTable::New(isolate, 0); |
| 15160 weak_collection->set_table(*table); |
| 15161 } |
| 15162 |
| 15163 |
| 15164 void JSWeakCollection::Set(Handle<JSWeakCollection> weak_collection, |
| 15165 Handle<Object> key, Handle<Object> value, |
| 15166 int32_t hash) { |
| 15167 DCHECK(key->IsJSReceiver() || key->IsSymbol()); |
| 15168 Handle<ObjectHashTable> table( |
| 15169 ObjectHashTable::cast(weak_collection->table())); |
| 15170 DCHECK(table->IsKey(*key)); |
| 15171 Handle<ObjectHashTable> new_table = |
| 15172 ObjectHashTable::Put(table, key, value, hash); |
| 15173 weak_collection->set_table(*new_table); |
| 15174 if (*table != *new_table) { |
| 15175 // Zap the old table since we didn't record slots for its elements. |
| 15176 table->FillWithHoles(0, table->length()); |
| 15177 } |
| 15178 } |
| 15179 |
| 15180 |
| 15181 bool JSWeakCollection::Delete(Handle<JSWeakCollection> weak_collection, |
| 15182 Handle<Object> key, int32_t hash) { |
| 15183 DCHECK(key->IsJSReceiver() || key->IsSymbol()); |
| 15184 Handle<ObjectHashTable> table( |
| 15185 ObjectHashTable::cast(weak_collection->table())); |
| 15186 DCHECK(table->IsKey(*key)); |
| 15187 bool was_present = false; |
| 15188 Handle<ObjectHashTable> new_table = |
| 15189 ObjectHashTable::Remove(table, key, &was_present, hash); |
| 15190 weak_collection->set_table(*new_table); |
| 15191 if (*table != *new_table) { |
| 15192 // Zap the old table since we didn't record slots for its elements. |
| 15193 table->FillWithHoles(0, table->length()); |
| 15194 } |
| 15195 return was_present; |
| 15196 } |
| 15197 |
| 15198 |
15156 // Check if there is a break point at this code position. | 15199 // Check if there is a break point at this code position. |
15157 bool DebugInfo::HasBreakPoint(int code_position) { | 15200 bool DebugInfo::HasBreakPoint(int code_position) { |
15158 // Get the break point info object for this code position. | 15201 // Get the break point info object for this code position. |
15159 Object* break_point_info = GetBreakPointInfo(code_position); | 15202 Object* break_point_info = GetBreakPointInfo(code_position); |
15160 | 15203 |
15161 // If there is no break point info object or no break points in the break | 15204 // If there is no break point info object or no break points in the break |
15162 // point info object there is no break point at this code position. | 15205 // point info object there is no break point at this code position. |
15163 if (break_point_info->IsUndefined()) return false; | 15206 if (break_point_info->IsUndefined()) return false; |
15164 return BreakPointInfo::cast(break_point_info)->GetBreakPointCount() > 0; | 15207 return BreakPointInfo::cast(break_point_info)->GetBreakPointCount() > 0; |
15165 } | 15208 } |
(...skipping 562 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
15728 if (cell->value() != *new_value) { | 15771 if (cell->value() != *new_value) { |
15729 cell->set_value(*new_value); | 15772 cell->set_value(*new_value); |
15730 Isolate* isolate = cell->GetIsolate(); | 15773 Isolate* isolate = cell->GetIsolate(); |
15731 cell->dependent_code()->DeoptimizeDependentCodeGroup( | 15774 cell->dependent_code()->DeoptimizeDependentCodeGroup( |
15732 isolate, DependentCode::kPropertyCellChangedGroup); | 15775 isolate, DependentCode::kPropertyCellChangedGroup); |
15733 } | 15776 } |
15734 } | 15777 } |
15735 | 15778 |
15736 } // namespace internal | 15779 } // namespace internal |
15737 } // namespace v8 | 15780 } // namespace v8 |
OLD | NEW |