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

Side by Side Diff: src/ia32/builtins-ia32.cc

Issue 6524006: Strict mode function entry (Function.prototype.call/apply) (Closed) Base URL: https://v8.googlecode.com/svn/branches/bleeding_edge
Patch Set: Created 9 years, 10 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
OLDNEW
1 // Copyright 2010 the V8 project authors. All rights reserved. 1 // Copyright 2010 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 571 matching lines...) Expand 10 before | Expand all | Expand 10 after
582 __ CmpObjectType(edi, JS_FUNCTION_TYPE, ecx); 582 __ CmpObjectType(edi, JS_FUNCTION_TYPE, ecx);
583 __ j(not_equal, &non_function, not_taken); 583 __ j(not_equal, &non_function, not_taken);
584 584
585 585
586 // 3a. Patch the first argument if necessary when calling a function. 586 // 3a. Patch the first argument if necessary when calling a function.
587 Label shift_arguments; 587 Label shift_arguments;
588 { Label convert_to_object, use_global_receiver, patch_receiver; 588 { Label convert_to_object, use_global_receiver, patch_receiver;
589 // Change context eagerly in case we need the global receiver. 589 // Change context eagerly in case we need the global receiver.
590 __ mov(esi, FieldOperand(edi, JSFunction::kContextOffset)); 590 __ mov(esi, FieldOperand(edi, JSFunction::kContextOffset));
591 591
592 // Do not transform the receiver for strict mode functions.
593 __ mov(ebx, FieldOperand(edi, JSFunction::kSharedFunctionInfoOffset));
594 __ mov(ebx, FieldOperand(ebx, SharedFunctionInfo::kCompilerHintsOffset));
595 __ test(ebx, Immediate(1 << (SharedFunctionInfo::kStrictModeFunction +
596 kSmiTagSize)));
597 __ j(not_equal, &shift_arguments);
598
599 // Compute the receiver in non-strict mode.
592 __ mov(ebx, Operand(esp, eax, times_4, 0)); // First argument. 600 __ mov(ebx, Operand(esp, eax, times_4, 0)); // First argument.
593 __ test(ebx, Immediate(kSmiTagMask)); 601 __ test(ebx, Immediate(kSmiTagMask));
594 __ j(zero, &convert_to_object); 602 __ j(zero, &convert_to_object);
595 603
596 __ cmp(ebx, Factory::null_value()); 604 __ cmp(ebx, Factory::null_value());
597 __ j(equal, &use_global_receiver); 605 __ j(equal, &use_global_receiver);
598 __ cmp(ebx, Factory::undefined_value()); 606 __ cmp(ebx, Factory::undefined_value());
599 __ j(equal, &use_global_receiver); 607 __ j(equal, &use_global_receiver);
600 608
601 // We don't use IsObjectJSObjectType here because we jump on success. 609 // We don't use IsObjectJSObjectType here because we jump on success.
(...skipping 127 matching lines...) Expand 10 before | Expand all | Expand 10 after
729 __ push(Immediate(0)); // index 737 __ push(Immediate(0)); // index
730 738
731 // Change context eagerly to get the right global object if 739 // Change context eagerly to get the right global object if
732 // necessary. 740 // necessary.
733 __ mov(edi, Operand(ebp, 4 * kPointerSize)); 741 __ mov(edi, Operand(ebp, 4 * kPointerSize));
734 __ mov(esi, FieldOperand(edi, JSFunction::kContextOffset)); 742 __ mov(esi, FieldOperand(edi, JSFunction::kContextOffset));
735 743
736 // Compute the receiver. 744 // Compute the receiver.
737 Label call_to_object, use_global_receiver, push_receiver; 745 Label call_to_object, use_global_receiver, push_receiver;
738 __ mov(ebx, Operand(ebp, 3 * kPointerSize)); 746 __ mov(ebx, Operand(ebp, 3 * kPointerSize));
747
748 // Do not transform the receiver for strict mode functions.
749 __ mov(ecx, FieldOperand(edi, JSFunction::kSharedFunctionInfoOffset));
750 __ mov(ecx, FieldOperand(ecx, SharedFunctionInfo::kCompilerHintsOffset));
751 __ test(ecx, Immediate(1 << (SharedFunctionInfo::kStrictModeFunction +
752 kSmiTagSize)));
Lasse Reichstein 2011/02/15 08:46:55 You can test directly against memory, without load
Mads Ager (chromium) 2011/02/15 08:50:12 If you do use the byte version, please introduce s
Martin Maly 2011/02/15 19:18:43 Done.
753 __ j(not_equal, &push_receiver);
754
755 // Compute the receiver in non-strict mode.
739 __ test(ebx, Immediate(kSmiTagMask)); 756 __ test(ebx, Immediate(kSmiTagMask));
740 __ j(zero, &call_to_object); 757 __ j(zero, &call_to_object);
741 __ cmp(ebx, Factory::null_value()); 758 __ cmp(ebx, Factory::null_value());
742 __ j(equal, &use_global_receiver); 759 __ j(equal, &use_global_receiver);
743 __ cmp(ebx, Factory::undefined_value()); 760 __ cmp(ebx, Factory::undefined_value());
744 __ j(equal, &use_global_receiver); 761 __ j(equal, &use_global_receiver);
745 762
746 // If given receiver is already a JavaScript object then there's no 763 // If given receiver is already a JavaScript object then there's no
747 // reason for converting it. 764 // reason for converting it.
748 // We don't use IsObjectJSObjectType here because we jump on success. 765 // We don't use IsObjectJSObjectType here because we jump on success.
(...skipping 817 matching lines...) Expand 10 before | Expand all | Expand 10 after
1566 Deoptimizer::EntryGenerator generator(masm, Deoptimizer::OSR); 1583 Deoptimizer::EntryGenerator generator(masm, Deoptimizer::OSR);
1567 generator.Generate(); 1584 generator.Generate();
1568 } 1585 }
1569 1586
1570 1587
1571 #undef __ 1588 #undef __
1572 1589
1573 } } // namespace v8::internal 1590 } } // namespace v8::internal
1574 1591
1575 #endif // V8_TARGET_ARCH_IA32 1592 #endif // V8_TARGET_ARCH_IA32
OLDNEW
« no previous file with comments | « src/arm/builtins-arm.cc ('k') | src/objects.h » ('j') | src/objects.h » ('J')

Powered by Google App Engine
This is Rietveld 408576698