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

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

Issue 209353006: Refactor optimized in hydrogen only runtime functions. (Closed) Base URL: https://v8.googlecode.com/svn/branches/bleeding_edge
Patch Set: Patch for landing + rebase Created 6 years, 9 months 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
« no previous file with comments | « src/hydrogen.cc ('k') | src/ia32/full-codegen-ia32.cc » ('j') | no next file with comments »
Toggle Intra-line Diffs ('i') | Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
OLDNEW
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
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::kHiddenNumberToString)->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
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::kHiddenRegExpConstructResult)->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
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::kHiddenStringAdd)->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
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::kHiddenRegExpExec, 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(&not_seq_nor_cons); 1870 __ bind(&not_seq_nor_cons);
1871 // Compare flags are still set from (3). 1871 // Compare flags are still set from (3).
1872 __ j(greater, &not_long_external, Label::kNear); // Go to (10). 1872 __ j(greater, &not_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 1271 matching lines...) Expand 10 before | Expand all | Expand 10 after
3148 __ jmp(&got_smi_index_); 3148 __ jmp(&got_smi_index_);
3149 3149
3150 // Call runtime. We get here when the receiver is a string and the 3150 // Call runtime. We get here when the receiver is a string and the
3151 // index is a number, but the code of getting the actual character 3151 // index is a number, but the code of getting the actual character
3152 // is too complex (e.g., when the string needs to be flattened). 3152 // is too complex (e.g., when the string needs to be flattened).
3153 __ bind(&call_runtime_); 3153 __ bind(&call_runtime_);
3154 call_helper.BeforeCall(masm); 3154 call_helper.BeforeCall(masm);
3155 __ push(object_); 3155 __ push(object_);
3156 __ SmiTag(index_); 3156 __ SmiTag(index_);
3157 __ push(index_); 3157 __ push(index_);
3158 __ CallRuntime(Runtime::kStringCharCodeAt, 2); 3158 __ CallRuntime(Runtime::kHiddenStringCharCodeAt, 2);
3159 if (!result_.is(eax)) { 3159 if (!result_.is(eax)) {
3160 __ mov(result_, eax); 3160 __ mov(result_, eax);
3161 } 3161 }
3162 call_helper.AfterCall(masm); 3162 call_helper.AfterCall(masm);
3163 __ jmp(&exit_); 3163 __ jmp(&exit_);
3164 3164
3165 __ Abort(kUnexpectedFallthroughFromCharCodeAtSlowCase); 3165 __ Abort(kUnexpectedFallthroughFromCharCodeAtSlowCase);
3166 } 3166 }
3167 3167
3168 3168
(...skipping 375 matching lines...) Expand 10 before | Expand all | Expand 10 after
3544 __ mov(esi, edx); // Restore esi. 3544 __ mov(esi, edx); // Restore esi.
3545 __ IncrementCounter(counters->sub_string_native(), 1); 3545 __ IncrementCounter(counters->sub_string_native(), 1);
3546 __ ret(3 * kPointerSize); 3546 __ ret(3 * kPointerSize);
3547 3547
3548 // Drop pushed values on the stack before tail call. 3548 // Drop pushed values on the stack before tail call.
3549 __ bind(&runtime_drop_two); 3549 __ bind(&runtime_drop_two);
3550 __ Drop(2); 3550 __ Drop(2);
3551 3551
3552 // Just jump to runtime to create the sub string. 3552 // Just jump to runtime to create the sub string.
3553 __ bind(&runtime); 3553 __ bind(&runtime);
3554 __ TailCallRuntime(Runtime::kSubString, 3, 1); 3554 __ TailCallRuntime(Runtime::kHiddenSubString, 3, 1);
3555 3555
3556 __ bind(&single_char); 3556 __ bind(&single_char);
3557 // eax: string 3557 // eax: string
3558 // ebx: instance type 3558 // ebx: instance type
3559 // ecx: sub string length (smi) 3559 // ecx: sub string length (smi)
3560 // edx: from index (smi) 3560 // edx: from index (smi)
3561 StringCharAtGenerator generator( 3561 StringCharAtGenerator generator(
3562 eax, edx, ecx, eax, &runtime, &runtime, &runtime, STRING_INDEX_IS_NUMBER); 3562 eax, edx, ecx, eax, &runtime, &runtime, &runtime, STRING_INDEX_IS_NUMBER);
3563 generator.GenerateFast(masm); 3563 generator.GenerateFast(masm);
3564 __ ret(3 * kPointerSize); 3564 __ ret(3 * kPointerSize);
(...skipping 161 matching lines...) Expand 10 before | Expand all | Expand 10 after
3726 // Compare flat ASCII strings. 3726 // Compare flat ASCII strings.
3727 // Drop arguments from the stack. 3727 // Drop arguments from the stack.
3728 __ pop(ecx); 3728 __ pop(ecx);
3729 __ add(esp, Immediate(2 * kPointerSize)); 3729 __ add(esp, Immediate(2 * kPointerSize));
3730 __ push(ecx); 3730 __ push(ecx);
3731 GenerateCompareFlatAsciiStrings(masm, edx, eax, ecx, ebx, edi); 3731 GenerateCompareFlatAsciiStrings(masm, edx, eax, ecx, ebx, edi);
3732 3732
3733 // Call the runtime; it returns -1 (less), 0 (equal), or 1 (greater) 3733 // Call the runtime; it returns -1 (less), 0 (equal), or 1 (greater)
3734 // tagged as a small integer. 3734 // tagged as a small integer.
3735 __ bind(&runtime); 3735 __ bind(&runtime);
3736 __ TailCallRuntime(Runtime::kStringCompare, 2, 1); 3736 __ TailCallRuntime(Runtime::kHiddenStringCompare, 2, 1);
3737 } 3737 }
3738 3738
3739 3739
3740 void ArrayPushStub::Generate(MacroAssembler* masm) { 3740 void ArrayPushStub::Generate(MacroAssembler* masm) {
3741 int argc = arguments_count(); 3741 int argc = arguments_count();
3742 3742
3743 if (argc == 0) { 3743 if (argc == 0) {
3744 // Noop, return the length. 3744 // Noop, return the length.
3745 __ mov(eax, FieldOperand(edx, JSArray::kLengthOffset)); 3745 __ mov(eax, FieldOperand(edx, JSArray::kLengthOffset));
3746 __ ret((argc + 1) * kPointerSize); 3746 __ ret((argc + 1) * kPointerSize);
(...skipping 502 matching lines...) Expand 10 before | Expand all | Expand 10 after
4249 4249
4250 // Handle more complex cases in runtime. 4250 // Handle more complex cases in runtime.
4251 __ bind(&runtime); 4251 __ bind(&runtime);
4252 __ pop(tmp1); // Return address. 4252 __ pop(tmp1); // Return address.
4253 __ push(left); 4253 __ push(left);
4254 __ push(right); 4254 __ push(right);
4255 __ push(tmp1); 4255 __ push(tmp1);
4256 if (equality) { 4256 if (equality) {
4257 __ TailCallRuntime(Runtime::kStringEquals, 2, 1); 4257 __ TailCallRuntime(Runtime::kStringEquals, 2, 1);
4258 } else { 4258 } else {
4259 __ TailCallRuntime(Runtime::kStringCompare, 2, 1); 4259 __ TailCallRuntime(Runtime::kHiddenStringCompare, 2, 1);
4260 } 4260 }
4261 4261
4262 __ bind(&miss); 4262 __ bind(&miss);
4263 GenerateMiss(masm); 4263 GenerateMiss(masm);
4264 } 4264 }
4265 4265
4266 4266
4267 void ICCompareStub::GenerateObjects(MacroAssembler* masm) { 4267 void ICCompareStub::GenerateObjects(MacroAssembler* masm) {
4268 ASSERT(state_ == CompareIC::OBJECT); 4268 ASSERT(state_ == CompareIC::OBJECT);
4269 Label miss; 4269 Label miss;
(...skipping 1085 matching lines...) Expand 10 before | Expand all | Expand 10 after
5355 Operand(ebp, 7 * kPointerSize), 5355 Operand(ebp, 7 * kPointerSize),
5356 NULL); 5356 NULL);
5357 } 5357 }
5358 5358
5359 5359
5360 #undef __ 5360 #undef __
5361 5361
5362 } } // namespace v8::internal 5362 } } // namespace v8::internal
5363 5363
5364 #endif // V8_TARGET_ARCH_IA32 5364 #endif // V8_TARGET_ARCH_IA32
OLDNEW
« no previous file with comments | « src/hydrogen.cc ('k') | src/ia32/full-codegen-ia32.cc » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698