| OLD | NEW |
| 1 // Copyright 2012 the V8 project authors. All rights reserved. | 1 // Copyright 2012 the V8 project authors. All rights reserved. |
| 2 // Redistribution and use in source and binary forms, with or without | 2 // Redistribution and use in source and binary forms, with or without |
| 3 // modification, are permitted provided that the following conditions are | 3 // modification, are permitted provided that the following conditions are |
| 4 // met: | 4 // met: |
| 5 // | 5 // |
| 6 // * Redistributions of source code must retain the above copyright | 6 // * Redistributions of source code must retain the above copyright |
| 7 // notice, this list of conditions and the following disclaimer. | 7 // notice, this list of conditions and the following disclaimer. |
| 8 // * Redistributions in binary form must reproduce the above | 8 // * Redistributions in binary form must reproduce the above |
| 9 // copyright notice, this list of conditions and the following | 9 // copyright notice, this list of conditions and the following |
| 10 // disclaimer in the documentation and/or other materials provided | 10 // disclaimer in the documentation and/or other materials provided |
| (...skipping 429 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 440 __ str(r6, MemOperand(r5, kPointerSize, PostIndex)); | 440 __ str(r6, MemOperand(r5, kPointerSize, PostIndex)); |
| 441 ASSERT_EQ(2 * kPointerSize, JSObject::kElementsOffset); | 441 ASSERT_EQ(2 * kPointerSize, JSObject::kElementsOffset); |
| 442 __ str(r6, MemOperand(r5, kPointerSize, PostIndex)); | 442 __ str(r6, MemOperand(r5, kPointerSize, PostIndex)); |
| 443 | 443 |
| 444 // Fill all the in-object properties with the appropriate filler. | 444 // Fill all the in-object properties with the appropriate filler. |
| 445 // r1: constructor function | 445 // r1: constructor function |
| 446 // r2: initial map | 446 // r2: initial map |
| 447 // r3: object size (in words) | 447 // r3: object size (in words) |
| 448 // r4: JSObject (not tagged) | 448 // r4: JSObject (not tagged) |
| 449 // r5: First in-object property of JSObject (not tagged) | 449 // r5: First in-object property of JSObject (not tagged) |
| 450 __ add(r6, r4, Operand(r3, LSL, kPointerSizeLog2)); // End of object. | |
| 451 ASSERT_EQ(3 * kPointerSize, JSObject::kHeaderSize); | 450 ASSERT_EQ(3 * kPointerSize, JSObject::kHeaderSize); |
| 452 __ LoadRoot(r7, Heap::kUndefinedValueRootIndex); | 451 __ LoadRoot(r6, Heap::kUndefinedValueRootIndex); |
| 453 if (count_constructions) { | 452 if (count_constructions) { |
| 454 __ ldr(r0, FieldMemOperand(r2, Map::kInstanceSizesOffset)); | 453 __ ldr(r0, FieldMemOperand(r2, Map::kInstanceSizesOffset)); |
| 455 __ Ubfx(r0, r0, Map::kPreAllocatedPropertyFieldsByte * kBitsPerByte, | 454 __ Ubfx(r0, r0, Map::kPreAllocatedPropertyFieldsByte * kBitsPerByte, |
| 456 kBitsPerByte); | 455 kBitsPerByte); |
| 457 __ add(r0, r5, Operand(r0, LSL, kPointerSizeLog2)); | 456 __ add(r0, r5, Operand(r0, LSL, kPointerSizeLog2)); |
| 458 // r0: offset of first field after pre-allocated fields | 457 // r0: offset of first field after pre-allocated fields |
| 459 if (FLAG_debug_code) { | 458 if (FLAG_debug_code) { |
| 460 __ cmp(r0, r6); | 459 __ add(ip, r4, Operand(r3, LSL, kPointerSizeLog2)); // End of object. |
| 460 __ cmp(r0, ip); |
| 461 __ Assert(le, kUnexpectedNumberOfPreAllocatedPropertyFields); | 461 __ Assert(le, kUnexpectedNumberOfPreAllocatedPropertyFields); |
| 462 } | 462 } |
| 463 __ InitializeFieldsWithFiller(r5, r0, r7); | 463 __ InitializeFieldsWithFiller(r5, r0, r6); |
| 464 // To allow for truncation. | 464 // To allow for truncation. |
| 465 __ LoadRoot(r7, Heap::kOnePointerFillerMapRootIndex); | 465 __ LoadRoot(r6, Heap::kOnePointerFillerMapRootIndex); |
| 466 } | 466 } |
| 467 __ InitializeFieldsWithFiller(r5, r6, r7); | 467 __ add(r0, r4, Operand(r3, LSL, kPointerSizeLog2)); // End of object. |
| 468 __ InitializeFieldsWithFiller(r5, r0, r6); |
| 468 | 469 |
| 469 // Add the object tag to make the JSObject real, so that we can continue | 470 // Add the object tag to make the JSObject real, so that we can continue |
| 470 // and jump into the continuation code at any time from now on. Any | 471 // and jump into the continuation code at any time from now on. Any |
| 471 // failures need to undo the allocation, so that the heap is in a | 472 // failures need to undo the allocation, so that the heap is in a |
| 472 // consistent state and verifiable. | 473 // consistent state and verifiable. |
| 473 __ add(r4, r4, Operand(kHeapObjectTag)); | 474 __ add(r4, r4, Operand(kHeapObjectTag)); |
| 474 | 475 |
| 475 // Check if a non-empty properties array is needed. Continue with | 476 // Check if a non-empty properties array is needed. Continue with |
| 476 // allocated object if not fall through to runtime call if it is. | 477 // allocated object if not fall through to runtime call if it is. |
| 477 // r1: constructor function | 478 // r1: constructor function |
| (...skipping 44 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 522 | 523 |
| 523 // Initialize the fields to undefined. | 524 // Initialize the fields to undefined. |
| 524 // r1: constructor function | 525 // r1: constructor function |
| 525 // r2: First element of FixedArray (not tagged) | 526 // r2: First element of FixedArray (not tagged) |
| 526 // r3: number of elements in properties array | 527 // r3: number of elements in properties array |
| 527 // r4: JSObject | 528 // r4: JSObject |
| 528 // r5: FixedArray (not tagged) | 529 // r5: FixedArray (not tagged) |
| 529 __ add(r6, r2, Operand(r3, LSL, kPointerSizeLog2)); // End of object. | 530 __ add(r6, r2, Operand(r3, LSL, kPointerSizeLog2)); // End of object. |
| 530 ASSERT_EQ(2 * kPointerSize, FixedArray::kHeaderSize); | 531 ASSERT_EQ(2 * kPointerSize, FixedArray::kHeaderSize); |
| 531 { Label loop, entry; | 532 { Label loop, entry; |
| 532 if (count_constructions) { | 533 __ LoadRoot(r0, Heap::kUndefinedValueRootIndex); |
| 533 __ LoadRoot(r7, Heap::kUndefinedValueRootIndex); | |
| 534 } else if (FLAG_debug_code) { | |
| 535 __ LoadRoot(r8, Heap::kUndefinedValueRootIndex); | |
| 536 __ cmp(r7, r8); | |
| 537 __ Assert(eq, kUndefinedValueNotLoaded); | |
| 538 } | |
| 539 __ b(&entry); | 534 __ b(&entry); |
| 540 __ bind(&loop); | 535 __ bind(&loop); |
| 541 __ str(r7, MemOperand(r2, kPointerSize, PostIndex)); | 536 __ str(r0, MemOperand(r2, kPointerSize, PostIndex)); |
| 542 __ bind(&entry); | 537 __ bind(&entry); |
| 543 __ cmp(r2, r6); | 538 __ cmp(r2, r6); |
| 544 __ b(lt, &loop); | 539 __ b(lt, &loop); |
| 545 } | 540 } |
| 546 | 541 |
| 547 // Store the initialized FixedArray into the properties field of | 542 // Store the initialized FixedArray into the properties field of |
| 548 // the JSObject | 543 // the JSObject |
| 549 // r1: constructor function | 544 // r1: constructor function |
| 550 // r4: JSObject | 545 // r4: JSObject |
| 551 // r5: FixedArray (not tagged) | 546 // r5: FixedArray (not tagged) |
| (...skipping 143 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 695 | 690 |
| 696 | 691 |
| 697 static void Generate_JSEntryTrampolineHelper(MacroAssembler* masm, | 692 static void Generate_JSEntryTrampolineHelper(MacroAssembler* masm, |
| 698 bool is_construct) { | 693 bool is_construct) { |
| 699 // Called from Generate_JS_Entry | 694 // Called from Generate_JS_Entry |
| 700 // r0: code entry | 695 // r0: code entry |
| 701 // r1: function | 696 // r1: function |
| 702 // r2: receiver | 697 // r2: receiver |
| 703 // r3: argc | 698 // r3: argc |
| 704 // r4: argv | 699 // r4: argv |
| 705 // r5-r7, cp may be clobbered | 700 // r5-r6, r7 (if not FLAG_enable_ool_constant_pool) and cp may be clobbered |
| 706 ProfileEntryHookStub::MaybeCallEntryHook(masm); | 701 ProfileEntryHookStub::MaybeCallEntryHook(masm); |
| 707 | 702 |
| 708 // Clear the context before we push it when entering the internal frame. | 703 // Clear the context before we push it when entering the internal frame. |
| 709 __ mov(cp, Operand::Zero()); | 704 __ mov(cp, Operand::Zero()); |
| 710 | 705 |
| 711 // Enter an internal frame. | 706 // Enter an internal frame. |
| 712 { | 707 { |
| 713 FrameScope scope(masm, StackFrame::INTERNAL); | 708 FrameScope scope(masm, StackFrame::INTERNAL); |
| 714 | 709 |
| 715 // Set up the context from the function argument. | 710 // Set up the context from the function argument. |
| (...skipping 19 matching lines...) Expand all Loading... |
| 735 __ push(r0); // push parameter | 730 __ push(r0); // push parameter |
| 736 __ bind(&entry); | 731 __ bind(&entry); |
| 737 __ cmp(r4, r2); | 732 __ cmp(r4, r2); |
| 738 __ b(ne, &loop); | 733 __ b(ne, &loop); |
| 739 | 734 |
| 740 // Initialize all JavaScript callee-saved registers, since they will be seen | 735 // Initialize all JavaScript callee-saved registers, since they will be seen |
| 741 // by the garbage collector as part of handlers. | 736 // by the garbage collector as part of handlers. |
| 742 __ LoadRoot(r4, Heap::kUndefinedValueRootIndex); | 737 __ LoadRoot(r4, Heap::kUndefinedValueRootIndex); |
| 743 __ mov(r5, Operand(r4)); | 738 __ mov(r5, Operand(r4)); |
| 744 __ mov(r6, Operand(r4)); | 739 __ mov(r6, Operand(r4)); |
| 745 __ mov(r7, Operand(r4)); | 740 if (!FLAG_enable_ool_constant_pool) { |
| 741 __ mov(r7, Operand(r4)); |
| 742 } |
| 746 if (kR9Available == 1) { | 743 if (kR9Available == 1) { |
| 747 __ mov(r9, Operand(r4)); | 744 __ mov(r9, Operand(r4)); |
| 748 } | 745 } |
| 749 | 746 |
| 750 // Invoke the code and pass argc as r0. | 747 // Invoke the code and pass argc as r0. |
| 751 __ mov(r0, Operand(r3)); | 748 __ mov(r0, Operand(r3)); |
| 752 if (is_construct) { | 749 if (is_construct) { |
| 753 // No type feedback cell is available | 750 // No type feedback cell is available |
| 754 Handle<Object> undefined_sentinel( | 751 Handle<Object> undefined_sentinel( |
| 755 masm->isolate()->heap()->undefined_value(), masm->isolate()); | 752 masm->isolate()->heap()->undefined_value(), masm->isolate()); |
| (...skipping 681 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 1437 __ bind(&dont_adapt_arguments); | 1434 __ bind(&dont_adapt_arguments); |
| 1438 __ Jump(r3); | 1435 __ Jump(r3); |
| 1439 } | 1436 } |
| 1440 | 1437 |
| 1441 | 1438 |
| 1442 #undef __ | 1439 #undef __ |
| 1443 | 1440 |
| 1444 } } // namespace v8::internal | 1441 } } // namespace v8::internal |
| 1445 | 1442 |
| 1446 #endif // V8_TARGET_ARCH_ARM | 1443 #endif // V8_TARGET_ARCH_ARM |
| OLD | NEW |