Chromium Code Reviews
chromiumcodereview-hr@appspot.gserviceaccount.com (chromiumcodereview-hr) | Please choose your nickname with Settings | Help | Chromium Project | Gerrit Changes | Sign out
(11)

Side by Side Diff: src/arm/code-stubs-arm.cc

Issue 8391045: Handlify the remaining CallStubCompiler functions. (Closed) Base URL: https://v8.googlecode.com/svn/branches/bleeding_edge
Patch Set: Created 9 years, 1 month ago
Use n/p to move between diff chunks; N/P to move between comments. Draft comments are only viewable by you.
Jump to:
View unified diff | Download patch | Annotate | Revision Log
OLDNEW
1 // Copyright 2011 the V8 project authors. All rights reserved. 1 // Copyright 2011 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 5125 matching lines...) Expand 10 before | Expand all | Expand 10 after
5136 __ add(scratch_, object_, Operand(scratch_, LSR, kSmiTagSize)); 5136 __ add(scratch_, object_, Operand(scratch_, LSR, kSmiTagSize));
5137 __ ldrb(result_, FieldMemOperand(scratch_, SeqAsciiString::kHeaderSize)); 5137 __ ldrb(result_, FieldMemOperand(scratch_, SeqAsciiString::kHeaderSize));
5138 5138
5139 __ bind(&got_char_code); 5139 __ bind(&got_char_code);
5140 __ mov(result_, Operand(result_, LSL, kSmiTagSize)); 5140 __ mov(result_, Operand(result_, LSL, kSmiTagSize));
5141 __ bind(&exit_); 5141 __ bind(&exit_);
5142 } 5142 }
5143 5143
5144 5144
5145 void StringCharCodeAtGenerator::GenerateSlow( 5145 void StringCharCodeAtGenerator::GenerateSlow(
5146 MacroAssembler* masm, const RuntimeCallHelper& call_helper) { 5146 MacroAssembler* masm,
5147 const RuntimeCallHelper& call_helper) {
5147 __ Abort("Unexpected fallthrough to CharCodeAt slow case"); 5148 __ Abort("Unexpected fallthrough to CharCodeAt slow case");
5148 5149
5149 // Index is not a smi. 5150 // Index is not a smi.
5150 __ bind(&index_not_smi_); 5151 __ bind(&index_not_smi_);
5151 // If index is a heap number, try converting it to an integer. 5152 // If index is a heap number, try converting it to an integer.
5152 __ CheckMap(index_, 5153 __ CheckMap(index_,
5153 scratch_, 5154 scratch_,
5154 Heap::kHeapNumberMapRootIndex, 5155 Heap::kHeapNumberMapRootIndex,
5155 index_not_number_, 5156 index_not_number_,
5156 DONT_DO_SMI_CHECK); 5157 DONT_DO_SMI_CHECK);
(...skipping 55 matching lines...) Expand 10 before | Expand all | Expand 10 after
5212 __ add(result_, result_, Operand(code_, LSL, kPointerSizeLog2 - kSmiTagSize)); 5213 __ add(result_, result_, Operand(code_, LSL, kPointerSizeLog2 - kSmiTagSize));
5213 __ ldr(result_, FieldMemOperand(result_, FixedArray::kHeaderSize)); 5214 __ ldr(result_, FieldMemOperand(result_, FixedArray::kHeaderSize));
5214 __ LoadRoot(ip, Heap::kUndefinedValueRootIndex); 5215 __ LoadRoot(ip, Heap::kUndefinedValueRootIndex);
5215 __ cmp(result_, Operand(ip)); 5216 __ cmp(result_, Operand(ip));
5216 __ b(eq, &slow_case_); 5217 __ b(eq, &slow_case_);
5217 __ bind(&exit_); 5218 __ bind(&exit_);
5218 } 5219 }
5219 5220
5220 5221
5221 void StringCharFromCodeGenerator::GenerateSlow( 5222 void StringCharFromCodeGenerator::GenerateSlow(
5222 MacroAssembler* masm, const RuntimeCallHelper& call_helper) { 5223 MacroAssembler* masm,
5224 const RuntimeCallHelper& call_helper) {
5223 __ Abort("Unexpected fallthrough to CharFromCode slow case"); 5225 __ Abort("Unexpected fallthrough to CharFromCode slow case");
5224 5226
5225 __ bind(&slow_case_); 5227 __ bind(&slow_case_);
5226 call_helper.BeforeCall(masm); 5228 call_helper.BeforeCall(masm);
5227 __ push(code_); 5229 __ push(code_);
5228 __ CallRuntime(Runtime::kCharFromCode, 1); 5230 __ CallRuntime(Runtime::kCharFromCode, 1);
5229 __ Move(result_, r0); 5231 __ Move(result_, r0);
5230 call_helper.AfterCall(masm); 5232 call_helper.AfterCall(masm);
5231 __ jmp(&exit_); 5233 __ jmp(&exit_);
5232 5234
5233 __ Abort("Unexpected fallthrough from CharFromCode slow case"); 5235 __ Abort("Unexpected fallthrough from CharFromCode slow case");
5234 } 5236 }
5235 5237
5236 5238
5237 // ------------------------------------------------------------------------- 5239 // -------------------------------------------------------------------------
5238 // StringCharAtGenerator 5240 // StringCharAtGenerator
5239 5241
5240 void StringCharAtGenerator::GenerateFast(MacroAssembler* masm) { 5242 void StringCharAtGenerator::GenerateFast(MacroAssembler* masm) {
5241 char_code_at_generator_.GenerateFast(masm); 5243 char_code_at_generator_.GenerateFast(masm);
5242 char_from_code_generator_.GenerateFast(masm); 5244 char_from_code_generator_.GenerateFast(masm);
5243 } 5245 }
5244 5246
5245 5247
5246 void StringCharAtGenerator::GenerateSlow( 5248 void StringCharAtGenerator::GenerateSlow(
5247 MacroAssembler* masm, const RuntimeCallHelper& call_helper) { 5249 MacroAssembler* masm,
5250 const RuntimeCallHelper& call_helper) {
5248 char_code_at_generator_.GenerateSlow(masm, call_helper); 5251 char_code_at_generator_.GenerateSlow(masm, call_helper);
5249 char_from_code_generator_.GenerateSlow(masm, call_helper); 5252 char_from_code_generator_.GenerateSlow(masm, call_helper);
5250 } 5253 }
5251 5254
5252 5255
5253 class StringHelper : public AllStatic { 5256 class StringHelper : public AllStatic {
5254 public: 5257 public:
5255 // Generate code for copying characters using a simple loop. This should only 5258 // Generate code for copying characters using a simple loop. This should only
5256 // be used in places where the number of characters is small and the 5259 // be used in places where the number of characters is small and the
5257 // additional setup and checking in GenerateCopyCharactersLong adds too much 5260 // additional setup and checking in GenerateCopyCharactersLong adds too much
(...skipping 1485 matching lines...) Expand 10 before | Expand all | Expand 10 after
6743 StringDictionaryLookupStub stub(NEGATIVE_LOOKUP); 6746 StringDictionaryLookupStub stub(NEGATIVE_LOOKUP);
6744 __ CallStub(&stub); 6747 __ CallStub(&stub);
6745 __ tst(r0, Operand(r0)); 6748 __ tst(r0, Operand(r0));
6746 __ ldm(ia_w, sp, spill_mask); 6749 __ ldm(ia_w, sp, spill_mask);
6747 6750
6748 __ b(eq, done); 6751 __ b(eq, done);
6749 __ b(ne, miss); 6752 __ b(ne, miss);
6750 } 6753 }
6751 6754
6752 6755
6753 // TODO(kmillikin): Eliminate this function when the stub cache is fully
6754 // handlified.
6755 MaybeObject* StringDictionaryLookupStub::TryGenerateNegativeLookup(
6756 MacroAssembler* masm,
6757 Label* miss,
6758 Label* done,
6759 Register receiver,
6760 Register properties,
6761 String* name,
6762 Register scratch0) {
6763 // If names of slots in range from 1 to kProbes - 1 for the hash value are
6764 // not equal to the name and kProbes-th slot is not used (its name is the
6765 // undefined value), it guarantees the hash table doesn't contain the
6766 // property. It's true even if some slots represent deleted properties
6767 // (their names are the null value).
6768 for (int i = 0; i < kInlinedProbes; i++) {
6769 // scratch0 points to properties hash.
6770 // Compute the masked index: (hash + i + i * i) & mask.
6771 Register index = scratch0;
6772 // Capacity is smi 2^n.
6773 __ ldr(index, FieldMemOperand(properties, kCapacityOffset));
6774 __ sub(index, index, Operand(1));
6775 __ and_(index, index, Operand(
6776 Smi::FromInt(name->Hash() + StringDictionary::GetProbeOffset(i))));
6777
6778 // Scale the index by multiplying by the entry size.
6779 ASSERT(StringDictionary::kEntrySize == 3);
6780 __ add(index, index, Operand(index, LSL, 1)); // index *= 3.
6781
6782 Register entity_name = scratch0;
6783 // Having undefined at this place means the name is not contained.
6784 ASSERT_EQ(kSmiTagSize, 1);
6785 Register tmp = properties;
6786 __ add(tmp, properties, Operand(index, LSL, 1));
6787 __ ldr(entity_name, FieldMemOperand(tmp, kElementsStartOffset));
6788
6789 ASSERT(!tmp.is(entity_name));
6790 __ LoadRoot(tmp, Heap::kUndefinedValueRootIndex);
6791 __ cmp(entity_name, tmp);
6792 __ b(eq, done);
6793
6794 if (i != kInlinedProbes - 1) {
6795 // Stop if found the property.
6796 __ cmp(entity_name, Operand(Handle<String>(name)));
6797 __ b(eq, miss);
6798
6799 // Check if the entry name is not a symbol.
6800 __ ldr(entity_name, FieldMemOperand(entity_name, HeapObject::kMapOffset));
6801 __ ldrb(entity_name,
6802 FieldMemOperand(entity_name, Map::kInstanceTypeOffset));
6803 __ tst(entity_name, Operand(kIsSymbolMask));
6804 __ b(eq, miss);
6805
6806 // Restore the properties.
6807 __ ldr(properties,
6808 FieldMemOperand(receiver, JSObject::kPropertiesOffset));
6809 }
6810 }
6811
6812 const int spill_mask =
6813 (lr.bit() | r6.bit() | r5.bit() | r4.bit() | r3.bit() |
6814 r2.bit() | r1.bit() | r0.bit());
6815
6816 __ stm(db_w, sp, spill_mask);
6817 __ ldr(r0, FieldMemOperand(receiver, JSObject::kPropertiesOffset));
6818 __ mov(r1, Operand(Handle<String>(name)));
6819 StringDictionaryLookupStub stub(NEGATIVE_LOOKUP);
6820 MaybeObject* result = masm->TryCallStub(&stub);
6821 if (result->IsFailure()) return result;
6822 __ tst(r0, Operand(r0));
6823 __ ldm(ia_w, sp, spill_mask);
6824
6825 __ b(eq, done);
6826 __ b(ne, miss);
6827 return result;
6828 }
6829
6830
6831 // Probe the string dictionary in the |elements| register. Jump to the 6756 // Probe the string dictionary in the |elements| register. Jump to the
6832 // |done| label if a property with the given name is found. Jump to 6757 // |done| label if a property with the given name is found. Jump to
6833 // the |miss| label otherwise. 6758 // the |miss| label otherwise.
6834 // If lookup was successful |scratch2| will be equal to elements + 4 * index. 6759 // If lookup was successful |scratch2| will be equal to elements + 4 * index.
6835 void StringDictionaryLookupStub::GeneratePositiveLookup(MacroAssembler* masm, 6760 void StringDictionaryLookupStub::GeneratePositiveLookup(MacroAssembler* masm,
6836 Label* miss, 6761 Label* miss,
6837 Label* done, 6762 Label* done,
6838 Register elements, 6763 Register elements,
6839 Register name, 6764 Register name,
6840 Register scratch1, 6765 Register scratch1,
(...skipping 411 matching lines...) Expand 10 before | Expand all | Expand 10 after
7252 __ bind(&need_incremental); 7177 __ bind(&need_incremental);
7253 7178
7254 // Fall through when we need to inform the incremental marker. 7179 // Fall through when we need to inform the incremental marker.
7255 } 7180 }
7256 7181
7257 #undef __ 7182 #undef __
7258 7183
7259 } } // namespace v8::internal 7184 } } // namespace v8::internal
7260 7185
7261 #endif // V8_TARGET_ARCH_ARM 7186 #endif // V8_TARGET_ARCH_ARM
OLDNEW

Powered by Google App Engine
This is Rietveld 408576698