| 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 179 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 190 // Receiver is just before the parameters on the caller's stack. | 190 // Receiver is just before the parameters on the caller's stack. |
| 191 int offset = scope()->num_parameters() * kPointerSize; | 191 int offset = scope()->num_parameters() * kPointerSize; |
| 192 __ lea(edx, | 192 __ lea(edx, |
| 193 Operand(ebp, StandardFrameConstants::kCallerSPOffset + offset)); | 193 Operand(ebp, StandardFrameConstants::kCallerSPOffset + offset)); |
| 194 __ push(edx); | 194 __ push(edx); |
| 195 __ push(Immediate(Smi::FromInt(scope()->num_parameters()))); | 195 __ push(Immediate(Smi::FromInt(scope()->num_parameters()))); |
| 196 // Arguments to ArgumentsAccessStub: | 196 // Arguments to ArgumentsAccessStub: |
| 197 // function, receiver address, parameter count. | 197 // function, receiver address, parameter count. |
| 198 // The stub will rewrite receiver and parameter count if the previous | 198 // The stub will rewrite receiver and parameter count if the previous |
| 199 // stack frame was an arguments adapter frame. | 199 // stack frame was an arguments adapter frame. |
| 200 ArgumentsAccessStub stub(ArgumentsAccessStub::NEW_OBJECT); | 200 ArgumentsAccessStub stub( |
| 201 is_strict_mode() ? ArgumentsAccessStub::NEW_STRICT |
| 202 : ArgumentsAccessStub::NEW_NON_STRICT); |
| 201 __ CallStub(&stub); | 203 __ CallStub(&stub); |
| 202 | 204 |
| 203 Variable* arguments_shadow = scope()->arguments_shadow(); | 205 Variable* arguments_shadow = scope()->arguments_shadow(); |
| 204 if (arguments_shadow != NULL) { | 206 if (arguments_shadow != NULL) { |
| 205 __ mov(ecx, eax); // Duplicate result. | 207 __ mov(ecx, eax); // Duplicate result. |
| 206 Move(arguments_shadow->AsSlot(), ecx, ebx, edx); | 208 Move(arguments_shadow->AsSlot(), ecx, ebx, edx); |
| 207 } | 209 } |
| 208 Move(arguments->AsSlot(), eax, ebx, edx); | 210 Move(arguments->AsSlot(), eax, ebx, edx); |
| 209 } | 211 } |
| 210 | 212 |
| (...skipping 802 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 1013 void FullCodeGenerator::EmitNewClosure(Handle<SharedFunctionInfo> info, | 1015 void FullCodeGenerator::EmitNewClosure(Handle<SharedFunctionInfo> info, |
| 1014 bool pretenure) { | 1016 bool pretenure) { |
| 1015 // Use the fast case closure allocation code that allocates in new | 1017 // Use the fast case closure allocation code that allocates in new |
| 1016 // space for nested functions that don't need literals cloning. If | 1018 // space for nested functions that don't need literals cloning. If |
| 1017 // we're running with the --always-opt or the --prepare-always-opt | 1019 // we're running with the --always-opt or the --prepare-always-opt |
| 1018 // flag, we need to use the runtime function so that the new function | 1020 // flag, we need to use the runtime function so that the new function |
| 1019 // we are creating here gets a chance to have its code optimized and | 1021 // we are creating here gets a chance to have its code optimized and |
| 1020 // doesn't just get a copy of the existing unoptimized code. | 1022 // doesn't just get a copy of the existing unoptimized code. |
| 1021 if (!FLAG_always_opt && | 1023 if (!FLAG_always_opt && |
| 1022 !FLAG_prepare_always_opt && | 1024 !FLAG_prepare_always_opt && |
| 1025 !pretenure && |
| 1023 scope()->is_function_scope() && | 1026 scope()->is_function_scope() && |
| 1024 info->num_literals() == 0 && | 1027 info->num_literals() == 0) { |
| 1025 !pretenure) { | 1028 FastNewClosureStub stub(info->strict_mode() ? kStrictMode : kNonStrictMode); |
| 1026 FastNewClosureStub stub; | |
| 1027 __ push(Immediate(info)); | 1029 __ push(Immediate(info)); |
| 1028 __ CallStub(&stub); | 1030 __ CallStub(&stub); |
| 1029 } else { | 1031 } else { |
| 1030 __ push(esi); | 1032 __ push(esi); |
| 1031 __ push(Immediate(info)); | 1033 __ push(Immediate(info)); |
| 1032 __ push(Immediate(pretenure | 1034 __ push(Immediate(pretenure |
| 1033 ? isolate()->factory()->true_value() | 1035 ? isolate()->factory()->true_value() |
| 1034 : isolate()->factory()->false_value())); | 1036 : isolate()->factory()->false_value())); |
| 1035 __ CallRuntime(Runtime::kNewClosure, 3); | 1037 __ CallRuntime(Runtime::kNewClosure, 3); |
| 1036 } | 1038 } |
| (...skipping 3239 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 4276 // And return. | 4278 // And return. |
| 4277 __ ret(0); | 4279 __ ret(0); |
| 4278 } | 4280 } |
| 4279 | 4281 |
| 4280 | 4282 |
| 4281 #undef __ | 4283 #undef __ |
| 4282 | 4284 |
| 4283 } } // namespace v8::internal | 4285 } } // namespace v8::internal |
| 4284 | 4286 |
| 4285 #endif // V8_TARGET_ARCH_IA32 | 4287 #endif // V8_TARGET_ARCH_IA32 |
| OLD | NEW |