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

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

Issue 300283002: Introduce FieldIndex to unify and abstract property/field offset (Closed) Base URL: https://v8.googlecode.com/svn/branches/bleeding_edge
Patch Set: Fix mutable boxed double runtime function 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 int index = lookup->GetFieldIndex().field_index(); 525 FieldIndex index = lookup->GetFieldIndex();
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();
531 526
532 Representation representation = lookup->representation(); 527 Representation representation = lookup->representation();
533 ASSERT(!representation.IsNone()); 528 ASSERT(!representation.IsNone());
534 if (representation.IsSmi()) { 529 if (representation.IsSmi()) {
535 __ JumpIfNotSmi(value_reg, miss_label); 530 __ JumpIfNotSmi(value_reg, miss_label);
536 } else if (representation.IsHeapObject()) { 531 } else if (representation.IsHeapObject()) {
537 __ JumpIfSmi(value_reg, miss_label); 532 __ JumpIfSmi(value_reg, miss_label);
538 HeapType* field_type = lookup->GetFieldType(); 533 HeapType* field_type = lookup->GetFieldType();
539 HeapType::Iterator<Map> it = field_type->Classes(); 534 HeapType::Iterator<Map> it = field_type->Classes();
540 if (!it.Done()) { 535 if (!it.Done()) {
(...skipping 10 matching lines...) Expand all
551 } 546 }
552 __ Bind(&do_store); 547 __ Bind(&do_store);
553 } 548 }
554 } else if (representation.IsDouble()) { 549 } else if (representation.IsDouble()) {
555 UseScratchRegisterScope temps(masm); 550 UseScratchRegisterScope temps(masm);
556 DoubleRegister temp_double = temps.AcquireD(); 551 DoubleRegister temp_double = temps.AcquireD();
557 552
558 __ SmiUntagToDouble(temp_double, value_reg, kSpeculativeUntag); 553 __ SmiUntagToDouble(temp_double, value_reg, kSpeculativeUntag);
559 554
560 // Load the double storage. 555 // Load the double storage.
561 if (index < 0) { 556 if (index.is_inobject()) {
562 int offset = (index * kPointerSize) + object->map()->instance_size(); 557 __ Ldr(scratch1, FieldMemOperand(receiver_reg, index.offset()));
563 __ Ldr(scratch1, FieldMemOperand(receiver_reg, offset));
564 } else { 558 } else {
565 int offset = (index * kPointerSize) + FixedArray::kHeaderSize;
566 __ Ldr(scratch1, 559 __ Ldr(scratch1,
567 FieldMemOperand(receiver_reg, JSObject::kPropertiesOffset)); 560 FieldMemOperand(receiver_reg, JSObject::kPropertiesOffset));
568 __ Ldr(scratch1, FieldMemOperand(scratch1, offset)); 561 __ Ldr(scratch1, FieldMemOperand(scratch1, index.offset()));
569 } 562 }
570 563
571 // Store the value into the storage. 564 // Store the value into the storage.
572 Label do_store, heap_number; 565 Label do_store, heap_number;
573 566
574 __ JumpIfSmi(value_reg, &do_store); 567 __ JumpIfSmi(value_reg, &do_store);
575 568
576 __ CheckMap(value_reg, scratch2, Heap::kHeapNumberMapRootIndex, 569 __ CheckMap(value_reg, scratch2, Heap::kHeapNumberMapRootIndex,
577 miss_label, DONT_DO_SMI_CHECK); 570 miss_label, DONT_DO_SMI_CHECK);
578 __ Ldr(temp_double, FieldMemOperand(value_reg, HeapNumber::kValueOffset)); 571 __ Ldr(temp_double, FieldMemOperand(value_reg, HeapNumber::kValueOffset));
579 572
580 __ Bind(&do_store); 573 __ Bind(&do_store);
581 __ Str(temp_double, FieldMemOperand(scratch1, HeapNumber::kValueOffset)); 574 __ Str(temp_double, FieldMemOperand(scratch1, HeapNumber::kValueOffset));
582 575
583 // Return the value (register x0). 576 // Return the value (register x0).
584 ASSERT(value_reg.is(x0)); 577 ASSERT(value_reg.is(x0));
585 __ Ret(); 578 __ Ret();
586 return; 579 return;
587 } 580 }
588 581
589 // TODO(verwaest): Share this code as a code stub. 582 // TODO(verwaest): Share this code as a code stub.
590 SmiCheck smi_check = representation.IsTagged() 583 SmiCheck smi_check = representation.IsTagged()
591 ? INLINE_SMI_CHECK : OMIT_SMI_CHECK; 584 ? INLINE_SMI_CHECK : OMIT_SMI_CHECK;
592 if (index < 0) { 585 if (index.is_inobject()) {
593 // Set the property straight into the object. 586 // Set the property straight into the object.
594 int offset = object->map()->instance_size() + (index * kPointerSize); 587 __ Str(value_reg, FieldMemOperand(receiver_reg, index.offset()));
595 __ Str(value_reg, FieldMemOperand(receiver_reg, offset));
596 588
597 if (!representation.IsSmi()) { 589 if (!representation.IsSmi()) {
598 // Skip updating write barrier if storing a smi. 590 // Skip updating write barrier if storing a smi.
599 __ JumpIfSmi(value_reg, &exit); 591 __ JumpIfSmi(value_reg, &exit);
600 592
601 // Update the write barrier for the array address. 593 // Update the write barrier for the array address.
602 // Pass the now unused name_reg as a scratch register. 594 // Pass the now unused name_reg as a scratch register.
603 __ Mov(name_reg, value_reg); 595 __ Mov(name_reg, value_reg);
604 __ RecordWriteField(receiver_reg, 596 __ RecordWriteField(receiver_reg,
605 offset, 597 index.offset(),
606 name_reg, 598 name_reg,
607 scratch1, 599 scratch1,
608 kLRHasNotBeenSaved, 600 kLRHasNotBeenSaved,
609 kDontSaveFPRegs, 601 kDontSaveFPRegs,
610 EMIT_REMEMBERED_SET, 602 EMIT_REMEMBERED_SET,
611 smi_check); 603 smi_check);
612 } 604 }
613 } else { 605 } else {
614 // Write to the properties array. 606 // Write to the properties array.
615 int offset = index * kPointerSize + FixedArray::kHeaderSize;
616 // Get the properties array 607 // Get the properties array
617 __ Ldr(scratch1, 608 __ Ldr(scratch1,
618 FieldMemOperand(receiver_reg, JSObject::kPropertiesOffset)); 609 FieldMemOperand(receiver_reg, JSObject::kPropertiesOffset));
619 __ Str(value_reg, FieldMemOperand(scratch1, offset)); 610 __ Str(value_reg, FieldMemOperand(scratch1, index.offset()));
620 611
621 if (!representation.IsSmi()) { 612 if (!representation.IsSmi()) {
622 // Skip updating write barrier if storing a smi. 613 // Skip updating write barrier if storing a smi.
623 __ JumpIfSmi(value_reg, &exit); 614 __ JumpIfSmi(value_reg, &exit);
624 615
625 // Update the write barrier for the array address. 616 // Update the write barrier for the array address.
626 // Ok to clobber receiver_reg and name_reg, since we return. 617 // Ok to clobber receiver_reg and name_reg, since we return.
627 __ Mov(name_reg, value_reg); 618 __ Mov(name_reg, value_reg);
628 __ RecordWriteField(scratch1, 619 __ RecordWriteField(scratch1,
629 offset, 620 index.offset(),
630 name_reg, 621 name_reg,
631 receiver_reg, 622 receiver_reg,
632 kLRHasNotBeenSaved, 623 kLRHasNotBeenSaved,
633 kDontSaveFPRegs, 624 kDontSaveFPRegs,
634 EMIT_REMEMBERED_SET, 625 EMIT_REMEMBERED_SET,
635 smi_check); 626 smi_check);
636 } 627 }
637 } 628 }
638 629
639 __ Bind(&exit); 630 __ Bind(&exit);
(...skipping 320 matching lines...) Expand 10 before | Expand all | Expand 10 after
960 __ B(ne, &miss); 951 __ B(ne, &miss);
961 } 952 }
962 953
963 HandlerFrontendFooter(name, &miss); 954 HandlerFrontendFooter(name, &miss);
964 return reg; 955 return reg;
965 } 956 }
966 957
967 958
968 void LoadStubCompiler::GenerateLoadField(Register reg, 959 void LoadStubCompiler::GenerateLoadField(Register reg,
969 Handle<JSObject> holder, 960 Handle<JSObject> holder,
970 PropertyIndex field, 961 FieldIndex field,
971 Representation representation) { 962 Representation representation) {
972 __ Mov(receiver(), reg); 963 __ Mov(receiver(), reg);
973 if (kind() == Code::LOAD_IC) { 964 if (kind() == Code::LOAD_IC) {
974 LoadFieldStub stub(isolate(), 965 LoadFieldStub stub(isolate(), field);
975 field.is_inobject(holder),
976 field.translate(holder),
977 representation);
978 GenerateTailCall(masm(), stub.GetCode()); 966 GenerateTailCall(masm(), stub.GetCode());
979 } else { 967 } else {
980 KeyedLoadFieldStub stub(isolate(), 968 KeyedLoadFieldStub stub(isolate(), field);
981 field.is_inobject(holder),
982 field.translate(holder),
983 representation);
984 GenerateTailCall(masm(), stub.GetCode()); 969 GenerateTailCall(masm(), stub.GetCode());
985 } 970 }
986 } 971 }
987 972
988 973
989 void LoadStubCompiler::GenerateLoadConstant(Handle<Object> value) { 974 void LoadStubCompiler::GenerateLoadConstant(Handle<Object> value) {
990 // Return the constant value. 975 // Return the constant value.
991 __ LoadObject(x0, value); 976 __ LoadObject(x0, value);
992 __ Ret(); 977 __ Ret();
993 } 978 }
(...skipping 489 matching lines...) Expand 10 before | Expand all | Expand 10 after
1483 1468
1484 // Miss case, call the runtime. 1469 // Miss case, call the runtime.
1485 __ Bind(&miss); 1470 __ Bind(&miss);
1486 TailCallBuiltin(masm, Builtins::kKeyedLoadIC_Miss); 1471 TailCallBuiltin(masm, Builtins::kKeyedLoadIC_Miss);
1487 } 1472 }
1488 1473
1489 1474
1490 } } // namespace v8::internal 1475 } } // namespace v8::internal
1491 1476
1492 #endif // V8_TARGET_ARCH_ARM64 1477 #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