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

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

Issue 346413004: Remove distinction between hidden and normal runtime functions (Closed) Base URL: https://v8.googlecode.com/svn/branches/bleeding_edge
Patch Set: Created 6 years, 6 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 // Use of this source code is governed by a BSD-style license that can be 2 // Use of this source code is governed by a BSD-style license that can be
3 // found in the LICENSE file. 3 // found in the LICENSE file.
4 4
5 #include "src/v8.h" 5 #include "src/v8.h"
6 6
7 #if V8_TARGET_ARCH_X64 7 #if V8_TARGET_ARCH_X64
8 8
9 #include "src/bootstrapper.h" 9 #include "src/bootstrapper.h"
10 #include "src/code-stubs.h" 10 #include "src/code-stubs.h"
11 #include "src/regexp-macro-assembler.h" 11 #include "src/regexp-macro-assembler.h"
12 #include "src/runtime.h" 12 #include "src/runtime.h"
13 #include "src/stub-cache.h" 13 #include "src/stub-cache.h"
14 14
15 namespace v8 { 15 namespace v8 {
16 namespace internal { 16 namespace internal {
17 17
18 18
19 void FastNewClosureStub::InitializeInterfaceDescriptor( 19 void FastNewClosureStub::InitializeInterfaceDescriptor(
20 CodeStubInterfaceDescriptor* descriptor) { 20 CodeStubInterfaceDescriptor* descriptor) {
21 static Register registers[] = { rbx }; 21 static Register registers[] = { rbx };
22 descriptor->register_param_count_ = 1; 22 descriptor->register_param_count_ = 1;
23 descriptor->register_params_ = registers; 23 descriptor->register_params_ = registers;
24 descriptor->deoptimization_handler_ = 24 descriptor->deoptimization_handler_ =
25 Runtime::FunctionForId(Runtime::kHiddenNewClosureFromStubFailure)->entry; 25 Runtime::FunctionForId(Runtime::kNewClosureFromStubFailure)->entry;
26 } 26 }
27 27
28 28
29 void FastNewContextStub::InitializeInterfaceDescriptor( 29 void FastNewContextStub::InitializeInterfaceDescriptor(
30 CodeStubInterfaceDescriptor* descriptor) { 30 CodeStubInterfaceDescriptor* descriptor) {
31 static Register registers[] = { rdi }; 31 static Register registers[] = { rdi };
32 descriptor->register_param_count_ = 1; 32 descriptor->register_param_count_ = 1;
33 descriptor->register_params_ = registers; 33 descriptor->register_params_ = registers;
34 descriptor->deoptimization_handler_ = NULL; 34 descriptor->deoptimization_handler_ = NULL;
35 } 35 }
36 36
37 37
38 void ToNumberStub::InitializeInterfaceDescriptor( 38 void ToNumberStub::InitializeInterfaceDescriptor(
39 CodeStubInterfaceDescriptor* descriptor) { 39 CodeStubInterfaceDescriptor* descriptor) {
40 static Register registers[] = { rax }; 40 static Register registers[] = { rax };
41 descriptor->register_param_count_ = 1; 41 descriptor->register_param_count_ = 1;
42 descriptor->register_params_ = registers; 42 descriptor->register_params_ = registers;
43 descriptor->deoptimization_handler_ = NULL; 43 descriptor->deoptimization_handler_ = NULL;
44 } 44 }
45 45
46 46
47 void NumberToStringStub::InitializeInterfaceDescriptor( 47 void NumberToStringStub::InitializeInterfaceDescriptor(
48 CodeStubInterfaceDescriptor* descriptor) { 48 CodeStubInterfaceDescriptor* descriptor) {
49 static Register registers[] = { rax }; 49 static Register registers[] = { rax };
50 descriptor->register_param_count_ = 1; 50 descriptor->register_param_count_ = 1;
51 descriptor->register_params_ = registers; 51 descriptor->register_params_ = registers;
52 descriptor->deoptimization_handler_ = 52 descriptor->deoptimization_handler_ =
53 Runtime::FunctionForId(Runtime::kHiddenNumberToString)->entry; 53 Runtime::FunctionForId(Runtime::kNumberToString)->entry;
54 } 54 }
55 55
56 56
57 void FastCloneShallowArrayStub::InitializeInterfaceDescriptor( 57 void FastCloneShallowArrayStub::InitializeInterfaceDescriptor(
58 CodeStubInterfaceDescriptor* descriptor) { 58 CodeStubInterfaceDescriptor* descriptor) {
59 static Register registers[] = { rax, rbx, rcx }; 59 static Register registers[] = { rax, rbx, rcx };
60 descriptor->register_param_count_ = 3; 60 descriptor->register_param_count_ = 3;
61 descriptor->register_params_ = registers; 61 descriptor->register_params_ = registers;
62 static Representation representations[] = { 62 static Representation representations[] = {
63 Representation::Tagged(), 63 Representation::Tagged(),
64 Representation::Smi(), 64 Representation::Smi(),
65 Representation::Tagged() }; 65 Representation::Tagged() };
66 descriptor->register_param_representations_ = representations; 66 descriptor->register_param_representations_ = representations;
67 descriptor->deoptimization_handler_ = 67 descriptor->deoptimization_handler_ =
68 Runtime::FunctionForId( 68 Runtime::FunctionForId(
69 Runtime::kHiddenCreateArrayLiteralStubBailout)->entry; 69 Runtime::kCreateArrayLiteralStubBailout)->entry;
70 } 70 }
71 71
72 72
73 void FastCloneShallowObjectStub::InitializeInterfaceDescriptor( 73 void FastCloneShallowObjectStub::InitializeInterfaceDescriptor(
74 CodeStubInterfaceDescriptor* descriptor) { 74 CodeStubInterfaceDescriptor* descriptor) {
75 static Register registers[] = { rax, rbx, rcx, rdx }; 75 static Register registers[] = { rax, rbx, rcx, rdx };
76 descriptor->register_param_count_ = 4; 76 descriptor->register_param_count_ = 4;
77 descriptor->register_params_ = registers; 77 descriptor->register_params_ = registers;
78 descriptor->deoptimization_handler_ = 78 descriptor->deoptimization_handler_ =
79 Runtime::FunctionForId(Runtime::kHiddenCreateObjectLiteral)->entry; 79 Runtime::FunctionForId(Runtime::kCreateObjectLiteral)->entry;
80 } 80 }
81 81
82 82
83 void CreateAllocationSiteStub::InitializeInterfaceDescriptor( 83 void CreateAllocationSiteStub::InitializeInterfaceDescriptor(
84 CodeStubInterfaceDescriptor* descriptor) { 84 CodeStubInterfaceDescriptor* descriptor) {
85 static Register registers[] = { rbx, rdx }; 85 static Register registers[] = { rbx, rdx };
86 descriptor->register_param_count_ = 2; 86 descriptor->register_param_count_ = 2;
87 descriptor->register_params_ = registers; 87 descriptor->register_params_ = registers;
88 descriptor->deoptimization_handler_ = NULL; 88 descriptor->deoptimization_handler_ = NULL;
89 } 89 }
(...skipping 18 matching lines...) Expand all
108 FUNCTION_ADDR(KeyedLoadIC_MissFromStubFailure); 108 FUNCTION_ADDR(KeyedLoadIC_MissFromStubFailure);
109 } 109 }
110 110
111 111
112 void RegExpConstructResultStub::InitializeInterfaceDescriptor( 112 void RegExpConstructResultStub::InitializeInterfaceDescriptor(
113 CodeStubInterfaceDescriptor* descriptor) { 113 CodeStubInterfaceDescriptor* descriptor) {
114 static Register registers[] = { rcx, rbx, rax }; 114 static Register registers[] = { rcx, rbx, rax };
115 descriptor->register_param_count_ = 3; 115 descriptor->register_param_count_ = 3;
116 descriptor->register_params_ = registers; 116 descriptor->register_params_ = registers;
117 descriptor->deoptimization_handler_ = 117 descriptor->deoptimization_handler_ =
118 Runtime::FunctionForId(Runtime::kHiddenRegExpConstructResult)->entry; 118 Runtime::FunctionForId(Runtime::kRegExpConstructResult)->entry;
119 } 119 }
120 120
121 121
122 void KeyedLoadGenericElementStub::InitializeInterfaceDescriptor( 122 void KeyedLoadGenericElementStub::InitializeInterfaceDescriptor(
123 CodeStubInterfaceDescriptor* descriptor) { 123 CodeStubInterfaceDescriptor* descriptor) {
124 static Register registers[] = { rdx, rax }; 124 static Register registers[] = { rdx, rax };
125 descriptor->register_param_count_ = 2; 125 descriptor->register_param_count_ = 2;
126 descriptor->register_params_ = registers; 126 descriptor->register_params_ = registers;
127 descriptor->deoptimization_handler_ = 127 descriptor->deoptimization_handler_ =
128 Runtime::FunctionForId(Runtime::kKeyedGetProperty)->entry; 128 Runtime::FunctionForId(Runtime::kKeyedGetProperty)->entry;
(...skipping 78 matching lines...) Expand 10 before | Expand all | Expand 10 after
207 Representation::Tagged(), 207 Representation::Tagged(),
208 Representation::Tagged(), 208 Representation::Tagged(),
209 Representation::Integer32() }; 209 Representation::Integer32() };
210 descriptor->register_param_representations_ = representations; 210 descriptor->register_param_representations_ = representations;
211 descriptor->register_params_ = registers_variable_args; 211 descriptor->register_params_ = registers_variable_args;
212 } 212 }
213 213
214 descriptor->hint_stack_parameter_count_ = constant_stack_parameter_count; 214 descriptor->hint_stack_parameter_count_ = constant_stack_parameter_count;
215 descriptor->function_mode_ = JS_FUNCTION_STUB_MODE; 215 descriptor->function_mode_ = JS_FUNCTION_STUB_MODE;
216 descriptor->deoptimization_handler_ = 216 descriptor->deoptimization_handler_ =
217 Runtime::FunctionForId(Runtime::kHiddenArrayConstructor)->entry; 217 Runtime::FunctionForId(Runtime::kArrayConstructor)->entry;
218 } 218 }
219 219
220 220
221 static void InitializeInternalArrayConstructorDescriptor( 221 static void InitializeInternalArrayConstructorDescriptor(
222 CodeStubInterfaceDescriptor* descriptor, 222 CodeStubInterfaceDescriptor* descriptor,
223 int constant_stack_parameter_count) { 223 int constant_stack_parameter_count) {
224 // register state 224 // register state
225 // rax -- number of arguments 225 // rax -- number of arguments
226 // rdi -- constructor function 226 // rdi -- constructor function
227 static Register registers_variable_args[] = { rdi, rax }; 227 static Register registers_variable_args[] = { rdi, rax };
(...skipping 10 matching lines...) Expand all
238 descriptor->register_params_ = registers_variable_args; 238 descriptor->register_params_ = registers_variable_args;
239 static Representation representations[] = { 239 static Representation representations[] = {
240 Representation::Tagged(), 240 Representation::Tagged(),
241 Representation::Integer32() }; 241 Representation::Integer32() };
242 descriptor->register_param_representations_ = representations; 242 descriptor->register_param_representations_ = representations;
243 } 243 }
244 244
245 descriptor->hint_stack_parameter_count_ = constant_stack_parameter_count; 245 descriptor->hint_stack_parameter_count_ = constant_stack_parameter_count;
246 descriptor->function_mode_ = JS_FUNCTION_STUB_MODE; 246 descriptor->function_mode_ = JS_FUNCTION_STUB_MODE;
247 descriptor->deoptimization_handler_ = 247 descriptor->deoptimization_handler_ =
248 Runtime::FunctionForId(Runtime::kHiddenInternalArrayConstructor)->entry; 248 Runtime::FunctionForId(Runtime::kInternalArrayConstructor)->entry;
249 } 249 }
250 250
251 251
252 void ArrayNoArgumentConstructorStub::InitializeInterfaceDescriptor( 252 void ArrayNoArgumentConstructorStub::InitializeInterfaceDescriptor(
253 CodeStubInterfaceDescriptor* descriptor) { 253 CodeStubInterfaceDescriptor* descriptor) {
254 InitializeArrayConstructorDescriptor(descriptor, 0); 254 InitializeArrayConstructorDescriptor(descriptor, 0);
255 } 255 }
256 256
257 257
258 void ArraySingleArgumentConstructorStub::InitializeInterfaceDescriptor( 258 void ArraySingleArgumentConstructorStub::InitializeInterfaceDescriptor(
(...skipping 90 matching lines...) Expand 10 before | Expand all | Expand 10 after
349 FUNCTION_ADDR(BinaryOpIC_MissWithAllocationSite); 349 FUNCTION_ADDR(BinaryOpIC_MissWithAllocationSite);
350 } 350 }
351 351
352 352
353 void StringAddStub::InitializeInterfaceDescriptor( 353 void StringAddStub::InitializeInterfaceDescriptor(
354 CodeStubInterfaceDescriptor* descriptor) { 354 CodeStubInterfaceDescriptor* descriptor) {
355 static Register registers[] = { rdx, rax }; 355 static Register registers[] = { rdx, rax };
356 descriptor->register_param_count_ = 2; 356 descriptor->register_param_count_ = 2;
357 descriptor->register_params_ = registers; 357 descriptor->register_params_ = registers;
358 descriptor->deoptimization_handler_ = 358 descriptor->deoptimization_handler_ =
359 Runtime::FunctionForId(Runtime::kHiddenStringAdd)->entry; 359 Runtime::FunctionForId(Runtime::kStringAdd)->entry;
360 } 360 }
361 361
362 362
363 void CallDescriptors::InitializeForIsolate(Isolate* isolate) { 363 void CallDescriptors::InitializeForIsolate(Isolate* isolate) {
364 { 364 {
365 CallInterfaceDescriptor* descriptor = 365 CallInterfaceDescriptor* descriptor =
366 isolate->call_descriptor(Isolate::ArgumentAdaptorCall); 366 isolate->call_descriptor(Isolate::ArgumentAdaptorCall);
367 static Register registers[] = { rdi, // JSFunction 367 static Register registers[] = { rdi, // JSFunction
368 rsi, // context 368 rsi, // context
369 rax, // actual number of arguments 369 rax, // actual number of arguments
(...skipping 467 matching lines...) Expand 10 before | Expand all | Expand 10 after
837 // and may not have contained the exponent value in the first place when the 837 // and may not have contained the exponent value in the first place when the
838 // input was a smi. We reset it with exponent value before bailing out. 838 // input was a smi. We reset it with exponent value before bailing out.
839 __ j(not_equal, &done); 839 __ j(not_equal, &done);
840 __ Cvtlsi2sd(double_exponent, exponent); 840 __ Cvtlsi2sd(double_exponent, exponent);
841 841
842 // Returning or bailing out. 842 // Returning or bailing out.
843 Counters* counters = isolate()->counters(); 843 Counters* counters = isolate()->counters();
844 if (exponent_type_ == ON_STACK) { 844 if (exponent_type_ == ON_STACK) {
845 // The arguments are still on the stack. 845 // The arguments are still on the stack.
846 __ bind(&call_runtime); 846 __ bind(&call_runtime);
847 __ TailCallRuntime(Runtime::kHiddenMathPow, 2, 1); 847 __ TailCallRuntime(Runtime::kMathPow, 2, 1);
848 848
849 // The stub is called from non-optimized code, which expects the result 849 // The stub is called from non-optimized code, which expects the result
850 // as heap number in rax. 850 // as heap number in rax.
851 __ bind(&done); 851 __ bind(&done);
852 __ AllocateHeapNumber(rax, rcx, &call_runtime); 852 __ AllocateHeapNumber(rax, rcx, &call_runtime);
853 __ movsd(FieldOperand(rax, HeapNumber::kValueOffset), double_result); 853 __ movsd(FieldOperand(rax, HeapNumber::kValueOffset), double_result);
854 __ IncrementCounter(counters->math_pow(), 1); 854 __ IncrementCounter(counters->math_pow(), 1);
855 __ ret(2 * kPointerSize); 855 __ ret(2 * kPointerSize);
856 } else { 856 } else {
857 __ bind(&call_runtime); 857 __ bind(&call_runtime);
(...skipping 308 matching lines...) Expand 10 before | Expand all | Expand 10 after
1166 __ j(less, &arguments_loop, Label::kNear); 1166 __ j(less, &arguments_loop, Label::kNear);
1167 1167
1168 // Return and remove the on-stack parameters. 1168 // Return and remove the on-stack parameters.
1169 __ ret(3 * kPointerSize); 1169 __ ret(3 * kPointerSize);
1170 1170
1171 // Do the runtime call to allocate the arguments object. 1171 // Do the runtime call to allocate the arguments object.
1172 // rcx = argument count (untagged) 1172 // rcx = argument count (untagged)
1173 __ bind(&runtime); 1173 __ bind(&runtime);
1174 __ Integer32ToSmi(rcx, rcx); 1174 __ Integer32ToSmi(rcx, rcx);
1175 __ movp(args.GetArgumentOperand(2), rcx); // Patch argument count. 1175 __ movp(args.GetArgumentOperand(2), rcx); // Patch argument count.
1176 __ TailCallRuntime(Runtime::kHiddenNewSloppyArguments, 3, 1); 1176 __ TailCallRuntime(Runtime::kNewSloppyArguments, 3, 1);
1177 } 1177 }
1178 1178
1179 1179
1180 void ArgumentsAccessStub::GenerateNewSloppySlow(MacroAssembler* masm) { 1180 void ArgumentsAccessStub::GenerateNewSloppySlow(MacroAssembler* masm) {
1181 // rsp[0] : return address 1181 // rsp[0] : return address
1182 // rsp[8] : number of parameters 1182 // rsp[8] : number of parameters
1183 // rsp[16] : receiver displacement 1183 // rsp[16] : receiver displacement
1184 // rsp[24] : function 1184 // rsp[24] : function
1185 1185
1186 // Check if the calling frame is an arguments adaptor frame. 1186 // Check if the calling frame is an arguments adaptor frame.
1187 Label runtime; 1187 Label runtime;
1188 __ movp(rdx, Operand(rbp, StandardFrameConstants::kCallerFPOffset)); 1188 __ movp(rdx, Operand(rbp, StandardFrameConstants::kCallerFPOffset));
1189 __ movp(rcx, Operand(rdx, StandardFrameConstants::kContextOffset)); 1189 __ movp(rcx, Operand(rdx, StandardFrameConstants::kContextOffset));
1190 __ Cmp(rcx, Smi::FromInt(StackFrame::ARGUMENTS_ADAPTOR)); 1190 __ Cmp(rcx, Smi::FromInt(StackFrame::ARGUMENTS_ADAPTOR));
1191 __ j(not_equal, &runtime); 1191 __ j(not_equal, &runtime);
1192 1192
1193 // Patch the arguments.length and the parameters pointer. 1193 // Patch the arguments.length and the parameters pointer.
1194 StackArgumentsAccessor args(rsp, 3, ARGUMENTS_DONT_CONTAIN_RECEIVER); 1194 StackArgumentsAccessor args(rsp, 3, ARGUMENTS_DONT_CONTAIN_RECEIVER);
1195 __ movp(rcx, Operand(rdx, ArgumentsAdaptorFrameConstants::kLengthOffset)); 1195 __ movp(rcx, Operand(rdx, ArgumentsAdaptorFrameConstants::kLengthOffset));
1196 __ movp(args.GetArgumentOperand(2), rcx); 1196 __ movp(args.GetArgumentOperand(2), rcx);
1197 __ SmiToInteger64(rcx, rcx); 1197 __ SmiToInteger64(rcx, rcx);
1198 __ leap(rdx, Operand(rdx, rcx, times_pointer_size, 1198 __ leap(rdx, Operand(rdx, rcx, times_pointer_size,
1199 StandardFrameConstants::kCallerSPOffset)); 1199 StandardFrameConstants::kCallerSPOffset));
1200 __ movp(args.GetArgumentOperand(1), rdx); 1200 __ movp(args.GetArgumentOperand(1), rdx);
1201 1201
1202 __ bind(&runtime); 1202 __ bind(&runtime);
1203 __ TailCallRuntime(Runtime::kHiddenNewSloppyArguments, 3, 1); 1203 __ TailCallRuntime(Runtime::kNewSloppyArguments, 3, 1);
1204 } 1204 }
1205 1205
1206 1206
1207 void ArgumentsAccessStub::GenerateNewStrict(MacroAssembler* masm) { 1207 void ArgumentsAccessStub::GenerateNewStrict(MacroAssembler* masm) {
1208 // rsp[0] : return address 1208 // rsp[0] : return address
1209 // rsp[8] : number of parameters 1209 // rsp[8] : number of parameters
1210 // rsp[16] : receiver displacement 1210 // rsp[16] : receiver displacement
1211 // rsp[24] : function 1211 // rsp[24] : function
1212 1212
1213 // Check if the calling frame is an arguments adaptor frame. 1213 // Check if the calling frame is an arguments adaptor frame.
(...skipping 80 matching lines...) Expand 10 before | Expand all | Expand 10 after
1294 __ subp(rdx, Immediate(kPointerSize)); 1294 __ subp(rdx, Immediate(kPointerSize));
1295 __ decp(rcx); 1295 __ decp(rcx);
1296 __ j(not_zero, &loop); 1296 __ j(not_zero, &loop);
1297 1297
1298 // Return and remove the on-stack parameters. 1298 // Return and remove the on-stack parameters.
1299 __ bind(&done); 1299 __ bind(&done);
1300 __ ret(3 * kPointerSize); 1300 __ ret(3 * kPointerSize);
1301 1301
1302 // Do the runtime call to allocate the arguments object. 1302 // Do the runtime call to allocate the arguments object.
1303 __ bind(&runtime); 1303 __ bind(&runtime);
1304 __ TailCallRuntime(Runtime::kHiddenNewStrictArguments, 3, 1); 1304 __ TailCallRuntime(Runtime::kNewStrictArguments, 3, 1);
1305 } 1305 }
1306 1306
1307 1307
1308 void RegExpExecStub::Generate(MacroAssembler* masm) { 1308 void RegExpExecStub::Generate(MacroAssembler* masm) {
1309 // Just jump directly to runtime if native RegExp is not selected at compile 1309 // Just jump directly to runtime if native RegExp is not selected at compile
1310 // time or if regexp entry in generated code is turned off runtime switch or 1310 // time or if regexp entry in generated code is turned off runtime switch or
1311 // at compilation. 1311 // at compilation.
1312 #ifdef V8_INTERPRETED_REGEXP 1312 #ifdef V8_INTERPRETED_REGEXP
1313 __ TailCallRuntime(Runtime::kHiddenRegExpExec, 4, 1); 1313 __ TailCallRuntime(Runtime::kRegExpExec, 4, 1);
1314 #else // V8_INTERPRETED_REGEXP 1314 #else // V8_INTERPRETED_REGEXP
1315 1315
1316 // Stack frame on entry. 1316 // Stack frame on entry.
1317 // rsp[0] : return address 1317 // rsp[0] : return address
1318 // rsp[8] : last_match_info (expected JSArray) 1318 // rsp[8] : last_match_info (expected JSArray)
1319 // rsp[16] : previous index 1319 // rsp[16] : previous index
1320 // rsp[24] : subject string 1320 // rsp[24] : subject string
1321 // rsp[32] : JSRegExp object 1321 // rsp[32] : JSRegExp object
1322 1322
1323 enum RegExpExecStubArgumentIndices { 1323 enum RegExpExecStubArgumentIndices {
(...skipping 372 matching lines...) Expand 10 before | Expand all | Expand 10 after
1696 __ CompareRoot(rax, Heap::kTerminationExceptionRootIndex); 1696 __ CompareRoot(rax, Heap::kTerminationExceptionRootIndex);
1697 Label termination_exception; 1697 Label termination_exception;
1698 __ j(equal, &termination_exception, Label::kNear); 1698 __ j(equal, &termination_exception, Label::kNear);
1699 __ Throw(rax); 1699 __ Throw(rax);
1700 1700
1701 __ bind(&termination_exception); 1701 __ bind(&termination_exception);
1702 __ ThrowUncatchable(rax); 1702 __ ThrowUncatchable(rax);
1703 1703
1704 // Do the runtime call to execute the regexp. 1704 // Do the runtime call to execute the regexp.
1705 __ bind(&runtime); 1705 __ bind(&runtime);
1706 __ TailCallRuntime(Runtime::kHiddenRegExpExec, 4, 1); 1706 __ TailCallRuntime(Runtime::kRegExpExec, 4, 1);
1707 1707
1708 // Deferred code for string handling. 1708 // Deferred code for string handling.
1709 // (7) Not a long external string? If yes, go to (10). 1709 // (7) Not a long external string? If yes, go to (10).
1710 __ bind(&not_seq_nor_cons); 1710 __ bind(&not_seq_nor_cons);
1711 // Compare flags are still set from (3). 1711 // Compare flags are still set from (3).
1712 __ j(greater, &not_long_external, Label::kNear); // Go to (10). 1712 __ j(greater, &not_long_external, Label::kNear); // Go to (10).
1713 1713
1714 // (8) External string. Short external strings have been ruled out. 1714 // (8) External string. Short external strings have been ruled out.
1715 __ bind(&external_string); 1715 __ bind(&external_string);
1716 __ movp(rbx, FieldOperand(rdi, HeapObject::kMapOffset)); 1716 __ movp(rbx, FieldOperand(rdi, HeapObject::kMapOffset));
(...skipping 1346 matching lines...) Expand 10 before | Expand all | Expand 10 after
3063 index_not_number_, 3063 index_not_number_,
3064 DONT_DO_SMI_CHECK); 3064 DONT_DO_SMI_CHECK);
3065 call_helper.BeforeCall(masm); 3065 call_helper.BeforeCall(masm);
3066 __ Push(object_); 3066 __ Push(object_);
3067 __ Push(index_); // Consumed by runtime conversion function. 3067 __ Push(index_); // Consumed by runtime conversion function.
3068 if (index_flags_ == STRING_INDEX_IS_NUMBER) { 3068 if (index_flags_ == STRING_INDEX_IS_NUMBER) {
3069 __ CallRuntime(Runtime::kNumberToIntegerMapMinusZero, 1); 3069 __ CallRuntime(Runtime::kNumberToIntegerMapMinusZero, 1);
3070 } else { 3070 } else {
3071 ASSERT(index_flags_ == STRING_INDEX_IS_ARRAY_INDEX); 3071 ASSERT(index_flags_ == STRING_INDEX_IS_ARRAY_INDEX);
3072 // NumberToSmi discards numbers that are not exact integers. 3072 // NumberToSmi discards numbers that are not exact integers.
3073 __ CallRuntime(Runtime::kHiddenNumberToSmi, 1); 3073 __ CallRuntime(Runtime::kNumberToSmi, 1);
3074 } 3074 }
3075 if (!index_.is(rax)) { 3075 if (!index_.is(rax)) {
3076 // Save the conversion result before the pop instructions below 3076 // Save the conversion result before the pop instructions below
3077 // have a chance to overwrite it. 3077 // have a chance to overwrite it.
3078 __ movp(index_, rax); 3078 __ movp(index_, rax);
3079 } 3079 }
3080 __ Pop(object_); 3080 __ Pop(object_);
3081 // Reload the instance type. 3081 // Reload the instance type.
3082 __ movp(result_, FieldOperand(object_, HeapObject::kMapOffset)); 3082 __ movp(result_, FieldOperand(object_, HeapObject::kMapOffset));
3083 __ movzxbl(result_, FieldOperand(result_, Map::kInstanceTypeOffset)); 3083 __ movzxbl(result_, FieldOperand(result_, Map::kInstanceTypeOffset));
3084 call_helper.AfterCall(masm); 3084 call_helper.AfterCall(masm);
3085 // If index is still not a smi, it must be out of range. 3085 // If index is still not a smi, it must be out of range.
3086 __ JumpIfNotSmi(index_, index_out_of_range_); 3086 __ JumpIfNotSmi(index_, index_out_of_range_);
3087 // Otherwise, return to the fast path. 3087 // Otherwise, return to the fast path.
3088 __ jmp(&got_smi_index_); 3088 __ jmp(&got_smi_index_);
3089 3089
3090 // Call runtime. We get here when the receiver is a string and the 3090 // Call runtime. We get here when the receiver is a string and the
3091 // index is a number, but the code of getting the actual character 3091 // index is a number, but the code of getting the actual character
3092 // is too complex (e.g., when the string needs to be flattened). 3092 // is too complex (e.g., when the string needs to be flattened).
3093 __ bind(&call_runtime_); 3093 __ bind(&call_runtime_);
3094 call_helper.BeforeCall(masm); 3094 call_helper.BeforeCall(masm);
3095 __ Push(object_); 3095 __ Push(object_);
3096 __ Integer32ToSmi(index_, index_); 3096 __ Integer32ToSmi(index_, index_);
3097 __ Push(index_); 3097 __ Push(index_);
3098 __ CallRuntime(Runtime::kHiddenStringCharCodeAt, 2); 3098 __ CallRuntime(Runtime::kStringCharCodeAt, 2);
3099 if (!result_.is(rax)) { 3099 if (!result_.is(rax)) {
3100 __ movp(result_, rax); 3100 __ movp(result_, rax);
3101 } 3101 }
3102 call_helper.AfterCall(masm); 3102 call_helper.AfterCall(masm);
3103 __ jmp(&exit_); 3103 __ jmp(&exit_);
3104 3104
3105 __ Abort(kUnexpectedFallthroughFromCharCodeAtSlowCase); 3105 __ Abort(kUnexpectedFallthroughFromCharCodeAtSlowCase);
3106 } 3106 }
3107 3107
3108 3108
(...skipping 323 matching lines...) Expand 10 before | Expand all | Expand 10 after
3432 // rcx: result length 3432 // rcx: result length
3433 // rdi: first character of result 3433 // rdi: first character of result
3434 // r14: character of sub string start 3434 // r14: character of sub string start
3435 StringHelper::GenerateCopyCharacters( 3435 StringHelper::GenerateCopyCharacters(
3436 masm, rdi, r14, rcx, String::TWO_BYTE_ENCODING); 3436 masm, rdi, r14, rcx, String::TWO_BYTE_ENCODING);
3437 __ IncrementCounter(counters->sub_string_native(), 1); 3437 __ IncrementCounter(counters->sub_string_native(), 1);
3438 __ ret(SUB_STRING_ARGUMENT_COUNT * kPointerSize); 3438 __ ret(SUB_STRING_ARGUMENT_COUNT * kPointerSize);
3439 3439
3440 // Just jump to runtime to create the sub string. 3440 // Just jump to runtime to create the sub string.
3441 __ bind(&runtime); 3441 __ bind(&runtime);
3442 __ TailCallRuntime(Runtime::kHiddenSubString, 3, 1); 3442 __ TailCallRuntime(Runtime::kSubString, 3, 1);
3443 3443
3444 __ bind(&single_char); 3444 __ bind(&single_char);
3445 // rax: string 3445 // rax: string
3446 // rbx: instance type 3446 // rbx: instance type
3447 // rcx: sub string length (smi) 3447 // rcx: sub string length (smi)
3448 // rdx: from index (smi) 3448 // rdx: from index (smi)
3449 StringCharAtGenerator generator( 3449 StringCharAtGenerator generator(
3450 rax, rdx, rcx, rax, &runtime, &runtime, &runtime, STRING_INDEX_IS_NUMBER); 3450 rax, rdx, rcx, rax, &runtime, &runtime, &runtime, STRING_INDEX_IS_NUMBER);
3451 generator.GenerateFast(masm); 3451 generator.GenerateFast(masm);
3452 __ ret(SUB_STRING_ARGUMENT_COUNT * kPointerSize); 3452 __ ret(SUB_STRING_ARGUMENT_COUNT * kPointerSize);
(...skipping 176 matching lines...) Expand 10 before | Expand all | Expand 10 after
3629 __ IncrementCounter(counters->string_compare_native(), 1); 3629 __ IncrementCounter(counters->string_compare_native(), 1);
3630 // Drop arguments from the stack 3630 // Drop arguments from the stack
3631 __ PopReturnAddressTo(rcx); 3631 __ PopReturnAddressTo(rcx);
3632 __ addp(rsp, Immediate(2 * kPointerSize)); 3632 __ addp(rsp, Immediate(2 * kPointerSize));
3633 __ PushReturnAddressFrom(rcx); 3633 __ PushReturnAddressFrom(rcx);
3634 GenerateCompareFlatAsciiStrings(masm, rdx, rax, rcx, rbx, rdi, r8); 3634 GenerateCompareFlatAsciiStrings(masm, rdx, rax, rcx, rbx, rdi, r8);
3635 3635
3636 // Call the runtime; it returns -1 (less), 0 (equal), or 1 (greater) 3636 // Call the runtime; it returns -1 (less), 0 (equal), or 1 (greater)
3637 // tagged as a small integer. 3637 // tagged as a small integer.
3638 __ bind(&runtime); 3638 __ bind(&runtime);
3639 __ TailCallRuntime(Runtime::kHiddenStringCompare, 2, 1); 3639 __ TailCallRuntime(Runtime::kStringCompare, 2, 1);
3640 } 3640 }
3641 3641
3642 3642
3643 void BinaryOpICWithAllocationSiteStub::Generate(MacroAssembler* masm) { 3643 void BinaryOpICWithAllocationSiteStub::Generate(MacroAssembler* masm) {
3644 // ----------- S t a t e ------------- 3644 // ----------- S t a t e -------------
3645 // -- rdx : left 3645 // -- rdx : left
3646 // -- rax : right 3646 // -- rax : right
3647 // -- rsp[0] : return address 3647 // -- rsp[0] : return address
3648 // ----------------------------------- 3648 // -----------------------------------
3649 3649
(...skipping 277 matching lines...) Expand 10 before | Expand all | Expand 10 after
3927 3927
3928 // Handle more complex cases in runtime. 3928 // Handle more complex cases in runtime.
3929 __ bind(&runtime); 3929 __ bind(&runtime);
3930 __ PopReturnAddressTo(tmp1); 3930 __ PopReturnAddressTo(tmp1);
3931 __ Push(left); 3931 __ Push(left);
3932 __ Push(right); 3932 __ Push(right);
3933 __ PushReturnAddressFrom(tmp1); 3933 __ PushReturnAddressFrom(tmp1);
3934 if (equality) { 3934 if (equality) {
3935 __ TailCallRuntime(Runtime::kStringEquals, 2, 1); 3935 __ TailCallRuntime(Runtime::kStringEquals, 2, 1);
3936 } else { 3936 } else {
3937 __ TailCallRuntime(Runtime::kHiddenStringCompare, 2, 1); 3937 __ TailCallRuntime(Runtime::kStringCompare, 2, 1);
3938 } 3938 }
3939 3939
3940 __ bind(&miss); 3940 __ bind(&miss);
3941 GenerateMiss(masm); 3941 GenerateMiss(masm);
3942 } 3942 }
3943 3943
3944 3944
3945 void ICCompareStub::GenerateObjects(MacroAssembler* masm) { 3945 void ICCompareStub::GenerateObjects(MacroAssembler* masm) {
3946 ASSERT(state_ == CompareIC::OBJECT); 3946 ASSERT(state_ == CompareIC::OBJECT);
3947 Label miss; 3947 Label miss;
(...skipping 1098 matching lines...) Expand 10 before | Expand all | Expand 10 after
5046 return_value_operand, 5046 return_value_operand,
5047 NULL); 5047 NULL);
5048 } 5048 }
5049 5049
5050 5050
5051 #undef __ 5051 #undef __
5052 5052
5053 } } // namespace v8::internal 5053 } } // namespace v8::internal
5054 5054
5055 #endif // V8_TARGET_ARCH_X64 5055 #endif // V8_TARGET_ARCH_X64
OLDNEW
« src/serialize.cc ('K') | « src/x64/builtins-x64.cc ('k') | src/x64/full-codegen-x64.cc » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698