| OLD | NEW |
| 1 // Copyright 2014 the V8 project authors. All rights reserved. | 1 // Copyright 2014 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/ic/ic-compiler.h" | 5 #include "src/ic/ic-compiler.h" |
| 6 | 6 |
| 7 #include "src/ic/handler-compiler.h" | 7 #include "src/ic/handler-compiler.h" |
| 8 #include "src/ic/ic-inl.h" | 8 #include "src/ic/ic-inl.h" |
| 9 | 9 |
| 10 namespace v8 { | 10 namespace v8 { |
| 11 namespace internal { | 11 namespace internal { |
| 12 | 12 |
| 13 | |
| 14 Handle<Code> PropertyICCompiler::ComputeKeyedLoadMonomorphicHandler( | |
| 15 Handle<Map> receiver_map, ExtraICState extra_ic_state) { | |
| 16 // TODO(ishell): remove extra_ic_state | |
| 17 Isolate* isolate = receiver_map->GetIsolate(); | |
| 18 bool is_js_array = receiver_map->instance_type() == JS_ARRAY_TYPE; | |
| 19 ElementsKind elements_kind = receiver_map->elements_kind(); | |
| 20 | |
| 21 // No need to check for an elements-free prototype chain here, the generated | |
| 22 // stub code needs to check that dynamically anyway. | |
| 23 bool convert_hole_to_undefined = | |
| 24 is_js_array && elements_kind == FAST_HOLEY_ELEMENTS && | |
| 25 *receiver_map == isolate->get_initial_js_array_map(elements_kind); | |
| 26 Handle<Code> stub; | |
| 27 if (receiver_map->has_indexed_interceptor()) { | |
| 28 TRACE_HANDLER_STATS(isolate, KeyedLoadIC_LoadIndexedInterceptorStub); | |
| 29 stub = LoadIndexedInterceptorStub(isolate).GetCode(); | |
| 30 } else if (receiver_map->IsStringMap()) { | |
| 31 TRACE_HANDLER_STATS(isolate, KeyedLoadIC_LoadIndexedStringStub); | |
| 32 stub = LoadIndexedStringStub(isolate).GetCode(); | |
| 33 } else if (receiver_map->has_sloppy_arguments_elements()) { | |
| 34 TRACE_HANDLER_STATS(isolate, KeyedLoadIC_KeyedLoadSloppyArgumentsStub); | |
| 35 stub = KeyedLoadSloppyArgumentsStub(isolate).GetCode(); | |
| 36 } else if (receiver_map->has_fast_elements() || | |
| 37 receiver_map->has_fixed_typed_array_elements()) { | |
| 38 TRACE_HANDLER_STATS(isolate, KeyedLoadIC_LoadFastElementStub); | |
| 39 stub = LoadFastElementStub(isolate, is_js_array, elements_kind, | |
| 40 convert_hole_to_undefined).GetCode(); | |
| 41 } else { | |
| 42 DCHECK(receiver_map->has_dictionary_elements()); | |
| 43 TRACE_HANDLER_STATS(isolate, KeyedLoadIC_LoadDictionaryElementStub); | |
| 44 stub = LoadDictionaryElementStub(isolate).GetCode(); | |
| 45 } | |
| 46 return stub; | |
| 47 } | |
| 48 | |
| 49 Handle<Code> PropertyICCompiler::ComputeKeyedStoreMonomorphicHandler( | 13 Handle<Code> PropertyICCompiler::ComputeKeyedStoreMonomorphicHandler( |
| 50 Handle<Map> receiver_map, KeyedAccessStoreMode store_mode) { | 14 Handle<Map> receiver_map, KeyedAccessStoreMode store_mode) { |
| 51 Isolate* isolate = receiver_map->GetIsolate(); | 15 Isolate* isolate = receiver_map->GetIsolate(); |
| 52 | 16 |
| 53 DCHECK(store_mode == STANDARD_STORE || | 17 DCHECK(store_mode == STANDARD_STORE || |
| 54 store_mode == STORE_AND_GROW_NO_TRANSITION || | 18 store_mode == STORE_AND_GROW_NO_TRANSITION || |
| 55 store_mode == STORE_NO_TRANSITION_IGNORE_OUT_OF_BOUNDS || | 19 store_mode == STORE_NO_TRANSITION_IGNORE_OUT_OF_BOUNDS || |
| 56 store_mode == STORE_NO_TRANSITION_HANDLE_COW); | 20 store_mode == STORE_NO_TRANSITION_HANDLE_COW); |
| 57 | 21 |
| 58 PropertyICCompiler compiler(isolate); | 22 PropertyICCompiler compiler(isolate); |
| (...skipping 84 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 143 TRACE_HANDLER_STATS(isolate(), KeyedStoreIC_StoreElementStub); | 107 TRACE_HANDLER_STATS(isolate(), KeyedStoreIC_StoreElementStub); |
| 144 stub = StoreElementStub(isolate(), elements_kind, store_mode).GetCode(); | 108 stub = StoreElementStub(isolate(), elements_kind, store_mode).GetCode(); |
| 145 } | 109 } |
| 146 return stub; | 110 return stub; |
| 147 } | 111 } |
| 148 | 112 |
| 149 | 113 |
| 150 #undef __ | 114 #undef __ |
| 151 } // namespace internal | 115 } // namespace internal |
| 152 } // namespace v8 | 116 } // namespace v8 |
| OLD | NEW |