| 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 #if V8_TARGET_ARCH_MIPS64 |    5 #if V8_TARGET_ARCH_MIPS64 | 
|    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  Loading... | 
|  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   DCHECK(!AreAliased(scratch2(), scratch3(), scratch4(), receiver())); |  588   // Build AccessorInfo::args_ list on the stack and push property name below | 
|  589   DCHECK(!AreAliased(scratch2(), scratch3(), scratch4(), reg)); |  589   // the exit frame to make GC aware of them and store pointers to them. | 
|  590  |  590   STATIC_ASSERT(PropertyCallbackArguments::kHolderIndex == 0); | 
|  591   // Build v8::PropertyCallbackInfo::args_ array on the stack and push property |  591   STATIC_ASSERT(PropertyCallbackArguments::kIsolateIndex == 1); | 
|  592   // name below the exit frame to make GC aware of them. |  592   STATIC_ASSERT(PropertyCallbackArguments::kReturnValueDefaultValueIndex == 2); | 
|  593   STATIC_ASSERT(PropertyCallbackArguments::kShouldThrowOnErrorIndex == 0); |  593   STATIC_ASSERT(PropertyCallbackArguments::kReturnValueOffset == 3); | 
|  594   STATIC_ASSERT(PropertyCallbackArguments::kHolderIndex == 1); |  594   STATIC_ASSERT(PropertyCallbackArguments::kDataIndex == 4); | 
|  595   STATIC_ASSERT(PropertyCallbackArguments::kIsolateIndex == 2); |  595   STATIC_ASSERT(PropertyCallbackArguments::kThisIndex == 5); | 
|  596   STATIC_ASSERT(PropertyCallbackArguments::kReturnValueDefaultValueIndex == 3); |  596   STATIC_ASSERT(PropertyCallbackArguments::kArgsLength == 6); | 
|  597   STATIC_ASSERT(PropertyCallbackArguments::kReturnValueOffset == 4); |  597   DCHECK(!scratch2().is(reg)); | 
|  598   STATIC_ASSERT(PropertyCallbackArguments::kDataIndex == 5); |  598   DCHECK(!scratch3().is(reg)); | 
|  599   STATIC_ASSERT(PropertyCallbackArguments::kThisIndex == 6); |  599   DCHECK(!scratch4().is(reg)); | 
|  600   STATIC_ASSERT(PropertyCallbackArguments::kArgsLength == 7); |  600   __ push(receiver()); | 
|  601  |  | 
|  602   // Here and below +1 is for name() pushed after the args_ array. |  | 
|  603   typedef PropertyCallbackArguments PCA; |  | 
|  604   __ Dsubu(sp, sp, (PCA::kArgsLength + 1) * kPointerSize); |  | 
|  605   __ sw(receiver(), MemOperand(sp, (PCA::kThisIndex + 1) * kPointerSize)); |  | 
|  606   Handle<Object> data(callback->data(), isolate()); |  601   Handle<Object> data(callback->data(), isolate()); | 
|  607   if (data->IsUndefined() || data->IsSmi()) { |  602   if (data->IsUndefined() || data->IsSmi()) { | 
|  608     __ li(scratch2(), data); |  603     __ li(scratch3(), data); | 
|  609   } else { |  604   } else { | 
|  610     Handle<WeakCell> cell = |  605     Handle<WeakCell> cell = | 
|  611         isolate()->factory()->NewWeakCell(Handle<HeapObject>::cast(data)); |  606         isolate()->factory()->NewWeakCell(Handle<HeapObject>::cast(data)); | 
|  612     // The callback is alive if this instruction is executed, |  607     // The callback is alive if this instruction is executed, | 
|  613     // so the weak cell is not cleared and points to data. |  608     // so the weak cell is not cleared and points to data. | 
|  614     __ GetWeakValue(scratch2(), cell); |  609     __ GetWeakValue(scratch3(), cell); | 
|  615   } |  610   } | 
|  616   __ sd(scratch2(), MemOperand(sp, (PCA::kDataIndex + 1) * kPointerSize)); |  611   __ Dsubu(sp, sp, 6 * kPointerSize); | 
|  617   __ LoadRoot(scratch2(), Heap::kUndefinedValueRootIndex); |  612   __ sd(scratch3(), MemOperand(sp, 5 * kPointerSize)); | 
|  618   __ sd(scratch2(), |  613   __ LoadRoot(scratch3(), Heap::kUndefinedValueRootIndex); | 
|  619         MemOperand(sp, (PCA::kReturnValueOffset + 1) * kPointerSize)); |  614   __ sd(scratch3(), MemOperand(sp, 4 * kPointerSize)); | 
|  620   __ sd(scratch2(), MemOperand(sp, (PCA::kReturnValueDefaultValueIndex + 1) * |  615   __ sd(scratch3(), MemOperand(sp, 3 * kPointerSize)); | 
|  621                                        kPointerSize)); |  616   __ li(scratch4(), Operand(ExternalReference::isolate_address(isolate()))); | 
|  622   __ li(scratch2(), Operand(ExternalReference::isolate_address(isolate()))); |  617   __ sd(scratch4(), MemOperand(sp, 2 * kPointerSize)); | 
|  623   __ sd(scratch2(), MemOperand(sp, (PCA::kIsolateIndex + 1) * kPointerSize)); |  618   __ sd(reg, MemOperand(sp, 1 * kPointerSize)); | 
|  624   __ sd(reg, MemOperand(sp, (PCA::kHolderIndex + 1) * kPointerSize)); |  619   __ sd(name(), MemOperand(sp, 0 * kPointerSize)); | 
|  625   // should_throw_on_error -> false |  620   __ Daddu(scratch2(), sp, 1 * kPointerSize); | 
|  626   DCHECK(Smi::FromInt(0) == nullptr); |  | 
|  627   __ sd(zero_reg, |  | 
|  628         MemOperand(sp, (PCA::kShouldThrowOnErrorIndex + 1) * kPointerSize)); |  | 
|  629  |  621  | 
|  630   __ sd(name(), MemOperand(sp, 0 * kPointerSize)); |  622   __ mov(a2, scratch2());  // Saved in case scratch2 == a1. | 
|  631  |  | 
|  632   // Abi for CallApiGetter. |  623   // Abi for CallApiGetter. | 
|  633   Register getter_address_reg = ApiGetterDescriptor::function_address(); |  624   Register getter_address_reg = ApiGetterDescriptor::function_address(); | 
|  634  |  625  | 
|  635   Address getter_address = v8::ToCData<Address>(callback->getter()); |  626   Address getter_address = v8::ToCData<Address>(callback->getter()); | 
|  636   ApiFunction fun(getter_address); |  627   ApiFunction fun(getter_address); | 
|  637   ExternalReference::Type type = ExternalReference::DIRECT_GETTER_CALL; |  628   ExternalReference::Type type = ExternalReference::DIRECT_GETTER_CALL; | 
|  638   ExternalReference ref = ExternalReference(&fun, type, isolate()); |  629   ExternalReference ref = ExternalReference(&fun, type, isolate()); | 
|  639   __ li(getter_address_reg, Operand(ref)); |  630   __ li(getter_address_reg, Operand(ref)); | 
|  640  |  631  | 
|  641   CallApiGetterStub stub(isolate()); |  632   CallApiGetterStub stub(isolate()); | 
| (...skipping 65 matching lines...) Expand 10 before | Expand all | Expand 10 after  Loading... | 
|  707   DCHECK(holder()->HasNamedInterceptor()); |  698   DCHECK(holder()->HasNamedInterceptor()); | 
|  708   DCHECK(!holder()->GetNamedInterceptor()->getter()->IsUndefined()); |  699   DCHECK(!holder()->GetNamedInterceptor()->getter()->IsUndefined()); | 
|  709   PushInterceptorArguments(masm(), receiver(), holder_reg, this->name(), |  700   PushInterceptorArguments(masm(), receiver(), holder_reg, this->name(), | 
|  710                            holder()); |  701                            holder()); | 
|  711  |  702  | 
|  712   __ TailCallRuntime(Runtime::kLoadPropertyWithInterceptor); |  703   __ TailCallRuntime(Runtime::kLoadPropertyWithInterceptor); | 
|  713 } |  704 } | 
|  714  |  705  | 
|  715  |  706  | 
|  716 Handle<Code> NamedStoreHandlerCompiler::CompileStoreCallback( |  707 Handle<Code> NamedStoreHandlerCompiler::CompileStoreCallback( | 
|  717     Handle<JSObject> object, Handle<Name> name, Handle<AccessorInfo> callback, |  708     Handle<JSObject> object, Handle<Name> name, Handle<AccessorInfo> callback) { | 
|  718     LanguageMode language_mode) { |  | 
|  719   Register holder_reg = Frontend(name); |  709   Register holder_reg = Frontend(name); | 
|  720  |  710  | 
|  721   __ Push(receiver(), holder_reg);  // Receiver. |  711   __ Push(receiver(), holder_reg);  // Receiver. | 
|  722   // If the callback cannot leak, then push the callback directly, |  712   // If the callback cannot leak, then push the callback directly, | 
|  723   // otherwise wrap it in a weak cell. |  713   // otherwise wrap it in a weak cell. | 
|  724   if (callback->data()->IsUndefined() || callback->data()->IsSmi()) { |  714   if (callback->data()->IsUndefined() || callback->data()->IsSmi()) { | 
|  725     __ li(at, Operand(callback)); |  715     __ li(at, Operand(callback)); | 
|  726   } else { |  716   } else { | 
|  727     Handle<WeakCell> cell = isolate()->factory()->NewWeakCell(callback); |  717     Handle<WeakCell> cell = isolate()->factory()->NewWeakCell(callback); | 
|  728     __ li(at, Operand(cell)); |  718     __ li(at, Operand(cell)); | 
|  729   } |  719   } | 
|  730   __ push(at); |  720   __ push(at); | 
|  731   __ li(at, Operand(name)); |  721   __ li(at, Operand(name)); | 
|  732   __ Push(at, value()); |  722   __ Push(at, value()); | 
|  733   __ Push(Smi::FromInt(language_mode)); |  | 
|  734  |  723  | 
|  735   // Do tail-call to the runtime system. |  724   // Do tail-call to the runtime system. | 
|  736   __ TailCallRuntime(Runtime::kStoreCallbackProperty); |  725   __ TailCallRuntime(Runtime::kStoreCallbackProperty); | 
|  737  |  726  | 
|  738   // Return the generated code. |  727   // Return the generated code. | 
|  739   return GetCode(kind(), Code::FAST, name); |  728   return GetCode(kind(), Code::FAST, name); | 
|  740 } |  729 } | 
|  741  |  730  | 
|  742  |  731  | 
|  743 Handle<Code> NamedStoreHandlerCompiler::CompileStoreInterceptor( |  732 Handle<Code> NamedStoreHandlerCompiler::CompileStoreInterceptor( | 
| (...skipping 47 matching lines...) Expand 10 before | Expand all | Expand 10 after  Loading... | 
|  791   // Return the generated code. |  780   // Return the generated code. | 
|  792   return GetCode(kind(), Code::NORMAL, name); |  781   return GetCode(kind(), Code::NORMAL, name); | 
|  793 } |  782 } | 
|  794  |  783  | 
|  795  |  784  | 
|  796 #undef __ |  785 #undef __ | 
|  797 }  // namespace internal |  786 }  // namespace internal | 
|  798 }  // namespace v8 |  787 }  // namespace v8 | 
|  799  |  788  | 
|  800 #endif  // V8_TARGET_ARCH_MIPS64 |  789 #endif  // V8_TARGET_ARCH_MIPS64 | 
| OLD | NEW |