Chromium Code Reviews
chromiumcodereview-hr@appspot.gserviceaccount.com (chromiumcodereview-hr) | Please choose your nickname with Settings | Help | Chromium Project | Gerrit Changes | Sign out
(150)

Side by Side Diff: src/x64/full-codegen-x64.cc

Issue 145513002: Turn FastNewContextStub into a HydrogenCodeStub. (Closed) Base URL: https://v8.googlecode.com/svn/branches/bleeding_edge
Patch Set: Created 6 years, 11 months ago
Use n/p to move between diff chunks; N/P to move between comments. Draft comments are only viewable by you.
Jump to:
View unified diff | Download patch | Annotate | Revision Log
« no previous file with comments | « src/x64/code-stubs-x64.cc ('k') | src/x64/lithium-codegen-x64.cc » ('j') | no next file with comments »
Toggle Intra-line Diffs ('i') | Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
OLDNEW
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 164 matching lines...) Expand 10 before | Expand all | Expand 10 after
175 } 175 }
176 } 176 }
177 177
178 bool function_in_register = true; 178 bool function_in_register = true;
179 179
180 // Possibly allocate a local context. 180 // Possibly allocate a local context.
181 int heap_slots = info->scope()->num_heap_slots() - Context::MIN_CONTEXT_SLOTS; 181 int heap_slots = info->scope()->num_heap_slots() - Context::MIN_CONTEXT_SLOTS;
182 if (heap_slots > 0) { 182 if (heap_slots > 0) {
183 Comment cmnt(masm_, "[ Allocate context"); 183 Comment cmnt(masm_, "[ Allocate context");
184 // Argument to NewContext is the function, which is still in rdi. 184 // Argument to NewContext is the function, which is still in rdi.
185 __ push(rdi);
186 if (FLAG_harmony_scoping && info->scope()->is_global_scope()) { 185 if (FLAG_harmony_scoping && info->scope()->is_global_scope()) {
186 __ push(rdi);
187 __ Push(info->scope()->GetScopeInfo()); 187 __ Push(info->scope()->GetScopeInfo());
188 __ CallRuntime(Runtime::kNewGlobalContext, 2); 188 __ CallRuntime(Runtime::kNewGlobalContext, 2);
189 } else if (heap_slots <= FastNewContextStub::kMaximumSlots) { 189 } else if (heap_slots <= FastNewContextStub::kMaximumSlots) {
190 FastNewContextStub stub(heap_slots); 190 FastNewContextStub stub(heap_slots);
191 __ CallStub(&stub); 191 __ CallStub(&stub);
192 } else { 192 } else {
193 __ push(rdi);
193 __ CallRuntime(Runtime::kNewFunctionContext, 1); 194 __ CallRuntime(Runtime::kNewFunctionContext, 1);
194 } 195 }
195 function_in_register = false; 196 function_in_register = false;
196 // Context is returned in both rax and rsi. It replaces the context 197 // Context is returned in rax. It replaces the context passed to us.
197 // passed to us. It's saved in the stack and kept live in rsi. 198 // It's saved in the stack and kept live in rsi.
198 __ movp(Operand(rbp, StandardFrameConstants::kContextOffset), rsi); 199 __ movp(rsi, rax);
200 __ movp(Operand(rbp, StandardFrameConstants::kContextOffset), rax);
199 201
200 // Copy any necessary parameters into the context. 202 // Copy any necessary parameters into the context.
201 int num_parameters = info->scope()->num_parameters(); 203 int num_parameters = info->scope()->num_parameters();
202 for (int i = 0; i < num_parameters; i++) { 204 for (int i = 0; i < num_parameters; i++) {
203 Variable* var = scope()->parameter(i); 205 Variable* var = scope()->parameter(i);
204 if (var->IsContextSlot()) { 206 if (var->IsContextSlot()) {
205 int parameter_offset = StandardFrameConstants::kCallerSPOffset + 207 int parameter_offset = StandardFrameConstants::kCallerSPOffset +
206 (num_parameters - 1 - i) * kPointerSize; 208 (num_parameters - 1 - i) * kPointerSize;
207 // Load parameter from stack. 209 // Load parameter from stack.
208 __ movp(rax, Operand(rbp, parameter_offset)); 210 __ movp(rax, Operand(rbp, parameter_offset));
(...skipping 4682 matching lines...) Expand 10 before | Expand all | Expand 10 after
4891 4893
4892 ASSERT_EQ(isolate->builtins()->OsrAfterStackCheck()->entry(), 4894 ASSERT_EQ(isolate->builtins()->OsrAfterStackCheck()->entry(),
4893 Assembler::target_address_at(call_target_address)); 4895 Assembler::target_address_at(call_target_address));
4894 return OSR_AFTER_STACK_CHECK; 4896 return OSR_AFTER_STACK_CHECK;
4895 } 4897 }
4896 4898
4897 4899
4898 } } // namespace v8::internal 4900 } } // namespace v8::internal
4899 4901
4900 #endif // V8_TARGET_ARCH_X64 4902 #endif // V8_TARGET_ARCH_X64
OLDNEW
« no previous file with comments | « src/x64/code-stubs-x64.cc ('k') | src/x64/lithium-codegen-x64.cc » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698