| OLD | NEW |
| 1 // Copyright 2011 the V8 project authors. All rights reserved. | 1 // Copyright 2011 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 2689 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 2700 void LCodeGen::DoApplyArguments(LApplyArguments* instr) { | 2700 void LCodeGen::DoApplyArguments(LApplyArguments* instr) { |
| 2701 Register receiver = ToRegister(instr->receiver()); | 2701 Register receiver = ToRegister(instr->receiver()); |
| 2702 Register function = ToRegister(instr->function()); | 2702 Register function = ToRegister(instr->function()); |
| 2703 Register length = ToRegister(instr->length()); | 2703 Register length = ToRegister(instr->length()); |
| 2704 Register elements = ToRegister(instr->elements()); | 2704 Register elements = ToRegister(instr->elements()); |
| 2705 Register scratch = scratch0(); | 2705 Register scratch = scratch0(); |
| 2706 ASSERT(receiver.is(r0)); // Used for parameter count. | 2706 ASSERT(receiver.is(r0)); // Used for parameter count. |
| 2707 ASSERT(function.is(r1)); // Required by InvokeFunction. | 2707 ASSERT(function.is(r1)); // Required by InvokeFunction. |
| 2708 ASSERT(ToRegister(instr->result()).is(r0)); | 2708 ASSERT(ToRegister(instr->result()).is(r0)); |
| 2709 | 2709 |
| 2710 // TODO(1412): This is not correct if the called function is a | 2710 // If the receiver is null or undefined, we have to pass the global |
| 2711 // strict mode function or a native. | 2711 // object as a receiver to normal functions. Values have to be |
| 2712 // | 2712 // passed unchanged to builtins and strict-mode functions. |
| 2713 // If the receiver is null or undefined, we have to pass the global object | |
| 2714 // as a receiver. | |
| 2715 Label global_object, receiver_ok; | 2713 Label global_object, receiver_ok; |
| 2714 |
| 2715 // Do not transform the receiver to object for strict mode |
| 2716 // functions. |
| 2717 __ ldr(scratch, |
| 2718 FieldMemOperand(function, JSFunction::kSharedFunctionInfoOffset)); |
| 2719 __ ldr(scratch, |
| 2720 FieldMemOperand(scratch, SharedFunctionInfo::kCompilerHintsOffset)); |
| 2721 __ tst(scratch, |
| 2722 Operand(1 << (SharedFunctionInfo::kStrictModeFunction + kSmiTagSize))); |
| 2723 __ b(ne, &receiver_ok); |
| 2724 |
| 2725 // Do not transform the receiver to object for builtins. |
| 2726 __ tst(scratch, Operand(1 << (SharedFunctionInfo::kNative + kSmiTagSize))); |
| 2727 __ b(ne, &receiver_ok); |
| 2728 |
| 2729 // Normal function. Replace undefined or null with global receiver. |
| 2716 __ LoadRoot(scratch, Heap::kNullValueRootIndex); | 2730 __ LoadRoot(scratch, Heap::kNullValueRootIndex); |
| 2717 __ cmp(receiver, scratch); | 2731 __ cmp(receiver, scratch); |
| 2718 __ b(eq, &global_object); | 2732 __ b(eq, &global_object); |
| 2719 __ LoadRoot(scratch, Heap::kUndefinedValueRootIndex); | 2733 __ LoadRoot(scratch, Heap::kUndefinedValueRootIndex); |
| 2720 __ cmp(receiver, scratch); | 2734 __ cmp(receiver, scratch); |
| 2721 __ b(eq, &global_object); | 2735 __ b(eq, &global_object); |
| 2722 | 2736 |
| 2723 // Deoptimize if the receiver is not a JS object. | 2737 // Deoptimize if the receiver is not a JS object. |
| 2724 __ tst(receiver, Operand(kSmiTagMask)); | 2738 __ tst(receiver, Operand(kSmiTagMask)); |
| 2725 DeoptimizeIf(eq, instr->environment()); | 2739 DeoptimizeIf(eq, instr->environment()); |
| (...skipping 1797 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 4523 ASSERT(osr_pc_offset_ == -1); | 4537 ASSERT(osr_pc_offset_ == -1); |
| 4524 osr_pc_offset_ = masm()->pc_offset(); | 4538 osr_pc_offset_ = masm()->pc_offset(); |
| 4525 } | 4539 } |
| 4526 | 4540 |
| 4527 | 4541 |
| 4528 | 4542 |
| 4529 | 4543 |
| 4530 #undef __ | 4544 #undef __ |
| 4531 | 4545 |
| 4532 } } // namespace v8::internal | 4546 } } // namespace v8::internal |
| OLD | NEW |