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 10649 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
10660 JSObject::OptimizeAsPrototype(Handle<JSObject>::cast(value), | 10660 JSObject::OptimizeAsPrototype(Handle<JSObject>::cast(value), |
10661 FAST_PROTOTYPE); | 10661 FAST_PROTOTYPE); |
10662 } | 10662 } |
10663 } | 10663 } |
10664 isolate->heap()->ClearInstanceofCache(); | 10664 isolate->heap()->ClearInstanceofCache(); |
10665 } | 10665 } |
10666 | 10666 |
10667 | 10667 |
10668 void JSFunction::SetPrototype(Handle<JSFunction> function, | 10668 void JSFunction::SetPrototype(Handle<JSFunction> function, |
10669 Handle<Object> value) { | 10669 Handle<Object> value) { |
10670 DCHECK(function->IsConstructor()); | 10670 DCHECK(function->should_have_prototype()); |
10671 Handle<Object> construct_prototype = value; | 10671 Handle<Object> construct_prototype = value; |
10672 | 10672 |
10673 // If the value is not a JSReceiver, store the value in the map's | 10673 // If the value is not a JSReceiver, store the value in the map's |
10674 // constructor field so it can be accessed. Also, set the prototype | 10674 // constructor field so it can be accessed. Also, set the prototype |
10675 // used for constructing objects to the original object prototype. | 10675 // used for constructing objects to the original object prototype. |
10676 // See ECMA-262 13.2.2. | 10676 // See ECMA-262 13.2.2. |
10677 if (!value->IsJSReceiver()) { | 10677 if (!value->IsJSReceiver()) { |
10678 // Copy the map so this does not affect unrelated functions. | 10678 // Copy the map so this does not affect unrelated functions. |
10679 // Remove map transitions because they point to maps with a | 10679 // Remove map transitions because they point to maps with a |
10680 // different prototype. | 10680 // different prototype. |
(...skipping 6016 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
16697 if (cell->value() != *new_value) { | 16697 if (cell->value() != *new_value) { |
16698 cell->set_value(*new_value); | 16698 cell->set_value(*new_value); |
16699 Isolate* isolate = cell->GetIsolate(); | 16699 Isolate* isolate = cell->GetIsolate(); |
16700 cell->dependent_code()->DeoptimizeDependentCodeGroup( | 16700 cell->dependent_code()->DeoptimizeDependentCodeGroup( |
16701 isolate, DependentCode::kPropertyCellChangedGroup); | 16701 isolate, DependentCode::kPropertyCellChangedGroup); |
16702 } | 16702 } |
16703 } | 16703 } |
16704 | 16704 |
16705 } // namespace internal | 16705 } // namespace internal |
16706 } // namespace v8 | 16706 } // namespace v8 |
OLD | NEW |