| OLD | NEW |
| 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 560 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 571 __ ldr(reg, ContextOperand(cp, Context::GLOBAL_INDEX)); | 571 __ ldr(reg, ContextOperand(cp, Context::GLOBAL_INDEX)); |
| 572 __ ldr(reg, | 572 __ ldr(reg, |
| 573 FieldMemOperand(reg, GlobalObject::kGlobalReceiverOffset)); | 573 FieldMemOperand(reg, GlobalObject::kGlobalReceiverOffset)); |
| 574 frame_->EmitPush(reg); | 574 frame_->EmitPush(reg); |
| 575 } | 575 } |
| 576 | 576 |
| 577 | 577 |
| 578 ArgumentsAllocationMode CodeGenerator::ArgumentsMode() { | 578 ArgumentsAllocationMode CodeGenerator::ArgumentsMode() { |
| 579 if (scope()->arguments() == NULL) return NO_ARGUMENTS_ALLOCATION; | 579 if (scope()->arguments() == NULL) return NO_ARGUMENTS_ALLOCATION; |
| 580 | 580 |
| 581 // In strict mode there is no need for shadow arguments. | |
| 582 ASSERT(scope()->arguments_shadow() != NULL || scope()->is_strict_mode()); | |
| 583 // We don't want to do lazy arguments allocation for functions that | 581 // We don't want to do lazy arguments allocation for functions that |
| 584 // have heap-allocated contexts, because it interfers with the | 582 // have heap-allocated contexts, because it interfers with the |
| 585 // uninitialized const tracking in the context objects. | 583 // uninitialized const tracking in the context objects. |
| 586 return (scope()->num_heap_slots() > 0 || scope()->is_strict_mode()) | 584 return (scope()->num_heap_slots() > 0 || scope()->is_strict_mode()) |
| 587 ? EAGER_ARGUMENTS_ALLOCATION | 585 ? EAGER_ARGUMENTS_ALLOCATION |
| 588 : LAZY_ARGUMENTS_ALLOCATION; | 586 : LAZY_ARGUMENTS_ALLOCATION; |
| 589 } | 587 } |
| 590 | 588 |
| 591 | 589 |
| 592 void CodeGenerator::StoreArgumentsObject(bool initial) { | 590 void CodeGenerator::StoreArgumentsObject(bool initial) { |
| (...skipping 15 matching lines...) Expand all Loading... |
| 608 const int kReceiverDisplacement = 2 + scope()->num_parameters(); | 606 const int kReceiverDisplacement = 2 + scope()->num_parameters(); |
| 609 __ add(r1, fp, Operand(kReceiverDisplacement * kPointerSize)); | 607 __ add(r1, fp, Operand(kReceiverDisplacement * kPointerSize)); |
| 610 __ mov(r0, Operand(Smi::FromInt(scope()->num_parameters()))); | 608 __ mov(r0, Operand(Smi::FromInt(scope()->num_parameters()))); |
| 611 frame_->Adjust(3); | 609 frame_->Adjust(3); |
| 612 __ Push(r2, r1, r0); | 610 __ Push(r2, r1, r0); |
| 613 frame_->CallStub(&stub, 3); | 611 frame_->CallStub(&stub, 3); |
| 614 frame_->EmitPush(r0); | 612 frame_->EmitPush(r0); |
| 615 } | 613 } |
| 616 | 614 |
| 617 Variable* arguments = scope()->arguments(); | 615 Variable* arguments = scope()->arguments(); |
| 618 Variable* shadow = scope()->arguments_shadow(); | |
| 619 ASSERT(arguments != NULL && arguments->AsSlot() != NULL); | 616 ASSERT(arguments != NULL && arguments->AsSlot() != NULL); |
| 620 ASSERT((shadow != NULL && shadow->AsSlot() != NULL) || | |
| 621 scope()->is_strict_mode()); | |
| 622 | 617 |
| 623 JumpTarget done; | 618 JumpTarget done; |
| 624 if (mode == LAZY_ARGUMENTS_ALLOCATION && !initial) { | 619 if (mode == LAZY_ARGUMENTS_ALLOCATION && !initial) { |
| 625 // We have to skip storing into the arguments slot if it has | 620 // We have to skip storing into the arguments slot if it has |
| 626 // already been written to. This can happen if the a function | 621 // already been written to. This can happen if the a function |
| 627 // has a local variable named 'arguments'. | 622 // has a local variable named 'arguments'. |
| 628 LoadFromSlot(scope()->arguments()->AsSlot(), NOT_INSIDE_TYPEOF); | 623 LoadFromSlot(scope()->arguments()->AsSlot(), NOT_INSIDE_TYPEOF); |
| 629 Register arguments = frame_->PopToRegister(); | 624 Register arguments = frame_->PopToRegister(); |
| 630 __ LoadRoot(ip, Heap::kArgumentsMarkerRootIndex); | 625 __ LoadRoot(ip, Heap::kArgumentsMarkerRootIndex); |
| 631 __ cmp(arguments, ip); | 626 __ cmp(arguments, ip); |
| 632 done.Branch(ne); | 627 done.Branch(ne); |
| 633 } | 628 } |
| 634 StoreToSlot(arguments->AsSlot(), NOT_CONST_INIT); | 629 StoreToSlot(arguments->AsSlot(), NOT_CONST_INIT); |
| 635 if (mode == LAZY_ARGUMENTS_ALLOCATION) done.Bind(); | 630 if (mode == LAZY_ARGUMENTS_ALLOCATION) done.Bind(); |
| 636 if (shadow != NULL) { | |
| 637 StoreToSlot(shadow->AsSlot(), NOT_CONST_INIT); | |
| 638 } | |
| 639 } | 631 } |
| 640 | 632 |
| 641 | 633 |
| 642 void CodeGenerator::LoadTypeofExpression(Expression* expr) { | 634 void CodeGenerator::LoadTypeofExpression(Expression* expr) { |
| 643 // Special handling of identifiers as subexpressions of typeof. | 635 // Special handling of identifiers as subexpressions of typeof. |
| 644 Variable* variable = expr->AsVariableProxy()->AsVariable(); | 636 Variable* variable = expr->AsVariableProxy()->AsVariable(); |
| 645 if (variable != NULL && !variable->is_this() && variable->is_global()) { | 637 if (variable != NULL && !variable->is_this() && variable->is_global()) { |
| 646 // For a global variable we build the property reference | 638 // For a global variable we build the property reference |
| 647 // <global>.<variable> and perform a (regular non-contextual) property | 639 // <global>.<variable> and perform a (regular non-contextual) property |
| 648 // load to make sure we do not get reference errors. | 640 // load to make sure we do not get reference errors. |
| (...skipping 6758 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 7407 BinaryOpIC::GetName(runtime_operands_type_)); | 7399 BinaryOpIC::GetName(runtime_operands_type_)); |
| 7408 return name_; | 7400 return name_; |
| 7409 } | 7401 } |
| 7410 | 7402 |
| 7411 | 7403 |
| 7412 #undef __ | 7404 #undef __ |
| 7413 | 7405 |
| 7414 } } // namespace v8::internal | 7406 } } // namespace v8::internal |
| 7415 | 7407 |
| 7416 #endif // V8_TARGET_ARCH_ARM | 7408 #endif // V8_TARGET_ARCH_ARM |
| OLD | NEW |