| 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 2098 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 2109 ArgumentsAdaptorFrameConstants::kLengthOffset)); | 2109 ArgumentsAdaptorFrameConstants::kLengthOffset)); |
| 2110 __ SmiUntag(result); | 2110 __ SmiUntag(result); |
| 2111 | 2111 |
| 2112 // Argument length is in result register. | 2112 // Argument length is in result register. |
| 2113 __ bind(&done); | 2113 __ bind(&done); |
| 2114 } | 2114 } |
| 2115 | 2115 |
| 2116 | 2116 |
| 2117 void LCodeGen::DoApplyArguments(LApplyArguments* instr) { | 2117 void LCodeGen::DoApplyArguments(LApplyArguments* instr) { |
| 2118 Register receiver = ToRegister(instr->receiver()); | 2118 Register receiver = ToRegister(instr->receiver()); |
| 2119 Register length = ToRegister(instr->length()); |
| 2120 Register elements = ToRegister(instr->elements()); |
| 2121 Register temp = ToRegister(instr->TempAt(0)); |
| 2119 ASSERT(ToRegister(instr->function()).is(edi)); | 2122 ASSERT(ToRegister(instr->function()).is(edi)); |
| 2120 ASSERT(ToRegister(instr->result()).is(eax)); | 2123 ASSERT(ToRegister(instr->result()).is(eax)); |
| 2121 | 2124 |
| 2122 // If the receiver is null or undefined, we have to pass the | 2125 // If the receiver is null or undefined, we have to pass the |
| 2123 // global object as a receiver. | 2126 // global object as a receiver. |
| 2124 NearLabel global_receiver, receiver_ok; | 2127 NearLabel global_receiver, receiver_ok; |
| 2125 __ cmp(receiver, Factory::null_value()); | 2128 __ cmp(receiver, Factory::null_value()); |
| 2126 __ j(equal, &global_receiver); | 2129 __ j(equal, &global_receiver); |
| 2127 __ cmp(receiver, Factory::undefined_value()); | 2130 __ cmp(receiver, Factory::undefined_value()); |
| 2128 __ j(not_equal, &receiver_ok); | 2131 __ j(equal, &global_receiver); |
| 2132 |
| 2133 // The receiver should be a JS object. |
| 2134 __ test(receiver, Immediate(kSmiTagMask)); |
| 2135 DeoptimizeIf(equal, instr->environment()); |
| 2136 __ CmpObjectType(receiver, FIRST_JS_OBJECT_TYPE, temp); |
| 2137 DeoptimizeIf(below, instr->environment()); |
| 2138 __ jmp(&receiver_ok); |
| 2139 |
| 2129 __ bind(&global_receiver); | 2140 __ bind(&global_receiver); |
| 2130 __ mov(receiver, GlobalObjectOperand()); | 2141 __ mov(receiver, GlobalObjectOperand()); |
| 2131 __ bind(&receiver_ok); | 2142 __ bind(&receiver_ok); |
| 2132 | 2143 |
| 2133 Register length = ToRegister(instr->length()); | |
| 2134 Register elements = ToRegister(instr->elements()); | |
| 2135 | |
| 2136 Label invoke; | 2144 Label invoke; |
| 2137 | 2145 |
| 2138 // Copy the arguments to this function possibly from the | 2146 // Copy the arguments to this function possibly from the |
| 2139 // adaptor frame below it. | 2147 // adaptor frame below it. |
| 2140 const uint32_t kArgumentsLimit = 1 * KB; | 2148 const uint32_t kArgumentsLimit = 1 * KB; |
| 2141 __ cmp(length, kArgumentsLimit); | 2149 __ cmp(length, kArgumentsLimit); |
| 2142 DeoptimizeIf(above, instr->environment()); | 2150 DeoptimizeIf(above, instr->environment()); |
| 2143 | 2151 |
| 2144 __ push(receiver); | 2152 __ push(receiver); |
| 2145 __ mov(receiver, length); | 2153 __ mov(receiver, length); |
| (...skipping 1560 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 3706 ASSERT(osr_pc_offset_ == -1); | 3714 ASSERT(osr_pc_offset_ == -1); |
| 3707 osr_pc_offset_ = masm()->pc_offset(); | 3715 osr_pc_offset_ = masm()->pc_offset(); |
| 3708 } | 3716 } |
| 3709 | 3717 |
| 3710 | 3718 |
| 3711 #undef __ | 3719 #undef __ |
| 3712 | 3720 |
| 3713 } } // namespace v8::internal | 3721 } } // namespace v8::internal |
| 3714 | 3722 |
| 3715 #endif // V8_TARGET_ARCH_IA32 | 3723 #endif // V8_TARGET_ARCH_IA32 |
| OLD | NEW |