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

Side by Side Diff: src/ia32/full-codegen-ia32.cc

Issue 3421009: Revision 2.4.4.... (Closed) Base URL: http://v8.googlecode.com/svn/trunk/
Patch Set: '' Created 10 years, 3 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/codegen-ia32.cc ('k') | src/parser.h » ('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 2010 the V8 project authors. All rights reserved. 1 // Copyright 2010 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 666 matching lines...) Expand 10 before | Expand all | Expand 10 after
677 677
678 Comment cmnt(masm_, "[ Case comparison"); 678 Comment cmnt(masm_, "[ Case comparison");
679 __ bind(&next_test); 679 __ bind(&next_test);
680 next_test.Unuse(); 680 next_test.Unuse();
681 681
682 // Compile the label expression. 682 // Compile the label expression.
683 VisitForValue(clause->label(), kAccumulator); 683 VisitForValue(clause->label(), kAccumulator);
684 684
685 // Perform the comparison as if via '==='. 685 // Perform the comparison as if via '==='.
686 __ mov(edx, Operand(esp, 0)); // Switch value. 686 __ mov(edx, Operand(esp, 0)); // Switch value.
687 if (ShouldInlineSmiCase(Token::EQ_STRICT)) { 687 bool inline_smi_code = ShouldInlineSmiCase(Token::EQ_STRICT);
688 if (inline_smi_code) {
688 Label slow_case; 689 Label slow_case;
689 __ mov(ecx, edx); 690 __ mov(ecx, edx);
690 __ or_(ecx, Operand(eax)); 691 __ or_(ecx, Operand(eax));
691 __ test(ecx, Immediate(kSmiTagMask)); 692 __ test(ecx, Immediate(kSmiTagMask));
692 __ j(not_zero, &slow_case, not_taken); 693 __ j(not_zero, &slow_case, not_taken);
693 __ cmp(edx, Operand(eax)); 694 __ cmp(edx, Operand(eax));
694 __ j(not_equal, &next_test); 695 __ j(not_equal, &next_test);
695 __ Drop(1); // Switch value is no longer needed. 696 __ Drop(1); // Switch value is no longer needed.
696 __ jmp(clause->body_target()->entry_label()); 697 __ jmp(clause->body_target()->entry_label());
697 __ bind(&slow_case); 698 __ bind(&slow_case);
698 } 699 }
699 700
700 CompareStub stub(equal, true); 701 CompareFlags flags = inline_smi_code
702 ? NO_SMI_COMPARE_IN_STUB
703 : NO_COMPARE_FLAGS;
704 CompareStub stub(equal, true, flags);
701 __ CallStub(&stub); 705 __ CallStub(&stub);
702 __ test(eax, Operand(eax)); 706 __ test(eax, Operand(eax));
703 __ j(not_equal, &next_test); 707 __ j(not_equal, &next_test);
704 __ Drop(1); // Switch value is no longer needed. 708 __ Drop(1); // Switch value is no longer needed.
705 __ jmp(clause->body_target()->entry_label()); 709 __ jmp(clause->body_target()->entry_label());
706 } 710 }
707 711
708 // Discard the test value and jump to the default if present, otherwise to 712 // Discard the test value and jump to the default if present, otherwise to
709 // the end of the statement. 713 // the end of the statement.
710 __ bind(&next_test); 714 __ bind(&next_test);
(...skipping 270 matching lines...) Expand 10 before | Expand all | Expand 10 after
981 985
982 // All extension objects were empty and it is safe to use a global 986 // All extension objects were empty and it is safe to use a global
983 // load IC call. 987 // load IC call.
984 __ mov(eax, CodeGenerator::GlobalObject()); 988 __ mov(eax, CodeGenerator::GlobalObject());
985 __ mov(ecx, slot->var()->name()); 989 __ mov(ecx, slot->var()->name());
986 Handle<Code> ic(Builtins::builtin(Builtins::LoadIC_Initialize)); 990 Handle<Code> ic(Builtins::builtin(Builtins::LoadIC_Initialize));
987 RelocInfo::Mode mode = (typeof_state == INSIDE_TYPEOF) 991 RelocInfo::Mode mode = (typeof_state == INSIDE_TYPEOF)
988 ? RelocInfo::CODE_TARGET 992 ? RelocInfo::CODE_TARGET
989 : RelocInfo::CODE_TARGET_CONTEXT; 993 : RelocInfo::CODE_TARGET_CONTEXT;
990 __ call(ic, mode); 994 __ call(ic, mode);
995 __ nop(); // Signal no inlined code.
991 } 996 }
992 997
993 998
994 MemOperand FullCodeGenerator::ContextSlotOperandCheckExtensions( 999 MemOperand FullCodeGenerator::ContextSlotOperandCheckExtensions(
995 Slot* slot, 1000 Slot* slot,
996 Label* slow) { 1001 Label* slow) {
997 ASSERT(slot->type() == Slot::CONTEXT); 1002 ASSERT(slot->type() == Slot::CONTEXT);
998 Register context = esi; 1003 Register context = esi;
999 Register temp = ebx; 1004 Register temp = ebx;
1000 1005
(...skipping 2130 matching lines...) Expand 10 before | Expand all | Expand 10 after
3131 for (int i = 0; i < arg_count; i++) { 3136 for (int i = 0; i < arg_count; i++) {
3132 VisitForValue(args->at(i), kStack); 3137 VisitForValue(args->at(i), kStack);
3133 } 3138 }
3134 3139
3135 if (expr->is_jsruntime()) { 3140 if (expr->is_jsruntime()) {
3136 // Call the JS runtime function via a call IC. 3141 // Call the JS runtime function via a call IC.
3137 __ Set(ecx, Immediate(expr->name())); 3142 __ Set(ecx, Immediate(expr->name()));
3138 InLoopFlag in_loop = (loop_depth() > 0) ? IN_LOOP : NOT_IN_LOOP; 3143 InLoopFlag in_loop = (loop_depth() > 0) ? IN_LOOP : NOT_IN_LOOP;
3139 Handle<Code> ic = CodeGenerator::ComputeCallInitialize(arg_count, in_loop); 3144 Handle<Code> ic = CodeGenerator::ComputeCallInitialize(arg_count, in_loop);
3140 __ call(ic, RelocInfo::CODE_TARGET); 3145 __ call(ic, RelocInfo::CODE_TARGET);
3141 // Restore context register. 3146 // Restore context register.
3142 __ mov(esi, Operand(ebp, StandardFrameConstants::kContextOffset)); 3147 __ mov(esi, Operand(ebp, StandardFrameConstants::kContextOffset));
3143 } else { 3148 } else {
3144 // Call the C runtime function. 3149 // Call the C runtime function.
3145 __ CallRuntime(expr->function(), arg_count); 3150 __ CallRuntime(expr->function(), arg_count);
3146 } 3151 }
3147 Apply(context_, eax); 3152 Apply(context_, eax);
3148 } 3153 }
3149 3154
3150 3155
3151 void FullCodeGenerator::VisitUnaryOperation(UnaryOperation* expr) { 3156 void FullCodeGenerator::VisitUnaryOperation(UnaryOperation* expr) {
(...skipping 98 matching lines...) Expand 10 before | Expand all | Expand 10 after
3250 __ bind(&no_conversion); 3255 __ bind(&no_conversion);
3251 Apply(context_, result_register()); 3256 Apply(context_, result_register());
3252 break; 3257 break;
3253 } 3258 }
3254 3259
3255 case Token::SUB: { 3260 case Token::SUB: {
3256 Comment cmt(masm_, "[ UnaryOperation (SUB)"); 3261 Comment cmt(masm_, "[ UnaryOperation (SUB)");
3257 bool can_overwrite = expr->expression()->ResultOverwriteAllowed(); 3262 bool can_overwrite = expr->expression()->ResultOverwriteAllowed();
3258 UnaryOverwriteMode overwrite = 3263 UnaryOverwriteMode overwrite =
3259 can_overwrite ? UNARY_OVERWRITE : UNARY_NO_OVERWRITE; 3264 can_overwrite ? UNARY_OVERWRITE : UNARY_NO_OVERWRITE;
3260 GenericUnaryOpStub stub(Token::SUB, overwrite); 3265 GenericUnaryOpStub stub(Token::SUB, overwrite, NO_UNARY_FLAGS);
3261 // GenericUnaryOpStub expects the argument to be in the 3266 // GenericUnaryOpStub expects the argument to be in the
3262 // accumulator register eax. 3267 // accumulator register eax.
3263 VisitForValue(expr->expression(), kAccumulator); 3268 VisitForValue(expr->expression(), kAccumulator);
3264 __ CallStub(&stub); 3269 __ CallStub(&stub);
3265 Apply(context_, eax); 3270 Apply(context_, eax);
3266 break; 3271 break;
3267 } 3272 }
3268 3273
3269 case Token::BIT_NOT: { 3274 case Token::BIT_NOT: {
3270 Comment cmt(masm_, "[ UnaryOperation (BIT_NOT)"); 3275 Comment cmt(masm_, "[ UnaryOperation (BIT_NOT)");
3271 // The generic unary operation stub expects the argument to be 3276 // The generic unary operation stub expects the argument to be
3272 // in the accumulator register eax. 3277 // in the accumulator register eax.
3273 VisitForValue(expr->expression(), kAccumulator); 3278 VisitForValue(expr->expression(), kAccumulator);
3274 Label done; 3279 Label done;
3275 if (ShouldInlineSmiCase(expr->op())) { 3280 bool inline_smi_case = ShouldInlineSmiCase(expr->op());
3281 if (inline_smi_case) {
3276 Label call_stub; 3282 Label call_stub;
3277 __ test(eax, Immediate(kSmiTagMask)); 3283 __ test(eax, Immediate(kSmiTagMask));
3278 __ j(not_zero, &call_stub); 3284 __ j(not_zero, &call_stub);
3279 __ lea(eax, Operand(eax, kSmiTagMask)); 3285 __ lea(eax, Operand(eax, kSmiTagMask));
3280 __ not_(eax); 3286 __ not_(eax);
3281 __ jmp(&done); 3287 __ jmp(&done);
3282 __ bind(&call_stub); 3288 __ bind(&call_stub);
3283 } 3289 }
3284 bool overwrite = expr->expression()->ResultOverwriteAllowed(); 3290 bool overwrite = expr->expression()->ResultOverwriteAllowed();
3285 UnaryOverwriteMode mode = 3291 UnaryOverwriteMode mode =
3286 overwrite ? UNARY_OVERWRITE : UNARY_NO_OVERWRITE; 3292 overwrite ? UNARY_OVERWRITE : UNARY_NO_OVERWRITE;
3287 GenericUnaryOpStub stub(Token::BIT_NOT, mode); 3293 UnaryOpFlags flags = inline_smi_case
3294 ? NO_UNARY_SMI_CODE_IN_STUB
3295 : NO_UNARY_FLAGS;
3296 GenericUnaryOpStub stub(Token::BIT_NOT, mode, flags);
3288 __ CallStub(&stub); 3297 __ CallStub(&stub);
3289 __ bind(&done); 3298 __ bind(&done);
3290 Apply(context_, eax); 3299 Apply(context_, eax);
3291 break; 3300 break;
3292 } 3301 }
3293 3302
3294 default: 3303 default:
3295 UNREACHABLE(); 3304 UNREACHABLE();
3296 } 3305 }
3297 } 3306 }
(...skipping 178 matching lines...) Expand 10 before | Expand all | Expand 10 after
3476 void FullCodeGenerator::VisitForTypeofValue(Expression* expr, Location where) { 3485 void FullCodeGenerator::VisitForTypeofValue(Expression* expr, Location where) {
3477 VariableProxy* proxy = expr->AsVariableProxy(); 3486 VariableProxy* proxy = expr->AsVariableProxy();
3478 if (proxy != NULL && !proxy->var()->is_this() && proxy->var()->is_global()) { 3487 if (proxy != NULL && !proxy->var()->is_this() && proxy->var()->is_global()) {
3479 Comment cmnt(masm_, "Global variable"); 3488 Comment cmnt(masm_, "Global variable");
3480 __ mov(eax, CodeGenerator::GlobalObject()); 3489 __ mov(eax, CodeGenerator::GlobalObject());
3481 __ mov(ecx, Immediate(proxy->name())); 3490 __ mov(ecx, Immediate(proxy->name()));
3482 Handle<Code> ic(Builtins::builtin(Builtins::LoadIC_Initialize)); 3491 Handle<Code> ic(Builtins::builtin(Builtins::LoadIC_Initialize));
3483 // Use a regular load, not a contextual load, to avoid a reference 3492 // Use a regular load, not a contextual load, to avoid a reference
3484 // error. 3493 // error.
3485 __ call(ic, RelocInfo::CODE_TARGET); 3494 __ call(ic, RelocInfo::CODE_TARGET);
3495 __ nop(); // Signal no inlined code.
3486 if (where == kStack) __ push(eax); 3496 if (where == kStack) __ push(eax);
3487 } else if (proxy != NULL && 3497 } else if (proxy != NULL &&
3488 proxy->var()->slot() != NULL && 3498 proxy->var()->slot() != NULL &&
3489 proxy->var()->slot()->type() == Slot::LOOKUP) { 3499 proxy->var()->slot()->type() == Slot::LOOKUP) {
3490 Label done, slow; 3500 Label done, slow;
3491 3501
3492 // Generate code for loading from variables potentially shadowed 3502 // Generate code for loading from variables potentially shadowed
3493 // by eval-introduced variables. 3503 // by eval-introduced variables.
3494 Slot* slot = proxy->var()->slot(); 3504 Slot* slot = proxy->var()->slot();
3495 EmitDynamicLoadFromSlotFastCase(slot, INSIDE_TYPEOF, &slow, &done); 3505 EmitDynamicLoadFromSlotFastCase(slot, INSIDE_TYPEOF, &slow, &done);
(...skipping 169 matching lines...) Expand 10 before | Expand all | Expand 10 after
3665 case Token::GTE: 3675 case Token::GTE:
3666 cc = greater_equal; 3676 cc = greater_equal;
3667 __ pop(edx); 3677 __ pop(edx);
3668 break; 3678 break;
3669 case Token::IN: 3679 case Token::IN:
3670 case Token::INSTANCEOF: 3680 case Token::INSTANCEOF:
3671 default: 3681 default:
3672 UNREACHABLE(); 3682 UNREACHABLE();
3673 } 3683 }
3674 3684
3675 if (ShouldInlineSmiCase(op)) { 3685 bool inline_smi_code = ShouldInlineSmiCase(op);
3686 if (inline_smi_code) {
3676 Label slow_case; 3687 Label slow_case;
3677 __ mov(ecx, Operand(edx)); 3688 __ mov(ecx, Operand(edx));
3678 __ or_(ecx, Operand(eax)); 3689 __ or_(ecx, Operand(eax));
3679 __ test(ecx, Immediate(kSmiTagMask)); 3690 __ test(ecx, Immediate(kSmiTagMask));
3680 __ j(not_zero, &slow_case, not_taken); 3691 __ j(not_zero, &slow_case, not_taken);
3681 __ cmp(edx, Operand(eax)); 3692 __ cmp(edx, Operand(eax));
3682 Split(cc, if_true, if_false, NULL); 3693 Split(cc, if_true, if_false, NULL);
3683 __ bind(&slow_case); 3694 __ bind(&slow_case);
3684 } 3695 }
3685 3696
3686 CompareStub stub(cc, strict); 3697 CompareFlags flags = inline_smi_code
3698 ? NO_SMI_COMPARE_IN_STUB
3699 : NO_COMPARE_FLAGS;
3700 CompareStub stub(cc, strict, flags);
3687 __ CallStub(&stub); 3701 __ CallStub(&stub);
3688 __ test(eax, Operand(eax)); 3702 __ test(eax, Operand(eax));
3689 Split(cc, if_true, if_false, fall_through); 3703 Split(cc, if_true, if_false, fall_through);
3690 } 3704 }
3691 } 3705 }
3692 3706
3693 // Convert the result of the comparison into one expected for this 3707 // Convert the result of the comparison into one expected for this
3694 // expression's context. 3708 // expression's context.
3695 Apply(context_, if_true, if_false); 3709 Apply(context_, if_true, if_false);
3696 } 3710 }
(...skipping 79 matching lines...) Expand 10 before | Expand all | Expand 10 after
3776 // And return. 3790 // And return.
3777 __ ret(0); 3791 __ ret(0);
3778 } 3792 }
3779 3793
3780 3794
3781 #undef __ 3795 #undef __
3782 3796
3783 } } // namespace v8::internal 3797 } } // namespace v8::internal
3784 3798
3785 #endif // V8_TARGET_ARCH_IA32 3799 #endif // V8_TARGET_ARCH_IA32
OLDNEW
« no previous file with comments | « src/ia32/codegen-ia32.cc ('k') | src/parser.h » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698