| 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 180 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 191 // The receiver is just before the parameters on the caller's stack. | 191 // The receiver is just before the parameters on the caller's stack. |
| 192 int offset = scope()->num_parameters() * kPointerSize; | 192 int offset = scope()->num_parameters() * kPointerSize; |
| 193 __ lea(rdx, | 193 __ lea(rdx, |
| 194 Operand(rbp, StandardFrameConstants::kCallerSPOffset + offset)); | 194 Operand(rbp, StandardFrameConstants::kCallerSPOffset + offset)); |
| 195 __ push(rdx); | 195 __ push(rdx); |
| 196 __ Push(Smi::FromInt(scope()->num_parameters())); | 196 __ Push(Smi::FromInt(scope()->num_parameters())); |
| 197 // Arguments to ArgumentsAccessStub: | 197 // Arguments to ArgumentsAccessStub: |
| 198 // function, receiver address, parameter count. | 198 // function, receiver address, parameter count. |
| 199 // The stub will rewrite receiver and parameter count if the previous | 199 // The stub will rewrite receiver and parameter count if the previous |
| 200 // stack frame was an arguments adapter frame. | 200 // stack frame was an arguments adapter frame. |
| 201 ArgumentsAccessStub stub(ArgumentsAccessStub::NEW_OBJECT); | 201 ArgumentsAccessStub stub( |
| 202 is_strict_mode() ? ArgumentsAccessStub::NEW_STRICT |
| 203 : ArgumentsAccessStub::NEW_NON_STRICT); |
| 202 __ CallStub(&stub); | 204 __ CallStub(&stub); |
| 203 | 205 |
| 204 Variable* arguments_shadow = scope()->arguments_shadow(); | 206 Variable* arguments_shadow = scope()->arguments_shadow(); |
| 205 if (arguments_shadow != NULL) { | 207 if (arguments_shadow != NULL) { |
| 206 // Store new arguments object in both "arguments" and ".arguments" slots. | 208 // Store new arguments object in both "arguments" and ".arguments" slots. |
| 207 __ movq(rcx, rax); | 209 __ movq(rcx, rax); |
| 208 Move(arguments_shadow->AsSlot(), rcx, rbx, rdx); | 210 Move(arguments_shadow->AsSlot(), rcx, rbx, rdx); |
| 209 } | 211 } |
| 210 Move(arguments->AsSlot(), rax, rbx, rdx); | 212 Move(arguments->AsSlot(), rax, rbx, rdx); |
| 211 } | 213 } |
| (...skipping 820 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 1032 void FullCodeGenerator::EmitNewClosure(Handle<SharedFunctionInfo> info, | 1034 void FullCodeGenerator::EmitNewClosure(Handle<SharedFunctionInfo> info, |
| 1033 bool pretenure) { | 1035 bool pretenure) { |
| 1034 // Use the fast case closure allocation code that allocates in new | 1036 // Use the fast case closure allocation code that allocates in new |
| 1035 // space for nested functions that don't need literals cloning. If | 1037 // space for nested functions that don't need literals cloning. If |
| 1036 // we're running with the --always-opt or the --prepare-always-opt | 1038 // we're running with the --always-opt or the --prepare-always-opt |
| 1037 // flag, we need to use the runtime function so that the new function | 1039 // flag, we need to use the runtime function so that the new function |
| 1038 // we are creating here gets a chance to have its code optimized and | 1040 // we are creating here gets a chance to have its code optimized and |
| 1039 // doesn't just get a copy of the existing unoptimized code. | 1041 // doesn't just get a copy of the existing unoptimized code. |
| 1040 if (!FLAG_always_opt && | 1042 if (!FLAG_always_opt && |
| 1041 !FLAG_prepare_always_opt && | 1043 !FLAG_prepare_always_opt && |
| 1044 !pretenure && |
| 1042 scope()->is_function_scope() && | 1045 scope()->is_function_scope() && |
| 1043 info->num_literals() == 0 && | 1046 info->num_literals() == 0) { |
| 1044 !pretenure) { | 1047 FastNewClosureStub stub(info->strict_mode() ? kStrictMode : kNonStrictMode); |
| 1045 FastNewClosureStub stub; | |
| 1046 __ Push(info); | 1048 __ Push(info); |
| 1047 __ CallStub(&stub); | 1049 __ CallStub(&stub); |
| 1048 } else { | 1050 } else { |
| 1049 __ push(rsi); | 1051 __ push(rsi); |
| 1050 __ Push(info); | 1052 __ Push(info); |
| 1051 __ Push(pretenure | 1053 __ Push(pretenure |
| 1052 ? isolate()->factory()->true_value() | 1054 ? isolate()->factory()->true_value() |
| 1053 : isolate()->factory()->false_value()); | 1055 : isolate()->factory()->false_value()); |
| 1054 __ CallRuntime(Runtime::kNewClosure, 3); | 1056 __ CallRuntime(Runtime::kNewClosure, 3); |
| 1055 } | 1057 } |
| (...skipping 2926 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 3982 __ ret(0); | 3984 __ ret(0); |
| 3983 } | 3985 } |
| 3984 | 3986 |
| 3985 | 3987 |
| 3986 #undef __ | 3988 #undef __ |
| 3987 | 3989 |
| 3988 | 3990 |
| 3989 } } // namespace v8::internal | 3991 } } // namespace v8::internal |
| 3990 | 3992 |
| 3991 #endif // V8_TARGET_ARCH_X64 | 3993 #endif // V8_TARGET_ARCH_X64 |
| OLD | NEW |