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

Side by Side Diff: src/arm/full-codegen-arm.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 | « no previous file | src/ia32/full-codegen-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 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 stub_call, done;
4399 JumpPatchSite patch_site(masm_);
4400
4401 int count_value = expr->op() == Token::INC ? 1 : -1;
4399 if (ShouldInlineSmiCase(expr->op())) { 4402 if (ShouldInlineSmiCase(expr->op())) {
4400 __ JumpIfSmi(r0, &no_conversion); 4403 Label slow;
4404 patch_site.EmitJumpIfNotSmi(r0, &slow);
4405
4406 // Save result for postfix expressions.
4407 if (expr->is_postfix()) {
4408 if (!context()->IsEffect()) {
4409 // 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
4411 // of the stack.
4412 switch (assign_type) {
4413 case VARIABLE:
4414 __ push(r0);
4415 break;
4416 case NAMED_PROPERTY:
4417 __ str(r0, MemOperand(sp, kPointerSize));
4418 break;
4419 case KEYED_PROPERTY:
4420 __ str(r0, MemOperand(sp, 2 * kPointerSize));
4421 break;
4422 }
4423 }
4424 }
4425
4426 __ add(r0, r0, Operand(Smi::FromInt(count_value)), SetCC);
4427 __ b(vc, &done);
4428 // Call stub. Undo operation first.
4429 __ sub(r0, r0, Operand(Smi::FromInt(count_value)));
4430 __ jmp(&stub_call);
4431 __ bind(&slow);
4401 } 4432 }
4402 ToNumberStub convert_stub; 4433 ToNumberStub convert_stub;
4403 __ CallStub(&convert_stub); 4434 __ CallStub(&convert_stub);
4404 __ bind(&no_conversion);
4405 4435
4406 // Save result for postfix expressions. 4436 // Save result for postfix expressions.
4407 if (expr->is_postfix()) { 4437 if (expr->is_postfix()) {
4408 if (!context()->IsEffect()) { 4438 if (!context()->IsEffect()) {
4409 // Save the result on the stack. If we have a named or keyed property 4439 // 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 4440 // we store the result under the receiver that is currently on top
4411 // of the stack. 4441 // of the stack.
4412 switch (assign_type) { 4442 switch (assign_type) {
4413 case VARIABLE: 4443 case VARIABLE:
4414 __ push(r0); 4444 __ push(r0);
4415 break; 4445 break;
4416 case NAMED_PROPERTY: 4446 case NAMED_PROPERTY:
4417 __ str(r0, MemOperand(sp, kPointerSize)); 4447 __ str(r0, MemOperand(sp, kPointerSize));
4418 break; 4448 break;
4419 case KEYED_PROPERTY: 4449 case KEYED_PROPERTY:
4420 __ str(r0, MemOperand(sp, 2 * kPointerSize)); 4450 __ str(r0, MemOperand(sp, 2 * kPointerSize));
4421 break; 4451 break;
4422 } 4452 }
4423 } 4453 }
4424 } 4454 }
4425 4455
4426 4456
4427 // Inline smi case if we are in a loop. 4457 __ bind(&stub_call);
4428 Label stub_call, done;
4429 JumpPatchSite patch_site(masm_);
4430
4431 int count_value = expr->op() == Token::INC ? 1 : -1;
4432 if (ShouldInlineSmiCase(expr->op())) {
4433 __ add(r0, r0, Operand(Smi::FromInt(count_value)), SetCC);
4434 __ b(vs, &stub_call);
4435 // We could eliminate this smi check if we split the code at
4436 // the first smi check before calling ToNumber.
4437 patch_site.EmitJumpIfSmi(r0, &done);
4438
4439 __ bind(&stub_call);
4440 // Call stub. Undo operation first.
4441 __ sub(r0, r0, Operand(Smi::FromInt(count_value)));
4442 }
4443 __ mov(r1, r0); 4458 __ mov(r1, r0);
4444 __ mov(r0, Operand(Smi::FromInt(count_value))); 4459 __ mov(r0, Operand(Smi::FromInt(count_value)));
4445 4460
4446 // Record position before stub call. 4461 // Record position before stub call.
4447 SetSourcePosition(expr->position()); 4462 SetSourcePosition(expr->position());
4448 4463
4449 BinaryOpStub stub(Token::ADD, NO_OVERWRITE); 4464 BinaryOpStub stub(Token::ADD, NO_OVERWRITE);
4450 CallIC(stub.GetCode(isolate()), 4465 CallIC(stub.GetCode(isolate()),
4451 RelocInfo::CODE_TARGET, 4466 RelocInfo::CODE_TARGET,
4452 expr->CountBinOpFeedbackId()); 4467 expr->CountBinOpFeedbackId());
(...skipping 506 matching lines...) Expand 10 before | Expand all | Expand 10 after
4959 ASSERT(Memory::uint32_at(interrupt_address_pointer) == 4974 ASSERT(Memory::uint32_at(interrupt_address_pointer) ==
4960 reinterpret_cast<uint32_t>( 4975 reinterpret_cast<uint32_t>(
4961 isolate->builtins()->OsrAfterStackCheck()->entry())); 4976 isolate->builtins()->OsrAfterStackCheck()->entry()));
4962 return OSR_AFTER_STACK_CHECK; 4977 return OSR_AFTER_STACK_CHECK;
4963 } 4978 }
4964 4979
4965 4980
4966 } } // namespace v8::internal 4981 } } // namespace v8::internal
4967 4982
4968 #endif // V8_TARGET_ARCH_ARM 4983 #endif // V8_TARGET_ARCH_ARM
OLDNEW
« no previous file with comments | « no previous file | src/ia32/full-codegen-ia32.cc » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698