Chromium Code Reviews| 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 604 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... | |
| 615 ParameterCount actual(r0); | 615 ParameterCount actual(r0); |
| 616 __ InvokeFunction(r1, actual, CALL_FUNCTION, | 616 __ InvokeFunction(r1, actual, CALL_FUNCTION, |
| 617 NullCallWrapper(), CALL_AS_METHOD); | 617 NullCallWrapper(), CALL_AS_METHOD); |
| 618 } | 618 } |
| 619 | 619 |
| 620 // Store offset of return address for deoptimizer. | 620 // Store offset of return address for deoptimizer. |
| 621 if (!is_api_function && !count_constructions) { | 621 if (!is_api_function && !count_constructions) { |
| 622 masm->isolate()->heap()->SetConstructStubDeoptPCOffset(masm->pc_offset()); | 622 masm->isolate()->heap()->SetConstructStubDeoptPCOffset(masm->pc_offset()); |
| 623 } | 623 } |
| 624 | 624 |
| 625 // Restore context from the frame. | 625 // Restore context and pool pointer from the frame. |
| 626 // r0: result | 626 // r0: result |
| 627 // sp[0]: receiver | 627 // sp[0]: receiver |
| 628 // sp[1]: constructor function | 628 // sp[1]: constructor function |
| 629 // sp[2]: number of arguments (smi-tagged) | 629 // sp[2]: number of arguments (smi-tagged) |
| 630 __ ldr(cp, MemOperand(fp, StandardFrameConstants::kContextOffset)); | 630 __ ldr(cp, MemOperand(fp, StandardFrameConstants::kContextOffset)); |
| 631 __ RestoreConstantPoolPointer(); | |
| 631 | 632 |
| 632 // If the result is an object (in the ECMA sense), we should get rid | 633 // If the result is an object (in the ECMA sense), we should get rid |
| 633 // of the receiver and use the result; see ECMA-262 section 13.2.2-7 | 634 // of the receiver and use the result; see ECMA-262 section 13.2.2-7 |
| 634 // on page 74. | 635 // on page 74. |
| 635 Label use_receiver, exit; | 636 Label use_receiver, exit; |
| 636 | 637 |
| 637 // If the result is a smi, it is *not* an object in the ECMA sense. | 638 // If the result is a smi, it is *not* an object in the ECMA sense. |
| 638 // r0: result | 639 // r0: result |
| 639 // sp[0]: receiver (newly allocated object) | 640 // sp[0]: receiver (newly allocated object) |
| 640 // sp[1]: constructor function | 641 // sp[1]: constructor function |
| (...skipping 57 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... | |
| 698 | 699 |
| 699 // Clear the context before we push it when entering the internal frame. | 700 // Clear the context before we push it when entering the internal frame. |
| 700 __ mov(cp, Operand::Zero()); | 701 __ mov(cp, Operand::Zero()); |
| 701 | 702 |
| 702 // Enter an internal frame. | 703 // Enter an internal frame. |
| 703 { | 704 { |
| 704 FrameScope scope(masm, StackFrame::INTERNAL); | 705 FrameScope scope(masm, StackFrame::INTERNAL); |
| 705 | 706 |
| 706 // Set up the context from the function argument. | 707 // Set up the context from the function argument. |
| 707 __ ldr(cp, FieldMemOperand(r1, JSFunction::kContextOffset)); | 708 __ ldr(cp, FieldMemOperand(r1, JSFunction::kContextOffset)); |
| 709 __ LoadConstantPoolPointer(r1); | |
| 708 | 710 |
| 709 __ InitializeRootRegister(); | 711 __ InitializeRootRegister(); |
| 710 | 712 |
| 711 // Push the function and the receiver onto the stack. | 713 // Push the function and the receiver onto the stack. |
| 712 __ push(r1); | 714 __ push(r1); |
| 713 __ push(r2); | 715 __ push(r2); |
| 714 | 716 |
| 715 // Copy arguments to the stack in a loop. | 717 // Copy arguments to the stack in a loop. |
| 716 // r1: function | 718 // r1: function |
| 717 // r3: argc | 719 // r3: argc |
| (...skipping 118 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... | |
| 836 // r1 - isolate | 838 // r1 - isolate |
| 837 FrameScope scope(masm, StackFrame::MANUAL); | 839 FrameScope scope(masm, StackFrame::MANUAL); |
| 838 __ stm(db_w, sp, r0.bit() | r1.bit() | fp.bit() | lr.bit()); | 840 __ stm(db_w, sp, r0.bit() | r1.bit() | fp.bit() | lr.bit()); |
| 839 __ PrepareCallCFunction(1, 0, r2); | 841 __ PrepareCallCFunction(1, 0, r2); |
| 840 __ mov(r1, Operand(ExternalReference::isolate_address(masm->isolate()))); | 842 __ mov(r1, Operand(ExternalReference::isolate_address(masm->isolate()))); |
| 841 __ CallCFunction(ExternalReference::get_mark_code_as_executed_function( | 843 __ CallCFunction(ExternalReference::get_mark_code_as_executed_function( |
| 842 masm->isolate()), 2); | 844 masm->isolate()), 2); |
| 843 __ ldm(ia_w, sp, r0.bit() | r1.bit() | fp.bit() | lr.bit()); | 845 __ ldm(ia_w, sp, r0.bit() | r1.bit() | fp.bit() | lr.bit()); |
| 844 | 846 |
| 845 // Perform prologue operations usually performed by the young code stub. | 847 // Perform prologue operations usually performed by the young code stub. |
| 846 __ stm(db_w, sp, r1.bit() | cp.bit() | fp.bit() | lr.bit()); | 848 __ PushFixedFrame(r1); |
|
JF
2013/11/26 18:43:59
Maybe I'm missing some context, but why is this ne
rmcilroy
2013/11/27 17:33:56
If code is pre-aged it will hit call this stub (ra
| |
| 847 __ add(fp, sp, Operand(StandardFrameConstants::kFixedFrameSizeFromFp)); | 849 __ add(fp, sp, Operand(StandardFrameConstants::kFixedFrameSizeFromFp)); |
| 848 | 850 |
| 849 // Jump to point after the code-age stub. | 851 // Jump to point after the code-age stub. |
| 850 __ add(r0, r0, Operand(kNoCodeAgeSequenceLength * Assembler::kInstrSize)); | 852 __ add(r0, r0, Operand(kNoCodeAgeSequenceLength * Assembler::kInstrSize)); |
| 851 __ mov(pc, r0); | 853 __ mov(pc, r0); |
| 852 } | 854 } |
| 853 | 855 |
| 854 | 856 |
| 855 void Builtins::Generate_MarkCodeAsExecutedTwice(MacroAssembler* masm) { | 857 void Builtins::Generate_MarkCodeAsExecutedTwice(MacroAssembler* masm) { |
| 856 GenerateMakeCodeYoungAgainCommon(masm); | 858 GenerateMakeCodeYoungAgainCommon(masm); |
| (...skipping 162 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... | |
| 1019 __ b(ne, &slow); | 1021 __ b(ne, &slow); |
| 1020 | 1022 |
| 1021 // 3a. Patch the first argument if necessary when calling a function. | 1023 // 3a. Patch the first argument if necessary when calling a function. |
| 1022 // r0: actual number of arguments | 1024 // r0: actual number of arguments |
| 1023 // r1: function | 1025 // r1: function |
| 1024 Label shift_arguments; | 1026 Label shift_arguments; |
| 1025 __ mov(r4, Operand::Zero()); // indicate regular JS_FUNCTION | 1027 __ mov(r4, Operand::Zero()); // indicate regular JS_FUNCTION |
| 1026 { Label convert_to_object, use_global_receiver, patch_receiver; | 1028 { Label convert_to_object, use_global_receiver, patch_receiver; |
| 1027 // Change context eagerly in case we need the global receiver. | 1029 // Change context eagerly in case we need the global receiver. |
| 1028 __ ldr(cp, FieldMemOperand(r1, JSFunction::kContextOffset)); | 1030 __ ldr(cp, FieldMemOperand(r1, JSFunction::kContextOffset)); |
| 1031 __ LoadConstantPoolPointer(r1); | |
| 1029 | 1032 |
| 1030 // Do not transform the receiver for strict mode functions. | 1033 // Do not transform the receiver for strict mode functions. |
| 1031 __ ldr(r2, FieldMemOperand(r1, JSFunction::kSharedFunctionInfoOffset)); | 1034 __ ldr(r2, FieldMemOperand(r1, JSFunction::kSharedFunctionInfoOffset)); |
| 1032 __ ldr(r3, FieldMemOperand(r2, SharedFunctionInfo::kCompilerHintsOffset)); | 1035 __ ldr(r3, FieldMemOperand(r2, SharedFunctionInfo::kCompilerHintsOffset)); |
| 1033 __ tst(r3, Operand(1 << (SharedFunctionInfo::kStrictModeFunction + | 1036 __ tst(r3, Operand(1 << (SharedFunctionInfo::kStrictModeFunction + |
| 1034 kSmiTagSize))); | 1037 kSmiTagSize))); |
| 1035 __ b(ne, &shift_arguments); | 1038 __ b(ne, &shift_arguments); |
| 1036 | 1039 |
| 1037 // Do not transform the receiver for native (Compilerhints already in r3). | 1040 // Do not transform the receiver for native (Compilerhints already in r3). |
| 1038 __ tst(r3, Operand(1 << (SharedFunctionInfo::kNative + kSmiTagSize))); | 1041 __ tst(r3, Operand(1 << (SharedFunctionInfo::kNative + kSmiTagSize))); |
| (...skipping 307 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... | |
| 1346 // Tear down the internal frame and remove function, receiver and args. | 1349 // Tear down the internal frame and remove function, receiver and args. |
| 1347 } | 1350 } |
| 1348 __ add(sp, sp, Operand(3 * kPointerSize)); | 1351 __ add(sp, sp, Operand(3 * kPointerSize)); |
| 1349 __ Jump(lr); | 1352 __ Jump(lr); |
| 1350 } | 1353 } |
| 1351 | 1354 |
| 1352 | 1355 |
| 1353 static void EnterArgumentsAdaptorFrame(MacroAssembler* masm) { | 1356 static void EnterArgumentsAdaptorFrame(MacroAssembler* masm) { |
| 1354 __ SmiTag(r0); | 1357 __ SmiTag(r0); |
| 1355 __ mov(r4, Operand(Smi::FromInt(StackFrame::ARGUMENTS_ADAPTOR))); | 1358 __ mov(r4, Operand(Smi::FromInt(StackFrame::ARGUMENTS_ADAPTOR))); |
| 1356 __ stm(db_w, sp, r0.bit() | r1.bit() | r4.bit() | fp.bit() | lr.bit()); | 1359 if (FLAG_enable_ool_constant_pool) { |
| 1360 __ stm(db_w, sp, r4.bit() | fp.bit() | lr.bit()); | |
| 1361 __ stm(db_w, sp, r0.bit() | r1.bit() | r4.bit()); | |
|
JF
2013/11/26 18:43:59
Can you explain why r4 is spilled twice?
rmcilroy
2013/11/27 17:33:56
The second r4 is pushed where pp would usually be
| |
| 1362 } else { | |
| 1363 __ stm(db_w, sp, r0.bit() | r1.bit() | r4.bit() | fp.bit() | lr.bit()); | |
| 1364 } | |
| 1357 __ add(fp, sp, | 1365 __ add(fp, sp, |
| 1358 Operand(StandardFrameConstants::kFixedFrameSizeFromFp + kPointerSize)); | 1366 Operand(StandardFrameConstants::kFixedFrameSizeFromFp + kPointerSize)); |
| 1359 } | 1367 } |
| 1360 | 1368 |
| 1361 | 1369 |
| 1362 static void LeaveArgumentsAdaptorFrame(MacroAssembler* masm) { | 1370 static void LeaveArgumentsAdaptorFrame(MacroAssembler* masm) { |
| 1363 // ----------- S t a t e ------------- | 1371 // ----------- S t a t e ------------- |
| 1364 // -- r0 : result being passed through | 1372 // -- r0 : result being passed through |
| 1365 // ----------------------------------- | 1373 // ----------------------------------- |
| 1366 // Get the number of arguments passed (as a smi), tear down the frame and | 1374 // Get the number of arguments passed (as a smi), tear down the frame and |
| (...skipping 115 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... | |
| 1482 __ bind(&dont_adapt_arguments); | 1490 __ bind(&dont_adapt_arguments); |
| 1483 __ Jump(r3); | 1491 __ Jump(r3); |
| 1484 } | 1492 } |
| 1485 | 1493 |
| 1486 | 1494 |
| 1487 #undef __ | 1495 #undef __ |
| 1488 | 1496 |
| 1489 } } // namespace v8::internal | 1497 } } // namespace v8::internal |
| 1490 | 1498 |
| 1491 #endif // V8_TARGET_ARCH_ARM | 1499 #endif // V8_TARGET_ARCH_ARM |
| OLD | NEW |