OLD | NEW |
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" |
(...skipping 2230 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
2241 __ movp(vector, FieldOperand(vector, JSFunction::kSharedFunctionInfoOffset)); | 2241 __ movp(vector, FieldOperand(vector, JSFunction::kSharedFunctionInfoOffset)); |
2242 __ movp(vector, FieldOperand(vector, | 2242 __ movp(vector, FieldOperand(vector, |
2243 SharedFunctionInfo::kFeedbackVectorOffset)); | 2243 SharedFunctionInfo::kFeedbackVectorOffset)); |
2244 } | 2244 } |
2245 | 2245 |
2246 | 2246 |
2247 void CallIC_ArrayStub::Generate(MacroAssembler* masm) { | 2247 void CallIC_ArrayStub::Generate(MacroAssembler* masm) { |
2248 // rdi - function | 2248 // rdi - function |
2249 // rdx - slot id (as integer) | 2249 // rdx - slot id (as integer) |
2250 Label miss; | 2250 Label miss; |
2251 int argc = state_.arg_count(); | 2251 int argc = arg_count(); |
2252 ParameterCount actual(argc); | 2252 ParameterCount actual(argc); |
2253 | 2253 |
2254 EmitLoadTypeFeedbackVector(masm, rbx); | 2254 EmitLoadTypeFeedbackVector(masm, rbx); |
2255 __ SmiToInteger32(rdx, rdx); | 2255 __ SmiToInteger32(rdx, rdx); |
2256 | 2256 |
2257 __ LoadGlobalFunction(Context::ARRAY_FUNCTION_INDEX, rcx); | 2257 __ LoadGlobalFunction(Context::ARRAY_FUNCTION_INDEX, rcx); |
2258 __ cmpp(rdi, rcx); | 2258 __ cmpp(rdi, rcx); |
2259 __ j(not_equal, &miss); | 2259 __ j(not_equal, &miss); |
2260 | 2260 |
2261 __ movp(rax, Immediate(arg_count())); | 2261 __ movp(rax, Immediate(arg_count())); |
(...skipping 24 matching lines...) Expand all Loading... |
2286 | 2286 |
2287 | 2287 |
2288 void CallICStub::Generate(MacroAssembler* masm) { | 2288 void CallICStub::Generate(MacroAssembler* masm) { |
2289 // rdi - function | 2289 // rdi - function |
2290 // rbx - vector | 2290 // rbx - vector |
2291 // rdx - slot id | 2291 // rdx - slot id |
2292 Isolate* isolate = masm->isolate(); | 2292 Isolate* isolate = masm->isolate(); |
2293 Label extra_checks_or_miss, slow_start; | 2293 Label extra_checks_or_miss, slow_start; |
2294 Label slow, non_function, wrap, cont; | 2294 Label slow, non_function, wrap, cont; |
2295 Label have_js_function; | 2295 Label have_js_function; |
2296 int argc = state_.arg_count(); | 2296 int argc = arg_count(); |
2297 StackArgumentsAccessor args(rsp, argc); | 2297 StackArgumentsAccessor args(rsp, argc); |
2298 ParameterCount actual(argc); | 2298 ParameterCount actual(argc); |
2299 | 2299 |
2300 EmitLoadTypeFeedbackVector(masm, rbx); | 2300 EmitLoadTypeFeedbackVector(masm, rbx); |
2301 | 2301 |
2302 // The checks. First, does rdi match the recorded monomorphic target? | 2302 // The checks. First, does rdi match the recorded monomorphic target? |
2303 __ SmiToInteger32(rdx, rdx); | 2303 __ SmiToInteger32(rdx, rdx); |
2304 __ cmpp(rdi, FieldOperand(rbx, rdx, times_pointer_size, | 2304 __ cmpp(rdi, FieldOperand(rbx, rdx, times_pointer_size, |
2305 FixedArray::kHeaderSize)); | 2305 FixedArray::kHeaderSize)); |
2306 __ j(not_equal, &extra_checks_or_miss); | 2306 __ j(not_equal, &extra_checks_or_miss); |
2307 | 2307 |
2308 __ bind(&have_js_function); | 2308 __ bind(&have_js_function); |
2309 if (state_.CallAsMethod()) { | 2309 if (CallAsMethod()) { |
2310 EmitContinueIfStrictOrNative(masm, &cont); | 2310 EmitContinueIfStrictOrNative(masm, &cont); |
2311 | 2311 |
2312 // Load the receiver from the stack. | 2312 // Load the receiver from the stack. |
2313 __ movp(rax, args.GetReceiverOperand()); | 2313 __ movp(rax, args.GetReceiverOperand()); |
2314 | 2314 |
2315 __ JumpIfSmi(rax, &wrap); | 2315 __ JumpIfSmi(rax, &wrap); |
2316 | 2316 |
2317 __ CmpObjectType(rax, FIRST_SPEC_OBJECT_TYPE, rcx); | 2317 __ CmpObjectType(rax, FIRST_SPEC_OBJECT_TYPE, rcx); |
2318 __ j(below, &wrap); | 2318 __ j(below, &wrap); |
2319 | 2319 |
2320 __ bind(&cont); | 2320 __ bind(&cont); |
2321 } | 2321 } |
2322 | 2322 |
2323 __ InvokeFunction(rdi, actual, JUMP_FUNCTION, NullCallWrapper()); | 2323 __ InvokeFunction(rdi, actual, JUMP_FUNCTION, NullCallWrapper()); |
2324 | 2324 |
2325 __ bind(&slow); | 2325 __ bind(&slow); |
2326 EmitSlowCase(isolate, masm, &args, argc, &non_function); | 2326 EmitSlowCase(isolate, masm, &args, argc, &non_function); |
2327 | 2327 |
2328 if (state_.CallAsMethod()) { | 2328 if (CallAsMethod()) { |
2329 __ bind(&wrap); | 2329 __ bind(&wrap); |
2330 EmitWrapCase(masm, &args, &cont); | 2330 EmitWrapCase(masm, &args, &cont); |
2331 } | 2331 } |
2332 | 2332 |
2333 __ bind(&extra_checks_or_miss); | 2333 __ bind(&extra_checks_or_miss); |
2334 Label miss; | 2334 Label miss; |
2335 | 2335 |
2336 __ movp(rcx, FieldOperand(rbx, rdx, times_pointer_size, | 2336 __ movp(rcx, FieldOperand(rbx, rdx, times_pointer_size, |
2337 FixedArray::kHeaderSize)); | 2337 FixedArray::kHeaderSize)); |
2338 __ Cmp(rcx, TypeFeedbackInfo::MegamorphicSentinel(isolate)); | 2338 __ Cmp(rcx, TypeFeedbackInfo::MegamorphicSentinel(isolate)); |
(...skipping 26 matching lines...) Expand all Loading... |
2365 __ j(not_equal, &slow); | 2365 __ j(not_equal, &slow); |
2366 __ jmp(&have_js_function); | 2366 __ jmp(&have_js_function); |
2367 | 2367 |
2368 // Unreachable | 2368 // Unreachable |
2369 __ int3(); | 2369 __ int3(); |
2370 } | 2370 } |
2371 | 2371 |
2372 | 2372 |
2373 void CallICStub::GenerateMiss(MacroAssembler* masm, IC::UtilityId id) { | 2373 void CallICStub::GenerateMiss(MacroAssembler* masm, IC::UtilityId id) { |
2374 // Get the receiver of the function from the stack; 1 ~ return address. | 2374 // Get the receiver of the function from the stack; 1 ~ return address. |
2375 __ movp(rcx, Operand(rsp, (state_.arg_count() + 1) * kPointerSize)); | 2375 __ movp(rcx, Operand(rsp, (arg_count() + 1) * kPointerSize)); |
2376 | 2376 |
2377 { | 2377 { |
2378 FrameScope scope(masm, StackFrame::INTERNAL); | 2378 FrameScope scope(masm, StackFrame::INTERNAL); |
2379 | 2379 |
2380 // Push the receiver and the function and feedback info. | 2380 // Push the receiver and the function and feedback info. |
2381 __ Push(rcx); | 2381 __ Push(rcx); |
2382 __ Push(rdi); | 2382 __ Push(rdi); |
2383 __ Push(rbx); | 2383 __ Push(rbx); |
2384 __ Integer32ToSmi(rdx, rdx); | 2384 __ Integer32ToSmi(rdx, rdx); |
2385 __ Push(rdx); | 2385 __ Push(rdx); |
(...skipping 2589 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
4975 return_value_operand, | 4975 return_value_operand, |
4976 NULL); | 4976 NULL); |
4977 } | 4977 } |
4978 | 4978 |
4979 | 4979 |
4980 #undef __ | 4980 #undef __ |
4981 | 4981 |
4982 } } // namespace v8::internal | 4982 } } // namespace v8::internal |
4983 | 4983 |
4984 #endif // V8_TARGET_ARCH_X64 | 4984 #endif // V8_TARGET_ARCH_X64 |
OLD | NEW |