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