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

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

Issue 39973003: Merge bleeding_edge. (Closed) Base URL: https://v8.googlecode.com/svn/branches/experimental/parser
Patch Set: again Created 7 years, 2 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/x64/builtins-x64.cc ('k') | src/x64/codegen-x64.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 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 48 matching lines...) Expand 10 before | Expand all | Expand 10 after
59 descriptor->deoptimization_handler_ = NULL; 59 descriptor->deoptimization_handler_ = NULL;
60 } 60 }
61 61
62 62
63 void NumberToStringStub::InitializeInterfaceDescriptor( 63 void NumberToStringStub::InitializeInterfaceDescriptor(
64 Isolate* isolate, 64 Isolate* isolate,
65 CodeStubInterfaceDescriptor* descriptor) { 65 CodeStubInterfaceDescriptor* descriptor) {
66 static Register registers[] = { rax }; 66 static Register registers[] = { rax };
67 descriptor->register_param_count_ = 1; 67 descriptor->register_param_count_ = 1;
68 descriptor->register_params_ = registers; 68 descriptor->register_params_ = registers;
69 descriptor->deoptimization_handler_ = NULL; 69 descriptor->deoptimization_handler_ =
70 Runtime::FunctionForId(Runtime::kNumberToString)->entry;
70 } 71 }
71 72
72 73
73 void FastCloneShallowArrayStub::InitializeInterfaceDescriptor( 74 void FastCloneShallowArrayStub::InitializeInterfaceDescriptor(
74 Isolate* isolate, 75 Isolate* isolate,
75 CodeStubInterfaceDescriptor* descriptor) { 76 CodeStubInterfaceDescriptor* descriptor) {
76 static Register registers[] = { rax, rbx, rcx }; 77 static Register registers[] = { rax, rbx, rcx };
77 descriptor->register_param_count_ = 3; 78 descriptor->register_param_count_ = 3;
78 descriptor->register_params_ = registers; 79 descriptor->register_params_ = registers;
79 descriptor->deoptimization_handler_ = 80 descriptor->deoptimization_handler_ =
(...skipping 92 matching lines...) Expand 10 before | Expand all | Expand 10 after
172 CodeStubInterfaceDescriptor* descriptor, 173 CodeStubInterfaceDescriptor* descriptor,
173 int constant_stack_parameter_count) { 174 int constant_stack_parameter_count) {
174 // register state 175 // register state
175 // rax -- number of arguments 176 // rax -- number of arguments
176 // rdi -- function 177 // rdi -- function
177 // rbx -- type info cell with elements kind 178 // rbx -- type info cell with elements kind
178 static Register registers[] = { rdi, rbx }; 179 static Register registers[] = { rdi, rbx };
179 descriptor->register_param_count_ = 2; 180 descriptor->register_param_count_ = 2;
180 if (constant_stack_parameter_count != 0) { 181 if (constant_stack_parameter_count != 0) {
181 // stack param count needs (constructor pointer, and single argument) 182 // stack param count needs (constructor pointer, and single argument)
182 descriptor->stack_parameter_count_ = &rax; 183 descriptor->stack_parameter_count_ = rax;
183 } 184 }
184 descriptor->hint_stack_parameter_count_ = constant_stack_parameter_count; 185 descriptor->hint_stack_parameter_count_ = constant_stack_parameter_count;
185 descriptor->register_params_ = registers; 186 descriptor->register_params_ = registers;
186 descriptor->function_mode_ = JS_FUNCTION_STUB_MODE; 187 descriptor->function_mode_ = JS_FUNCTION_STUB_MODE;
187 descriptor->deoptimization_handler_ = 188 descriptor->deoptimization_handler_ =
188 Runtime::FunctionForId(Runtime::kArrayConstructor)->entry; 189 Runtime::FunctionForId(Runtime::kArrayConstructor)->entry;
189 } 190 }
190 191
191 192
192 static void InitializeInternalArrayConstructorDescriptor( 193 static void InitializeInternalArrayConstructorDescriptor(
193 Isolate* isolate, 194 Isolate* isolate,
194 CodeStubInterfaceDescriptor* descriptor, 195 CodeStubInterfaceDescriptor* descriptor,
195 int constant_stack_parameter_count) { 196 int constant_stack_parameter_count) {
196 // register state 197 // register state
197 // rax -- number of arguments 198 // rax -- number of arguments
198 // rdi -- constructor function 199 // rdi -- constructor function
199 static Register registers[] = { rdi }; 200 static Register registers[] = { rdi };
200 descriptor->register_param_count_ = 1; 201 descriptor->register_param_count_ = 1;
201 202
202 if (constant_stack_parameter_count != 0) { 203 if (constant_stack_parameter_count != 0) {
203 // stack param count needs (constructor pointer, and single argument) 204 // stack param count needs (constructor pointer, and single argument)
204 descriptor->stack_parameter_count_ = &rax; 205 descriptor->stack_parameter_count_ = rax;
205 } 206 }
206 descriptor->hint_stack_parameter_count_ = constant_stack_parameter_count; 207 descriptor->hint_stack_parameter_count_ = constant_stack_parameter_count;
207 descriptor->register_params_ = registers; 208 descriptor->register_params_ = registers;
208 descriptor->function_mode_ = JS_FUNCTION_STUB_MODE; 209 descriptor->function_mode_ = JS_FUNCTION_STUB_MODE;
209 descriptor->deoptimization_handler_ = 210 descriptor->deoptimization_handler_ =
210 Runtime::FunctionForId(Runtime::kInternalArrayConstructor)->entry; 211 Runtime::FunctionForId(Runtime::kInternalArrayConstructor)->entry;
211 } 212 }
212 213
213 214
214 void ArrayNoArgumentConstructorStub::InitializeInterfaceDescriptor( 215 void ArrayNoArgumentConstructorStub::InitializeInterfaceDescriptor(
(...skipping 3552 matching lines...) Expand 10 before | Expand all | Expand 10 after
3767 StringHelper::GenerateCopyCharacters(masm, rbx, rcx, r14, false); 3768 StringHelper::GenerateCopyCharacters(masm, rbx, rcx, r14, false);
3768 // rbx: next character of result 3769 // rbx: next character of result
3769 // rdx: first char of second string 3770 // rdx: first char of second string
3770 // r15: length of second string 3771 // r15: length of second string
3771 StringHelper::GenerateCopyCharacters(masm, rbx, rdx, r15, false); 3772 StringHelper::GenerateCopyCharacters(masm, rbx, rdx, r15, false);
3772 __ IncrementCounter(counters->string_add_native(), 1); 3773 __ IncrementCounter(counters->string_add_native(), 1);
3773 __ ret(2 * kPointerSize); 3774 __ ret(2 * kPointerSize);
3774 3775
3775 // Just jump to runtime to add the two strings. 3776 // Just jump to runtime to add the two strings.
3776 __ bind(&call_runtime); 3777 __ bind(&call_runtime);
3777 3778 __ TailCallRuntime(Runtime::kStringAdd, 2, 1);
3778 if ((flags_ & STRING_ADD_ERECT_FRAME) != 0) {
3779 GenerateRegisterArgsPop(masm, rcx);
3780 // Build a frame
3781 {
3782 FrameScope scope(masm, StackFrame::INTERNAL);
3783 GenerateRegisterArgsPush(masm);
3784 __ CallRuntime(Runtime::kStringAdd, 2);
3785 }
3786 __ Ret();
3787 } else {
3788 __ TailCallRuntime(Runtime::kStringAdd, 2, 1);
3789 }
3790 3779
3791 if (call_builtin.is_linked()) { 3780 if (call_builtin.is_linked()) {
3792 __ bind(&call_builtin); 3781 __ bind(&call_builtin);
3793 if ((flags_ & STRING_ADD_ERECT_FRAME) != 0) { 3782 __ InvokeBuiltin(builtin_id, JUMP_FUNCTION);
3794 GenerateRegisterArgsPop(masm, rcx);
3795 // Build a frame
3796 {
3797 FrameScope scope(masm, StackFrame::INTERNAL);
3798 GenerateRegisterArgsPush(masm);
3799 __ InvokeBuiltin(builtin_id, CALL_FUNCTION);
3800 }
3801 __ Ret();
3802 } else {
3803 __ InvokeBuiltin(builtin_id, JUMP_FUNCTION);
3804 }
3805 } 3783 }
3806 } 3784 }
3807 3785
3808 3786
3809 void StringAddStub::GenerateRegisterArgsPush(MacroAssembler* masm) { 3787 void StringAddStub::GenerateRegisterArgsPush(MacroAssembler* masm) {
3810 __ push(rax); 3788 __ push(rax);
3811 __ push(rdx); 3789 __ push(rdx);
3812 } 3790 }
3813 3791
3814 3792
(...skipping 404 matching lines...) Expand 10 before | Expand all | Expand 10 after
4219 __ j(less, &copy_routine); 4197 __ j(less, &copy_routine);
4220 // Allocate new sliced string. At this point we do not reload the instance 4198 // Allocate new sliced string. At this point we do not reload the instance
4221 // type including the string encoding because we simply rely on the info 4199 // type including the string encoding because we simply rely on the info
4222 // provided by the original string. It does not matter if the original 4200 // provided by the original string. It does not matter if the original
4223 // string's encoding is wrong because we always have to recheck encoding of 4201 // string's encoding is wrong because we always have to recheck encoding of
4224 // the newly created string's parent anyways due to externalized strings. 4202 // the newly created string's parent anyways due to externalized strings.
4225 Label two_byte_slice, set_slice_header; 4203 Label two_byte_slice, set_slice_header;
4226 STATIC_ASSERT((kStringEncodingMask & kOneByteStringTag) != 0); 4204 STATIC_ASSERT((kStringEncodingMask & kOneByteStringTag) != 0);
4227 STATIC_ASSERT((kStringEncodingMask & kTwoByteStringTag) == 0); 4205 STATIC_ASSERT((kStringEncodingMask & kTwoByteStringTag) == 0);
4228 __ testb(rbx, Immediate(kStringEncodingMask)); 4206 __ testb(rbx, Immediate(kStringEncodingMask));
4229 __ j(zero, &two_byte_slice, Label::kNear); 4207 // Make long jumps when allocations tracking is on due to
4208 // RecordObjectAllocation inside MacroAssembler::Allocate.
4209 Label::Distance jump_distance =
4210 masm->isolate()->heap_profiler()->is_tracking_allocations()
4211 ? Label::kFar
4212 : Label::kNear;
4213 __ j(zero, &two_byte_slice, jump_distance);
4230 __ AllocateAsciiSlicedString(rax, rbx, r14, &runtime); 4214 __ AllocateAsciiSlicedString(rax, rbx, r14, &runtime);
4231 __ jmp(&set_slice_header, Label::kNear); 4215 __ jmp(&set_slice_header, jump_distance);
4232 __ bind(&two_byte_slice); 4216 __ bind(&two_byte_slice);
4233 __ AllocateTwoByteSlicedString(rax, rbx, r14, &runtime); 4217 __ AllocateTwoByteSlicedString(rax, rbx, r14, &runtime);
4234 __ bind(&set_slice_header); 4218 __ bind(&set_slice_header);
4235 __ Integer32ToSmi(rcx, rcx); 4219 __ Integer32ToSmi(rcx, rcx);
4236 __ movq(FieldOperand(rax, SlicedString::kLengthOffset), rcx); 4220 __ movq(FieldOperand(rax, SlicedString::kLengthOffset), rcx);
4237 __ movq(FieldOperand(rax, SlicedString::kHashFieldOffset), 4221 __ movq(FieldOperand(rax, SlicedString::kHashFieldOffset),
4238 Immediate(String::kEmptyHashField)); 4222 Immediate(String::kEmptyHashField));
4239 __ movq(FieldOperand(rax, SlicedString::kParentOffset), rdi); 4223 __ movq(FieldOperand(rax, SlicedString::kParentOffset), rdi);
4240 __ movq(FieldOperand(rax, SlicedString::kOffsetOffset), rdx); 4224 __ movq(FieldOperand(rax, SlicedString::kOffsetOffset), rdx);
4241 __ IncrementCounter(counters->sub_string_native(), 1); 4225 __ IncrementCounter(counters->sub_string_native(), 1);
(...skipping 1589 matching lines...) Expand 10 before | Expand all | Expand 10 after
5831 __ bind(&fast_elements_case); 5815 __ bind(&fast_elements_case);
5832 GenerateCase(masm, FAST_ELEMENTS); 5816 GenerateCase(masm, FAST_ELEMENTS);
5833 } 5817 }
5834 5818
5835 5819
5836 #undef __ 5820 #undef __
5837 5821
5838 } } // namespace v8::internal 5822 } } // namespace v8::internal
5839 5823
5840 #endif // V8_TARGET_ARCH_X64 5824 #endif // V8_TARGET_ARCH_X64
OLDNEW
« no previous file with comments | « src/x64/builtins-x64.cc ('k') | src/x64/codegen-x64.cc » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698