| 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 11895 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 11906 default: | 11906 default: |
| 11907 return false; | 11907 return false; |
| 11908 } | 11908 } |
| 11909 } | 11909 } |
| 11910 | 11910 |
| 11911 } // namespace | 11911 } // namespace |
| 11912 #endif | 11912 #endif |
| 11913 | 11913 |
| 11914 | 11914 |
| 11915 void JSFunction::EnsureHasInitialMap(Handle<JSFunction> function) { | 11915 void JSFunction::EnsureHasInitialMap(Handle<JSFunction> function) { |
| 11916 DCHECK(function->IsConstructor() || function->shared()->is_generator()); | 11916 DCHECK(function->IsConstructor() || function->shared()->is_generator() || |
| 11917 function->shared()->is_async()); |
| 11917 if (function->has_initial_map()) return; | 11918 if (function->has_initial_map()) return; |
| 11918 Isolate* isolate = function->GetIsolate(); | 11919 Isolate* isolate = function->GetIsolate(); |
| 11919 | 11920 |
| 11920 // The constructor should be compiled for the optimization hints to be | 11921 // The constructor should be compiled for the optimization hints to be |
| 11921 // available. | 11922 // available. |
| 11922 Compiler::Compile(function, Compiler::CLEAR_EXCEPTION); | 11923 Compiler::Compile(function, Compiler::CLEAR_EXCEPTION); |
| 11923 | 11924 |
| 11924 // First create a new map with the size and number of in-object properties | 11925 // First create a new map with the size and number of in-object properties |
| 11925 // suggested by the function. | 11926 // suggested by the function. |
| 11926 InstanceType instance_type; | 11927 InstanceType instance_type; |
| 11927 if (function->shared()->is_generator()) { | 11928 if (function->shared()->is_generator() || function->shared()->is_async()) { |
| 11928 instance_type = JS_GENERATOR_OBJECT_TYPE; | 11929 instance_type = JS_GENERATOR_OBJECT_TYPE; |
| 11929 } else { | 11930 } else { |
| 11930 instance_type = JS_OBJECT_TYPE; | 11931 instance_type = JS_OBJECT_TYPE; |
| 11931 } | 11932 } |
| 11932 int instance_size; | 11933 int instance_size; |
| 11933 int in_object_properties; | 11934 int in_object_properties; |
| 11934 function->CalculateInstanceSize(instance_type, 0, &instance_size, | 11935 function->CalculateInstanceSize(instance_type, 0, &instance_size, |
| 11935 &in_object_properties); | 11936 &in_object_properties); |
| 11936 | 11937 |
| 11937 Handle<Map> map = isolate->factory()->NewMap(instance_type, instance_size); | 11938 Handle<Map> map = isolate->factory()->NewMap(instance_type, instance_size); |
| (...skipping 6320 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 18258 if (cell->value() != *new_value) { | 18259 if (cell->value() != *new_value) { |
| 18259 cell->set_value(*new_value); | 18260 cell->set_value(*new_value); |
| 18260 Isolate* isolate = cell->GetIsolate(); | 18261 Isolate* isolate = cell->GetIsolate(); |
| 18261 cell->dependent_code()->DeoptimizeDependentCodeGroup( | 18262 cell->dependent_code()->DeoptimizeDependentCodeGroup( |
| 18262 isolate, DependentCode::kPropertyCellChangedGroup); | 18263 isolate, DependentCode::kPropertyCellChangedGroup); |
| 18263 } | 18264 } |
| 18264 } | 18265 } |
| 18265 | 18266 |
| 18266 } // namespace internal | 18267 } // namespace internal |
| 18267 } // namespace v8 | 18268 } // namespace v8 |
| OLD | NEW |