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 12097 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
12108 Handle<JSObject> real_receiver = object; | 12108 Handle<JSObject> real_receiver = object; |
12109 | 12109 |
12110 if (from_javascript) { | 12110 if (from_javascript) { |
12111 // Find the first object in the chain whose prototype object is not | 12111 // Find the first object in the chain whose prototype object is not |
12112 // hidden and set the new prototype on that object. | 12112 // hidden and set the new prototype on that object. |
12113 PrototypeIterator iter(isolate, real_receiver); | 12113 PrototypeIterator iter(isolate, real_receiver); |
12114 while (!iter.IsAtEnd(PrototypeIterator::END_AT_NON_HIDDEN)) { | 12114 while (!iter.IsAtEnd(PrototypeIterator::END_AT_NON_HIDDEN)) { |
12115 real_receiver = | 12115 real_receiver = |
12116 Handle<JSObject>::cast(PrototypeIterator::GetCurrent(iter)); | 12116 Handle<JSObject>::cast(PrototypeIterator::GetCurrent(iter)); |
12117 iter.Advance(); | 12117 iter.Advance(); |
| 12118 if (!real_receiver->map()->is_extensible()) { |
| 12119 Handle<Object> args[] = {object}; |
| 12120 THROW_NEW_ERROR(isolate, |
| 12121 NewTypeError("non_extensible_proto", |
| 12122 HandleVector(args, arraysize(args))), |
| 12123 Object); |
| 12124 } |
12118 } | 12125 } |
12119 } | 12126 } |
12120 | 12127 |
12121 // Set the new prototype of the object. | 12128 // Set the new prototype of the object. |
12122 Handle<Map> map(real_receiver->map()); | 12129 Handle<Map> map(real_receiver->map()); |
12123 | 12130 |
12124 // Nothing to do if prototype is already set. | 12131 // Nothing to do if prototype is already set. |
12125 if (map->prototype() == *value) return value; | 12132 if (map->prototype() == *value) return value; |
12126 | 12133 |
12127 PrototypeOptimizationMode mode = | 12134 PrototypeOptimizationMode mode = |
(...skipping 4751 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
16879 Handle<DependentCode> codes = | 16886 Handle<DependentCode> codes = |
16880 DependentCode::Insert(handle(cell->dependent_code(), info->isolate()), | 16887 DependentCode::Insert(handle(cell->dependent_code(), info->isolate()), |
16881 DependentCode::kPropertyCellChangedGroup, | 16888 DependentCode::kPropertyCellChangedGroup, |
16882 info->object_wrapper()); | 16889 info->object_wrapper()); |
16883 if (*codes != cell->dependent_code()) cell->set_dependent_code(*codes); | 16890 if (*codes != cell->dependent_code()) cell->set_dependent_code(*codes); |
16884 info->dependencies(DependentCode::kPropertyCellChangedGroup)->Add( | 16891 info->dependencies(DependentCode::kPropertyCellChangedGroup)->Add( |
16885 cell, info->zone()); | 16892 cell, info->zone()); |
16886 } | 16893 } |
16887 | 16894 |
16888 } } // namespace v8::internal | 16895 } } // namespace v8::internal |
OLD | NEW |