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 11807 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
11818 if (!value->IsJSReceiver()) { | 11818 if (!value->IsJSReceiver()) { |
11819 // Copy the map so this does not affect unrelated functions. | 11819 // Copy the map so this does not affect unrelated functions. |
11820 // Remove map transitions because they point to maps with a | 11820 // Remove map transitions because they point to maps with a |
11821 // different prototype. | 11821 // different prototype. |
11822 Handle<Map> new_map = Map::Copy(handle(function->map()), "SetPrototype"); | 11822 Handle<Map> new_map = Map::Copy(handle(function->map()), "SetPrototype"); |
11823 | 11823 |
11824 JSObject::MigrateToMap(function, new_map); | 11824 JSObject::MigrateToMap(function, new_map); |
11825 new_map->SetConstructor(*value); | 11825 new_map->SetConstructor(*value); |
11826 new_map->set_non_instance_prototype(true); | 11826 new_map->set_non_instance_prototype(true); |
11827 Isolate* isolate = new_map->GetIsolate(); | 11827 Isolate* isolate = new_map->GetIsolate(); |
| 11828 |
11828 construct_prototype = handle( | 11829 construct_prototype = handle( |
11829 function->context()->native_context()->initial_object_prototype(), | 11830 IsGeneratorFunction(function->shared()->kind()) |
| 11831 ? function->context() |
| 11832 ->native_context() |
| 11833 ->initial_generator_prototype() |
| 11834 : function->context()->native_context()->initial_object_prototype(), |
11830 isolate); | 11835 isolate); |
11831 } else { | 11836 } else { |
11832 function->map()->set_non_instance_prototype(false); | 11837 function->map()->set_non_instance_prototype(false); |
11833 } | 11838 } |
11834 | 11839 |
11835 return SetInstancePrototype(function, construct_prototype); | 11840 return SetInstancePrototype(function, construct_prototype); |
11836 } | 11841 } |
11837 | 11842 |
11838 | 11843 |
11839 bool JSFunction::RemovePrototype() { | 11844 bool JSFunction::RemovePrototype() { |
(...skipping 6459 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
18299 if (cell->value() != *new_value) { | 18304 if (cell->value() != *new_value) { |
18300 cell->set_value(*new_value); | 18305 cell->set_value(*new_value); |
18301 Isolate* isolate = cell->GetIsolate(); | 18306 Isolate* isolate = cell->GetIsolate(); |
18302 cell->dependent_code()->DeoptimizeDependentCodeGroup( | 18307 cell->dependent_code()->DeoptimizeDependentCodeGroup( |
18303 isolate, DependentCode::kPropertyCellChangedGroup); | 18308 isolate, DependentCode::kPropertyCellChangedGroup); |
18304 } | 18309 } |
18305 } | 18310 } |
18306 | 18311 |
18307 } // namespace internal | 18312 } // namespace internal |
18308 } // namespace v8 | 18313 } // namespace v8 |
OLD | NEW |