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

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

Issue 7001025: Remove support for branch hints from the IA32 and X64 assembler. (Closed) Base URL: http://v8.googlecode.com/svn/branches/bleeding_edge/
Patch Set: Created 9 years, 7 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
« no previous file with comments | « src/ia32/assembler-ia32.cc ('k') | src/ia32/code-stubs-ia32.cc » ('j') | no next file with comments »
Toggle Intra-line Diffs ('i') | Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
OLDNEW
1 // Copyright 2011 the V8 project authors. All rights reserved. 1 // Copyright 2011 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 338 matching lines...) Expand 10 before | Expand all | Expand 10 after
349 // Restore context from the frame. 349 // Restore context from the frame.
350 __ mov(esi, Operand(ebp, StandardFrameConstants::kContextOffset)); 350 __ mov(esi, Operand(ebp, StandardFrameConstants::kContextOffset));
351 351
352 // If the result is an object (in the ECMA sense), we should get rid 352 // If the result is an object (in the ECMA sense), we should get rid
353 // of the receiver and use the result; see ECMA-262 section 13.2.2-7 353 // of the receiver and use the result; see ECMA-262 section 13.2.2-7
354 // on page 74. 354 // on page 74.
355 Label use_receiver, exit; 355 Label use_receiver, exit;
356 356
357 // If the result is a smi, it is *not* an object in the ECMA sense. 357 // If the result is a smi, it is *not* an object in the ECMA sense.
358 __ test(eax, Immediate(kSmiTagMask)); 358 __ test(eax, Immediate(kSmiTagMask));
359 __ j(zero, &use_receiver, not_taken); 359 __ j(zero, &use_receiver);
360 360
361 // If the type of the result (stored in its map) is less than 361 // If the type of the result (stored in its map) is less than
362 // FIRST_JS_OBJECT_TYPE, it is not an object in the ECMA sense. 362 // FIRST_JS_OBJECT_TYPE, it is not an object in the ECMA sense.
363 __ CmpObjectType(eax, FIRST_JS_OBJECT_TYPE, ecx); 363 __ CmpObjectType(eax, FIRST_JS_OBJECT_TYPE, ecx);
364 __ j(above_equal, &exit, not_taken); 364 __ j(above_equal, &exit);
365 365
366 // Throw away the result of the constructor invocation and use the 366 // Throw away the result of the constructor invocation and use the
367 // on-stack receiver as the result. 367 // on-stack receiver as the result.
368 __ bind(&use_receiver); 368 __ bind(&use_receiver);
369 __ mov(eax, Operand(esp, 0)); 369 __ mov(eax, Operand(esp, 0));
370 370
371 // Restore the arguments count and leave the construct frame. 371 // Restore the arguments count and leave the construct frame.
372 __ bind(&exit); 372 __ bind(&exit);
373 __ mov(ebx, Operand(esp, kPointerSize)); // get arguments count 373 __ mov(ebx, Operand(esp, kPointerSize)); // get arguments count
374 __ LeaveConstructFrame(); 374 __ LeaveConstructFrame();
(...skipping 186 matching lines...) Expand 10 before | Expand all | Expand 10 after
561 __ ret(0); 561 __ ret(0);
562 } 562 }
563 563
564 564
565 void Builtins::Generate_FunctionCall(MacroAssembler* masm) { 565 void Builtins::Generate_FunctionCall(MacroAssembler* masm) {
566 Factory* factory = masm->isolate()->factory(); 566 Factory* factory = masm->isolate()->factory();
567 567
568 // 1. Make sure we have at least one argument. 568 // 1. Make sure we have at least one argument.
569 { Label done; 569 { Label done;
570 __ test(eax, Operand(eax)); 570 __ test(eax, Operand(eax));
571 __ j(not_zero, &done, taken); 571 __ j(not_zero, &done);
572 __ pop(ebx); 572 __ pop(ebx);
573 __ push(Immediate(factory->undefined_value())); 573 __ push(Immediate(factory->undefined_value()));
574 __ push(ebx); 574 __ push(ebx);
575 __ inc(eax); 575 __ inc(eax);
576 __ bind(&done); 576 __ bind(&done);
577 } 577 }
578 578
579 // 2. Get the function to call (passed as receiver) from the stack, check 579 // 2. Get the function to call (passed as receiver) from the stack, check
580 // if it is a function. 580 // if it is a function.
581 Label non_function; 581 Label non_function;
582 // 1 ~ return address. 582 // 1 ~ return address.
583 __ mov(edi, Operand(esp, eax, times_4, 1 * kPointerSize)); 583 __ mov(edi, Operand(esp, eax, times_4, 1 * kPointerSize));
584 __ test(edi, Immediate(kSmiTagMask)); 584 __ test(edi, Immediate(kSmiTagMask));
585 __ j(zero, &non_function, not_taken); 585 __ j(zero, &non_function);
586 __ CmpObjectType(edi, JS_FUNCTION_TYPE, ecx); 586 __ CmpObjectType(edi, JS_FUNCTION_TYPE, ecx);
587 __ j(not_equal, &non_function, not_taken); 587 __ j(not_equal, &non_function);
588 588
589 589
590 // 3a. Patch the first argument if necessary when calling a function. 590 // 3a. Patch the first argument if necessary when calling a function.
591 Label shift_arguments; 591 Label shift_arguments;
592 { Label convert_to_object, use_global_receiver, patch_receiver; 592 { Label convert_to_object, use_global_receiver, patch_receiver;
593 // Change context eagerly in case we need the global receiver. 593 // Change context eagerly in case we need the global receiver.
594 __ mov(esi, FieldOperand(edi, JSFunction::kContextOffset)); 594 __ mov(esi, FieldOperand(edi, JSFunction::kContextOffset));
595 595
596 // Do not transform the receiver for strict mode functions. 596 // Do not transform the receiver for strict mode functions.
597 __ mov(ebx, FieldOperand(edi, JSFunction::kSharedFunctionInfoOffset)); 597 __ mov(ebx, FieldOperand(edi, JSFunction::kSharedFunctionInfoOffset));
(...skipping 79 matching lines...) Expand 10 before | Expand all | Expand 10 after
677 __ mov(Operand(esp, ecx, times_4, kPointerSize), ebx); 677 __ mov(Operand(esp, ecx, times_4, kPointerSize), ebx);
678 __ dec(ecx); 678 __ dec(ecx);
679 __ j(not_sign, &loop); // While non-negative (to copy return address). 679 __ j(not_sign, &loop); // While non-negative (to copy return address).
680 __ pop(ebx); // Discard copy of return address. 680 __ pop(ebx); // Discard copy of return address.
681 __ dec(eax); // One fewer argument (first argument is new receiver). 681 __ dec(eax); // One fewer argument (first argument is new receiver).
682 } 682 }
683 683
684 // 5a. Call non-function via tail call to CALL_NON_FUNCTION builtin. 684 // 5a. Call non-function via tail call to CALL_NON_FUNCTION builtin.
685 { Label function; 685 { Label function;
686 __ test(edi, Operand(edi)); 686 __ test(edi, Operand(edi));
687 __ j(not_zero, &function, taken); 687 __ j(not_zero, &function);
688 __ Set(ebx, Immediate(0)); 688 __ Set(ebx, Immediate(0));
689 __ GetBuiltinEntry(edx, Builtins::CALL_NON_FUNCTION); 689 __ GetBuiltinEntry(edx, Builtins::CALL_NON_FUNCTION);
690 __ jmp(masm->isolate()->builtins()->ArgumentsAdaptorTrampoline(), 690 __ jmp(masm->isolate()->builtins()->ArgumentsAdaptorTrampoline(),
691 RelocInfo::CODE_TARGET); 691 RelocInfo::CODE_TARGET);
692 __ bind(&function); 692 __ bind(&function);
693 } 693 }
694 694
695 // 5b. Get the code to call from the function and check that the number of 695 // 5b. Get the code to call from the function and check that the number of
696 // expected arguments matches what we're providing. If so, jump 696 // expected arguments matches what we're providing. If so, jump
697 // (tail-call) to the code in register edx without checking arguments. 697 // (tail-call) to the code in register edx without checking arguments.
(...skipping 28 matching lines...) Expand all
726 // Make ecx the space we have left. The stack might already be overflowed 726 // Make ecx the space we have left. The stack might already be overflowed
727 // here which will cause ecx to become negative. 727 // here which will cause ecx to become negative.
728 __ mov(ecx, Operand(esp)); 728 __ mov(ecx, Operand(esp));
729 __ sub(ecx, Operand(edi)); 729 __ sub(ecx, Operand(edi));
730 // Make edx the space we need for the array when it is unrolled onto the 730 // Make edx the space we need for the array when it is unrolled onto the
731 // stack. 731 // stack.
732 __ mov(edx, Operand(eax)); 732 __ mov(edx, Operand(eax));
733 __ shl(edx, kPointerSizeLog2 - kSmiTagSize); 733 __ shl(edx, kPointerSizeLog2 - kSmiTagSize);
734 // Check if the arguments will overflow the stack. 734 // Check if the arguments will overflow the stack.
735 __ cmp(ecx, Operand(edx)); 735 __ cmp(ecx, Operand(edx));
736 __ j(greater, &okay, taken); // Signed comparison. 736 __ j(greater, &okay); // Signed comparison.
737 737
738 // Out of stack space. 738 // Out of stack space.
739 __ push(Operand(ebp, 4 * kPointerSize)); // push this 739 __ push(Operand(ebp, 4 * kPointerSize)); // push this
740 __ push(eax); 740 __ push(eax);
741 __ InvokeBuiltin(Builtins::APPLY_OVERFLOW, CALL_FUNCTION); 741 __ InvokeBuiltin(Builtins::APPLY_OVERFLOW, CALL_FUNCTION);
742 __ bind(&okay); 742 __ bind(&okay);
743 // End of stack check. 743 // End of stack check.
744 744
745 // Push current index and limit. 745 // Push current index and limit.
746 const int kLimitOffset = 746 const int kLimitOffset =
(...skipping 835 matching lines...) Expand 10 before | Expand all | Expand 10 after
1582 __ j(not_equal, &skip, Label::kNear); 1582 __ j(not_equal, &skip, Label::kNear);
1583 __ ret(0); 1583 __ ret(0);
1584 1584
1585 // If we decide not to perform on-stack replacement we perform a 1585 // If we decide not to perform on-stack replacement we perform a
1586 // stack guard check to enable interrupts. 1586 // stack guard check to enable interrupts.
1587 __ bind(&stack_check); 1587 __ bind(&stack_check);
1588 Label ok; 1588 Label ok;
1589 ExternalReference stack_limit = 1589 ExternalReference stack_limit =
1590 ExternalReference::address_of_stack_limit(masm->isolate()); 1590 ExternalReference::address_of_stack_limit(masm->isolate());
1591 __ cmp(esp, Operand::StaticVariable(stack_limit)); 1591 __ cmp(esp, Operand::StaticVariable(stack_limit));
1592 __ j(above_equal, &ok, taken, Label::kNear); 1592 __ j(above_equal, &ok, Label::kNear);
1593 StackCheckStub stub; 1593 StackCheckStub stub;
1594 __ TailCallStub(&stub); 1594 __ TailCallStub(&stub);
1595 __ Abort("Unreachable code: returned from tail call."); 1595 __ Abort("Unreachable code: returned from tail call.");
1596 __ bind(&ok); 1596 __ bind(&ok);
1597 __ ret(0); 1597 __ ret(0);
1598 1598
1599 __ bind(&skip); 1599 __ bind(&skip);
1600 // Untag the AST id and push it on the stack. 1600 // Untag the AST id and push it on the stack.
1601 __ SmiUntag(eax); 1601 __ SmiUntag(eax);
1602 __ push(eax); 1602 __ push(eax);
1603 1603
1604 // Generate the code for doing the frame-to-frame translation using 1604 // Generate the code for doing the frame-to-frame translation using
1605 // the deoptimizer infrastructure. 1605 // the deoptimizer infrastructure.
1606 Deoptimizer::EntryGenerator generator(masm, Deoptimizer::OSR); 1606 Deoptimizer::EntryGenerator generator(masm, Deoptimizer::OSR);
1607 generator.Generate(); 1607 generator.Generate();
1608 } 1608 }
1609 1609
1610 1610
1611 #undef __ 1611 #undef __
1612 } 1612 }
1613 } // namespace v8::internal 1613 } // namespace v8::internal
1614 1614
1615 #endif // V8_TARGET_ARCH_IA32 1615 #endif // V8_TARGET_ARCH_IA32
OLDNEW
« no previous file with comments | « src/ia32/assembler-ia32.cc ('k') | src/ia32/code-stubs-ia32.cc » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698