Chromium Code Reviews
chromiumcodereview-hr@appspot.gserviceaccount.com (chromiumcodereview-hr) | Please choose your nickname with Settings | Help | Chromium Project | Gerrit Changes | Sign out
(455)

Side by Side Diff: src/ia32/builtins-ia32.cc

Issue 346413004: Remove distinction between hidden and normal runtime functions (Closed) Base URL: https://v8.googlecode.com/svn/branches/bleeding_edge
Patch Set: Fix natives fuzzing Created 6 years, 6 months ago
Use n/p to move between diff chunks; N/P to move between comments. Draft comments are only viewable by you.
Jump to:
View unified diff | Download patch | Annotate | Revision Log
OLDNEW
1 // Copyright 2012 the V8 project authors. All rights reserved. 1 // Copyright 2012 the V8 project authors. All rights reserved.
2 // Use of this source code is governed by a BSD-style license that can be 2 // Use of this source code is governed by a BSD-style license that can be
3 // found in the LICENSE file. 3 // found in the LICENSE file.
4 4
5 #include "src/v8.h" 5 #include "src/v8.h"
6 6
7 #if V8_TARGET_ARCH_IA32 7 #if V8_TARGET_ARCH_IA32
8 8
9 #include "src/codegen.h" 9 #include "src/codegen.h"
10 #include "src/deoptimizer.h" 10 #include "src/deoptimizer.h"
(...skipping 74 matching lines...) Expand 10 before | Expand all | Expand 10 after
85 // since we come across interrupts and stack checks elsewhere. However, 85 // since we come across interrupts and stack checks elsewhere. However,
86 // not checking may delay installing ready functions, and always checking 86 // not checking may delay installing ready functions, and always checking
87 // would be quite expensive. A good compromise is to first check against 87 // would be quite expensive. A good compromise is to first check against
88 // stack limit as a cue for an interrupt signal. 88 // stack limit as a cue for an interrupt signal.
89 Label ok; 89 Label ok;
90 ExternalReference stack_limit = 90 ExternalReference stack_limit =
91 ExternalReference::address_of_stack_limit(masm->isolate()); 91 ExternalReference::address_of_stack_limit(masm->isolate());
92 __ cmp(esp, Operand::StaticVariable(stack_limit)); 92 __ cmp(esp, Operand::StaticVariable(stack_limit));
93 __ j(above_equal, &ok, Label::kNear); 93 __ j(above_equal, &ok, Label::kNear);
94 94
95 CallRuntimePassFunction(masm, Runtime::kHiddenTryInstallOptimizedCode); 95 CallRuntimePassFunction(masm, Runtime::kTryInstallOptimizedCode);
96 GenerateTailCallToReturnedCode(masm); 96 GenerateTailCallToReturnedCode(masm);
97 97
98 __ bind(&ok); 98 __ bind(&ok);
99 GenerateTailCallToSharedCode(masm); 99 GenerateTailCallToSharedCode(masm);
100 } 100 }
101 101
102 102
103 static void Generate_JSConstructStubHelper(MacroAssembler* masm, 103 static void Generate_JSConstructStubHelper(MacroAssembler* masm,
104 bool is_api_function, 104 bool is_api_function,
105 bool create_memento) { 105 bool create_memento) {
(...skipping 65 matching lines...) Expand 10 before | Expand all | Expand 10 after
171 __ sub(FieldOperand(eax, Map::kBitField3Offset), 171 __ sub(FieldOperand(eax, Map::kBitField3Offset),
172 Immediate(1 << Map::ConstructionCount::kShift)); 172 Immediate(1 << Map::ConstructionCount::kShift));
173 173
174 __ cmp(esi, JSFunction::kFinishSlackTracking); 174 __ cmp(esi, JSFunction::kFinishSlackTracking);
175 __ j(not_equal, &allocate); 175 __ j(not_equal, &allocate);
176 176
177 __ push(eax); 177 __ push(eax);
178 __ push(edi); 178 __ push(edi);
179 179
180 __ push(edi); // constructor 180 __ push(edi); // constructor
181 __ CallRuntime(Runtime::kHiddenFinalizeInstanceSize, 1); 181 __ CallRuntime(Runtime::kFinalizeInstanceSize, 1);
182 182
183 __ pop(edi); 183 __ pop(edi);
184 __ pop(eax); 184 __ pop(eax);
185 __ xor_(esi, esi); // JSFunction::kNoSlackTracking 185 __ xor_(esi, esi); // JSFunction::kNoSlackTracking
186 186
187 __ bind(&allocate); 187 __ bind(&allocate);
188 } 188 }
189 189
190 // Now allocate the JSObject on the heap. 190 // Now allocate the JSObject on the heap.
191 // edi: constructor 191 // edi: constructor
(...skipping 160 matching lines...) Expand 10 before | Expand all | Expand 10 after
352 __ push(edi); 352 __ push(edi);
353 offset = kPointerSize; 353 offset = kPointerSize;
354 } 354 }
355 355
356 // Must restore esi (context) and edi (constructor) before calling runtime. 356 // Must restore esi (context) and edi (constructor) before calling runtime.
357 __ mov(esi, Operand(ebp, StandardFrameConstants::kContextOffset)); 357 __ mov(esi, Operand(ebp, StandardFrameConstants::kContextOffset));
358 __ mov(edi, Operand(esp, offset)); 358 __ mov(edi, Operand(esp, offset));
359 // edi: function (constructor) 359 // edi: function (constructor)
360 __ push(edi); 360 __ push(edi);
361 if (create_memento) { 361 if (create_memento) {
362 __ CallRuntime(Runtime::kHiddenNewObjectWithAllocationSite, 2); 362 __ CallRuntime(Runtime::kNewObjectWithAllocationSite, 2);
363 } else { 363 } else {
364 __ CallRuntime(Runtime::kHiddenNewObject, 1); 364 __ CallRuntime(Runtime::kNewObject, 1);
365 } 365 }
366 __ mov(ebx, eax); // store result in ebx 366 __ mov(ebx, eax); // store result in ebx
367 367
368 // If we ended up using the runtime, and we want a memento, then the 368 // If we ended up using the runtime, and we want a memento, then the
369 // runtime call made it for us, and we shouldn't do create count 369 // runtime call made it for us, and we shouldn't do create count
370 // increment. 370 // increment.
371 Label count_incremented; 371 Label count_incremented;
372 if (create_memento) { 372 if (create_memento) {
373 __ jmp(&count_incremented); 373 __ jmp(&count_incremented);
374 } 374 }
(...skipping 169 matching lines...) Expand 10 before | Expand all | Expand 10 after
544 Generate_JSEntryTrampolineHelper(masm, false); 544 Generate_JSEntryTrampolineHelper(masm, false);
545 } 545 }
546 546
547 547
548 void Builtins::Generate_JSConstructEntryTrampoline(MacroAssembler* masm) { 548 void Builtins::Generate_JSConstructEntryTrampoline(MacroAssembler* masm) {
549 Generate_JSEntryTrampolineHelper(masm, true); 549 Generate_JSEntryTrampolineHelper(masm, true);
550 } 550 }
551 551
552 552
553 void Builtins::Generate_CompileUnoptimized(MacroAssembler* masm) { 553 void Builtins::Generate_CompileUnoptimized(MacroAssembler* masm) {
554 CallRuntimePassFunction(masm, Runtime::kHiddenCompileUnoptimized); 554 CallRuntimePassFunction(masm, Runtime::kCompileUnoptimized);
555 GenerateTailCallToReturnedCode(masm); 555 GenerateTailCallToReturnedCode(masm);
556 } 556 }
557 557
558 558
559 559
560 static void CallCompileOptimized(MacroAssembler* masm, bool concurrent) { 560 static void CallCompileOptimized(MacroAssembler* masm, bool concurrent) {
561 FrameScope scope(masm, StackFrame::INTERNAL); 561 FrameScope scope(masm, StackFrame::INTERNAL);
562 // Push a copy of the function. 562 // Push a copy of the function.
563 __ push(edi); 563 __ push(edi);
564 // Function is also the parameter to the runtime call. 564 // Function is also the parameter to the runtime call.
565 __ push(edi); 565 __ push(edi);
566 // Whether to compile in a background thread. 566 // Whether to compile in a background thread.
567 __ Push(masm->isolate()->factory()->ToBoolean(concurrent)); 567 __ Push(masm->isolate()->factory()->ToBoolean(concurrent));
568 568
569 __ CallRuntime(Runtime::kHiddenCompileOptimized, 2); 569 __ CallRuntime(Runtime::kCompileOptimized, 2);
570 // Restore receiver. 570 // Restore receiver.
571 __ pop(edi); 571 __ pop(edi);
572 } 572 }
573 573
574 574
575 void Builtins::Generate_CompileOptimized(MacroAssembler* masm) { 575 void Builtins::Generate_CompileOptimized(MacroAssembler* masm) {
576 CallCompileOptimized(masm, false); 576 CallCompileOptimized(masm, false);
577 GenerateTailCallToReturnedCode(masm); 577 GenerateTailCallToReturnedCode(masm);
578 } 578 }
579 579
(...skipping 83 matching lines...) Expand 10 before | Expand all | Expand 10 after
663 static void Generate_NotifyStubFailureHelper(MacroAssembler* masm, 663 static void Generate_NotifyStubFailureHelper(MacroAssembler* masm,
664 SaveFPRegsMode save_doubles) { 664 SaveFPRegsMode save_doubles) {
665 // Enter an internal frame. 665 // Enter an internal frame.
666 { 666 {
667 FrameScope scope(masm, StackFrame::INTERNAL); 667 FrameScope scope(masm, StackFrame::INTERNAL);
668 668
669 // Preserve registers across notification, this is important for compiled 669 // Preserve registers across notification, this is important for compiled
670 // stubs that tail call the runtime on deopts passing their parameters in 670 // stubs that tail call the runtime on deopts passing their parameters in
671 // registers. 671 // registers.
672 __ pushad(); 672 __ pushad();
673 __ CallRuntime(Runtime::kHiddenNotifyStubFailure, 0, save_doubles); 673 __ CallRuntime(Runtime::kNotifyStubFailure, 0, save_doubles);
674 __ popad(); 674 __ popad();
675 // Tear down internal frame. 675 // Tear down internal frame.
676 } 676 }
677 677
678 __ pop(MemOperand(esp, 0)); // Ignore state offset 678 __ pop(MemOperand(esp, 0)); // Ignore state offset
679 __ ret(0); // Return to IC Miss stub, continuation still on stack. 679 __ ret(0); // Return to IC Miss stub, continuation still on stack.
680 } 680 }
681 681
682 682
683 void Builtins::Generate_NotifyStubFailure(MacroAssembler* masm) { 683 void Builtins::Generate_NotifyStubFailure(MacroAssembler* masm) {
684 Generate_NotifyStubFailureHelper(masm, kDontSaveFPRegs); 684 Generate_NotifyStubFailureHelper(masm, kDontSaveFPRegs);
685 } 685 }
686 686
687 687
688 void Builtins::Generate_NotifyStubFailureSaveDoubles(MacroAssembler* masm) { 688 void Builtins::Generate_NotifyStubFailureSaveDoubles(MacroAssembler* masm) {
689 Generate_NotifyStubFailureHelper(masm, kSaveFPRegs); 689 Generate_NotifyStubFailureHelper(masm, kSaveFPRegs);
690 } 690 }
691 691
692 692
693 static void Generate_NotifyDeoptimizedHelper(MacroAssembler* masm, 693 static void Generate_NotifyDeoptimizedHelper(MacroAssembler* masm,
694 Deoptimizer::BailoutType type) { 694 Deoptimizer::BailoutType type) {
695 { 695 {
696 FrameScope scope(masm, StackFrame::INTERNAL); 696 FrameScope scope(masm, StackFrame::INTERNAL);
697 697
698 // Pass deoptimization type to the runtime system. 698 // Pass deoptimization type to the runtime system.
699 __ push(Immediate(Smi::FromInt(static_cast<int>(type)))); 699 __ push(Immediate(Smi::FromInt(static_cast<int>(type))));
700 __ CallRuntime(Runtime::kHiddenNotifyDeoptimized, 1); 700 __ CallRuntime(Runtime::kNotifyDeoptimized, 1);
701 701
702 // Tear down internal frame. 702 // Tear down internal frame.
703 } 703 }
704 704
705 // Get the full codegen state from the stack and untag it. 705 // Get the full codegen state from the stack and untag it.
706 __ mov(ecx, Operand(esp, 1 * kPointerSize)); 706 __ mov(ecx, Operand(esp, 1 * kPointerSize));
707 __ SmiUntag(ecx); 707 __ SmiUntag(ecx);
708 708
709 // Switch on the state. 709 // Switch on the state.
710 Label not_no_registers, not_tos_eax; 710 Label not_no_registers, not_tos_eax;
(...skipping 718 matching lines...) Expand 10 before | Expand all | Expand 10 after
1429 1429
1430 void Builtins::Generate_OsrAfterStackCheck(MacroAssembler* masm) { 1430 void Builtins::Generate_OsrAfterStackCheck(MacroAssembler* masm) {
1431 // We check the stack limit as indicator that recompilation might be done. 1431 // We check the stack limit as indicator that recompilation might be done.
1432 Label ok; 1432 Label ok;
1433 ExternalReference stack_limit = 1433 ExternalReference stack_limit =
1434 ExternalReference::address_of_stack_limit(masm->isolate()); 1434 ExternalReference::address_of_stack_limit(masm->isolate());
1435 __ cmp(esp, Operand::StaticVariable(stack_limit)); 1435 __ cmp(esp, Operand::StaticVariable(stack_limit));
1436 __ j(above_equal, &ok, Label::kNear); 1436 __ j(above_equal, &ok, Label::kNear);
1437 { 1437 {
1438 FrameScope scope(masm, StackFrame::INTERNAL); 1438 FrameScope scope(masm, StackFrame::INTERNAL);
1439 __ CallRuntime(Runtime::kHiddenStackGuard, 0); 1439 __ CallRuntime(Runtime::kStackGuard, 0);
1440 } 1440 }
1441 __ jmp(masm->isolate()->builtins()->OnStackReplacement(), 1441 __ jmp(masm->isolate()->builtins()->OnStackReplacement(),
1442 RelocInfo::CODE_TARGET); 1442 RelocInfo::CODE_TARGET);
1443 1443
1444 __ bind(&ok); 1444 __ bind(&ok);
1445 __ ret(0); 1445 __ ret(0);
1446 } 1446 }
1447 1447
1448 #undef __ 1448 #undef __
1449 } 1449 }
1450 } // namespace v8::internal 1450 } // namespace v8::internal
1451 1451
1452 #endif // V8_TARGET_ARCH_IA32 1452 #endif // V8_TARGET_ARCH_IA32
OLDNEW

Powered by Google App Engine
This is Rietveld 408576698