| OLD | NEW | 
|---|
| 1 // Copyright 2012 the V8 project authors. All rights reserved. | 1 // Copyright 2012 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 2513 matching lines...) Expand 10 before | Expand all | Expand 10 after  Loading... | 
| 2524   __ CmpObjectType(edi, JS_FUNCTION_TYPE, ecx); | 2524   __ CmpObjectType(edi, JS_FUNCTION_TYPE, ecx); | 
| 2525   __ j(not_equal, &slow); | 2525   __ j(not_equal, &slow); | 
| 2526 | 2526 | 
| 2527   if (RecordCallTarget()) { | 2527   if (RecordCallTarget()) { | 
| 2528     GenerateRecordCallTarget(masm); | 2528     GenerateRecordCallTarget(masm); | 
| 2529   } | 2529   } | 
| 2530 | 2530 | 
| 2531   // Fast-case: Just invoke the function. | 2531   // Fast-case: Just invoke the function. | 
| 2532   ParameterCount actual(argc_); | 2532   ParameterCount actual(argc_); | 
| 2533 | 2533 | 
| 2534   __ InvokeFunction(edi, | 2534   __ InvokeFunction(edi, actual, JUMP_FUNCTION, NullCallWrapper()); | 
| 2535                     actual, |  | 
| 2536                     JUMP_FUNCTION, |  | 
| 2537                     NullCallWrapper(), |  | 
| 2538                     CALL_AS_FUNCTION); |  | 
| 2539 | 2535 | 
| 2540   // Slow-case: Non-function called. | 2536   // Slow-case: Non-function called. | 
| 2541   __ bind(&slow); | 2537   __ bind(&slow); | 
| 2542   if (RecordCallTarget()) { | 2538   if (RecordCallTarget()) { | 
| 2543     // If there is a call target cache, mark it megamorphic in the | 2539     // If there is a call target cache, mark it megamorphic in the | 
| 2544     // non-function case.  MegamorphicSentinel is an immortal immovable | 2540     // non-function case.  MegamorphicSentinel is an immortal immovable | 
| 2545     // object (undefined) so no write barrier is needed. | 2541     // object (undefined) so no write barrier is needed. | 
| 2546     __ mov(FieldOperand(ebx, Cell::kValueOffset), | 2542     __ mov(FieldOperand(ebx, Cell::kValueOffset), | 
| 2547            Immediate(TypeFeedbackCells::MegamorphicSentinel(isolate))); | 2543            Immediate(TypeFeedbackCells::MegamorphicSentinel(isolate))); | 
| 2548   } | 2544   } | 
| 2549   // Check for function proxy. | 2545   // Check for function proxy. | 
| 2550   __ CmpInstanceType(ecx, JS_FUNCTION_PROXY_TYPE); | 2546   __ CmpInstanceType(ecx, JS_FUNCTION_PROXY_TYPE); | 
| 2551   __ j(not_equal, &non_function); | 2547   __ j(not_equal, &non_function); | 
| 2552   __ pop(ecx); | 2548   __ pop(ecx); | 
| 2553   __ push(edi);  // put proxy as additional argument under return address | 2549   __ push(edi);  // put proxy as additional argument under return address | 
| 2554   __ push(ecx); | 2550   __ push(ecx); | 
| 2555   __ Set(eax, Immediate(argc_ + 1)); | 2551   __ Set(eax, Immediate(argc_ + 1)); | 
| 2556   __ Set(ebx, Immediate(0)); | 2552   __ Set(ebx, Immediate(0)); | 
| 2557   __ SetCallKind(ecx, CALL_AS_FUNCTION); |  | 
| 2558   __ GetBuiltinEntry(edx, Builtins::CALL_FUNCTION_PROXY); | 2553   __ GetBuiltinEntry(edx, Builtins::CALL_FUNCTION_PROXY); | 
| 2559   { | 2554   { | 
| 2560     Handle<Code> adaptor = isolate->builtins()->ArgumentsAdaptorTrampoline(); | 2555     Handle<Code> adaptor = isolate->builtins()->ArgumentsAdaptorTrampoline(); | 
| 2561     __ jmp(adaptor, RelocInfo::CODE_TARGET); | 2556     __ jmp(adaptor, RelocInfo::CODE_TARGET); | 
| 2562   } | 2557   } | 
| 2563 | 2558 | 
| 2564   // CALL_NON_FUNCTION expects the non-function callee as receiver (instead | 2559   // CALL_NON_FUNCTION expects the non-function callee as receiver (instead | 
| 2565   // of the original receiver from the call site). | 2560   // of the original receiver from the call site). | 
| 2566   __ bind(&non_function); | 2561   __ bind(&non_function); | 
| 2567   __ mov(Operand(esp, (argc_ + 1) * kPointerSize), edi); | 2562   __ mov(Operand(esp, (argc_ + 1) * kPointerSize), edi); | 
| 2568   __ Set(eax, Immediate(argc_)); | 2563   __ Set(eax, Immediate(argc_)); | 
| 2569   __ Set(ebx, Immediate(0)); | 2564   __ Set(ebx, Immediate(0)); | 
| 2570   __ SetCallKind(ecx, CALL_AS_FUNCTION); |  | 
| 2571   __ GetBuiltinEntry(edx, Builtins::CALL_NON_FUNCTION); | 2565   __ GetBuiltinEntry(edx, Builtins::CALL_NON_FUNCTION); | 
| 2572   Handle<Code> adaptor = isolate->builtins()->ArgumentsAdaptorTrampoline(); | 2566   Handle<Code> adaptor = isolate->builtins()->ArgumentsAdaptorTrampoline(); | 
| 2573   __ jmp(adaptor, RelocInfo::CODE_TARGET); | 2567   __ jmp(adaptor, RelocInfo::CODE_TARGET); | 
| 2574 } | 2568 } | 
| 2575 | 2569 | 
| 2576 | 2570 | 
| 2577 void CallConstructStub::Generate(MacroAssembler* masm) { | 2571 void CallConstructStub::Generate(MacroAssembler* masm) { | 
| 2578   // eax : number of arguments | 2572   // eax : number of arguments | 
| 2579   // ebx : cache cell for call target | 2573   // ebx : cache cell for call target | 
| 2580   // edi : constructor function | 2574   // edi : constructor function | 
| (...skipping 27 matching lines...) Expand all  Loading... | 
| 2608   __ GetBuiltinEntry(edx, Builtins::CALL_FUNCTION_PROXY_AS_CONSTRUCTOR); | 2602   __ GetBuiltinEntry(edx, Builtins::CALL_FUNCTION_PROXY_AS_CONSTRUCTOR); | 
| 2609   __ jmp(&do_call); | 2603   __ jmp(&do_call); | 
| 2610 | 2604 | 
| 2611   __ bind(&non_function_call); | 2605   __ bind(&non_function_call); | 
| 2612   __ GetBuiltinEntry(edx, Builtins::CALL_NON_FUNCTION_AS_CONSTRUCTOR); | 2606   __ GetBuiltinEntry(edx, Builtins::CALL_NON_FUNCTION_AS_CONSTRUCTOR); | 
| 2613   __ bind(&do_call); | 2607   __ bind(&do_call); | 
| 2614   // Set expected number of arguments to zero (not changing eax). | 2608   // Set expected number of arguments to zero (not changing eax). | 
| 2615   __ Set(ebx, Immediate(0)); | 2609   __ Set(ebx, Immediate(0)); | 
| 2616   Handle<Code> arguments_adaptor = | 2610   Handle<Code> arguments_adaptor = | 
| 2617       masm->isolate()->builtins()->ArgumentsAdaptorTrampoline(); | 2611       masm->isolate()->builtins()->ArgumentsAdaptorTrampoline(); | 
| 2618   __ SetCallKind(ecx, CALL_AS_METHOD); |  | 
| 2619   __ jmp(arguments_adaptor, RelocInfo::CODE_TARGET); | 2612   __ jmp(arguments_adaptor, RelocInfo::CODE_TARGET); | 
| 2620 } | 2613 } | 
| 2621 | 2614 | 
| 2622 | 2615 | 
| 2623 bool CEntryStub::NeedsImmovableCode() { | 2616 bool CEntryStub::NeedsImmovableCode() { | 
| 2624   return false; | 2617   return false; | 
| 2625 } | 2618 } | 
| 2626 | 2619 | 
| 2627 | 2620 | 
| 2628 void CodeStub::GenerateStubsAheadOfTime(Isolate* isolate) { | 2621 void CodeStub::GenerateStubsAheadOfTime(Isolate* isolate) { | 
| (...skipping 2678 matching lines...) Expand 10 before | Expand all | Expand 10 after  Loading... | 
| 5307   __ mov(edi, eax); | 5300   __ mov(edi, eax); | 
| 5308   int parameter_count_offset = | 5301   int parameter_count_offset = | 
| 5309       StubFailureTrampolineFrame::kCallerStackParameterCountFrameOffset; | 5302       StubFailureTrampolineFrame::kCallerStackParameterCountFrameOffset; | 
| 5310   __ mov(eax, MemOperand(ebp, parameter_count_offset)); | 5303   __ mov(eax, MemOperand(ebp, parameter_count_offset)); | 
| 5311   // The parameter count above includes the receiver for the arguments passed to | 5304   // The parameter count above includes the receiver for the arguments passed to | 
| 5312   // the deoptimization handler. Subtract the receiver for the parameter count | 5305   // the deoptimization handler. Subtract the receiver for the parameter count | 
| 5313   // for the call. | 5306   // for the call. | 
| 5314   __ sub(eax, Immediate(1)); | 5307   __ sub(eax, Immediate(1)); | 
| 5315   masm->LeaveFrame(StackFrame::STUB_FAILURE_TRAMPOLINE); | 5308   masm->LeaveFrame(StackFrame::STUB_FAILURE_TRAMPOLINE); | 
| 5316   ParameterCount argument_count(eax); | 5309   ParameterCount argument_count(eax); | 
| 5317   __ InvokeFunction( | 5310   __ InvokeFunction(edi, argument_count, JUMP_FUNCTION, NullCallWrapper()); | 
| 5318       edi, argument_count, JUMP_FUNCTION, NullCallWrapper(), CALL_AS_METHOD); |  | 
| 5319 } | 5311 } | 
| 5320 | 5312 | 
| 5321 | 5313 | 
| 5322 void ProfileEntryHookStub::MaybeCallEntryHook(MacroAssembler* masm) { | 5314 void ProfileEntryHookStub::MaybeCallEntryHook(MacroAssembler* masm) { | 
| 5323   if (masm->isolate()->function_entry_hook() != NULL) { | 5315   if (masm->isolate()->function_entry_hook() != NULL) { | 
| 5324     ProfileEntryHookStub stub; | 5316     ProfileEntryHookStub stub; | 
| 5325     masm->CallStub(&stub); | 5317     masm->CallStub(&stub); | 
| 5326   } | 5318   } | 
| 5327 } | 5319 } | 
| 5328 | 5320 | 
| (...skipping 348 matching lines...) Expand 10 before | Expand all | Expand 10 after  Loading... | 
| 5677   __ bind(&fast_elements_case); | 5669   __ bind(&fast_elements_case); | 
| 5678   GenerateCase(masm, FAST_ELEMENTS); | 5670   GenerateCase(masm, FAST_ELEMENTS); | 
| 5679 } | 5671 } | 
| 5680 | 5672 | 
| 5681 | 5673 | 
| 5682 #undef __ | 5674 #undef __ | 
| 5683 | 5675 | 
| 5684 } }  // namespace v8::internal | 5676 } }  // namespace v8::internal | 
| 5685 | 5677 | 
| 5686 #endif  // V8_TARGET_ARCH_IA32 | 5678 #endif  // V8_TARGET_ARCH_IA32 | 
| OLD | NEW | 
|---|