OLD | NEW |
1 // Copyright 2012 the V8 project authors. All rights reserved.7 | 1 // Copyright 2012 the V8 project authors. All rights reserved.7 |
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 165 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
176 bool need_write_barrier = true; | 176 bool need_write_barrier = true; |
177 // Argument to NewContext is the function, which is in a1. | 177 // Argument to NewContext is the function, which is in a1. |
178 int slots = info()->scope()->num_heap_slots() - Context::MIN_CONTEXT_SLOTS; | 178 int slots = info()->scope()->num_heap_slots() - Context::MIN_CONTEXT_SLOTS; |
179 Safepoint::DeoptMode deopt_mode = Safepoint::kNoLazyDeopt; | 179 Safepoint::DeoptMode deopt_mode = Safepoint::kNoLazyDeopt; |
180 if (info()->scope()->is_script_scope()) { | 180 if (info()->scope()->is_script_scope()) { |
181 __ push(a1); | 181 __ push(a1); |
182 __ Push(info()->scope()->scope_info()); | 182 __ Push(info()->scope()->scope_info()); |
183 __ CallRuntime(Runtime::kNewScriptContext); | 183 __ CallRuntime(Runtime::kNewScriptContext); |
184 deopt_mode = Safepoint::kLazyDeopt; | 184 deopt_mode = Safepoint::kLazyDeopt; |
185 } else { | 185 } else { |
186 FastNewFunctionContextStub stub(isolate()); | 186 if (slots <= FastNewFunctionContextStub::kMaximumSlots) { |
187 __ li(FastNewFunctionContextDescriptor::SlotsRegister(), Operand(slots)); | 187 FastNewFunctionContextStub stub(isolate()); |
188 __ CallStub(&stub); | 188 __ li(FastNewFunctionContextDescriptor::SlotsRegister(), |
189 // Result of FastNewFunctionContextStub is always in new space. | 189 Operand(slots)); |
190 need_write_barrier = false; | 190 __ CallStub(&stub); |
| 191 // Result of FastNewFunctionContextStub is always in new space. |
| 192 need_write_barrier = false; |
| 193 } else { |
| 194 __ push(a1); |
| 195 __ CallRuntime(Runtime::kNewFunctionContext); |
| 196 } |
191 } | 197 } |
192 RecordSafepoint(deopt_mode); | 198 RecordSafepoint(deopt_mode); |
193 | 199 |
194 // Context is returned in both v0. It replaces the context passed to us. | 200 // Context is returned in both v0. It replaces the context passed to us. |
195 // It's saved in the stack and kept live in cp. | 201 // It's saved in the stack and kept live in cp. |
196 __ mov(cp, v0); | 202 __ mov(cp, v0); |
197 __ sw(v0, MemOperand(fp, StandardFrameConstants::kContextOffset)); | 203 __ sw(v0, MemOperand(fp, StandardFrameConstants::kContextOffset)); |
198 // Copy any necessary parameters into the context. | 204 // Copy any necessary parameters into the context. |
199 int num_parameters = info()->scope()->num_parameters(); | 205 int num_parameters = info()->scope()->num_parameters(); |
200 int first_parameter = info()->scope()->has_this_declaration() ? -1 : 0; | 206 int first_parameter = info()->scope()->has_this_declaration() ? -1 : 0; |
(...skipping 5213 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
5414 __ lw(result, FieldMemOperand(scratch, | 5420 __ lw(result, FieldMemOperand(scratch, |
5415 FixedArray::kHeaderSize - kPointerSize)); | 5421 FixedArray::kHeaderSize - kPointerSize)); |
5416 __ bind(deferred->exit()); | 5422 __ bind(deferred->exit()); |
5417 __ bind(&done); | 5423 __ bind(&done); |
5418 } | 5424 } |
5419 | 5425 |
5420 #undef __ | 5426 #undef __ |
5421 | 5427 |
5422 } // namespace internal | 5428 } // namespace internal |
5423 } // namespace v8 | 5429 } // namespace v8 |
OLD | NEW |