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

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

Issue 6366028: X64 Crankshaft: Add TypeRecordingBinaryStub to X64 (Closed) Base URL: http://v8.googlecode.com/svn/branches/bleeding_edge/
Patch Set: '' Created 9 years, 10 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/x64/code-stubs-x64.cc ('k') | src/x64/ic-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 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 1511 matching lines...) Expand 10 before | Expand all | Expand 10 after
1522 // Do combined smi check of the operands. Left operand is on the 1522 // Do combined smi check of the operands. Left operand is on the
1523 // stack (popped into rdx). Right operand is in rax but moved into 1523 // stack (popped into rdx). Right operand is in rax but moved into
1524 // rcx to make the shifts easier. 1524 // rcx to make the shifts easier.
1525 Label done, stub_call, smi_case; 1525 Label done, stub_call, smi_case;
1526 __ pop(rdx); 1526 __ pop(rdx);
1527 __ movq(rcx, rax); 1527 __ movq(rcx, rax);
1528 Condition smi = masm()->CheckBothSmi(rdx, rax); 1528 Condition smi = masm()->CheckBothSmi(rdx, rax);
1529 __ j(smi, &smi_case); 1529 __ j(smi, &smi_case);
1530 1530
1531 __ bind(&stub_call); 1531 __ bind(&stub_call);
1532 GenericBinaryOpStub stub(op, mode, NO_SMI_CODE_IN_STUB, TypeInfo::Unknown()); 1532 TypeRecordingBinaryOpStub stub(op, mode);
1533 if (stub.ArgsInRegistersSupported()) { 1533 __ movq(rax, rcx);
1534 stub.GenerateCall(masm_, rdx, rcx); 1534 __ CallStub(&stub);
1535 } else {
1536 __ push(rdx);
1537 __ push(rcx);
1538 __ CallStub(&stub);
1539 }
1540 __ jmp(&done); 1535 __ jmp(&done);
1541 1536
1542 __ bind(&smi_case); 1537 __ bind(&smi_case);
1543 switch (op) { 1538 switch (op) {
1544 case Token::SAR: 1539 case Token::SAR:
1545 __ SmiShiftArithmeticRight(rax, rdx, rcx); 1540 __ SmiShiftArithmeticRight(rax, rdx, rcx);
1546 break; 1541 break;
1547 case Token::SHL: 1542 case Token::SHL:
1548 __ SmiShiftLeft(rax, rdx, rcx); 1543 __ SmiShiftLeft(rax, rdx, rcx);
1549 break; 1544 break;
(...skipping 23 matching lines...) Expand all
1573 break; 1568 break;
1574 } 1569 }
1575 1570
1576 __ bind(&done); 1571 __ bind(&done);
1577 context()->Plug(rax); 1572 context()->Plug(rax);
1578 } 1573 }
1579 1574
1580 1575
1581 void FullCodeGenerator::EmitBinaryOp(Token::Value op, 1576 void FullCodeGenerator::EmitBinaryOp(Token::Value op,
1582 OverwriteMode mode) { 1577 OverwriteMode mode) {
1583 GenericBinaryOpStub stub(op, mode, NO_GENERIC_BINARY_FLAGS); 1578 TypeRecordingBinaryOpStub stub(op, mode);
1584 if (stub.ArgsInRegistersSupported()) { 1579 __ pop(rdx);
1585 __ pop(rdx); 1580 __ CallStub(&stub);
1586 stub.GenerateCall(masm_, rdx, rax);
1587 } else {
1588 __ push(result_register());
1589 __ CallStub(&stub);
1590 }
1591 context()->Plug(rax); 1581 context()->Plug(rax);
1592 } 1582 }
1593 1583
1594 1584
1595 void FullCodeGenerator::EmitAssignment(Expression* expr, int bailout_ast_id) { 1585 void FullCodeGenerator::EmitAssignment(Expression* expr, int bailout_ast_id) {
1596 // Invalid left-hand sides are rewritten to have a 'throw 1586 // Invalid left-hand sides are rewritten to have a 'throw
1597 // ReferenceError' on the left-hand side. 1587 // ReferenceError' on the left-hand side.
1598 if (!expr->IsValidLeftHandSide()) { 1588 if (!expr->IsValidLeftHandSide()) {
1599 VisitForEffect(expr); 1589 VisitForEffect(expr);
1600 return; 1590 return;
(...skipping 1609 matching lines...) Expand 10 before | Expand all | Expand 10 after
3210 if (expr->op() == Token::INC) { 3200 if (expr->op() == Token::INC) {
3211 __ SmiAddConstant(rax, rax, Smi::FromInt(1)); 3201 __ SmiAddConstant(rax, rax, Smi::FromInt(1));
3212 } else { 3202 } else {
3213 __ SmiSubConstant(rax, rax, Smi::FromInt(1)); 3203 __ SmiSubConstant(rax, rax, Smi::FromInt(1));
3214 } 3204 }
3215 __ j(overflow, &stub_call); 3205 __ j(overflow, &stub_call);
3216 // We could eliminate this smi check if we split the code at 3206 // We could eliminate this smi check if we split the code at
3217 // the first smi check before calling ToNumber. 3207 // the first smi check before calling ToNumber.
3218 is_smi = masm_->CheckSmi(rax); 3208 is_smi = masm_->CheckSmi(rax);
3219 __ j(is_smi, &done); 3209 __ j(is_smi, &done);
3210
3220 __ bind(&stub_call); 3211 __ bind(&stub_call);
3221 // Call stub. Undo operation first. 3212 // Call stub. Undo operation first.
3222 if (expr->op() == Token::INC) { 3213 if (expr->op() == Token::INC) {
3223 __ SmiSubConstant(rax, rax, Smi::FromInt(1)); 3214 __ SmiSubConstant(rax, rax, Smi::FromInt(1));
3224 } else { 3215 } else {
3225 __ SmiAddConstant(rax, rax, Smi::FromInt(1)); 3216 __ SmiAddConstant(rax, rax, Smi::FromInt(1));
3226 } 3217 }
3227 } 3218 }
3228 3219
3229 // Record position before stub call. 3220 // Record position before stub call.
3230 SetSourcePosition(expr->position()); 3221 SetSourcePosition(expr->position());
3231 3222
3232 // Call stub for +1/-1. 3223 // Call stub for +1/-1.
3233 GenericBinaryOpStub stub(expr->binary_op(), 3224 TypeRecordingBinaryOpStub stub(expr->binary_op(), NO_OVERWRITE);
3234 NO_OVERWRITE, 3225 if (expr->op() == Token::INC) {
3235 NO_GENERIC_BINARY_FLAGS); 3226 __ Move(rdx, Smi::FromInt(1));
3236 stub.GenerateCall(masm_, rax, Smi::FromInt(1)); 3227 } else {
3228 __ movq(rdx, rax);
3229 __ Move(rax, Smi::FromInt(1));
3230 }
3231 __ CallStub(&stub);
3232
3237 __ bind(&done); 3233 __ bind(&done);
3238
3239 // Store the value returned in rax. 3234 // Store the value returned in rax.
3240 switch (assign_type) { 3235 switch (assign_type) {
3241 case VARIABLE: 3236 case VARIABLE:
3242 if (expr->is_postfix()) { 3237 if (expr->is_postfix()) {
3243 // Perform the assignment as if via '='. 3238 // Perform the assignment as if via '='.
3244 { EffectContext context(this); 3239 { EffectContext context(this);
3245 EmitVariableAssignment(expr->expression()->AsVariableProxy()->var(), 3240 EmitVariableAssignment(expr->expression()->AsVariableProxy()->var(),
3246 Token::ASSIGN); 3241 Token::ASSIGN);
3247 PrepareForBailoutForId(expr->AssignmentId(), TOS_REG); 3242 PrepareForBailoutForId(expr->AssignmentId(), TOS_REG);
3248 context.Plug(rax); 3243 context.Plug(rax);
(...skipping 395 matching lines...) Expand 10 before | Expand all | Expand 10 after
3644 __ ret(0); 3639 __ ret(0);
3645 } 3640 }
3646 3641
3647 3642
3648 #undef __ 3643 #undef __
3649 3644
3650 3645
3651 } } // namespace v8::internal 3646 } } // namespace v8::internal
3652 3647
3653 #endif // V8_TARGET_ARCH_X64 3648 #endif // V8_TARGET_ARCH_X64
OLDNEW
« no previous file with comments | « src/x64/code-stubs-x64.cc ('k') | src/x64/ic-x64.cc » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698