| OLD | NEW |
| 1 // Copyright 2009 the V8 project authors. All rights reserved. | 1 // Copyright 2009 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 76 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 87 | 87 |
| 88 // Copy parameters into context if necessary. | 88 // Copy parameters into context if necessary. |
| 89 int num_parameters = fun->scope()->num_parameters(); | 89 int num_parameters = fun->scope()->num_parameters(); |
| 90 for (int i = 0; i < num_parameters; i++) { | 90 for (int i = 0; i < num_parameters; i++) { |
| 91 Slot* slot = fun->scope()->parameter(i)->slot(); | 91 Slot* slot = fun->scope()->parameter(i)->slot(); |
| 92 if (slot != NULL && slot->type() == Slot::CONTEXT) { | 92 if (slot != NULL && slot->type() == Slot::CONTEXT) { |
| 93 int parameter_offset = StandardFrameConstants::kCallerSPOffset + | 93 int parameter_offset = StandardFrameConstants::kCallerSPOffset + |
| 94 (num_parameters - 1 - i) * kPointerSize; | 94 (num_parameters - 1 - i) * kPointerSize; |
| 95 // Load parameter from stack. | 95 // Load parameter from stack. |
| 96 __ mov(eax, Operand(ebp, parameter_offset)); | 96 __ mov(eax, Operand(ebp, parameter_offset)); |
| 97 // Store it in the context | 97 // Store it in the context. |
| 98 __ mov(Operand(esi, Context::SlotOffset(slot->index())), eax); | 98 int context_offset = Context::SlotOffset(slot->index()); |
| 99 __ mov(Operand(esi, context_offset), eax); |
| 100 // Update the write barrier. This clobbers all involved |
| 101 // registers, so we have use a third register to avoid |
| 102 // clobbering esi. |
| 103 __ mov(ecx, esi); |
| 104 __ RecordWrite(ecx, context_offset, eax, ebx); |
| 99 } | 105 } |
| 100 } | 106 } |
| 101 } | 107 } |
| 102 | 108 |
| 103 Variable* arguments = fun->scope()->arguments()->AsVariable(); | 109 Variable* arguments = fun->scope()->arguments()->AsVariable(); |
| 104 if (arguments != NULL) { | 110 if (arguments != NULL) { |
| 105 // Function uses arguments object. | 111 // Function uses arguments object. |
| 106 Comment cmnt(masm_, "[ Allocate arguments object"); | 112 Comment cmnt(masm_, "[ Allocate arguments object"); |
| 107 if (function_in_register) { | 113 if (function_in_register) { |
| 108 __ push(edi); | 114 __ push(edi); |
| 109 } else { | 115 } else { |
| 110 __ push(Operand(ebp, JavaScriptFrameConstants::kFunctionOffset)); | 116 __ push(Operand(ebp, JavaScriptFrameConstants::kFunctionOffset)); |
| 111 } | 117 } |
| 112 // Receiver is just before the parameters on the caller's stack. | 118 // Receiver is just before the parameters on the caller's stack. |
| 113 __ lea(edx, Operand(ebp, StandardFrameConstants::kCallerSPOffset + | 119 __ lea(edx, Operand(ebp, StandardFrameConstants::kCallerSPOffset + |
| 114 fun->num_parameters() * kPointerSize)); | 120 fun->num_parameters() * kPointerSize)); |
| 115 __ push(edx); | 121 __ push(edx); |
| 116 __ push(Immediate(Smi::FromInt(fun->num_parameters()))); | 122 __ push(Immediate(Smi::FromInt(fun->num_parameters()))); |
| 117 // Arguments to ArgumentsAccessStub: | 123 // Arguments to ArgumentsAccessStub: |
| 118 // function, receiver address, parameter count. | 124 // function, receiver address, parameter count. |
| 119 // The stub will rewrite receiver and parameter count if the previous | 125 // The stub will rewrite receiver and parameter count if the previous |
| 120 // stack frame was an arguments adapter frame. | 126 // stack frame was an arguments adapter frame. |
| 121 ArgumentsAccessStub stub(ArgumentsAccessStub::NEW_OBJECT); | 127 ArgumentsAccessStub stub(ArgumentsAccessStub::NEW_OBJECT); |
| 122 __ CallStub(&stub); | 128 __ CallStub(&stub); |
| 123 __ mov(ecx, eax); // Duplicate result. | 129 __ mov(ecx, eax); // Duplicate result. |
| 124 Move(arguments->slot(), eax, ebx, edx); | 130 Move(arguments->slot(), eax, ebx, edx); |
| (...skipping 1752 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 1877 __ add(Operand(edx), Immediate(masm_->CodeObject())); | 1883 __ add(Operand(edx), Immediate(masm_->CodeObject())); |
| 1878 __ mov(Operand(esp, 0), edx); | 1884 __ mov(Operand(esp, 0), edx); |
| 1879 // And return. | 1885 // And return. |
| 1880 __ ret(0); | 1886 __ ret(0); |
| 1881 } | 1887 } |
| 1882 | 1888 |
| 1883 | 1889 |
| 1884 #undef __ | 1890 #undef __ |
| 1885 | 1891 |
| 1886 } } // namespace v8::internal | 1892 } } // namespace v8::internal |
| OLD | NEW |