| 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 160 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 171 __ push(eax); | 171 __ push(eax); |
| 172 } | 172 } |
| 173 } | 173 } |
| 174 } | 174 } |
| 175 | 175 |
| 176 bool function_in_register = true; | 176 bool function_in_register = true; |
| 177 | 177 |
| 178 // Possibly allocate a local context. | 178 // Possibly allocate a local context. |
| 179 int heap_slots = info->scope()->num_heap_slots() - Context::MIN_CONTEXT_SLOTS; | 179 int heap_slots = info->scope()->num_heap_slots() - Context::MIN_CONTEXT_SLOTS; |
| 180 if (heap_slots > 0) { | 180 if (heap_slots > 0) { |
| 181 Comment cmnt(masm_, "[ Allocate local context"); | 181 Comment cmnt(masm_, "[ Allocate context"); |
| 182 // Argument to NewContext is the function, which is still in edi. | 182 // Argument to NewContext is the function, which is still in edi. |
| 183 __ push(edi); | 183 __ push(edi); |
| 184 if (heap_slots <= FastNewContextStub::kMaximumSlots) { | 184 if (FLAG_harmony_scoping && info->scope()->is_global_scope()) { |
| 185 __ Push(info->scope()->GetScopeInfo()); |
| 186 __ CallRuntime(Runtime::kNewGlobalContext, 2); |
| 187 } else if (heap_slots <= FastNewContextStub::kMaximumSlots) { |
| 185 FastNewContextStub stub(heap_slots); | 188 FastNewContextStub stub(heap_slots); |
| 186 __ CallStub(&stub); | 189 __ CallStub(&stub); |
| 187 } else { | 190 } else { |
| 188 __ CallRuntime(Runtime::kNewFunctionContext, 1); | 191 __ CallRuntime(Runtime::kNewFunctionContext, 1); |
| 189 } | 192 } |
| 190 function_in_register = false; | 193 function_in_register = false; |
| 191 // Context is returned in both eax and esi. It replaces the context | 194 // Context is returned in both eax and esi. It replaces the context |
| 192 // passed to us. It's saved in the stack and kept live in esi. | 195 // passed to us. It's saved in the stack and kept live in esi. |
| 193 __ mov(Operand(ebp, StandardFrameConstants::kContextOffset), esi); | 196 __ mov(Operand(ebp, StandardFrameConstants::kContextOffset), esi); |
| 194 | 197 |
| (...skipping 4348 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 4543 *stack_depth = 0; | 4546 *stack_depth = 0; |
| 4544 *context_length = 0; | 4547 *context_length = 0; |
| 4545 return previous_; | 4548 return previous_; |
| 4546 } | 4549 } |
| 4547 | 4550 |
| 4548 #undef __ | 4551 #undef __ |
| 4549 | 4552 |
| 4550 } } // namespace v8::internal | 4553 } } // namespace v8::internal |
| 4551 | 4554 |
| 4552 #endif // V8_TARGET_ARCH_IA32 | 4555 #endif // V8_TARGET_ARCH_IA32 |
| OLD | NEW |