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 184 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
195 bool need_write_barrier = true; | 195 bool need_write_barrier = true; |
196 // Argument to NewContext is the function, which is in a1. | 196 // Argument to NewContext is the function, which is in a1. |
197 int slots = info()->scope()->num_heap_slots() - Context::MIN_CONTEXT_SLOTS; | 197 int slots = info()->scope()->num_heap_slots() - Context::MIN_CONTEXT_SLOTS; |
198 Safepoint::DeoptMode deopt_mode = Safepoint::kNoLazyDeopt; | 198 Safepoint::DeoptMode deopt_mode = Safepoint::kNoLazyDeopt; |
199 if (info()->scope()->is_script_scope()) { | 199 if (info()->scope()->is_script_scope()) { |
200 __ push(a1); | 200 __ push(a1); |
201 __ Push(info()->scope()->scope_info()); | 201 __ Push(info()->scope()->scope_info()); |
202 __ CallRuntime(Runtime::kNewScriptContext); | 202 __ CallRuntime(Runtime::kNewScriptContext); |
203 deopt_mode = Safepoint::kLazyDeopt; | 203 deopt_mode = Safepoint::kLazyDeopt; |
204 } else { | 204 } else { |
205 if (slots <= FastNewFunctionContextStub::kMaximumSlots) { | 205 if (slots <= FastNewFunctionContextStub::MaximumSlots()) { |
206 FastNewFunctionContextStub stub(isolate()); | 206 FastNewFunctionContextStub stub(isolate(), |
| 207 info()->scope()->scope_type()); |
207 __ li(FastNewFunctionContextDescriptor::SlotsRegister(), | 208 __ li(FastNewFunctionContextDescriptor::SlotsRegister(), |
208 Operand(slots)); | 209 Operand(slots)); |
209 __ CallStub(&stub); | 210 __ CallStub(&stub); |
210 // Result of FastNewFunctionContextStub is always in new space. | 211 // Result of FastNewFunctionContextStub is always in new space. |
211 need_write_barrier = false; | 212 need_write_barrier = false; |
212 } else { | 213 } else { |
213 __ push(a1); | 214 __ push(a1); |
| 215 __ Push(Smi::FromInt(info()->scope()->scope_type())); |
214 __ CallRuntime(Runtime::kNewFunctionContext); | 216 __ CallRuntime(Runtime::kNewFunctionContext); |
215 } | 217 } |
216 } | 218 } |
217 RecordSafepoint(deopt_mode); | 219 RecordSafepoint(deopt_mode); |
218 | 220 |
219 // Context is returned in both v0. It replaces the context passed to us. | 221 // Context is returned in both v0. It replaces the context passed to us. |
220 // It's saved in the stack and kept live in cp. | 222 // It's saved in the stack and kept live in cp. |
221 __ mov(cp, v0); | 223 __ mov(cp, v0); |
222 __ sw(v0, MemOperand(fp, StandardFrameConstants::kContextOffset)); | 224 __ sw(v0, MemOperand(fp, StandardFrameConstants::kContextOffset)); |
223 // Copy any necessary parameters into the context. | 225 // Copy any necessary parameters into the context. |
(...skipping 5190 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
5414 __ lw(result, FieldMemOperand(scratch, | 5416 __ lw(result, FieldMemOperand(scratch, |
5415 FixedArray::kHeaderSize - kPointerSize)); | 5417 FixedArray::kHeaderSize - kPointerSize)); |
5416 __ bind(deferred->exit()); | 5418 __ bind(deferred->exit()); |
5417 __ bind(&done); | 5419 __ bind(&done); |
5418 } | 5420 } |
5419 | 5421 |
5420 #undef __ | 5422 #undef __ |
5421 | 5423 |
5422 } // namespace internal | 5424 } // namespace internal |
5423 } // namespace v8 | 5425 } // namespace v8 |
OLD | NEW |