| 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/field-index-inl.h" | 10 #include "src/field-index-inl.h" |
| 11 #include "src/field-type.h" | 11 #include "src/field-type.h" |
| 12 #include "src/objects-inl.h" | 12 #include "src/objects-inl.h" |
| 13 #include "src/type-cache.h" | 13 #include "src/type-cache.h" |
| 14 | 14 |
| 15 namespace v8 { | 15 namespace v8 { |
| 16 namespace internal { | 16 namespace internal { |
| 17 namespace compiler { | 17 namespace compiler { |
| 18 | 18 |
| 19 namespace { | 19 namespace { |
| 20 | 20 |
| 21 bool CanInlineElementAccess(Handle<Map> map) { | 21 bool CanInlineElementAccess(Handle<Map> map) { |
| 22 if (!map->IsJSObjectMap()) return false; | 22 if (!map->IsJSObjectMap()) return false; |
| 23 if (map->is_access_check_needed()) return false; | 23 if (map->is_access_check_needed()) return false; |
| 24 if (map->has_indexed_interceptor()) return false; | 24 if (map->has_indexed_interceptor()) return false; |
| 25 ElementsKind const elements_kind = map->elements_kind(); | 25 ElementsKind const elements_kind = map->elements_kind(); |
| 26 if (IsFastElementsKind(elements_kind)) return true; | 26 if (IsFastElementsKind(elements_kind)) return true; |
| 27 // TODO(bmeurer): Add support for other elements kind. | 27 // TODO(bmeurer): Add support for other elements kind. |
| 28 if (elements_kind == UINT8_CLAMPED_ELEMENTS) return false; |
| 29 if (IsFixedTypedArrayElementsKind(elements_kind)) return true; |
| 28 return false; | 30 return false; |
| 29 } | 31 } |
| 30 | 32 |
| 31 | 33 |
| 32 bool CanInlinePropertyAccess(Handle<Map> map) { | 34 bool CanInlinePropertyAccess(Handle<Map> map) { |
| 33 // We can inline property access to prototypes of all primitives, except | 35 // We can inline property access to prototypes of all primitives, except |
| 34 // the special Oddball ones that have no wrapper counterparts (i.e. Null, | 36 // the special Oddball ones that have no wrapper counterparts (i.e. Null, |
| 35 // Undefined and TheHole). | 37 // Undefined and TheHole). |
| 36 STATIC_ASSERT(ODDBALL_TYPE == LAST_PRIMITIVE_TYPE); | 38 STATIC_ASSERT(ODDBALL_TYPE == LAST_PRIMITIVE_TYPE); |
| 37 if (map->IsBooleanMap()) return true; | 39 if (map->IsBooleanMap()) return true; |
| (...skipping 483 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 521 } | 523 } |
| 522 return false; | 524 return false; |
| 523 } | 525 } |
| 524 | 526 |
| 525 | 527 |
| 526 Factory* AccessInfoFactory::factory() const { return isolate()->factory(); } | 528 Factory* AccessInfoFactory::factory() const { return isolate()->factory(); } |
| 527 | 529 |
| 528 } // namespace compiler | 530 } // namespace compiler |
| 529 } // namespace internal | 531 } // namespace internal |
| 530 } // namespace v8 | 532 } // namespace v8 |
| OLD | NEW |