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

Side by Side Diff: src/x64/full-codegen-x64.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/ia32/full-codegen-ia32.cc ('k') | src/x64/macro-assembler-x64.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 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 4359 matching lines...) Expand 10 before | Expand all | Expand 10 after
4370 } 4370 }
4371 4371
4372 // We need a second deoptimization point after loading the value 4372 // We need a second deoptimization point after loading the value
4373 // in case evaluating the property load my have a side effect. 4373 // in case evaluating the property load my have a side effect.
4374 if (assign_type == VARIABLE) { 4374 if (assign_type == VARIABLE) {
4375 PrepareForBailout(expr->expression(), TOS_REG); 4375 PrepareForBailout(expr->expression(), TOS_REG);
4376 } else { 4376 } else {
4377 PrepareForBailoutForId(prop->LoadId(), TOS_REG); 4377 PrepareForBailoutForId(prop->LoadId(), TOS_REG);
4378 } 4378 }
4379 4379
4380 // Call ToNumber only if operand is not a smi. 4380 // Inline smi case if we are in a loop.
4381 Label no_conversion; 4381 Label done, stub_call;
4382 JumpPatchSite patch_site(masm_);
4382 if (ShouldInlineSmiCase(expr->op())) { 4383 if (ShouldInlineSmiCase(expr->op())) {
4383 __ JumpIfSmi(rax, &no_conversion, Label::kNear); 4384 Label slow;
4385 patch_site.EmitJumpIfNotSmi(rax, &slow, Label::kNear);
4386
4387 // Save result for postfix expressions.
4388 if (expr->is_postfix()) {
4389 if (!context()->IsEffect()) {
4390 // Save the result on the stack. If we have a named or keyed property
4391 // we store the result under the receiver that is currently on top
4392 // of the stack.
4393 switch (assign_type) {
4394 case VARIABLE:
4395 __ push(rax);
4396 break;
4397 case NAMED_PROPERTY:
4398 __ movq(Operand(rsp, kPointerSize), rax);
4399 break;
4400 case KEYED_PROPERTY:
4401 __ movq(Operand(rsp, 2 * kPointerSize), rax);
4402 break;
4403 }
4404 }
4405 }
4406
4407 SmiOperationExecutionMode mode;
4408 mode.Add(PRESERVE_SOURCE_REGISTER);
4409 mode.Add(BAILOUT_ON_NO_OVERFLOW);
4410 if (expr->op() == Token::INC) {
4411 __ SmiAddConstant(rax, rax, Smi::FromInt(1), mode, &done, Label::kNear);
4412 } else {
4413 __ SmiSubConstant(rax, rax, Smi::FromInt(1), mode, &done, Label::kNear);
4414 }
4415 __ jmp(&stub_call, Label::kNear);
4416 __ bind(&slow);
4384 } 4417 }
4418
4385 ToNumberStub convert_stub; 4419 ToNumberStub convert_stub;
4386 __ CallStub(&convert_stub); 4420 __ CallStub(&convert_stub);
4387 __ bind(&no_conversion);
4388 4421
4389 // Save result for postfix expressions. 4422 // Save result for postfix expressions.
4390 if (expr->is_postfix()) { 4423 if (expr->is_postfix()) {
4391 if (!context()->IsEffect()) { 4424 if (!context()->IsEffect()) {
4392 // Save the result on the stack. If we have a named or keyed property 4425 // Save the result on the stack. If we have a named or keyed property
4393 // we store the result under the receiver that is currently on top 4426 // we store the result under the receiver that is currently on top
4394 // of the stack. 4427 // of the stack.
4395 switch (assign_type) { 4428 switch (assign_type) {
4396 case VARIABLE: 4429 case VARIABLE:
4397 __ push(rax); 4430 __ push(rax);
4398 break; 4431 break;
4399 case NAMED_PROPERTY: 4432 case NAMED_PROPERTY:
4400 __ movq(Operand(rsp, kPointerSize), rax); 4433 __ movq(Operand(rsp, kPointerSize), rax);
4401 break; 4434 break;
4402 case KEYED_PROPERTY: 4435 case KEYED_PROPERTY:
4403 __ movq(Operand(rsp, 2 * kPointerSize), rax); 4436 __ movq(Operand(rsp, 2 * kPointerSize), rax);
4404 break; 4437 break;
4405 } 4438 }
4406 } 4439 }
4407 } 4440 }
4408 4441
4409 // Inline smi case if we are in a loop.
4410 Label done, stub_call;
4411 JumpPatchSite patch_site(masm_);
4412
4413 if (ShouldInlineSmiCase(expr->op())) {
4414 if (expr->op() == Token::INC) {
4415 __ SmiAddConstant(rax, rax, Smi::FromInt(1));
4416 } else {
4417 __ SmiSubConstant(rax, rax, Smi::FromInt(1));
4418 }
4419 __ j(overflow, &stub_call, Label::kNear);
4420 // We could eliminate this smi check if we split the code at
4421 // the first smi check before calling ToNumber.
4422 patch_site.EmitJumpIfSmi(rax, &done, Label::kNear);
4423
4424 __ bind(&stub_call);
4425 // Call stub. Undo operation first.
4426 if (expr->op() == Token::INC) {
4427 __ SmiSubConstant(rax, rax, Smi::FromInt(1));
4428 } else {
4429 __ SmiAddConstant(rax, rax, Smi::FromInt(1));
4430 }
4431 }
4432
4433 // Record position before stub call. 4442 // Record position before stub call.
4434 SetSourcePosition(expr->position()); 4443 SetSourcePosition(expr->position());
4435 4444
4436 // Call stub for +1/-1. 4445 // Call stub for +1/-1.
4446 __ bind(&stub_call);
4437 __ movq(rdx, rax); 4447 __ movq(rdx, rax);
4438 __ Move(rax, Smi::FromInt(1)); 4448 __ Move(rax, Smi::FromInt(1));
4439 BinaryOpStub stub(expr->binary_op(), NO_OVERWRITE); 4449 BinaryOpStub stub(expr->binary_op(), NO_OVERWRITE);
4440 CallIC(stub.GetCode(isolate()), 4450 CallIC(stub.GetCode(isolate()),
4441 RelocInfo::CODE_TARGET, 4451 RelocInfo::CODE_TARGET,
4442 expr->CountBinOpFeedbackId()); 4452 expr->CountBinOpFeedbackId());
4443 patch_site.EmitPatchInfo(); 4453 patch_site.EmitPatchInfo();
4444 __ bind(&done); 4454 __ bind(&done);
4445 4455
4446 // Store the value returned in rax. 4456 // Store the value returned in rax.
(...skipping 490 matching lines...) Expand 10 before | Expand all | Expand 10 after
4937 4947
4938 ASSERT_EQ(isolate->builtins()->OsrAfterStackCheck()->entry(), 4948 ASSERT_EQ(isolate->builtins()->OsrAfterStackCheck()->entry(),
4939 Assembler::target_address_at(call_target_address)); 4949 Assembler::target_address_at(call_target_address));
4940 return OSR_AFTER_STACK_CHECK; 4950 return OSR_AFTER_STACK_CHECK;
4941 } 4951 }
4942 4952
4943 4953
4944 } } // namespace v8::internal 4954 } } // namespace v8::internal
4945 4955
4946 #endif // V8_TARGET_ARCH_X64 4956 #endif // V8_TARGET_ARCH_X64
OLDNEW
« no previous file with comments | « src/ia32/full-codegen-ia32.cc ('k') | src/x64/macro-assembler-x64.h » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698