| 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 112 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 123 __ Pop(slot, vector); | 123 __ Pop(slot, vector); |
| 124 } | 124 } |
| 125 | 125 |
| 126 | 126 |
| 127 void PropertyHandlerCompiler::DiscardVectorAndSlot() { | 127 void PropertyHandlerCompiler::DiscardVectorAndSlot() { |
| 128 MacroAssembler* masm = this->masm(); | 128 MacroAssembler* masm = this->masm(); |
| 129 // Remove vector and slot. | 129 // Remove vector and slot. |
| 130 __ addi(sp, sp, Operand(2 * kPointerSize)); | 130 __ addi(sp, sp, Operand(2 * kPointerSize)); |
| 131 } | 131 } |
| 132 | 132 |
| 133 void PropertyHandlerCompiler::PushReturnAddress(Register tmp) { | |
| 134 // No-op. Return address is in lr register. | |
| 135 } | |
| 136 | |
| 137 void PropertyHandlerCompiler::PopReturnAddress(Register tmp) { | |
| 138 // No-op. Return address is in lr register. | |
| 139 } | |
| 140 | |
| 141 void PropertyHandlerCompiler::GenerateDictionaryNegativeLookup( | 133 void PropertyHandlerCompiler::GenerateDictionaryNegativeLookup( |
| 142 MacroAssembler* masm, Label* miss_label, Register receiver, | 134 MacroAssembler* masm, Label* miss_label, Register receiver, |
| 143 Handle<Name> name, Register scratch0, Register scratch1) { | 135 Handle<Name> name, Register scratch0, Register scratch1) { |
| 144 DCHECK(name->IsUniqueName()); | 136 DCHECK(name->IsUniqueName()); |
| 145 DCHECK(!receiver.is(scratch0)); | 137 DCHECK(!receiver.is(scratch0)); |
| 146 Counters* counters = masm->isolate()->counters(); | 138 Counters* counters = masm->isolate()->counters(); |
| 147 __ IncrementCounter(counters->negative_lookups(), 1, scratch0, scratch1); | 139 __ IncrementCounter(counters->negative_lookups(), 1, scratch0, scratch1); |
| 148 __ IncrementCounter(counters->negative_lookups_miss(), 1, scratch0, scratch1); | 140 __ IncrementCounter(counters->negative_lookups_miss(), 1, scratch0, scratch1); |
| 149 | 141 |
| 150 Label done; | 142 Label done; |
| (...skipping 26 matching lines...) Expand all Loading... |
| 177 // Restore the temporarily used register. | 169 // Restore the temporarily used register. |
| 178 __ LoadP(properties, FieldMemOperand(receiver, JSObject::kPropertiesOffset)); | 170 __ LoadP(properties, FieldMemOperand(receiver, JSObject::kPropertiesOffset)); |
| 179 | 171 |
| 180 | 172 |
| 181 NameDictionaryLookupStub::GenerateNegativeLookup( | 173 NameDictionaryLookupStub::GenerateNegativeLookup( |
| 182 masm, miss_label, &done, receiver, properties, name, scratch1); | 174 masm, miss_label, &done, receiver, properties, name, scratch1); |
| 183 __ bind(&done); | 175 __ bind(&done); |
| 184 __ DecrementCounter(counters->negative_lookups_miss(), 1, scratch0, scratch1); | 176 __ DecrementCounter(counters->negative_lookups_miss(), 1, scratch0, scratch1); |
| 185 } | 177 } |
| 186 | 178 |
| 187 | |
| 188 void NamedLoadHandlerCompiler::GenerateDirectLoadGlobalFunctionPrototype( | |
| 189 MacroAssembler* masm, int index, Register result, Label* miss) { | |
| 190 __ LoadNativeContextSlot(index, result); | |
| 191 // Load its initial map. The global functions all have initial maps. | |
| 192 __ LoadP(result, | |
| 193 FieldMemOperand(result, JSFunction::kPrototypeOrInitialMapOffset)); | |
| 194 // Load the prototype from the initial map. | |
| 195 __ LoadP(result, FieldMemOperand(result, Map::kPrototypeOffset)); | |
| 196 } | |
| 197 | |
| 198 | |
| 199 void NamedLoadHandlerCompiler::GenerateLoadFunctionPrototype( | 179 void NamedLoadHandlerCompiler::GenerateLoadFunctionPrototype( |
| 200 MacroAssembler* masm, Register receiver, Register scratch1, | 180 MacroAssembler* masm, Register receiver, Register scratch1, |
| 201 Register scratch2, Label* miss_label) { | 181 Register scratch2, Label* miss_label) { |
| 202 __ TryGetFunctionPrototype(receiver, scratch1, scratch2, miss_label); | 182 __ TryGetFunctionPrototype(receiver, scratch1, scratch2, miss_label); |
| 203 __ mr(r3, scratch1); | 183 __ mr(r3, scratch1); |
| 204 __ Ret(); | 184 __ Ret(); |
| 205 } | 185 } |
| 206 | 186 |
| 207 | 187 |
| 208 // Generate code to check that a global property cell is empty. Create | 188 // Generate code to check that a global property cell is empty. Create |
| (...skipping 134 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 343 | 323 |
| 344 | 324 |
| 345 void NamedStoreHandlerCompiler::GenerateRestoreName(Label* label, | 325 void NamedStoreHandlerCompiler::GenerateRestoreName(Label* label, |
| 346 Handle<Name> name) { | 326 Handle<Name> name) { |
| 347 if (!label->is_unused()) { | 327 if (!label->is_unused()) { |
| 348 __ bind(label); | 328 __ bind(label); |
| 349 __ mov(this->name(), Operand(name)); | 329 __ mov(this->name(), Operand(name)); |
| 350 } | 330 } |
| 351 } | 331 } |
| 352 | 332 |
| 353 | |
| 354 void NamedStoreHandlerCompiler::GenerateRestoreName(Handle<Name> name) { | |
| 355 __ mov(this->name(), Operand(name)); | |
| 356 } | |
| 357 | |
| 358 | |
| 359 void NamedStoreHandlerCompiler::GenerateRestoreMap(Handle<Map> transition, | |
| 360 Register map_reg, | |
| 361 Register scratch, | |
| 362 Label* miss) { | |
| 363 Handle<WeakCell> cell = Map::WeakCellForMap(transition); | |
| 364 DCHECK(!map_reg.is(scratch)); | |
| 365 __ LoadWeakValue(map_reg, cell, miss); | |
| 366 if (transition->CanBeDeprecated()) { | |
| 367 __ lwz(scratch, FieldMemOperand(map_reg, Map::kBitField3Offset)); | |
| 368 __ DecodeField<Map::Deprecated>(r0, scratch, SetRC); | |
| 369 __ bne(miss, cr0); | |
| 370 } | |
| 371 } | |
| 372 | |
| 373 | |
| 374 void NamedStoreHandlerCompiler::GenerateConstantCheck(Register map_reg, | |
| 375 int descriptor, | |
| 376 Register value_reg, | |
| 377 Register scratch, | |
| 378 Label* miss_label) { | |
| 379 DCHECK(!map_reg.is(scratch)); | |
| 380 DCHECK(!map_reg.is(value_reg)); | |
| 381 DCHECK(!value_reg.is(scratch)); | |
| 382 __ LoadInstanceDescriptors(map_reg, scratch); | |
| 383 __ LoadP(scratch, FieldMemOperand( | |
| 384 scratch, DescriptorArray::GetValueOffset(descriptor))); | |
| 385 __ cmp(value_reg, scratch); | |
| 386 __ bne(miss_label); | |
| 387 } | |
| 388 | |
| 389 void NamedStoreHandlerCompiler::GenerateFieldTypeChecks(FieldType* field_type, | |
| 390 Register value_reg, | |
| 391 Label* miss_label) { | |
| 392 Register map_reg = scratch1(); | |
| 393 Register scratch = scratch2(); | |
| 394 DCHECK(!value_reg.is(map_reg)); | |
| 395 DCHECK(!value_reg.is(scratch)); | |
| 396 __ JumpIfSmi(value_reg, miss_label); | |
| 397 if (field_type->IsClass()) { | |
| 398 __ LoadP(map_reg, FieldMemOperand(value_reg, HeapObject::kMapOffset)); | |
| 399 __ CmpWeakValue(map_reg, Map::WeakCellForMap(field_type->AsClass()), | |
| 400 scratch); | |
| 401 __ bne(miss_label); | |
| 402 } | |
| 403 } | |
| 404 | |
| 405 void PropertyHandlerCompiler::GenerateAccessCheck( | 333 void PropertyHandlerCompiler::GenerateAccessCheck( |
| 406 Handle<WeakCell> native_context_cell, Register scratch1, Register scratch2, | 334 Handle<WeakCell> native_context_cell, Register scratch1, Register scratch2, |
| 407 Label* miss, bool compare_native_contexts_only) { | 335 Label* miss, bool compare_native_contexts_only) { |
| 408 Label done; | 336 Label done; |
| 409 // Load current native context. | 337 // Load current native context. |
| 410 __ LoadP(scratch1, NativeContextMemOperand()); | 338 __ LoadP(scratch1, NativeContextMemOperand()); |
| 411 // Load expected native context. | 339 // Load expected native context. |
| 412 __ LoadWeakValue(scratch2, native_context_cell, miss); | 340 __ LoadWeakValue(scratch2, native_context_cell, miss); |
| 413 __ cmp(scratch1, scratch2); | 341 __ cmp(scratch1, scratch2); |
| 414 | 342 |
| (...skipping 116 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 531 if (!miss->is_unused()) { | 459 if (!miss->is_unused()) { |
| 532 Label success; | 460 Label success; |
| 533 __ b(&success); | 461 __ b(&success); |
| 534 GenerateRestoreName(miss, name); | 462 GenerateRestoreName(miss, name); |
| 535 if (IC::ICUseVector(kind())) PopVectorAndSlot(); | 463 if (IC::ICUseVector(kind())) PopVectorAndSlot(); |
| 536 TailCallBuiltin(masm(), MissBuiltin(kind())); | 464 TailCallBuiltin(masm(), MissBuiltin(kind())); |
| 537 __ bind(&success); | 465 __ bind(&success); |
| 538 } | 466 } |
| 539 } | 467 } |
| 540 | 468 |
| 541 | |
| 542 void NamedLoadHandlerCompiler::GenerateLoadConstant(Handle<Object> value) { | |
| 543 // Return the constant value. | |
| 544 __ Move(r3, value); | |
| 545 __ Ret(); | |
| 546 } | |
| 547 | |
| 548 | |
| 549 void NamedLoadHandlerCompiler::GenerateLoadInterceptorWithFollowup( | 469 void NamedLoadHandlerCompiler::GenerateLoadInterceptorWithFollowup( |
| 550 LookupIterator* it, Register holder_reg) { | 470 LookupIterator* it, Register holder_reg) { |
| 551 DCHECK(holder()->HasNamedInterceptor()); | 471 DCHECK(holder()->HasNamedInterceptor()); |
| 552 DCHECK(!holder()->GetNamedInterceptor()->getter()->IsUndefined(isolate())); | 472 DCHECK(!holder()->GetNamedInterceptor()->getter()->IsUndefined(isolate())); |
| 553 | 473 |
| 554 // Compile the interceptor call, followed by inline code to load the | 474 // Compile the interceptor call, followed by inline code to load the |
| 555 // property from further up the prototype chain if the call fails. | 475 // property from further up the prototype chain if the call fails. |
| 556 // Check that the maps haven't changed. | 476 // Check that the maps haven't changed. |
| 557 DCHECK(holder_reg.is(receiver()) || holder_reg.is(scratch1())); | 477 DCHECK(holder_reg.is(receiver()) || holder_reg.is(scratch1())); |
| 558 | 478 |
| (...skipping 127 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 686 // Return the generated code. | 606 // Return the generated code. |
| 687 return GetCode(kind(), name); | 607 return GetCode(kind(), name); |
| 688 } | 608 } |
| 689 | 609 |
| 690 | 610 |
| 691 #undef __ | 611 #undef __ |
| 692 } // namespace internal | 612 } // namespace internal |
| 693 } // namespace v8 | 613 } // namespace v8 |
| 694 | 614 |
| 695 #endif // V8_TARGET_ARCH_ARM | 615 #endif // V8_TARGET_ARCH_ARM |
| OLD | NEW |