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 12690 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
12701 default: | 12701 default: |
12702 return false; | 12702 return false; |
12703 } | 12703 } |
12704 } | 12704 } |
12705 | 12705 |
12706 } // namespace | 12706 } // namespace |
12707 #endif | 12707 #endif |
12708 | 12708 |
12709 | 12709 |
12710 void JSFunction::EnsureHasInitialMap(Handle<JSFunction> function) { | 12710 void JSFunction::EnsureHasInitialMap(Handle<JSFunction> function) { |
12711 DCHECK(function->IsConstructor() || function->shared()->is_generator()); | 12711 DCHECK(function->IsConstructor() || function->shared()->is_generator() || |
| 12712 function->shared()->is_async()); |
12712 if (function->has_initial_map()) return; | 12713 if (function->has_initial_map()) return; |
12713 Isolate* isolate = function->GetIsolate(); | 12714 Isolate* isolate = function->GetIsolate(); |
12714 | 12715 |
12715 // The constructor should be compiled for the optimization hints to be | 12716 // The constructor should be compiled for the optimization hints to be |
12716 // available. | 12717 // available. |
12717 Compiler::Compile(function, Compiler::CLEAR_EXCEPTION); | 12718 Compiler::Compile(function, Compiler::CLEAR_EXCEPTION); |
12718 | 12719 |
12719 // First create a new map with the size and number of in-object properties | 12720 // First create a new map with the size and number of in-object properties |
12720 // suggested by the function. | 12721 // suggested by the function. |
12721 InstanceType instance_type; | 12722 InstanceType instance_type; |
12722 if (function->shared()->is_generator()) { | 12723 if (function->shared()->is_generator() || function->shared()->is_async()) { |
12723 instance_type = JS_GENERATOR_OBJECT_TYPE; | 12724 instance_type = JS_GENERATOR_OBJECT_TYPE; |
12724 } else { | 12725 } else { |
12725 instance_type = JS_OBJECT_TYPE; | 12726 instance_type = JS_OBJECT_TYPE; |
12726 } | 12727 } |
12727 int instance_size; | 12728 int instance_size; |
12728 int in_object_properties; | 12729 int in_object_properties; |
12729 function->CalculateInstanceSize(instance_type, 0, &instance_size, | 12730 function->CalculateInstanceSize(instance_type, 0, &instance_size, |
12730 &in_object_properties); | 12731 &in_object_properties); |
12731 | 12732 |
12732 Handle<Map> map = isolate->factory()->NewMap(instance_type, instance_size); | 12733 Handle<Map> map = isolate->factory()->NewMap(instance_type, instance_size); |
(...skipping 6669 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
19402 if (cell->value() != *new_value) { | 19403 if (cell->value() != *new_value) { |
19403 cell->set_value(*new_value); | 19404 cell->set_value(*new_value); |
19404 Isolate* isolate = cell->GetIsolate(); | 19405 Isolate* isolate = cell->GetIsolate(); |
19405 cell->dependent_code()->DeoptimizeDependentCodeGroup( | 19406 cell->dependent_code()->DeoptimizeDependentCodeGroup( |
19406 isolate, DependentCode::kPropertyCellChangedGroup); | 19407 isolate, DependentCode::kPropertyCellChangedGroup); |
19407 } | 19408 } |
19408 } | 19409 } |
19409 | 19410 |
19410 } // namespace internal | 19411 } // namespace internal |
19411 } // namespace v8 | 19412 } // namespace v8 |
OLD | NEW |