| 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 97 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 108 // since we come across interrupts and stack checks elsewhere. However, | 108 // since we come across interrupts and stack checks elsewhere. However, |
| 109 // not checking may delay installing ready functions, and always checking | 109 // not checking may delay installing ready functions, and always checking |
| 110 // would be quite expensive. A good compromise is to first check against | 110 // would be quite expensive. A good compromise is to first check against |
| 111 // stack limit as a cue for an interrupt signal. | 111 // stack limit as a cue for an interrupt signal. |
| 112 Label ok; | 112 Label ok; |
| 113 ExternalReference stack_limit = | 113 ExternalReference stack_limit = |
| 114 ExternalReference::address_of_stack_limit(masm->isolate()); | 114 ExternalReference::address_of_stack_limit(masm->isolate()); |
| 115 __ cmp(esp, Operand::StaticVariable(stack_limit)); | 115 __ cmp(esp, Operand::StaticVariable(stack_limit)); |
| 116 __ j(above_equal, &ok, Label::kNear); | 116 __ j(above_equal, &ok, Label::kNear); |
| 117 | 117 |
| 118 CallRuntimePassFunction(masm, Runtime::kTryInstallOptimizedCode); | 118 CallRuntimePassFunction(masm, Runtime::kHiddenTryInstallOptimizedCode); |
| 119 GenerateTailCallToReturnedCode(masm); | 119 GenerateTailCallToReturnedCode(masm); |
| 120 | 120 |
| 121 __ bind(&ok); | 121 __ bind(&ok); |
| 122 GenerateTailCallToSharedCode(masm); | 122 GenerateTailCallToSharedCode(masm); |
| 123 } | 123 } |
| 124 | 124 |
| 125 | 125 |
| 126 static void Generate_JSConstructStubHelper(MacroAssembler* masm, | 126 static void Generate_JSConstructStubHelper(MacroAssembler* masm, |
| 127 bool is_api_function, | 127 bool is_api_function, |
| 128 bool count_constructions, | 128 bool count_constructions, |
| (...skipping 66 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 195 __ mov(ecx, FieldOperand(edi, JSFunction::kSharedFunctionInfoOffset)); | 195 __ mov(ecx, FieldOperand(edi, JSFunction::kSharedFunctionInfoOffset)); |
| 196 __ dec_b(FieldOperand(ecx, | 196 __ dec_b(FieldOperand(ecx, |
| 197 SharedFunctionInfo::kConstructionCountOffset)); | 197 SharedFunctionInfo::kConstructionCountOffset)); |
| 198 __ j(not_zero, &allocate); | 198 __ j(not_zero, &allocate); |
| 199 | 199 |
| 200 __ push(eax); | 200 __ push(eax); |
| 201 __ push(edi); | 201 __ push(edi); |
| 202 | 202 |
| 203 __ push(edi); // constructor | 203 __ push(edi); // constructor |
| 204 // The call will replace the stub, so the countdown is only done once. | 204 // The call will replace the stub, so the countdown is only done once. |
| 205 __ CallRuntime(Runtime::kFinalizeInstanceSize, 1); | 205 __ CallRuntime(Runtime::kHiddenFinalizeInstanceSize, 1); |
| 206 | 206 |
| 207 __ pop(edi); | 207 __ pop(edi); |
| 208 __ pop(eax); | 208 __ pop(eax); |
| 209 | 209 |
| 210 __ bind(&allocate); | 210 __ bind(&allocate); |
| 211 } | 211 } |
| 212 | 212 |
| 213 // Now allocate the JSObject on the heap. | 213 // Now allocate the JSObject on the heap. |
| 214 // edi: constructor | 214 // edi: constructor |
| 215 // eax: initial map | 215 // eax: initial map |
| (...skipping 147 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 363 __ mov(edi, Operand(esp, kPointerSize * 2)); | 363 __ mov(edi, Operand(esp, kPointerSize * 2)); |
| 364 __ push(edi); | 364 __ push(edi); |
| 365 offset = kPointerSize; | 365 offset = kPointerSize; |
| 366 } | 366 } |
| 367 | 367 |
| 368 // Must restore edi (constructor) before calling runtime. | 368 // Must restore edi (constructor) before calling runtime. |
| 369 __ mov(edi, Operand(esp, offset)); | 369 __ mov(edi, Operand(esp, offset)); |
| 370 // edi: function (constructor) | 370 // edi: function (constructor) |
| 371 __ push(edi); | 371 __ push(edi); |
| 372 if (create_memento) { | 372 if (create_memento) { |
| 373 __ CallRuntime(Runtime::kNewObjectWithAllocationSite, 2); | 373 __ CallRuntime(Runtime::kHiddenNewObjectWithAllocationSite, 2); |
| 374 } else { | 374 } else { |
| 375 __ CallRuntime(Runtime::kNewObject, 1); | 375 __ CallRuntime(Runtime::kHiddenNewObject, 1); |
| 376 } | 376 } |
| 377 __ mov(ebx, eax); // store result in ebx | 377 __ mov(ebx, eax); // store result in ebx |
| 378 | 378 |
| 379 // If we ended up using the runtime, and we want a memento, then the | 379 // If we ended up using the runtime, and we want a memento, then the |
| 380 // runtime call made it for us, and we shouldn't do create count | 380 // runtime call made it for us, and we shouldn't do create count |
| 381 // increment. | 381 // increment. |
| 382 Label count_incremented; | 382 Label count_incremented; |
| 383 if (create_memento) { | 383 if (create_memento) { |
| 384 __ jmp(&count_incremented); | 384 __ jmp(&count_incremented); |
| 385 } | 385 } |
| (...skipping 174 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 560 Generate_JSEntryTrampolineHelper(masm, false); | 560 Generate_JSEntryTrampolineHelper(masm, false); |
| 561 } | 561 } |
| 562 | 562 |
| 563 | 563 |
| 564 void Builtins::Generate_JSConstructEntryTrampoline(MacroAssembler* masm) { | 564 void Builtins::Generate_JSConstructEntryTrampoline(MacroAssembler* masm) { |
| 565 Generate_JSEntryTrampolineHelper(masm, true); | 565 Generate_JSEntryTrampolineHelper(masm, true); |
| 566 } | 566 } |
| 567 | 567 |
| 568 | 568 |
| 569 void Builtins::Generate_CompileUnoptimized(MacroAssembler* masm) { | 569 void Builtins::Generate_CompileUnoptimized(MacroAssembler* masm) { |
| 570 CallRuntimePassFunction(masm, Runtime::kCompileUnoptimized); | 570 CallRuntimePassFunction(masm, Runtime::kHiddenCompileUnoptimized); |
| 571 GenerateTailCallToReturnedCode(masm); | 571 GenerateTailCallToReturnedCode(masm); |
| 572 } | 572 } |
| 573 | 573 |
| 574 | 574 |
| 575 | 575 |
| 576 static void CallCompileOptimized(MacroAssembler* masm, bool concurrent) { | 576 static void CallCompileOptimized(MacroAssembler* masm, bool concurrent) { |
| 577 FrameScope scope(masm, StackFrame::INTERNAL); | 577 FrameScope scope(masm, StackFrame::INTERNAL); |
| 578 // Push a copy of the function. | 578 // Push a copy of the function. |
| 579 __ push(edi); | 579 __ push(edi); |
| 580 // Function is also the parameter to the runtime call. | 580 // Function is also the parameter to the runtime call. |
| 581 __ push(edi); | 581 __ push(edi); |
| 582 // Whether to compile in a background thread. | 582 // Whether to compile in a background thread. |
| 583 __ Push(masm->isolate()->factory()->ToBoolean(concurrent)); | 583 __ Push(masm->isolate()->factory()->ToBoolean(concurrent)); |
| 584 | 584 |
| 585 __ CallRuntime(Runtime::kCompileOptimized, 2); | 585 __ CallRuntime(Runtime::kHiddenCompileOptimized, 2); |
| 586 // Restore receiver. | 586 // Restore receiver. |
| 587 __ pop(edi); | 587 __ pop(edi); |
| 588 } | 588 } |
| 589 | 589 |
| 590 | 590 |
| 591 void Builtins::Generate_CompileOptimized(MacroAssembler* masm) { | 591 void Builtins::Generate_CompileOptimized(MacroAssembler* masm) { |
| 592 CallCompileOptimized(masm, false); | 592 CallCompileOptimized(masm, false); |
| 593 GenerateTailCallToReturnedCode(masm); | 593 GenerateTailCallToReturnedCode(masm); |
| 594 } | 594 } |
| 595 | 595 |
| (...skipping 83 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 679 static void Generate_NotifyStubFailureHelper(MacroAssembler* masm, | 679 static void Generate_NotifyStubFailureHelper(MacroAssembler* masm, |
| 680 SaveFPRegsMode save_doubles) { | 680 SaveFPRegsMode save_doubles) { |
| 681 // Enter an internal frame. | 681 // Enter an internal frame. |
| 682 { | 682 { |
| 683 FrameScope scope(masm, StackFrame::INTERNAL); | 683 FrameScope scope(masm, StackFrame::INTERNAL); |
| 684 | 684 |
| 685 // Preserve registers across notification, this is important for compiled | 685 // Preserve registers across notification, this is important for compiled |
| 686 // stubs that tail call the runtime on deopts passing their parameters in | 686 // stubs that tail call the runtime on deopts passing their parameters in |
| 687 // registers. | 687 // registers. |
| 688 __ pushad(); | 688 __ pushad(); |
| 689 __ CallRuntime(Runtime::kNotifyStubFailure, 0, save_doubles); | 689 __ CallRuntime(Runtime::kHiddenNotifyStubFailure, 0, save_doubles); |
| 690 __ popad(); | 690 __ popad(); |
| 691 // Tear down internal frame. | 691 // Tear down internal frame. |
| 692 } | 692 } |
| 693 | 693 |
| 694 __ pop(MemOperand(esp, 0)); // Ignore state offset | 694 __ pop(MemOperand(esp, 0)); // Ignore state offset |
| 695 __ ret(0); // Return to IC Miss stub, continuation still on stack. | 695 __ ret(0); // Return to IC Miss stub, continuation still on stack. |
| 696 } | 696 } |
| 697 | 697 |
| 698 | 698 |
| 699 void Builtins::Generate_NotifyStubFailure(MacroAssembler* masm) { | 699 void Builtins::Generate_NotifyStubFailure(MacroAssembler* masm) { |
| (...skipping 11 matching lines...) Expand all Loading... |
| 711 } | 711 } |
| 712 | 712 |
| 713 | 713 |
| 714 static void Generate_NotifyDeoptimizedHelper(MacroAssembler* masm, | 714 static void Generate_NotifyDeoptimizedHelper(MacroAssembler* masm, |
| 715 Deoptimizer::BailoutType type) { | 715 Deoptimizer::BailoutType type) { |
| 716 { | 716 { |
| 717 FrameScope scope(masm, StackFrame::INTERNAL); | 717 FrameScope scope(masm, StackFrame::INTERNAL); |
| 718 | 718 |
| 719 // Pass deoptimization type to the runtime system. | 719 // Pass deoptimization type to the runtime system. |
| 720 __ push(Immediate(Smi::FromInt(static_cast<int>(type)))); | 720 __ push(Immediate(Smi::FromInt(static_cast<int>(type)))); |
| 721 __ CallRuntime(Runtime::kNotifyDeoptimized, 1); | 721 __ CallRuntime(Runtime::kHiddenNotifyDeoptimized, 1); |
| 722 | 722 |
| 723 // Tear down internal frame. | 723 // Tear down internal frame. |
| 724 } | 724 } |
| 725 | 725 |
| 726 // Get the full codegen state from the stack and untag it. | 726 // Get the full codegen state from the stack and untag it. |
| 727 __ mov(ecx, Operand(esp, 1 * kPointerSize)); | 727 __ mov(ecx, Operand(esp, 1 * kPointerSize)); |
| 728 __ SmiUntag(ecx); | 728 __ SmiUntag(ecx); |
| 729 | 729 |
| 730 // Switch on the state. | 730 // Switch on the state. |
| 731 Label not_no_registers, not_tos_eax; | 731 Label not_no_registers, not_tos_eax; |
| (...skipping 680 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 1412 | 1412 |
| 1413 void Builtins::Generate_OsrAfterStackCheck(MacroAssembler* masm) { | 1413 void Builtins::Generate_OsrAfterStackCheck(MacroAssembler* masm) { |
| 1414 // We check the stack limit as indicator that recompilation might be done. | 1414 // We check the stack limit as indicator that recompilation might be done. |
| 1415 Label ok; | 1415 Label ok; |
| 1416 ExternalReference stack_limit = | 1416 ExternalReference stack_limit = |
| 1417 ExternalReference::address_of_stack_limit(masm->isolate()); | 1417 ExternalReference::address_of_stack_limit(masm->isolate()); |
| 1418 __ cmp(esp, Operand::StaticVariable(stack_limit)); | 1418 __ cmp(esp, Operand::StaticVariable(stack_limit)); |
| 1419 __ j(above_equal, &ok, Label::kNear); | 1419 __ j(above_equal, &ok, Label::kNear); |
| 1420 { | 1420 { |
| 1421 FrameScope scope(masm, StackFrame::INTERNAL); | 1421 FrameScope scope(masm, StackFrame::INTERNAL); |
| 1422 __ CallRuntime(Runtime::kStackGuard, 0); | 1422 __ CallRuntime(Runtime::kHiddenStackGuard, 0); |
| 1423 } | 1423 } |
| 1424 __ jmp(masm->isolate()->builtins()->OnStackReplacement(), | 1424 __ jmp(masm->isolate()->builtins()->OnStackReplacement(), |
| 1425 RelocInfo::CODE_TARGET); | 1425 RelocInfo::CODE_TARGET); |
| 1426 | 1426 |
| 1427 __ bind(&ok); | 1427 __ bind(&ok); |
| 1428 __ ret(0); | 1428 __ ret(0); |
| 1429 } | 1429 } |
| 1430 | 1430 |
| 1431 #undef __ | 1431 #undef __ |
| 1432 } | 1432 } |
| 1433 } // namespace v8::internal | 1433 } // namespace v8::internal |
| 1434 | 1434 |
| 1435 #endif // V8_TARGET_ARCH_IA32 | 1435 #endif // V8_TARGET_ARCH_IA32 |
| OLD | NEW |