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 12507 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
12518 default: | 12518 default: |
12519 return false; | 12519 return false; |
12520 } | 12520 } |
12521 } | 12521 } |
12522 | 12522 |
12523 } // namespace | 12523 } // namespace |
12524 #endif | 12524 #endif |
12525 | 12525 |
12526 | 12526 |
12527 void JSFunction::EnsureHasInitialMap(Handle<JSFunction> function) { | 12527 void JSFunction::EnsureHasInitialMap(Handle<JSFunction> function) { |
12528 DCHECK(function->IsConstructor() || function->shared()->is_generator()); | 12528 DCHECK(function->IsConstructor() || function->shared()->is_generator() || |
| 12529 function->shared()->is_async()); |
12529 if (function->has_initial_map()) return; | 12530 if (function->has_initial_map()) return; |
12530 Isolate* isolate = function->GetIsolate(); | 12531 Isolate* isolate = function->GetIsolate(); |
12531 | 12532 |
12532 // The constructor should be compiled for the optimization hints to be | 12533 // The constructor should be compiled for the optimization hints to be |
12533 // available. | 12534 // available. |
12534 Compiler::Compile(function, Compiler::CLEAR_EXCEPTION); | 12535 Compiler::Compile(function, Compiler::CLEAR_EXCEPTION); |
12535 | 12536 |
12536 // First create a new map with the size and number of in-object properties | 12537 // First create a new map with the size and number of in-object properties |
12537 // suggested by the function. | 12538 // suggested by the function. |
12538 InstanceType instance_type; | 12539 InstanceType instance_type; |
12539 if (function->shared()->is_generator()) { | 12540 if (function->shared()->is_generator() || function->shared()->is_async()) { |
12540 instance_type = JS_GENERATOR_OBJECT_TYPE; | 12541 instance_type = JS_GENERATOR_OBJECT_TYPE; |
12541 } else { | 12542 } else { |
12542 instance_type = JS_OBJECT_TYPE; | 12543 instance_type = JS_OBJECT_TYPE; |
12543 } | 12544 } |
12544 int instance_size; | 12545 int instance_size; |
12545 int in_object_properties; | 12546 int in_object_properties; |
12546 function->CalculateInstanceSize(instance_type, 0, &instance_size, | 12547 function->CalculateInstanceSize(instance_type, 0, &instance_size, |
12547 &in_object_properties); | 12548 &in_object_properties); |
12548 | 12549 |
12549 Handle<Map> map = isolate->factory()->NewMap(instance_type, instance_size); | 12550 Handle<Map> map = isolate->factory()->NewMap(instance_type, instance_size); |
(...skipping 6511 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
19061 if (cell->value() != *new_value) { | 19062 if (cell->value() != *new_value) { |
19062 cell->set_value(*new_value); | 19063 cell->set_value(*new_value); |
19063 Isolate* isolate = cell->GetIsolate(); | 19064 Isolate* isolate = cell->GetIsolate(); |
19064 cell->dependent_code()->DeoptimizeDependentCodeGroup( | 19065 cell->dependent_code()->DeoptimizeDependentCodeGroup( |
19065 isolate, DependentCode::kPropertyCellChangedGroup); | 19066 isolate, DependentCode::kPropertyCellChangedGroup); |
19066 } | 19067 } |
19067 } | 19068 } |
19068 | 19069 |
19069 } // namespace internal | 19070 } // namespace internal |
19070 } // namespace v8 | 19071 } // namespace v8 |
OLD | NEW |