| OLD | NEW |
| 1 // Copyright 2006-2009 the V8 project authors. All rights reserved. | 1 // Copyright 2006-2009 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 483 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 494 if (!maybe_result->ToObject(&result)) return maybe_result; | 494 if (!maybe_result->ToObject(&result)) return maybe_result; |
| 495 } | 495 } |
| 496 } | 496 } |
| 497 return code; | 497 return code; |
| 498 } | 498 } |
| 499 | 499 |
| 500 | 500 |
| 501 MaybeObject* StubCache::ComputeStoreField(String* name, | 501 MaybeObject* StubCache::ComputeStoreField(String* name, |
| 502 JSObject* receiver, | 502 JSObject* receiver, |
| 503 int field_index, | 503 int field_index, |
| 504 Map* transition) { | 504 Map* transition, |
| 505 StrictModeFlag strict_mode) { |
| 505 PropertyType type = (transition == NULL) ? FIELD : MAP_TRANSITION; | 506 PropertyType type = (transition == NULL) ? FIELD : MAP_TRANSITION; |
| 506 Code::Flags flags = Code::ComputeMonomorphicFlags(Code::STORE_IC, type); | 507 Code::Flags flags = Code::ComputeMonomorphicFlags( |
| 508 Code::STORE_IC, type, strict_mode); |
| 507 Object* code = receiver->map()->FindInCodeCache(name, flags); | 509 Object* code = receiver->map()->FindInCodeCache(name, flags); |
| 508 if (code->IsUndefined()) { | 510 if (code->IsUndefined()) { |
| 509 StoreStubCompiler compiler; | 511 StoreStubCompiler compiler(strict_mode); |
| 510 { MaybeObject* maybe_code = | 512 { MaybeObject* maybe_code = |
| 511 compiler.CompileStoreField(receiver, field_index, transition, name); | 513 compiler.CompileStoreField(receiver, field_index, transition, name); |
| 512 if (!maybe_code->ToObject(&code)) return maybe_code; | 514 if (!maybe_code->ToObject(&code)) return maybe_code; |
| 513 } | 515 } |
| 514 PROFILE(CodeCreateEvent(Logger::STORE_IC_TAG, Code::cast(code), name)); | 516 PROFILE(CodeCreateEvent(Logger::STORE_IC_TAG, Code::cast(code), name)); |
| 515 GDBJIT(AddCode(GDBJITInterface::STORE_IC, name, Code::cast(code))); | 517 GDBJIT(AddCode(GDBJITInterface::STORE_IC, name, Code::cast(code))); |
| 516 Object* result; | 518 Object* result; |
| 517 { MaybeObject* maybe_result = | 519 { MaybeObject* maybe_result = |
| 518 receiver->UpdateMapCodeCache(name, Code::cast(code)); | 520 receiver->UpdateMapCodeCache(name, Code::cast(code)); |
| 519 if (!maybe_result->ToObject(&result)) return maybe_result; | 521 if (!maybe_result->ToObject(&result)) return maybe_result; |
| 520 } | 522 } |
| 521 } | 523 } |
| 522 return code; | 524 return code; |
| 523 } | 525 } |
| 524 | 526 |
| 525 | 527 |
| 526 MaybeObject* StubCache::ComputeKeyedStoreSpecialized(JSObject* receiver) { | 528 MaybeObject* StubCache::ComputeKeyedStoreSpecialized( |
| 529 JSObject* receiver, |
| 530 StrictModeFlag strict_mode) { |
| 527 Code::Flags flags = | 531 Code::Flags flags = |
| 528 Code::ComputeMonomorphicFlags(Code::KEYED_STORE_IC, NORMAL); | 532 Code::ComputeMonomorphicFlags(Code::KEYED_STORE_IC, NORMAL, strict_mode); |
| 529 String* name = isolate_->heap()->KeyedStoreSpecialized_symbol(); | 533 String* name = isolate_->heap()->KeyedStoreSpecialized_symbol(); |
| 530 Object* code = receiver->map()->FindInCodeCache(name, flags); | 534 Object* code = receiver->map()->FindInCodeCache(name, flags); |
| 531 if (code->IsUndefined()) { | 535 if (code->IsUndefined()) { |
| 532 KeyedStoreStubCompiler compiler; | 536 KeyedStoreStubCompiler compiler(strict_mode); |
| 533 { MaybeObject* maybe_code = compiler.CompileStoreSpecialized(receiver); | 537 { MaybeObject* maybe_code = compiler.CompileStoreSpecialized(receiver); |
| 534 if (!maybe_code->ToObject(&code)) return maybe_code; | 538 if (!maybe_code->ToObject(&code)) return maybe_code; |
| 535 } | 539 } |
| 536 PROFILE(CodeCreateEvent(Logger::KEYED_STORE_IC_TAG, Code::cast(code), 0)); | 540 PROFILE(CodeCreateEvent(Logger::KEYED_STORE_IC_TAG, Code::cast(code), 0)); |
| 537 Object* result; | 541 Object* result; |
| 538 { MaybeObject* maybe_result = | 542 { MaybeObject* maybe_result = |
| 539 receiver->UpdateMapCodeCache(name, Code::cast(code)); | 543 receiver->UpdateMapCodeCache(name, Code::cast(code)); |
| 540 if (!maybe_result->ToObject(&result)) return maybe_result; | 544 if (!maybe_result->ToObject(&result)) return maybe_result; |
| 541 } | 545 } |
| 542 } | 546 } |
| 543 return code; | 547 return code; |
| 544 } | 548 } |
| 545 | 549 |
| 546 | 550 |
| 551 MaybeObject* StubCache::ComputeKeyedStorePixelArray( |
| 552 JSObject* receiver, |
| 553 StrictModeFlag strict_mode) { |
| 554 // Using NORMAL as the PropertyType for array element stores is a misuse. The |
| 555 // generated stub always accesses fast elements, not slow-mode fields, but |
| 556 // some property type is required for the stub lookup. Note that overloading |
| 557 // the NORMAL PropertyType is only safe as long as no stubs are generated for |
| 558 // other keyed field stores. This is guaranteed to be the case since all field |
| 559 // keyed stores that are not array elements go through a generic builtin stub. |
| 560 Code::Flags flags = |
| 561 Code::ComputeMonomorphicFlags(Code::KEYED_STORE_IC, NORMAL, strict_mode); |
| 562 String* name = isolate_->heap()->KeyedStorePixelArray_symbol(); |
| 563 Object* code = receiver->map()->FindInCodeCache(name, flags); |
| 564 if (code->IsUndefined()) { |
| 565 KeyedStoreStubCompiler compiler(strict_mode); |
| 566 { MaybeObject* maybe_code = compiler.CompileStorePixelArray(receiver); |
| 567 if (!maybe_code->ToObject(&code)) return maybe_code; |
| 568 } |
| 569 PROFILE(CodeCreateEvent(Logger::KEYED_STORE_IC_TAG, Code::cast(code), 0)); |
| 570 Object* result; |
| 571 { MaybeObject* maybe_result = |
| 572 receiver->UpdateMapCodeCache(name, Code::cast(code)); |
| 573 if (!maybe_result->ToObject(&result)) return maybe_result; |
| 574 } |
| 575 } |
| 576 return code; |
| 577 } |
| 578 |
| 579 |
| 547 namespace { | 580 namespace { |
| 548 | 581 |
| 549 ExternalArrayType ElementsKindToExternalArrayType(JSObject::ElementsKind kind) { | 582 ExternalArrayType ElementsKindToExternalArrayType(JSObject::ElementsKind kind) { |
| 550 switch (kind) { | 583 switch (kind) { |
| 551 case JSObject::EXTERNAL_BYTE_ELEMENTS: | 584 case JSObject::EXTERNAL_BYTE_ELEMENTS: |
| 552 return kExternalByteArray; | 585 return kExternalByteArray; |
| 553 case JSObject::EXTERNAL_UNSIGNED_BYTE_ELEMENTS: | 586 case JSObject::EXTERNAL_UNSIGNED_BYTE_ELEMENTS: |
| 554 return kExternalUnsignedByteArray; | 587 return kExternalUnsignedByteArray; |
| 555 case JSObject::EXTERNAL_SHORT_ELEMENTS: | 588 case JSObject::EXTERNAL_SHORT_ELEMENTS: |
| 556 return kExternalShortArray; | 589 return kExternalShortArray; |
| 557 case JSObject::EXTERNAL_UNSIGNED_SHORT_ELEMENTS: | 590 case JSObject::EXTERNAL_UNSIGNED_SHORT_ELEMENTS: |
| 558 return kExternalUnsignedShortArray; | 591 return kExternalUnsignedShortArray; |
| 559 case JSObject::EXTERNAL_INT_ELEMENTS: | 592 case JSObject::EXTERNAL_INT_ELEMENTS: |
| 560 return kExternalIntArray; | 593 return kExternalIntArray; |
| 561 case JSObject::EXTERNAL_UNSIGNED_INT_ELEMENTS: | 594 case JSObject::EXTERNAL_UNSIGNED_INT_ELEMENTS: |
| 562 return kExternalUnsignedIntArray; | 595 return kExternalUnsignedIntArray; |
| 563 case JSObject::EXTERNAL_FLOAT_ELEMENTS: | 596 case JSObject::EXTERNAL_FLOAT_ELEMENTS: |
| 564 return kExternalFloatArray; | 597 return kExternalFloatArray; |
| 565 default: | 598 default: |
| 566 UNREACHABLE(); | 599 UNREACHABLE(); |
| 567 return static_cast<ExternalArrayType>(0); | 600 return static_cast<ExternalArrayType>(0); |
| 568 } | 601 } |
| 569 } | 602 } |
| 570 | 603 |
| 571 } // anonymous namespace | 604 } // anonymous namespace |
| 572 | 605 |
| 573 | 606 |
| 574 MaybeObject* StubCache::ComputeKeyedLoadOrStoreExternalArray( | 607 MaybeObject* StubCache::ComputeKeyedLoadOrStoreExternalArray( |
| 575 JSObject* receiver, | 608 JSObject* receiver, |
| 576 bool is_store) { | 609 bool is_store, |
| 610 StrictModeFlag strict_mode) { |
| 577 Code::Flags flags = | 611 Code::Flags flags = |
| 578 Code::ComputeMonomorphicFlags( | 612 Code::ComputeMonomorphicFlags( |
| 579 is_store ? Code::KEYED_STORE_IC : Code::KEYED_LOAD_IC, | 613 is_store ? Code::KEYED_STORE_IC : Code::KEYED_LOAD_IC, |
| 580 NORMAL); | 614 NORMAL, |
| 615 strict_mode); |
| 581 ExternalArrayType array_type = | 616 ExternalArrayType array_type = |
| 582 ElementsKindToExternalArrayType(receiver->GetElementsKind()); | 617 ElementsKindToExternalArrayType(receiver->GetElementsKind()); |
| 583 String* name = | 618 String* name = |
| 584 is_store ? isolate_->heap()->KeyedStoreExternalArray_symbol() | 619 is_store ? isolate_->heap()->KeyedStoreExternalArray_symbol() |
| 585 : isolate_->heap()->KeyedLoadExternalArray_symbol(); | 620 : isolate_->heap()->KeyedLoadExternalArray_symbol(); |
| 586 // Use the global maps for the particular external array types, | 621 // Use the global maps for the particular external array types, |
| 587 // rather than the receiver's map, when looking up the cached code, | 622 // rather than the receiver's map, when looking up the cached code, |
| 588 // so that we actually canonicalize these stubs. | 623 // so that we actually canonicalize these stubs. |
| 589 Map* map = isolate_->heap()->MapForExternalArrayType(array_type); | 624 Map* map = isolate_->heap()->MapForExternalArrayType(array_type); |
| 590 Object* code = map->FindInCodeCache(name, flags); | 625 Object* code = map->FindInCodeCache(name, flags); |
| 591 if (code->IsUndefined()) { | 626 if (code->IsUndefined()) { |
| 592 ExternalArrayStubCompiler compiler; | 627 ExternalArrayStubCompiler compiler; |
| 593 { MaybeObject* maybe_code = | 628 { MaybeObject* maybe_code = is_store |
| 594 is_store ? compiler.CompileKeyedStoreStub(array_type, flags) : | 629 ? compiler.CompileKeyedStoreStub(array_type, flags) |
| 595 compiler.CompileKeyedLoadStub(array_type, flags); | 630 : compiler.CompileKeyedLoadStub(array_type, flags); |
| 596 if (!maybe_code->ToObject(&code)) return maybe_code; | 631 if (!maybe_code->ToObject(&code)) return maybe_code; |
| 597 } | 632 } |
| 598 if (is_store) { | 633 if (is_store) { |
| 599 PROFILE( | 634 PROFILE( |
| 600 CodeCreateEvent(Logger::KEYED_STORE_IC_TAG, Code::cast(code), 0)); | 635 CodeCreateEvent(Logger::KEYED_STORE_IC_TAG, Code::cast(code), 0)); |
| 601 } else { | 636 } else { |
| 602 PROFILE( | 637 PROFILE( |
| 603 CodeCreateEvent(Logger::KEYED_LOAD_IC_TAG, Code::cast(code), 0)); | 638 CodeCreateEvent(Logger::KEYED_LOAD_IC_TAG, Code::cast(code), 0)); |
| 604 } | 639 } |
| 605 Object* result; | 640 Object* result; |
| 606 { MaybeObject* maybe_result = | 641 { MaybeObject* maybe_result = |
| 607 map->UpdateCodeCache(name, Code::cast(code)); | 642 map->UpdateCodeCache(name, Code::cast(code)); |
| 608 if (!maybe_result->ToObject(&result)) return maybe_result; | 643 if (!maybe_result->ToObject(&result)) return maybe_result; |
| 609 } | 644 } |
| 610 } | 645 } |
| 611 return code; | 646 return code; |
| 612 } | 647 } |
| 613 | 648 |
| 614 | 649 |
| 615 MaybeObject* StubCache::ComputeStoreNormal() { | 650 MaybeObject* StubCache::ComputeStoreNormal(StrictModeFlag strict_mode) { |
| 616 return isolate_->builtins()->builtin(Builtins::StoreIC_Normal); | 651 return isolate_->builtins()->builtin((strict_mode == kStrictMode) |
| 652 ? Builtins::StoreIC_Normal_Strict |
| 653 : Builtins::StoreIC_Normal); |
| 617 } | 654 } |
| 618 | 655 |
| 619 | 656 |
| 620 MaybeObject* StubCache::ComputeStoreGlobal(String* name, | 657 MaybeObject* StubCache::ComputeStoreGlobal(String* name, |
| 621 GlobalObject* receiver, | 658 GlobalObject* receiver, |
| 622 JSGlobalPropertyCell* cell) { | 659 JSGlobalPropertyCell* cell, |
| 623 Code::Flags flags = Code::ComputeMonomorphicFlags(Code::STORE_IC, NORMAL); | 660 StrictModeFlag strict_mode) { |
| 661 Code::Flags flags = Code::ComputeMonomorphicFlags( |
| 662 Code::STORE_IC, NORMAL, strict_mode); |
| 624 Object* code = receiver->map()->FindInCodeCache(name, flags); | 663 Object* code = receiver->map()->FindInCodeCache(name, flags); |
| 625 if (code->IsUndefined()) { | 664 if (code->IsUndefined()) { |
| 626 StoreStubCompiler compiler; | 665 StoreStubCompiler compiler(strict_mode); |
| 627 { MaybeObject* maybe_code = | 666 { MaybeObject* maybe_code = |
| 628 compiler.CompileStoreGlobal(receiver, cell, name); | 667 compiler.CompileStoreGlobal(receiver, cell, name); |
| 629 if (!maybe_code->ToObject(&code)) return maybe_code; | 668 if (!maybe_code->ToObject(&code)) return maybe_code; |
| 630 } | 669 } |
| 631 PROFILE(CodeCreateEvent(Logger::STORE_IC_TAG, Code::cast(code), name)); | 670 PROFILE(CodeCreateEvent(Logger::STORE_IC_TAG, Code::cast(code), name)); |
| 632 GDBJIT(AddCode(GDBJITInterface::STORE_IC, name, Code::cast(code))); | 671 GDBJIT(AddCode(GDBJITInterface::STORE_IC, name, Code::cast(code))); |
| 633 Object* result; | 672 Object* result; |
| 634 { MaybeObject* maybe_result = | 673 { MaybeObject* maybe_result = |
| 635 receiver->UpdateMapCodeCache(name, Code::cast(code)); | 674 receiver->UpdateMapCodeCache(name, Code::cast(code)); |
| 636 if (!maybe_result->ToObject(&result)) return maybe_result; | 675 if (!maybe_result->ToObject(&result)) return maybe_result; |
| 637 } | 676 } |
| 638 } | 677 } |
| 639 return code; | 678 return code; |
| 640 } | 679 } |
| 641 | 680 |
| 642 | 681 |
| 643 MaybeObject* StubCache::ComputeStoreCallback(String* name, | 682 MaybeObject* StubCache::ComputeStoreCallback( |
| 644 JSObject* receiver, | 683 String* name, |
| 645 AccessorInfo* callback) { | 684 JSObject* receiver, |
| 685 AccessorInfo* callback, |
| 686 StrictModeFlag strict_mode) { |
| 646 ASSERT(v8::ToCData<Address>(callback->setter()) != 0); | 687 ASSERT(v8::ToCData<Address>(callback->setter()) != 0); |
| 647 Code::Flags flags = Code::ComputeMonomorphicFlags(Code::STORE_IC, CALLBACKS); | 688 Code::Flags flags = Code::ComputeMonomorphicFlags( |
| 689 Code::STORE_IC, CALLBACKS, strict_mode); |
| 648 Object* code = receiver->map()->FindInCodeCache(name, flags); | 690 Object* code = receiver->map()->FindInCodeCache(name, flags); |
| 649 if (code->IsUndefined()) { | 691 if (code->IsUndefined()) { |
| 650 StoreStubCompiler compiler; | 692 StoreStubCompiler compiler(strict_mode); |
| 651 { MaybeObject* maybe_code = | 693 { MaybeObject* maybe_code = |
| 652 compiler.CompileStoreCallback(receiver, callback, name); | 694 compiler.CompileStoreCallback(receiver, callback, name); |
| 653 if (!maybe_code->ToObject(&code)) return maybe_code; | 695 if (!maybe_code->ToObject(&code)) return maybe_code; |
| 654 } | 696 } |
| 655 PROFILE(CodeCreateEvent(Logger::STORE_IC_TAG, Code::cast(code), name)); | 697 PROFILE(CodeCreateEvent(Logger::STORE_IC_TAG, Code::cast(code), name)); |
| 656 GDBJIT(AddCode(GDBJITInterface::STORE_IC, name, Code::cast(code))); | 698 GDBJIT(AddCode(GDBJITInterface::STORE_IC, name, Code::cast(code))); |
| 657 Object* result; | 699 Object* result; |
| 658 { MaybeObject* maybe_result = | 700 { MaybeObject* maybe_result = |
| 659 receiver->UpdateMapCodeCache(name, Code::cast(code)); | 701 receiver->UpdateMapCodeCache(name, Code::cast(code)); |
| 660 if (!maybe_result->ToObject(&result)) return maybe_result; | 702 if (!maybe_result->ToObject(&result)) return maybe_result; |
| 661 } | 703 } |
| 662 } | 704 } |
| 663 return code; | 705 return code; |
| 664 } | 706 } |
| 665 | 707 |
| 666 | 708 |
| 667 MaybeObject* StubCache::ComputeStoreInterceptor(String* name, | 709 MaybeObject* StubCache::ComputeStoreInterceptor( |
| 668 JSObject* receiver) { | 710 String* name, |
| 669 Code::Flags flags = | 711 JSObject* receiver, |
| 670 Code::ComputeMonomorphicFlags(Code::STORE_IC, INTERCEPTOR); | 712 StrictModeFlag strict_mode) { |
| 713 Code::Flags flags = Code::ComputeMonomorphicFlags( |
| 714 Code::STORE_IC, INTERCEPTOR, strict_mode); |
| 671 Object* code = receiver->map()->FindInCodeCache(name, flags); | 715 Object* code = receiver->map()->FindInCodeCache(name, flags); |
| 672 if (code->IsUndefined()) { | 716 if (code->IsUndefined()) { |
| 673 StoreStubCompiler compiler; | 717 StoreStubCompiler compiler(strict_mode); |
| 674 { MaybeObject* maybe_code = | 718 { MaybeObject* maybe_code = |
| 675 compiler.CompileStoreInterceptor(receiver, name); | 719 compiler.CompileStoreInterceptor(receiver, name); |
| 676 if (!maybe_code->ToObject(&code)) return maybe_code; | 720 if (!maybe_code->ToObject(&code)) return maybe_code; |
| 677 } | 721 } |
| 678 PROFILE(CodeCreateEvent(Logger::STORE_IC_TAG, Code::cast(code), name)); | 722 PROFILE(CodeCreateEvent(Logger::STORE_IC_TAG, Code::cast(code), name)); |
| 679 GDBJIT(AddCode(GDBJITInterface::STORE_IC, name, Code::cast(code))); | 723 GDBJIT(AddCode(GDBJITInterface::STORE_IC, name, Code::cast(code))); |
| 680 Object* result; | 724 Object* result; |
| 681 { MaybeObject* maybe_result = | 725 { MaybeObject* maybe_result = |
| 682 receiver->UpdateMapCodeCache(name, Code::cast(code)); | 726 receiver->UpdateMapCodeCache(name, Code::cast(code)); |
| 683 if (!maybe_result->ToObject(&result)) return maybe_result; | 727 if (!maybe_result->ToObject(&result)) return maybe_result; |
| 684 } | 728 } |
| 685 } | 729 } |
| 686 return code; | 730 return code; |
| 687 } | 731 } |
| 688 | 732 |
| 689 | 733 |
| 690 MaybeObject* StubCache::ComputeKeyedStoreField(String* name, | 734 MaybeObject* StubCache::ComputeKeyedStoreField(String* name, |
| 691 JSObject* receiver, | 735 JSObject* receiver, |
| 692 int field_index, | 736 int field_index, |
| 693 Map* transition) { | 737 Map* transition, |
| 738 StrictModeFlag strict_mode) { |
| 694 PropertyType type = (transition == NULL) ? FIELD : MAP_TRANSITION; | 739 PropertyType type = (transition == NULL) ? FIELD : MAP_TRANSITION; |
| 695 Code::Flags flags = Code::ComputeMonomorphicFlags(Code::KEYED_STORE_IC, type); | 740 Code::Flags flags = Code::ComputeMonomorphicFlags( |
| 741 Code::KEYED_STORE_IC, type, strict_mode); |
| 696 Object* code = receiver->map()->FindInCodeCache(name, flags); | 742 Object* code = receiver->map()->FindInCodeCache(name, flags); |
| 697 if (code->IsUndefined()) { | 743 if (code->IsUndefined()) { |
| 698 KeyedStoreStubCompiler compiler; | 744 KeyedStoreStubCompiler compiler(strict_mode); |
| 699 { MaybeObject* maybe_code = | 745 { MaybeObject* maybe_code = |
| 700 compiler.CompileStoreField(receiver, field_index, transition, name); | 746 compiler.CompileStoreField(receiver, field_index, transition, name); |
| 701 if (!maybe_code->ToObject(&code)) return maybe_code; | 747 if (!maybe_code->ToObject(&code)) return maybe_code; |
| 702 } | 748 } |
| 703 PROFILE(CodeCreateEvent( | 749 PROFILE(CodeCreateEvent( |
| 704 Logger::KEYED_STORE_IC_TAG, Code::cast(code), name)); | 750 Logger::KEYED_STORE_IC_TAG, Code::cast(code), name)); |
| 705 GDBJIT(AddCode(GDBJITInterface::KEYED_STORE_IC, name, Code::cast(code))); | 751 GDBJIT(AddCode(GDBJITInterface::KEYED_STORE_IC, name, Code::cast(code))); |
| 706 Object* result; | 752 Object* result; |
| 707 { MaybeObject* maybe_result = | 753 { MaybeObject* maybe_result = |
| 708 receiver->UpdateMapCodeCache(name, Code::cast(code)); | 754 receiver->UpdateMapCodeCache(name, Code::cast(code)); |
| (...skipping 682 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 1391 RETURN_IF_SCHEDULED_EXCEPTION(isolate); | 1437 RETURN_IF_SCHEDULED_EXCEPTION(isolate); |
| 1392 // This is call IC. In this case, we simply return the undefined result which | 1438 // This is call IC. In this case, we simply return the undefined result which |
| 1393 // will lead to an exception when trying to invoke the result as a | 1439 // will lead to an exception when trying to invoke the result as a |
| 1394 // function. | 1440 // function. |
| 1395 return result; | 1441 return result; |
| 1396 } | 1442 } |
| 1397 | 1443 |
| 1398 | 1444 |
| 1399 MaybeObject* StoreInterceptorProperty(RUNTIME_CALLING_CONVENTION) { | 1445 MaybeObject* StoreInterceptorProperty(RUNTIME_CALLING_CONVENTION) { |
| 1400 RUNTIME_GET_ISOLATE; | 1446 RUNTIME_GET_ISOLATE; |
| 1447 ASSERT(args.length() == 4); |
| 1401 JSObject* recv = JSObject::cast(args[0]); | 1448 JSObject* recv = JSObject::cast(args[0]); |
| 1402 String* name = String::cast(args[1]); | 1449 String* name = String::cast(args[1]); |
| 1403 Object* value = args[2]; | 1450 Object* value = args[2]; |
| 1451 StrictModeFlag strict = |
| 1452 static_cast<StrictModeFlag>(Smi::cast(args[3])->value()); |
| 1453 ASSERT(strict == kStrictMode || strict == kNonStrictMode); |
| 1404 ASSERT(recv->HasNamedInterceptor()); | 1454 ASSERT(recv->HasNamedInterceptor()); |
| 1405 PropertyAttributes attr = NONE; | 1455 PropertyAttributes attr = NONE; |
| 1406 MaybeObject* result = recv->SetPropertyWithInterceptor(name, value, attr); | 1456 MaybeObject* result = recv->SetPropertyWithInterceptor( |
| 1457 name, value, attr, strict); |
| 1407 return result; | 1458 return result; |
| 1408 } | 1459 } |
| 1409 | 1460 |
| 1410 | 1461 |
| 1411 MaybeObject* KeyedLoadPropertyWithInterceptor(RUNTIME_CALLING_CONVENTION) { | 1462 MaybeObject* KeyedLoadPropertyWithInterceptor(RUNTIME_CALLING_CONVENTION) { |
| 1412 RUNTIME_GET_ISOLATE; | 1463 RUNTIME_GET_ISOLATE; |
| 1413 JSObject* receiver = JSObject::cast(args[0]); | 1464 JSObject* receiver = JSObject::cast(args[0]); |
| 1414 ASSERT(Smi::cast(args[1])->value() >= 0); | 1465 ASSERT(Smi::cast(args[1])->value() >= 0); |
| 1415 uint32_t index = Smi::cast(args[1])->value(); | 1466 uint32_t index = Smi::cast(args[1])->value(); |
| 1416 return receiver->GetElementWithInterceptor(receiver, index); | 1467 return receiver->GetElementWithInterceptor(receiver, index); |
| (...skipping 232 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 1649 name)); | 1700 name)); |
| 1650 GDBJIT(AddCode(GDBJITInterface::LOAD_IC, | 1701 GDBJIT(AddCode(GDBJITInterface::LOAD_IC, |
| 1651 name, | 1702 name, |
| 1652 Code::cast(result->ToObjectUnchecked()))); | 1703 Code::cast(result->ToObjectUnchecked()))); |
| 1653 } | 1704 } |
| 1654 return result; | 1705 return result; |
| 1655 } | 1706 } |
| 1656 | 1707 |
| 1657 | 1708 |
| 1658 MaybeObject* StoreStubCompiler::GetCode(PropertyType type, String* name) { | 1709 MaybeObject* StoreStubCompiler::GetCode(PropertyType type, String* name) { |
| 1659 Code::Flags flags = Code::ComputeMonomorphicFlags(Code::STORE_IC, type); | 1710 Code::Flags flags = Code::ComputeMonomorphicFlags( |
| 1711 Code::STORE_IC, type, strict_mode_); |
| 1660 MaybeObject* result = GetCodeWithFlags(flags, name); | 1712 MaybeObject* result = GetCodeWithFlags(flags, name); |
| 1661 if (!result->IsFailure()) { | 1713 if (!result->IsFailure()) { |
| 1662 PROFILE(CodeCreateEvent(Logger::STORE_IC_TAG, | 1714 PROFILE(CodeCreateEvent(Logger::STORE_IC_TAG, |
| 1663 Code::cast(result->ToObjectUnchecked()), | 1715 Code::cast(result->ToObjectUnchecked()), |
| 1664 name)); | 1716 name)); |
| 1665 GDBJIT(AddCode(GDBJITInterface::STORE_IC, | 1717 GDBJIT(AddCode(GDBJITInterface::STORE_IC, |
| 1666 name, | 1718 name, |
| 1667 Code::cast(result->ToObjectUnchecked()))); | 1719 Code::cast(result->ToObjectUnchecked()))); |
| 1668 } | 1720 } |
| 1669 return result; | 1721 return result; |
| 1670 } | 1722 } |
| 1671 | 1723 |
| 1672 | 1724 |
| 1673 MaybeObject* KeyedStoreStubCompiler::GetCode(PropertyType type, String* name) { | 1725 MaybeObject* KeyedStoreStubCompiler::GetCode(PropertyType type, String* name) { |
| 1674 Code::Flags flags = Code::ComputeMonomorphicFlags(Code::KEYED_STORE_IC, type); | 1726 Code::Flags flags = Code::ComputeMonomorphicFlags( |
| 1727 Code::KEYED_STORE_IC, type, strict_mode_); |
| 1675 MaybeObject* result = GetCodeWithFlags(flags, name); | 1728 MaybeObject* result = GetCodeWithFlags(flags, name); |
| 1676 if (!result->IsFailure()) { | 1729 if (!result->IsFailure()) { |
| 1677 PROFILE(CodeCreateEvent(Logger::KEYED_STORE_IC_TAG, | 1730 PROFILE(CodeCreateEvent(Logger::KEYED_STORE_IC_TAG, |
| 1678 Code::cast(result->ToObjectUnchecked()), | 1731 Code::cast(result->ToObjectUnchecked()), |
| 1679 name)); | 1732 name)); |
| 1680 GDBJIT(AddCode(GDBJITInterface::KEYED_STORE_IC, | 1733 GDBJIT(AddCode(GDBJITInterface::KEYED_STORE_IC, |
| 1681 name, | 1734 name, |
| 1682 Code::cast(result->ToObjectUnchecked()))); | 1735 Code::cast(result->ToObjectUnchecked()))); |
| 1683 } | 1736 } |
| 1684 return result; | 1737 return result; |
| (...skipping 150 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 1835 if (!maybe_result->ToObject(&result)) return maybe_result; | 1888 if (!maybe_result->ToObject(&result)) return maybe_result; |
| 1836 } | 1889 } |
| 1837 Code* code = Code::cast(result); | 1890 Code* code = Code::cast(result); |
| 1838 USE(code); | 1891 USE(code); |
| 1839 PROFILE(CodeCreateEvent(Logger::STUB_TAG, code, "ExternalArrayStub")); | 1892 PROFILE(CodeCreateEvent(Logger::STUB_TAG, code, "ExternalArrayStub")); |
| 1840 return result; | 1893 return result; |
| 1841 } | 1894 } |
| 1842 | 1895 |
| 1843 | 1896 |
| 1844 } } // namespace v8::internal | 1897 } } // namespace v8::internal |
| OLD | NEW |