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" |
(...skipping 10 matching lines...) Expand all Loading... |
21 bool CanInlineElementAccess(Handle<Map> map) { | 21 bool CanInlineElementAccess(Handle<Map> map) { |
22 // TODO(bmeurer): IsJSObjectMap | 22 // TODO(bmeurer): IsJSObjectMap |
23 // TODO(bmeurer): !map->has_dictionary_elements() | 23 // TODO(bmeurer): !map->has_dictionary_elements() |
24 // TODO(bmeurer): !map->has_sloppy_arguments_elements() | 24 // TODO(bmeurer): !map->has_sloppy_arguments_elements() |
25 return map->IsJSArrayMap() && map->has_fast_elements() && | 25 return map->IsJSArrayMap() && map->has_fast_elements() && |
26 !map->has_indexed_interceptor() && !map->is_access_check_needed(); | 26 !map->has_indexed_interceptor() && !map->is_access_check_needed(); |
27 } | 27 } |
28 | 28 |
29 | 29 |
30 bool CanInlinePropertyAccess(Handle<Map> map) { | 30 bool CanInlinePropertyAccess(Handle<Map> map) { |
31 if (map->instance_type() == HEAP_NUMBER_TYPE) return true; | 31 // We can inline property access to prototypes of all primitives, except |
32 if (map->instance_type() < FIRST_NONSTRING_TYPE) return true; | 32 // the special Oddball ones that have no wrapper counterparts (i.e. Null, |
| 33 // Undefined and TheHole). |
| 34 STATIC_ASSERT(ODDBALL_TYPE == LAST_PRIMITIVE_TYPE); |
| 35 if (map->IsBooleanMap()) return true; |
| 36 if (map->instance_type() < LAST_PRIMITIVE_TYPE) return true; |
33 return map->IsJSObjectMap() && !map->is_dictionary_map() && | 37 return map->IsJSObjectMap() && !map->is_dictionary_map() && |
34 !map->has_named_interceptor() && | 38 !map->has_named_interceptor() && |
35 // TODO(verwaest): Whitelist contexts to which we have access. | 39 // TODO(verwaest): Whitelist contexts to which we have access. |
36 !map->is_access_check_needed(); | 40 !map->is_access_check_needed(); |
37 } | 41 } |
38 | 42 |
39 } // namespace | 43 } // namespace |
40 | 44 |
41 | 45 |
42 std::ostream& operator<<(std::ostream& os, AccessMode access_mode) { | 46 std::ostream& operator<<(std::ostream& os, AccessMode access_mode) { |
(...skipping 357 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
400 } | 404 } |
401 return false; | 405 return false; |
402 } | 406 } |
403 | 407 |
404 | 408 |
405 Factory* AccessInfoFactory::factory() const { return isolate()->factory(); } | 409 Factory* AccessInfoFactory::factory() const { return isolate()->factory(); } |
406 | 410 |
407 } // namespace compiler | 411 } // namespace compiler |
408 } // namespace internal | 412 } // namespace internal |
409 } // namespace v8 | 413 } // namespace v8 |
OLD | NEW |