Chromium Code Reviews
chromiumcodereview-hr@appspot.gserviceaccount.com (chromiumcodereview-hr) | Please choose your nickname with Settings | Help | Chromium Project | Gerrit Changes | Sign out
(6)

Side by Side Diff: src/ic/mips/handler-compiler-mips.cc

Issue 1587073003: Array length reduction should throw in strict mode if it can't delete an element. (Closed) Base URL: https://chromium.googlesource.com/v8/v8.git@master
Patch Set: Rebasing for relanding Created 4 years, 11 months ago
Use n/p to move between diff chunks; N/P to move between comments. Draft comments are only viewable by you.
Jump to:
View unified diff | Download patch
« no previous file with comments | « src/ic/ic.cc ('k') | src/ic/mips64/handler-compiler-mips64.cc » ('j') | no next file with comments »
Toggle Intra-line Diffs ('i') | Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
OLDNEW
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 #if V8_TARGET_ARCH_MIPS 5 #if V8_TARGET_ARCH_MIPS
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/isolate-inl.h" 10 #include "src/isolate-inl.h"
(...skipping 567 matching lines...) Expand 10 before | Expand all | Expand 10 after
578 578
579 void NamedLoadHandlerCompiler::GenerateLoadConstant(Handle<Object> value) { 579 void NamedLoadHandlerCompiler::GenerateLoadConstant(Handle<Object> value) {
580 // Return the constant value. 580 // Return the constant value.
581 __ li(v0, value); 581 __ li(v0, value);
582 __ Ret(); 582 __ Ret();
583 } 583 }
584 584
585 585
586 void NamedLoadHandlerCompiler::GenerateLoadCallback( 586 void NamedLoadHandlerCompiler::GenerateLoadCallback(
587 Register reg, Handle<AccessorInfo> callback) { 587 Register reg, Handle<AccessorInfo> callback) {
588 // Build AccessorInfo::args_ list on the stack and push property name below 588 DCHECK(!AreAliased(scratch2(), scratch3(), scratch4(), receiver()));
589 // the exit frame to make GC aware of them and store pointers to them. 589 DCHECK(!AreAliased(scratch2(), scratch3(), scratch4(), reg));
590 STATIC_ASSERT(PropertyCallbackArguments::kHolderIndex == 0); 590
591 STATIC_ASSERT(PropertyCallbackArguments::kIsolateIndex == 1); 591 // Build v8::PropertyCallbackInfo::args_ array on the stack and push property
592 STATIC_ASSERT(PropertyCallbackArguments::kReturnValueDefaultValueIndex == 2); 592 // name below the exit frame to make GC aware of them.
593 STATIC_ASSERT(PropertyCallbackArguments::kReturnValueOffset == 3); 593 STATIC_ASSERT(PropertyCallbackArguments::kShouldThrowOnErrorIndex == 0);
594 STATIC_ASSERT(PropertyCallbackArguments::kDataIndex == 4); 594 STATIC_ASSERT(PropertyCallbackArguments::kHolderIndex == 1);
595 STATIC_ASSERT(PropertyCallbackArguments::kThisIndex == 5); 595 STATIC_ASSERT(PropertyCallbackArguments::kIsolateIndex == 2);
596 STATIC_ASSERT(PropertyCallbackArguments::kArgsLength == 6); 596 STATIC_ASSERT(PropertyCallbackArguments::kReturnValueDefaultValueIndex == 3);
597 DCHECK(!scratch2().is(reg)); 597 STATIC_ASSERT(PropertyCallbackArguments::kReturnValueOffset == 4);
598 DCHECK(!scratch3().is(reg)); 598 STATIC_ASSERT(PropertyCallbackArguments::kDataIndex == 5);
599 DCHECK(!scratch4().is(reg)); 599 STATIC_ASSERT(PropertyCallbackArguments::kThisIndex == 6);
600 __ push(receiver()); 600 STATIC_ASSERT(PropertyCallbackArguments::kArgsLength == 7);
601
602 // Here and below +1 is for name() pushed after the args_ array.
603 typedef PropertyCallbackArguments PCA;
604 __ Subu(sp, sp, (PCA::kArgsLength + 1) * kPointerSize);
605 __ sw(receiver(), MemOperand(sp, (PCA::kThisIndex + 1) * kPointerSize));
601 Handle<Object> data(callback->data(), isolate()); 606 Handle<Object> data(callback->data(), isolate());
602 if (data->IsUndefined() || data->IsSmi()) { 607 if (data->IsUndefined() || data->IsSmi()) {
603 __ li(scratch3(), data); 608 __ li(scratch2(), data);
604 } else { 609 } else {
605 Handle<WeakCell> cell = 610 Handle<WeakCell> cell =
606 isolate()->factory()->NewWeakCell(Handle<HeapObject>::cast(data)); 611 isolate()->factory()->NewWeakCell(Handle<HeapObject>::cast(data));
607 // The callback is alive if this instruction is executed, 612 // The callback is alive if this instruction is executed,
608 // so the weak cell is not cleared and points to data. 613 // so the weak cell is not cleared and points to data.
609 __ GetWeakValue(scratch3(), cell); 614 __ GetWeakValue(scratch2(), cell);
610 } 615 }
611 __ Subu(sp, sp, 6 * kPointerSize); 616 __ sw(scratch2(), MemOperand(sp, (PCA::kDataIndex + 1) * kPointerSize));
612 __ sw(scratch3(), MemOperand(sp, 5 * kPointerSize)); 617 __ LoadRoot(scratch2(), Heap::kUndefinedValueRootIndex);
613 __ LoadRoot(scratch3(), Heap::kUndefinedValueRootIndex); 618 __ sw(scratch2(),
614 __ sw(scratch3(), MemOperand(sp, 4 * kPointerSize)); 619 MemOperand(sp, (PCA::kReturnValueOffset + 1) * kPointerSize));
615 __ sw(scratch3(), MemOperand(sp, 3 * kPointerSize)); 620 __ sw(scratch2(), MemOperand(sp, (PCA::kReturnValueDefaultValueIndex + 1) *
616 __ li(scratch4(), Operand(ExternalReference::isolate_address(isolate()))); 621 kPointerSize));
617 __ sw(scratch4(), MemOperand(sp, 2 * kPointerSize)); 622 __ li(scratch2(), Operand(ExternalReference::isolate_address(isolate())));
618 __ sw(reg, MemOperand(sp, 1 * kPointerSize)); 623 __ sw(scratch2(), MemOperand(sp, (PCA::kIsolateIndex + 1) * kPointerSize));
624 __ sw(reg, MemOperand(sp, (PCA::kHolderIndex + 1) * kPointerSize));
625 // should_throw_on_error -> false
626 DCHECK(Smi::FromInt(0) == nullptr);
627 __ sw(zero_reg,
628 MemOperand(sp, (PCA::kShouldThrowOnErrorIndex + 1) * kPointerSize));
629
619 __ sw(name(), MemOperand(sp, 0 * kPointerSize)); 630 __ sw(name(), MemOperand(sp, 0 * kPointerSize));
620 __ Addu(scratch2(), sp, 1 * kPointerSize);
621 631
622 __ mov(a2, scratch2()); // Saved in case scratch2 == a1.
623 // Abi for CallApiGetter. 632 // Abi for CallApiGetter.
624 Register getter_address_reg = ApiGetterDescriptor::function_address(); 633 Register getter_address_reg = ApiGetterDescriptor::function_address();
625 634
626 Address getter_address = v8::ToCData<Address>(callback->getter()); 635 Address getter_address = v8::ToCData<Address>(callback->getter());
627 ApiFunction fun(getter_address); 636 ApiFunction fun(getter_address);
628 ExternalReference::Type type = ExternalReference::DIRECT_GETTER_CALL; 637 ExternalReference::Type type = ExternalReference::DIRECT_GETTER_CALL;
629 ExternalReference ref = ExternalReference(&fun, type, isolate()); 638 ExternalReference ref = ExternalReference(&fun, type, isolate());
630 __ li(getter_address_reg, Operand(ref)); 639 __ li(getter_address_reg, Operand(ref));
631 640
632 CallApiGetterStub stub(isolate()); 641 CallApiGetterStub stub(isolate());
(...skipping 65 matching lines...) Expand 10 before | Expand all | Expand 10 after
698 DCHECK(holder()->HasNamedInterceptor()); 707 DCHECK(holder()->HasNamedInterceptor());
699 DCHECK(!holder()->GetNamedInterceptor()->getter()->IsUndefined()); 708 DCHECK(!holder()->GetNamedInterceptor()->getter()->IsUndefined());
700 PushInterceptorArguments(masm(), receiver(), holder_reg, this->name(), 709 PushInterceptorArguments(masm(), receiver(), holder_reg, this->name(),
701 holder()); 710 holder());
702 711
703 __ TailCallRuntime(Runtime::kLoadPropertyWithInterceptor); 712 __ TailCallRuntime(Runtime::kLoadPropertyWithInterceptor);
704 } 713 }
705 714
706 715
707 Handle<Code> NamedStoreHandlerCompiler::CompileStoreCallback( 716 Handle<Code> NamedStoreHandlerCompiler::CompileStoreCallback(
708 Handle<JSObject> object, Handle<Name> name, Handle<AccessorInfo> callback) { 717 Handle<JSObject> object, Handle<Name> name, Handle<AccessorInfo> callback,
718 LanguageMode language_mode) {
709 Register holder_reg = Frontend(name); 719 Register holder_reg = Frontend(name);
710 720
711 __ Push(receiver(), holder_reg); // Receiver. 721 __ Push(receiver(), holder_reg); // Receiver.
712 // If the callback cannot leak, then push the callback directly, 722 // If the callback cannot leak, then push the callback directly,
713 // otherwise wrap it in a weak cell. 723 // otherwise wrap it in a weak cell.
714 if (callback->data()->IsUndefined() || callback->data()->IsSmi()) { 724 if (callback->data()->IsUndefined() || callback->data()->IsSmi()) {
715 __ li(at, Operand(callback)); 725 __ li(at, Operand(callback));
716 } else { 726 } else {
717 Handle<WeakCell> cell = isolate()->factory()->NewWeakCell(callback); 727 Handle<WeakCell> cell = isolate()->factory()->NewWeakCell(callback);
718 __ li(at, Operand(cell)); 728 __ li(at, Operand(cell));
719 } 729 }
720 __ push(at); 730 __ push(at);
721 __ li(at, Operand(name)); 731 __ li(at, Operand(name));
722 __ Push(at, value()); 732 __ Push(at, value());
733 __ Push(Smi::FromInt(language_mode));
723 734
724 // Do tail-call to the runtime system. 735 // Do tail-call to the runtime system.
725 __ TailCallRuntime(Runtime::kStoreCallbackProperty); 736 __ TailCallRuntime(Runtime::kStoreCallbackProperty);
726 737
727 // Return the generated code. 738 // Return the generated code.
728 return GetCode(kind(), Code::FAST, name); 739 return GetCode(kind(), Code::FAST, name);
729 } 740 }
730 741
731 742
732 Handle<Code> NamedStoreHandlerCompiler::CompileStoreInterceptor( 743 Handle<Code> NamedStoreHandlerCompiler::CompileStoreInterceptor(
(...skipping 47 matching lines...) Expand 10 before | Expand all | Expand 10 after
780 // Return the generated code. 791 // Return the generated code.
781 return GetCode(kind(), Code::NORMAL, name); 792 return GetCode(kind(), Code::NORMAL, name);
782 } 793 }
783 794
784 795
785 #undef __ 796 #undef __
786 } // namespace internal 797 } // namespace internal
787 } // namespace v8 798 } // namespace v8
788 799
789 #endif // V8_TARGET_ARCH_MIPS 800 #endif // V8_TARGET_ARCH_MIPS
OLDNEW
« no previous file with comments | « src/ic/ic.cc ('k') | src/ic/mips64/handler-compiler-mips64.cc » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698