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

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

Issue 6580038: [Isolates] Merge from bleeding_edge, revisions 5934-6100. (Closed) Base URL: http://v8.googlecode.com/svn/branches/experimental/isolates/
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/arm/codegen-arm.cc ('k') | src/arm/ic-arm.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 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 188 matching lines...) Expand 10 before | Expand all | Expand 10 after
199 __ LoadRoot(r0, Heap::kUndefinedValueRootIndex); 199 __ LoadRoot(r0, Heap::kUndefinedValueRootIndex);
200 } 200 }
201 EmitReturnSequence(); 201 EmitReturnSequence();
202 202
203 // Force emit the constant pool, so it doesn't get emitted in the middle 203 // Force emit the constant pool, so it doesn't get emitted in the middle
204 // of the stack check table. 204 // of the stack check table.
205 masm()->CheckConstPool(true, false); 205 masm()->CheckConstPool(true, false);
206 } 206 }
207 207
208 208
209 void FullCodeGenerator::ClearAccumulator() {
210 __ mov(r0, Operand(Smi::FromInt(0)));
211 }
212
213
209 void FullCodeGenerator::EmitStackCheck(IterationStatement* stmt) { 214 void FullCodeGenerator::EmitStackCheck(IterationStatement* stmt) {
210 Comment cmnt(masm_, "[ Stack check"); 215 Comment cmnt(masm_, "[ Stack check");
211 Label ok; 216 Label ok;
212 __ LoadRoot(ip, Heap::kStackLimitRootIndex); 217 __ LoadRoot(ip, Heap::kStackLimitRootIndex);
213 __ cmp(sp, Operand(ip)); 218 __ cmp(sp, Operand(ip));
214 __ b(hs, &ok); 219 __ b(hs, &ok);
215 StackCheckStub stub; 220 StackCheckStub stub;
216 __ CallStub(&stub); 221 __ CallStub(&stub);
217 __ bind(&ok); 222 __ bind(&ok);
218 PrepareForBailoutForId(stmt->EntryId(), NO_REGISTERS); 223 PrepareForBailoutForId(stmt->EntryId(), NO_REGISTERS);
(...skipping 665 matching lines...) Expand 10 before | Expand all | Expand 10 after
884 __ push(r3); // Current entry. 889 __ push(r3); // Current entry.
885 __ InvokeBuiltin(Builtins::FILTER_KEY, CALL_JS); 890 __ InvokeBuiltin(Builtins::FILTER_KEY, CALL_JS);
886 __ mov(r3, Operand(r0), SetCC); 891 __ mov(r3, Operand(r0), SetCC);
887 __ b(eq, loop_statement.continue_target()); 892 __ b(eq, loop_statement.continue_target());
888 893
889 // Update the 'each' property or variable from the possibly filtered 894 // Update the 'each' property or variable from the possibly filtered
890 // entry in register r3. 895 // entry in register r3.
891 __ bind(&update_each); 896 __ bind(&update_each);
892 __ mov(result_register(), r3); 897 __ mov(result_register(), r3);
893 // Perform the assignment as if via '='. 898 // Perform the assignment as if via '='.
894 EmitAssignment(stmt->each()); 899 { EffectContext context(this);
900 EmitAssignment(stmt->each(), stmt->AssignmentId());
901 }
895 902
896 // Generate code for the body of the loop. 903 // Generate code for the body of the loop.
897 Visit(stmt->body()); 904 Visit(stmt->body());
898 905
899 // Generate code for the going to the next element by incrementing 906 // Generate code for the going to the next element by incrementing
900 // the index (smi) stored on top of the stack. 907 // the index (smi) stored on top of the stack.
901 __ bind(loop_statement.continue_target()); 908 __ bind(loop_statement.continue_target());
902 __ pop(r0); 909 __ pop(r0);
903 __ add(r0, r0, Operand(Smi::FromInt(1))); 910 __ add(r0, r0, Operand(Smi::FromInt(1)));
904 __ push(r0); 911 __ push(r0);
(...skipping 540 matching lines...) Expand 10 before | Expand all | Expand 10 after
1445 break; 1452 break;
1446 case KEYED_PROPERTY: 1453 case KEYED_PROPERTY:
1447 EmitKeyedPropertyLoad(property); 1454 EmitKeyedPropertyLoad(property);
1448 break; 1455 break;
1449 } 1456 }
1450 } 1457 }
1451 1458
1452 // For property compound assignments we need another deoptimization 1459 // For property compound assignments we need another deoptimization
1453 // point after the property load. 1460 // point after the property load.
1454 if (property != NULL) { 1461 if (property != NULL) {
1455 PrepareForBailoutForId(expr->compound_bailout_id(), TOS_REG); 1462 PrepareForBailoutForId(expr->CompoundLoadId(), TOS_REG);
1456 } 1463 }
1457 1464
1458 Token::Value op = expr->binary_op(); 1465 Token::Value op = expr->binary_op();
1459 ConstantOperand constant = ShouldInlineSmiCase(op) 1466 ConstantOperand constant = ShouldInlineSmiCase(op)
1460 ? GetConstantOperand(op, expr->target(), expr->value()) 1467 ? GetConstantOperand(op, expr->target(), expr->value())
1461 : kNoConstants; 1468 : kNoConstants;
1462 ASSERT(constant == kRightConstant || constant == kNoConstants); 1469 ASSERT(constant == kRightConstant || constant == kNoConstants);
1463 if (constant == kNoConstants) { 1470 if (constant == kNoConstants) {
1464 __ push(r0); // Left operand goes on the stack. 1471 __ push(r0); // Left operand goes on the stack.
1465 VisitForAccumulatorValue(expr->value()); 1472 VisitForAccumulatorValue(expr->value());
(...skipping 22 matching lines...) Expand all
1488 } 1495 }
1489 1496
1490 // Record source position before possible IC call. 1497 // Record source position before possible IC call.
1491 SetSourcePosition(expr->position()); 1498 SetSourcePosition(expr->position());
1492 1499
1493 // Store the value. 1500 // Store the value.
1494 switch (assign_type) { 1501 switch (assign_type) {
1495 case VARIABLE: 1502 case VARIABLE:
1496 EmitVariableAssignment(expr->target()->AsVariableProxy()->var(), 1503 EmitVariableAssignment(expr->target()->AsVariableProxy()->var(),
1497 expr->op()); 1504 expr->op());
1505 PrepareForBailoutForId(expr->AssignmentId(), TOS_REG);
1506 context()->Plug(r0);
1498 break; 1507 break;
1499 case NAMED_PROPERTY: 1508 case NAMED_PROPERTY:
1500 EmitNamedPropertyAssignment(expr); 1509 EmitNamedPropertyAssignment(expr);
1501 break; 1510 break;
1502 case KEYED_PROPERTY: 1511 case KEYED_PROPERTY:
1503 EmitKeyedPropertyAssignment(expr); 1512 EmitKeyedPropertyAssignment(expr);
1504 break; 1513 break;
1505 } 1514 }
1506 } 1515 }
1507 1516
(...skipping 31 matching lines...) Expand 10 before | Expand all | Expand 10 after
1539 1548
1540 void FullCodeGenerator::EmitBinaryOp(Token::Value op, 1549 void FullCodeGenerator::EmitBinaryOp(Token::Value op,
1541 OverwriteMode mode) { 1550 OverwriteMode mode) {
1542 __ pop(r1); 1551 __ pop(r1);
1543 GenericBinaryOpStub stub(op, mode, r1, r0); 1552 GenericBinaryOpStub stub(op, mode, r1, r0);
1544 __ CallStub(&stub); 1553 __ CallStub(&stub);
1545 context()->Plug(r0); 1554 context()->Plug(r0);
1546 } 1555 }
1547 1556
1548 1557
1549 void FullCodeGenerator::EmitAssignment(Expression* expr) { 1558 void FullCodeGenerator::EmitAssignment(Expression* expr, int bailout_ast_id) {
1550 // Invalid left-hand sides are rewritten to have a 'throw 1559 // Invalid left-hand sides are rewritten to have a 'throw
1551 // ReferenceError' on the left-hand side. 1560 // ReferenceError' on the left-hand side.
1552 if (!expr->IsValidLeftHandSide()) { 1561 if (!expr->IsValidLeftHandSide()) {
1553 VisitForEffect(expr); 1562 VisitForEffect(expr);
1554 return; 1563 return;
1555 } 1564 }
1556 1565
1557 // Left-hand side can only be a property, a global or a (parameter or local) 1566 // Left-hand side can only be a property, a global or a (parameter or local)
1558 // slot. Variables with rewrite to .arguments are treated as KEYED_PROPERTY. 1567 // slot. Variables with rewrite to .arguments are treated as KEYED_PROPERTY.
1559 enum LhsKind { VARIABLE, NAMED_PROPERTY, KEYED_PROPERTY }; 1568 enum LhsKind { VARIABLE, NAMED_PROPERTY, KEYED_PROPERTY };
(...skipping 29 matching lines...) Expand all
1589 VisitForAccumulatorValue(prop->key()); 1598 VisitForAccumulatorValue(prop->key());
1590 __ mov(r1, r0); 1599 __ mov(r1, r0);
1591 __ pop(r2); 1600 __ pop(r2);
1592 __ pop(r0); // Restore value. 1601 __ pop(r0); // Restore value.
1593 Handle<Code> ic(isolate()->builtins()->builtin( 1602 Handle<Code> ic(isolate()->builtins()->builtin(
1594 Builtins::KeyedStoreIC_Initialize)); 1603 Builtins::KeyedStoreIC_Initialize));
1595 EmitCallIC(ic, RelocInfo::CODE_TARGET); 1604 EmitCallIC(ic, RelocInfo::CODE_TARGET);
1596 break; 1605 break;
1597 } 1606 }
1598 } 1607 }
1608 PrepareForBailoutForId(bailout_ast_id, TOS_REG);
1609 context()->Plug(r0);
1599 } 1610 }
1600 1611
1601 1612
1602 void FullCodeGenerator::EmitVariableAssignment(Variable* var, 1613 void FullCodeGenerator::EmitVariableAssignment(Variable* var,
1603 Token::Value op) { 1614 Token::Value op) {
1604 // Left-hand sides that rewrite to explicit property accesses do not reach 1615 // Left-hand sides that rewrite to explicit property accesses do not reach
1605 // here. 1616 // here.
1606 ASSERT(var != NULL); 1617 ASSERT(var != NULL);
1607 ASSERT(var->is_global() || var->AsSlot() != NULL); 1618 ASSERT(var->is_global() || var->AsSlot() != NULL);
1608 1619
(...skipping 54 matching lines...) Expand 10 before | Expand all | Expand 10 after
1663 if (op == Token::INIT_CONST) { 1674 if (op == Token::INIT_CONST) {
1664 // The runtime will ignore const redeclaration. 1675 // The runtime will ignore const redeclaration.
1665 __ CallRuntime(Runtime::kInitializeConstContextSlot, 3); 1676 __ CallRuntime(Runtime::kInitializeConstContextSlot, 3);
1666 } else { 1677 } else {
1667 __ CallRuntime(Runtime::kStoreContextSlot, 3); 1678 __ CallRuntime(Runtime::kStoreContextSlot, 3);
1668 } 1679 }
1669 break; 1680 break;
1670 } 1681 }
1671 __ bind(&done); 1682 __ bind(&done);
1672 } 1683 }
1673
1674 context()->Plug(result_register());
1675 } 1684 }
1676 1685
1677 1686
1678 void FullCodeGenerator::EmitNamedPropertyAssignment(Assignment* expr) { 1687 void FullCodeGenerator::EmitNamedPropertyAssignment(Assignment* expr) {
1679 // Assignment to a property, using a named store IC. 1688 // Assignment to a property, using a named store IC.
1680 Property* prop = expr->target()->AsProperty(); 1689 Property* prop = expr->target()->AsProperty();
1681 ASSERT(prop != NULL); 1690 ASSERT(prop != NULL);
1682 ASSERT(prop->key()->AsLiteral() != NULL); 1691 ASSERT(prop->key()->AsLiteral() != NULL);
1683 1692
1684 // If the assignment starts a block of assignments to the same object, 1693 // If the assignment starts a block of assignments to the same object,
(...skipping 23 matching lines...) Expand all
1708 EmitCallIC(ic, RelocInfo::CODE_TARGET); 1717 EmitCallIC(ic, RelocInfo::CODE_TARGET);
1709 1718
1710 // If the assignment ends an initialization block, revert to fast case. 1719 // If the assignment ends an initialization block, revert to fast case.
1711 if (expr->ends_initialization_block()) { 1720 if (expr->ends_initialization_block()) {
1712 __ push(r0); // Result of assignment, saved even if not needed. 1721 __ push(r0); // Result of assignment, saved even if not needed.
1713 // Receiver is under the result value. 1722 // Receiver is under the result value.
1714 __ ldr(ip, MemOperand(sp, kPointerSize)); 1723 __ ldr(ip, MemOperand(sp, kPointerSize));
1715 __ push(ip); 1724 __ push(ip);
1716 __ CallRuntime(Runtime::kToFastProperties, 1); 1725 __ CallRuntime(Runtime::kToFastProperties, 1);
1717 __ pop(r0); 1726 __ pop(r0);
1718 context()->DropAndPlug(1, r0); 1727 __ Drop(1);
1719 } else {
1720 context()->Plug(r0);
1721 } 1728 }
1729 PrepareForBailoutForId(expr->AssignmentId(), TOS_REG);
1730 context()->Plug(r0);
1722 } 1731 }
1723 1732
1724 1733
1725 void FullCodeGenerator::EmitKeyedPropertyAssignment(Assignment* expr) { 1734 void FullCodeGenerator::EmitKeyedPropertyAssignment(Assignment* expr) {
1726 // Assignment to a property, using a keyed store IC. 1735 // Assignment to a property, using a keyed store IC.
1727 1736
1728 // If the assignment starts a block of assignments to the same object, 1737 // If the assignment starts a block of assignments to the same object,
1729 // change to slow case to avoid the quadratic behavior of repeatedly 1738 // change to slow case to avoid the quadratic behavior of repeatedly
1730 // adding fast properties. 1739 // adding fast properties.
1731 if (expr->starts_initialization_block()) { 1740 if (expr->starts_initialization_block()) {
(...skipping 21 matching lines...) Expand all
1753 EmitCallIC(ic, RelocInfo::CODE_TARGET); 1762 EmitCallIC(ic, RelocInfo::CODE_TARGET);
1754 1763
1755 // If the assignment ends an initialization block, revert to fast case. 1764 // If the assignment ends an initialization block, revert to fast case.
1756 if (expr->ends_initialization_block()) { 1765 if (expr->ends_initialization_block()) {
1757 __ push(r0); // Result of assignment, saved even if not needed. 1766 __ push(r0); // Result of assignment, saved even if not needed.
1758 // Receiver is under the result value. 1767 // Receiver is under the result value.
1759 __ ldr(ip, MemOperand(sp, kPointerSize)); 1768 __ ldr(ip, MemOperand(sp, kPointerSize));
1760 __ push(ip); 1769 __ push(ip);
1761 __ CallRuntime(Runtime::kToFastProperties, 1); 1770 __ CallRuntime(Runtime::kToFastProperties, 1);
1762 __ pop(r0); 1771 __ pop(r0);
1763 context()->DropAndPlug(1, r0); 1772 __ Drop(1);
1764 } else {
1765 context()->Plug(r0);
1766 } 1773 }
1774 PrepareForBailoutForId(expr->AssignmentId(), TOS_REG);
1775 context()->Plug(r0);
1767 } 1776 }
1768 1777
1769 1778
1770 void FullCodeGenerator::VisitProperty(Property* expr) { 1779 void FullCodeGenerator::VisitProperty(Property* expr) {
1771 Comment cmnt(masm_, "[ Property"); 1780 Comment cmnt(masm_, "[ Property");
1772 Expression* key = expr->key(); 1781 Expression* key = expr->key();
1773 1782
1774 if (key->IsPropertyName()) { 1783 if (key->IsPropertyName()) {
1775 VisitForAccumulatorValue(expr->obj()); 1784 VisitForAccumulatorValue(expr->obj());
1776 EmitNamedPropertyLoad(expr); 1785 EmitNamedPropertyLoad(expr);
(...skipping 1436 matching lines...) Expand 10 before | Expand all | Expand 10 after
3213 __ CallStub(&stub); 3222 __ CallStub(&stub);
3214 __ bind(&done); 3223 __ bind(&done);
3215 3224
3216 // Store the value returned in r0. 3225 // Store the value returned in r0.
3217 switch (assign_type) { 3226 switch (assign_type) {
3218 case VARIABLE: 3227 case VARIABLE:
3219 if (expr->is_postfix()) { 3228 if (expr->is_postfix()) {
3220 { EffectContext context(this); 3229 { EffectContext context(this);
3221 EmitVariableAssignment(expr->expression()->AsVariableProxy()->var(), 3230 EmitVariableAssignment(expr->expression()->AsVariableProxy()->var(),
3222 Token::ASSIGN); 3231 Token::ASSIGN);
3232 PrepareForBailoutForId(expr->AssignmentId(), TOS_REG);
3233 context.Plug(r0);
3223 } 3234 }
3224 // For all contexts except EffectConstant We have the result on 3235 // For all contexts except EffectConstant We have the result on
3225 // top of the stack. 3236 // top of the stack.
3226 if (!context()->IsEffect()) { 3237 if (!context()->IsEffect()) {
3227 context()->PlugTOS(); 3238 context()->PlugTOS();
3228 } 3239 }
3229 } else { 3240 } else {
3230 EmitVariableAssignment(expr->expression()->AsVariableProxy()->var(), 3241 EmitVariableAssignment(expr->expression()->AsVariableProxy()->var(),
3231 Token::ASSIGN); 3242 Token::ASSIGN);
3243 PrepareForBailoutForId(expr->AssignmentId(), TOS_REG);
3244 context()->Plug(r0);
3232 } 3245 }
3233 break; 3246 break;
3234 case NAMED_PROPERTY: { 3247 case NAMED_PROPERTY: {
3235 __ mov(r2, Operand(prop->key()->AsLiteral()->handle())); 3248 __ mov(r2, Operand(prop->key()->AsLiteral()->handle()));
3236 __ pop(r1); 3249 __ pop(r1);
3237 Handle<Code> ic(isolate()->builtins()->builtin( 3250 Handle<Code> ic(isolate()->builtins()->builtin(
3238 Builtins::StoreIC_Initialize)); 3251 Builtins::StoreIC_Initialize));
3239 EmitCallIC(ic, RelocInfo::CODE_TARGET); 3252 EmitCallIC(ic, RelocInfo::CODE_TARGET);
3253 PrepareForBailoutForId(expr->AssignmentId(), TOS_REG);
3240 if (expr->is_postfix()) { 3254 if (expr->is_postfix()) {
3241 if (!context()->IsEffect()) { 3255 if (!context()->IsEffect()) {
3242 context()->PlugTOS(); 3256 context()->PlugTOS();
3243 } 3257 }
3244 } else { 3258 } else {
3245 context()->Plug(r0); 3259 context()->Plug(r0);
3246 } 3260 }
3247 break; 3261 break;
3248 } 3262 }
3249 case KEYED_PROPERTY: { 3263 case KEYED_PROPERTY: {
3250 __ pop(r1); // Key. 3264 __ pop(r1); // Key.
3251 __ pop(r2); // Receiver. 3265 __ pop(r2); // Receiver.
3252 Handle<Code> ic(isolate()->builtins()->builtin( 3266 Handle<Code> ic(isolate()->builtins()->builtin(
3253 Builtins::KeyedStoreIC_Initialize)); 3267 Builtins::KeyedStoreIC_Initialize));
3254 EmitCallIC(ic, RelocInfo::CODE_TARGET); 3268 EmitCallIC(ic, RelocInfo::CODE_TARGET);
3269 PrepareForBailoutForId(expr->AssignmentId(), TOS_REG);
3255 if (expr->is_postfix()) { 3270 if (expr->is_postfix()) {
3256 if (!context()->IsEffect()) { 3271 if (!context()->IsEffect()) {
3257 context()->PlugTOS(); 3272 context()->PlugTOS();
3258 } 3273 }
3259 } else { 3274 } else {
3260 context()->Plug(r0); 3275 context()->Plug(r0);
3261 } 3276 }
3262 break; 3277 break;
3263 } 3278 }
3264 } 3279 }
(...skipping 166 matching lines...) Expand 10 before | Expand all | Expand 10 after
3431 VisitForStackValue(expr->right()); 3446 VisitForStackValue(expr->right());
3432 __ InvokeBuiltin(Builtins::IN, CALL_JS); 3447 __ InvokeBuiltin(Builtins::IN, CALL_JS);
3433 PrepareForBailoutBeforeSplit(TOS_REG, false, NULL, NULL); 3448 PrepareForBailoutBeforeSplit(TOS_REG, false, NULL, NULL);
3434 __ LoadRoot(ip, Heap::kTrueValueRootIndex); 3449 __ LoadRoot(ip, Heap::kTrueValueRootIndex);
3435 __ cmp(r0, ip); 3450 __ cmp(r0, ip);
3436 Split(eq, if_true, if_false, fall_through); 3451 Split(eq, if_true, if_false, fall_through);
3437 break; 3452 break;
3438 3453
3439 case Token::INSTANCEOF: { 3454 case Token::INSTANCEOF: {
3440 VisitForStackValue(expr->right()); 3455 VisitForStackValue(expr->right());
3441 InstanceofStub stub; 3456 InstanceofStub stub(InstanceofStub::kNoFlags);
3442 __ CallStub(&stub); 3457 __ CallStub(&stub);
3443 PrepareForBailoutBeforeSplit(TOS_REG, true, if_true, if_false); 3458 PrepareForBailoutBeforeSplit(TOS_REG, true, if_true, if_false);
3444 // The stub returns 0 for true. 3459 // The stub returns 0 for true.
3445 __ tst(r0, r0); 3460 __ tst(r0, r0);
3446 Split(eq, if_true, if_false, fall_through); 3461 Split(eq, if_true, if_false, fall_through);
3447 break; 3462 break;
3448 } 3463 }
3449 3464
3450 default: { 3465 default: {
3451 VisitForAccumulatorValue(expr->right()); 3466 VisitForAccumulatorValue(expr->right());
(...skipping 152 matching lines...) Expand 10 before | Expand all | Expand 10 after
3604 __ mov(r1, Operand(r1, ASR, 1)); // Un-smi-tag value. 3619 __ mov(r1, Operand(r1, ASR, 1)); // Un-smi-tag value.
3605 __ add(pc, r1, Operand(masm_->CodeObject())); 3620 __ add(pc, r1, Operand(masm_->CodeObject()));
3606 } 3621 }
3607 3622
3608 3623
3609 #undef __ 3624 #undef __
3610 3625
3611 } } // namespace v8::internal 3626 } } // namespace v8::internal
3612 3627
3613 #endif // V8_TARGET_ARCH_ARM 3628 #endif // V8_TARGET_ARCH_ARM
OLDNEW
« no previous file with comments | « src/arm/codegen-arm.cc ('k') | src/arm/ic-arm.cc » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698