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 <iomanip> | 5 #include <iomanip> |
6 #include <sstream> | 6 #include <sstream> |
7 | 7 |
8 #include "src/v8.h" | 8 #include "src/v8.h" |
9 | 9 |
10 #include "src/accessors.h" | 10 #include "src/accessors.h" |
(...skipping 12384 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
12395 | 12395 |
12396 // Before we can set the prototype we need to be sure | 12396 // Before we can set the prototype we need to be sure |
12397 // prototype cycles are prevented. | 12397 // prototype cycles are prevented. |
12398 // It is sufficient to validate that the receiver is not in the new prototype | 12398 // It is sufficient to validate that the receiver is not in the new prototype |
12399 // chain. | 12399 // chain. |
12400 for (PrototypeIterator iter(isolate, *value, | 12400 for (PrototypeIterator iter(isolate, *value, |
12401 PrototypeIterator::START_AT_RECEIVER); | 12401 PrototypeIterator::START_AT_RECEIVER); |
12402 !iter.IsAtEnd(); iter.Advance()) { | 12402 !iter.IsAtEnd(); iter.Advance()) { |
12403 if (JSReceiver::cast(iter.GetCurrent()) == *object) { | 12403 if (JSReceiver::cast(iter.GetCurrent()) == *object) { |
12404 // Cycle detected. | 12404 // Cycle detected. |
12405 THROW_NEW_ERROR(isolate, NewError(MessageTemplate::kCyclicProto), Object); | 12405 THROW_NEW_ERROR(isolate, NewTypeError(MessageTemplate::kCyclicProto), |
| 12406 Object); |
12406 } | 12407 } |
12407 } | 12408 } |
12408 | 12409 |
12409 bool dictionary_elements_in_chain = | 12410 bool dictionary_elements_in_chain = |
12410 object->map()->DictionaryElementsInPrototypeChainOnly(); | 12411 object->map()->DictionaryElementsInPrototypeChainOnly(); |
12411 Handle<JSObject> real_receiver = object; | 12412 Handle<JSObject> real_receiver = object; |
12412 | 12413 |
12413 if (from_javascript) { | 12414 if (from_javascript) { |
12414 // Find the first object in the chain whose prototype object is not | 12415 // Find the first object in the chain whose prototype object is not |
12415 // hidden and set the new prototype on that object. | 12416 // hidden and set the new prototype on that object. |
(...skipping 4284 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
16700 Handle<Object> new_value) { | 16701 Handle<Object> new_value) { |
16701 if (cell->value() != *new_value) { | 16702 if (cell->value() != *new_value) { |
16702 cell->set_value(*new_value); | 16703 cell->set_value(*new_value); |
16703 Isolate* isolate = cell->GetIsolate(); | 16704 Isolate* isolate = cell->GetIsolate(); |
16704 cell->dependent_code()->DeoptimizeDependentCodeGroup( | 16705 cell->dependent_code()->DeoptimizeDependentCodeGroup( |
16705 isolate, DependentCode::kPropertyCellChangedGroup); | 16706 isolate, DependentCode::kPropertyCellChangedGroup); |
16706 } | 16707 } |
16707 } | 16708 } |
16708 } // namespace internal | 16709 } // namespace internal |
16709 } // namespace v8 | 16710 } // namespace v8 |
OLD | NEW |