| 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_MIPS | 5 #if V8_TARGET_ARCH_MIPS |
| 6 | 6 |
| 7 #include "src/ic/handler-compiler.h" | 7 #include "src/ic/handler-compiler.h" |
| 8 | 8 |
| 9 #include "src/api-arguments.h" | 9 #include "src/api-arguments.h" |
| 10 #include "src/field-type.h" | 10 #include "src/field-type.h" |
| (...skipping 178 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 189 } | 189 } |
| 190 | 190 |
| 191 | 191 |
| 192 // Generate code to check that a global property cell is empty. Create | 192 // Generate code to check that a global property cell is empty. Create |
| 193 // the property cell at compilation time if no cell exists for the | 193 // the property cell at compilation time if no cell exists for the |
| 194 // property. | 194 // property. |
| 195 void PropertyHandlerCompiler::GenerateCheckPropertyCell( | 195 void PropertyHandlerCompiler::GenerateCheckPropertyCell( |
| 196 MacroAssembler* masm, Handle<JSGlobalObject> global, Handle<Name> name, | 196 MacroAssembler* masm, Handle<JSGlobalObject> global, Handle<Name> name, |
| 197 Register scratch, Label* miss) { | 197 Register scratch, Label* miss) { |
| 198 Handle<PropertyCell> cell = JSGlobalObject::EnsurePropertyCell(global, name); | 198 Handle<PropertyCell> cell = JSGlobalObject::EnsurePropertyCell(global, name); |
| 199 DCHECK(cell->value()->IsTheHole()); | 199 Isolate* isolate = masm->isolate(); |
| 200 Handle<WeakCell> weak_cell = masm->isolate()->factory()->NewWeakCell(cell); | 200 DCHECK(cell->value()->IsTheHole(isolate)); |
| 201 Handle<WeakCell> weak_cell = isolate->factory()->NewWeakCell(cell); |
| 201 __ LoadWeakValue(scratch, weak_cell, miss); | 202 __ LoadWeakValue(scratch, weak_cell, miss); |
| 202 __ lw(scratch, FieldMemOperand(scratch, PropertyCell::kValueOffset)); | 203 __ lw(scratch, FieldMemOperand(scratch, PropertyCell::kValueOffset)); |
| 203 __ LoadRoot(at, Heap::kTheHoleValueRootIndex); | 204 __ LoadRoot(at, Heap::kTheHoleValueRootIndex); |
| 204 __ Branch(miss, ne, scratch, Operand(at)); | 205 __ Branch(miss, ne, scratch, Operand(at)); |
| 205 } | 206 } |
| 206 | 207 |
| 207 | 208 |
| 208 static void PushInterceptorArguments(MacroAssembler* masm, Register receiver, | 209 static void PushInterceptorArguments(MacroAssembler* masm, Register receiver, |
| 209 Register holder, Register name, | 210 Register holder, Register name, |
| 210 Handle<JSObject> holder_obj) { | 211 Handle<JSObject> holder_obj) { |
| (...skipping 61 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 272 break; | 273 break; |
| 273 case CallOptimization::kHolderNotFound: | 274 case CallOptimization::kHolderNotFound: |
| 274 UNREACHABLE(); | 275 UNREACHABLE(); |
| 275 break; | 276 break; |
| 276 } | 277 } |
| 277 | 278 |
| 278 Isolate* isolate = masm->isolate(); | 279 Isolate* isolate = masm->isolate(); |
| 279 Handle<CallHandlerInfo> api_call_info = optimization.api_call_info(); | 280 Handle<CallHandlerInfo> api_call_info = optimization.api_call_info(); |
| 280 bool call_data_undefined = false; | 281 bool call_data_undefined = false; |
| 281 // Put call data in place. | 282 // Put call data in place. |
| 282 if (api_call_info->data()->IsUndefined()) { | 283 if (api_call_info->data()->IsUndefined(isolate)) { |
| 283 call_data_undefined = true; | 284 call_data_undefined = true; |
| 284 __ LoadRoot(data, Heap::kUndefinedValueRootIndex); | 285 __ LoadRoot(data, Heap::kUndefinedValueRootIndex); |
| 285 } else { | 286 } else { |
| 286 if (optimization.is_constant_call()) { | 287 if (optimization.is_constant_call()) { |
| 287 __ lw(data, | 288 __ lw(data, |
| 288 FieldMemOperand(callee, JSFunction::kSharedFunctionInfoOffset)); | 289 FieldMemOperand(callee, JSFunction::kSharedFunctionInfoOffset)); |
| 289 __ lw(data, | 290 __ lw(data, |
| 290 FieldMemOperand(data, SharedFunctionInfo::kFunctionDataOffset)); | 291 FieldMemOperand(data, SharedFunctionInfo::kFunctionDataOffset)); |
| 291 __ lw(data, FieldMemOperand(data, FunctionTemplateInfo::kCallCodeOffset)); | 292 __ lw(data, FieldMemOperand(data, FunctionTemplateInfo::kCallCodeOffset)); |
| 292 } else { | 293 } else { |
| (...skipping 256 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 549 void NamedLoadHandlerCompiler::GenerateLoadConstant(Handle<Object> value) { | 550 void NamedLoadHandlerCompiler::GenerateLoadConstant(Handle<Object> value) { |
| 550 // Return the constant value. | 551 // Return the constant value. |
| 551 __ li(v0, value); | 552 __ li(v0, value); |
| 552 __ Ret(); | 553 __ Ret(); |
| 553 } | 554 } |
| 554 | 555 |
| 555 | 556 |
| 556 void NamedLoadHandlerCompiler::GenerateLoadInterceptorWithFollowup( | 557 void NamedLoadHandlerCompiler::GenerateLoadInterceptorWithFollowup( |
| 557 LookupIterator* it, Register holder_reg) { | 558 LookupIterator* it, Register holder_reg) { |
| 558 DCHECK(holder()->HasNamedInterceptor()); | 559 DCHECK(holder()->HasNamedInterceptor()); |
| 559 DCHECK(!holder()->GetNamedInterceptor()->getter()->IsUndefined()); | 560 DCHECK(!holder()->GetNamedInterceptor()->getter()->IsUndefined(isolate())); |
| 560 | 561 |
| 561 // Compile the interceptor call, followed by inline code to load the | 562 // Compile the interceptor call, followed by inline code to load the |
| 562 // property from further up the prototype chain if the call fails. | 563 // property from further up the prototype chain if the call fails. |
| 563 // Check that the maps haven't changed. | 564 // Check that the maps haven't changed. |
| 564 DCHECK(holder_reg.is(receiver()) || holder_reg.is(scratch1())); | 565 DCHECK(holder_reg.is(receiver()) || holder_reg.is(scratch1())); |
| 565 | 566 |
| 566 // Preserve the receiver register explicitly whenever it is different from the | 567 // Preserve the receiver register explicitly whenever it is different from the |
| 567 // holder and it is needed should the interceptor return without any result. | 568 // holder and it is needed should the interceptor return without any result. |
| 568 // The ACCESSOR case needs the receiver to be passed into C++ code, the FIELD | 569 // The ACCESSOR case needs the receiver to be passed into C++ code, the FIELD |
| 569 // case might cause a miss during the prototype check. | 570 // case might cause a miss during the prototype check. |
| (...skipping 38 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 608 // Leave the internal frame. | 609 // Leave the internal frame. |
| 609 } | 610 } |
| 610 | 611 |
| 611 GenerateLoadPostInterceptor(it, holder_reg); | 612 GenerateLoadPostInterceptor(it, holder_reg); |
| 612 } | 613 } |
| 613 | 614 |
| 614 | 615 |
| 615 void NamedLoadHandlerCompiler::GenerateLoadInterceptor(Register holder_reg) { | 616 void NamedLoadHandlerCompiler::GenerateLoadInterceptor(Register holder_reg) { |
| 616 // Call the runtime system to load the interceptor. | 617 // Call the runtime system to load the interceptor. |
| 617 DCHECK(holder()->HasNamedInterceptor()); | 618 DCHECK(holder()->HasNamedInterceptor()); |
| 618 DCHECK(!holder()->GetNamedInterceptor()->getter()->IsUndefined()); | 619 DCHECK(!holder()->GetNamedInterceptor()->getter()->IsUndefined(isolate())); |
| 619 PushInterceptorArguments(masm(), receiver(), holder_reg, this->name(), | 620 PushInterceptorArguments(masm(), receiver(), holder_reg, this->name(), |
| 620 holder()); | 621 holder()); |
| 621 | 622 |
| 622 __ TailCallRuntime(Runtime::kLoadPropertyWithInterceptor); | 623 __ TailCallRuntime(Runtime::kLoadPropertyWithInterceptor); |
| 623 } | 624 } |
| 624 | 625 |
| 625 | 626 |
| 626 Handle<Code> NamedStoreHandlerCompiler::CompileStoreCallback( | 627 Handle<Code> NamedStoreHandlerCompiler::CompileStoreCallback( |
| 627 Handle<JSObject> object, Handle<Name> name, Handle<AccessorInfo> callback, | 628 Handle<JSObject> object, Handle<Name> name, Handle<AccessorInfo> callback, |
| 628 LanguageMode language_mode) { | 629 LanguageMode language_mode) { |
| 629 Register holder_reg = Frontend(name); | 630 Register holder_reg = Frontend(name); |
| 630 | 631 |
| 631 __ Push(receiver(), holder_reg); // Receiver. | 632 __ Push(receiver(), holder_reg); // Receiver. |
| 632 // If the callback cannot leak, then push the callback directly, | 633 // If the callback cannot leak, then push the callback directly, |
| 633 // otherwise wrap it in a weak cell. | 634 // otherwise wrap it in a weak cell. |
| 634 if (callback->data()->IsUndefined() || callback->data()->IsSmi()) { | 635 if (callback->data()->IsUndefined(isolate()) || callback->data()->IsSmi()) { |
| 635 __ li(at, Operand(callback)); | 636 __ li(at, Operand(callback)); |
| 636 } else { | 637 } else { |
| 637 Handle<WeakCell> cell = isolate()->factory()->NewWeakCell(callback); | 638 Handle<WeakCell> cell = isolate()->factory()->NewWeakCell(callback); |
| 638 __ li(at, Operand(cell)); | 639 __ li(at, Operand(cell)); |
| 639 } | 640 } |
| 640 __ push(at); | 641 __ push(at); |
| 641 __ li(at, Operand(name)); | 642 __ li(at, Operand(name)); |
| 642 __ Push(at, value()); | 643 __ Push(at, value()); |
| 643 __ Push(Smi::FromInt(language_mode)); | 644 __ Push(Smi::FromInt(language_mode)); |
| 644 | 645 |
| (...skipping 44 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 689 // Return the generated code. | 690 // Return the generated code. |
| 690 return GetCode(kind(), name); | 691 return GetCode(kind(), name); |
| 691 } | 692 } |
| 692 | 693 |
| 693 | 694 |
| 694 #undef __ | 695 #undef __ |
| 695 } // namespace internal | 696 } // namespace internal |
| 696 } // namespace v8 | 697 } // namespace v8 |
| 697 | 698 |
| 698 #endif // V8_TARGET_ARCH_MIPS | 699 #endif // V8_TARGET_ARCH_MIPS |
| OLD | NEW |