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 56 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... | |
67 ASSERT(extra_args == NO_EXTRA_ARGUMENTS); | 67 ASSERT(extra_args == NO_EXTRA_ARGUMENTS); |
68 } | 68 } |
69 | 69 |
70 // JumpToExternalReference expects eax to contain the number of arguments | 70 // JumpToExternalReference expects eax to contain the number of arguments |
71 // including the receiver and the extra arguments. | 71 // including the receiver and the extra arguments. |
72 __ add(eax, Immediate(num_extra_args + 1)); | 72 __ add(eax, Immediate(num_extra_args + 1)); |
73 __ JumpToExternalReference(ExternalReference(id, masm->isolate())); | 73 __ JumpToExternalReference(ExternalReference(id, masm->isolate())); |
74 } | 74 } |
75 | 75 |
76 | 76 |
77 static void CallRuntimePassFunction(MacroAssembler* masm, | |
78 Runtime::FunctionId function_id) { | |
79 FrameScope scope(masm, StackFrame::INTERNAL); | |
80 // Push a copy of the function. | |
81 __ push(edi); | |
82 // Push call kind information. | |
83 __ push(ecx); | |
84 // Function is also the parameter to the runtime call. | |
85 __ push(edi); | |
86 | |
87 __ CallRuntime(function_id, 1); | |
88 // Restore call kind information. | |
89 __ pop(ecx); | |
90 // Restore receiver. | |
91 __ pop(edi); | |
92 } | |
93 | |
94 | |
77 static void GenerateTailCallToSharedCode(MacroAssembler* masm) { | 95 static void GenerateTailCallToSharedCode(MacroAssembler* masm) { |
78 __ mov(eax, FieldOperand(edi, JSFunction::kSharedFunctionInfoOffset)); | 96 __ mov(eax, FieldOperand(edi, JSFunction::kSharedFunctionInfoOffset)); |
79 __ mov(eax, FieldOperand(eax, SharedFunctionInfo::kCodeOffset)); | 97 __ mov(eax, FieldOperand(eax, SharedFunctionInfo::kCodeOffset)); |
80 __ lea(eax, FieldOperand(eax, Code::kHeaderSize)); | 98 __ lea(eax, FieldOperand(eax, Code::kHeaderSize)); |
81 __ jmp(eax); | 99 __ jmp(eax); |
82 } | 100 } |
83 | 101 |
84 | 102 |
85 void Builtins::Generate_InRecompileQueue(MacroAssembler* masm) { | 103 void Builtins::Generate_InRecompileQueue(MacroAssembler* masm) { |
104 Label ok; | |
105 // Check stack limit for signal to install code. | |
Michael Starzinger
2013/09/12 10:53:10
As discussed offline: Since this stack-check is on
| |
106 ExternalReference stack_limit = | |
107 ExternalReference::address_of_stack_limit(masm->isolate()); | |
108 __ cmp(esp, Operand::StaticVariable(stack_limit)); | |
109 __ j(above_equal, &ok, Label::kNear); | |
110 | |
111 CallRuntimePassFunction(masm, Runtime::kTryInstallRecompiledCode); | |
112 // Tail call to returned code. | |
113 __ lea(eax, FieldOperand(eax, Code::kHeaderSize)); | |
114 __ jmp(eax); | |
115 | |
116 __ bind(&ok); | |
86 GenerateTailCallToSharedCode(masm); | 117 GenerateTailCallToSharedCode(masm); |
87 } | 118 } |
88 | 119 |
89 | 120 |
90 void Builtins::Generate_InstallRecompiledCode(MacroAssembler* masm) { | |
91 { | |
92 FrameScope scope(masm, StackFrame::INTERNAL); | |
93 | |
94 // Push a copy of the function. | |
95 __ push(edi); | |
96 // Push call kind information. | |
97 __ push(ecx); | |
98 | |
99 __ push(edi); // Function is also the parameter to the runtime call. | |
100 __ CallRuntime(Runtime::kInstallRecompiledCode, 1); | |
101 | |
102 // Restore call kind information. | |
103 __ pop(ecx); | |
104 // Restore receiver. | |
105 __ pop(edi); | |
106 | |
107 // Tear down internal frame. | |
108 } | |
109 | |
110 // Do a tail-call of the compiled function. | |
111 __ lea(eax, FieldOperand(eax, Code::kHeaderSize)); | |
112 __ jmp(eax); | |
113 } | |
114 | |
115 | |
116 void Builtins::Generate_ConcurrentRecompile(MacroAssembler* masm) { | 121 void Builtins::Generate_ConcurrentRecompile(MacroAssembler* masm) { |
117 { | 122 CallRuntimePassFunction(masm, Runtime::kConcurrentRecompile); |
118 FrameScope scope(masm, StackFrame::INTERNAL); | |
119 | |
120 // Push a copy of the function onto the stack. | |
121 __ push(edi); | |
122 // Push call kind information. | |
123 __ push(ecx); | |
124 | |
125 __ push(edi); // Function is also the parameter to the runtime call. | |
126 __ CallRuntime(Runtime::kConcurrentRecompile, 1); | |
127 | |
128 // Restore call kind information. | |
129 __ pop(ecx); | |
130 // Restore receiver. | |
131 __ pop(edi); | |
132 | |
133 // Tear down internal frame. | |
134 } | |
135 | |
136 GenerateTailCallToSharedCode(masm); | 123 GenerateTailCallToSharedCode(masm); |
137 } | 124 } |
138 | 125 |
139 | 126 |
140 static void Generate_JSConstructStubHelper(MacroAssembler* masm, | 127 static void Generate_JSConstructStubHelper(MacroAssembler* masm, |
141 bool is_api_function, | 128 bool is_api_function, |
142 bool count_constructions) { | 129 bool count_constructions) { |
143 // ----------- S t a t e ------------- | 130 // ----------- S t a t e ------------- |
144 // -- eax: number of arguments | 131 // -- eax: number of arguments |
145 // -- edi: constructor function | 132 // -- edi: constructor function |
(...skipping 366 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... | |
512 Generate_JSEntryTrampolineHelper(masm, false); | 499 Generate_JSEntryTrampolineHelper(masm, false); |
513 } | 500 } |
514 | 501 |
515 | 502 |
516 void Builtins::Generate_JSConstructEntryTrampoline(MacroAssembler* masm) { | 503 void Builtins::Generate_JSConstructEntryTrampoline(MacroAssembler* masm) { |
517 Generate_JSEntryTrampolineHelper(masm, true); | 504 Generate_JSEntryTrampolineHelper(masm, true); |
518 } | 505 } |
519 | 506 |
520 | 507 |
521 void Builtins::Generate_LazyCompile(MacroAssembler* masm) { | 508 void Builtins::Generate_LazyCompile(MacroAssembler* masm) { |
522 { | 509 CallRuntimePassFunction(masm, Runtime::kLazyCompile); |
523 FrameScope scope(masm, StackFrame::INTERNAL); | |
524 | |
525 // Push a copy of the function. | |
526 __ push(edi); | |
527 // Push call kind information. | |
528 __ push(ecx); | |
529 | |
530 __ push(edi); // Function is also the parameter to the runtime call. | |
531 __ CallRuntime(Runtime::kLazyCompile, 1); | |
532 | |
533 // Restore call kind information. | |
534 __ pop(ecx); | |
535 // Restore receiver. | |
536 __ pop(edi); | |
537 | |
538 // Tear down internal frame. | |
539 } | |
540 | |
541 // Do a tail-call of the compiled function. | 510 // Do a tail-call of the compiled function. |
542 __ lea(eax, FieldOperand(eax, Code::kHeaderSize)); | 511 __ lea(eax, FieldOperand(eax, Code::kHeaderSize)); |
543 __ jmp(eax); | 512 __ jmp(eax); |
544 } | 513 } |
545 | 514 |
546 | 515 |
547 void Builtins::Generate_LazyRecompile(MacroAssembler* masm) { | 516 void Builtins::Generate_LazyRecompile(MacroAssembler* masm) { |
548 { | 517 CallRuntimePassFunction(masm, Runtime::kLazyRecompile); |
549 FrameScope scope(masm, StackFrame::INTERNAL); | |
550 | |
551 // Push a copy of the function onto the stack. | |
552 __ push(edi); | |
553 // Push call kind information. | |
554 __ push(ecx); | |
555 | |
556 __ push(edi); // Function is also the parameter to the runtime call. | |
557 __ CallRuntime(Runtime::kLazyRecompile, 1); | |
558 | |
559 // Restore call kind information. | |
560 __ pop(ecx); | |
561 // Restore receiver. | |
562 __ pop(edi); | |
563 | |
564 // Tear down internal frame. | |
565 } | |
566 | |
567 // Do a tail-call of the compiled function. | 518 // Do a tail-call of the compiled function. |
568 __ lea(eax, FieldOperand(eax, Code::kHeaderSize)); | 519 __ lea(eax, FieldOperand(eax, Code::kHeaderSize)); |
569 __ jmp(eax); | 520 __ jmp(eax); |
570 } | 521 } |
571 | 522 |
572 | 523 |
573 static void GenerateMakeCodeYoungAgainCommon(MacroAssembler* masm) { | 524 static void GenerateMakeCodeYoungAgainCommon(MacroAssembler* masm) { |
574 // For now, we are relying on the fact that make_code_young doesn't do any | 525 // For now, we are relying on the fact that make_code_young doesn't do any |
575 // garbage collection which allows us to save/restore the registers without | 526 // garbage collection which allows us to save/restore the registers without |
576 // worrying about which of them contain pointers. We also don't build an | 527 // worrying about which of them contain pointers. We also don't build an |
(...skipping 792 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... | |
1369 // And "return" to the OSR entry point of the function. | 1320 // And "return" to the OSR entry point of the function. |
1370 __ ret(0); | 1321 __ ret(0); |
1371 } | 1322 } |
1372 | 1323 |
1373 | 1324 |
1374 #undef __ | 1325 #undef __ |
1375 } | 1326 } |
1376 } // namespace v8::internal | 1327 } // namespace v8::internal |
1377 | 1328 |
1378 #endif // V8_TARGET_ARCH_IA32 | 1329 #endif // V8_TARGET_ARCH_IA32 |
OLD | NEW |