| 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 167 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 178 Comment(";;; Allocate local context"); | 178 Comment(";;; Allocate local context"); |
| 179 bool need_write_barrier = true; | 179 bool need_write_barrier = true; |
| 180 // Argument to NewContext is the function, which is in a1. | 180 // Argument to NewContext is the function, which is in a1. |
| 181 int slots = info()->scope()->num_heap_slots() - Context::MIN_CONTEXT_SLOTS; | 181 int slots = info()->scope()->num_heap_slots() - Context::MIN_CONTEXT_SLOTS; |
| 182 Safepoint::DeoptMode deopt_mode = Safepoint::kNoLazyDeopt; | 182 Safepoint::DeoptMode deopt_mode = Safepoint::kNoLazyDeopt; |
| 183 if (info()->scope()->is_script_scope()) { | 183 if (info()->scope()->is_script_scope()) { |
| 184 __ push(a1); | 184 __ push(a1); |
| 185 __ Push(info()->scope()->GetScopeInfo(info()->isolate())); | 185 __ Push(info()->scope()->GetScopeInfo(info()->isolate())); |
| 186 __ CallRuntime(Runtime::kNewScriptContext); | 186 __ CallRuntime(Runtime::kNewScriptContext); |
| 187 deopt_mode = Safepoint::kLazyDeopt; | 187 deopt_mode = Safepoint::kLazyDeopt; |
| 188 } else if (slots <= FastNewFunctionContextStub::kMaximumSlots) { | 188 } else { |
| 189 FastNewFunctionContextStub stub(isolate(), slots); | 189 FastNewFunctionContextStub stub(isolate()); |
| 190 __ li(FastNewFunctionContextDescriptor::SlotsRegister(), Operand(slots)); |
| 190 __ CallStub(&stub); | 191 __ CallStub(&stub); |
| 191 // Result of FastNewFunctionContextStub is always in new space. | 192 // Result of FastNewFunctionContextStub is always in new space. |
| 192 need_write_barrier = false; | 193 need_write_barrier = false; |
| 193 } else { | |
| 194 __ push(a1); | |
| 195 __ CallRuntime(Runtime::kNewFunctionContext); | |
| 196 } | 194 } |
| 197 RecordSafepoint(deopt_mode); | 195 RecordSafepoint(deopt_mode); |
| 198 | 196 |
| 199 // Context is returned in both v0. It replaces the context passed to us. | 197 // Context is returned in both v0. It replaces the context passed to us. |
| 200 // It's saved in the stack and kept live in cp. | 198 // It's saved in the stack and kept live in cp. |
| 201 __ mov(cp, v0); | 199 __ mov(cp, v0); |
| 202 __ sw(v0, MemOperand(fp, StandardFrameConstants::kContextOffset)); | 200 __ sw(v0, MemOperand(fp, StandardFrameConstants::kContextOffset)); |
| 203 // Copy any necessary parameters into the context. | 201 // Copy any necessary parameters into the context. |
| 204 int num_parameters = scope()->num_parameters(); | 202 int num_parameters = scope()->num_parameters(); |
| 205 int first_parameter = scope()->has_this_declaration() ? -1 : 0; | 203 int first_parameter = scope()->has_this_declaration() ? -1 : 0; |
| (...skipping 5335 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 5541 __ lw(result, FieldMemOperand(scratch, | 5539 __ lw(result, FieldMemOperand(scratch, |
| 5542 FixedArray::kHeaderSize - kPointerSize)); | 5540 FixedArray::kHeaderSize - kPointerSize)); |
| 5543 __ bind(deferred->exit()); | 5541 __ bind(deferred->exit()); |
| 5544 __ bind(&done); | 5542 __ bind(&done); |
| 5545 } | 5543 } |
| 5546 | 5544 |
| 5547 #undef __ | 5545 #undef __ |
| 5548 | 5546 |
| 5549 } // namespace internal | 5547 } // namespace internal |
| 5550 } // namespace v8 | 5548 } // namespace v8 |
| OLD | NEW |