| 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 111 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 122 __ Pop(slot, vector); | 122 __ Pop(slot, vector); |
| 123 } | 123 } |
| 124 | 124 |
| 125 | 125 |
| 126 void PropertyHandlerCompiler::DiscardVectorAndSlot() { | 126 void PropertyHandlerCompiler::DiscardVectorAndSlot() { |
| 127 MacroAssembler* masm = this->masm(); | 127 MacroAssembler* masm = this->masm(); |
| 128 // Remove vector and slot. | 128 // Remove vector and slot. |
| 129 __ Addu(sp, sp, Operand(2 * kPointerSize)); | 129 __ Addu(sp, sp, Operand(2 * kPointerSize)); |
| 130 } | 130 } |
| 131 | 131 |
| 132 void PropertyHandlerCompiler::PushReturnAddress(Register tmp) { | |
| 133 // No-op. Return address is in ra register. | |
| 134 } | |
| 135 | |
| 136 void PropertyHandlerCompiler::PopReturnAddress(Register tmp) { | |
| 137 // No-op. Return address is in ra register. | |
| 138 } | |
| 139 | |
| 140 void PropertyHandlerCompiler::GenerateDictionaryNegativeLookup( | 132 void PropertyHandlerCompiler::GenerateDictionaryNegativeLookup( |
| 141 MacroAssembler* masm, Label* miss_label, Register receiver, | 133 MacroAssembler* masm, Label* miss_label, Register receiver, |
| 142 Handle<Name> name, Register scratch0, Register scratch1) { | 134 Handle<Name> name, Register scratch0, Register scratch1) { |
| 143 DCHECK(name->IsUniqueName()); | 135 DCHECK(name->IsUniqueName()); |
| 144 DCHECK(!receiver.is(scratch0)); | 136 DCHECK(!receiver.is(scratch0)); |
| 145 Counters* counters = masm->isolate()->counters(); | 137 Counters* counters = masm->isolate()->counters(); |
| 146 __ IncrementCounter(counters->negative_lookups(), 1, scratch0, scratch1); | 138 __ IncrementCounter(counters->negative_lookups(), 1, scratch0, scratch1); |
| 147 __ IncrementCounter(counters->negative_lookups_miss(), 1, scratch0, scratch1); | 139 __ IncrementCounter(counters->negative_lookups_miss(), 1, scratch0, scratch1); |
| 148 | 140 |
| 149 Label done; | 141 Label done; |
| (...skipping 24 matching lines...) Expand all Loading... |
| 174 // Restore the temporarily used register. | 166 // Restore the temporarily used register. |
| 175 __ lw(properties, FieldMemOperand(receiver, JSObject::kPropertiesOffset)); | 167 __ lw(properties, FieldMemOperand(receiver, JSObject::kPropertiesOffset)); |
| 176 | 168 |
| 177 | 169 |
| 178 NameDictionaryLookupStub::GenerateNegativeLookup( | 170 NameDictionaryLookupStub::GenerateNegativeLookup( |
| 179 masm, miss_label, &done, receiver, properties, name, scratch1); | 171 masm, miss_label, &done, receiver, properties, name, scratch1); |
| 180 __ bind(&done); | 172 __ bind(&done); |
| 181 __ DecrementCounter(counters->negative_lookups_miss(), 1, scratch0, scratch1); | 173 __ DecrementCounter(counters->negative_lookups_miss(), 1, scratch0, scratch1); |
| 182 } | 174 } |
| 183 | 175 |
| 184 | |
| 185 void NamedLoadHandlerCompiler::GenerateDirectLoadGlobalFunctionPrototype( | |
| 186 MacroAssembler* masm, int index, Register result, Label* miss) { | |
| 187 __ LoadNativeContextSlot(index, result); | |
| 188 // Load its initial map. The global functions all have initial maps. | |
| 189 __ lw(result, | |
| 190 FieldMemOperand(result, JSFunction::kPrototypeOrInitialMapOffset)); | |
| 191 // Load the prototype from the initial map. | |
| 192 __ lw(result, FieldMemOperand(result, Map::kPrototypeOffset)); | |
| 193 } | |
| 194 | |
| 195 | |
| 196 void NamedLoadHandlerCompiler::GenerateLoadFunctionPrototype( | 176 void NamedLoadHandlerCompiler::GenerateLoadFunctionPrototype( |
| 197 MacroAssembler* masm, Register receiver, Register scratch1, | 177 MacroAssembler* masm, Register receiver, Register scratch1, |
| 198 Register scratch2, Label* miss_label) { | 178 Register scratch2, Label* miss_label) { |
| 199 __ TryGetFunctionPrototype(receiver, scratch1, scratch2, miss_label); | 179 __ TryGetFunctionPrototype(receiver, scratch1, scratch2, miss_label); |
| 200 __ Ret(USE_DELAY_SLOT); | 180 __ Ret(USE_DELAY_SLOT); |
| 201 __ mov(v0, scratch1); | 181 __ mov(v0, scratch1); |
| 202 } | 182 } |
| 203 | 183 |
| 204 | 184 |
| 205 // Generate code to check that a global property cell is empty. Create | 185 // Generate code to check that a global property cell is empty. Create |
| (...skipping 129 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 335 | 315 |
| 336 | 316 |
| 337 void NamedStoreHandlerCompiler::GenerateRestoreName(Label* label, | 317 void NamedStoreHandlerCompiler::GenerateRestoreName(Label* label, |
| 338 Handle<Name> name) { | 318 Handle<Name> name) { |
| 339 if (!label->is_unused()) { | 319 if (!label->is_unused()) { |
| 340 __ bind(label); | 320 __ bind(label); |
| 341 __ li(this->name(), Operand(name)); | 321 __ li(this->name(), Operand(name)); |
| 342 } | 322 } |
| 343 } | 323 } |
| 344 | 324 |
| 345 | |
| 346 void NamedStoreHandlerCompiler::GenerateRestoreName(Handle<Name> name) { | |
| 347 __ li(this->name(), Operand(name)); | |
| 348 } | |
| 349 | |
| 350 | |
| 351 void NamedStoreHandlerCompiler::GenerateRestoreMap(Handle<Map> transition, | |
| 352 Register map_reg, | |
| 353 Register scratch, | |
| 354 Label* miss) { | |
| 355 Handle<WeakCell> cell = Map::WeakCellForMap(transition); | |
| 356 DCHECK(!map_reg.is(scratch)); | |
| 357 __ LoadWeakValue(map_reg, cell, miss); | |
| 358 if (transition->CanBeDeprecated()) { | |
| 359 __ lw(scratch, FieldMemOperand(map_reg, Map::kBitField3Offset)); | |
| 360 __ And(at, scratch, Operand(Map::Deprecated::kMask)); | |
| 361 __ Branch(miss, ne, at, Operand(zero_reg)); | |
| 362 } | |
| 363 } | |
| 364 | |
| 365 | |
| 366 void NamedStoreHandlerCompiler::GenerateConstantCheck(Register map_reg, | |
| 367 int descriptor, | |
| 368 Register value_reg, | |
| 369 Register scratch, | |
| 370 Label* miss_label) { | |
| 371 DCHECK(!map_reg.is(scratch)); | |
| 372 DCHECK(!map_reg.is(value_reg)); | |
| 373 DCHECK(!value_reg.is(scratch)); | |
| 374 __ LoadInstanceDescriptors(map_reg, scratch); | |
| 375 __ lw(scratch, | |
| 376 FieldMemOperand(scratch, DescriptorArray::GetValueOffset(descriptor))); | |
| 377 __ Branch(miss_label, ne, value_reg, Operand(scratch)); | |
| 378 } | |
| 379 | |
| 380 void NamedStoreHandlerCompiler::GenerateFieldTypeChecks(FieldType* field_type, | |
| 381 Register value_reg, | |
| 382 Label* miss_label) { | |
| 383 Register map_reg = scratch1(); | |
| 384 Register scratch = scratch2(); | |
| 385 DCHECK(!value_reg.is(map_reg)); | |
| 386 DCHECK(!value_reg.is(scratch)); | |
| 387 __ JumpIfSmi(value_reg, miss_label); | |
| 388 if (field_type->IsClass()) { | |
| 389 __ lw(map_reg, FieldMemOperand(value_reg, HeapObject::kMapOffset)); | |
| 390 // Compare map directly within the Branch() functions. | |
| 391 __ GetWeakValue(scratch, Map::WeakCellForMap(field_type->AsClass())); | |
| 392 __ Branch(miss_label, ne, map_reg, Operand(scratch)); | |
| 393 } | |
| 394 } | |
| 395 | |
| 396 void PropertyHandlerCompiler::GenerateAccessCheck( | 325 void PropertyHandlerCompiler::GenerateAccessCheck( |
| 397 Handle<WeakCell> native_context_cell, Register scratch1, Register scratch2, | 326 Handle<WeakCell> native_context_cell, Register scratch1, Register scratch2, |
| 398 Label* miss, bool compare_native_contexts_only) { | 327 Label* miss, bool compare_native_contexts_only) { |
| 399 Label done; | 328 Label done; |
| 400 // Load current native context. | 329 // Load current native context. |
| 401 __ lw(scratch1, NativeContextMemOperand()); | 330 __ lw(scratch1, NativeContextMemOperand()); |
| 402 // Load expected native context. | 331 // Load expected native context. |
| 403 __ LoadWeakValue(scratch2, native_context_cell, miss); | 332 __ LoadWeakValue(scratch2, native_context_cell, miss); |
| 404 | 333 |
| 405 if (!compare_native_contexts_only) { | 334 if (!compare_native_contexts_only) { |
| (...skipping 107 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 513 if (!miss->is_unused()) { | 442 if (!miss->is_unused()) { |
| 514 Label success; | 443 Label success; |
| 515 __ Branch(&success); | 444 __ Branch(&success); |
| 516 GenerateRestoreName(miss, name); | 445 GenerateRestoreName(miss, name); |
| 517 if (IC::ICUseVector(kind())) PopVectorAndSlot(); | 446 if (IC::ICUseVector(kind())) PopVectorAndSlot(); |
| 518 TailCallBuiltin(masm(), MissBuiltin(kind())); | 447 TailCallBuiltin(masm(), MissBuiltin(kind())); |
| 519 __ bind(&success); | 448 __ bind(&success); |
| 520 } | 449 } |
| 521 } | 450 } |
| 522 | 451 |
| 523 | |
| 524 void NamedLoadHandlerCompiler::GenerateLoadConstant(Handle<Object> value) { | |
| 525 // Return the constant value. | |
| 526 __ li(v0, value); | |
| 527 __ Ret(); | |
| 528 } | |
| 529 | |
| 530 | |
| 531 void NamedLoadHandlerCompiler::GenerateLoadInterceptorWithFollowup( | 452 void NamedLoadHandlerCompiler::GenerateLoadInterceptorWithFollowup( |
| 532 LookupIterator* it, Register holder_reg) { | 453 LookupIterator* it, Register holder_reg) { |
| 533 DCHECK(holder()->HasNamedInterceptor()); | 454 DCHECK(holder()->HasNamedInterceptor()); |
| 534 DCHECK(!holder()->GetNamedInterceptor()->getter()->IsUndefined(isolate())); | 455 DCHECK(!holder()->GetNamedInterceptor()->getter()->IsUndefined(isolate())); |
| 535 | 456 |
| 536 // Compile the interceptor call, followed by inline code to load the | 457 // Compile the interceptor call, followed by inline code to load the |
| 537 // property from further up the prototype chain if the call fails. | 458 // property from further up the prototype chain if the call fails. |
| 538 // Check that the maps haven't changed. | 459 // Check that the maps haven't changed. |
| 539 DCHECK(holder_reg.is(receiver()) || holder_reg.is(scratch1())); | 460 DCHECK(holder_reg.is(receiver()) || holder_reg.is(scratch1())); |
| 540 | 461 |
| (...skipping 126 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 667 // Return the generated code. | 588 // Return the generated code. |
| 668 return GetCode(kind(), name); | 589 return GetCode(kind(), name); |
| 669 } | 590 } |
| 670 | 591 |
| 671 | 592 |
| 672 #undef __ | 593 #undef __ |
| 673 } // namespace internal | 594 } // namespace internal |
| 674 } // namespace v8 | 595 } // namespace v8 |
| 675 | 596 |
| 676 #endif // V8_TARGET_ARCH_MIPS | 597 #endif // V8_TARGET_ARCH_MIPS |
| OLD | NEW |