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 182 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
193 if (info()->saves_caller_doubles()) { | 193 if (info()->saves_caller_doubles()) { |
194 SaveCallerDoubles(); | 194 SaveCallerDoubles(); |
195 } | 195 } |
196 | 196 |
197 // Possibly allocate a local context. | 197 // Possibly allocate a local context. |
198 int heap_slots = info()->num_heap_slots() - Context::MIN_CONTEXT_SLOTS; | 198 int heap_slots = info()->num_heap_slots() - Context::MIN_CONTEXT_SLOTS; |
199 if (heap_slots > 0) { | 199 if (heap_slots > 0) { |
200 Comment(";;; Allocate local context"); | 200 Comment(";;; Allocate local context"); |
201 bool need_write_barrier = true; | 201 bool need_write_barrier = true; |
202 // Argument to NewContext is the function, which is in a1. | 202 // Argument to NewContext is the function, which is in a1. |
203 if (FLAG_harmony_scoping && info()->scope()->is_global_scope()) { | 203 if (heap_slots <= FastNewContextStub::kMaximumSlots) { |
204 __ push(a1); | |
205 __ Push(info()->scope()->GetScopeInfo()); | |
206 __ CallRuntime(Runtime::kNewGlobalContext, 2); | |
207 } else if (heap_slots <= FastNewContextStub::kMaximumSlots) { | |
208 FastNewContextStub stub(isolate(), heap_slots); | 204 FastNewContextStub stub(isolate(), heap_slots); |
209 __ CallStub(&stub); | 205 __ CallStub(&stub); |
210 // Result of FastNewContextStub is always in new space. | 206 // Result of FastNewContextStub is always in new space. |
211 need_write_barrier = false; | 207 need_write_barrier = false; |
212 } else { | 208 } else { |
213 __ push(a1); | 209 __ push(a1); |
214 __ CallRuntime(Runtime::kNewFunctionContext, 1); | 210 __ CallRuntime(Runtime::kNewFunctionContext, 1); |
215 } | 211 } |
216 RecordSafepoint(Safepoint::kNoLazyDeopt); | 212 RecordSafepoint(Safepoint::kNoLazyDeopt); |
217 // Context is returned in both v0. It replaces the context passed to us. | 213 // Context is returned in both v0. It replaces the context passed to us. |
(...skipping 5690 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
5908 __ li(at, scope_info); | 5904 __ li(at, scope_info); |
5909 __ Push(at, ToRegister(instr->function())); | 5905 __ Push(at, ToRegister(instr->function())); |
5910 CallRuntime(Runtime::kPushBlockContext, 2, instr); | 5906 CallRuntime(Runtime::kPushBlockContext, 2, instr); |
5911 RecordSafepoint(Safepoint::kNoLazyDeopt); | 5907 RecordSafepoint(Safepoint::kNoLazyDeopt); |
5912 } | 5908 } |
5913 | 5909 |
5914 | 5910 |
5915 #undef __ | 5911 #undef __ |
5916 | 5912 |
5917 } } // namespace v8::internal | 5913 } } // namespace v8::internal |
OLD | NEW |