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

Side by Side Diff: src/x64/code-stubs-x64.cc

Issue 7134042: Link function contexts directly to the previous context. (Closed) Base URL: https://v8.googlecode.com/svn/branches/bleeding_edge
Patch Set: Avoid calling previous on the global context. Created 9 years, 6 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/runtime.cc ('k') | src/x64/macro-assembler-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 2011 the V8 project authors. All rights reserved. 1 // Copyright 2011 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 115 matching lines...) Expand 10 before | Expand all | Expand 10 after
126 126
127 // Setup the object header. 127 // Setup the object header.
128 __ LoadRoot(kScratchRegister, Heap::kFunctionContextMapRootIndex); 128 __ LoadRoot(kScratchRegister, Heap::kFunctionContextMapRootIndex);
129 __ movq(FieldOperand(rax, HeapObject::kMapOffset), kScratchRegister); 129 __ movq(FieldOperand(rax, HeapObject::kMapOffset), kScratchRegister);
130 __ Move(FieldOperand(rax, FixedArray::kLengthOffset), Smi::FromInt(length)); 130 __ Move(FieldOperand(rax, FixedArray::kLengthOffset), Smi::FromInt(length));
131 131
132 // Setup the fixed slots. 132 // Setup the fixed slots.
133 __ Set(rbx, 0); // Set to NULL. 133 __ Set(rbx, 0); // Set to NULL.
134 __ movq(Operand(rax, Context::SlotOffset(Context::CLOSURE_INDEX)), rcx); 134 __ movq(Operand(rax, Context::SlotOffset(Context::CLOSURE_INDEX)), rcx);
135 __ movq(Operand(rax, Context::SlotOffset(Context::FCONTEXT_INDEX)), rax); 135 __ movq(Operand(rax, Context::SlotOffset(Context::FCONTEXT_INDEX)), rax);
136 __ movq(Operand(rax, Context::SlotOffset(Context::PREVIOUS_INDEX)), rbx); 136 __ movq(Operand(rax, Context::SlotOffset(Context::PREVIOUS_INDEX)), rsi);
137 __ movq(Operand(rax, Context::SlotOffset(Context::EXTENSION_INDEX)), rbx); 137 __ movq(Operand(rax, Context::SlotOffset(Context::EXTENSION_INDEX)), rbx);
138 138
139 // Copy the global object from the surrounding context. 139 // Copy the global object from the previous context.
140 __ movq(rbx, Operand(rsi, Context::SlotOffset(Context::GLOBAL_INDEX))); 140 __ movq(rbx, Operand(rsi, Context::SlotOffset(Context::GLOBAL_INDEX)));
141 __ movq(Operand(rax, Context::SlotOffset(Context::GLOBAL_INDEX)), rbx); 141 __ movq(Operand(rax, Context::SlotOffset(Context::GLOBAL_INDEX)), rbx);
142 142
143 // Initialize the rest of the slots to undefined. 143 // Initialize the rest of the slots to undefined.
144 __ LoadRoot(rbx, Heap::kUndefinedValueRootIndex); 144 __ LoadRoot(rbx, Heap::kUndefinedValueRootIndex);
145 for (int i = Context::MIN_CONTEXT_SLOTS; i < length; i++) { 145 for (int i = Context::MIN_CONTEXT_SLOTS; i < length; i++) {
146 __ movq(Operand(rax, Context::SlotOffset(i)), rbx); 146 __ movq(Operand(rax, Context::SlotOffset(i)), rbx);
147 } 147 }
148 148
149 // Return and remove the on-stack parameter. 149 // Return and remove the on-stack parameter.
(...skipping 4977 matching lines...) Expand 10 before | Expand all | Expand 10 after
5127 __ Drop(1); 5127 __ Drop(1);
5128 __ ret(2 * kPointerSize); 5128 __ ret(2 * kPointerSize);
5129 } 5129 }
5130 5130
5131 5131
5132 #undef __ 5132 #undef __
5133 5133
5134 } } // namespace v8::internal 5134 } } // namespace v8::internal
5135 5135
5136 #endif // V8_TARGET_ARCH_X64 5136 #endif // V8_TARGET_ARCH_X64
OLDNEW
« no previous file with comments | « src/runtime.cc ('k') | src/x64/macro-assembler-x64.cc » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698