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

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

Issue 131663003: Make the strict-mode calling convention for contextual calls the default one. (Closed) Base URL: https://v8.googlecode.com/svn/branches/bleeding_edge
Patch Set: Fix arm port Created 6 years, 11 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
« no previous file with comments | « src/ia32/builtins-ia32.cc ('k') | src/ia32/full-codegen-ia32.cc » ('j') | no next file with comments »
Toggle Intra-line Diffs ('i') | Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
OLDNEW
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 2502 matching lines...) Expand 10 before | Expand all | Expand 10 after
2513 2513
2514 void CallFunctionStub::Generate(MacroAssembler* masm) { 2514 void CallFunctionStub::Generate(MacroAssembler* masm) {
2515 // ebx : cache cell for call target 2515 // ebx : cache cell for call target
2516 // edi : the function to call 2516 // edi : the function to call
2517 Isolate* isolate = masm->isolate(); 2517 Isolate* isolate = masm->isolate();
2518 Label slow, non_function; 2518 Label slow, non_function;
2519 2519
2520 // Check that the function really is a JavaScript function. 2520 // Check that the function really is a JavaScript function.
2521 __ JumpIfSmi(edi, &non_function); 2521 __ JumpIfSmi(edi, &non_function);
2522 2522
2523 // The receiver might implicitly be the global object. This is 2523 // Goto slow case if we do not have a function.
2524 // indicated by passing the hole as the receiver to the call 2524 __ CmpObjectType(edi, JS_FUNCTION_TYPE, ecx);
2525 // function stub. 2525 __ j(not_equal, &slow);
2526 if (ReceiverMightBeImplicit() || ReceiverIsImplicit()) {
2527 Label try_call, call, patch_current_context;
2528 if (ReceiverMightBeImplicit()) {
2529 // Get the receiver from the stack.
2530 // +1 ~ return address
2531 __ mov(eax, Operand(esp, (argc_ + 1) * kPointerSize));
2532 // Call as function is indicated with the hole.
2533 __ cmp(eax, isolate->factory()->the_hole_value());
2534 __ j(not_equal, &try_call, Label::kNear);
2535 }
2536 // Patch the receiver on the stack with the global receiver object.
2537 // Goto slow case if we do not have a function.
2538 __ CmpObjectType(edi, JS_FUNCTION_TYPE, ecx);
2539 __ j(not_equal, &patch_current_context);
2540 CallStubCompiler::FetchGlobalProxy(masm, ecx, edi);
2541 __ mov(Operand(esp, (argc_ + 1) * kPointerSize), ecx);
2542 __ jmp(&call, Label::kNear);
2543
2544 __ bind(&patch_current_context);
2545 __ mov(edx, isolate->factory()->undefined_value());
2546 __ mov(Operand(esp, (argc_ + 1) * kPointerSize), edx);
2547 __ jmp(&slow);
2548
2549 __ bind(&try_call);
2550 // Goto slow case if we do not have a function.
2551 __ CmpObjectType(edi, JS_FUNCTION_TYPE, ecx);
2552 __ j(not_equal, &slow);
2553
2554 __ bind(&call);
2555 } else {
2556 // Goto slow case if we do not have a function.
2557 __ CmpObjectType(edi, JS_FUNCTION_TYPE, ecx);
2558 __ j(not_equal, &slow);
2559 }
2560 2526
2561 if (RecordCallTarget()) { 2527 if (RecordCallTarget()) {
2562 GenerateRecordCallTarget(masm); 2528 GenerateRecordCallTarget(masm);
2563 } 2529 }
2564 2530
2565 // Fast-case: Just invoke the function. 2531 // Fast-case: Just invoke the function.
2566 ParameterCount actual(argc_); 2532 ParameterCount actual(argc_);
2567 2533
2568 if (ReceiverMightBeImplicit()) {
2569 Label call_as_function;
2570 __ cmp(eax, isolate->factory()->the_hole_value());
2571 __ j(equal, &call_as_function);
2572 __ InvokeFunction(edi,
2573 actual,
2574 JUMP_FUNCTION,
2575 NullCallWrapper(),
2576 CALL_AS_METHOD);
2577 __ bind(&call_as_function);
2578 }
2579 __ InvokeFunction(edi, 2534 __ InvokeFunction(edi,
2580 actual, 2535 actual,
2581 JUMP_FUNCTION, 2536 JUMP_FUNCTION,
2582 NullCallWrapper(), 2537 NullCallWrapper(),
2583 CALL_AS_FUNCTION); 2538 CALL_AS_FUNCTION);
2584 2539
2585 // Slow-case: Non-function called. 2540 // Slow-case: Non-function called.
2586 __ bind(&slow); 2541 __ bind(&slow);
2587 if (RecordCallTarget()) { 2542 if (RecordCallTarget()) {
2588 // If there is a call target cache, mark it megamorphic in the 2543 // If there is a call target cache, mark it megamorphic in the
(...skipping 16 matching lines...) Expand all
2605 Handle<Code> adaptor = isolate->builtins()->ArgumentsAdaptorTrampoline(); 2560 Handle<Code> adaptor = isolate->builtins()->ArgumentsAdaptorTrampoline();
2606 __ jmp(adaptor, RelocInfo::CODE_TARGET); 2561 __ jmp(adaptor, RelocInfo::CODE_TARGET);
2607 } 2562 }
2608 2563
2609 // CALL_NON_FUNCTION expects the non-function callee as receiver (instead 2564 // CALL_NON_FUNCTION expects the non-function callee as receiver (instead
2610 // of the original receiver from the call site). 2565 // of the original receiver from the call site).
2611 __ bind(&non_function); 2566 __ bind(&non_function);
2612 __ mov(Operand(esp, (argc_ + 1) * kPointerSize), edi); 2567 __ mov(Operand(esp, (argc_ + 1) * kPointerSize), edi);
2613 __ Set(eax, Immediate(argc_)); 2568 __ Set(eax, Immediate(argc_));
2614 __ Set(ebx, Immediate(0)); 2569 __ Set(ebx, Immediate(0));
2615 __ SetCallKind(ecx, CALL_AS_METHOD); 2570 __ SetCallKind(ecx, CALL_AS_FUNCTION);
2616 __ GetBuiltinEntry(edx, Builtins::CALL_NON_FUNCTION); 2571 __ GetBuiltinEntry(edx, Builtins::CALL_NON_FUNCTION);
2617 Handle<Code> adaptor = isolate->builtins()->ArgumentsAdaptorTrampoline(); 2572 Handle<Code> adaptor = isolate->builtins()->ArgumentsAdaptorTrampoline();
2618 __ jmp(adaptor, RelocInfo::CODE_TARGET); 2573 __ jmp(adaptor, RelocInfo::CODE_TARGET);
2619 } 2574 }
2620 2575
2621 2576
2622 void CallConstructStub::Generate(MacroAssembler* masm) { 2577 void CallConstructStub::Generate(MacroAssembler* masm) {
2623 // eax : number of arguments 2578 // eax : number of arguments
2624 // ebx : cache cell for call target 2579 // ebx : cache cell for call target
2625 // edi : constructor function 2580 // edi : constructor function
(...skipping 3096 matching lines...) Expand 10 before | Expand all | Expand 10 after
5722 __ bind(&fast_elements_case); 5677 __ bind(&fast_elements_case);
5723 GenerateCase(masm, FAST_ELEMENTS); 5678 GenerateCase(masm, FAST_ELEMENTS);
5724 } 5679 }
5725 5680
5726 5681
5727 #undef __ 5682 #undef __
5728 5683
5729 } } // namespace v8::internal 5684 } } // namespace v8::internal
5730 5685
5731 #endif // V8_TARGET_ARCH_IA32 5686 #endif // V8_TARGET_ARCH_IA32
OLDNEW
« no previous file with comments | « src/ia32/builtins-ia32.cc ('k') | src/ia32/full-codegen-ia32.cc » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698