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 <ostream> | 5 #include <ostream> |
6 | 6 |
7 #include "src/accessors.h" | 7 #include "src/accessors.h" |
8 #include "src/compilation-dependencies.h" | 8 #include "src/compilation-dependencies.h" |
9 #include "src/compiler/access-info.h" | 9 #include "src/compiler/access-info.h" |
10 #include "src/compiler/type-cache.h" | 10 #include "src/compiler/type-cache.h" |
11 #include "src/field-index-inl.h" | 11 #include "src/field-index-inl.h" |
12 #include "src/field-type.h" | 12 #include "src/field-type.h" |
| 13 #include "src/ic/call-optimization.h" |
13 #include "src/objects-inl.h" | 14 #include "src/objects-inl.h" |
14 | 15 |
15 namespace v8 { | 16 namespace v8 { |
16 namespace internal { | 17 namespace internal { |
17 namespace compiler { | 18 namespace compiler { |
18 | 19 |
19 namespace { | 20 namespace { |
20 | 21 |
21 bool CanInlineElementAccess(Handle<Map> map) { | 22 bool CanInlineElementAccess(Handle<Map> map) { |
22 if (!map->IsJSObjectMap()) return false; | 23 if (!map->IsJSObjectMap()) return false; |
(...skipping 313 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
336 } | 337 } |
337 case ACCESSOR_CONSTANT: { | 338 case ACCESSOR_CONSTANT: { |
338 Handle<Object> accessors(descriptors->GetValue(number), isolate()); | 339 Handle<Object> accessors(descriptors->GetValue(number), isolate()); |
339 if (!accessors->IsAccessorPair()) return false; | 340 if (!accessors->IsAccessorPair()) return false; |
340 Handle<Object> accessor( | 341 Handle<Object> accessor( |
341 access_mode == AccessMode::kLoad | 342 access_mode == AccessMode::kLoad |
342 ? Handle<AccessorPair>::cast(accessors)->getter() | 343 ? Handle<AccessorPair>::cast(accessors)->getter() |
343 : Handle<AccessorPair>::cast(accessors)->setter(), | 344 : Handle<AccessorPair>::cast(accessors)->setter(), |
344 isolate()); | 345 isolate()); |
345 if (!accessor->IsJSFunction()) { | 346 if (!accessor->IsJSFunction()) { |
346 // TODO(turbofan): Add support for API accessors. | 347 CallOptimization optimization(accessor); |
347 return false; | 348 if (!optimization.is_simple_api_call()) { |
| 349 return false; |
| 350 } |
| 351 if (optimization.api_call_info()->fast_handler()->IsCode()) { |
| 352 return false; |
| 353 } |
348 } | 354 } |
349 *access_info = PropertyAccessInfo::AccessorConstant( | 355 *access_info = PropertyAccessInfo::AccessorConstant( |
350 MapList{receiver_map}, accessor, holder); | 356 MapList{receiver_map}, accessor, holder); |
351 return true; | 357 return true; |
352 } | 358 } |
353 case ACCESSOR: { | 359 case ACCESSOR: { |
354 // TODO(turbofan): Add support for general accessors? | 360 // TODO(turbofan): Add support for general accessors? |
355 return false; | 361 return false; |
356 } | 362 } |
357 } | 363 } |
(...skipping 169 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
527 } | 533 } |
528 return false; | 534 return false; |
529 } | 535 } |
530 | 536 |
531 | 537 |
532 Factory* AccessInfoFactory::factory() const { return isolate()->factory(); } | 538 Factory* AccessInfoFactory::factory() const { return isolate()->factory(); } |
533 | 539 |
534 } // namespace compiler | 540 } // namespace compiler |
535 } // namespace internal | 541 } // namespace internal |
536 } // namespace v8 | 542 } // namespace v8 |
OLD | NEW |