| 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 | 13 |
| 14 Handle<Code> PropertyICCompiler::ComputeKeyedLoadMonomorphicHandler( | 14 Handle<Code> PropertyICCompiler::ComputeKeyedLoadMonomorphicHandler( |
| 15 Handle<Map> receiver_map, ExtraICState extra_ic_state) { | 15 Handle<Map> receiver_map, ExtraICState extra_ic_state) { |
| 16 // TODO(ishell): remove extra_ic_state |
| 16 Isolate* isolate = receiver_map->GetIsolate(); | 17 Isolate* isolate = receiver_map->GetIsolate(); |
| 17 bool is_js_array = receiver_map->instance_type() == JS_ARRAY_TYPE; | 18 bool is_js_array = receiver_map->instance_type() == JS_ARRAY_TYPE; |
| 18 ElementsKind elements_kind = receiver_map->elements_kind(); | 19 ElementsKind elements_kind = receiver_map->elements_kind(); |
| 19 | 20 |
| 20 // No need to check for an elements-free prototype chain here, the generated | 21 // No need to check for an elements-free prototype chain here, the generated |
| 21 // stub code needs to check that dynamically anyway. | 22 // stub code needs to check that dynamically anyway. |
| 22 bool convert_hole_to_undefined = | 23 bool convert_hole_to_undefined = |
| 23 is_js_array && elements_kind == FAST_HOLEY_ELEMENTS && | 24 is_js_array && elements_kind == FAST_HOLEY_ELEMENTS && |
| 24 *receiver_map == isolate->get_initial_js_array_map(elements_kind); | 25 *receiver_map == isolate->get_initial_js_array_map(elements_kind); |
| 25 Handle<Code> stub; | 26 Handle<Code> stub; |
| 26 if (receiver_map->has_indexed_interceptor()) { | 27 if (receiver_map->has_indexed_interceptor()) { |
| 27 TRACE_HANDLER_STATS(isolate, KeyedLoadIC_LoadIndexedInterceptorStub); | 28 TRACE_HANDLER_STATS(isolate, KeyedLoadIC_LoadIndexedInterceptorStub); |
| 28 stub = LoadIndexedInterceptorStub(isolate).GetCode(); | 29 stub = LoadIndexedInterceptorStub(isolate).GetCode(); |
| 29 } else if (receiver_map->IsStringMap()) { | 30 } else if (receiver_map->IsStringMap()) { |
| 30 TRACE_HANDLER_STATS(isolate, KeyedLoadIC_LoadIndexedStringStub); | 31 TRACE_HANDLER_STATS(isolate, KeyedLoadIC_LoadIndexedStringStub); |
| 31 stub = LoadIndexedStringStub(isolate).GetCode(); | 32 stub = LoadIndexedStringStub(isolate).GetCode(); |
| 32 } else if (receiver_map->has_sloppy_arguments_elements()) { | 33 } else if (receiver_map->has_sloppy_arguments_elements()) { |
| 33 TRACE_HANDLER_STATS(isolate, KeyedLoadIC_KeyedLoadSloppyArgumentsStub); | 34 TRACE_HANDLER_STATS(isolate, KeyedLoadIC_KeyedLoadSloppyArgumentsStub); |
| 34 stub = KeyedLoadSloppyArgumentsStub(isolate).GetCode(); | 35 stub = KeyedLoadSloppyArgumentsStub(isolate).GetCode(); |
| 35 } else if (receiver_map->has_fast_elements() || | 36 } else if (receiver_map->has_fast_elements() || |
| 36 receiver_map->has_fixed_typed_array_elements()) { | 37 receiver_map->has_fixed_typed_array_elements()) { |
| 37 TRACE_HANDLER_STATS(isolate, KeyedLoadIC_LoadFastElementStub); | 38 TRACE_HANDLER_STATS(isolate, KeyedLoadIC_LoadFastElementStub); |
| 38 stub = LoadFastElementStub(isolate, is_js_array, elements_kind, | 39 stub = LoadFastElementStub(isolate, is_js_array, elements_kind, |
| 39 convert_hole_to_undefined).GetCode(); | 40 convert_hole_to_undefined).GetCode(); |
| 40 } else { | 41 } else { |
| 41 DCHECK(receiver_map->has_dictionary_elements()); | 42 DCHECK(receiver_map->has_dictionary_elements()); |
| 42 TRACE_HANDLER_STATS(isolate, KeyedLoadIC_LoadDictionaryElementStub); | 43 TRACE_HANDLER_STATS(isolate, KeyedLoadIC_LoadDictionaryElementStub); |
| 43 stub = LoadDictionaryElementStub(isolate, LoadICState(extra_ic_state)) | 44 stub = LoadDictionaryElementStub(isolate).GetCode(); |
| 44 .GetCode(); | |
| 45 } | 45 } |
| 46 return stub; | 46 return stub; |
| 47 } | 47 } |
| 48 | 48 |
| 49 Handle<Code> PropertyICCompiler::ComputeKeyedStoreMonomorphicHandler( | 49 Handle<Code> PropertyICCompiler::ComputeKeyedStoreMonomorphicHandler( |
| 50 Handle<Map> receiver_map, KeyedAccessStoreMode store_mode) { | 50 Handle<Map> receiver_map, KeyedAccessStoreMode store_mode) { |
| 51 Isolate* isolate = receiver_map->GetIsolate(); | 51 Isolate* isolate = receiver_map->GetIsolate(); |
| 52 | 52 |
| 53 DCHECK(store_mode == STANDARD_STORE || | 53 DCHECK(store_mode == STANDARD_STORE || |
| 54 store_mode == STORE_AND_GROW_NO_TRANSITION || | 54 store_mode == STORE_AND_GROW_NO_TRANSITION || |
| (...skipping 88 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 143 TRACE_HANDLER_STATS(isolate(), KeyedStoreIC_StoreElementStub); | 143 TRACE_HANDLER_STATS(isolate(), KeyedStoreIC_StoreElementStub); |
| 144 stub = StoreElementStub(isolate(), elements_kind, store_mode).GetCode(); | 144 stub = StoreElementStub(isolate(), elements_kind, store_mode).GetCode(); |
| 145 } | 145 } |
| 146 return stub; | 146 return stub; |
| 147 } | 147 } |
| 148 | 148 |
| 149 | 149 |
| 150 #undef __ | 150 #undef __ |
| 151 } // namespace internal | 151 } // namespace internal |
| 152 } // namespace v8 | 152 } // namespace v8 |
| OLD | NEW |