| 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 333 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 344 Isolate* isolate, | 344 Isolate* isolate, |
| 345 CodeStubInterfaceDescriptor* descriptor) { | 345 CodeStubInterfaceDescriptor* descriptor) { |
| 346 static Register registers[] = { a2, a1, a0 }; | 346 static Register registers[] = { a2, a1, a0 }; |
| 347 descriptor->register_param_count_ = 3; | 347 descriptor->register_param_count_ = 3; |
| 348 descriptor->register_params_ = registers; | 348 descriptor->register_params_ = registers; |
| 349 descriptor->deoptimization_handler_ = | 349 descriptor->deoptimization_handler_ = |
| 350 FUNCTION_ADDR(BinaryOpIC_MissWithAllocationSite); | 350 FUNCTION_ADDR(BinaryOpIC_MissWithAllocationSite); |
| 351 } | 351 } |
| 352 | 352 |
| 353 | 353 |
| 354 void NewStringAddStub::InitializeInterfaceDescriptor( | 354 void StringAddStub::InitializeInterfaceDescriptor( |
| 355 Isolate* isolate, | 355 Isolate* isolate, |
| 356 CodeStubInterfaceDescriptor* descriptor) { | 356 CodeStubInterfaceDescriptor* descriptor) { |
| 357 static Register registers[] = { a1, a0 }; | 357 static Register registers[] = { a1, a0 }; |
| 358 descriptor->register_param_count_ = 2; | 358 descriptor->register_param_count_ = 2; |
| 359 descriptor->register_params_ = registers; | 359 descriptor->register_params_ = registers; |
| 360 descriptor->deoptimization_handler_ = | 360 descriptor->deoptimization_handler_ = |
| 361 Runtime::FunctionForId(Runtime::kStringAdd)->entry; | 361 Runtime::FunctionForId(Runtime::kStringAdd)->entry; |
| 362 } | 362 } |
| 363 | 363 |
| 364 | 364 |
| (...skipping 4189 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 4554 __ Assert(eq, kExpectedAllocationSite, t0, Operand(at)); | 4554 __ Assert(eq, kExpectedAllocationSite, t0, Operand(at)); |
| 4555 } | 4555 } |
| 4556 | 4556 |
| 4557 // Tail call into the stub that handles binary operations with allocation | 4557 // Tail call into the stub that handles binary operations with allocation |
| 4558 // sites. | 4558 // sites. |
| 4559 BinaryOpWithAllocationSiteStub stub(state_); | 4559 BinaryOpWithAllocationSiteStub stub(state_); |
| 4560 __ TailCallStub(&stub); | 4560 __ TailCallStub(&stub); |
| 4561 } | 4561 } |
| 4562 | 4562 |
| 4563 | 4563 |
| 4564 void StringAddStub::Generate(MacroAssembler* masm) { | |
| 4565 Label call_runtime, call_builtin; | |
| 4566 Builtins::JavaScript builtin_id = Builtins::ADD; | |
| 4567 | |
| 4568 Counters* counters = masm->isolate()->counters(); | |
| 4569 | |
| 4570 // Stack on entry: | |
| 4571 // sp[0]: second argument (right). | |
| 4572 // sp[4]: first argument (left). | |
| 4573 | |
| 4574 // Load the two arguments. | |
| 4575 __ lw(a0, MemOperand(sp, 1 * kPointerSize)); // First argument. | |
| 4576 __ lw(a1, MemOperand(sp, 0 * kPointerSize)); // Second argument. | |
| 4577 | |
| 4578 // Make sure that both arguments are strings if not known in advance. | |
| 4579 // Otherwise, at least one of the arguments is definitely a string, | |
| 4580 // and we convert the one that is not known to be a string. | |
| 4581 if ((flags_ & STRING_ADD_CHECK_BOTH) == STRING_ADD_CHECK_BOTH) { | |
| 4582 ASSERT((flags_ & STRING_ADD_CHECK_LEFT) == STRING_ADD_CHECK_LEFT); | |
| 4583 ASSERT((flags_ & STRING_ADD_CHECK_RIGHT) == STRING_ADD_CHECK_RIGHT); | |
| 4584 __ JumpIfEitherSmi(a0, a1, &call_runtime); | |
| 4585 // Load instance types. | |
| 4586 __ lw(t0, FieldMemOperand(a0, HeapObject::kMapOffset)); | |
| 4587 __ lw(t1, FieldMemOperand(a1, HeapObject::kMapOffset)); | |
| 4588 __ lbu(t0, FieldMemOperand(t0, Map::kInstanceTypeOffset)); | |
| 4589 __ lbu(t1, FieldMemOperand(t1, Map::kInstanceTypeOffset)); | |
| 4590 STATIC_ASSERT(kStringTag == 0); | |
| 4591 // If either is not a string, go to runtime. | |
| 4592 __ Or(t4, t0, Operand(t1)); | |
| 4593 __ And(t4, t4, Operand(kIsNotStringMask)); | |
| 4594 __ Branch(&call_runtime, ne, t4, Operand(zero_reg)); | |
| 4595 } else if ((flags_ & STRING_ADD_CHECK_LEFT) == STRING_ADD_CHECK_LEFT) { | |
| 4596 ASSERT((flags_ & STRING_ADD_CHECK_RIGHT) == 0); | |
| 4597 GenerateConvertArgument( | |
| 4598 masm, 1 * kPointerSize, a0, a2, a3, t0, t1, &call_builtin); | |
| 4599 builtin_id = Builtins::STRING_ADD_RIGHT; | |
| 4600 } else if ((flags_ & STRING_ADD_CHECK_RIGHT) == STRING_ADD_CHECK_RIGHT) { | |
| 4601 ASSERT((flags_ & STRING_ADD_CHECK_LEFT) == 0); | |
| 4602 GenerateConvertArgument( | |
| 4603 masm, 0 * kPointerSize, a1, a2, a3, t0, t1, &call_builtin); | |
| 4604 builtin_id = Builtins::STRING_ADD_LEFT; | |
| 4605 } | |
| 4606 | |
| 4607 // Both arguments are strings. | |
| 4608 // a0: first string | |
| 4609 // a1: second string | |
| 4610 // t0: first string instance type (if flags_ == NO_STRING_ADD_FLAGS) | |
| 4611 // t1: second string instance type (if flags_ == NO_STRING_ADD_FLAGS) | |
| 4612 { | |
| 4613 Label strings_not_empty; | |
| 4614 // Check if either of the strings are empty. In that case return the other. | |
| 4615 // These tests use zero-length check on string-length whch is an Smi. | |
| 4616 // Assert that Smi::FromInt(0) is really 0. | |
| 4617 STATIC_ASSERT(kSmiTag == 0); | |
| 4618 ASSERT(Smi::FromInt(0) == 0); | |
| 4619 __ lw(a2, FieldMemOperand(a0, String::kLengthOffset)); | |
| 4620 __ lw(a3, FieldMemOperand(a1, String::kLengthOffset)); | |
| 4621 __ mov(v0, a0); // Assume we'll return first string (from a0). | |
| 4622 __ Movz(v0, a1, a2); // If first is empty, return second (from a1). | |
| 4623 __ slt(t4, zero_reg, a2); // if (a2 > 0) t4 = 1. | |
| 4624 __ slt(t5, zero_reg, a3); // if (a3 > 0) t5 = 1. | |
| 4625 __ and_(t4, t4, t5); // Branch if both strings were non-empty. | |
| 4626 __ Branch(&strings_not_empty, ne, t4, Operand(zero_reg)); | |
| 4627 | |
| 4628 __ IncrementCounter(counters->string_add_native(), 1, a2, a3); | |
| 4629 __ DropAndRet(2); | |
| 4630 | |
| 4631 __ bind(&strings_not_empty); | |
| 4632 } | |
| 4633 | |
| 4634 // Untag both string-lengths. | |
| 4635 __ sra(a2, a2, kSmiTagSize); | |
| 4636 __ sra(a3, a3, kSmiTagSize); | |
| 4637 | |
| 4638 // Both strings are non-empty. | |
| 4639 // a0: first string | |
| 4640 // a1: second string | |
| 4641 // a2: length of first string | |
| 4642 // a3: length of second string | |
| 4643 // t0: first string instance type (if flags_ == NO_STRING_ADD_FLAGS) | |
| 4644 // t1: second string instance type (if flags_ == NO_STRING_ADD_FLAGS) | |
| 4645 // Look at the length of the result of adding the two strings. | |
| 4646 Label string_add_flat_result, longer_than_two; | |
| 4647 // Adding two lengths can't overflow. | |
| 4648 STATIC_ASSERT(String::kMaxLength < String::kMaxLength * 2); | |
| 4649 __ Addu(t2, a2, Operand(a3)); | |
| 4650 // Use the string table when adding two one character strings, as it | |
| 4651 // helps later optimizations to return a string here. | |
| 4652 __ Branch(&longer_than_two, ne, t2, Operand(2)); | |
| 4653 | |
| 4654 // Check that both strings are non-external ASCII strings. | |
| 4655 if ((flags_ & STRING_ADD_CHECK_BOTH) != STRING_ADD_CHECK_BOTH) { | |
| 4656 __ lw(t0, FieldMemOperand(a0, HeapObject::kMapOffset)); | |
| 4657 __ lw(t1, FieldMemOperand(a1, HeapObject::kMapOffset)); | |
| 4658 __ lbu(t0, FieldMemOperand(t0, Map::kInstanceTypeOffset)); | |
| 4659 __ lbu(t1, FieldMemOperand(t1, Map::kInstanceTypeOffset)); | |
| 4660 } | |
| 4661 __ JumpIfBothInstanceTypesAreNotSequentialAscii(t0, t1, t2, t3, | |
| 4662 &call_runtime); | |
| 4663 | |
| 4664 // Get the two characters forming the sub string. | |
| 4665 __ lbu(a2, FieldMemOperand(a0, SeqOneByteString::kHeaderSize)); | |
| 4666 __ lbu(a3, FieldMemOperand(a1, SeqOneByteString::kHeaderSize)); | |
| 4667 | |
| 4668 // Try to lookup two character string in string table. If it is not found | |
| 4669 // just allocate a new one. | |
| 4670 Label make_two_character_string; | |
| 4671 StringHelper::GenerateTwoCharacterStringTableProbe( | |
| 4672 masm, a2, a3, t2, t3, t0, t1, t5, &make_two_character_string); | |
| 4673 __ IncrementCounter(counters->string_add_native(), 1, a2, a3); | |
| 4674 __ DropAndRet(2); | |
| 4675 | |
| 4676 __ bind(&make_two_character_string); | |
| 4677 // Resulting string has length 2 and first chars of two strings | |
| 4678 // are combined into single halfword in a2 register. | |
| 4679 // So we can fill resulting string without two loops by a single | |
| 4680 // halfword store instruction (which assumes that processor is | |
| 4681 // in a little endian mode). | |
| 4682 __ li(t2, Operand(2)); | |
| 4683 __ AllocateAsciiString(v0, t2, t0, t1, t5, &call_runtime); | |
| 4684 __ sh(a2, FieldMemOperand(v0, SeqOneByteString::kHeaderSize)); | |
| 4685 __ IncrementCounter(counters->string_add_native(), 1, a2, a3); | |
| 4686 __ DropAndRet(2); | |
| 4687 | |
| 4688 __ bind(&longer_than_two); | |
| 4689 // Check if resulting string will be flat. | |
| 4690 __ Branch(&string_add_flat_result, lt, t2, Operand(ConsString::kMinLength)); | |
| 4691 // Handle exceptionally long strings in the runtime system. | |
| 4692 STATIC_ASSERT((String::kMaxLength & 0x80000000) == 0); | |
| 4693 ASSERT(IsPowerOf2(String::kMaxLength + 1)); | |
| 4694 // kMaxLength + 1 is representable as shifted literal, kMaxLength is not. | |
| 4695 __ Branch(&call_runtime, hs, t2, Operand(String::kMaxLength + 1)); | |
| 4696 | |
| 4697 // If result is not supposed to be flat, allocate a cons string object. | |
| 4698 // If both strings are ASCII the result is an ASCII cons string. | |
| 4699 if ((flags_ & STRING_ADD_CHECK_BOTH) != STRING_ADD_CHECK_BOTH) { | |
| 4700 __ lw(t0, FieldMemOperand(a0, HeapObject::kMapOffset)); | |
| 4701 __ lw(t1, FieldMemOperand(a1, HeapObject::kMapOffset)); | |
| 4702 __ lbu(t0, FieldMemOperand(t0, Map::kInstanceTypeOffset)); | |
| 4703 __ lbu(t1, FieldMemOperand(t1, Map::kInstanceTypeOffset)); | |
| 4704 } | |
| 4705 Label non_ascii, allocated, ascii_data; | |
| 4706 STATIC_ASSERT(kTwoByteStringTag == 0); | |
| 4707 // Branch to non_ascii if either string-encoding field is zero (non-ASCII). | |
| 4708 __ And(t4, t0, Operand(t1)); | |
| 4709 __ And(t4, t4, Operand(kStringEncodingMask)); | |
| 4710 __ Branch(&non_ascii, eq, t4, Operand(zero_reg)); | |
| 4711 | |
| 4712 // Allocate an ASCII cons string. | |
| 4713 __ bind(&ascii_data); | |
| 4714 __ AllocateAsciiConsString(v0, t2, t0, t1, &call_runtime); | |
| 4715 __ bind(&allocated); | |
| 4716 // Fill the fields of the cons string. | |
| 4717 Label skip_write_barrier, after_writing; | |
| 4718 ExternalReference high_promotion_mode = ExternalReference:: | |
| 4719 new_space_high_promotion_mode_active_address(masm->isolate()); | |
| 4720 __ li(t0, Operand(high_promotion_mode)); | |
| 4721 __ lw(t0, MemOperand(t0, 0)); | |
| 4722 __ Branch(&skip_write_barrier, eq, t0, Operand(zero_reg)); | |
| 4723 | |
| 4724 __ mov(t3, v0); | |
| 4725 __ sw(a0, FieldMemOperand(t3, ConsString::kFirstOffset)); | |
| 4726 __ RecordWriteField(t3, | |
| 4727 ConsString::kFirstOffset, | |
| 4728 a0, | |
| 4729 t0, | |
| 4730 kRAHasNotBeenSaved, | |
| 4731 kDontSaveFPRegs); | |
| 4732 __ sw(a1, FieldMemOperand(t3, ConsString::kSecondOffset)); | |
| 4733 __ RecordWriteField(t3, | |
| 4734 ConsString::kSecondOffset, | |
| 4735 a1, | |
| 4736 t0, | |
| 4737 kRAHasNotBeenSaved, | |
| 4738 kDontSaveFPRegs); | |
| 4739 __ jmp(&after_writing); | |
| 4740 | |
| 4741 __ bind(&skip_write_barrier); | |
| 4742 __ sw(a0, FieldMemOperand(v0, ConsString::kFirstOffset)); | |
| 4743 __ sw(a1, FieldMemOperand(v0, ConsString::kSecondOffset)); | |
| 4744 | |
| 4745 __ bind(&after_writing); | |
| 4746 | |
| 4747 __ IncrementCounter(counters->string_add_native(), 1, a2, a3); | |
| 4748 __ DropAndRet(2); | |
| 4749 | |
| 4750 __ bind(&non_ascii); | |
| 4751 // At least one of the strings is two-byte. Check whether it happens | |
| 4752 // to contain only one byte characters. | |
| 4753 // t0: first instance type. | |
| 4754 // t1: second instance type. | |
| 4755 // Branch to if _both_ instances have kOneByteDataHintMask set. | |
| 4756 __ And(at, t0, Operand(kOneByteDataHintMask)); | |
| 4757 __ and_(at, at, t1); | |
| 4758 __ Branch(&ascii_data, ne, at, Operand(zero_reg)); | |
| 4759 __ Xor(t0, t0, Operand(t1)); | |
| 4760 STATIC_ASSERT(kOneByteStringTag != 0 && kOneByteDataHintTag != 0); | |
| 4761 __ And(t0, t0, Operand(kOneByteStringTag | kOneByteDataHintTag)); | |
| 4762 __ Branch(&ascii_data, eq, t0, | |
| 4763 Operand(kOneByteStringTag | kOneByteDataHintTag)); | |
| 4764 | |
| 4765 // Allocate a two byte cons string. | |
| 4766 __ AllocateTwoByteConsString(v0, t2, t0, t1, &call_runtime); | |
| 4767 __ Branch(&allocated); | |
| 4768 | |
| 4769 // We cannot encounter sliced strings or cons strings here since: | |
| 4770 STATIC_ASSERT(SlicedString::kMinLength >= ConsString::kMinLength); | |
| 4771 // Handle creating a flat result from either external or sequential strings. | |
| 4772 // Locate the first characters' locations. | |
| 4773 // a0: first string | |
| 4774 // a1: second string | |
| 4775 // a2: length of first string | |
| 4776 // a3: length of second string | |
| 4777 // t0: first string instance type (if flags_ == NO_STRING_ADD_FLAGS) | |
| 4778 // t1: second string instance type (if flags_ == NO_STRING_ADD_FLAGS) | |
| 4779 // t2: sum of lengths. | |
| 4780 Label first_prepared, second_prepared; | |
| 4781 __ bind(&string_add_flat_result); | |
| 4782 if ((flags_ & STRING_ADD_CHECK_BOTH) != STRING_ADD_CHECK_BOTH) { | |
| 4783 __ lw(t0, FieldMemOperand(a0, HeapObject::kMapOffset)); | |
| 4784 __ lw(t1, FieldMemOperand(a1, HeapObject::kMapOffset)); | |
| 4785 __ lbu(t0, FieldMemOperand(t0, Map::kInstanceTypeOffset)); | |
| 4786 __ lbu(t1, FieldMemOperand(t1, Map::kInstanceTypeOffset)); | |
| 4787 } | |
| 4788 // Check whether both strings have same encoding | |
| 4789 __ Xor(t3, t0, Operand(t1)); | |
| 4790 __ And(t3, t3, Operand(kStringEncodingMask)); | |
| 4791 __ Branch(&call_runtime, ne, t3, Operand(zero_reg)); | |
| 4792 | |
| 4793 STATIC_ASSERT(kSeqStringTag == 0); | |
| 4794 __ And(t4, t0, Operand(kStringRepresentationMask)); | |
| 4795 | |
| 4796 STATIC_ASSERT(SeqOneByteString::kHeaderSize == SeqTwoByteString::kHeaderSize); | |
| 4797 Label skip_first_add; | |
| 4798 __ Branch(&skip_first_add, ne, t4, Operand(zero_reg)); | |
| 4799 __ Branch(USE_DELAY_SLOT, &first_prepared); | |
| 4800 __ addiu(t3, a0, SeqOneByteString::kHeaderSize - kHeapObjectTag); | |
| 4801 __ bind(&skip_first_add); | |
| 4802 // External string: rule out short external string and load string resource. | |
| 4803 STATIC_ASSERT(kShortExternalStringTag != 0); | |
| 4804 __ And(t4, t0, Operand(kShortExternalStringMask)); | |
| 4805 __ Branch(&call_runtime, ne, t4, Operand(zero_reg)); | |
| 4806 __ lw(t3, FieldMemOperand(a0, ExternalString::kResourceDataOffset)); | |
| 4807 __ bind(&first_prepared); | |
| 4808 | |
| 4809 STATIC_ASSERT(kSeqStringTag == 0); | |
| 4810 __ And(t4, t1, Operand(kStringRepresentationMask)); | |
| 4811 STATIC_ASSERT(SeqOneByteString::kHeaderSize == SeqTwoByteString::kHeaderSize); | |
| 4812 Label skip_second_add; | |
| 4813 __ Branch(&skip_second_add, ne, t4, Operand(zero_reg)); | |
| 4814 __ Branch(USE_DELAY_SLOT, &second_prepared); | |
| 4815 __ addiu(a1, a1, SeqOneByteString::kHeaderSize - kHeapObjectTag); | |
| 4816 __ bind(&skip_second_add); | |
| 4817 // External string: rule out short external string and load string resource. | |
| 4818 STATIC_ASSERT(kShortExternalStringTag != 0); | |
| 4819 __ And(t4, t1, Operand(kShortExternalStringMask)); | |
| 4820 __ Branch(&call_runtime, ne, t4, Operand(zero_reg)); | |
| 4821 __ lw(a1, FieldMemOperand(a1, ExternalString::kResourceDataOffset)); | |
| 4822 __ bind(&second_prepared); | |
| 4823 | |
| 4824 Label non_ascii_string_add_flat_result; | |
| 4825 // t3: first character of first string | |
| 4826 // a1: first character of second string | |
| 4827 // a2: length of first string | |
| 4828 // a3: length of second string | |
| 4829 // t2: sum of lengths. | |
| 4830 // Both strings have the same encoding. | |
| 4831 STATIC_ASSERT(kTwoByteStringTag == 0); | |
| 4832 __ And(t4, t1, Operand(kStringEncodingMask)); | |
| 4833 __ Branch(&non_ascii_string_add_flat_result, eq, t4, Operand(zero_reg)); | |
| 4834 | |
| 4835 __ AllocateAsciiString(v0, t2, t0, t1, t5, &call_runtime); | |
| 4836 __ Addu(t2, v0, Operand(SeqOneByteString::kHeaderSize - kHeapObjectTag)); | |
| 4837 // v0: result string. | |
| 4838 // t3: first character of first string. | |
| 4839 // a1: first character of second string | |
| 4840 // a2: length of first string. | |
| 4841 // a3: length of second string. | |
| 4842 // t2: first character of result. | |
| 4843 | |
| 4844 StringHelper::GenerateCopyCharacters(masm, t2, t3, a2, t0, true); | |
| 4845 // t2: next character of result. | |
| 4846 StringHelper::GenerateCopyCharacters(masm, t2, a1, a3, t0, true); | |
| 4847 __ IncrementCounter(counters->string_add_native(), 1, a2, a3); | |
| 4848 __ DropAndRet(2); | |
| 4849 | |
| 4850 __ bind(&non_ascii_string_add_flat_result); | |
| 4851 __ AllocateTwoByteString(v0, t2, t0, t1, t5, &call_runtime); | |
| 4852 __ Addu(t2, v0, Operand(SeqTwoByteString::kHeaderSize - kHeapObjectTag)); | |
| 4853 // v0: result string. | |
| 4854 // t3: first character of first string. | |
| 4855 // a1: first character of second string. | |
| 4856 // a2: length of first string. | |
| 4857 // a3: length of second string. | |
| 4858 // t2: first character of result. | |
| 4859 StringHelper::GenerateCopyCharacters(masm, t2, t3, a2, t0, false); | |
| 4860 // t2: next character of result. | |
| 4861 StringHelper::GenerateCopyCharacters(masm, t2, a1, a3, t0, false); | |
| 4862 | |
| 4863 __ IncrementCounter(counters->string_add_native(), 1, a2, a3); | |
| 4864 __ DropAndRet(2); | |
| 4865 | |
| 4866 // Just jump to runtime to add the two strings. | |
| 4867 __ bind(&call_runtime); | |
| 4868 __ TailCallRuntime(Runtime::kStringAdd, 2, 1); | |
| 4869 | |
| 4870 if (call_builtin.is_linked()) { | |
| 4871 __ bind(&call_builtin); | |
| 4872 __ InvokeBuiltin(builtin_id, JUMP_FUNCTION); | |
| 4873 } | |
| 4874 } | |
| 4875 | |
| 4876 | |
| 4877 void StringAddStub::GenerateRegisterArgsPush(MacroAssembler* masm) { | |
| 4878 __ push(a0); | |
| 4879 __ push(a1); | |
| 4880 } | |
| 4881 | |
| 4882 | |
| 4883 void StringAddStub::GenerateRegisterArgsPop(MacroAssembler* masm) { | |
| 4884 __ pop(a1); | |
| 4885 __ pop(a0); | |
| 4886 } | |
| 4887 | |
| 4888 | |
| 4889 void StringAddStub::GenerateConvertArgument(MacroAssembler* masm, | |
| 4890 int stack_offset, | |
| 4891 Register arg, | |
| 4892 Register scratch1, | |
| 4893 Register scratch2, | |
| 4894 Register scratch3, | |
| 4895 Register scratch4, | |
| 4896 Label* slow) { | |
| 4897 // First check if the argument is already a string. | |
| 4898 Label not_string, done; | |
| 4899 __ JumpIfSmi(arg, ¬_string); | |
| 4900 __ GetObjectType(arg, scratch1, scratch1); | |
| 4901 __ Branch(&done, lt, scratch1, Operand(FIRST_NONSTRING_TYPE)); | |
| 4902 | |
| 4903 // Check the number to string cache. | |
| 4904 __ bind(¬_string); | |
| 4905 // Puts the cached result into scratch1. | |
| 4906 __ LookupNumberStringCache(arg, scratch1, scratch2, scratch3, scratch4, slow); | |
| 4907 __ mov(arg, scratch1); | |
| 4908 __ sw(arg, MemOperand(sp, stack_offset)); | |
| 4909 __ bind(&done); | |
| 4910 } | |
| 4911 | |
| 4912 | |
| 4913 void ICCompareStub::GenerateSmis(MacroAssembler* masm) { | 4564 void ICCompareStub::GenerateSmis(MacroAssembler* masm) { |
| 4914 ASSERT(state_ == CompareIC::SMI); | 4565 ASSERT(state_ == CompareIC::SMI); |
| 4915 Label miss; | 4566 Label miss; |
| 4916 __ Or(a2, a1, a0); | 4567 __ Or(a2, a1, a0); |
| 4917 __ JumpIfNotSmi(a2, &miss); | 4568 __ JumpIfNotSmi(a2, &miss); |
| 4918 | 4569 |
| 4919 if (GetCondition() == eq) { | 4570 if (GetCondition() == eq) { |
| 4920 // For equality we do not care about the sign of the result. | 4571 // For equality we do not care about the sign of the result. |
| 4921 __ Ret(USE_DELAY_SLOT); | 4572 __ Ret(USE_DELAY_SLOT); |
| 4922 __ Subu(v0, a0, a1); | 4573 __ Subu(v0, a0, a1); |
| (...skipping 1295 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 6218 __ bind(&fast_elements_case); | 5869 __ bind(&fast_elements_case); |
| 6219 GenerateCase(masm, FAST_ELEMENTS); | 5870 GenerateCase(masm, FAST_ELEMENTS); |
| 6220 } | 5871 } |
| 6221 | 5872 |
| 6222 | 5873 |
| 6223 #undef __ | 5874 #undef __ |
| 6224 | 5875 |
| 6225 } } // namespace v8::internal | 5876 } } // namespace v8::internal |
| 6226 | 5877 |
| 6227 #endif // V8_TARGET_ARCH_MIPS | 5878 #endif // V8_TARGET_ARCH_MIPS |
| OLD | NEW |