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