| 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 1091 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 1102 | 1102 |
| 1103 Register heap_number_map = r7; | 1103 Register heap_number_map = r7; |
| 1104 __ LoadRoot(heap_number_map, Heap::kHeapNumberMapRootIndex); | 1104 __ LoadRoot(heap_number_map, Heap::kHeapNumberMapRootIndex); |
| 1105 __ ldr(r3, FieldMemOperand(tos_register_, HeapNumber::kMapOffset)); | 1105 __ ldr(r3, FieldMemOperand(tos_register_, HeapNumber::kMapOffset)); |
| 1106 __ cmp(r3, heap_number_map); | 1106 __ cmp(r3, heap_number_map); |
| 1107 // Not a number, fall back to the GenericBinaryOpStub. | 1107 // Not a number, fall back to the GenericBinaryOpStub. |
| 1108 __ b(ne, entry_label()); | 1108 __ b(ne, entry_label()); |
| 1109 | 1109 |
| 1110 Register int32 = r2; | 1110 Register int32 = r2; |
| 1111 // Not a 32bits signed int, fall back to the GenericBinaryOpStub. | 1111 // Not a 32bits signed int, fall back to the GenericBinaryOpStub. |
| 1112 __ ConvertToInt32(tos_register_, int32, r4, r5, entry_label()); | 1112 __ ConvertToInt32(tos_register_, int32, r4, r5, d0, entry_label()); |
| 1113 | 1113 |
| 1114 // tos_register_ (r0 or r1): Original heap number. | 1114 // tos_register_ (r0 or r1): Original heap number. |
| 1115 // int32: signed 32bits int. | 1115 // int32: signed 32bits int. |
| 1116 | 1116 |
| 1117 Label result_not_a_smi; | 1117 Label result_not_a_smi; |
| 1118 int shift_value = value_ & 0x1f; | 1118 int shift_value = value_ & 0x1f; |
| 1119 switch (op_) { | 1119 switch (op_) { |
| 1120 case Token::BIT_OR: __ orr(int32, int32, Operand(value_)); break; | 1120 case Token::BIT_OR: __ orr(int32, int32, Operand(value_)); break; |
| 1121 case Token::BIT_XOR: __ eor(int32, int32, Operand(value_)); break; | 1121 case Token::BIT_XOR: __ eor(int32, int32, Operand(value_)); break; |
| 1122 case Token::BIT_AND: __ and_(int32, int32, Operand(value_)); break; | 1122 case Token::BIT_AND: __ and_(int32, int32, Operand(value_)); break; |
| (...skipping 1062 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 2185 frame_->Exit(); | 2185 frame_->Exit(); |
| 2186 | 2186 |
| 2187 // Here we use masm_-> instead of the __ macro to avoid the code coverage | 2187 // Here we use masm_-> instead of the __ macro to avoid the code coverage |
| 2188 // tool from instrumenting as we rely on the code size here. | 2188 // tool from instrumenting as we rely on the code size here. |
| 2189 int32_t sp_delta = (scope()->num_parameters() + 1) * kPointerSize; | 2189 int32_t sp_delta = (scope()->num_parameters() + 1) * kPointerSize; |
| 2190 masm_->add(sp, sp, Operand(sp_delta)); | 2190 masm_->add(sp, sp, Operand(sp_delta)); |
| 2191 masm_->Jump(lr); | 2191 masm_->Jump(lr); |
| 2192 DeleteFrame(); | 2192 DeleteFrame(); |
| 2193 | 2193 |
| 2194 #ifdef DEBUG | 2194 #ifdef DEBUG |
| 2195 // Check that the size of the code used for returning matches what is | 2195 // Check that the size of the code used for returning is large enough |
| 2196 // expected by the debugger. If the sp_delts above cannot be encoded in | 2196 // for the debugger's requirements. |
| 2197 // the add instruction the add will generate two instructions. | 2197 ASSERT(Assembler::kJSReturnSequenceInstructions <= |
| 2198 int return_sequence_length = | 2198 masm_->InstructionsGeneratedSince(&check_exit_codesize)); |
| 2199 masm_->InstructionsGeneratedSince(&check_exit_codesize); | |
| 2200 CHECK(return_sequence_length == | |
| 2201 Assembler::kJSReturnSequenceInstructions || | |
| 2202 return_sequence_length == | |
| 2203 Assembler::kJSReturnSequenceInstructions + 1); | |
| 2204 #endif | 2199 #endif |
| 2205 } | 2200 } |
| 2206 } | 2201 } |
| 2207 | 2202 |
| 2208 | 2203 |
| 2209 void CodeGenerator::VisitWithEnterStatement(WithEnterStatement* node) { | 2204 void CodeGenerator::VisitWithEnterStatement(WithEnterStatement* node) { |
| 2210 #ifdef DEBUG | 2205 #ifdef DEBUG |
| 2211 int original_height = frame_->height(); | 2206 int original_height = frame_->height(); |
| 2212 #endif | 2207 #endif |
| 2213 Comment cmnt(masm_, "[ WithEnterStatement"); | 2208 Comment cmnt(masm_, "[ WithEnterStatement"); |
| (...skipping 1957 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 4171 frame_->EmitPush(r0); | 4166 frame_->EmitPush(r0); |
| 4172 if (arg_count > 0) { | 4167 if (arg_count > 0) { |
| 4173 __ ldr(r1, MemOperand(sp, arg_count * kPointerSize)); | 4168 __ ldr(r1, MemOperand(sp, arg_count * kPointerSize)); |
| 4174 frame_->EmitPush(r1); | 4169 frame_->EmitPush(r1); |
| 4175 } else { | 4170 } else { |
| 4176 frame_->EmitPush(r2); | 4171 frame_->EmitPush(r2); |
| 4177 } | 4172 } |
| 4178 __ ldr(r1, frame_->Receiver()); | 4173 __ ldr(r1, frame_->Receiver()); |
| 4179 frame_->EmitPush(r1); | 4174 frame_->EmitPush(r1); |
| 4180 | 4175 |
| 4181 frame_->CallRuntime(Runtime::kResolvePossiblyDirectEvalNoLookup, 3); | 4176 // Push the strict mode flag. |
| 4177 frame_->EmitPush(Operand(Smi::FromInt(strict_mode_flag()))); |
| 4178 |
| 4179 frame_->CallRuntime(Runtime::kResolvePossiblyDirectEvalNoLookup, 4); |
| 4182 | 4180 |
| 4183 done.Jump(); | 4181 done.Jump(); |
| 4184 slow.Bind(); | 4182 slow.Bind(); |
| 4185 } | 4183 } |
| 4186 | 4184 |
| 4187 // Prepare the stack for the call to ResolvePossiblyDirectEval by | 4185 // Prepare the stack for the call to ResolvePossiblyDirectEval by |
| 4188 // pushing the loaded function, the first argument to the eval | 4186 // pushing the loaded function, the first argument to the eval |
| 4189 // call and the receiver. | 4187 // call and the receiver. |
| 4190 __ ldr(r1, MemOperand(sp, arg_count * kPointerSize + kPointerSize)); | 4188 __ ldr(r1, MemOperand(sp, arg_count * kPointerSize + kPointerSize)); |
| 4191 frame_->EmitPush(r1); | 4189 frame_->EmitPush(r1); |
| 4192 if (arg_count > 0) { | 4190 if (arg_count > 0) { |
| 4193 __ ldr(r1, MemOperand(sp, arg_count * kPointerSize)); | 4191 __ ldr(r1, MemOperand(sp, arg_count * kPointerSize)); |
| 4194 frame_->EmitPush(r1); | 4192 frame_->EmitPush(r1); |
| 4195 } else { | 4193 } else { |
| 4196 frame_->EmitPush(r2); | 4194 frame_->EmitPush(r2); |
| 4197 } | 4195 } |
| 4198 __ ldr(r1, frame_->Receiver()); | 4196 __ ldr(r1, frame_->Receiver()); |
| 4199 frame_->EmitPush(r1); | 4197 frame_->EmitPush(r1); |
| 4200 | 4198 |
| 4199 // Push the strict mode flag. |
| 4200 frame_->EmitPush(Operand(Smi::FromInt(strict_mode_flag()))); |
| 4201 |
| 4201 // Resolve the call. | 4202 // Resolve the call. |
| 4202 frame_->CallRuntime(Runtime::kResolvePossiblyDirectEval, 3); | 4203 frame_->CallRuntime(Runtime::kResolvePossiblyDirectEval, 4); |
| 4203 | 4204 |
| 4204 // If we generated fast-case code bind the jump-target where fast | 4205 // If we generated fast-case code bind the jump-target where fast |
| 4205 // and slow case merge. | 4206 // and slow case merge. |
| 4206 if (done.is_linked()) done.Bind(); | 4207 if (done.is_linked()) done.Bind(); |
| 4207 | 4208 |
| 4208 // Touch up stack with the right values for the function and the receiver. | 4209 // Touch up stack with the right values for the function and the receiver. |
| 4209 __ str(r0, MemOperand(sp, (arg_count + 1) * kPointerSize)); | 4210 __ str(r0, MemOperand(sp, (arg_count + 1) * kPointerSize)); |
| 4210 __ str(r1, MemOperand(sp, arg_count * kPointerSize)); | 4211 __ str(r1, MemOperand(sp, arg_count * kPointerSize)); |
| 4211 | 4212 |
| 4212 // Call the function. | 4213 // Call the function. |
| (...skipping 482 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 4695 // Compare exponent with -0.5. | 4696 // Compare exponent with -0.5. |
| 4696 __ cmp(scratch1, Operand(0xbfe00000)); | 4697 __ cmp(scratch1, Operand(0xbfe00000)); |
| 4697 __ b(ne, ¬_minus_half); | 4698 __ b(ne, ¬_minus_half); |
| 4698 | 4699 |
| 4699 // Get the double value from the base into vfp register d0. | 4700 // Get the double value from the base into vfp register d0. |
| 4700 __ ObjectToDoubleVFPRegister(base, d0, | 4701 __ ObjectToDoubleVFPRegister(base, d0, |
| 4701 scratch1, scratch2, heap_number_map, s0, | 4702 scratch1, scratch2, heap_number_map, s0, |
| 4702 runtime.entry_label(), | 4703 runtime.entry_label(), |
| 4703 AVOID_NANS_AND_INFINITIES); | 4704 AVOID_NANS_AND_INFINITIES); |
| 4704 | 4705 |
| 4706 // Convert -0 into +0 by adding +0. |
| 4707 __ vmov(d2, 0.0); |
| 4708 __ vadd(d0, d2, d0); |
| 4705 // Load 1.0 into d2. | 4709 // Load 1.0 into d2. |
| 4706 __ vmov(d2, 1.0); | 4710 __ vmov(d2, 1.0); |
| 4707 | 4711 |
| 4708 // Calculate the reciprocal of the square root. 1/sqrt(x) = sqrt(1/x). | 4712 // Calculate the reciprocal of the square root. |
| 4713 __ vsqrt(d0, d0); |
| 4709 __ vdiv(d0, d2, d0); | 4714 __ vdiv(d0, d2, d0); |
| 4710 __ vsqrt(d0, d0); | |
| 4711 | 4715 |
| 4712 __ b(&allocate_return); | 4716 __ b(&allocate_return); |
| 4713 | 4717 |
| 4714 __ bind(¬_minus_half); | 4718 __ bind(¬_minus_half); |
| 4715 // Compare exponent with 0.5. | 4719 // Compare exponent with 0.5. |
| 4716 __ cmp(scratch1, Operand(0x3fe00000)); | 4720 __ cmp(scratch1, Operand(0x3fe00000)); |
| 4717 runtime.Branch(ne); | 4721 runtime.Branch(ne); |
| 4718 | 4722 |
| 4719 // Get the double value from the base into vfp register d0. | 4723 // Get the double value from the base into vfp register d0. |
| 4720 __ ObjectToDoubleVFPRegister(base, d0, | 4724 __ ObjectToDoubleVFPRegister(base, d0, |
| 4721 scratch1, scratch2, heap_number_map, s0, | 4725 scratch1, scratch2, heap_number_map, s0, |
| 4722 runtime.entry_label(), | 4726 runtime.entry_label(), |
| 4723 AVOID_NANS_AND_INFINITIES); | 4727 AVOID_NANS_AND_INFINITIES); |
| 4728 // Convert -0 into +0 by adding +0. |
| 4729 __ vmov(d2, 0.0); |
| 4730 __ vadd(d0, d2, d0); |
| 4724 __ vsqrt(d0, d0); | 4731 __ vsqrt(d0, d0); |
| 4725 | 4732 |
| 4726 __ bind(&allocate_return); | 4733 __ bind(&allocate_return); |
| 4727 Register scratch3 = r5; | 4734 Register scratch3 = r5; |
| 4728 __ AllocateHeapNumberWithValue(scratch3, d0, scratch1, scratch2, | 4735 __ AllocateHeapNumberWithValue(scratch3, d0, scratch1, scratch2, |
| 4729 heap_number_map, runtime.entry_label()); | 4736 heap_number_map, runtime.entry_label()); |
| 4730 __ mov(base, scratch3); | 4737 __ mov(base, scratch3); |
| 4731 done.Jump(); | 4738 done.Jump(); |
| 4732 | 4739 |
| 4733 runtime.Bind(); | 4740 runtime.Bind(); |
| (...skipping 2639 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 7373 specialized_on_rhs_ ? "_ConstantRhs" : "", | 7380 specialized_on_rhs_ ? "_ConstantRhs" : "", |
| 7374 BinaryOpIC::GetName(runtime_operands_type_)); | 7381 BinaryOpIC::GetName(runtime_operands_type_)); |
| 7375 return name_; | 7382 return name_; |
| 7376 } | 7383 } |
| 7377 | 7384 |
| 7378 #undef __ | 7385 #undef __ |
| 7379 | 7386 |
| 7380 } } // namespace v8::internal | 7387 } } // namespace v8::internal |
| 7381 | 7388 |
| 7382 #endif // V8_TARGET_ARCH_ARM | 7389 #endif // V8_TARGET_ARCH_ARM |
| OLD | NEW |