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 if (info->scope()->is_global_scope()) { |
188 // Argument to NewContext is the function, which is in r1. | 188 Comment cmnt(masm_, "[ Allocate global context"); |
189 __ push(r1); | 189 // Argument to NewContext is the function, which is still in edi. |
Sven Panne
2012/08/27 06:24:54
copy-n-paste typo: should be r1. Consider moving t
rossberg
2012/08/27 09:07:16
Done.
| |
190 if (heap_slots <= FastNewContextStub::kMaximumSlots) { | 190 __ push(r1); |
191 FastNewContextStub stub(heap_slots); | 191 __ Push(info->scope()->GetScopeInfo()); |
192 __ CallStub(&stub); | 192 __ CallRuntime(Runtime::kNewGlobalContext, 2); |
193 } else { | 193 } else { |
194 __ CallRuntime(Runtime::kNewFunctionContext, 1); | 194 Comment cmnt(masm_, "[ Allocate function context"); |
195 // Argument to NewContext is the function, which is still in edi. | |
196 __ push(r1); | |
197 if (heap_slots <= FastNewContextStub::kMaximumSlots) { | |
198 FastNewContextStub stub(heap_slots); | |
199 __ CallStub(&stub); | |
200 } else { | |
201 __ CallRuntime(Runtime::kNewFunctionContext, 1); | |
202 } | |
195 } | 203 } |
196 function_in_register = false; | 204 function_in_register = false; |
197 // Context is returned in both r0 and cp. It replaces the context | 205 // 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. | 206 // passed to us. It's saved in the stack and kept live in cp. |
199 __ str(cp, MemOperand(fp, StandardFrameConstants::kContextOffset)); | 207 __ str(cp, MemOperand(fp, StandardFrameConstants::kContextOffset)); |
200 // Copy any necessary parameters into the context. | 208 // Copy any necessary parameters into the context. |
201 int num_parameters = info->scope()->num_parameters(); | 209 int num_parameters = info->scope()->num_parameters(); |
202 for (int i = 0; i < num_parameters; i++) { | 210 for (int i = 0; i < num_parameters; i++) { |
203 Variable* var = scope()->parameter(i); | 211 Variable* var = scope()->parameter(i); |
204 if (var->IsContextSlot()) { | 212 if (var->IsContextSlot()) { |
(...skipping 4361 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... | |
4566 *context_length = 0; | 4574 *context_length = 0; |
4567 return previous_; | 4575 return previous_; |
4568 } | 4576 } |
4569 | 4577 |
4570 | 4578 |
4571 #undef __ | 4579 #undef __ |
4572 | 4580 |
4573 } } // namespace v8::internal | 4581 } } // namespace v8::internal |
4574 | 4582 |
4575 #endif // V8_TARGET_ARCH_ARM | 4583 #endif // V8_TARGET_ARCH_ARM |
OLD | NEW |