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 63 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
74 } | 74 } |
75 | 75 |
76 | 76 |
77 void NumberToStringStub::InitializeInterfaceDescriptor( | 77 void NumberToStringStub::InitializeInterfaceDescriptor( |
78 Isolate* isolate, | 78 Isolate* isolate, |
79 CodeStubInterfaceDescriptor* descriptor) { | 79 CodeStubInterfaceDescriptor* descriptor) { |
80 static Register registers[] = { eax }; | 80 static Register registers[] = { eax }; |
81 descriptor->register_param_count_ = 1; | 81 descriptor->register_param_count_ = 1; |
82 descriptor->register_params_ = registers; | 82 descriptor->register_params_ = registers; |
83 descriptor->deoptimization_handler_ = | 83 descriptor->deoptimization_handler_ = |
84 Runtime::FunctionForId(Runtime::kNumberToString)->entry; | 84 Runtime::FunctionForId(Runtime::kNumberToStringInternal)->entry; |
85 } | 85 } |
86 | 86 |
87 | 87 |
88 void FastCloneShallowArrayStub::InitializeInterfaceDescriptor( | 88 void FastCloneShallowArrayStub::InitializeInterfaceDescriptor( |
89 Isolate* isolate, | 89 Isolate* isolate, |
90 CodeStubInterfaceDescriptor* descriptor) { | 90 CodeStubInterfaceDescriptor* descriptor) { |
91 static Register registers[] = { eax, ebx, ecx }; | 91 static Register registers[] = { eax, ebx, ecx }; |
92 descriptor->register_param_count_ = 3; | 92 descriptor->register_param_count_ = 3; |
93 descriptor->register_params_ = registers; | 93 descriptor->register_params_ = registers; |
94 descriptor->deoptimization_handler_ = | 94 descriptor->deoptimization_handler_ = |
(...skipping 44 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
139 } | 139 } |
140 | 140 |
141 | 141 |
142 void RegExpConstructResultStub::InitializeInterfaceDescriptor( | 142 void RegExpConstructResultStub::InitializeInterfaceDescriptor( |
143 Isolate* isolate, | 143 Isolate* isolate, |
144 CodeStubInterfaceDescriptor* descriptor) { | 144 CodeStubInterfaceDescriptor* descriptor) { |
145 static Register registers[] = { ecx, ebx, eax }; | 145 static Register registers[] = { ecx, ebx, eax }; |
146 descriptor->register_param_count_ = 3; | 146 descriptor->register_param_count_ = 3; |
147 descriptor->register_params_ = registers; | 147 descriptor->register_params_ = registers; |
148 descriptor->deoptimization_handler_ = | 148 descriptor->deoptimization_handler_ = |
149 Runtime::FunctionForId(Runtime::kRegExpConstructResult)->entry; | 149 Runtime::FunctionForId(Runtime::kRegExpConstructResultInternal)->entry; |
150 } | 150 } |
151 | 151 |
152 | 152 |
153 void LoadFieldStub::InitializeInterfaceDescriptor( | 153 void LoadFieldStub::InitializeInterfaceDescriptor( |
154 Isolate* isolate, | 154 Isolate* isolate, |
155 CodeStubInterfaceDescriptor* descriptor) { | 155 CodeStubInterfaceDescriptor* descriptor) { |
156 static Register registers[] = { edx }; | 156 static Register registers[] = { edx }; |
157 descriptor->register_param_count_ = 1; | 157 descriptor->register_param_count_ = 1; |
158 descriptor->register_params_ = registers; | 158 descriptor->register_params_ = registers; |
159 descriptor->deoptimization_handler_ = NULL; | 159 descriptor->deoptimization_handler_ = NULL; |
(...skipping 221 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
381 } | 381 } |
382 | 382 |
383 | 383 |
384 void StringAddStub::InitializeInterfaceDescriptor( | 384 void StringAddStub::InitializeInterfaceDescriptor( |
385 Isolate* isolate, | 385 Isolate* isolate, |
386 CodeStubInterfaceDescriptor* descriptor) { | 386 CodeStubInterfaceDescriptor* descriptor) { |
387 static Register registers[] = { edx, eax }; | 387 static Register registers[] = { edx, eax }; |
388 descriptor->register_param_count_ = 2; | 388 descriptor->register_param_count_ = 2; |
389 descriptor->register_params_ = registers; | 389 descriptor->register_params_ = registers; |
390 descriptor->deoptimization_handler_ = | 390 descriptor->deoptimization_handler_ = |
391 Runtime::FunctionForId(Runtime::kStringAdd)->entry; | 391 Runtime::FunctionForId(Runtime::kStringAddInternal)->entry; |
392 } | 392 } |
393 | 393 |
394 | 394 |
395 void CallDescriptors::InitializeForIsolate(Isolate* isolate) { | 395 void CallDescriptors::InitializeForIsolate(Isolate* isolate) { |
396 { | 396 { |
397 CallInterfaceDescriptor* descriptor = | 397 CallInterfaceDescriptor* descriptor = |
398 isolate->call_descriptor(Isolate::ArgumentAdaptorCall); | 398 isolate->call_descriptor(Isolate::ArgumentAdaptorCall); |
399 static Register registers[] = { edi, // JSFunction | 399 static Register registers[] = { edi, // JSFunction |
400 esi, // context | 400 esi, // context |
401 eax, // actual number of arguments | 401 eax, // actual number of arguments |
(...skipping 1454 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
1856 edi); | 1856 edi); |
1857 __ jmp(&next_capture); | 1857 __ jmp(&next_capture); |
1858 __ bind(&done); | 1858 __ bind(&done); |
1859 | 1859 |
1860 // Return last match info. | 1860 // Return last match info. |
1861 __ mov(eax, Operand(esp, kLastMatchInfoOffset)); | 1861 __ mov(eax, Operand(esp, kLastMatchInfoOffset)); |
1862 __ ret(4 * kPointerSize); | 1862 __ ret(4 * kPointerSize); |
1863 | 1863 |
1864 // Do the runtime call to execute the regexp. | 1864 // Do the runtime call to execute the regexp. |
1865 __ bind(&runtime); | 1865 __ bind(&runtime); |
1866 __ TailCallRuntime(Runtime::kRegExpExec, 4, 1); | 1866 __ TailCallRuntime(Runtime::kRegExpExecInternal, 4, 1); |
1867 | 1867 |
1868 // Deferred code for string handling. | 1868 // Deferred code for string handling. |
1869 // (7) Not a long external string? If yes, go to (10). | 1869 // (7) Not a long external string? If yes, go to (10). |
1870 __ bind(¬_seq_nor_cons); | 1870 __ bind(¬_seq_nor_cons); |
1871 // Compare flags are still set from (3). | 1871 // Compare flags are still set from (3). |
1872 __ j(greater, ¬_long_external, Label::kNear); // Go to (10). | 1872 __ j(greater, ¬_long_external, Label::kNear); // Go to (10). |
1873 | 1873 |
1874 // (8) External string. Short external strings have been ruled out. | 1874 // (8) External string. Short external strings have been ruled out. |
1875 __ bind(&external_string); | 1875 __ bind(&external_string); |
1876 // Reload instance type. | 1876 // Reload instance type. |
(...skipping 1312 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
3189 __ jmp(&got_smi_index_); | 3189 __ jmp(&got_smi_index_); |
3190 | 3190 |
3191 // Call runtime. We get here when the receiver is a string and the | 3191 // Call runtime. We get here when the receiver is a string and the |
3192 // index is a number, but the code of getting the actual character | 3192 // index is a number, but the code of getting the actual character |
3193 // is too complex (e.g., when the string needs to be flattened). | 3193 // is too complex (e.g., when the string needs to be flattened). |
3194 __ bind(&call_runtime_); | 3194 __ bind(&call_runtime_); |
3195 call_helper.BeforeCall(masm); | 3195 call_helper.BeforeCall(masm); |
3196 __ push(object_); | 3196 __ push(object_); |
3197 __ SmiTag(index_); | 3197 __ SmiTag(index_); |
3198 __ push(index_); | 3198 __ push(index_); |
3199 __ CallRuntime(Runtime::kStringCharCodeAt, 2); | 3199 __ CallRuntime(Runtime::kStringCharCodeAtInternal, 2); |
3200 if (!result_.is(eax)) { | 3200 if (!result_.is(eax)) { |
3201 __ mov(result_, eax); | 3201 __ mov(result_, eax); |
3202 } | 3202 } |
3203 call_helper.AfterCall(masm); | 3203 call_helper.AfterCall(masm); |
3204 __ jmp(&exit_); | 3204 __ jmp(&exit_); |
3205 | 3205 |
3206 __ Abort(kUnexpectedFallthroughFromCharCodeAtSlowCase); | 3206 __ Abort(kUnexpectedFallthroughFromCharCodeAtSlowCase); |
3207 } | 3207 } |
3208 | 3208 |
3209 | 3209 |
(...skipping 375 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
3585 __ mov(esi, edx); // Restore esi. | 3585 __ mov(esi, edx); // Restore esi. |
3586 __ IncrementCounter(counters->sub_string_native(), 1); | 3586 __ IncrementCounter(counters->sub_string_native(), 1); |
3587 __ ret(3 * kPointerSize); | 3587 __ ret(3 * kPointerSize); |
3588 | 3588 |
3589 // Drop pushed values on the stack before tail call. | 3589 // Drop pushed values on the stack before tail call. |
3590 __ bind(&runtime_drop_two); | 3590 __ bind(&runtime_drop_two); |
3591 __ Drop(2); | 3591 __ Drop(2); |
3592 | 3592 |
3593 // Just jump to runtime to create the sub string. | 3593 // Just jump to runtime to create the sub string. |
3594 __ bind(&runtime); | 3594 __ bind(&runtime); |
3595 __ TailCallRuntime(Runtime::kSubString, 3, 1); | 3595 __ TailCallRuntime(Runtime::kSubStringInternal, 3, 1); |
3596 | 3596 |
3597 __ bind(&single_char); | 3597 __ bind(&single_char); |
3598 // eax: string | 3598 // eax: string |
3599 // ebx: instance type | 3599 // ebx: instance type |
3600 // ecx: sub string length (smi) | 3600 // ecx: sub string length (smi) |
3601 // edx: from index (smi) | 3601 // edx: from index (smi) |
3602 StringCharAtGenerator generator( | 3602 StringCharAtGenerator generator( |
3603 eax, edx, ecx, eax, &runtime, &runtime, &runtime, STRING_INDEX_IS_NUMBER); | 3603 eax, edx, ecx, eax, &runtime, &runtime, &runtime, STRING_INDEX_IS_NUMBER); |
3604 generator.GenerateFast(masm); | 3604 generator.GenerateFast(masm); |
3605 __ ret(3 * kPointerSize); | 3605 __ ret(3 * kPointerSize); |
(...skipping 161 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
3767 // Compare flat ASCII strings. | 3767 // Compare flat ASCII strings. |
3768 // Drop arguments from the stack. | 3768 // Drop arguments from the stack. |
3769 __ pop(ecx); | 3769 __ pop(ecx); |
3770 __ add(esp, Immediate(2 * kPointerSize)); | 3770 __ add(esp, Immediate(2 * kPointerSize)); |
3771 __ push(ecx); | 3771 __ push(ecx); |
3772 GenerateCompareFlatAsciiStrings(masm, edx, eax, ecx, ebx, edi); | 3772 GenerateCompareFlatAsciiStrings(masm, edx, eax, ecx, ebx, edi); |
3773 | 3773 |
3774 // Call the runtime; it returns -1 (less), 0 (equal), or 1 (greater) | 3774 // Call the runtime; it returns -1 (less), 0 (equal), or 1 (greater) |
3775 // tagged as a small integer. | 3775 // tagged as a small integer. |
3776 __ bind(&runtime); | 3776 __ bind(&runtime); |
3777 __ TailCallRuntime(Runtime::kStringCompare, 2, 1); | 3777 __ TailCallRuntime(Runtime::kStringCompareInternal, 2, 1); |
3778 } | 3778 } |
3779 | 3779 |
3780 | 3780 |
3781 void ArrayPushStub::Generate(MacroAssembler* masm) { | 3781 void ArrayPushStub::Generate(MacroAssembler* masm) { |
3782 int argc = arguments_count(); | 3782 int argc = arguments_count(); |
3783 | 3783 |
3784 if (argc == 0) { | 3784 if (argc == 0) { |
3785 // Noop, return the length. | 3785 // Noop, return the length. |
3786 __ mov(eax, FieldOperand(edx, JSArray::kLengthOffset)); | 3786 __ mov(eax, FieldOperand(edx, JSArray::kLengthOffset)); |
3787 __ ret((argc + 1) * kPointerSize); | 3787 __ ret((argc + 1) * kPointerSize); |
(...skipping 502 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
4290 | 4290 |
4291 // Handle more complex cases in runtime. | 4291 // Handle more complex cases in runtime. |
4292 __ bind(&runtime); | 4292 __ bind(&runtime); |
4293 __ pop(tmp1); // Return address. | 4293 __ pop(tmp1); // Return address. |
4294 __ push(left); | 4294 __ push(left); |
4295 __ push(right); | 4295 __ push(right); |
4296 __ push(tmp1); | 4296 __ push(tmp1); |
4297 if (equality) { | 4297 if (equality) { |
4298 __ TailCallRuntime(Runtime::kStringEquals, 2, 1); | 4298 __ TailCallRuntime(Runtime::kStringEquals, 2, 1); |
4299 } else { | 4299 } else { |
4300 __ TailCallRuntime(Runtime::kStringCompare, 2, 1); | 4300 __ TailCallRuntime(Runtime::kStringCompareInternal, 2, 1); |
4301 } | 4301 } |
4302 | 4302 |
4303 __ bind(&miss); | 4303 __ bind(&miss); |
4304 GenerateMiss(masm); | 4304 GenerateMiss(masm); |
4305 } | 4305 } |
4306 | 4306 |
4307 | 4307 |
4308 void ICCompareStub::GenerateObjects(MacroAssembler* masm) { | 4308 void ICCompareStub::GenerateObjects(MacroAssembler* masm) { |
4309 ASSERT(state_ == CompareIC::OBJECT); | 4309 ASSERT(state_ == CompareIC::OBJECT); |
4310 Label miss; | 4310 Label miss; |
(...skipping 1085 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
5396 Operand(ebp, 7 * kPointerSize), | 5396 Operand(ebp, 7 * kPointerSize), |
5397 NULL); | 5397 NULL); |
5398 } | 5398 } |
5399 | 5399 |
5400 | 5400 |
5401 #undef __ | 5401 #undef __ |
5402 | 5402 |
5403 } } // namespace v8::internal | 5403 } } // namespace v8::internal |
5404 | 5404 |
5405 #endif // V8_TARGET_ARCH_IA32 | 5405 #endif // V8_TARGET_ARCH_IA32 |
OLD | NEW |