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

Side by Side Diff: src/ppc/builtins-ppc.cc

Issue 1226203011: Remove unused byte from Map::instance_sizes field. (Closed) Base URL: https://chromium.googlesource.com/v8/v8.git@master
Patch Set: Ported to all architectures. Created 5 years, 5 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
« no previous file with comments | « src/objects-printer.cc ('k') | src/ppc/macro-assembler-ppc.h » ('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 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 #include "src/v8.h" 5 #include "src/v8.h"
6 6
7 #if V8_TARGET_ARCH_PPC 7 #if V8_TARGET_ARCH_PPC
8 8
9 #include "src/codegen.h" 9 #include "src/codegen.h"
10 #include "src/debug.h" 10 #include "src/debug.h"
(...skipping 364 matching lines...) Expand 10 before | Expand all | Expand 10 after
375 __ beq(&normal_new); 375 __ beq(&normal_new);
376 376
377 // Original constructor and function are different. 377 // Original constructor and function are different.
378 Generate_Runtime_NewObject(masm, create_memento, r6, &count_incremented, 378 Generate_Runtime_NewObject(masm, create_memento, r6, &count_incremented,
379 &allocated); 379 &allocated);
380 __ bind(&normal_new); 380 __ bind(&normal_new);
381 381
382 // Try to allocate the object without transitioning into C code. If any of 382 // Try to allocate the object without transitioning into C code. If any of
383 // the preconditions is not met, the code bails out to the runtime call. 383 // the preconditions is not met, the code bails out to the runtime call.
384 if (FLAG_inline_new) { 384 if (FLAG_inline_new) {
385 Label undo_allocation;
386 ExternalReference debug_step_in_fp = 385 ExternalReference debug_step_in_fp =
387 ExternalReference::debug_step_in_fp_address(isolate); 386 ExternalReference::debug_step_in_fp_address(isolate);
388 __ mov(r5, Operand(debug_step_in_fp)); 387 __ mov(r5, Operand(debug_step_in_fp));
389 __ LoadP(r5, MemOperand(r5)); 388 __ LoadP(r5, MemOperand(r5));
390 __ cmpi(r5, Operand::Zero()); 389 __ cmpi(r5, Operand::Zero());
391 __ bne(&rt_call); 390 __ bne(&rt_call);
392 391
393 // Load the initial map and verify that it is in fact a map. 392 // Load the initial map and verify that it is in fact a map.
394 // r4: constructor function 393 // r4: constructor function
395 __ LoadP(r5, 394 __ LoadP(r5,
(...skipping 71 matching lines...) Expand 10 before | Expand all | Expand 10 after
467 __ LoadRoot(r10, Heap::kUndefinedValueRootIndex); 466 __ LoadRoot(r10, Heap::kUndefinedValueRootIndex);
468 467
469 if (!is_api_function) { 468 if (!is_api_function) {
470 Label no_inobject_slack_tracking; 469 Label no_inobject_slack_tracking;
471 470
472 // Check if slack tracking is enabled. 471 // Check if slack tracking is enabled.
473 __ cmpi(r11, Operand(Map::kSlackTrackingCounterEnd)); 472 __ cmpi(r11, Operand(Map::kSlackTrackingCounterEnd));
474 __ blt(&no_inobject_slack_tracking); 473 __ blt(&no_inobject_slack_tracking);
475 474
476 // Allocate object with a slack. 475 // Allocate object with a slack.
477 __ lbz(r3, FieldMemOperand(r5, Map::kPreAllocatedPropertyFieldsOffset)); 476 __ lbz(r3, FieldMemOperand(r5, Map::kInObjectPropertiesOffset));
477 __ lbz(r5, FieldMemOperand(r5, Map::kUnusedPropertyFieldsOffset));
478 __ sub(r3, r3, r5);
478 if (FLAG_debug_code) { 479 if (FLAG_debug_code) {
479 __ ShiftLeftImm(r0, r3, Operand(kPointerSizeLog2)); 480 __ ShiftLeftImm(r0, r3, Operand(kPointerSizeLog2));
480 __ add(r0, r8, r0); 481 __ add(r0, r8, r0);
481 // r0: offset of first field after pre-allocated fields 482 // r0: offset of first field after pre-allocated fields
482 __ cmp(r0, r9); 483 __ cmp(r0, r9);
483 __ Assert(le, kUnexpectedNumberOfPreAllocatedPropertyFields); 484 __ Assert(le, kUnexpectedNumberOfPreAllocatedPropertyFields);
484 } 485 }
485 { 486 {
486 Label done; 487 Label done;
487 __ cmpi(r3, Operand::Zero()); 488 __ cmpi(r3, Operand::Zero());
(...skipping 20 matching lines...) Expand all
508 __ LoadP(r10, MemOperand(sp, 2 * kPointerSize)); 509 __ LoadP(r10, MemOperand(sp, 2 * kPointerSize));
509 __ StoreP(r10, 510 __ StoreP(r10,
510 MemOperand(r8, AllocationMemento::kAllocationSiteOffset)); 511 MemOperand(r8, AllocationMemento::kAllocationSiteOffset));
511 __ addi(r8, r8, Operand(AllocationMemento::kAllocationSiteOffset + 512 __ addi(r8, r8, Operand(AllocationMemento::kAllocationSiteOffset +
512 kPointerSize)); 513 kPointerSize));
513 } else { 514 } else {
514 __ InitializeFieldsWithFiller(r8, r9, r10); 515 __ InitializeFieldsWithFiller(r8, r9, r10);
515 } 516 }
516 517
517 // Add the object tag to make the JSObject real, so that we can continue 518 // Add the object tag to make the JSObject real, so that we can continue
518 // and jump into the continuation code at any time from now on. Any 519 // and jump into the continuation code at any time from now on.
519 // failures need to undo the allocation, so that the heap is in a
520 // consistent state and verifiable.
521 __ addi(r7, r7, Operand(kHeapObjectTag)); 520 __ addi(r7, r7, Operand(kHeapObjectTag));
522 521
523 // Check if a non-empty properties array is needed. Continue with
524 // allocated object if not; allocate and initialize a FixedArray if yes.
525 // r4: constructor function
526 // r7: JSObject
527 // r8: start of next object (not tagged)
528 __ lbz(r6, FieldMemOperand(r5, Map::kUnusedPropertyFieldsOffset));
529 // The field instance sizes contains both pre-allocated property fields
530 // and in-object properties.
531 __ lbz(r0, FieldMemOperand(r5, Map::kPreAllocatedPropertyFieldsOffset));
532 __ add(r6, r6, r0);
533 __ lbz(r0, FieldMemOperand(r5, Map::kInObjectPropertiesOffset));
534 __ sub(r6, r6, r0, LeaveOE, SetRC);
535
536 // Done if no extra properties are to be allocated.
537 __ beq(&allocated, cr0);
538 __ Assert(ge, kPropertyAllocationCountFailed, cr0);
539
540 // Scale the number of elements by pointer size and add the header for
541 // FixedArrays to the start of the next object calculation from above.
542 // r4: constructor
543 // r6: number of elements in properties array
544 // r7: JSObject
545 // r8: start of next object
546 __ addi(r3, r6, Operand(FixedArray::kHeaderSize / kPointerSize));
547 __ Allocate(
548 r3, r8, r9, r5, &undo_allocation,
549 static_cast<AllocationFlags>(RESULT_CONTAINS_TOP | SIZE_IN_WORDS));
550
551 // Initialize the FixedArray.
552 // r4: constructor
553 // r6: number of elements in properties array
554 // r7: JSObject
555 // r8: FixedArray (not tagged)
556 __ LoadRoot(r9, Heap::kFixedArrayMapRootIndex);
557 __ mr(r5, r8);
558 DCHECK_EQ(0 * kPointerSize, JSObject::kMapOffset);
559 __ StoreP(r9, MemOperand(r5));
560 DCHECK_EQ(1 * kPointerSize, FixedArray::kLengthOffset);
561 __ SmiTag(r3, r6);
562 __ StoreP(r3, MemOperand(r5, kPointerSize));
563 __ addi(r5, r5, Operand(2 * kPointerSize));
564
565 // Initialize the fields to undefined.
566 // r4: constructor function
567 // r5: First element of FixedArray (not tagged)
568 // r6: number of elements in properties array
569 // r7: JSObject
570 // r8: FixedArray (not tagged)
571 DCHECK_EQ(2 * kPointerSize, FixedArray::kHeaderSize);
572 {
573 Label done;
574 __ cmpi(r6, Operand::Zero());
575 __ beq(&done);
576 if (!is_api_function || create_memento) {
577 __ LoadRoot(r10, Heap::kUndefinedValueRootIndex);
578 } else if (FLAG_debug_code) {
579 __ LoadRoot(r11, Heap::kUndefinedValueRootIndex);
580 __ cmp(r10, r11);
581 __ Assert(eq, kUndefinedValueNotLoaded);
582 }
583 __ InitializeNFieldsWithFiller(r5, r6, r10);
584 __ bind(&done);
585 }
586
587 // Store the initialized FixedArray into the properties field of
588 // the JSObject
589 // r4: constructor function
590 // r7: JSObject
591 // r8: FixedArray (not tagged)
592 __ addi(r8, r8, Operand(kHeapObjectTag)); // Add the heap tag.
593 __ StoreP(r8, FieldMemOperand(r7, JSObject::kPropertiesOffset), r0);
594
595 // Continue with JSObject being successfully allocated 522 // Continue with JSObject being successfully allocated
596 // r4: constructor function
597 // r7: JSObject 523 // r7: JSObject
598 __ b(&allocated); 524 __ b(&allocated);
599
600 // Undo the setting of the new top so that the heap is verifiable. For
601 // example, the map's unused properties potentially do not match the
602 // allocated objects unused properties.
603 // r7: JSObject (previous new top)
604 __ bind(&undo_allocation);
605 __ UndoAllocationInNewSpace(r7, r8);
606 } 525 }
607 526
608 // Allocate the new receiver object using the runtime call. 527 // Allocate the new receiver object using the runtime call.
609 // r4: constructor function 528 // r4: constructor function
610 __ bind(&rt_call); 529 __ bind(&rt_call);
611 Generate_Runtime_NewObject(masm, create_memento, r4, &count_incremented, 530 Generate_Runtime_NewObject(masm, create_memento, r4, &count_incremented,
612 &allocated); 531 &allocated);
613 532
614 // Receiver for constructor call allocated. 533 // Receiver for constructor call allocated.
615 // r7: JSObject 534 // r7: JSObject
(...skipping 1283 matching lines...) Expand 10 before | Expand all | Expand 10 after
1899 __ bkpt(0); 1818 __ bkpt(0);
1900 } 1819 }
1901 } 1820 }
1902 1821
1903 1822
1904 #undef __ 1823 #undef __
1905 } // namespace internal 1824 } // namespace internal
1906 } // namespace v8 1825 } // namespace v8
1907 1826
1908 #endif // V8_TARGET_ARCH_PPC 1827 #endif // V8_TARGET_ARCH_PPC
OLDNEW
« no previous file with comments | « src/objects-printer.cc ('k') | src/ppc/macro-assembler-ppc.h » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698