OLD | NEW |
1 // Copyright 2012 the V8 project authors. All rights reserved. | 1 // Copyright 2012 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_IA32 | 7 #if V8_TARGET_ARCH_IA32 |
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 2348 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
2359 __ mov(vector, FieldOperand(vector, JSFunction::kSharedFunctionInfoOffset)); | 2359 __ mov(vector, FieldOperand(vector, JSFunction::kSharedFunctionInfoOffset)); |
2360 __ mov(vector, FieldOperand(vector, | 2360 __ mov(vector, FieldOperand(vector, |
2361 SharedFunctionInfo::kFeedbackVectorOffset)); | 2361 SharedFunctionInfo::kFeedbackVectorOffset)); |
2362 } | 2362 } |
2363 | 2363 |
2364 | 2364 |
2365 void CallIC_ArrayStub::Generate(MacroAssembler* masm) { | 2365 void CallIC_ArrayStub::Generate(MacroAssembler* masm) { |
2366 // edi - function | 2366 // edi - function |
2367 // edx - slot id | 2367 // edx - slot id |
2368 Label miss; | 2368 Label miss; |
2369 int argc = state_.arg_count(); | 2369 int argc = arg_count(); |
2370 ParameterCount actual(argc); | 2370 ParameterCount actual(argc); |
2371 | 2371 |
2372 EmitLoadTypeFeedbackVector(masm, ebx); | 2372 EmitLoadTypeFeedbackVector(masm, ebx); |
2373 | 2373 |
2374 __ LoadGlobalFunction(Context::ARRAY_FUNCTION_INDEX, ecx); | 2374 __ LoadGlobalFunction(Context::ARRAY_FUNCTION_INDEX, ecx); |
2375 __ cmp(edi, ecx); | 2375 __ cmp(edi, ecx); |
2376 __ j(not_equal, &miss); | 2376 __ j(not_equal, &miss); |
2377 | 2377 |
2378 __ mov(eax, arg_count()); | 2378 __ mov(eax, arg_count()); |
2379 __ mov(ecx, FieldOperand(ebx, edx, times_half_pointer_size, | 2379 __ mov(ecx, FieldOperand(ebx, edx, times_half_pointer_size, |
(...skipping 23 matching lines...) Expand all Loading... |
2403 } | 2403 } |
2404 | 2404 |
2405 | 2405 |
2406 void CallICStub::Generate(MacroAssembler* masm) { | 2406 void CallICStub::Generate(MacroAssembler* masm) { |
2407 // edi - function | 2407 // edi - function |
2408 // edx - slot id | 2408 // edx - slot id |
2409 Isolate* isolate = masm->isolate(); | 2409 Isolate* isolate = masm->isolate(); |
2410 Label extra_checks_or_miss, slow_start; | 2410 Label extra_checks_or_miss, slow_start; |
2411 Label slow, non_function, wrap, cont; | 2411 Label slow, non_function, wrap, cont; |
2412 Label have_js_function; | 2412 Label have_js_function; |
2413 int argc = state_.arg_count(); | 2413 int argc = arg_count(); |
2414 ParameterCount actual(argc); | 2414 ParameterCount actual(argc); |
2415 | 2415 |
2416 EmitLoadTypeFeedbackVector(masm, ebx); | 2416 EmitLoadTypeFeedbackVector(masm, ebx); |
2417 | 2417 |
2418 // The checks. First, does edi match the recorded monomorphic target? | 2418 // The checks. First, does edi match the recorded monomorphic target? |
2419 __ cmp(edi, FieldOperand(ebx, edx, times_half_pointer_size, | 2419 __ cmp(edi, FieldOperand(ebx, edx, times_half_pointer_size, |
2420 FixedArray::kHeaderSize)); | 2420 FixedArray::kHeaderSize)); |
2421 __ j(not_equal, &extra_checks_or_miss); | 2421 __ j(not_equal, &extra_checks_or_miss); |
2422 | 2422 |
2423 __ bind(&have_js_function); | 2423 __ bind(&have_js_function); |
2424 if (state_.CallAsMethod()) { | 2424 if (CallAsMethod()) { |
2425 EmitContinueIfStrictOrNative(masm, &cont); | 2425 EmitContinueIfStrictOrNative(masm, &cont); |
2426 | 2426 |
2427 // Load the receiver from the stack. | 2427 // Load the receiver from the stack. |
2428 __ mov(eax, Operand(esp, (argc + 1) * kPointerSize)); | 2428 __ mov(eax, Operand(esp, (argc + 1) * kPointerSize)); |
2429 | 2429 |
2430 __ JumpIfSmi(eax, &wrap); | 2430 __ JumpIfSmi(eax, &wrap); |
2431 | 2431 |
2432 __ CmpObjectType(eax, FIRST_SPEC_OBJECT_TYPE, ecx); | 2432 __ CmpObjectType(eax, FIRST_SPEC_OBJECT_TYPE, ecx); |
2433 __ j(below, &wrap); | 2433 __ j(below, &wrap); |
2434 | 2434 |
2435 __ bind(&cont); | 2435 __ bind(&cont); |
2436 } | 2436 } |
2437 | 2437 |
2438 __ InvokeFunction(edi, actual, JUMP_FUNCTION, NullCallWrapper()); | 2438 __ InvokeFunction(edi, actual, JUMP_FUNCTION, NullCallWrapper()); |
2439 | 2439 |
2440 __ bind(&slow); | 2440 __ bind(&slow); |
2441 EmitSlowCase(isolate, masm, argc, &non_function); | 2441 EmitSlowCase(isolate, masm, argc, &non_function); |
2442 | 2442 |
2443 if (state_.CallAsMethod()) { | 2443 if (CallAsMethod()) { |
2444 __ bind(&wrap); | 2444 __ bind(&wrap); |
2445 EmitWrapCase(masm, argc, &cont); | 2445 EmitWrapCase(masm, argc, &cont); |
2446 } | 2446 } |
2447 | 2447 |
2448 __ bind(&extra_checks_or_miss); | 2448 __ bind(&extra_checks_or_miss); |
2449 Label miss; | 2449 Label miss; |
2450 | 2450 |
2451 __ mov(ecx, FieldOperand(ebx, edx, times_half_pointer_size, | 2451 __ mov(ecx, FieldOperand(ebx, edx, times_half_pointer_size, |
2452 FixedArray::kHeaderSize)); | 2452 FixedArray::kHeaderSize)); |
2453 __ cmp(ecx, Immediate(TypeFeedbackInfo::MegamorphicSentinel(isolate))); | 2453 __ cmp(ecx, Immediate(TypeFeedbackInfo::MegamorphicSentinel(isolate))); |
(...skipping 28 matching lines...) Expand all Loading... |
2482 __ j(not_equal, &slow); | 2482 __ j(not_equal, &slow); |
2483 __ jmp(&have_js_function); | 2483 __ jmp(&have_js_function); |
2484 | 2484 |
2485 // Unreachable | 2485 // Unreachable |
2486 __ int3(); | 2486 __ int3(); |
2487 } | 2487 } |
2488 | 2488 |
2489 | 2489 |
2490 void CallICStub::GenerateMiss(MacroAssembler* masm, IC::UtilityId id) { | 2490 void CallICStub::GenerateMiss(MacroAssembler* masm, IC::UtilityId id) { |
2491 // Get the receiver of the function from the stack; 1 ~ return address. | 2491 // Get the receiver of the function from the stack; 1 ~ return address. |
2492 __ mov(ecx, Operand(esp, (state_.arg_count() + 1) * kPointerSize)); | 2492 __ mov(ecx, Operand(esp, (arg_count() + 1) * kPointerSize)); |
2493 | 2493 |
2494 { | 2494 { |
2495 FrameScope scope(masm, StackFrame::INTERNAL); | 2495 FrameScope scope(masm, StackFrame::INTERNAL); |
2496 | 2496 |
2497 // Push the receiver and the function and feedback info. | 2497 // Push the receiver and the function and feedback info. |
2498 __ push(ecx); | 2498 __ push(ecx); |
2499 __ push(edi); | 2499 __ push(edi); |
2500 __ push(ebx); | 2500 __ push(ebx); |
2501 __ push(edx); | 2501 __ push(edx); |
2502 | 2502 |
(...skipping 2501 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
5004 Operand(ebp, 7 * kPointerSize), | 5004 Operand(ebp, 7 * kPointerSize), |
5005 NULL); | 5005 NULL); |
5006 } | 5006 } |
5007 | 5007 |
5008 | 5008 |
5009 #undef __ | 5009 #undef __ |
5010 | 5010 |
5011 } } // namespace v8::internal | 5011 } } // namespace v8::internal |
5012 | 5012 |
5013 #endif // V8_TARGET_ARCH_IA32 | 5013 #endif // V8_TARGET_ARCH_IA32 |
OLD | NEW |