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 55 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... | |
66 ASSERT(extra_args == NO_EXTRA_ARGUMENTS); | 66 ASSERT(extra_args == NO_EXTRA_ARGUMENTS); |
67 } | 67 } |
68 | 68 |
69 // JumpToExternalReference expects rax to contain the number of arguments | 69 // JumpToExternalReference expects rax to contain the number of arguments |
70 // including the receiver and the extra arguments. | 70 // including the receiver and the extra arguments. |
71 __ addq(rax, Immediate(num_extra_args + 1)); | 71 __ addq(rax, Immediate(num_extra_args + 1)); |
72 __ JumpToExternalReference(ExternalReference(id, masm->isolate()), 1); | 72 __ JumpToExternalReference(ExternalReference(id, masm->isolate()), 1); |
73 } | 73 } |
74 | 74 |
75 | 75 |
76 static void GenerateTailCallToSharedCode(MacroAssembler* masm) { | |
77 __ movq(kScratchRegister, | |
78 FieldOperand(rdi, JSFunction::kSharedFunctionInfoOffset)); | |
79 __ movq(kScratchRegister, | |
80 FieldOperand(kScratchRegister, SharedFunctionInfo::kCodeOffset)); | |
81 __ addq(kScratchRegister, Immediate(Code::kHeaderSize - kHeapObjectTag)); | |
Yang
2012/07/19 12:47:30
I'd prefer if you use the lea-instruction and Fiel
sanjoy
2012/07/19 15:06:09
Done.
| |
82 __ jmp(kScratchRegister); | |
83 } | |
84 | |
85 | |
86 void Builtins::Generate_InRecompileQueue(MacroAssembler* masm) { | |
87 GenerateTailCallToSharedCode(masm); | |
88 } | |
89 | |
90 | |
91 void Builtins::Generate_ParallelRecompile(MacroAssembler* masm) { | |
92 { | |
93 FrameScope scope(masm, StackFrame::INTERNAL); | |
94 | |
95 // Push a copy of the function onto the stack. | |
96 __ push(rdi); | |
97 // Push call kind information. | |
98 __ push(rcx); | |
99 | |
100 __ push(rdi); // Function is also the parameter to the runtime call. | |
101 __ CallRuntime(Runtime::kParallelRecompile, 1); | |
102 | |
103 // Restore call kind information. | |
104 __ pop(rcx); | |
105 // Restore receiver. | |
106 __ pop(rdi); | |
107 | |
108 // Tear down internal frame. | |
109 } | |
110 | |
111 GenerateTailCallToSharedCode(masm); | |
112 } | |
113 | |
114 | |
76 static void Generate_JSConstructStubHelper(MacroAssembler* masm, | 115 static void Generate_JSConstructStubHelper(MacroAssembler* masm, |
77 bool is_api_function, | 116 bool is_api_function, |
78 bool count_constructions) { | 117 bool count_constructions) { |
79 // ----------- S t a t e ------------- | 118 // ----------- S t a t e ------------- |
80 // -- rax: number of arguments | 119 // -- rax: number of arguments |
81 // -- rdi: constructor function | 120 // -- rdi: constructor function |
82 // ----------------------------------- | 121 // ----------------------------------- |
83 | 122 |
84 // Should never count constructions for api objects. | 123 // Should never count constructions for api objects. |
85 ASSERT(!is_api_function || !count_constructions); | 124 ASSERT(!is_api_function || !count_constructions); |
(...skipping 1651 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... | |
1737 Deoptimizer::EntryGenerator generator(masm, Deoptimizer::OSR); | 1776 Deoptimizer::EntryGenerator generator(masm, Deoptimizer::OSR); |
1738 generator.Generate(); | 1777 generator.Generate(); |
1739 } | 1778 } |
1740 | 1779 |
1741 | 1780 |
1742 #undef __ | 1781 #undef __ |
1743 | 1782 |
1744 } } // namespace v8::internal | 1783 } } // namespace v8::internal |
1745 | 1784 |
1746 #endif // V8_TARGET_ARCH_X64 | 1785 #endif // V8_TARGET_ARCH_X64 |
OLD | NEW |