| 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/ic/call-optimization.h" |
| 14 #include "src/objects-inl.h" | 14 #include "src/objects-inl.h" |
| 15 | 15 |
| 16 namespace v8 { | 16 namespace v8 { |
| 17 namespace internal { | 17 namespace internal { |
| 18 namespace compiler { | 18 namespace compiler { |
| 19 | 19 |
| 20 namespace { | 20 namespace { |
| 21 | 21 |
| 22 bool CanInlineElementAccess(Handle<Map> map) { | 22 bool CanInlineElementAccess(Handle<Map> map) { |
| 23 if (!map->IsJSObjectMap()) return false; | 23 if (!map->IsJSObjectMap()) return false; |
| 24 if (map->is_access_check_needed()) return false; | 24 if (map->is_access_check_needed()) return false; |
| 25 if (map->has_indexed_interceptor()) return false; | 25 if (map->has_indexed_interceptor()) return false; |
| 26 ElementsKind const elements_kind = map->elements_kind(); | 26 ElementsKind const elements_kind = map->elements_kind(); |
| 27 if (IsFastElementsKind(elements_kind)) return true; | 27 if (IsFastElementsKind(elements_kind)) return true; |
| 28 // TODO(bmeurer): Add support for other elements kind. | |
| 29 if (elements_kind == UINT8_CLAMPED_ELEMENTS) return false; | |
| 30 if (IsFixedTypedArrayElementsKind(elements_kind)) return true; | 28 if (IsFixedTypedArrayElementsKind(elements_kind)) return true; |
| 31 return false; | 29 return false; |
| 32 } | 30 } |
| 33 | 31 |
| 34 | 32 |
| 35 bool CanInlinePropertyAccess(Handle<Map> map) { | 33 bool CanInlinePropertyAccess(Handle<Map> map) { |
| 36 // We can inline property access to prototypes of all primitives, except | 34 // We can inline property access to prototypes of all primitives, except |
| 37 // the special Oddball ones that have no wrapper counterparts (i.e. Null, | 35 // the special Oddball ones that have no wrapper counterparts (i.e. Null, |
| 38 // Undefined and TheHole). | 36 // Undefined and TheHole). |
| 39 STATIC_ASSERT(ODDBALL_TYPE == LAST_PRIMITIVE_TYPE); | 37 STATIC_ASSERT(ODDBALL_TYPE == LAST_PRIMITIVE_TYPE); |
| (...skipping 493 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 533 } | 531 } |
| 534 return false; | 532 return false; |
| 535 } | 533 } |
| 536 | 534 |
| 537 | 535 |
| 538 Factory* AccessInfoFactory::factory() const { return isolate()->factory(); } | 536 Factory* AccessInfoFactory::factory() const { return isolate()->factory(); } |
| 539 | 537 |
| 540 } // namespace compiler | 538 } // namespace compiler |
| 541 } // namespace internal | 539 } // namespace internal |
| 542 } // namespace v8 | 540 } // namespace v8 |
| OLD | NEW |