OLD | NEW |
1 // Copyright 2011 the V8 project authors. All rights reserved. | 1 // Copyright 2011 the V8 project authors. All rights reserved. |
2 // Redistribution and use in source and binary forms, with or without | 2 // Redistribution and use in source and binary forms, with or without |
3 // modification, are permitted provided that the following conditions are | 3 // modification, are permitted provided that the following conditions are |
4 // met: | 4 // met: |
5 // | 5 // |
6 // * Redistributions of source code must retain the above copyright | 6 // * Redistributions of source code must retain the above copyright |
7 // notice, this list of conditions and the following disclaimer. | 7 // notice, this list of conditions and the following disclaimer. |
8 // * Redistributions in binary form must reproduce the above | 8 // * Redistributions in binary form must reproduce the above |
9 // copyright notice, this list of conditions and the following | 9 // copyright notice, this list of conditions and the following |
10 // disclaimer in the documentation and/or other materials provided | 10 // disclaimer in the documentation and/or other materials provided |
(...skipping 479 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
490 receiver->UpdateMapCodeCache(name, Code::cast(code)); | 490 receiver->UpdateMapCodeCache(name, Code::cast(code)); |
491 if (!maybe_result->ToObject(&result)) return maybe_result; | 491 if (!maybe_result->ToObject(&result)) return maybe_result; |
492 } | 492 } |
493 } | 493 } |
494 return code; | 494 return code; |
495 } | 495 } |
496 | 496 |
497 | 497 |
498 MaybeObject* StubCache::ComputeKeyedLoadOrStoreElement( | 498 MaybeObject* StubCache::ComputeKeyedLoadOrStoreElement( |
499 JSObject* receiver, | 499 JSObject* receiver, |
500 bool is_store, | 500 KeyedIC::StubKind stub_kind, |
501 StrictModeFlag strict_mode) { | 501 StrictModeFlag strict_mode) { |
502 Code::Flags flags = | 502 Code::Flags flags = |
503 Code::ComputeMonomorphicFlags( | 503 Code::ComputeMonomorphicFlags( |
504 is_store ? Code::KEYED_STORE_IC : | 504 stub_kind == KeyedIC::LOAD ? Code::KEYED_LOAD_IC |
505 Code::KEYED_LOAD_IC, | 505 : Code::KEYED_STORE_IC, |
506 NORMAL, | 506 NORMAL, |
507 strict_mode); | 507 strict_mode); |
508 String* name = is_store | 508 String* name = NULL; |
509 ? isolate()->heap()->KeyedStoreElementMonomorphic_symbol() | 509 switch (stub_kind) { |
510 : isolate()->heap()->KeyedLoadElementMonomorphic_symbol(); | 510 case KeyedIC::LOAD: |
| 511 name = isolate()->heap()->KeyedLoadElementMonomorphic_symbol(); |
| 512 break; |
| 513 case KeyedIC::STORE_NO_TRANSITION: |
| 514 name = isolate()->heap()->KeyedStoreElementMonomorphic_symbol(); |
| 515 break; |
| 516 default: |
| 517 UNREACHABLE(); |
| 518 break; |
| 519 } |
511 Object* maybe_code = receiver->map()->FindInCodeCache(name, flags); | 520 Object* maybe_code = receiver->map()->FindInCodeCache(name, flags); |
512 if (!maybe_code->IsUndefined()) return Code::cast(maybe_code); | 521 if (!maybe_code->IsUndefined()) return Code::cast(maybe_code); |
513 | 522 |
| 523 Map* receiver_map = receiver->map(); |
514 MaybeObject* maybe_new_code = NULL; | 524 MaybeObject* maybe_new_code = NULL; |
515 Map* receiver_map = receiver->map(); | 525 switch (stub_kind) { |
516 if (is_store) { | 526 case KeyedIC::LOAD: { |
517 KeyedStoreStubCompiler compiler(strict_mode); | 527 KeyedLoadStubCompiler compiler; |
518 maybe_new_code = compiler.CompileStoreElement(receiver_map); | 528 maybe_new_code = compiler.CompileLoadElement(receiver_map); |
| 529 break; |
| 530 } |
| 531 case KeyedIC::STORE_NO_TRANSITION: { |
| 532 KeyedStoreStubCompiler compiler(strict_mode); |
| 533 maybe_new_code = compiler.CompileStoreElement(receiver_map); |
| 534 break; |
| 535 } |
| 536 default: |
| 537 UNREACHABLE(); |
| 538 break; |
| 539 } |
| 540 Code* code = NULL; |
| 541 if (!maybe_new_code->To(&code)) return maybe_new_code; |
| 542 |
| 543 if (stub_kind == KeyedIC::LOAD) { |
| 544 PROFILE(isolate_, |
| 545 CodeCreateEvent(Logger::KEYED_LOAD_IC_TAG, |
| 546 Code::cast(code), 0)); |
519 } else { | 547 } else { |
520 KeyedLoadStubCompiler compiler; | |
521 maybe_new_code = compiler.CompileLoadElement(receiver_map); | |
522 } | |
523 Code* code; | |
524 if (!maybe_new_code->To(&code)) return maybe_new_code; | |
525 if (is_store) { | |
526 PROFILE(isolate_, | 548 PROFILE(isolate_, |
527 CodeCreateEvent(Logger::KEYED_STORE_IC_TAG, | 549 CodeCreateEvent(Logger::KEYED_STORE_IC_TAG, |
528 Code::cast(code), 0)); | 550 Code::cast(code), 0)); |
529 } else { | |
530 PROFILE(isolate_, | |
531 CodeCreateEvent(Logger::KEYED_LOAD_IC_TAG, | |
532 Code::cast(code), 0)); | |
533 } | 551 } |
534 ASSERT(code->IsCode()); | 552 ASSERT(code->IsCode()); |
535 Object* result; | 553 Object* result; |
536 { MaybeObject* maybe_result = | 554 { MaybeObject* maybe_result = |
537 receiver->UpdateMapCodeCache(name, Code::cast(code)); | 555 receiver->UpdateMapCodeCache(name, Code::cast(code)); |
538 if (!maybe_result->ToObject(&result)) return maybe_result; | 556 if (!maybe_result->ToObject(&result)) return maybe_result; |
539 } | 557 } |
540 return code; | 558 return code; |
541 } | 559 } |
542 | 560 |
(...skipping 1297 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
1840 expected_receiver_type_ = | 1858 expected_receiver_type_ = |
1841 FunctionTemplateInfo::cast(signature->receiver()); | 1859 FunctionTemplateInfo::cast(signature->receiver()); |
1842 } | 1860 } |
1843 } | 1861 } |
1844 | 1862 |
1845 is_simple_api_call_ = true; | 1863 is_simple_api_call_ = true; |
1846 } | 1864 } |
1847 | 1865 |
1848 | 1866 |
1849 } } // namespace v8::internal | 1867 } } // namespace v8::internal |
OLD | NEW |