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 1863 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
1874 | 1874 |
1875 void LCodeGen::DoReturn(LReturn* instr) { | 1875 void LCodeGen::DoReturn(LReturn* instr) { |
1876 if (FLAG_trace) { | 1876 if (FLAG_trace) { |
1877 // Preserve the return value on the stack and rely on the runtime | 1877 // Preserve the return value on the stack and rely on the runtime |
1878 // call to return the value in the same register. | 1878 // call to return the value in the same register. |
1879 __ push(eax); | 1879 __ push(eax); |
1880 __ CallRuntime(Runtime::kTraceExit, 1); | 1880 __ CallRuntime(Runtime::kTraceExit, 1); |
1881 } | 1881 } |
1882 __ mov(esp, ebp); | 1882 __ mov(esp, ebp); |
1883 __ pop(ebp); | 1883 __ pop(ebp); |
1884 __ ret((ParameterCount() + 1) * kPointerSize); | 1884 __ Ret((ParameterCount() + 1) * kPointerSize, ecx); |
1885 } | 1885 } |
1886 | 1886 |
1887 | 1887 |
1888 void LCodeGen::DoLoadGlobal(LLoadGlobal* instr) { | 1888 void LCodeGen::DoLoadGlobal(LLoadGlobal* instr) { |
1889 Register result = ToRegister(instr->result()); | 1889 Register result = ToRegister(instr->result()); |
1890 __ mov(result, Operand::Cell(instr->hydrogen()->cell())); | 1890 __ mov(result, Operand::Cell(instr->hydrogen()->cell())); |
1891 if (instr->hydrogen()->check_hole_value()) { | 1891 if (instr->hydrogen()->check_hole_value()) { |
1892 __ cmp(result, Factory::the_hole_value()); | 1892 __ cmp(result, Factory::the_hole_value()); |
1893 DeoptimizeIf(equal, instr->environment()); | 1893 DeoptimizeIf(equal, instr->environment()); |
1894 } | 1894 } |
(...skipping 188 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
2083 ArgumentsAdaptorFrameConstants::kLengthOffset)); | 2083 ArgumentsAdaptorFrameConstants::kLengthOffset)); |
2084 __ SmiUntag(result); | 2084 __ SmiUntag(result); |
2085 | 2085 |
2086 // Argument length is in result register. | 2086 // Argument length is in result register. |
2087 __ bind(&done); | 2087 __ bind(&done); |
2088 } | 2088 } |
2089 | 2089 |
2090 | 2090 |
2091 void LCodeGen::DoApplyArguments(LApplyArguments* instr) { | 2091 void LCodeGen::DoApplyArguments(LApplyArguments* instr) { |
2092 Register receiver = ToRegister(instr->receiver()); | 2092 Register receiver = ToRegister(instr->receiver()); |
| 2093 Register length = ToRegister(instr->length()); |
| 2094 Register elements = ToRegister(instr->elements()); |
| 2095 Register temp = ToRegister(instr->TempAt(0)); |
2093 ASSERT(ToRegister(instr->function()).is(edi)); | 2096 ASSERT(ToRegister(instr->function()).is(edi)); |
2094 ASSERT(ToRegister(instr->result()).is(eax)); | 2097 ASSERT(ToRegister(instr->result()).is(eax)); |
2095 | 2098 |
2096 // If the receiver is null or undefined, we have to pass the | 2099 // If the receiver is null or undefined, we have to pass the |
2097 // global object as a receiver. | 2100 // global object as a receiver. |
2098 NearLabel global_receiver, receiver_ok; | 2101 NearLabel global_receiver, receiver_ok; |
2099 __ cmp(receiver, Factory::null_value()); | 2102 __ cmp(receiver, Factory::null_value()); |
2100 __ j(equal, &global_receiver); | 2103 __ j(equal, &global_receiver); |
2101 __ cmp(receiver, Factory::undefined_value()); | 2104 __ cmp(receiver, Factory::undefined_value()); |
2102 __ j(not_equal, &receiver_ok); | 2105 __ j(equal, &global_receiver); |
| 2106 |
| 2107 // The receiver should be a JS object. |
| 2108 __ test(receiver, Immediate(kSmiTagMask)); |
| 2109 DeoptimizeIf(equal, instr->environment()); |
| 2110 __ CmpObjectType(receiver, FIRST_JS_OBJECT_TYPE, temp); |
| 2111 DeoptimizeIf(below, instr->environment()); |
| 2112 __ jmp(&receiver_ok); |
| 2113 |
2103 __ bind(&global_receiver); | 2114 __ bind(&global_receiver); |
2104 __ mov(receiver, GlobalObjectOperand()); | 2115 __ mov(receiver, GlobalObjectOperand()); |
2105 __ bind(&receiver_ok); | 2116 __ bind(&receiver_ok); |
2106 | 2117 |
2107 Register length = ToRegister(instr->length()); | |
2108 Register elements = ToRegister(instr->elements()); | |
2109 | |
2110 Label invoke; | 2118 Label invoke; |
2111 | 2119 |
2112 // Copy the arguments to this function possibly from the | 2120 // Copy the arguments to this function possibly from the |
2113 // adaptor frame below it. | 2121 // adaptor frame below it. |
2114 const uint32_t kArgumentsLimit = 1 * KB; | 2122 const uint32_t kArgumentsLimit = 1 * KB; |
2115 __ cmp(length, kArgumentsLimit); | 2123 __ cmp(length, kArgumentsLimit); |
2116 DeoptimizeIf(above, instr->environment()); | 2124 DeoptimizeIf(above, instr->environment()); |
2117 | 2125 |
2118 __ push(receiver); | 2126 __ push(receiver); |
2119 __ mov(receiver, length); | 2127 __ mov(receiver, length); |
(...skipping 1491 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
3611 ASSERT(osr_pc_offset_ == -1); | 3619 ASSERT(osr_pc_offset_ == -1); |
3612 osr_pc_offset_ = masm()->pc_offset(); | 3620 osr_pc_offset_ = masm()->pc_offset(); |
3613 } | 3621 } |
3614 | 3622 |
3615 | 3623 |
3616 #undef __ | 3624 #undef __ |
3617 | 3625 |
3618 } } // namespace v8::internal | 3626 } } // namespace v8::internal |
3619 | 3627 |
3620 #endif // V8_TARGET_ARCH_IA32 | 3628 #endif // V8_TARGET_ARCH_IA32 |
OLD | NEW |