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/v8.h" | 5 #include "src/v8.h" |
6 | 6 |
7 #include "src/cpu-profiler.h" | 7 #include "src/cpu-profiler.h" |
8 #include "src/ic/handler-compiler.h" | 8 #include "src/ic/handler-compiler.h" |
9 #include "src/ic/ic-inl.h" | 9 #include "src/ic/ic-inl.h" |
10 #include "src/ic/ic-compiler.h" | 10 #include "src/ic/ic-compiler.h" |
(...skipping 92 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
103 receiver_map, stub, isolate->factory()->empty_string(), ELEMENT); | 103 receiver_map, stub, isolate->factory()->empty_string(), ELEMENT); |
104 | 104 |
105 Map::UpdateCodeCache(receiver_map, name, code); | 105 Map::UpdateCodeCache(receiver_map, name, code); |
106 return code; | 106 return code; |
107 } | 107 } |
108 | 108 |
109 | 109 |
110 Handle<Code> PropertyICCompiler::ComputeKeyedLoadMonomorphicHandler( | 110 Handle<Code> PropertyICCompiler::ComputeKeyedLoadMonomorphicHandler( |
111 Handle<Map> receiver_map) { | 111 Handle<Map> receiver_map) { |
112 Isolate* isolate = receiver_map->GetIsolate(); | 112 Isolate* isolate = receiver_map->GetIsolate(); |
| 113 bool is_js_array = receiver_map->instance_type() == JS_ARRAY_TYPE; |
113 ElementsKind elements_kind = receiver_map->elements_kind(); | 114 ElementsKind elements_kind = receiver_map->elements_kind(); |
| 115 |
| 116 // No need to check for an elements-free prototype chain here, the generated |
| 117 // stub code needs to check that dynamically anyway. |
| 118 bool convert_hole_to_undefined = |
| 119 is_js_array && elements_kind == FAST_HOLEY_ELEMENTS && |
| 120 *receiver_map == isolate->get_initial_js_array_map(elements_kind); |
| 121 |
114 Handle<Code> stub; | 122 Handle<Code> stub; |
115 if (receiver_map->has_indexed_interceptor()) { | 123 if (receiver_map->has_indexed_interceptor()) { |
116 stub = LoadIndexedInterceptorStub(isolate).GetCode(); | 124 stub = LoadIndexedInterceptorStub(isolate).GetCode(); |
117 } else if (receiver_map->IsStringMap()) { | 125 } else if (receiver_map->IsStringMap()) { |
118 // We have a string. | 126 // We have a string. |
119 stub = LoadIndexedStringStub(isolate).GetCode(); | 127 stub = LoadIndexedStringStub(isolate).GetCode(); |
120 } else if (receiver_map->has_sloppy_arguments_elements()) { | 128 } else if (receiver_map->has_sloppy_arguments_elements()) { |
121 stub = KeyedLoadSloppyArgumentsStub(isolate).GetCode(); | 129 stub = KeyedLoadSloppyArgumentsStub(isolate).GetCode(); |
122 } else if (receiver_map->has_fast_elements() || | 130 } else if (receiver_map->has_fast_elements() || |
123 receiver_map->has_external_array_elements() || | 131 receiver_map->has_external_array_elements() || |
124 receiver_map->has_fixed_typed_array_elements()) { | 132 receiver_map->has_fixed_typed_array_elements()) { |
125 stub = LoadFastElementStub(isolate, | 133 stub = LoadFastElementStub(isolate, is_js_array, elements_kind, |
126 receiver_map->instance_type() == JS_ARRAY_TYPE, | 134 convert_hole_to_undefined).GetCode(); |
127 elements_kind).GetCode(); | |
128 } else { | 135 } else { |
129 stub = LoadDictionaryElementStub(isolate).GetCode(); | 136 stub = LoadDictionaryElementStub(isolate).GetCode(); |
130 } | 137 } |
131 return stub; | 138 return stub; |
132 } | 139 } |
133 | 140 |
134 | 141 |
135 Handle<Code> PropertyICCompiler::ComputeKeyedStoreMonomorphic( | 142 Handle<Code> PropertyICCompiler::ComputeKeyedStoreMonomorphic( |
136 Handle<Map> receiver_map, LanguageMode language_mode, | 143 Handle<Map> receiver_map, LanguageMode language_mode, |
137 KeyedAccessStoreMode store_mode) { | 144 KeyedAccessStoreMode store_mode) { |
(...skipping 327 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
465 | 472 |
466 TailCallBuiltin(masm(), Builtins::kKeyedStoreIC_Miss); | 473 TailCallBuiltin(masm(), Builtins::kKeyedStoreIC_Miss); |
467 | 474 |
468 return GetCode(kind(), Code::NORMAL, factory()->empty_string()); | 475 return GetCode(kind(), Code::NORMAL, factory()->empty_string()); |
469 } | 476 } |
470 | 477 |
471 | 478 |
472 #undef __ | 479 #undef __ |
473 } | 480 } |
474 } // namespace v8::internal | 481 } // namespace v8::internal |
OLD | NEW |