| 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_PPC | 5 #if V8_TARGET_ARCH_PPC |
| 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 181 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 192 } | 192 } |
| 193 | 193 |
| 194 | 194 |
| 195 // Generate code to check that a global property cell is empty. Create | 195 // Generate code to check that a global property cell is empty. Create |
| 196 // the property cell at compilation time if no cell exists for the | 196 // the property cell at compilation time if no cell exists for the |
| 197 // property. | 197 // property. |
| 198 void PropertyHandlerCompiler::GenerateCheckPropertyCell( | 198 void PropertyHandlerCompiler::GenerateCheckPropertyCell( |
| 199 MacroAssembler* masm, Handle<JSGlobalObject> global, Handle<Name> name, | 199 MacroAssembler* masm, Handle<JSGlobalObject> global, Handle<Name> name, |
| 200 Register scratch, Label* miss) { | 200 Register scratch, Label* miss) { |
| 201 Handle<PropertyCell> cell = JSGlobalObject::EnsurePropertyCell(global, name); | 201 Handle<PropertyCell> cell = JSGlobalObject::EnsurePropertyCell(global, name); |
| 202 DCHECK(cell->value()->IsTheHole()); | 202 Isolate* isolate = masm->isolate(); |
| 203 Handle<WeakCell> weak_cell = masm->isolate()->factory()->NewWeakCell(cell); | 203 DCHECK(cell->value()->IsTheHole(isolate)); |
| 204 Handle<WeakCell> weak_cell = isolate->factory()->NewWeakCell(cell); |
| 204 __ LoadWeakValue(scratch, weak_cell, miss); | 205 __ LoadWeakValue(scratch, weak_cell, miss); |
| 205 __ LoadP(scratch, FieldMemOperand(scratch, PropertyCell::kValueOffset)); | 206 __ LoadP(scratch, FieldMemOperand(scratch, PropertyCell::kValueOffset)); |
| 206 __ LoadRoot(ip, Heap::kTheHoleValueRootIndex); | 207 __ LoadRoot(ip, Heap::kTheHoleValueRootIndex); |
| 207 __ cmp(scratch, ip); | 208 __ cmp(scratch, ip); |
| 208 __ bne(miss); | 209 __ bne(miss); |
| 209 } | 210 } |
| 210 | 211 |
| 211 | 212 |
| 212 static void PushInterceptorArguments(MacroAssembler* masm, Register receiver, | 213 static void PushInterceptorArguments(MacroAssembler* masm, Register receiver, |
| 213 Register holder, Register name, | 214 Register holder, Register name, |
| (...skipping 64 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 278 break; | 279 break; |
| 279 case CallOptimization::kHolderNotFound: | 280 case CallOptimization::kHolderNotFound: |
| 280 UNREACHABLE(); | 281 UNREACHABLE(); |
| 281 break; | 282 break; |
| 282 } | 283 } |
| 283 | 284 |
| 284 Isolate* isolate = masm->isolate(); | 285 Isolate* isolate = masm->isolate(); |
| 285 Handle<CallHandlerInfo> api_call_info = optimization.api_call_info(); | 286 Handle<CallHandlerInfo> api_call_info = optimization.api_call_info(); |
| 286 bool call_data_undefined = false; | 287 bool call_data_undefined = false; |
| 287 // Put call data in place. | 288 // Put call data in place. |
| 288 if (api_call_info->data()->IsUndefined()) { | 289 if (api_call_info->data()->IsUndefined(isolate)) { |
| 289 call_data_undefined = true; | 290 call_data_undefined = true; |
| 290 __ LoadRoot(data, Heap::kUndefinedValueRootIndex); | 291 __ LoadRoot(data, Heap::kUndefinedValueRootIndex); |
| 291 } else { | 292 } else { |
| 292 if (optimization.is_constant_call()) { | 293 if (optimization.is_constant_call()) { |
| 293 __ LoadP(data, | 294 __ LoadP(data, |
| 294 FieldMemOperand(callee, JSFunction::kSharedFunctionInfoOffset)); | 295 FieldMemOperand(callee, JSFunction::kSharedFunctionInfoOffset)); |
| 295 __ LoadP(data, | 296 __ LoadP(data, |
| 296 FieldMemOperand(data, SharedFunctionInfo::kFunctionDataOffset)); | 297 FieldMemOperand(data, SharedFunctionInfo::kFunctionDataOffset)); |
| 297 __ LoadP(data, | 298 __ LoadP(data, |
| 298 FieldMemOperand(data, FunctionTemplateInfo::kCallCodeOffset)); | 299 FieldMemOperand(data, FunctionTemplateInfo::kCallCodeOffset)); |
| (...skipping 258 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 557 void NamedLoadHandlerCompiler::GenerateLoadConstant(Handle<Object> value) { | 558 void NamedLoadHandlerCompiler::GenerateLoadConstant(Handle<Object> value) { |
| 558 // Return the constant value. | 559 // Return the constant value. |
| 559 __ Move(r3, value); | 560 __ Move(r3, value); |
| 560 __ Ret(); | 561 __ Ret(); |
| 561 } | 562 } |
| 562 | 563 |
| 563 | 564 |
| 564 void NamedLoadHandlerCompiler::GenerateLoadInterceptorWithFollowup( | 565 void NamedLoadHandlerCompiler::GenerateLoadInterceptorWithFollowup( |
| 565 LookupIterator* it, Register holder_reg) { | 566 LookupIterator* it, Register holder_reg) { |
| 566 DCHECK(holder()->HasNamedInterceptor()); | 567 DCHECK(holder()->HasNamedInterceptor()); |
| 567 DCHECK(!holder()->GetNamedInterceptor()->getter()->IsUndefined()); | 568 DCHECK(!holder()->GetNamedInterceptor()->getter()->IsUndefined(isolate())); |
| 568 | 569 |
| 569 // Compile the interceptor call, followed by inline code to load the | 570 // Compile the interceptor call, followed by inline code to load the |
| 570 // property from further up the prototype chain if the call fails. | 571 // property from further up the prototype chain if the call fails. |
| 571 // Check that the maps haven't changed. | 572 // Check that the maps haven't changed. |
| 572 DCHECK(holder_reg.is(receiver()) || holder_reg.is(scratch1())); | 573 DCHECK(holder_reg.is(receiver()) || holder_reg.is(scratch1())); |
| 573 | 574 |
| 574 // Preserve the receiver register explicitly whenever it is different from the | 575 // Preserve the receiver register explicitly whenever it is different from the |
| 575 // holder and it is needed should the interceptor return without any result. | 576 // holder and it is needed should the interceptor return without any result. |
| 576 // The ACCESSOR case needs the receiver to be passed into C++ code, the FIELD | 577 // The ACCESSOR case needs the receiver to be passed into C++ code, the FIELD |
| 577 // case might cause a miss during the prototype check. | 578 // case might cause a miss during the prototype check. |
| (...skipping 39 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 617 // Leave the internal frame. | 618 // Leave the internal frame. |
| 618 } | 619 } |
| 619 | 620 |
| 620 GenerateLoadPostInterceptor(it, holder_reg); | 621 GenerateLoadPostInterceptor(it, holder_reg); |
| 621 } | 622 } |
| 622 | 623 |
| 623 | 624 |
| 624 void NamedLoadHandlerCompiler::GenerateLoadInterceptor(Register holder_reg) { | 625 void NamedLoadHandlerCompiler::GenerateLoadInterceptor(Register holder_reg) { |
| 625 // Call the runtime system to load the interceptor. | 626 // Call the runtime system to load the interceptor. |
| 626 DCHECK(holder()->HasNamedInterceptor()); | 627 DCHECK(holder()->HasNamedInterceptor()); |
| 627 DCHECK(!holder()->GetNamedInterceptor()->getter()->IsUndefined()); | 628 DCHECK(!holder()->GetNamedInterceptor()->getter()->IsUndefined(isolate())); |
| 628 PushInterceptorArguments(masm(), receiver(), holder_reg, this->name(), | 629 PushInterceptorArguments(masm(), receiver(), holder_reg, this->name(), |
| 629 holder()); | 630 holder()); |
| 630 | 631 |
| 631 __ TailCallRuntime(Runtime::kLoadPropertyWithInterceptor); | 632 __ TailCallRuntime(Runtime::kLoadPropertyWithInterceptor); |
| 632 } | 633 } |
| 633 | 634 |
| 634 | 635 |
| 635 Handle<Code> NamedStoreHandlerCompiler::CompileStoreCallback( | 636 Handle<Code> NamedStoreHandlerCompiler::CompileStoreCallback( |
| 636 Handle<JSObject> object, Handle<Name> name, Handle<AccessorInfo> callback, | 637 Handle<JSObject> object, Handle<Name> name, Handle<AccessorInfo> callback, |
| 637 LanguageMode language_mode) { | 638 LanguageMode language_mode) { |
| 638 Register holder_reg = Frontend(name); | 639 Register holder_reg = Frontend(name); |
| 639 | 640 |
| 640 __ Push(receiver(), holder_reg); // receiver | 641 __ Push(receiver(), holder_reg); // receiver |
| 641 | 642 |
| 642 // If the callback cannot leak, then push the callback directly, | 643 // If the callback cannot leak, then push the callback directly, |
| 643 // otherwise wrap it in a weak cell. | 644 // otherwise wrap it in a weak cell. |
| 644 if (callback->data()->IsUndefined() || callback->data()->IsSmi()) { | 645 if (callback->data()->IsUndefined(isolate()) || callback->data()->IsSmi()) { |
| 645 __ mov(ip, Operand(callback)); | 646 __ mov(ip, Operand(callback)); |
| 646 } else { | 647 } else { |
| 647 Handle<WeakCell> cell = isolate()->factory()->NewWeakCell(callback); | 648 Handle<WeakCell> cell = isolate()->factory()->NewWeakCell(callback); |
| 648 __ mov(ip, Operand(cell)); | 649 __ mov(ip, Operand(cell)); |
| 649 } | 650 } |
| 650 __ push(ip); | 651 __ push(ip); |
| 651 __ mov(ip, Operand(name)); | 652 __ mov(ip, Operand(name)); |
| 652 __ Push(ip, value()); | 653 __ Push(ip, value()); |
| 653 __ Push(Smi::FromInt(language_mode)); | 654 __ Push(Smi::FromInt(language_mode)); |
| 654 | 655 |
| (...skipping 43 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 698 // Return the generated code. | 699 // Return the generated code. |
| 699 return GetCode(kind(), name); | 700 return GetCode(kind(), name); |
| 700 } | 701 } |
| 701 | 702 |
| 702 | 703 |
| 703 #undef __ | 704 #undef __ |
| 704 } // namespace internal | 705 } // namespace internal |
| 705 } // namespace v8 | 706 } // namespace v8 |
| 706 | 707 |
| 707 #endif // V8_TARGET_ARCH_ARM | 708 #endif // V8_TARGET_ARCH_ARM |
| OLD | NEW |