| 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 #include "src/profiler/cpu-profiler.h" | 9 #include "src/profiler/cpu-profiler.h" |
| 10 | 10 |
| 11 | 11 |
| 12 namespace v8 { | 12 namespace v8 { |
| 13 namespace internal { | 13 namespace internal { |
| 14 | 14 |
| 15 | 15 |
| 16 Handle<Code> PropertyICCompiler::ComputeKeyedLoadMonomorphicHandler( | 16 Handle<Code> PropertyICCompiler::ComputeKeyedLoadMonomorphicHandler( |
| 17 Handle<Map> receiver_map, ExtraICState extra_ic_state) { | 17 Handle<Map> receiver_map, ExtraICState extra_ic_state) { |
| 18 Isolate* isolate = receiver_map->GetIsolate(); | 18 Isolate* isolate = receiver_map->GetIsolate(); |
| 19 bool is_js_array = receiver_map->instance_type() == JS_ARRAY_TYPE; | 19 bool is_js_array = receiver_map->instance_type() == JS_ARRAY_TYPE; |
| 20 ElementsKind elements_kind = receiver_map->elements_kind(); | 20 ElementsKind elements_kind = receiver_map->elements_kind(); |
| 21 | 21 |
| 22 // No need to check for an elements-free prototype chain here, the generated | 22 // No need to check for an elements-free prototype chain here, the generated |
| 23 // stub code needs to check that dynamically anyway. | 23 // stub code needs to check that dynamically anyway. |
| 24 bool convert_hole_to_undefined = | 24 bool convert_hole_to_undefined = |
| 25 is_js_array && elements_kind == FAST_HOLEY_ELEMENTS && | 25 is_js_array && elements_kind == FAST_HOLEY_ELEMENTS && |
| 26 *receiver_map == isolate->get_initial_js_array_map(elements_kind); | 26 *receiver_map == isolate->get_initial_js_array_map(elements_kind); |
| 27 Handle<Code> stub; | 27 Handle<Code> stub; |
| 28 if (receiver_map->has_indexed_interceptor()) { | 28 if (receiver_map->has_indexed_interceptor()) { |
| 29 TRACE_HANDLER_STATS(isolate, KeyedLoadIC_LoadIndexedInterceptorStub); |
| 29 stub = LoadIndexedInterceptorStub(isolate).GetCode(); | 30 stub = LoadIndexedInterceptorStub(isolate).GetCode(); |
| 30 } else if (receiver_map->IsStringMap()) { | 31 } else if (receiver_map->IsStringMap()) { |
| 32 TRACE_HANDLER_STATS(isolate, KeyedLoadIC_LoadIndexedStringStub); |
| 31 stub = LoadIndexedStringStub(isolate).GetCode(); | 33 stub = LoadIndexedStringStub(isolate).GetCode(); |
| 32 } else if (receiver_map->has_sloppy_arguments_elements()) { | 34 } else if (receiver_map->has_sloppy_arguments_elements()) { |
| 35 TRACE_HANDLER_STATS(isolate, KeyedLoadIC_KeyedLoadSloppyArgumentsStub); |
| 33 stub = KeyedLoadSloppyArgumentsStub(isolate).GetCode(); | 36 stub = KeyedLoadSloppyArgumentsStub(isolate).GetCode(); |
| 34 } else if (receiver_map->has_fast_elements() || | 37 } else if (receiver_map->has_fast_elements() || |
| 35 receiver_map->has_fixed_typed_array_elements()) { | 38 receiver_map->has_fixed_typed_array_elements()) { |
| 39 TRACE_HANDLER_STATS(isolate, KeyedLoadIC_LoadFastElementStub); |
| 36 stub = LoadFastElementStub(isolate, is_js_array, elements_kind, | 40 stub = LoadFastElementStub(isolate, is_js_array, elements_kind, |
| 37 convert_hole_to_undefined).GetCode(); | 41 convert_hole_to_undefined).GetCode(); |
| 38 } else { | 42 } else { |
| 39 DCHECK(receiver_map->has_dictionary_elements()); | 43 DCHECK(receiver_map->has_dictionary_elements()); |
| 44 TRACE_HANDLER_STATS(isolate, KeyedLoadIC_LoadDictionaryElementStub); |
| 40 stub = LoadDictionaryElementStub(isolate, LoadICState(extra_ic_state)) | 45 stub = LoadDictionaryElementStub(isolate, LoadICState(extra_ic_state)) |
| 41 .GetCode(); | 46 .GetCode(); |
| 42 } | 47 } |
| 43 return stub; | 48 return stub; |
| 44 } | 49 } |
| 45 | 50 |
| 46 Handle<Code> PropertyICCompiler::ComputeKeyedStoreMonomorphicHandler( | 51 Handle<Code> PropertyICCompiler::ComputeKeyedStoreMonomorphicHandler( |
| 47 Handle<Map> receiver_map, KeyedAccessStoreMode store_mode) { | 52 Handle<Map> receiver_map, KeyedAccessStoreMode store_mode) { |
| 48 Isolate* isolate = receiver_map->GetIsolate(); | 53 Isolate* isolate = receiver_map->GetIsolate(); |
| 49 | 54 |
| (...skipping 69 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 119 | 124 |
| 120 #define __ ACCESS_MASM(masm()) | 125 #define __ ACCESS_MASM(masm()) |
| 121 | 126 |
| 122 | 127 |
| 123 Handle<Code> PropertyICCompiler::CompileKeyedStoreMonomorphicHandler( | 128 Handle<Code> PropertyICCompiler::CompileKeyedStoreMonomorphicHandler( |
| 124 Handle<Map> receiver_map, KeyedAccessStoreMode store_mode) { | 129 Handle<Map> receiver_map, KeyedAccessStoreMode store_mode) { |
| 125 ElementsKind elements_kind = receiver_map->elements_kind(); | 130 ElementsKind elements_kind = receiver_map->elements_kind(); |
| 126 bool is_jsarray = receiver_map->instance_type() == JS_ARRAY_TYPE; | 131 bool is_jsarray = receiver_map->instance_type() == JS_ARRAY_TYPE; |
| 127 Handle<Code> stub; | 132 Handle<Code> stub; |
| 128 if (receiver_map->has_sloppy_arguments_elements()) { | 133 if (receiver_map->has_sloppy_arguments_elements()) { |
| 134 TRACE_HANDLER_STATS(isolate(), KeyedStoreIC_KeyedStoreSloppyArgumentsStub); |
| 129 stub = KeyedStoreSloppyArgumentsStub(isolate(), store_mode).GetCode(); | 135 stub = KeyedStoreSloppyArgumentsStub(isolate(), store_mode).GetCode(); |
| 130 } else if (receiver_map->has_fast_elements() || | 136 } else if (receiver_map->has_fast_elements() || |
| 131 receiver_map->has_fixed_typed_array_elements()) { | 137 receiver_map->has_fixed_typed_array_elements()) { |
| 138 TRACE_HANDLER_STATS(isolate(), KeyedStoreIC_StoreFastElementStub); |
| 132 stub = StoreFastElementStub(isolate(), is_jsarray, elements_kind, | 139 stub = StoreFastElementStub(isolate(), is_jsarray, elements_kind, |
| 133 store_mode).GetCode(); | 140 store_mode).GetCode(); |
| 134 } else { | 141 } else { |
| 142 TRACE_HANDLER_STATS(isolate(), KeyedStoreIC_StoreElementStub); |
| 135 stub = StoreElementStub(isolate(), elements_kind, store_mode).GetCode(); | 143 stub = StoreElementStub(isolate(), elements_kind, store_mode).GetCode(); |
| 136 } | 144 } |
| 137 return stub; | 145 return stub; |
| 138 } | 146 } |
| 139 | 147 |
| 140 | 148 |
| 141 #undef __ | 149 #undef __ |
| 142 } // namespace internal | 150 } // namespace internal |
| 143 } // namespace v8 | 151 } // namespace v8 |
| OLD | NEW |