OLD | NEW |
1 // Copyright 2010 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 |
11 // with the distribution. | 11 // with the distribution. |
(...skipping 440 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
452 | 452 |
453 | 453 |
454 void FullCodeGenerator::StackValueContext::Plug(bool flag) const { | 454 void FullCodeGenerator::StackValueContext::Plug(bool flag) const { |
455 Heap::RootListIndex value_root_index = | 455 Heap::RootListIndex value_root_index = |
456 flag ? Heap::kTrueValueRootIndex : Heap::kFalseValueRootIndex; | 456 flag ? Heap::kTrueValueRootIndex : Heap::kFalseValueRootIndex; |
457 __ PushRoot(value_root_index); | 457 __ PushRoot(value_root_index); |
458 } | 458 } |
459 | 459 |
460 | 460 |
461 void FullCodeGenerator::TestContext::Plug(bool flag) const { | 461 void FullCodeGenerator::TestContext::Plug(bool flag) const { |
462 codegen()->PrepareForBailoutBeforeSplit(TOS_REG, true, NULL, NULL); | 462 codegen()->PrepareForBailoutBeforeSplit(TOS_REG, |
| 463 true, |
| 464 true_label_, |
| 465 false_label_); |
463 if (flag) { | 466 if (flag) { |
464 if (true_label_ != fall_through_) __ jmp(true_label_); | 467 if (true_label_ != fall_through_) __ jmp(true_label_); |
465 } else { | 468 } else { |
466 if (false_label_ != fall_through_) __ jmp(false_label_); | 469 if (false_label_ != fall_through_) __ jmp(false_label_); |
467 } | 470 } |
468 } | 471 } |
469 | 472 |
470 | 473 |
471 void FullCodeGenerator::DoTest(Label* if_true, | 474 void FullCodeGenerator::DoTest(Label* if_true, |
472 Label* if_false, | 475 Label* if_false, |
(...skipping 900 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
1373 break; | 1376 break; |
1374 case NAMED_PROPERTY: | 1377 case NAMED_PROPERTY: |
1375 if (expr->is_compound()) { | 1378 if (expr->is_compound()) { |
1376 // We need the receiver both on the stack and in the accumulator. | 1379 // We need the receiver both on the stack and in the accumulator. |
1377 VisitForAccumulatorValue(property->obj()); | 1380 VisitForAccumulatorValue(property->obj()); |
1378 __ push(result_register()); | 1381 __ push(result_register()); |
1379 } else { | 1382 } else { |
1380 VisitForStackValue(property->obj()); | 1383 VisitForStackValue(property->obj()); |
1381 } | 1384 } |
1382 break; | 1385 break; |
1383 case KEYED_PROPERTY: | 1386 case KEYED_PROPERTY: { |
1384 if (expr->is_compound()) { | 1387 if (expr->is_compound()) { |
1385 VisitForStackValue(property->obj()); | 1388 if (property->is_arguments_access()) { |
1386 VisitForAccumulatorValue(property->key()); | 1389 VariableProxy* obj_proxy = property->obj()->AsVariableProxy(); |
| 1390 MemOperand slot_operand = |
| 1391 EmitSlotSearch(obj_proxy->var()->AsSlot(), rcx); |
| 1392 __ push(slot_operand); |
| 1393 __ Move(rax, property->key()->AsLiteral()->handle()); |
| 1394 } else { |
| 1395 VisitForStackValue(property->obj()); |
| 1396 VisitForAccumulatorValue(property->key()); |
| 1397 } |
1387 __ movq(rdx, Operand(rsp, 0)); | 1398 __ movq(rdx, Operand(rsp, 0)); |
1388 __ push(rax); | 1399 __ push(rax); |
1389 } else { | 1400 } else { |
1390 VisitForStackValue(property->obj()); | 1401 if (property->is_arguments_access()) { |
1391 VisitForStackValue(property->key()); | 1402 VariableProxy* obj_proxy = property->obj()->AsVariableProxy(); |
| 1403 MemOperand slot_operand = |
| 1404 EmitSlotSearch(obj_proxy->var()->AsSlot(), rcx); |
| 1405 __ push(slot_operand); |
| 1406 __ Push(property->key()->AsLiteral()->handle()); |
| 1407 } else { |
| 1408 VisitForStackValue(property->obj()); |
| 1409 VisitForStackValue(property->key()); |
| 1410 } |
1392 } | 1411 } |
1393 break; | 1412 break; |
| 1413 } |
1394 } | 1414 } |
1395 | 1415 |
1396 if (expr->is_compound()) { | 1416 if (expr->is_compound()) { |
1397 { AccumulatorValueContext context(this); | 1417 { AccumulatorValueContext context(this); |
1398 switch (assign_type) { | 1418 switch (assign_type) { |
1399 case VARIABLE: | 1419 case VARIABLE: |
1400 EmitVariableLoad(expr->target()->AsVariableProxy()->var()); | 1420 EmitVariableLoad(expr->target()->AsVariableProxy()->var()); |
1401 break; | 1421 break; |
1402 case NAMED_PROPERTY: | 1422 case NAMED_PROPERTY: |
1403 EmitNamedPropertyLoad(property); | 1423 EmitNamedPropertyLoad(property); |
(...skipping 1708 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
3112 } else { | 3132 } else { |
3113 // Reserve space for result of postfix operation. | 3133 // Reserve space for result of postfix operation. |
3114 if (expr->is_postfix() && !context()->IsEffect()) { | 3134 if (expr->is_postfix() && !context()->IsEffect()) { |
3115 __ Push(Smi::FromInt(0)); | 3135 __ Push(Smi::FromInt(0)); |
3116 } | 3136 } |
3117 if (assign_type == NAMED_PROPERTY) { | 3137 if (assign_type == NAMED_PROPERTY) { |
3118 VisitForAccumulatorValue(prop->obj()); | 3138 VisitForAccumulatorValue(prop->obj()); |
3119 __ push(rax); // Copy of receiver, needed for later store. | 3139 __ push(rax); // Copy of receiver, needed for later store. |
3120 EmitNamedPropertyLoad(prop); | 3140 EmitNamedPropertyLoad(prop); |
3121 } else { | 3141 } else { |
3122 VisitForStackValue(prop->obj()); | 3142 if (prop->is_arguments_access()) { |
3123 VisitForAccumulatorValue(prop->key()); | 3143 VariableProxy* obj_proxy = prop->obj()->AsVariableProxy(); |
| 3144 MemOperand slot_operand = |
| 3145 EmitSlotSearch(obj_proxy->var()->AsSlot(), rcx); |
| 3146 __ push(slot_operand); |
| 3147 __ Move(rax, prop->key()->AsLiteral()->handle()); |
| 3148 } else { |
| 3149 VisitForStackValue(prop->obj()); |
| 3150 VisitForAccumulatorValue(prop->key()); |
| 3151 } |
3124 __ movq(rdx, Operand(rsp, 0)); // Leave receiver on stack | 3152 __ movq(rdx, Operand(rsp, 0)); // Leave receiver on stack |
3125 __ push(rax); // Copy of key, needed for later store. | 3153 __ push(rax); // Copy of key, needed for later store. |
3126 EmitKeyedPropertyLoad(prop); | 3154 EmitKeyedPropertyLoad(prop); |
3127 } | 3155 } |
3128 } | 3156 } |
3129 | 3157 |
3130 // We need a second deoptimization point after loading the value | 3158 // We need a second deoptimization point after loading the value |
3131 // in case evaluating the property load my have a side effect. | 3159 // in case evaluating the property load my have a side effect. |
3132 PrepareForBailout(expr->increment(), TOS_REG); | 3160 PrepareForBailout(expr->increment(), TOS_REG); |
3133 | 3161 |
(...skipping 466 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
3600 __ ret(0); | 3628 __ ret(0); |
3601 } | 3629 } |
3602 | 3630 |
3603 | 3631 |
3604 #undef __ | 3632 #undef __ |
3605 | 3633 |
3606 | 3634 |
3607 } } // namespace v8::internal | 3635 } } // namespace v8::internal |
3608 | 3636 |
3609 #endif // V8_TARGET_ARCH_X64 | 3637 #endif // V8_TARGET_ARCH_X64 |
OLD | NEW |