OLD | NEW |
1 // Copyright 2012 the V8 project authors. All rights reserved. | 1 // Copyright 2012 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 209 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
220 __ push(edi); | 220 __ push(edi); |
221 } else { | 221 } else { |
222 __ push(Operand(ebp, JavaScriptFrameConstants::kFunctionOffset)); | 222 __ push(Operand(ebp, JavaScriptFrameConstants::kFunctionOffset)); |
223 } | 223 } |
224 // Receiver is just before the parameters on the caller's stack. | 224 // Receiver is just before the parameters on the caller's stack. |
225 int num_parameters = info->scope()->num_parameters(); | 225 int num_parameters = info->scope()->num_parameters(); |
226 int offset = num_parameters * kPointerSize; | 226 int offset = num_parameters * kPointerSize; |
227 __ lea(edx, | 227 __ lea(edx, |
228 Operand(ebp, StandardFrameConstants::kCallerSPOffset + offset)); | 228 Operand(ebp, StandardFrameConstants::kCallerSPOffset + offset)); |
229 __ push(edx); | 229 __ push(edx); |
230 __ SafePush(Immediate(Smi::FromInt(num_parameters))); | 230 __ Push(Immediate(Smi::FromInt(num_parameters))); |
231 // Arguments to ArgumentsAccessStub: | 231 // Arguments to ArgumentsAccessStub: |
232 // function, receiver address, parameter count. | 232 // function, receiver address, parameter count. |
233 // The stub will rewrite receiver and parameter count if the previous | 233 // The stub will rewrite receiver and parameter count if the previous |
234 // stack frame was an arguments adapter frame. | 234 // stack frame was an arguments adapter frame. |
235 ArgumentsAccessStub::Type type; | 235 ArgumentsAccessStub::Type type; |
236 if (!is_classic_mode()) { | 236 if (!is_classic_mode()) { |
237 type = ArgumentsAccessStub::NEW_STRICT; | 237 type = ArgumentsAccessStub::NEW_STRICT; |
238 } else if (function()->has_duplicate_parameters()) { | 238 } else if (function()->has_duplicate_parameters()) { |
239 type = ArgumentsAccessStub::NEW_NON_STRICT_SLOW; | 239 type = ArgumentsAccessStub::NEW_NON_STRICT_SLOW; |
240 } else { | 240 } else { |
(...skipping 2243 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
2484 int arg_count = args->length(); | 2484 int arg_count = args->length(); |
2485 for (int i = 0; i < arg_count; i++) { | 2485 for (int i = 0; i < arg_count; i++) { |
2486 VisitForStackValue(args->at(i)); | 2486 VisitForStackValue(args->at(i)); |
2487 } | 2487 } |
2488 | 2488 |
2489 // Call the construct call builtin that handles allocation and | 2489 // Call the construct call builtin that handles allocation and |
2490 // constructor invocation. | 2490 // constructor invocation. |
2491 SetSourcePosition(expr->position()); | 2491 SetSourcePosition(expr->position()); |
2492 | 2492 |
2493 // Load function and argument count into edi and eax. | 2493 // Load function and argument count into edi and eax. |
2494 __ SafeSet(eax, Immediate(arg_count)); | 2494 __ Set(eax, Immediate(arg_count)); |
2495 __ mov(edi, Operand(esp, arg_count * kPointerSize)); | 2495 __ mov(edi, Operand(esp, arg_count * kPointerSize)); |
2496 | 2496 |
2497 // Record call targets in unoptimized code, but not in the snapshot. | 2497 // Record call targets in unoptimized code, but not in the snapshot. |
2498 CallFunctionFlags flags; | 2498 CallFunctionFlags flags; |
2499 if (!Serializer::enabled()) { | 2499 if (!Serializer::enabled()) { |
2500 flags = RECORD_CALL_TARGET; | 2500 flags = RECORD_CALL_TARGET; |
2501 Handle<Object> uninitialized = | 2501 Handle<Object> uninitialized = |
2502 TypeFeedbackCells::UninitializedSentinel(isolate()); | 2502 TypeFeedbackCells::UninitializedSentinel(isolate()); |
2503 Handle<JSGlobalPropertyCell> cell = | 2503 Handle<JSGlobalPropertyCell> cell = |
2504 isolate()->factory()->NewJSGlobalPropertyCell(uninitialized); | 2504 isolate()->factory()->NewJSGlobalPropertyCell(uninitialized); |
(...skipping 337 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
2842 | 2842 |
2843 | 2843 |
2844 void FullCodeGenerator::EmitArguments(CallRuntime* expr) { | 2844 void FullCodeGenerator::EmitArguments(CallRuntime* expr) { |
2845 ZoneList<Expression*>* args = expr->arguments(); | 2845 ZoneList<Expression*>* args = expr->arguments(); |
2846 ASSERT(args->length() == 1); | 2846 ASSERT(args->length() == 1); |
2847 | 2847 |
2848 // ArgumentsAccessStub expects the key in edx and the formal | 2848 // ArgumentsAccessStub expects the key in edx and the formal |
2849 // parameter count in eax. | 2849 // parameter count in eax. |
2850 VisitForAccumulatorValue(args->at(0)); | 2850 VisitForAccumulatorValue(args->at(0)); |
2851 __ mov(edx, eax); | 2851 __ mov(edx, eax); |
2852 __ SafeSet(eax, Immediate(Smi::FromInt(info_->scope()->num_parameters()))); | 2852 __ Set(eax, Immediate(Smi::FromInt(info_->scope()->num_parameters()))); |
2853 ArgumentsAccessStub stub(ArgumentsAccessStub::READ_ELEMENT); | 2853 ArgumentsAccessStub stub(ArgumentsAccessStub::READ_ELEMENT); |
2854 __ CallStub(&stub); | 2854 __ CallStub(&stub); |
2855 context()->Plug(eax); | 2855 context()->Plug(eax); |
2856 } | 2856 } |
2857 | 2857 |
2858 | 2858 |
2859 void FullCodeGenerator::EmitArgumentsLength(CallRuntime* expr) { | 2859 void FullCodeGenerator::EmitArgumentsLength(CallRuntime* expr) { |
2860 ASSERT(expr->arguments()->length() == 0); | 2860 ASSERT(expr->arguments()->length() == 0); |
2861 | 2861 |
2862 Label exit; | 2862 Label exit; |
2863 // Get the number of formal parameters. | 2863 // Get the number of formal parameters. |
2864 __ SafeSet(eax, Immediate(Smi::FromInt(info_->scope()->num_parameters()))); | 2864 __ Set(eax, Immediate(Smi::FromInt(info_->scope()->num_parameters()))); |
2865 | 2865 |
2866 // Check if the calling frame is an arguments adaptor frame. | 2866 // Check if the calling frame is an arguments adaptor frame. |
2867 __ mov(ebx, Operand(ebp, StandardFrameConstants::kCallerFPOffset)); | 2867 __ mov(ebx, Operand(ebp, StandardFrameConstants::kCallerFPOffset)); |
2868 __ cmp(Operand(ebx, StandardFrameConstants::kContextOffset), | 2868 __ cmp(Operand(ebx, StandardFrameConstants::kContextOffset), |
2869 Immediate(Smi::FromInt(StackFrame::ARGUMENTS_ADAPTOR))); | 2869 Immediate(Smi::FromInt(StackFrame::ARGUMENTS_ADAPTOR))); |
2870 __ j(not_equal, &exit); | 2870 __ j(not_equal, &exit); |
2871 | 2871 |
2872 // Arguments adaptor case: Read the arguments length from the | 2872 // Arguments adaptor case: Read the arguments length from the |
2873 // adaptor frame. | 2873 // adaptor frame. |
2874 __ mov(eax, Operand(ebx, ArgumentsAdaptorFrameConstants::kLengthOffset)); | 2874 __ mov(eax, Operand(ebx, ArgumentsAdaptorFrameConstants::kLengthOffset)); |
(...skipping 1674 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
4549 *context_length = 0; | 4549 *context_length = 0; |
4550 return previous_; | 4550 return previous_; |
4551 } | 4551 } |
4552 | 4552 |
4553 | 4553 |
4554 #undef __ | 4554 #undef __ |
4555 | 4555 |
4556 } } // namespace v8::internal | 4556 } } // namespace v8::internal |
4557 | 4557 |
4558 #endif // V8_TARGET_ARCH_IA32 | 4558 #endif // V8_TARGET_ARCH_IA32 |
OLD | NEW |