Chromium Code Reviews| OLD | NEW |
|---|---|
| 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 624 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... | |
| 635 __ JumpIfSmi(rdi, &non_function); | 635 __ JumpIfSmi(rdi, &non_function); |
| 636 __ CmpObjectType(rdi, JS_FUNCTION_TYPE, rcx); | 636 __ CmpObjectType(rdi, JS_FUNCTION_TYPE, rcx); |
| 637 __ j(not_equal, &non_function); | 637 __ j(not_equal, &non_function); |
| 638 | 638 |
| 639 // 3a. Patch the first argument if necessary when calling a function. | 639 // 3a. Patch the first argument if necessary when calling a function. |
| 640 Label shift_arguments; | 640 Label shift_arguments; |
| 641 { Label convert_to_object, use_global_receiver, patch_receiver; | 641 { Label convert_to_object, use_global_receiver, patch_receiver; |
| 642 // Change context eagerly in case we need the global receiver. | 642 // Change context eagerly in case we need the global receiver. |
| 643 __ movq(rsi, FieldOperand(rdi, JSFunction::kContextOffset)); | 643 __ movq(rsi, FieldOperand(rdi, JSFunction::kContextOffset)); |
| 644 | 644 |
| 645 // Do not transform the receiver for strict mode functions. | |
| 646 __ movq(rbx, FieldOperand(rdi, JSFunction::kSharedFunctionInfoOffset)); | |
| 647 __ movl(rbx, FieldOperand(rbx, SharedFunctionInfo::kCompilerHintsOffset)); | |
| 648 __ testl(rbx, Immediate(1 << SharedFunctionInfo::kStrictModeFunction)); | |
| 649 __ j(not_equal, &shift_arguments); | |
| 650 | |
| 651 // Compute the receiver in non-strict mode. | |
|
Martin Maly
2011/02/15 05:14:00
Tricky ... on 64 bit the fields in SharedFunctionI
| |
| 645 __ movq(rbx, Operand(rsp, rax, times_pointer_size, 0)); | 652 __ movq(rbx, Operand(rsp, rax, times_pointer_size, 0)); |
| 646 __ JumpIfSmi(rbx, &convert_to_object); | 653 __ JumpIfSmi(rbx, &convert_to_object); |
| 647 | 654 |
| 648 __ CompareRoot(rbx, Heap::kNullValueRootIndex); | 655 __ CompareRoot(rbx, Heap::kNullValueRootIndex); |
| 649 __ j(equal, &use_global_receiver); | 656 __ j(equal, &use_global_receiver); |
| 650 __ CompareRoot(rbx, Heap::kUndefinedValueRootIndex); | 657 __ CompareRoot(rbx, Heap::kUndefinedValueRootIndex); |
| 651 __ j(equal, &use_global_receiver); | 658 __ j(equal, &use_global_receiver); |
| 652 | 659 |
| 653 __ CmpObjectType(rbx, FIRST_JS_OBJECT_TYPE, rcx); | 660 __ CmpObjectType(rbx, FIRST_JS_OBJECT_TYPE, rcx); |
| 654 __ j(below, &convert_to_object); | 661 __ j(below, &convert_to_object); |
| (...skipping 136 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... | |
| 791 __ push(Immediate(0)); // index | 798 __ push(Immediate(0)); // index |
| 792 | 799 |
| 793 // Change context eagerly to get the right global object if | 800 // Change context eagerly to get the right global object if |
| 794 // necessary. | 801 // necessary. |
| 795 __ movq(rdi, Operand(rbp, kFunctionOffset)); | 802 __ movq(rdi, Operand(rbp, kFunctionOffset)); |
| 796 __ movq(rsi, FieldOperand(rdi, JSFunction::kContextOffset)); | 803 __ movq(rsi, FieldOperand(rdi, JSFunction::kContextOffset)); |
| 797 | 804 |
| 798 // Compute the receiver. | 805 // Compute the receiver. |
| 799 Label call_to_object, use_global_receiver, push_receiver; | 806 Label call_to_object, use_global_receiver, push_receiver; |
| 800 __ movq(rbx, Operand(rbp, kReceiverOffset)); | 807 __ movq(rbx, Operand(rbp, kReceiverOffset)); |
| 808 | |
| 809 // Do not transform the receiver for strict mode functions. | |
| 810 __ movq(rdx, FieldOperand(rdi, JSFunction::kSharedFunctionInfoOffset)); | |
| 811 __ movl(rdx, FieldOperand(rdx, SharedFunctionInfo::kCompilerHintsOffset)); | |
| 812 __ testl(rdx, Immediate(1 << SharedFunctionInfo::kStrictModeFunction)); | |
| 813 __ j(not_equal, &push_receiver); | |
| 814 | |
| 815 // Compute the receiver in non-strict mode. | |
| 801 __ JumpIfSmi(rbx, &call_to_object); | 816 __ JumpIfSmi(rbx, &call_to_object); |
| 802 __ CompareRoot(rbx, Heap::kNullValueRootIndex); | 817 __ CompareRoot(rbx, Heap::kNullValueRootIndex); |
| 803 __ j(equal, &use_global_receiver); | 818 __ j(equal, &use_global_receiver); |
| 804 __ CompareRoot(rbx, Heap::kUndefinedValueRootIndex); | 819 __ CompareRoot(rbx, Heap::kUndefinedValueRootIndex); |
| 805 __ j(equal, &use_global_receiver); | 820 __ j(equal, &use_global_receiver); |
| 806 | 821 |
| 807 // If given receiver is already a JavaScript object then there's no | 822 // If given receiver is already a JavaScript object then there's no |
| 808 // reason for converting it. | 823 // reason for converting it. |
| 809 __ CmpObjectType(rbx, FIRST_JS_OBJECT_TYPE, rcx); | 824 __ CmpObjectType(rbx, FIRST_JS_OBJECT_TYPE, rcx); |
| 810 __ j(below, &call_to_object); | 825 __ j(below, &call_to_object); |
| (...skipping 597 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... | |
| 1408 void Builtins::Generate_OnStackReplacement(MacroAssembler* masm) { | 1423 void Builtins::Generate_OnStackReplacement(MacroAssembler* masm) { |
| 1409 __ int3(); | 1424 __ int3(); |
| 1410 } | 1425 } |
| 1411 | 1426 |
| 1412 | 1427 |
| 1413 #undef __ | 1428 #undef __ |
| 1414 | 1429 |
| 1415 } } // namespace v8::internal | 1430 } } // namespace v8::internal |
| 1416 | 1431 |
| 1417 #endif // V8_TARGET_ARCH_X64 | 1432 #endif // V8_TARGET_ARCH_X64 |
| OLD | NEW |