Chromium Code Reviews| 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 559 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... | |
| 570 Register reg = frame_->GetTOSRegister(); | 570 Register reg = frame_->GetTOSRegister(); |
| 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 ASSERT(scope()->arguments_shadow() != NULL); | 580 |
| 581 // In strict mode there is no need for shadow arguments. | |
| 582 ASSERT(scope()->arguments_shadow() != NULL || scope()->is_strict_mode()); | |
| 581 // We don't want to do lazy arguments allocation for functions that | 583 // We don't want to do lazy arguments allocation for functions that |
| 582 // have heap-allocated contexts, because it interfers with the | 584 // have heap-allocated contexts, because it interfers with the |
| 583 // uninitialized const tracking in the context objects. | 585 // uninitialized const tracking in the context objects. |
| 584 return (scope()->num_heap_slots() > 0) | 586 return (scope()->num_heap_slots() > 0 || scope()->is_strict_mode()) |
| 585 ? EAGER_ARGUMENTS_ALLOCATION | 587 ? EAGER_ARGUMENTS_ALLOCATION |
| 586 : LAZY_ARGUMENTS_ALLOCATION; | 588 : LAZY_ARGUMENTS_ALLOCATION; |
| 587 } | 589 } |
| 588 | 590 |
| 589 | 591 |
| 590 void CodeGenerator::StoreArgumentsObject(bool initial) { | 592 void CodeGenerator::StoreArgumentsObject(bool initial) { |
| 591 ArgumentsAllocationMode mode = ArgumentsMode(); | 593 ArgumentsAllocationMode mode = ArgumentsMode(); |
| 592 ASSERT(mode != NO_ARGUMENTS_ALLOCATION); | 594 ASSERT(mode != NO_ARGUMENTS_ALLOCATION); |
| 593 | 595 |
| 594 Comment cmnt(masm_, "[ store arguments object"); | 596 Comment cmnt(masm_, "[ store arguments object"); |
| (...skipping 13 matching lines...) Expand all Loading... | |
| 608 __ mov(r0, Operand(Smi::FromInt(scope()->num_parameters()))); | 610 __ mov(r0, Operand(Smi::FromInt(scope()->num_parameters()))); |
| 609 frame_->Adjust(3); | 611 frame_->Adjust(3); |
| 610 __ Push(r2, r1, r0); | 612 __ Push(r2, r1, r0); |
| 611 frame_->CallStub(&stub, 3); | 613 frame_->CallStub(&stub, 3); |
| 612 frame_->EmitPush(r0); | 614 frame_->EmitPush(r0); |
| 613 } | 615 } |
| 614 | 616 |
| 615 Variable* arguments = scope()->arguments(); | 617 Variable* arguments = scope()->arguments(); |
| 616 Variable* shadow = scope()->arguments_shadow(); | 618 Variable* shadow = scope()->arguments_shadow(); |
| 617 ASSERT(arguments != NULL && arguments->AsSlot() != NULL); | 619 ASSERT(arguments != NULL && arguments->AsSlot() != NULL); |
| 618 ASSERT(shadow != NULL && shadow->AsSlot() != NULL); | 620 ASSERT(shadow != NULL && shadow->AsSlot() != NULL || |
|
Kevin Millikin (Chromium)
2011/03/07 11:46:48
Parens around the && please.
Martin Maly
2011/03/07 19:09:40
Done.
| |
| 621 scope()->is_strict_mode()); | |
| 622 | |
| 619 JumpTarget done; | 623 JumpTarget done; |
| 620 if (mode == LAZY_ARGUMENTS_ALLOCATION && !initial) { | 624 if (mode == LAZY_ARGUMENTS_ALLOCATION && !initial) { |
| 621 // We have to skip storing into the arguments slot if it has | 625 // We have to skip storing into the arguments slot if it has |
| 622 // already been written to. This can happen if the a function | 626 // already been written to. This can happen if the a function |
| 623 // has a local variable named 'arguments'. | 627 // has a local variable named 'arguments'. |
| 624 LoadFromSlot(scope()->arguments()->AsSlot(), NOT_INSIDE_TYPEOF); | 628 LoadFromSlot(scope()->arguments()->AsSlot(), NOT_INSIDE_TYPEOF); |
| 625 Register arguments = frame_->PopToRegister(); | 629 Register arguments = frame_->PopToRegister(); |
| 626 __ LoadRoot(ip, Heap::kArgumentsMarkerRootIndex); | 630 __ LoadRoot(ip, Heap::kArgumentsMarkerRootIndex); |
| 627 __ cmp(arguments, ip); | 631 __ cmp(arguments, ip); |
| 628 done.Branch(ne); | 632 done.Branch(ne); |
| 629 } | 633 } |
| 630 StoreToSlot(arguments->AsSlot(), NOT_CONST_INIT); | 634 StoreToSlot(arguments->AsSlot(), NOT_CONST_INIT); |
| 631 if (mode == LAZY_ARGUMENTS_ALLOCATION) done.Bind(); | 635 if (mode == LAZY_ARGUMENTS_ALLOCATION) done.Bind(); |
| 632 StoreToSlot(shadow->AsSlot(), NOT_CONST_INIT); | 636 if (shadow != NULL) { |
| 637 StoreToSlot(shadow->AsSlot(), NOT_CONST_INIT); | |
| 638 } | |
| 633 } | 639 } |
| 634 | 640 |
| 635 | 641 |
| 636 void CodeGenerator::LoadTypeofExpression(Expression* expr) { | 642 void CodeGenerator::LoadTypeofExpression(Expression* expr) { |
| 637 // Special handling of identifiers as subexpressions of typeof. | 643 // Special handling of identifiers as subexpressions of typeof. |
| 638 Variable* variable = expr->AsVariableProxy()->AsVariable(); | 644 Variable* variable = expr->AsVariableProxy()->AsVariable(); |
| 639 if (variable != NULL && !variable->is_this() && variable->is_global()) { | 645 if (variable != NULL && !variable->is_this() && variable->is_global()) { |
| 640 // For a global variable we build the property reference | 646 // For a global variable we build the property reference |
| 641 // <global>.<variable> and perform a (regular non-contextual) property | 647 // <global>.<variable> and perform a (regular non-contextual) property |
| 642 // load to make sure we do not get reference errors. | 648 // load to make sure we do not get reference errors. |
| (...skipping 6754 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... | |
| 7397 BinaryOpIC::GetName(runtime_operands_type_)); | 7403 BinaryOpIC::GetName(runtime_operands_type_)); |
| 7398 return name_; | 7404 return name_; |
| 7399 } | 7405 } |
| 7400 | 7406 |
| 7401 | 7407 |
| 7402 #undef __ | 7408 #undef __ |
| 7403 | 7409 |
| 7404 } } // namespace v8::internal | 7410 } } // namespace v8::internal |
| 7405 | 7411 |
| 7406 #endif // V8_TARGET_ARCH_ARM | 7412 #endif // V8_TARGET_ARCH_ARM |
| OLD | NEW |