| OLD | NEW |
| 1 // Copyright 2015 the V8 project authors. All rights reserved. | 1 // Copyright 2015 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_S390 | 5 #if V8_TARGET_ARCH_S390 |
| 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 170 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 181 __ Ret(); | 181 __ Ret(); |
| 182 } | 182 } |
| 183 | 183 |
| 184 // Generate code to check that a global property cell is empty. Create | 184 // Generate code to check that a global property cell is empty. Create |
| 185 // the property cell at compilation time if no cell exists for the | 185 // the property cell at compilation time if no cell exists for the |
| 186 // property. | 186 // property. |
| 187 void PropertyHandlerCompiler::GenerateCheckPropertyCell( | 187 void PropertyHandlerCompiler::GenerateCheckPropertyCell( |
| 188 MacroAssembler* masm, Handle<JSGlobalObject> global, Handle<Name> name, | 188 MacroAssembler* masm, Handle<JSGlobalObject> global, Handle<Name> name, |
| 189 Register scratch, Label* miss) { | 189 Register scratch, Label* miss) { |
| 190 Handle<PropertyCell> cell = JSGlobalObject::EnsurePropertyCell(global, name); | 190 Handle<PropertyCell> cell = JSGlobalObject::EnsurePropertyCell(global, name); |
| 191 DCHECK(cell->value()->IsTheHole()); | 191 Isolate* isolate = masm->isolate(); |
| 192 Handle<WeakCell> weak_cell = masm->isolate()->factory()->NewWeakCell(cell); | 192 DCHECK(cell->value()->IsTheHole(isolate)); |
| 193 Handle<WeakCell> weak_cell = isolate->factory()->NewWeakCell(cell); |
| 193 __ LoadWeakValue(scratch, weak_cell, miss); | 194 __ LoadWeakValue(scratch, weak_cell, miss); |
| 194 __ LoadP(scratch, FieldMemOperand(scratch, PropertyCell::kValueOffset)); | 195 __ LoadP(scratch, FieldMemOperand(scratch, PropertyCell::kValueOffset)); |
| 195 __ CompareRoot(scratch, Heap::kTheHoleValueRootIndex); | 196 __ CompareRoot(scratch, Heap::kTheHoleValueRootIndex); |
| 196 __ bne(miss); | 197 __ bne(miss); |
| 197 } | 198 } |
| 198 | 199 |
| 199 static void PushInterceptorArguments(MacroAssembler* masm, Register receiver, | 200 static void PushInterceptorArguments(MacroAssembler* masm, Register receiver, |
| 200 Register holder, Register name, | 201 Register holder, Register name, |
| 201 Handle<JSObject> holder_obj) { | 202 Handle<JSObject> holder_obj) { |
| 202 STATIC_ASSERT(NamedLoadHandlerCompiler::kInterceptorArgsNameIndex == 0); | 203 STATIC_ASSERT(NamedLoadHandlerCompiler::kInterceptorArgsNameIndex == 0); |
| (...skipping 60 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 263 break; | 264 break; |
| 264 case CallOptimization::kHolderNotFound: | 265 case CallOptimization::kHolderNotFound: |
| 265 UNREACHABLE(); | 266 UNREACHABLE(); |
| 266 break; | 267 break; |
| 267 } | 268 } |
| 268 | 269 |
| 269 Isolate* isolate = masm->isolate(); | 270 Isolate* isolate = masm->isolate(); |
| 270 Handle<CallHandlerInfo> api_call_info = optimization.api_call_info(); | 271 Handle<CallHandlerInfo> api_call_info = optimization.api_call_info(); |
| 271 bool call_data_undefined = false; | 272 bool call_data_undefined = false; |
| 272 // Put call data in place. | 273 // Put call data in place. |
| 273 if (api_call_info->data()->IsUndefined()) { | 274 if (api_call_info->data()->IsUndefined(isolate)) { |
| 274 call_data_undefined = true; | 275 call_data_undefined = true; |
| 275 __ LoadRoot(data, Heap::kUndefinedValueRootIndex); | 276 __ LoadRoot(data, Heap::kUndefinedValueRootIndex); |
| 276 } else { | 277 } else { |
| 277 if (optimization.is_constant_call()) { | 278 if (optimization.is_constant_call()) { |
| 278 __ LoadP(data, | 279 __ LoadP(data, |
| 279 FieldMemOperand(callee, JSFunction::kSharedFunctionInfoOffset)); | 280 FieldMemOperand(callee, JSFunction::kSharedFunctionInfoOffset)); |
| 280 __ LoadP(data, | 281 __ LoadP(data, |
| 281 FieldMemOperand(data, SharedFunctionInfo::kFunctionDataOffset)); | 282 FieldMemOperand(data, SharedFunctionInfo::kFunctionDataOffset)); |
| 282 __ LoadP(data, | 283 __ LoadP(data, |
| 283 FieldMemOperand(data, FunctionTemplateInfo::kCallCodeOffset)); | 284 FieldMemOperand(data, FunctionTemplateInfo::kCallCodeOffset)); |
| (...skipping 243 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 527 | 528 |
| 528 void NamedLoadHandlerCompiler::GenerateLoadConstant(Handle<Object> value) { | 529 void NamedLoadHandlerCompiler::GenerateLoadConstant(Handle<Object> value) { |
| 529 // Return the constant value. | 530 // Return the constant value. |
| 530 __ Move(r2, value); | 531 __ Move(r2, value); |
| 531 __ Ret(); | 532 __ Ret(); |
| 532 } | 533 } |
| 533 | 534 |
| 534 void NamedLoadHandlerCompiler::GenerateLoadInterceptorWithFollowup( | 535 void NamedLoadHandlerCompiler::GenerateLoadInterceptorWithFollowup( |
| 535 LookupIterator* it, Register holder_reg) { | 536 LookupIterator* it, Register holder_reg) { |
| 536 DCHECK(holder()->HasNamedInterceptor()); | 537 DCHECK(holder()->HasNamedInterceptor()); |
| 537 DCHECK(!holder()->GetNamedInterceptor()->getter()->IsUndefined()); | 538 DCHECK(!holder()->GetNamedInterceptor()->getter()->IsUndefined(isolate())); |
| 538 | 539 |
| 539 // Compile the interceptor call, followed by inline code to load the | 540 // Compile the interceptor call, followed by inline code to load the |
| 540 // property from further up the prototype chain if the call fails. | 541 // property from further up the prototype chain if the call fails. |
| 541 // Check that the maps haven't changed. | 542 // Check that the maps haven't changed. |
| 542 DCHECK(holder_reg.is(receiver()) || holder_reg.is(scratch1())); | 543 DCHECK(holder_reg.is(receiver()) || holder_reg.is(scratch1())); |
| 543 | 544 |
| 544 // Preserve the receiver register explicitly whenever it is different from the | 545 // Preserve the receiver register explicitly whenever it is different from the |
| 545 // holder and it is needed should the interceptor return without any result. | 546 // holder and it is needed should the interceptor return without any result. |
| 546 // The ACCESSOR case needs the receiver to be passed into C++ code, the FIELD | 547 // The ACCESSOR case needs the receiver to be passed into C++ code, the FIELD |
| 547 // case might cause a miss during the prototype check. | 548 // case might cause a miss during the prototype check. |
| (...skipping 37 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 585 } | 586 } |
| 586 // Leave the internal frame. | 587 // Leave the internal frame. |
| 587 } | 588 } |
| 588 | 589 |
| 589 GenerateLoadPostInterceptor(it, holder_reg); | 590 GenerateLoadPostInterceptor(it, holder_reg); |
| 590 } | 591 } |
| 591 | 592 |
| 592 void NamedLoadHandlerCompiler::GenerateLoadInterceptor(Register holder_reg) { | 593 void NamedLoadHandlerCompiler::GenerateLoadInterceptor(Register holder_reg) { |
| 593 // Call the runtime system to load the interceptor. | 594 // Call the runtime system to load the interceptor. |
| 594 DCHECK(holder()->HasNamedInterceptor()); | 595 DCHECK(holder()->HasNamedInterceptor()); |
| 595 DCHECK(!holder()->GetNamedInterceptor()->getter()->IsUndefined()); | 596 DCHECK(!holder()->GetNamedInterceptor()->getter()->IsUndefined(isolate())); |
| 596 PushInterceptorArguments(masm(), receiver(), holder_reg, this->name(), | 597 PushInterceptorArguments(masm(), receiver(), holder_reg, this->name(), |
| 597 holder()); | 598 holder()); |
| 598 | 599 |
| 599 __ TailCallRuntime(Runtime::kLoadPropertyWithInterceptor); | 600 __ TailCallRuntime(Runtime::kLoadPropertyWithInterceptor); |
| 600 } | 601 } |
| 601 | 602 |
| 602 Handle<Code> NamedStoreHandlerCompiler::CompileStoreCallback( | 603 Handle<Code> NamedStoreHandlerCompiler::CompileStoreCallback( |
| 603 Handle<JSObject> object, Handle<Name> name, Handle<AccessorInfo> callback, | 604 Handle<JSObject> object, Handle<Name> name, Handle<AccessorInfo> callback, |
| 604 LanguageMode language_mode) { | 605 LanguageMode language_mode) { |
| 605 Register holder_reg = Frontend(name); | 606 Register holder_reg = Frontend(name); |
| 606 | 607 |
| 607 __ Push(receiver(), holder_reg); // receiver | 608 __ Push(receiver(), holder_reg); // receiver |
| 608 | 609 |
| 609 // If the callback cannot leak, then push the callback directly, | 610 // If the callback cannot leak, then push the callback directly, |
| 610 // otherwise wrap it in a weak cell. | 611 // otherwise wrap it in a weak cell. |
| 611 if (callback->data()->IsUndefined() || callback->data()->IsSmi()) { | 612 if (callback->data()->IsUndefined(isolate()) || callback->data()->IsSmi()) { |
| 612 __ mov(ip, Operand(callback)); | 613 __ mov(ip, Operand(callback)); |
| 613 } else { | 614 } else { |
| 614 Handle<WeakCell> cell = isolate()->factory()->NewWeakCell(callback); | 615 Handle<WeakCell> cell = isolate()->factory()->NewWeakCell(callback); |
| 615 __ mov(ip, Operand(cell)); | 616 __ mov(ip, Operand(cell)); |
| 616 } | 617 } |
| 617 __ Push(ip); | 618 __ Push(ip); |
| 618 __ mov(ip, Operand(name)); | 619 __ mov(ip, Operand(name)); |
| 619 __ Push(ip, value()); | 620 __ Push(ip, value()); |
| 620 __ Push(Smi::FromInt(language_mode)); | 621 __ Push(Smi::FromInt(language_mode)); |
| 621 | 622 |
| (...skipping 39 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 661 | 662 |
| 662 // Return the generated code. | 663 // Return the generated code. |
| 663 return GetCode(kind(), name); | 664 return GetCode(kind(), name); |
| 664 } | 665 } |
| 665 | 666 |
| 666 #undef __ | 667 #undef __ |
| 667 } // namespace internal | 668 } // namespace internal |
| 668 } // namespace v8 | 669 } // namespace v8 |
| 669 | 670 |
| 670 #endif // V8_TARGET_ARCH_ARM | 671 #endif // V8_TARGET_ARCH_ARM |
| OLD | NEW |