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

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

Issue 42973002: Refine CountOperation of FullCodeGen (Closed) Base URL: https://v8.googlecode.com/svn/branches/bleeding_edge
Patch Set: Rebased with bleeding_edge Created 7 years, 1 month 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/arm/full-codegen-arm.cc ('k') | src/x64/full-codegen-x64.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 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 4376 matching lines...) Expand 10 before | Expand all | Expand 10 after
4387 } 4387 }
4388 4388
4389 // We need a second deoptimization point after loading the value 4389 // We need a second deoptimization point after loading the value
4390 // in case evaluating the property load my have a side effect. 4390 // in case evaluating the property load my have a side effect.
4391 if (assign_type == VARIABLE) { 4391 if (assign_type == VARIABLE) {
4392 PrepareForBailout(expr->expression(), TOS_REG); 4392 PrepareForBailout(expr->expression(), TOS_REG);
4393 } else { 4393 } else {
4394 PrepareForBailoutForId(prop->LoadId(), TOS_REG); 4394 PrepareForBailoutForId(prop->LoadId(), TOS_REG);
4395 } 4395 }
4396 4396
4397 // Call ToNumber only if operand is not a smi. 4397 // Inline smi case if we are in a loop.
4398 Label no_conversion; 4398 Label done, stub_call;
4399 JumpPatchSite patch_site(masm_);
4399 if (ShouldInlineSmiCase(expr->op())) { 4400 if (ShouldInlineSmiCase(expr->op())) {
4400 __ JumpIfSmi(eax, &no_conversion, Label::kNear); 4401 Label slow;
4402 patch_site.EmitJumpIfNotSmi(eax, &slow, Label::kNear);
4403
4404 // Save result for postfix expressions.
4405 if (expr->is_postfix()) {
4406 if (!context()->IsEffect()) {
4407 // Save the result on the stack. If we have a named or keyed property
4408 // we store the result under the receiver that is currently on top
4409 // of the stack.
4410 switch (assign_type) {
4411 case VARIABLE:
4412 __ push(eax);
4413 break;
4414 case NAMED_PROPERTY:
4415 __ mov(Operand(esp, kPointerSize), eax);
4416 break;
4417 case KEYED_PROPERTY:
4418 __ mov(Operand(esp, 2 * kPointerSize), eax);
4419 break;
4420 }
4421 }
4422 }
4423
4424 if (expr->op() == Token::INC) {
4425 __ add(eax, Immediate(Smi::FromInt(1)));
4426 } else {
4427 __ sub(eax, Immediate(Smi::FromInt(1)));
4428 }
4429 __ j(no_overflow, &done, Label::kNear);
4430 // Call stub. Undo operation first.
4431 if (expr->op() == Token::INC) {
4432 __ sub(eax, Immediate(Smi::FromInt(1)));
4433 } else {
4434 __ add(eax, Immediate(Smi::FromInt(1)));
4435 }
4436 __ jmp(&stub_call, Label::kNear);
4437 __ bind(&slow);
4401 } 4438 }
4402 ToNumberStub convert_stub; 4439 ToNumberStub convert_stub;
4403 __ CallStub(&convert_stub); 4440 __ CallStub(&convert_stub);
4404 __ bind(&no_conversion);
4405 4441
4406 // Save result for postfix expressions. 4442 // Save result for postfix expressions.
4407 if (expr->is_postfix()) { 4443 if (expr->is_postfix()) {
4408 if (!context()->IsEffect()) { 4444 if (!context()->IsEffect()) {
4409 // Save the result on the stack. If we have a named or keyed property 4445 // Save the result on the stack. If we have a named or keyed property
4410 // we store the result under the receiver that is currently on top 4446 // we store the result under the receiver that is currently on top
4411 // of the stack. 4447 // of the stack.
4412 switch (assign_type) { 4448 switch (assign_type) {
4413 case VARIABLE: 4449 case VARIABLE:
4414 __ push(eax); 4450 __ push(eax);
4415 break; 4451 break;
4416 case NAMED_PROPERTY: 4452 case NAMED_PROPERTY:
4417 __ mov(Operand(esp, kPointerSize), eax); 4453 __ mov(Operand(esp, kPointerSize), eax);
4418 break; 4454 break;
4419 case KEYED_PROPERTY: 4455 case KEYED_PROPERTY:
4420 __ mov(Operand(esp, 2 * kPointerSize), eax); 4456 __ mov(Operand(esp, 2 * kPointerSize), eax);
4421 break; 4457 break;
4422 } 4458 }
4423 } 4459 }
4424 } 4460 }
4425 4461
4426 // Inline smi case if we are in a loop.
4427 Label done, stub_call;
4428 JumpPatchSite patch_site(masm_);
4429
4430 if (ShouldInlineSmiCase(expr->op())) {
4431 if (expr->op() == Token::INC) {
4432 __ add(eax, Immediate(Smi::FromInt(1)));
4433 } else {
4434 __ sub(eax, Immediate(Smi::FromInt(1)));
4435 }
4436 __ j(overflow, &stub_call, Label::kNear);
4437 // We could eliminate this smi check if we split the code at
4438 // the first smi check before calling ToNumber.
4439 patch_site.EmitJumpIfSmi(eax, &done, Label::kNear);
4440
4441 __ bind(&stub_call);
4442 // Call stub. Undo operation first.
4443 if (expr->op() == Token::INC) {
4444 __ sub(eax, Immediate(Smi::FromInt(1)));
4445 } else {
4446 __ add(eax, Immediate(Smi::FromInt(1)));
4447 }
4448 }
4449
4450 // Record position before stub call. 4462 // Record position before stub call.
4451 SetSourcePosition(expr->position()); 4463 SetSourcePosition(expr->position());
4452 4464
4453 // Call stub for +1/-1. 4465 // Call stub for +1/-1.
4466 __ bind(&stub_call);
4454 __ mov(edx, eax); 4467 __ mov(edx, eax);
4455 __ mov(eax, Immediate(Smi::FromInt(1))); 4468 __ mov(eax, Immediate(Smi::FromInt(1)));
4456 BinaryOpStub stub(expr->binary_op(), NO_OVERWRITE); 4469 BinaryOpStub stub(expr->binary_op(), NO_OVERWRITE);
4457 CallIC(stub.GetCode(isolate()), 4470 CallIC(stub.GetCode(isolate()),
4458 RelocInfo::CODE_TARGET, 4471 RelocInfo::CODE_TARGET,
4459 expr->CountBinOpFeedbackId()); 4472 expr->CountBinOpFeedbackId());
4460 patch_site.EmitPatchInfo(); 4473 patch_site.EmitPatchInfo();
4461 __ bind(&done); 4474 __ bind(&done);
4462 4475
4463 // Store the value returned in eax. 4476 // Store the value returned in eax.
(...skipping 488 matching lines...) Expand 10 before | Expand all | Expand 10 after
4952 4965
4953 ASSERT_EQ(isolate->builtins()->OsrAfterStackCheck()->entry(), 4966 ASSERT_EQ(isolate->builtins()->OsrAfterStackCheck()->entry(),
4954 Assembler::target_address_at(call_target_address)); 4967 Assembler::target_address_at(call_target_address));
4955 return OSR_AFTER_STACK_CHECK; 4968 return OSR_AFTER_STACK_CHECK;
4956 } 4969 }
4957 4970
4958 4971
4959 } } // namespace v8::internal 4972 } } // namespace v8::internal
4960 4973
4961 #endif // V8_TARGET_ARCH_IA32 4974 #endif // V8_TARGET_ARCH_IA32
OLDNEW
« no previous file with comments | « src/arm/full-codegen-arm.cc ('k') | src/x64/full-codegen-x64.cc » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698