OLD | NEW |
1 // Copyright 2012 the V8 project authors. All rights reserved. | 1 // Copyright 2012 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 174 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
185 for (int i = 0; i < locals_count; i++) { | 185 for (int i = 0; i < locals_count; i++) { |
186 __ push(at); | 186 __ push(at); |
187 } | 187 } |
188 } | 188 } |
189 | 189 |
190 bool function_in_register = true; | 190 bool function_in_register = true; |
191 | 191 |
192 // Possibly allocate a local context. | 192 // Possibly allocate a local context. |
193 int heap_slots = info->scope()->num_heap_slots() - Context::MIN_CONTEXT_SLOTS; | 193 int heap_slots = info->scope()->num_heap_slots() - Context::MIN_CONTEXT_SLOTS; |
194 if (heap_slots > 0) { | 194 if (heap_slots > 0) { |
195 Comment cmnt(masm_, "[ Allocate local context"); | 195 Comment cmnt(masm_, "[ Allocate context"); |
196 // Argument to NewContext is the function, which is in a1. | 196 // Argument to NewContext is the function, which is still in a1. |
197 __ push(a1); | 197 __ push(a1); |
198 if (heap_slots <= FastNewContextStub::kMaximumSlots) { | 198 if (FLAG_harmony_scoping && info->scope()->is_global_scope()) { |
| 199 __ Push(info->scope()->GetScopeInfo()); |
| 200 __ CallRuntime(Runtime::kNewGlobalContext, 2); |
| 201 } else if (heap_slots <= FastNewContextStub::kMaximumSlots) { |
199 FastNewContextStub stub(heap_slots); | 202 FastNewContextStub stub(heap_slots); |
200 __ CallStub(&stub); | 203 __ CallStub(&stub); |
201 } else { | 204 } else { |
202 __ CallRuntime(Runtime::kNewFunctionContext, 1); | 205 __ CallRuntime(Runtime::kNewFunctionContext, 1); |
203 } | 206 } |
204 function_in_register = false; | 207 function_in_register = false; |
205 // Context is returned in both v0 and cp. It replaces the context | 208 // Context is returned in both v0 and cp. It replaces the context |
206 // passed to us. It's saved in the stack and kept live in cp. | 209 // passed to us. It's saved in the stack and kept live in cp. |
207 __ sw(cp, MemOperand(fp, StandardFrameConstants::kContextOffset)); | 210 __ sw(cp, MemOperand(fp, StandardFrameConstants::kContextOffset)); |
208 // Copy any necessary parameters into the context. | 211 // Copy any necessary parameters into the context. |
(...skipping 4401 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
4610 *context_length = 0; | 4613 *context_length = 0; |
4611 return previous_; | 4614 return previous_; |
4612 } | 4615 } |
4613 | 4616 |
4614 | 4617 |
4615 #undef __ | 4618 #undef __ |
4616 | 4619 |
4617 } } // namespace v8::internal | 4620 } } // namespace v8::internal |
4618 | 4621 |
4619 #endif // V8_TARGET_ARCH_MIPS | 4622 #endif // V8_TARGET_ARCH_MIPS |
OLD | NEW |