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/ic/call-optimization.h" | 7 #include "src/ic/call-optimization.h" |
8 #include "src/ic/handler-compiler.h" | 8 #include "src/ic/handler-compiler.h" |
9 #include "src/ic/ic.h" | 9 #include "src/ic/ic.h" |
10 #include "src/ic/ic-inl.h" | 10 #include "src/ic/ic-inl.h" |
(...skipping 397 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
408 | 408 |
409 #undef __ | 409 #undef __ |
410 | 410 |
411 | 411 |
412 void ElementHandlerCompiler::CompileElementHandlers( | 412 void ElementHandlerCompiler::CompileElementHandlers( |
413 MapHandleList* receiver_maps, CodeHandleList* handlers) { | 413 MapHandleList* receiver_maps, CodeHandleList* handlers) { |
414 for (int i = 0; i < receiver_maps->length(); ++i) { | 414 for (int i = 0; i < receiver_maps->length(); ++i) { |
415 Handle<Map> receiver_map = receiver_maps->at(i); | 415 Handle<Map> receiver_map = receiver_maps->at(i); |
416 Handle<Code> cached_stub; | 416 Handle<Code> cached_stub; |
417 | 417 |
418 if ((receiver_map->instance_type() & kNotStringTag) == 0) { | 418 if (receiver_map->IsStringMap()) { |
419 cached_stub = isolate()->builtins()->KeyedLoadIC_String(); | 419 cached_stub = LoadIndexedStringStub(isolate()).GetCode(); |
420 } else if (receiver_map->instance_type() < FIRST_JS_RECEIVER_TYPE) { | 420 } else if (receiver_map->instance_type() < FIRST_JS_RECEIVER_TYPE) { |
421 cached_stub = isolate()->builtins()->KeyedLoadIC_Slow(); | 421 cached_stub = isolate()->builtins()->KeyedLoadIC_Slow(); |
422 } else { | 422 } else { |
423 bool is_js_array = receiver_map->instance_type() == JS_ARRAY_TYPE; | 423 bool is_js_array = receiver_map->instance_type() == JS_ARRAY_TYPE; |
424 ElementsKind elements_kind = receiver_map->elements_kind(); | 424 ElementsKind elements_kind = receiver_map->elements_kind(); |
425 if (receiver_map->has_indexed_interceptor()) { | 425 if (receiver_map->has_indexed_interceptor()) { |
426 cached_stub = LoadIndexedInterceptorStub(isolate()).GetCode(); | 426 cached_stub = LoadIndexedInterceptorStub(isolate()).GetCode(); |
427 } else if (IsSloppyArgumentsElements(elements_kind)) { | 427 } else if (IsSloppyArgumentsElements(elements_kind)) { |
428 cached_stub = KeyedLoadSloppyArgumentsStub(isolate()).GetCode(); | 428 cached_stub = KeyedLoadSloppyArgumentsStub(isolate()).GetCode(); |
429 } else if (IsFastElementsKind(elements_kind) || | 429 } else if (IsFastElementsKind(elements_kind) || |
430 IsExternalArrayElementsKind(elements_kind) || | 430 IsExternalArrayElementsKind(elements_kind) || |
431 IsFixedTypedArrayElementsKind(elements_kind)) { | 431 IsFixedTypedArrayElementsKind(elements_kind)) { |
432 cached_stub = LoadFastElementStub(isolate(), is_js_array, elements_kind) | 432 cached_stub = LoadFastElementStub(isolate(), is_js_array, elements_kind) |
433 .GetCode(); | 433 .GetCode(); |
434 } else { | 434 } else { |
435 DCHECK(elements_kind == DICTIONARY_ELEMENTS); | 435 DCHECK(elements_kind == DICTIONARY_ELEMENTS); |
436 cached_stub = LoadDictionaryElementStub(isolate()).GetCode(); | 436 cached_stub = LoadDictionaryElementStub(isolate()).GetCode(); |
437 } | 437 } |
438 } | 438 } |
439 | 439 |
440 handlers->Add(cached_stub); | 440 handlers->Add(cached_stub); |
441 } | 441 } |
442 } | 442 } |
443 } | 443 } |
444 } // namespace v8::internal | 444 } // namespace v8::internal |
OLD | NEW |