Chromium Code Reviews
chromiumcodereview-hr@appspot.gserviceaccount.com (chromiumcodereview-hr) | Please choose your nickname with Settings | Help | Chromium Project | Gerrit Changes | Sign out
(103)

Side by Side Diff: src/arm64/stub-cache-arm64.cc

Issue 329463005: Revert 21720: "Introduce FieldIndex to unify and abstract property/field offset" (Closed) Base URL: https://v8.googlecode.com/svn/branches/bleeding_edge
Patch Set: Created 6 years, 6 months ago
Use n/p to move between diff chunks; N/P to move between comments. Draft comments are only viewable by you.
Jump to:
View unified diff | Download patch | Annotate | Revision Log
« no previous file with comments | « src/arm/stub-cache-arm.cc ('k') | src/bootstrapper.cc » ('j') | no next file with comments »
Toggle Intra-line Diffs ('i') | Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
OLDNEW
1 // Copyright 2013 the V8 project authors. All rights reserved. 1 // Copyright 2013 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 #include "src/v8.h" 5 #include "src/v8.h"
6 6
7 #if V8_TARGET_ARCH_ARM64 7 #if V8_TARGET_ARCH_ARM64
8 8
9 #include "src/ic-inl.h" 9 #include "src/ic-inl.h"
10 #include "src/codegen.h" 10 #include "src/codegen.h"
(...skipping 504 matching lines...) Expand 10 before | Expand all | Expand 10 after
515 Register scratch1, 515 Register scratch1,
516 Register scratch2, 516 Register scratch2,
517 Label* miss_label) { 517 Label* miss_label) {
518 // x0 : value 518 // x0 : value
519 Label exit; 519 Label exit;
520 520
521 // Stub never generated for non-global objects that require access 521 // Stub never generated for non-global objects that require access
522 // checks. 522 // checks.
523 ASSERT(object->IsJSGlobalProxy() || !object->IsAccessCheckNeeded()); 523 ASSERT(object->IsJSGlobalProxy() || !object->IsAccessCheckNeeded());
524 524
525 FieldIndex index = lookup->GetFieldIndex(); 525 int index = lookup->GetFieldIndex().field_index();
526
527 // Adjust for the number of properties stored in the object. Even in the
528 // face of a transition we can use the old map here because the size of the
529 // object and the number of in-object properties is not going to change.
530 index -= object->map()->inobject_properties();
526 531
527 Representation representation = lookup->representation(); 532 Representation representation = lookup->representation();
528 ASSERT(!representation.IsNone()); 533 ASSERT(!representation.IsNone());
529 if (representation.IsSmi()) { 534 if (representation.IsSmi()) {
530 __ JumpIfNotSmi(value_reg, miss_label); 535 __ JumpIfNotSmi(value_reg, miss_label);
531 } else if (representation.IsHeapObject()) { 536 } else if (representation.IsHeapObject()) {
532 __ JumpIfSmi(value_reg, miss_label); 537 __ JumpIfSmi(value_reg, miss_label);
533 HeapType* field_type = lookup->GetFieldType(); 538 HeapType* field_type = lookup->GetFieldType();
534 HeapType::Iterator<Map> it = field_type->Classes(); 539 HeapType::Iterator<Map> it = field_type->Classes();
535 if (!it.Done()) { 540 if (!it.Done()) {
(...skipping 10 matching lines...) Expand all
546 } 551 }
547 __ Bind(&do_store); 552 __ Bind(&do_store);
548 } 553 }
549 } else if (representation.IsDouble()) { 554 } else if (representation.IsDouble()) {
550 UseScratchRegisterScope temps(masm); 555 UseScratchRegisterScope temps(masm);
551 DoubleRegister temp_double = temps.AcquireD(); 556 DoubleRegister temp_double = temps.AcquireD();
552 557
553 __ SmiUntagToDouble(temp_double, value_reg, kSpeculativeUntag); 558 __ SmiUntagToDouble(temp_double, value_reg, kSpeculativeUntag);
554 559
555 // Load the double storage. 560 // Load the double storage.
556 if (index.is_inobject()) { 561 if (index < 0) {
557 __ Ldr(scratch1, FieldMemOperand(receiver_reg, index.offset())); 562 int offset = (index * kPointerSize) + object->map()->instance_size();
563 __ Ldr(scratch1, FieldMemOperand(receiver_reg, offset));
558 } else { 564 } else {
565 int offset = (index * kPointerSize) + FixedArray::kHeaderSize;
559 __ Ldr(scratch1, 566 __ Ldr(scratch1,
560 FieldMemOperand(receiver_reg, JSObject::kPropertiesOffset)); 567 FieldMemOperand(receiver_reg, JSObject::kPropertiesOffset));
561 __ Ldr(scratch1, FieldMemOperand(scratch1, index.offset())); 568 __ Ldr(scratch1, FieldMemOperand(scratch1, offset));
562 } 569 }
563 570
564 // Store the value into the storage. 571 // Store the value into the storage.
565 Label do_store, heap_number; 572 Label do_store, heap_number;
566 573
567 __ JumpIfSmi(value_reg, &do_store); 574 __ JumpIfSmi(value_reg, &do_store);
568 575
569 __ CheckMap(value_reg, scratch2, Heap::kHeapNumberMapRootIndex, 576 __ CheckMap(value_reg, scratch2, Heap::kHeapNumberMapRootIndex,
570 miss_label, DONT_DO_SMI_CHECK); 577 miss_label, DONT_DO_SMI_CHECK);
571 __ Ldr(temp_double, FieldMemOperand(value_reg, HeapNumber::kValueOffset)); 578 __ Ldr(temp_double, FieldMemOperand(value_reg, HeapNumber::kValueOffset));
572 579
573 __ Bind(&do_store); 580 __ Bind(&do_store);
574 __ Str(temp_double, FieldMemOperand(scratch1, HeapNumber::kValueOffset)); 581 __ Str(temp_double, FieldMemOperand(scratch1, HeapNumber::kValueOffset));
575 582
576 // Return the value (register x0). 583 // Return the value (register x0).
577 ASSERT(value_reg.is(x0)); 584 ASSERT(value_reg.is(x0));
578 __ Ret(); 585 __ Ret();
579 return; 586 return;
580 } 587 }
581 588
582 // TODO(verwaest): Share this code as a code stub. 589 // TODO(verwaest): Share this code as a code stub.
583 SmiCheck smi_check = representation.IsTagged() 590 SmiCheck smi_check = representation.IsTagged()
584 ? INLINE_SMI_CHECK : OMIT_SMI_CHECK; 591 ? INLINE_SMI_CHECK : OMIT_SMI_CHECK;
585 if (index.is_inobject()) { 592 if (index < 0) {
586 // Set the property straight into the object. 593 // Set the property straight into the object.
587 __ Str(value_reg, FieldMemOperand(receiver_reg, index.offset())); 594 int offset = object->map()->instance_size() + (index * kPointerSize);
595 __ Str(value_reg, FieldMemOperand(receiver_reg, offset));
588 596
589 if (!representation.IsSmi()) { 597 if (!representation.IsSmi()) {
590 // Skip updating write barrier if storing a smi. 598 // Skip updating write barrier if storing a smi.
591 __ JumpIfSmi(value_reg, &exit); 599 __ JumpIfSmi(value_reg, &exit);
592 600
593 // Update the write barrier for the array address. 601 // Update the write barrier for the array address.
594 // Pass the now unused name_reg as a scratch register. 602 // Pass the now unused name_reg as a scratch register.
595 __ Mov(name_reg, value_reg); 603 __ Mov(name_reg, value_reg);
596 __ RecordWriteField(receiver_reg, 604 __ RecordWriteField(receiver_reg,
597 index.offset(), 605 offset,
598 name_reg, 606 name_reg,
599 scratch1, 607 scratch1,
600 kLRHasNotBeenSaved, 608 kLRHasNotBeenSaved,
601 kDontSaveFPRegs, 609 kDontSaveFPRegs,
602 EMIT_REMEMBERED_SET, 610 EMIT_REMEMBERED_SET,
603 smi_check); 611 smi_check);
604 } 612 }
605 } else { 613 } else {
606 // Write to the properties array. 614 // Write to the properties array.
615 int offset = index * kPointerSize + FixedArray::kHeaderSize;
607 // Get the properties array 616 // Get the properties array
608 __ Ldr(scratch1, 617 __ Ldr(scratch1,
609 FieldMemOperand(receiver_reg, JSObject::kPropertiesOffset)); 618 FieldMemOperand(receiver_reg, JSObject::kPropertiesOffset));
610 __ Str(value_reg, FieldMemOperand(scratch1, index.offset())); 619 __ Str(value_reg, FieldMemOperand(scratch1, offset));
611 620
612 if (!representation.IsSmi()) { 621 if (!representation.IsSmi()) {
613 // Skip updating write barrier if storing a smi. 622 // Skip updating write barrier if storing a smi.
614 __ JumpIfSmi(value_reg, &exit); 623 __ JumpIfSmi(value_reg, &exit);
615 624
616 // Update the write barrier for the array address. 625 // Update the write barrier for the array address.
617 // Ok to clobber receiver_reg and name_reg, since we return. 626 // Ok to clobber receiver_reg and name_reg, since we return.
618 __ Mov(name_reg, value_reg); 627 __ Mov(name_reg, value_reg);
619 __ RecordWriteField(scratch1, 628 __ RecordWriteField(scratch1,
620 index.offset(), 629 offset,
621 name_reg, 630 name_reg,
622 receiver_reg, 631 receiver_reg,
623 kLRHasNotBeenSaved, 632 kLRHasNotBeenSaved,
624 kDontSaveFPRegs, 633 kDontSaveFPRegs,
625 EMIT_REMEMBERED_SET, 634 EMIT_REMEMBERED_SET,
626 smi_check); 635 smi_check);
627 } 636 }
628 } 637 }
629 638
630 __ Bind(&exit); 639 __ Bind(&exit);
(...skipping 320 matching lines...) Expand 10 before | Expand all | Expand 10 after
951 __ B(ne, &miss); 960 __ B(ne, &miss);
952 } 961 }
953 962
954 HandlerFrontendFooter(name, &miss); 963 HandlerFrontendFooter(name, &miss);
955 return reg; 964 return reg;
956 } 965 }
957 966
958 967
959 void LoadStubCompiler::GenerateLoadField(Register reg, 968 void LoadStubCompiler::GenerateLoadField(Register reg,
960 Handle<JSObject> holder, 969 Handle<JSObject> holder,
961 FieldIndex field, 970 PropertyIndex field,
962 Representation representation) { 971 Representation representation) {
963 __ Mov(receiver(), reg); 972 __ Mov(receiver(), reg);
964 if (kind() == Code::LOAD_IC) { 973 if (kind() == Code::LOAD_IC) {
965 LoadFieldStub stub(isolate(), field); 974 LoadFieldStub stub(isolate(),
975 field.is_inobject(holder),
976 field.translate(holder),
977 representation);
966 GenerateTailCall(masm(), stub.GetCode()); 978 GenerateTailCall(masm(), stub.GetCode());
967 } else { 979 } else {
968 KeyedLoadFieldStub stub(isolate(), field); 980 KeyedLoadFieldStub stub(isolate(),
981 field.is_inobject(holder),
982 field.translate(holder),
983 representation);
969 GenerateTailCall(masm(), stub.GetCode()); 984 GenerateTailCall(masm(), stub.GetCode());
970 } 985 }
971 } 986 }
972 987
973 988
974 void LoadStubCompiler::GenerateLoadConstant(Handle<Object> value) { 989 void LoadStubCompiler::GenerateLoadConstant(Handle<Object> value) {
975 // Return the constant value. 990 // Return the constant value.
976 __ LoadObject(x0, value); 991 __ LoadObject(x0, value);
977 __ Ret(); 992 __ Ret();
978 } 993 }
(...skipping 489 matching lines...) Expand 10 before | Expand all | Expand 10 after
1468 1483
1469 // Miss case, call the runtime. 1484 // Miss case, call the runtime.
1470 __ Bind(&miss); 1485 __ Bind(&miss);
1471 TailCallBuiltin(masm, Builtins::kKeyedLoadIC_Miss); 1486 TailCallBuiltin(masm, Builtins::kKeyedLoadIC_Miss);
1472 } 1487 }
1473 1488
1474 1489
1475 } } // namespace v8::internal 1490 } } // namespace v8::internal
1476 1491
1477 #endif // V8_TARGET_ARCH_ARM64 1492 #endif // V8_TARGET_ARCH_ARM64
OLDNEW
« no previous file with comments | « src/arm/stub-cache-arm.cc ('k') | src/bootstrapper.cc » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698