| Index: src/ic/handler-compiler.cc
|
| diff --git a/src/ic/handler-compiler.cc b/src/ic/handler-compiler.cc
|
| index 6993c753662d04fc6fe2a95eaba1ed4717952327..a1d1467ab1f3600d1994d7d62c4380db4408ccf2 100644
|
| --- a/src/ic/handler-compiler.cc
|
| +++ b/src/ic/handler-compiler.cc
|
| @@ -576,44 +576,50 @@ Handle<Code> NamedStoreHandlerCompiler::CompileStoreCallback(
|
|
|
| #undef __
|
|
|
| +// static
|
| +Handle<Code> ElementHandlerCompiler::GetKeyedLoadHandler(
|
| + Handle<Map> receiver_map, Isolate* isolate) {
|
| + if (receiver_map->has_indexed_interceptor() &&
|
| + !receiver_map->GetIndexedInterceptor()->getter()->IsUndefined(isolate) &&
|
| + !receiver_map->GetIndexedInterceptor()->non_masking()) {
|
| + TRACE_HANDLER_STATS(isolate, KeyedLoadIC_LoadIndexedInterceptorStub);
|
| + return LoadIndexedInterceptorStub(isolate).GetCode();
|
| + }
|
| + if (receiver_map->IsStringMap()) {
|
| + TRACE_HANDLER_STATS(isolate, KeyedLoadIC_LoadIndexedStringStub);
|
| + return LoadIndexedStringStub(isolate).GetCode();
|
| + }
|
| + InstanceType instance_type = receiver_map->instance_type();
|
| + if (instance_type < FIRST_JS_RECEIVER_TYPE) {
|
| + TRACE_HANDLER_STATS(isolate, KeyedLoadIC_SlowStub);
|
| + return isolate->builtins()->KeyedLoadIC_Slow();
|
| + }
|
| +
|
| + ElementsKind elements_kind = receiver_map->elements_kind();
|
| + if (IsSloppyArgumentsElements(elements_kind)) {
|
| + TRACE_HANDLER_STATS(isolate, KeyedLoadIC_KeyedLoadSloppyArgumentsStub);
|
| + return KeyedLoadSloppyArgumentsStub(isolate).GetCode();
|
| + }
|
| + if (elements_kind == DICTIONARY_ELEMENTS) {
|
| + TRACE_HANDLER_STATS(isolate, KeyedLoadIC_LoadDictionaryElementStub);
|
| + return LoadDictionaryElementStub(isolate).GetCode();
|
| + }
|
| + DCHECK(IsFastElementsKind(elements_kind) ||
|
| + IsFixedTypedArrayElementsKind(elements_kind));
|
| + bool is_js_array = instance_type == JS_ARRAY_TYPE;
|
| + bool convert_hole_to_undefined =
|
| + is_js_array && elements_kind == FAST_HOLEY_ELEMENTS &&
|
| + *receiver_map == isolate->get_initial_js_array_map(elements_kind);
|
| + TRACE_HANDLER_STATS(isolate, KeyedLoadIC_LoadFastElementStub);
|
| + return LoadFastElementStub(isolate, is_js_array, elements_kind,
|
| + convert_hole_to_undefined)
|
| + .GetCode();
|
| +}
|
| +
|
| void ElementHandlerCompiler::CompileElementHandlers(
|
| MapHandleList* receiver_maps, List<Handle<Object>>* handlers) {
|
| for (int i = 0; i < receiver_maps->length(); ++i) {
|
| - Handle<Map> receiver_map = receiver_maps->at(i);
|
| - Handle<Code> cached_stub;
|
| -
|
| - if (receiver_map->IsStringMap()) {
|
| - cached_stub = LoadIndexedStringStub(isolate()).GetCode();
|
| - } else if (receiver_map->instance_type() < FIRST_JS_RECEIVER_TYPE) {
|
| - cached_stub = isolate()->builtins()->KeyedLoadIC_Slow();
|
| - } else {
|
| - bool is_js_array = receiver_map->instance_type() == JS_ARRAY_TYPE;
|
| - ElementsKind elements_kind = receiver_map->elements_kind();
|
| -
|
| - // No need to check for an elements-free prototype chain here, the
|
| - // generated stub code needs to check that dynamically anyway.
|
| - bool convert_hole_to_undefined =
|
| - (is_js_array && elements_kind == FAST_HOLEY_ELEMENTS &&
|
| - *receiver_map == isolate()->get_initial_js_array_map(elements_kind));
|
| -
|
| - if (receiver_map->has_indexed_interceptor() &&
|
| - !receiver_map->GetIndexedInterceptor()->getter()->IsUndefined(
|
| - isolate()) &&
|
| - !receiver_map->GetIndexedInterceptor()->non_masking()) {
|
| - cached_stub = LoadIndexedInterceptorStub(isolate()).GetCode();
|
| - } else if (IsSloppyArgumentsElements(elements_kind)) {
|
| - cached_stub = KeyedLoadSloppyArgumentsStub(isolate()).GetCode();
|
| - } else if (IsFastElementsKind(elements_kind) ||
|
| - IsFixedTypedArrayElementsKind(elements_kind)) {
|
| - cached_stub = LoadFastElementStub(isolate(), is_js_array, elements_kind,
|
| - convert_hole_to_undefined).GetCode();
|
| - } else {
|
| - DCHECK(elements_kind == DICTIONARY_ELEMENTS);
|
| - cached_stub = LoadDictionaryElementStub(isolate()).GetCode();
|
| - }
|
| - }
|
| -
|
| - handlers->Add(cached_stub);
|
| + handlers->Add(GetKeyedLoadHandler(receiver_maps->at(i), isolate()));
|
| }
|
| }
|
| } // namespace internal
|
|
|