| 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 587 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 598 ASSERT(mode != NO_ARGUMENTS_ALLOCATION); | 598 ASSERT(mode != NO_ARGUMENTS_ALLOCATION); |
| 599 | 599 |
| 600 Comment cmnt(masm_, "[ store arguments object"); | 600 Comment cmnt(masm_, "[ store arguments object"); |
| 601 if (mode == LAZY_ARGUMENTS_ALLOCATION && initial) { | 601 if (mode == LAZY_ARGUMENTS_ALLOCATION && initial) { |
| 602 // When using lazy arguments allocation, we store the hole value | 602 // When using lazy arguments allocation, we store the hole value |
| 603 // as a sentinel indicating that the arguments object hasn't been | 603 // as a sentinel indicating that the arguments object hasn't been |
| 604 // allocated yet. | 604 // allocated yet. |
| 605 frame_->EmitPushRoot(Heap::kArgumentsMarkerRootIndex); | 605 frame_->EmitPushRoot(Heap::kArgumentsMarkerRootIndex); |
| 606 } else { | 606 } else { |
| 607 frame_->SpillAll(); | 607 frame_->SpillAll(); |
| 608 ArgumentsAccessStub stub(ArgumentsAccessStub::NEW_OBJECT); | 608 ArgumentsAccessStub stub(is_strict_mode() |
| 609 ? ArgumentsAccessStub::NEW_STRICT |
| 610 : ArgumentsAccessStub::NEW_NON_STRICT); |
| 609 __ ldr(r2, frame_->Function()); | 611 __ ldr(r2, frame_->Function()); |
| 610 // The receiver is below the arguments, the return address, and the | 612 // The receiver is below the arguments, the return address, and the |
| 611 // frame pointer on the stack. | 613 // frame pointer on the stack. |
| 612 const int kReceiverDisplacement = 2 + scope()->num_parameters(); | 614 const int kReceiverDisplacement = 2 + scope()->num_parameters(); |
| 613 __ add(r1, fp, Operand(kReceiverDisplacement * kPointerSize)); | 615 __ add(r1, fp, Operand(kReceiverDisplacement * kPointerSize)); |
| 614 __ mov(r0, Operand(Smi::FromInt(scope()->num_parameters()))); | 616 __ mov(r0, Operand(Smi::FromInt(scope()->num_parameters()))); |
| 615 frame_->Adjust(3); | 617 frame_->Adjust(3); |
| 616 __ Push(r2, r1, r0); | 618 __ Push(r2, r1, r0); |
| 617 frame_->CallStub(&stub, 3); | 619 frame_->CallStub(&stub, 3); |
| 618 frame_->EmitPush(r0); | 620 frame_->EmitPush(r0); |
| (...skipping 537 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 1156 case Token::SHL: | 1158 case Token::SHL: |
| 1157 ASSERT(!reversed_); | 1159 ASSERT(!reversed_); |
| 1158 if (shift_value != 0) { | 1160 if (shift_value != 0) { |
| 1159 __ mov(int32, Operand(int32, LSL, shift_value)); | 1161 __ mov(int32, Operand(int32, LSL, shift_value)); |
| 1160 } | 1162 } |
| 1161 break; | 1163 break; |
| 1162 default: UNREACHABLE(); | 1164 default: UNREACHABLE(); |
| 1163 } | 1165 } |
| 1164 // Check that the *signed* result fits in a smi. Not necessary for AND, SAR | 1166 // Check that the *signed* result fits in a smi. Not necessary for AND, SAR |
| 1165 // if the shift if more than 0 or SHR if the shit is more than 1. | 1167 // if the shift if more than 0 or SHR if the shit is more than 1. |
| 1166 if (!( (op_ == Token::AND) || | 1168 if (!( (op_ == Token::AND && value_ >= 0) || |
| 1167 ((op_ == Token::SAR) && (shift_value > 0)) || | 1169 ((op_ == Token::SAR) && (shift_value > 0)) || |
| 1168 ((op_ == Token::SHR) && (shift_value > 1)))) { | 1170 ((op_ == Token::SHR) && (shift_value > 1)))) { |
| 1169 __ add(r3, int32, Operand(0x40000000), SetCC); | 1171 __ add(r3, int32, Operand(0x40000000), SetCC); |
| 1170 __ b(mi, &result_not_a_smi); | 1172 __ b(mi, &result_not_a_smi); |
| 1171 } | 1173 } |
| 1172 __ mov(tos_register_, Operand(int32, LSL, kSmiTagSize)); | 1174 __ mov(tos_register_, Operand(int32, LSL, kSmiTagSize)); |
| 1173 Exit(); | 1175 Exit(); |
| 1174 | 1176 |
| 1175 if (result_not_a_smi.is_linked()) { | 1177 if (result_not_a_smi.is_linked()) { |
| 1176 __ bind(&result_not_a_smi); | 1178 __ bind(&result_not_a_smi); |
| (...skipping 240 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 1417 new DeferredInlineSmiOperation(op, int_value, reversed, mode, tos); | 1419 new DeferredInlineSmiOperation(op, int_value, reversed, mode, tos); |
| 1418 __ tst(tos, Operand(kSmiTagMask)); | 1420 __ tst(tos, Operand(kSmiTagMask)); |
| 1419 deferred->JumpToNonSmiInput(ne); | 1421 deferred->JumpToNonSmiInput(ne); |
| 1420 switch (op) { | 1422 switch (op) { |
| 1421 case Token::BIT_OR: __ orr(tos, tos, Operand(value)); break; | 1423 case Token::BIT_OR: __ orr(tos, tos, Operand(value)); break; |
| 1422 case Token::BIT_XOR: __ eor(tos, tos, Operand(value)); break; | 1424 case Token::BIT_XOR: __ eor(tos, tos, Operand(value)); break; |
| 1423 case Token::BIT_AND: __ And(tos, tos, Operand(value)); break; | 1425 case Token::BIT_AND: __ And(tos, tos, Operand(value)); break; |
| 1424 default: UNREACHABLE(); | 1426 default: UNREACHABLE(); |
| 1425 } | 1427 } |
| 1426 deferred->BindExit(); | 1428 deferred->BindExit(); |
| 1427 TypeInfo result_type = | 1429 TypeInfo result_type = TypeInfo::Integer32(); |
| 1428 (op == Token::BIT_AND) ? TypeInfo::Smi() : TypeInfo::Integer32(); | 1430 if (op == Token::BIT_AND && int_value >= 0) { |
| 1431 result_type = TypeInfo::Smi(); |
| 1432 } |
| 1429 frame_->EmitPush(tos, result_type); | 1433 frame_->EmitPush(tos, result_type); |
| 1430 } | 1434 } |
| 1431 break; | 1435 break; |
| 1432 } | 1436 } |
| 1433 | 1437 |
| 1434 case Token::SHL: | 1438 case Token::SHL: |
| 1435 if (reversed) { | 1439 if (reversed) { |
| 1436 ASSERT(both_sides_are_smi); | 1440 ASSERT(both_sides_are_smi); |
| 1437 int max_shift = 0; | 1441 int max_shift = 0; |
| 1438 int max_result = int_value == 0 ? 1 : int_value; | 1442 int max_result = int_value == 0 ? 1 : int_value; |
| (...skipping 1670 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 3109 // Ignore the return value. | 3113 // Ignore the return value. |
| 3110 ASSERT(frame_->height() == original_height); | 3114 ASSERT(frame_->height() == original_height); |
| 3111 } | 3115 } |
| 3112 | 3116 |
| 3113 | 3117 |
| 3114 void CodeGenerator::InstantiateFunction( | 3118 void CodeGenerator::InstantiateFunction( |
| 3115 Handle<SharedFunctionInfo> function_info, | 3119 Handle<SharedFunctionInfo> function_info, |
| 3116 bool pretenure) { | 3120 bool pretenure) { |
| 3117 // Use the fast case closure allocation code that allocates in new | 3121 // Use the fast case closure allocation code that allocates in new |
| 3118 // space for nested functions that don't need literals cloning. | 3122 // space for nested functions that don't need literals cloning. |
| 3119 if (scope()->is_function_scope() && | 3123 if (!pretenure && |
| 3120 function_info->num_literals() == 0 && | 3124 scope()->is_function_scope() && |
| 3121 !pretenure) { | 3125 function_info->num_literals() == 0) { |
| 3122 FastNewClosureStub stub; | 3126 FastNewClosureStub stub( |
| 3127 function_info->strict_mode() ? kStrictMode : kNonStrictMode); |
| 3123 frame_->EmitPush(Operand(function_info)); | 3128 frame_->EmitPush(Operand(function_info)); |
| 3124 frame_->SpillAll(); | 3129 frame_->SpillAll(); |
| 3125 frame_->CallStub(&stub, 1); | 3130 frame_->CallStub(&stub, 1); |
| 3126 frame_->EmitPush(r0); | 3131 frame_->EmitPush(r0); |
| 3127 } else { | 3132 } else { |
| 3128 // Create a new closure. | 3133 // Create a new closure. |
| 3129 frame_->EmitPush(cp); | 3134 frame_->EmitPush(cp); |
| 3130 frame_->EmitPush(Operand(function_info)); | 3135 frame_->EmitPush(Operand(function_info)); |
| 3131 frame_->EmitPush(Operand(pretenure | 3136 frame_->EmitPush(Operand(pretenure |
| 3132 ? Factory::true_value() | 3137 ? Factory::true_value() |
| (...skipping 4286 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 7419 BinaryOpIC::GetName(runtime_operands_type_)); | 7424 BinaryOpIC::GetName(runtime_operands_type_)); |
| 7420 return name_; | 7425 return name_; |
| 7421 } | 7426 } |
| 7422 | 7427 |
| 7423 | 7428 |
| 7424 #undef __ | 7429 #undef __ |
| 7425 | 7430 |
| 7426 } } // namespace v8::internal | 7431 } } // namespace v8::internal |
| 7427 | 7432 |
| 7428 #endif // V8_TARGET_ARCH_ARM | 7433 #endif // V8_TARGET_ARCH_ARM |
| OLD | NEW |