OLD | NEW |
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 28 matching lines...) Expand all Loading... |
39 namespace internal { | 39 namespace internal { |
40 | 40 |
41 | 41 |
42 void FastNewClosureStub::InitializeInterfaceDescriptor( | 42 void FastNewClosureStub::InitializeInterfaceDescriptor( |
43 Isolate* isolate, | 43 Isolate* isolate, |
44 CodeStubInterfaceDescriptor* descriptor) { | 44 CodeStubInterfaceDescriptor* descriptor) { |
45 static Register registers[] = { rbx }; | 45 static Register registers[] = { rbx }; |
46 descriptor->register_param_count_ = 1; | 46 descriptor->register_param_count_ = 1; |
47 descriptor->register_params_ = registers; | 47 descriptor->register_params_ = registers; |
48 descriptor->deoptimization_handler_ = | 48 descriptor->deoptimization_handler_ = |
49 Runtime::FunctionForId(Runtime::kNewClosureFromStubFailure)->entry; | 49 Runtime::FunctionForId(Runtime::kHiddenNewClosureFromStubFailure)->entry; |
50 } | 50 } |
51 | 51 |
52 | 52 |
53 void FastNewContextStub::InitializeInterfaceDescriptor( | 53 void FastNewContextStub::InitializeInterfaceDescriptor( |
54 Isolate* isolate, | 54 Isolate* isolate, |
55 CodeStubInterfaceDescriptor* descriptor) { | 55 CodeStubInterfaceDescriptor* descriptor) { |
56 static Register registers[] = { rdi }; | 56 static Register registers[] = { rdi }; |
57 descriptor->register_param_count_ = 1; | 57 descriptor->register_param_count_ = 1; |
58 descriptor->register_params_ = registers; | 58 descriptor->register_params_ = registers; |
59 descriptor->deoptimization_handler_ = NULL; | 59 descriptor->deoptimization_handler_ = NULL; |
(...skipping 21 matching lines...) Expand all Loading... |
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_ = |
91 Runtime::FunctionForId(Runtime::kCreateArrayLiteralStubBailout)->entry; | 91 Runtime::FunctionForId( |
| 92 Runtime::kHiddenCreateArrayLiteralStubBailout)->entry; |
92 } | 93 } |
93 | 94 |
94 | 95 |
95 void FastCloneShallowObjectStub::InitializeInterfaceDescriptor( | 96 void FastCloneShallowObjectStub::InitializeInterfaceDescriptor( |
96 Isolate* isolate, | 97 Isolate* isolate, |
97 CodeStubInterfaceDescriptor* descriptor) { | 98 CodeStubInterfaceDescriptor* descriptor) { |
98 static Register registers[] = { rax, rbx, rcx, rdx }; | 99 static Register registers[] = { rax, rbx, rcx, rdx }; |
99 descriptor->register_param_count_ = 4; | 100 descriptor->register_param_count_ = 4; |
100 descriptor->register_params_ = registers; | 101 descriptor->register_params_ = registers; |
101 descriptor->deoptimization_handler_ = | 102 descriptor->deoptimization_handler_ = |
102 Runtime::FunctionForId(Runtime::kCreateObjectLiteral)->entry; | 103 Runtime::FunctionForId(Runtime::kHiddenCreateObjectLiteral)->entry; |
103 } | 104 } |
104 | 105 |
105 | 106 |
106 void CreateAllocationSiteStub::InitializeInterfaceDescriptor( | 107 void CreateAllocationSiteStub::InitializeInterfaceDescriptor( |
107 Isolate* isolate, | 108 Isolate* isolate, |
108 CodeStubInterfaceDescriptor* descriptor) { | 109 CodeStubInterfaceDescriptor* descriptor) { |
109 static Register registers[] = { rbx, rdx }; | 110 static Register registers[] = { rbx, rdx }; |
110 descriptor->register_param_count_ = 2; | 111 descriptor->register_param_count_ = 2; |
111 descriptor->register_params_ = registers; | 112 descriptor->register_params_ = registers; |
112 descriptor->deoptimization_handler_ = NULL; | 113 descriptor->deoptimization_handler_ = NULL; |
(...skipping 113 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
226 // stack param count needs (constructor pointer, and single argument) | 227 // stack param count needs (constructor pointer, and single argument) |
227 descriptor->handler_arguments_mode_ = PASS_ARGUMENTS; | 228 descriptor->handler_arguments_mode_ = PASS_ARGUMENTS; |
228 descriptor->stack_parameter_count_ = rax; | 229 descriptor->stack_parameter_count_ = rax; |
229 descriptor->register_param_count_ = 3; | 230 descriptor->register_param_count_ = 3; |
230 descriptor->register_params_ = registers_variable_args; | 231 descriptor->register_params_ = registers_variable_args; |
231 } | 232 } |
232 | 233 |
233 descriptor->hint_stack_parameter_count_ = constant_stack_parameter_count; | 234 descriptor->hint_stack_parameter_count_ = constant_stack_parameter_count; |
234 descriptor->function_mode_ = JS_FUNCTION_STUB_MODE; | 235 descriptor->function_mode_ = JS_FUNCTION_STUB_MODE; |
235 descriptor->deoptimization_handler_ = | 236 descriptor->deoptimization_handler_ = |
236 Runtime::FunctionForId(Runtime::kArrayConstructor)->entry; | 237 Runtime::FunctionForId(Runtime::kHiddenArrayConstructor)->entry; |
237 } | 238 } |
238 | 239 |
239 | 240 |
240 static void InitializeInternalArrayConstructorDescriptor( | 241 static void InitializeInternalArrayConstructorDescriptor( |
241 Isolate* isolate, | 242 Isolate* isolate, |
242 CodeStubInterfaceDescriptor* descriptor, | 243 CodeStubInterfaceDescriptor* descriptor, |
243 int constant_stack_parameter_count) { | 244 int constant_stack_parameter_count) { |
244 // register state | 245 // register state |
245 // rax -- number of arguments | 246 // rax -- number of arguments |
246 // rdi -- constructor function | 247 // rdi -- constructor function |
247 static Register registers_variable_args[] = { rdi, rax }; | 248 static Register registers_variable_args[] = { rdi, rax }; |
248 static Register registers_no_args[] = { rdi }; | 249 static Register registers_no_args[] = { rdi }; |
249 | 250 |
250 if (constant_stack_parameter_count == 0) { | 251 if (constant_stack_parameter_count == 0) { |
251 descriptor->register_param_count_ = 1; | 252 descriptor->register_param_count_ = 1; |
252 descriptor->register_params_ = registers_no_args; | 253 descriptor->register_params_ = registers_no_args; |
253 } else { | 254 } else { |
254 // stack param count needs (constructor pointer, and single argument) | 255 // stack param count needs (constructor pointer, and single argument) |
255 descriptor->handler_arguments_mode_ = PASS_ARGUMENTS; | 256 descriptor->handler_arguments_mode_ = PASS_ARGUMENTS; |
256 descriptor->stack_parameter_count_ = rax; | 257 descriptor->stack_parameter_count_ = rax; |
257 descriptor->register_param_count_ = 2; | 258 descriptor->register_param_count_ = 2; |
258 descriptor->register_params_ = registers_variable_args; | 259 descriptor->register_params_ = registers_variable_args; |
259 } | 260 } |
260 | 261 |
261 descriptor->hint_stack_parameter_count_ = constant_stack_parameter_count; | 262 descriptor->hint_stack_parameter_count_ = constant_stack_parameter_count; |
262 descriptor->function_mode_ = JS_FUNCTION_STUB_MODE; | 263 descriptor->function_mode_ = JS_FUNCTION_STUB_MODE; |
263 descriptor->deoptimization_handler_ = | 264 descriptor->deoptimization_handler_ = |
264 Runtime::FunctionForId(Runtime::kInternalArrayConstructor)->entry; | 265 Runtime::FunctionForId(Runtime::kHiddenInternalArrayConstructor)->entry; |
265 } | 266 } |
266 | 267 |
267 | 268 |
268 void ArrayNoArgumentConstructorStub::InitializeInterfaceDescriptor( | 269 void ArrayNoArgumentConstructorStub::InitializeInterfaceDescriptor( |
269 Isolate* isolate, | 270 Isolate* isolate, |
270 CodeStubInterfaceDescriptor* descriptor) { | 271 CodeStubInterfaceDescriptor* descriptor) { |
271 InitializeArrayConstructorDescriptor(isolate, descriptor, 0); | 272 InitializeArrayConstructorDescriptor(isolate, descriptor, 0); |
272 } | 273 } |
273 | 274 |
274 | 275 |
(...skipping 921 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
1196 __ j(less, &arguments_loop, Label::kNear); | 1197 __ j(less, &arguments_loop, Label::kNear); |
1197 | 1198 |
1198 // Return and remove the on-stack parameters. | 1199 // Return and remove the on-stack parameters. |
1199 __ ret(3 * kPointerSize); | 1200 __ ret(3 * kPointerSize); |
1200 | 1201 |
1201 // Do the runtime call to allocate the arguments object. | 1202 // Do the runtime call to allocate the arguments object. |
1202 // rcx = argument count (untagged) | 1203 // rcx = argument count (untagged) |
1203 __ bind(&runtime); | 1204 __ bind(&runtime); |
1204 __ Integer32ToSmi(rcx, rcx); | 1205 __ Integer32ToSmi(rcx, rcx); |
1205 __ movp(args.GetArgumentOperand(2), rcx); // Patch argument count. | 1206 __ movp(args.GetArgumentOperand(2), rcx); // Patch argument count. |
1206 __ TailCallRuntime(Runtime::kNewArgumentsFast, 3, 1); | 1207 __ TailCallRuntime(Runtime::kHiddenNewArgumentsFast, 3, 1); |
1207 } | 1208 } |
1208 | 1209 |
1209 | 1210 |
1210 void ArgumentsAccessStub::GenerateNewSloppySlow(MacroAssembler* masm) { | 1211 void ArgumentsAccessStub::GenerateNewSloppySlow(MacroAssembler* masm) { |
1211 // rsp[0] : return address | 1212 // rsp[0] : return address |
1212 // rsp[8] : number of parameters | 1213 // rsp[8] : number of parameters |
1213 // rsp[16] : receiver displacement | 1214 // rsp[16] : receiver displacement |
1214 // rsp[24] : function | 1215 // rsp[24] : function |
1215 | 1216 |
1216 // Check if the calling frame is an arguments adaptor frame. | 1217 // Check if the calling frame is an arguments adaptor frame. |
1217 Label runtime; | 1218 Label runtime; |
1218 __ movp(rdx, Operand(rbp, StandardFrameConstants::kCallerFPOffset)); | 1219 __ movp(rdx, Operand(rbp, StandardFrameConstants::kCallerFPOffset)); |
1219 __ movp(rcx, Operand(rdx, StandardFrameConstants::kContextOffset)); | 1220 __ movp(rcx, Operand(rdx, StandardFrameConstants::kContextOffset)); |
1220 __ Cmp(rcx, Smi::FromInt(StackFrame::ARGUMENTS_ADAPTOR)); | 1221 __ Cmp(rcx, Smi::FromInt(StackFrame::ARGUMENTS_ADAPTOR)); |
1221 __ j(not_equal, &runtime); | 1222 __ j(not_equal, &runtime); |
1222 | 1223 |
1223 // Patch the arguments.length and the parameters pointer. | 1224 // Patch the arguments.length and the parameters pointer. |
1224 StackArgumentsAccessor args(rsp, 3, ARGUMENTS_DONT_CONTAIN_RECEIVER); | 1225 StackArgumentsAccessor args(rsp, 3, ARGUMENTS_DONT_CONTAIN_RECEIVER); |
1225 __ movp(rcx, Operand(rdx, ArgumentsAdaptorFrameConstants::kLengthOffset)); | 1226 __ movp(rcx, Operand(rdx, ArgumentsAdaptorFrameConstants::kLengthOffset)); |
1226 __ movp(args.GetArgumentOperand(2), rcx); | 1227 __ movp(args.GetArgumentOperand(2), rcx); |
1227 __ SmiToInteger64(rcx, rcx); | 1228 __ SmiToInteger64(rcx, rcx); |
1228 __ lea(rdx, Operand(rdx, rcx, times_pointer_size, | 1229 __ lea(rdx, Operand(rdx, rcx, times_pointer_size, |
1229 StandardFrameConstants::kCallerSPOffset)); | 1230 StandardFrameConstants::kCallerSPOffset)); |
1230 __ movp(args.GetArgumentOperand(1), rdx); | 1231 __ movp(args.GetArgumentOperand(1), rdx); |
1231 | 1232 |
1232 __ bind(&runtime); | 1233 __ bind(&runtime); |
1233 __ TailCallRuntime(Runtime::kNewArgumentsFast, 3, 1); | 1234 __ TailCallRuntime(Runtime::kHiddenNewArgumentsFast, 3, 1); |
1234 } | 1235 } |
1235 | 1236 |
1236 | 1237 |
1237 void ArgumentsAccessStub::GenerateNewStrict(MacroAssembler* masm) { | 1238 void ArgumentsAccessStub::GenerateNewStrict(MacroAssembler* masm) { |
1238 // rsp[0] : return address | 1239 // rsp[0] : return address |
1239 // rsp[8] : number of parameters | 1240 // rsp[8] : number of parameters |
1240 // rsp[16] : receiver displacement | 1241 // rsp[16] : receiver displacement |
1241 // rsp[24] : function | 1242 // rsp[24] : function |
1242 | 1243 |
1243 // Check if the calling frame is an arguments adaptor frame. | 1244 // Check if the calling frame is an arguments adaptor frame. |
(...skipping 80 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
1324 __ subp(rdx, Immediate(kPointerSize)); | 1325 __ subp(rdx, Immediate(kPointerSize)); |
1325 __ decp(rcx); | 1326 __ decp(rcx); |
1326 __ j(not_zero, &loop); | 1327 __ j(not_zero, &loop); |
1327 | 1328 |
1328 // Return and remove the on-stack parameters. | 1329 // Return and remove the on-stack parameters. |
1329 __ bind(&done); | 1330 __ bind(&done); |
1330 __ ret(3 * kPointerSize); | 1331 __ ret(3 * kPointerSize); |
1331 | 1332 |
1332 // Do the runtime call to allocate the arguments object. | 1333 // Do the runtime call to allocate the arguments object. |
1333 __ bind(&runtime); | 1334 __ bind(&runtime); |
1334 __ TailCallRuntime(Runtime::kNewStrictArgumentsFast, 3, 1); | 1335 __ TailCallRuntime(Runtime::kHiddenNewStrictArgumentsFast, 3, 1); |
1335 } | 1336 } |
1336 | 1337 |
1337 | 1338 |
1338 void RegExpExecStub::Generate(MacroAssembler* masm) { | 1339 void RegExpExecStub::Generate(MacroAssembler* masm) { |
1339 // Just jump directly to runtime if native RegExp is not selected at compile | 1340 // Just jump directly to runtime if native RegExp is not selected at compile |
1340 // time or if regexp entry in generated code is turned off runtime switch or | 1341 // time or if regexp entry in generated code is turned off runtime switch or |
1341 // at compilation. | 1342 // at compilation. |
1342 #ifdef V8_INTERPRETED_REGEXP | 1343 #ifdef V8_INTERPRETED_REGEXP |
1343 __ TailCallRuntime(Runtime::kHiddenRegExpExec, 4, 1); | 1344 __ TailCallRuntime(Runtime::kHiddenRegExpExec, 4, 1); |
1344 #else // V8_INTERPRETED_REGEXP | 1345 #else // V8_INTERPRETED_REGEXP |
(...skipping 1657 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
3002 index_not_number_, | 3003 index_not_number_, |
3003 DONT_DO_SMI_CHECK); | 3004 DONT_DO_SMI_CHECK); |
3004 call_helper.BeforeCall(masm); | 3005 call_helper.BeforeCall(masm); |
3005 __ Push(object_); | 3006 __ Push(object_); |
3006 __ Push(index_); // Consumed by runtime conversion function. | 3007 __ Push(index_); // Consumed by runtime conversion function. |
3007 if (index_flags_ == STRING_INDEX_IS_NUMBER) { | 3008 if (index_flags_ == STRING_INDEX_IS_NUMBER) { |
3008 __ CallRuntime(Runtime::kNumberToIntegerMapMinusZero, 1); | 3009 __ CallRuntime(Runtime::kNumberToIntegerMapMinusZero, 1); |
3009 } else { | 3010 } else { |
3010 ASSERT(index_flags_ == STRING_INDEX_IS_ARRAY_INDEX); | 3011 ASSERT(index_flags_ == STRING_INDEX_IS_ARRAY_INDEX); |
3011 // NumberToSmi discards numbers that are not exact integers. | 3012 // NumberToSmi discards numbers that are not exact integers. |
3012 __ CallRuntime(Runtime::kNumberToSmi, 1); | 3013 __ CallRuntime(Runtime::kHiddenNumberToSmi, 1); |
3013 } | 3014 } |
3014 if (!index_.is(rax)) { | 3015 if (!index_.is(rax)) { |
3015 // Save the conversion result before the pop instructions below | 3016 // Save the conversion result before the pop instructions below |
3016 // have a chance to overwrite it. | 3017 // have a chance to overwrite it. |
3017 __ movp(index_, rax); | 3018 __ movp(index_, rax); |
3018 } | 3019 } |
3019 __ Pop(object_); | 3020 __ Pop(object_); |
3020 // Reload the instance type. | 3021 // Reload the instance type. |
3021 __ movp(result_, FieldOperand(object_, HeapObject::kMapOffset)); | 3022 __ movp(result_, FieldOperand(object_, HeapObject::kMapOffset)); |
3022 __ movzxbl(result_, FieldOperand(result_, Map::kInstanceTypeOffset)); | 3023 __ movzxbl(result_, FieldOperand(result_, Map::kInstanceTypeOffset)); |
(...skipping 2191 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
5214 return_value_operand, | 5215 return_value_operand, |
5215 NULL); | 5216 NULL); |
5216 } | 5217 } |
5217 | 5218 |
5218 | 5219 |
5219 #undef __ | 5220 #undef __ |
5220 | 5221 |
5221 } } // namespace v8::internal | 5222 } } // namespace v8::internal |
5222 | 5223 |
5223 #endif // V8_TARGET_ARCH_X64 | 5224 #endif // V8_TARGET_ARCH_X64 |
OLD | NEW |