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 166 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
177 for (int i = 0; i < locals_count; i++) { | 177 for (int i = 0; i < locals_count; i++) { |
178 __ push(ip); | 178 __ push(ip); |
179 } | 179 } |
180 } | 180 } |
181 | 181 |
182 bool function_in_register = true; | 182 bool function_in_register = true; |
183 | 183 |
184 // Possibly allocate a local context. | 184 // Possibly allocate a local context. |
185 int heap_slots = info->scope()->num_heap_slots() - Context::MIN_CONTEXT_SLOTS; | 185 int heap_slots = info->scope()->num_heap_slots() - Context::MIN_CONTEXT_SLOTS; |
186 if (heap_slots > 0) { | 186 if (heap_slots > 0) { |
187 Comment cmnt(masm_, "[ Allocate local context"); | 187 // Argument to NewContext is the function, which is still in r1. |
188 // Argument to NewContext is the function, which is in r1. | 188 Comment cmnt(masm_, "[ Allocate context"); |
189 __ push(r1); | 189 __ push(r1); |
190 if (heap_slots <= FastNewContextStub::kMaximumSlots) { | 190 if (FLAG_harmony_scoping && info->scope()->is_global_scope()) { |
| 191 __ Push(info->scope()->GetScopeInfo()); |
| 192 __ CallRuntime(Runtime::kNewGlobalContext, 2); |
| 193 } else if (heap_slots <= FastNewContextStub::kMaximumSlots) { |
191 FastNewContextStub stub(heap_slots); | 194 FastNewContextStub stub(heap_slots); |
192 __ CallStub(&stub); | 195 __ CallStub(&stub); |
193 } else { | 196 } else { |
194 __ CallRuntime(Runtime::kNewFunctionContext, 1); | 197 __ CallRuntime(Runtime::kNewFunctionContext, 1); |
195 } | 198 } |
196 function_in_register = false; | 199 function_in_register = false; |
197 // Context is returned in both r0 and cp. It replaces the context | 200 // Context is returned in both r0 and cp. It replaces the context |
198 // passed to us. It's saved in the stack and kept live in cp. | 201 // passed to us. It's saved in the stack and kept live in cp. |
199 __ str(cp, MemOperand(fp, StandardFrameConstants::kContextOffset)); | 202 __ str(cp, MemOperand(fp, StandardFrameConstants::kContextOffset)); |
200 // Copy any necessary parameters into the context. | 203 // Copy any necessary parameters into the context. |
(...skipping 4365 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
4566 *context_length = 0; | 4569 *context_length = 0; |
4567 return previous_; | 4570 return previous_; |
4568 } | 4571 } |
4569 | 4572 |
4570 | 4573 |
4571 #undef __ | 4574 #undef __ |
4572 | 4575 |
4573 } } // namespace v8::internal | 4576 } } // namespace v8::internal |
4574 | 4577 |
4575 #endif // V8_TARGET_ARCH_ARM | 4578 #endif // V8_TARGET_ARCH_ARM |
OLD | NEW |