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

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

Issue 209353006: Refactor optimized in hydrogen only runtime functions. (Closed) Base URL: https://v8.googlecode.com/svn/branches/bleeding_edge
Patch Set: Patch 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
OLDNEW
1 // Copyright 2013 the V8 project authors. All rights reserved. 1 // Copyright 2013 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 59 matching lines...) Expand 10 before | Expand all | Expand 10 after
70 } 70 }
71 71
72 72
73 void NumberToStringStub::InitializeInterfaceDescriptor( 73 void NumberToStringStub::InitializeInterfaceDescriptor(
74 Isolate* isolate, 74 Isolate* isolate,
75 CodeStubInterfaceDescriptor* descriptor) { 75 CodeStubInterfaceDescriptor* descriptor) {
76 static Register registers[] = { rax }; 76 static Register registers[] = { rax };
77 descriptor->register_param_count_ = 1; 77 descriptor->register_param_count_ = 1;
78 descriptor->register_params_ = registers; 78 descriptor->register_params_ = registers;
79 descriptor->deoptimization_handler_ = 79 descriptor->deoptimization_handler_ =
80 Runtime::FunctionForId(Runtime::kNumberToString)->entry; 80 Runtime::FunctionForId(Runtime::kNumberToStringInternal)->entry;
81 } 81 }
82 82
83 83
84 void FastCloneShallowArrayStub::InitializeInterfaceDescriptor( 84 void FastCloneShallowArrayStub::InitializeInterfaceDescriptor(
85 Isolate* isolate, 85 Isolate* isolate,
86 CodeStubInterfaceDescriptor* descriptor) { 86 CodeStubInterfaceDescriptor* descriptor) {
87 static Register registers[] = { rax, rbx, rcx }; 87 static Register registers[] = { rax, rbx, rcx };
88 descriptor->register_param_count_ = 3; 88 descriptor->register_param_count_ = 3;
89 descriptor->register_params_ = registers; 89 descriptor->register_params_ = registers;
90 descriptor->deoptimization_handler_ = 90 descriptor->deoptimization_handler_ =
(...skipping 44 matching lines...) Expand 10 before | Expand all | Expand 10 after
135 } 135 }
136 136
137 137
138 void RegExpConstructResultStub::InitializeInterfaceDescriptor( 138 void RegExpConstructResultStub::InitializeInterfaceDescriptor(
139 Isolate* isolate, 139 Isolate* isolate,
140 CodeStubInterfaceDescriptor* descriptor) { 140 CodeStubInterfaceDescriptor* descriptor) {
141 static Register registers[] = { rcx, rbx, rax }; 141 static Register registers[] = { rcx, rbx, rax };
142 descriptor->register_param_count_ = 3; 142 descriptor->register_param_count_ = 3;
143 descriptor->register_params_ = registers; 143 descriptor->register_params_ = registers;
144 descriptor->deoptimization_handler_ = 144 descriptor->deoptimization_handler_ =
145 Runtime::FunctionForId(Runtime::kRegExpConstructResult)->entry; 145 Runtime::FunctionForId(Runtime::kRegExpConstructResultInternal)->entry;
146 } 146 }
147 147
148 148
149 void LoadFieldStub::InitializeInterfaceDescriptor( 149 void LoadFieldStub::InitializeInterfaceDescriptor(
150 Isolate* isolate, 150 Isolate* isolate,
151 CodeStubInterfaceDescriptor* descriptor) { 151 CodeStubInterfaceDescriptor* descriptor) {
152 static Register registers[] = { rax }; 152 static Register registers[] = { rax };
153 descriptor->register_param_count_ = 1; 153 descriptor->register_param_count_ = 1;
154 descriptor->register_params_ = registers; 154 descriptor->register_params_ = registers;
155 descriptor->deoptimization_handler_ = NULL; 155 descriptor->deoptimization_handler_ = NULL;
(...skipping 222 matching lines...) Expand 10 before | Expand all | Expand 10 after
378 } 378 }
379 379
380 380
381 void StringAddStub::InitializeInterfaceDescriptor( 381 void StringAddStub::InitializeInterfaceDescriptor(
382 Isolate* isolate, 382 Isolate* isolate,
383 CodeStubInterfaceDescriptor* descriptor) { 383 CodeStubInterfaceDescriptor* descriptor) {
384 static Register registers[] = { rdx, rax }; 384 static Register registers[] = { rdx, rax };
385 descriptor->register_param_count_ = 2; 385 descriptor->register_param_count_ = 2;
386 descriptor->register_params_ = registers; 386 descriptor->register_params_ = registers;
387 descriptor->deoptimization_handler_ = 387 descriptor->deoptimization_handler_ =
388 Runtime::FunctionForId(Runtime::kStringAdd)->entry; 388 Runtime::FunctionForId(Runtime::kStringAddInternal)->entry;
389 } 389 }
390 390
391 391
392 void CallDescriptors::InitializeForIsolate(Isolate* isolate) { 392 void CallDescriptors::InitializeForIsolate(Isolate* isolate) {
393 { 393 {
394 CallInterfaceDescriptor* descriptor = 394 CallInterfaceDescriptor* descriptor =
395 isolate->call_descriptor(Isolate::ArgumentAdaptorCall); 395 isolate->call_descriptor(Isolate::ArgumentAdaptorCall);
396 static Register registers[] = { rdi, // JSFunction 396 static Register registers[] = { rdi, // JSFunction
397 rsi, // context 397 rsi, // context
398 rax, // actual number of arguments 398 rax, // actual number of arguments
(...skipping 1328 matching lines...) Expand 10 before | Expand all | Expand 10 after
1727 __ CompareRoot(rax, Heap::kTerminationExceptionRootIndex); 1727 __ CompareRoot(rax, Heap::kTerminationExceptionRootIndex);
1728 Label termination_exception; 1728 Label termination_exception;
1729 __ j(equal, &termination_exception, Label::kNear); 1729 __ j(equal, &termination_exception, Label::kNear);
1730 __ Throw(rax); 1730 __ Throw(rax);
1731 1731
1732 __ bind(&termination_exception); 1732 __ bind(&termination_exception);
1733 __ ThrowUncatchable(rax); 1733 __ ThrowUncatchable(rax);
1734 1734
1735 // Do the runtime call to execute the regexp. 1735 // Do the runtime call to execute the regexp.
1736 __ bind(&runtime); 1736 __ bind(&runtime);
1737 __ TailCallRuntime(Runtime::kRegExpExec, 4, 1); 1737 __ TailCallRuntime(Runtime::kRegExpExecInternal, 4, 1);
1738 1738
1739 // Deferred code for string handling. 1739 // Deferred code for string handling.
1740 // (7) Not a long external string? If yes, go to (10). 1740 // (7) Not a long external string? If yes, go to (10).
1741 __ bind(&not_seq_nor_cons); 1741 __ bind(&not_seq_nor_cons);
1742 // Compare flags are still set from (3). 1742 // Compare flags are still set from (3).
1743 __ j(greater, &not_long_external, Label::kNear); // Go to (10). 1743 __ j(greater, &not_long_external, Label::kNear); // Go to (10).
1744 1744
1745 // (8) External string. Short external strings have been ruled out. 1745 // (8) External string. Short external strings have been ruled out.
1746 __ bind(&external_string); 1746 __ bind(&external_string);
1747 __ movp(rbx, FieldOperand(rdi, HeapObject::kMapOffset)); 1747 __ movp(rbx, FieldOperand(rdi, HeapObject::kMapOffset));
(...skipping 1321 matching lines...) Expand 10 before | Expand all | Expand 10 after
3069 __ jmp(&got_smi_index_); 3069 __ jmp(&got_smi_index_);
3070 3070
3071 // Call runtime. We get here when the receiver is a string and the 3071 // Call runtime. We get here when the receiver is a string and the
3072 // index is a number, but the code of getting the actual character 3072 // index is a number, but the code of getting the actual character
3073 // is too complex (e.g., when the string needs to be flattened). 3073 // is too complex (e.g., when the string needs to be flattened).
3074 __ bind(&call_runtime_); 3074 __ bind(&call_runtime_);
3075 call_helper.BeforeCall(masm); 3075 call_helper.BeforeCall(masm);
3076 __ Push(object_); 3076 __ Push(object_);
3077 __ Integer32ToSmi(index_, index_); 3077 __ Integer32ToSmi(index_, index_);
3078 __ Push(index_); 3078 __ Push(index_);
3079 __ CallRuntime(Runtime::kStringCharCodeAt, 2); 3079 __ CallRuntime(Runtime::kStringCharCodeAtInternal, 2);
3080 if (!result_.is(rax)) { 3080 if (!result_.is(rax)) {
3081 __ movp(result_, rax); 3081 __ movp(result_, rax);
3082 } 3082 }
3083 call_helper.AfterCall(masm); 3083 call_helper.AfterCall(masm);
3084 __ jmp(&exit_); 3084 __ jmp(&exit_);
3085 3085
3086 __ Abort(kUnexpectedFallthroughFromCharCodeAtSlowCase); 3086 __ Abort(kUnexpectedFallthroughFromCharCodeAtSlowCase);
3087 } 3087 }
3088 3088
3089 3089
(...skipping 354 matching lines...) Expand 10 before | Expand all | Expand 10 after
3444 // rdi: first character of result 3444 // rdi: first character of result
3445 // rsi: character of sub string start 3445 // rsi: character of sub string start
3446 // r14: original value of rsi 3446 // r14: original value of rsi
3447 StringHelper::GenerateCopyCharactersREP(masm, rdi, rsi, rcx, false); 3447 StringHelper::GenerateCopyCharactersREP(masm, rdi, rsi, rcx, false);
3448 __ movp(rsi, r14); // Restore esi. 3448 __ movp(rsi, r14); // Restore esi.
3449 __ IncrementCounter(counters->sub_string_native(), 1); 3449 __ IncrementCounter(counters->sub_string_native(), 1);
3450 __ ret(SUB_STRING_ARGUMENT_COUNT * kPointerSize); 3450 __ ret(SUB_STRING_ARGUMENT_COUNT * kPointerSize);
3451 3451
3452 // Just jump to runtime to create the sub string. 3452 // Just jump to runtime to create the sub string.
3453 __ bind(&runtime); 3453 __ bind(&runtime);
3454 __ TailCallRuntime(Runtime::kSubString, 3, 1); 3454 __ TailCallRuntime(Runtime::kSubStringInternal, 3, 1);
3455 3455
3456 __ bind(&single_char); 3456 __ bind(&single_char);
3457 // rax: string 3457 // rax: string
3458 // rbx: instance type 3458 // rbx: instance type
3459 // rcx: sub string length (smi) 3459 // rcx: sub string length (smi)
3460 // rdx: from index (smi) 3460 // rdx: from index (smi)
3461 StringCharAtGenerator generator( 3461 StringCharAtGenerator generator(
3462 rax, rdx, rcx, rax, &runtime, &runtime, &runtime, STRING_INDEX_IS_NUMBER); 3462 rax, rdx, rcx, rax, &runtime, &runtime, &runtime, STRING_INDEX_IS_NUMBER);
3463 generator.GenerateFast(masm); 3463 generator.GenerateFast(masm);
3464 __ ret(SUB_STRING_ARGUMENT_COUNT * kPointerSize); 3464 __ ret(SUB_STRING_ARGUMENT_COUNT * kPointerSize);
(...skipping 176 matching lines...) Expand 10 before | Expand all | Expand 10 after
3641 __ IncrementCounter(counters->string_compare_native(), 1); 3641 __ IncrementCounter(counters->string_compare_native(), 1);
3642 // Drop arguments from the stack 3642 // Drop arguments from the stack
3643 __ PopReturnAddressTo(rcx); 3643 __ PopReturnAddressTo(rcx);
3644 __ addp(rsp, Immediate(2 * kPointerSize)); 3644 __ addp(rsp, Immediate(2 * kPointerSize));
3645 __ PushReturnAddressFrom(rcx); 3645 __ PushReturnAddressFrom(rcx);
3646 GenerateCompareFlatAsciiStrings(masm, rdx, rax, rcx, rbx, rdi, r8); 3646 GenerateCompareFlatAsciiStrings(masm, rdx, rax, rcx, rbx, rdi, r8);
3647 3647
3648 // Call the runtime; it returns -1 (less), 0 (equal), or 1 (greater) 3648 // Call the runtime; it returns -1 (less), 0 (equal), or 1 (greater)
3649 // tagged as a small integer. 3649 // tagged as a small integer.
3650 __ bind(&runtime); 3650 __ bind(&runtime);
3651 __ TailCallRuntime(Runtime::kStringCompare, 2, 1); 3651 __ TailCallRuntime(Runtime::kStringCompareInternal, 2, 1);
3652 } 3652 }
3653 3653
3654 3654
3655 void ArrayPushStub::Generate(MacroAssembler* masm) { 3655 void ArrayPushStub::Generate(MacroAssembler* masm) {
3656 int argc = arguments_count(); 3656 int argc = arguments_count();
3657 3657
3658 StackArgumentsAccessor args(rsp, argc); 3658 StackArgumentsAccessor args(rsp, argc);
3659 if (argc == 0) { 3659 if (argc == 0) {
3660 // Noop, return the length. 3660 // Noop, return the length.
3661 __ movp(rax, FieldOperand(rdx, JSArray::kLengthOffset)); 3661 __ movp(rax, FieldOperand(rdx, JSArray::kLengthOffset));
(...skipping 474 matching lines...) Expand 10 before | Expand all | Expand 10 after
4136 4136
4137 // Handle more complex cases in runtime. 4137 // Handle more complex cases in runtime.
4138 __ bind(&runtime); 4138 __ bind(&runtime);
4139 __ PopReturnAddressTo(tmp1); 4139 __ PopReturnAddressTo(tmp1);
4140 __ Push(left); 4140 __ Push(left);
4141 __ Push(right); 4141 __ Push(right);
4142 __ PushReturnAddressFrom(tmp1); 4142 __ PushReturnAddressFrom(tmp1);
4143 if (equality) { 4143 if (equality) {
4144 __ TailCallRuntime(Runtime::kStringEquals, 2, 1); 4144 __ TailCallRuntime(Runtime::kStringEquals, 2, 1);
4145 } else { 4145 } else {
4146 __ TailCallRuntime(Runtime::kStringCompare, 2, 1); 4146 __ TailCallRuntime(Runtime::kStringCompareInternal, 2, 1);
4147 } 4147 }
4148 4148
4149 __ bind(&miss); 4149 __ bind(&miss);
4150 GenerateMiss(masm); 4150 GenerateMiss(masm);
4151 } 4151 }
4152 4152
4153 4153
4154 void ICCompareStub::GenerateObjects(MacroAssembler* masm) { 4154 void ICCompareStub::GenerateObjects(MacroAssembler* masm) {
4155 ASSERT(state_ == CompareIC::OBJECT); 4155 ASSERT(state_ == CompareIC::OBJECT);
4156 Label miss; 4156 Label miss;
(...skipping 1099 matching lines...) Expand 10 before | Expand all | Expand 10 after
5256 return_value_operand, 5256 return_value_operand,
5257 NULL); 5257 NULL);
5258 } 5258 }
5259 5259
5260 5260
5261 #undef __ 5261 #undef __
5262 5262
5263 } } // namespace v8::internal 5263 } } // namespace v8::internal
5264 5264
5265 #endif // V8_TARGET_ARCH_X64 5265 #endif // V8_TARGET_ARCH_X64
OLDNEW
« src/runtime.h ('K') | « src/runtime.cc ('k') | src/x64/full-codegen-x64.cc » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698