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 #if V8_TARGET_ARCH_MIPS | 7 #if V8_TARGET_ARCH_MIPS |
8 | 8 |
9 #include "src/ic/call-optimization.h" | 9 #include "src/ic/call-optimization.h" |
10 #include "src/ic/handler-compiler.h" | 10 #include "src/ic/handler-compiler.h" |
(...skipping 541 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
552 STATIC_ASSERT(PropertyCallbackArguments::kIsolateIndex == 1); | 552 STATIC_ASSERT(PropertyCallbackArguments::kIsolateIndex == 1); |
553 STATIC_ASSERT(PropertyCallbackArguments::kReturnValueDefaultValueIndex == 2); | 553 STATIC_ASSERT(PropertyCallbackArguments::kReturnValueDefaultValueIndex == 2); |
554 STATIC_ASSERT(PropertyCallbackArguments::kReturnValueOffset == 3); | 554 STATIC_ASSERT(PropertyCallbackArguments::kReturnValueOffset == 3); |
555 STATIC_ASSERT(PropertyCallbackArguments::kDataIndex == 4); | 555 STATIC_ASSERT(PropertyCallbackArguments::kDataIndex == 4); |
556 STATIC_ASSERT(PropertyCallbackArguments::kThisIndex == 5); | 556 STATIC_ASSERT(PropertyCallbackArguments::kThisIndex == 5); |
557 STATIC_ASSERT(PropertyCallbackArguments::kArgsLength == 6); | 557 STATIC_ASSERT(PropertyCallbackArguments::kArgsLength == 6); |
558 DCHECK(!scratch2().is(reg)); | 558 DCHECK(!scratch2().is(reg)); |
559 DCHECK(!scratch3().is(reg)); | 559 DCHECK(!scratch3().is(reg)); |
560 DCHECK(!scratch4().is(reg)); | 560 DCHECK(!scratch4().is(reg)); |
561 __ push(receiver()); | 561 __ push(receiver()); |
562 if (heap()->InNewSpace(callback->data())) { | 562 Handle<Object> data(callback->data(), isolate()); |
563 __ li(scratch3(), callback); | 563 if (data->IsUndefined() || data->IsSmi()) { |
564 __ lw(scratch3(), | 564 __ li(scratch3(), data); |
565 FieldMemOperand(scratch3(), ExecutableAccessorInfo::kDataOffset)); | |
566 } else { | 565 } else { |
567 __ li(scratch3(), Handle<Object>(callback->data(), isolate())); | 566 Handle<WeakCell> cell = |
| 567 isolate()->factory()->NewWeakCell(Handle<HeapObject>::cast(data)); |
| 568 // The callback is alive if this instruction is executed, |
| 569 // so the weak cell is not cleared and points to data. |
| 570 __ GetWeakValue(scratch3(), cell); |
568 } | 571 } |
569 __ Subu(sp, sp, 6 * kPointerSize); | 572 __ Subu(sp, sp, 6 * kPointerSize); |
570 __ sw(scratch3(), MemOperand(sp, 5 * kPointerSize)); | 573 __ sw(scratch3(), MemOperand(sp, 5 * kPointerSize)); |
571 __ LoadRoot(scratch3(), Heap::kUndefinedValueRootIndex); | 574 __ LoadRoot(scratch3(), Heap::kUndefinedValueRootIndex); |
572 __ sw(scratch3(), MemOperand(sp, 4 * kPointerSize)); | 575 __ sw(scratch3(), MemOperand(sp, 4 * kPointerSize)); |
573 __ sw(scratch3(), MemOperand(sp, 3 * kPointerSize)); | 576 __ sw(scratch3(), MemOperand(sp, 3 * kPointerSize)); |
574 __ li(scratch4(), Operand(ExternalReference::isolate_address(isolate()))); | 577 __ li(scratch4(), Operand(ExternalReference::isolate_address(isolate()))); |
575 __ sw(scratch4(), MemOperand(sp, 2 * kPointerSize)); | 578 __ sw(scratch4(), MemOperand(sp, 2 * kPointerSize)); |
576 __ sw(reg, MemOperand(sp, 1 * kPointerSize)); | 579 __ sw(reg, MemOperand(sp, 1 * kPointerSize)); |
577 __ sw(name(), MemOperand(sp, 0 * kPointerSize)); | 580 __ sw(name(), MemOperand(sp, 0 * kPointerSize)); |
(...skipping 161 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
739 // Return the generated code. | 742 // Return the generated code. |
740 return GetCode(kind(), Code::NORMAL, name); | 743 return GetCode(kind(), Code::NORMAL, name); |
741 } | 744 } |
742 | 745 |
743 | 746 |
744 #undef __ | 747 #undef __ |
745 } | 748 } |
746 } // namespace v8::internal | 749 } // namespace v8::internal |
747 | 750 |
748 #endif // V8_TARGET_ARCH_MIPS | 751 #endif // V8_TARGET_ARCH_MIPS |
OLD | NEW |