OLD | NEW |
1 // Copyright 2015 the V8 project authors. All rights reserved. | 1 // Copyright 2015 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 12858 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
12869 JSObject::OptimizeAsPrototype(Handle<JSObject>::cast(value), | 12869 JSObject::OptimizeAsPrototype(Handle<JSObject>::cast(value), |
12870 FAST_PROTOTYPE); | 12870 FAST_PROTOTYPE); |
12871 } | 12871 } |
12872 } | 12872 } |
12873 isolate->heap()->ClearInstanceofCache(); | 12873 isolate->heap()->ClearInstanceofCache(); |
12874 } | 12874 } |
12875 | 12875 |
12876 | 12876 |
12877 void JSFunction::SetPrototype(Handle<JSFunction> function, | 12877 void JSFunction::SetPrototype(Handle<JSFunction> function, |
12878 Handle<Object> value) { | 12878 Handle<Object> value) { |
12879 DCHECK(function->IsConstructor()); | 12879 DCHECK(function->IsConstructor() || |
| 12880 IsGeneratorFunction(function->shared()->kind())); |
12880 Handle<Object> construct_prototype = value; | 12881 Handle<Object> construct_prototype = value; |
12881 | 12882 |
12882 // If the value is not a JSReceiver, store the value in the map's | 12883 // If the value is not a JSReceiver, store the value in the map's |
12883 // constructor field so it can be accessed. Also, set the prototype | 12884 // constructor field so it can be accessed. Also, set the prototype |
12884 // used for constructing objects to the original object prototype. | 12885 // used for constructing objects to the original object prototype. |
12885 // See ECMA-262 13.2.2. | 12886 // See ECMA-262 13.2.2. |
12886 if (!value->IsJSReceiver()) { | 12887 if (!value->IsJSReceiver()) { |
12887 // Copy the map so this does not affect unrelated functions. | 12888 // Copy the map so this does not affect unrelated functions. |
12888 // Remove map transitions because they point to maps with a | 12889 // Remove map transitions because they point to maps with a |
12889 // different prototype. | 12890 // different prototype. |
(...skipping 6775 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
19665 if (cell->value() != *new_value) { | 19666 if (cell->value() != *new_value) { |
19666 cell->set_value(*new_value); | 19667 cell->set_value(*new_value); |
19667 Isolate* isolate = cell->GetIsolate(); | 19668 Isolate* isolate = cell->GetIsolate(); |
19668 cell->dependent_code()->DeoptimizeDependentCodeGroup( | 19669 cell->dependent_code()->DeoptimizeDependentCodeGroup( |
19669 isolate, DependentCode::kPropertyCellChangedGroup); | 19670 isolate, DependentCode::kPropertyCellChangedGroup); |
19670 } | 19671 } |
19671 } | 19672 } |
19672 | 19673 |
19673 } // namespace internal | 19674 } // namespace internal |
19674 } // namespace v8 | 19675 } // namespace v8 |
OLD | NEW |