| 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 <cmath> | 7 #include <cmath> |
| 8 #include <iomanip> | 8 #include <iomanip> |
| 9 #include <sstream> | 9 #include <sstream> |
| 10 | 10 |
| (...skipping 10701 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 10712 JSObject::OptimizeAsPrototype(Handle<JSObject>::cast(value), | 10712 JSObject::OptimizeAsPrototype(Handle<JSObject>::cast(value), |
| 10713 FAST_PROTOTYPE); | 10713 FAST_PROTOTYPE); |
| 10714 } | 10714 } |
| 10715 } | 10715 } |
| 10716 isolate->heap()->ClearInstanceofCache(); | 10716 isolate->heap()->ClearInstanceofCache(); |
| 10717 } | 10717 } |
| 10718 | 10718 |
| 10719 | 10719 |
| 10720 void JSFunction::SetPrototype(Handle<JSFunction> function, | 10720 void JSFunction::SetPrototype(Handle<JSFunction> function, |
| 10721 Handle<Object> value) { | 10721 Handle<Object> value) { |
| 10722 DCHECK(function->should_have_prototype()); | 10722 DCHECK(function->IsConstructor()); |
| 10723 Handle<Object> construct_prototype = value; | 10723 Handle<Object> construct_prototype = value; |
| 10724 | 10724 |
| 10725 // If the value is not a JSReceiver, store the value in the map's | 10725 // If the value is not a JSReceiver, store the value in the map's |
| 10726 // constructor field so it can be accessed. Also, set the prototype | 10726 // constructor field so it can be accessed. Also, set the prototype |
| 10727 // used for constructing objects to the original object prototype. | 10727 // used for constructing objects to the original object prototype. |
| 10728 // See ECMA-262 13.2.2. | 10728 // See ECMA-262 13.2.2. |
| 10729 if (!value->IsJSReceiver()) { | 10729 if (!value->IsJSReceiver()) { |
| 10730 // Copy the map so this does not affect unrelated functions. | 10730 // Copy the map so this does not affect unrelated functions. |
| 10731 // Remove map transitions because they point to maps with a | 10731 // Remove map transitions because they point to maps with a |
| 10732 // different prototype. | 10732 // different prototype. |
| (...skipping 6036 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 16769 if (cell->value() != *new_value) { | 16769 if (cell->value() != *new_value) { |
| 16770 cell->set_value(*new_value); | 16770 cell->set_value(*new_value); |
| 16771 Isolate* isolate = cell->GetIsolate(); | 16771 Isolate* isolate = cell->GetIsolate(); |
| 16772 cell->dependent_code()->DeoptimizeDependentCodeGroup( | 16772 cell->dependent_code()->DeoptimizeDependentCodeGroup( |
| 16773 isolate, DependentCode::kPropertyCellChangedGroup); | 16773 isolate, DependentCode::kPropertyCellChangedGroup); |
| 16774 } | 16774 } |
| 16775 } | 16775 } |
| 16776 | 16776 |
| 16777 } // namespace internal | 16777 } // namespace internal |
| 16778 } // namespace v8 | 16778 } // namespace v8 |
| OLD | NEW |