| 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 107 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 118 MacroAssembler* masm = this->masm(); | 118 MacroAssembler* masm = this->masm(); |
| 119 __ Pop(slot, vector); | 119 __ Pop(slot, vector); |
| 120 } | 120 } |
| 121 | 121 |
| 122 void PropertyHandlerCompiler::DiscardVectorAndSlot() { | 122 void PropertyHandlerCompiler::DiscardVectorAndSlot() { |
| 123 MacroAssembler* masm = this->masm(); | 123 MacroAssembler* masm = this->masm(); |
| 124 // Remove vector and slot. | 124 // Remove vector and slot. |
| 125 __ la(sp, MemOperand(sp, 2 * kPointerSize)); | 125 __ la(sp, MemOperand(sp, 2 * kPointerSize)); |
| 126 } | 126 } |
| 127 | 127 |
| 128 void PropertyHandlerCompiler::PushReturnAddress(Register tmp) { | |
| 129 // No-op. Return address is in lr register. | |
| 130 } | |
| 131 | |
| 132 void PropertyHandlerCompiler::PopReturnAddress(Register tmp) { | |
| 133 // No-op. Return address is in lr register. | |
| 134 } | |
| 135 | |
| 136 void PropertyHandlerCompiler::GenerateDictionaryNegativeLookup( | 128 void PropertyHandlerCompiler::GenerateDictionaryNegativeLookup( |
| 137 MacroAssembler* masm, Label* miss_label, Register receiver, | 129 MacroAssembler* masm, Label* miss_label, Register receiver, |
| 138 Handle<Name> name, Register scratch0, Register scratch1) { | 130 Handle<Name> name, Register scratch0, Register scratch1) { |
| 139 DCHECK(name->IsUniqueName()); | 131 DCHECK(name->IsUniqueName()); |
| 140 DCHECK(!receiver.is(scratch0)); | 132 DCHECK(!receiver.is(scratch0)); |
| 141 Counters* counters = masm->isolate()->counters(); | 133 Counters* counters = masm->isolate()->counters(); |
| 142 __ IncrementCounter(counters->negative_lookups(), 1, scratch0, scratch1); | 134 __ IncrementCounter(counters->negative_lookups(), 1, scratch0, scratch1); |
| 143 __ IncrementCounter(counters->negative_lookups_miss(), 1, scratch0, scratch1); | 135 __ IncrementCounter(counters->negative_lookups_miss(), 1, scratch0, scratch1); |
| 144 | 136 |
| 145 Label done; | 137 Label done; |
| (...skipping 24 matching lines...) Expand all Loading... |
| 170 | 162 |
| 171 // Restore the temporarily used register. | 163 // Restore the temporarily used register. |
| 172 __ LoadP(properties, FieldMemOperand(receiver, JSObject::kPropertiesOffset)); | 164 __ LoadP(properties, FieldMemOperand(receiver, JSObject::kPropertiesOffset)); |
| 173 | 165 |
| 174 NameDictionaryLookupStub::GenerateNegativeLookup( | 166 NameDictionaryLookupStub::GenerateNegativeLookup( |
| 175 masm, miss_label, &done, receiver, properties, name, scratch1); | 167 masm, miss_label, &done, receiver, properties, name, scratch1); |
| 176 __ bind(&done); | 168 __ bind(&done); |
| 177 __ DecrementCounter(counters->negative_lookups_miss(), 1, scratch0, scratch1); | 169 __ DecrementCounter(counters->negative_lookups_miss(), 1, scratch0, scratch1); |
| 178 } | 170 } |
| 179 | 171 |
| 180 void NamedLoadHandlerCompiler::GenerateDirectLoadGlobalFunctionPrototype( | |
| 181 MacroAssembler* masm, int index, Register result, Label* miss) { | |
| 182 __ LoadNativeContextSlot(index, result); | |
| 183 // Load its initial map. The global functions all have initial maps. | |
| 184 __ LoadP(result, | |
| 185 FieldMemOperand(result, JSFunction::kPrototypeOrInitialMapOffset)); | |
| 186 // Load the prototype from the initial map. | |
| 187 __ LoadP(result, FieldMemOperand(result, Map::kPrototypeOffset)); | |
| 188 } | |
| 189 | |
| 190 void NamedLoadHandlerCompiler::GenerateLoadFunctionPrototype( | 172 void NamedLoadHandlerCompiler::GenerateLoadFunctionPrototype( |
| 191 MacroAssembler* masm, Register receiver, Register scratch1, | 173 MacroAssembler* masm, Register receiver, Register scratch1, |
| 192 Register scratch2, Label* miss_label) { | 174 Register scratch2, Label* miss_label) { |
| 193 __ TryGetFunctionPrototype(receiver, scratch1, scratch2, miss_label); | 175 __ TryGetFunctionPrototype(receiver, scratch1, scratch2, miss_label); |
| 194 __ LoadRR(r2, scratch1); | 176 __ LoadRR(r2, scratch1); |
| 195 __ Ret(); | 177 __ Ret(); |
| 196 } | 178 } |
| 197 | 179 |
| 198 // Generate code to check that a global property cell is empty. Create | 180 // Generate code to check that a global property cell is empty. Create |
| 199 // the property cell at compilation time if no cell exists for the | 181 // the property cell at compilation time if no cell exists for the |
| (...skipping 128 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 328 #define __ ACCESS_MASM(masm()) | 310 #define __ ACCESS_MASM(masm()) |
| 329 | 311 |
| 330 void NamedStoreHandlerCompiler::GenerateRestoreName(Label* label, | 312 void NamedStoreHandlerCompiler::GenerateRestoreName(Label* label, |
| 331 Handle<Name> name) { | 313 Handle<Name> name) { |
| 332 if (!label->is_unused()) { | 314 if (!label->is_unused()) { |
| 333 __ bind(label); | 315 __ bind(label); |
| 334 __ mov(this->name(), Operand(name)); | 316 __ mov(this->name(), Operand(name)); |
| 335 } | 317 } |
| 336 } | 318 } |
| 337 | 319 |
| 338 void NamedStoreHandlerCompiler::GenerateRestoreName(Handle<Name> name) { | |
| 339 __ mov(this->name(), Operand(name)); | |
| 340 } | |
| 341 | |
| 342 void NamedStoreHandlerCompiler::GenerateRestoreMap(Handle<Map> transition, | |
| 343 Register map_reg, | |
| 344 Register scratch, | |
| 345 Label* miss) { | |
| 346 Handle<WeakCell> cell = Map::WeakCellForMap(transition); | |
| 347 DCHECK(!map_reg.is(scratch)); | |
| 348 __ LoadWeakValue(map_reg, cell, miss); | |
| 349 if (transition->CanBeDeprecated()) { | |
| 350 __ LoadlW(scratch, FieldMemOperand(map_reg, Map::kBitField3Offset)); | |
| 351 __ DecodeField<Map::Deprecated>(r0, scratch); | |
| 352 __ bne(miss); | |
| 353 } | |
| 354 } | |
| 355 | |
| 356 void NamedStoreHandlerCompiler::GenerateConstantCheck(Register map_reg, | |
| 357 int descriptor, | |
| 358 Register value_reg, | |
| 359 Register scratch, | |
| 360 Label* miss_label) { | |
| 361 DCHECK(!map_reg.is(scratch)); | |
| 362 DCHECK(!map_reg.is(value_reg)); | |
| 363 DCHECK(!value_reg.is(scratch)); | |
| 364 __ LoadInstanceDescriptors(map_reg, scratch); | |
| 365 __ CmpP(value_reg, FieldMemOperand( | |
| 366 scratch, DescriptorArray::GetValueOffset(descriptor))); | |
| 367 __ bne(miss_label); | |
| 368 } | |
| 369 | |
| 370 void NamedStoreHandlerCompiler::GenerateFieldTypeChecks(FieldType* field_type, | |
| 371 Register value_reg, | |
| 372 Label* miss_label) { | |
| 373 Register map_reg = scratch1(); | |
| 374 Register scratch = scratch2(); | |
| 375 DCHECK(!value_reg.is(map_reg)); | |
| 376 DCHECK(!value_reg.is(scratch)); | |
| 377 __ JumpIfSmi(value_reg, miss_label); | |
| 378 if (field_type->IsClass()) { | |
| 379 __ LoadP(map_reg, FieldMemOperand(value_reg, HeapObject::kMapOffset)); | |
| 380 __ CmpWeakValue(map_reg, Map::WeakCellForMap(field_type->AsClass()), | |
| 381 scratch); | |
| 382 __ bne(miss_label); | |
| 383 } | |
| 384 } | |
| 385 | |
| 386 void PropertyHandlerCompiler::GenerateAccessCheck( | 320 void PropertyHandlerCompiler::GenerateAccessCheck( |
| 387 Handle<WeakCell> native_context_cell, Register scratch1, Register scratch2, | 321 Handle<WeakCell> native_context_cell, Register scratch1, Register scratch2, |
| 388 Label* miss, bool compare_native_contexts_only) { | 322 Label* miss, bool compare_native_contexts_only) { |
| 389 Label done; | 323 Label done; |
| 390 // Load current native context. | 324 // Load current native context. |
| 391 __ LoadP(scratch1, NativeContextMemOperand()); | 325 __ LoadP(scratch1, NativeContextMemOperand()); |
| 392 // Load expected native context. | 326 // Load expected native context. |
| 393 __ LoadWeakValue(scratch2, native_context_cell, miss); | 327 __ LoadWeakValue(scratch2, native_context_cell, miss); |
| 394 __ CmpP(scratch1, scratch2); | 328 __ CmpP(scratch1, scratch2); |
| 395 | 329 |
| (...skipping 109 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 505 if (!miss->is_unused()) { | 439 if (!miss->is_unused()) { |
| 506 Label success; | 440 Label success; |
| 507 __ b(&success); | 441 __ b(&success); |
| 508 GenerateRestoreName(miss, name); | 442 GenerateRestoreName(miss, name); |
| 509 if (IC::ICUseVector(kind())) PopVectorAndSlot(); | 443 if (IC::ICUseVector(kind())) PopVectorAndSlot(); |
| 510 TailCallBuiltin(masm(), MissBuiltin(kind())); | 444 TailCallBuiltin(masm(), MissBuiltin(kind())); |
| 511 __ bind(&success); | 445 __ bind(&success); |
| 512 } | 446 } |
| 513 } | 447 } |
| 514 | 448 |
| 515 void NamedLoadHandlerCompiler::GenerateLoadConstant(Handle<Object> value) { | |
| 516 // Return the constant value. | |
| 517 __ Move(r2, value); | |
| 518 __ Ret(); | |
| 519 } | |
| 520 | |
| 521 void NamedLoadHandlerCompiler::GenerateLoadInterceptorWithFollowup( | 449 void NamedLoadHandlerCompiler::GenerateLoadInterceptorWithFollowup( |
| 522 LookupIterator* it, Register holder_reg) { | 450 LookupIterator* it, Register holder_reg) { |
| 523 DCHECK(holder()->HasNamedInterceptor()); | 451 DCHECK(holder()->HasNamedInterceptor()); |
| 524 DCHECK(!holder()->GetNamedInterceptor()->getter()->IsUndefined(isolate())); | 452 DCHECK(!holder()->GetNamedInterceptor()->getter()->IsUndefined(isolate())); |
| 525 | 453 |
| 526 // Compile the interceptor call, followed by inline code to load the | 454 // Compile the interceptor call, followed by inline code to load the |
| 527 // property from further up the prototype chain if the call fails. | 455 // property from further up the prototype chain if the call fails. |
| 528 // Check that the maps haven't changed. | 456 // Check that the maps haven't changed. |
| 529 DCHECK(holder_reg.is(receiver()) || holder_reg.is(scratch1())); | 457 DCHECK(holder_reg.is(receiver()) || holder_reg.is(scratch1())); |
| 530 | 458 |
| (...skipping 121 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 652 | 580 |
| 653 // Return the generated code. | 581 // Return the generated code. |
| 654 return GetCode(kind(), name); | 582 return GetCode(kind(), name); |
| 655 } | 583 } |
| 656 | 584 |
| 657 #undef __ | 585 #undef __ |
| 658 } // namespace internal | 586 } // namespace internal |
| 659 } // namespace v8 | 587 } // namespace v8 |
| 660 | 588 |
| 661 #endif // V8_TARGET_ARCH_ARM | 589 #endif // V8_TARGET_ARCH_ARM |
| OLD | NEW |