| 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 11883 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 11894 default: | 11894 default: |
| 11895 return false; | 11895 return false; |
| 11896 } | 11896 } |
| 11897 } | 11897 } |
| 11898 | 11898 |
| 11899 } // namespace | 11899 } // namespace |
| 11900 #endif | 11900 #endif |
| 11901 | 11901 |
| 11902 | 11902 |
| 11903 void JSFunction::EnsureHasInitialMap(Handle<JSFunction> function) { | 11903 void JSFunction::EnsureHasInitialMap(Handle<JSFunction> function) { |
| 11904 DCHECK(function->IsConstructor() || function->shared()->is_generator()); | 11904 DCHECK(function->IsConstructor() || function->shared()->is_generator() || |
| 11905 function->shared()->is_async()); |
| 11905 if (function->has_initial_map()) return; | 11906 if (function->has_initial_map()) return; |
| 11906 Isolate* isolate = function->GetIsolate(); | 11907 Isolate* isolate = function->GetIsolate(); |
| 11907 | 11908 |
| 11908 // The constructor should be compiled for the optimization hints to be | 11909 // The constructor should be compiled for the optimization hints to be |
| 11909 // available. | 11910 // available. |
| 11910 Compiler::Compile(function, Compiler::CLEAR_EXCEPTION); | 11911 Compiler::Compile(function, Compiler::CLEAR_EXCEPTION); |
| 11911 | 11912 |
| 11912 // First create a new map with the size and number of in-object properties | 11913 // First create a new map with the size and number of in-object properties |
| 11913 // suggested by the function. | 11914 // suggested by the function. |
| 11914 InstanceType instance_type; | 11915 InstanceType instance_type; |
| 11915 if (function->shared()->is_generator()) { | 11916 if (function->shared()->is_generator() || function->shared()->is_async()) { |
| 11916 instance_type = JS_GENERATOR_OBJECT_TYPE; | 11917 instance_type = JS_GENERATOR_OBJECT_TYPE; |
| 11917 } else { | 11918 } else { |
| 11918 instance_type = JS_OBJECT_TYPE; | 11919 instance_type = JS_OBJECT_TYPE; |
| 11919 } | 11920 } |
| 11920 int instance_size; | 11921 int instance_size; |
| 11921 int in_object_properties; | 11922 int in_object_properties; |
| 11922 function->CalculateInstanceSize(instance_type, 0, &instance_size, | 11923 function->CalculateInstanceSize(instance_type, 0, &instance_size, |
| 11923 &in_object_properties); | 11924 &in_object_properties); |
| 11924 | 11925 |
| 11925 Handle<Map> map = isolate->factory()->NewMap(instance_type, instance_size); | 11926 Handle<Map> map = isolate->factory()->NewMap(instance_type, instance_size); |
| (...skipping 6320 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 18246 if (cell->value() != *new_value) { | 18247 if (cell->value() != *new_value) { |
| 18247 cell->set_value(*new_value); | 18248 cell->set_value(*new_value); |
| 18248 Isolate* isolate = cell->GetIsolate(); | 18249 Isolate* isolate = cell->GetIsolate(); |
| 18249 cell->dependent_code()->DeoptimizeDependentCodeGroup( | 18250 cell->dependent_code()->DeoptimizeDependentCodeGroup( |
| 18250 isolate, DependentCode::kPropertyCellChangedGroup); | 18251 isolate, DependentCode::kPropertyCellChangedGroup); |
| 18251 } | 18252 } |
| 18252 } | 18253 } |
| 18253 | 18254 |
| 18254 } // namespace internal | 18255 } // namespace internal |
| 18255 } // namespace v8 | 18256 } // namespace v8 |
| OLD | NEW |