OLD | NEW |
1 // Copyright 2012 the V8 project authors. All rights reserved. | 1 // Copyright 2012 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 773 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
784 Split(eq, a0, Operand(t0), if_true, if_false, NULL); | 784 Split(eq, a0, Operand(t0), if_true, if_false, NULL); |
785 __ bind(&skip); | 785 __ bind(&skip); |
786 } | 786 } |
787 } | 787 } |
788 | 788 |
789 | 789 |
790 void FullCodeGenerator::EmitDebugCheckDeclarationContext(Variable* variable) { | 790 void FullCodeGenerator::EmitDebugCheckDeclarationContext(Variable* variable) { |
791 // The variable in the declaration always resides in the current function | 791 // The variable in the declaration always resides in the current function |
792 // context. | 792 // context. |
793 ASSERT_EQ(0, scope()->ContextChainLength(variable->scope())); | 793 ASSERT_EQ(0, scope()->ContextChainLength(variable->scope())); |
794 if (FLAG_debug_code) { | 794 if (generate_debug_code_) { |
795 // Check that we're not inside a with or catch context. | 795 // Check that we're not inside a with or catch context. |
796 __ lw(a1, FieldMemOperand(cp, HeapObject::kMapOffset)); | 796 __ lw(a1, FieldMemOperand(cp, HeapObject::kMapOffset)); |
797 __ LoadRoot(t0, Heap::kWithContextMapRootIndex); | 797 __ LoadRoot(t0, Heap::kWithContextMapRootIndex); |
798 __ Check(ne, "Declaration in with context.", | 798 __ Check(ne, "Declaration in with context.", |
799 a1, Operand(t0)); | 799 a1, Operand(t0)); |
800 __ LoadRoot(t0, Heap::kCatchContextMapRootIndex); | 800 __ LoadRoot(t0, Heap::kCatchContextMapRootIndex); |
801 __ Check(ne, "Declaration in catch context.", | 801 __ Check(ne, "Declaration in catch context.", |
802 a1, Operand(t0)); | 802 a1, Operand(t0)); |
803 } | 803 } |
804 } | 804 } |
(...skipping 1352 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
2157 __ RecordWriteContextSlot( | 2157 __ RecordWriteContextSlot( |
2158 a1, offset, a3, a2, kRAHasBeenSaved, kDontSaveFPRegs); | 2158 a1, offset, a3, a2, kRAHasBeenSaved, kDontSaveFPRegs); |
2159 } | 2159 } |
2160 } | 2160 } |
2161 | 2161 |
2162 } else if (!var->is_const_mode() || op == Token::INIT_CONST_HARMONY) { | 2162 } else if (!var->is_const_mode() || op == Token::INIT_CONST_HARMONY) { |
2163 // Assignment to var or initializing assignment to let/const | 2163 // Assignment to var or initializing assignment to let/const |
2164 // in harmony mode. | 2164 // in harmony mode. |
2165 if (var->IsStackAllocated() || var->IsContextSlot()) { | 2165 if (var->IsStackAllocated() || var->IsContextSlot()) { |
2166 MemOperand location = VarOperand(var, a1); | 2166 MemOperand location = VarOperand(var, a1); |
2167 if (FLAG_debug_code && op == Token::INIT_LET) { | 2167 if (generate_debug_code_ && op == Token::INIT_LET) { |
2168 // Check for an uninitialized let binding. | 2168 // Check for an uninitialized let binding. |
2169 __ lw(a2, location); | 2169 __ lw(a2, location); |
2170 __ LoadRoot(t0, Heap::kTheHoleValueRootIndex); | 2170 __ LoadRoot(t0, Heap::kTheHoleValueRootIndex); |
2171 __ Check(eq, "Let binding re-initialization.", a2, Operand(t0)); | 2171 __ Check(eq, "Let binding re-initialization.", a2, Operand(t0)); |
2172 } | 2172 } |
2173 // Perform the assignment. | 2173 // Perform the assignment. |
2174 __ sw(v0, location); | 2174 __ sw(v0, location); |
2175 if (var->IsContextSlot()) { | 2175 if (var->IsContextSlot()) { |
2176 __ mov(a3, v0); | 2176 __ mov(a3, v0); |
2177 int offset = Context::SlotOffset(var->index()); | 2177 int offset = Context::SlotOffset(var->index()); |
(...skipping 549 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
2727 | 2727 |
2728 VisitForAccumulatorValue(args->at(0)); | 2728 VisitForAccumulatorValue(args->at(0)); |
2729 | 2729 |
2730 Label materialize_true, materialize_false; | 2730 Label materialize_true, materialize_false; |
2731 Label* if_true = NULL; | 2731 Label* if_true = NULL; |
2732 Label* if_false = NULL; | 2732 Label* if_false = NULL; |
2733 Label* fall_through = NULL; | 2733 Label* fall_through = NULL; |
2734 context()->PrepareTest(&materialize_true, &materialize_false, | 2734 context()->PrepareTest(&materialize_true, &materialize_false, |
2735 &if_true, &if_false, &fall_through); | 2735 &if_true, &if_false, &fall_through); |
2736 | 2736 |
2737 if (FLAG_debug_code) __ AbortIfSmi(v0); | 2737 if (generate_debug_code_) __ AbortIfSmi(v0); |
2738 | 2738 |
2739 __ lw(a1, FieldMemOperand(v0, HeapObject::kMapOffset)); | 2739 __ lw(a1, FieldMemOperand(v0, HeapObject::kMapOffset)); |
2740 __ lbu(t0, FieldMemOperand(a1, Map::kBitField2Offset)); | 2740 __ lbu(t0, FieldMemOperand(a1, Map::kBitField2Offset)); |
2741 __ And(t0, t0, 1 << Map::kStringWrapperSafeForDefaultValueOf); | 2741 __ And(t0, t0, 1 << Map::kStringWrapperSafeForDefaultValueOf); |
2742 __ Branch(if_true, ne, t0, Operand(zero_reg)); | 2742 __ Branch(if_true, ne, t0, Operand(zero_reg)); |
2743 | 2743 |
2744 // Check for fast case object. Generate false result for slow case object. | 2744 // Check for fast case object. Generate false result for slow case object. |
2745 __ lw(a2, FieldMemOperand(v0, JSObject::kPropertiesOffset)); | 2745 __ lw(a2, FieldMemOperand(v0, JSObject::kPropertiesOffset)); |
2746 __ lw(a2, FieldMemOperand(a2, HeapObject::kMapOffset)); | 2746 __ lw(a2, FieldMemOperand(a2, HeapObject::kMapOffset)); |
2747 __ LoadRoot(t0, Heap::kHashTableMapRootIndex); | 2747 __ LoadRoot(t0, Heap::kHashTableMapRootIndex); |
(...skipping 854 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
3602 | 3602 |
3603 context()->Plug(if_true, if_false); | 3603 context()->Plug(if_true, if_false); |
3604 } | 3604 } |
3605 | 3605 |
3606 | 3606 |
3607 void FullCodeGenerator::EmitGetCachedArrayIndex(CallRuntime* expr) { | 3607 void FullCodeGenerator::EmitGetCachedArrayIndex(CallRuntime* expr) { |
3608 ZoneList<Expression*>* args = expr->arguments(); | 3608 ZoneList<Expression*>* args = expr->arguments(); |
3609 ASSERT(args->length() == 1); | 3609 ASSERT(args->length() == 1); |
3610 VisitForAccumulatorValue(args->at(0)); | 3610 VisitForAccumulatorValue(args->at(0)); |
3611 | 3611 |
3612 if (FLAG_debug_code) { | 3612 if (generate_debug_code_) { |
3613 __ AbortIfNotString(v0); | 3613 __ AbortIfNotString(v0); |
3614 } | 3614 } |
3615 | 3615 |
3616 __ lw(v0, FieldMemOperand(v0, String::kHashFieldOffset)); | 3616 __ lw(v0, FieldMemOperand(v0, String::kHashFieldOffset)); |
3617 __ IndexFromHash(v0, v0); | 3617 __ IndexFromHash(v0, v0); |
3618 | 3618 |
3619 context()->Plug(v0); | 3619 context()->Plug(v0); |
3620 } | 3620 } |
3621 | 3621 |
3622 | 3622 |
(...skipping 55 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
3678 __ sll(elements_end, array_length, kPointerSizeLog2); | 3678 __ sll(elements_end, array_length, kPointerSizeLog2); |
3679 __ Addu(elements_end, element, elements_end); | 3679 __ Addu(elements_end, element, elements_end); |
3680 // Loop condition: while (element < elements_end). | 3680 // Loop condition: while (element < elements_end). |
3681 // Live values in registers: | 3681 // Live values in registers: |
3682 // elements: Fixed array of strings. | 3682 // elements: Fixed array of strings. |
3683 // array_length: Length of the fixed array of strings (not smi) | 3683 // array_length: Length of the fixed array of strings (not smi) |
3684 // separator: Separator string | 3684 // separator: Separator string |
3685 // string_length: Accumulated sum of string lengths (smi). | 3685 // string_length: Accumulated sum of string lengths (smi). |
3686 // element: Current array element. | 3686 // element: Current array element. |
3687 // elements_end: Array end. | 3687 // elements_end: Array end. |
3688 if (FLAG_debug_code) { | 3688 if (generate_debug_code_) { |
3689 __ Assert(gt, "No empty arrays here in EmitFastAsciiArrayJoin", | 3689 __ Assert(gt, "No empty arrays here in EmitFastAsciiArrayJoin", |
3690 array_length, Operand(zero_reg)); | 3690 array_length, Operand(zero_reg)); |
3691 } | 3691 } |
3692 __ bind(&loop); | 3692 __ bind(&loop); |
3693 __ lw(string, MemOperand(element)); | 3693 __ lw(string, MemOperand(element)); |
3694 __ Addu(element, element, kPointerSize); | 3694 __ Addu(element, element, kPointerSize); |
3695 __ JumpIfSmi(string, &bailout); | 3695 __ JumpIfSmi(string, &bailout); |
3696 __ lw(scratch1, FieldMemOperand(string, HeapObject::kMapOffset)); | 3696 __ lw(scratch1, FieldMemOperand(string, HeapObject::kMapOffset)); |
3697 __ lbu(scratch1, FieldMemOperand(scratch1, Map::kInstanceTypeOffset)); | 3697 __ lbu(scratch1, FieldMemOperand(scratch1, Map::kInstanceTypeOffset)); |
3698 __ JumpIfInstanceTypeIsNotSequentialAscii(scratch1, scratch2, &bailout); | 3698 __ JumpIfInstanceTypeIsNotSequentialAscii(scratch1, scratch2, &bailout); |
(...skipping 908 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
4607 *context_length = 0; | 4607 *context_length = 0; |
4608 return previous_; | 4608 return previous_; |
4609 } | 4609 } |
4610 | 4610 |
4611 | 4611 |
4612 #undef __ | 4612 #undef __ |
4613 | 4613 |
4614 } } // namespace v8::internal | 4614 } } // namespace v8::internal |
4615 | 4615 |
4616 #endif // V8_TARGET_ARCH_MIPS | 4616 #endif // V8_TARGET_ARCH_MIPS |
OLD | NEW |