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

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

Issue 169303007: Revert r19403: "A64: Tidy up Push and Pop TODOs." (Closed) Base URL: https://v8.googlecode.com/svn/branches/bleeding_edge
Patch Set: Created 6 years, 10 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/a64/code-stubs-a64.cc ('k') | src/a64/macro-assembler-a64.h » ('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 2013 the V8 project authors. All rights reserved. 1 // Copyright 2013 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 165 matching lines...) Expand 10 before | Expand all | Expand 10 after
176 info->AddNoFrameRange(0, masm_->pc_offset()); 176 info->AddNoFrameRange(0, masm_->pc_offset());
177 177
178 // Reserve space on the stack for locals. 178 // Reserve space on the stack for locals.
179 { Comment cmnt(masm_, "[ Allocate locals"); 179 { Comment cmnt(masm_, "[ Allocate locals");
180 int locals_count = info->scope()->num_stack_slots(); 180 int locals_count = info->scope()->num_stack_slots();
181 // Generators allocate locals, if any, in context slots. 181 // Generators allocate locals, if any, in context slots.
182 ASSERT(!info->function()->is_generator() || locals_count == 0); 182 ASSERT(!info->function()->is_generator() || locals_count == 0);
183 183
184 if (locals_count > 0) { 184 if (locals_count > 0) {
185 __ LoadRoot(x10, Heap::kUndefinedValueRootIndex); 185 __ LoadRoot(x10, Heap::kUndefinedValueRootIndex);
186 __ PushMultipleTimes(x10, locals_count); 186 __ PushMultipleTimes(locals_count, x10);
187 } 187 }
188 } 188 }
189 189
190 bool function_in_register_x1 = true; 190 bool function_in_register_x1 = true;
191 191
192 int heap_slots = info->scope()->num_heap_slots() - Context::MIN_CONTEXT_SLOTS; 192 int heap_slots = info->scope()->num_heap_slots() - Context::MIN_CONTEXT_SLOTS;
193 if (heap_slots > 0) { 193 if (heap_slots > 0) {
194 // Argument to NewContext is the function, which is still in x1. 194 // Argument to NewContext is the function, which is still in x1.
195 Comment cmnt(masm_, "[ Allocate context"); 195 Comment cmnt(masm_, "[ Allocate context");
196 if (FLAG_harmony_scoping && info->scope()->is_global_scope()) { 196 if (FLAG_harmony_scoping && info->scope()->is_global_scope()) {
(...skipping 4421 matching lines...) Expand 10 before | Expand all | Expand 10 after
4618 // Push holes for the rest of the arguments to the generator function. 4618 // Push holes for the rest of the arguments to the generator function.
4619 __ Ldr(x10, FieldMemOperand(function, JSFunction::kSharedFunctionInfoOffset)); 4619 __ Ldr(x10, FieldMemOperand(function, JSFunction::kSharedFunctionInfoOffset));
4620 4620
4621 // The number of arguments is stored as an int32_t, and -1 is a marker 4621 // The number of arguments is stored as an int32_t, and -1 is a marker
4622 // (SharedFunctionInfo::kDontAdaptArgumentsSentinel), so we need sign 4622 // (SharedFunctionInfo::kDontAdaptArgumentsSentinel), so we need sign
4623 // extension to correctly handle it. However, in this case, we operate on 4623 // extension to correctly handle it. However, in this case, we operate on
4624 // 32-bit W registers, so extension isn't required. 4624 // 32-bit W registers, so extension isn't required.
4625 __ Ldr(w10, FieldMemOperand(x10, 4625 __ Ldr(w10, FieldMemOperand(x10,
4626 SharedFunctionInfo::kFormalParameterCountOffset)); 4626 SharedFunctionInfo::kFormalParameterCountOffset));
4627 __ LoadRoot(the_hole, Heap::kTheHoleValueRootIndex); 4627 __ LoadRoot(the_hole, Heap::kTheHoleValueRootIndex);
4628 __ PushMultipleTimes(the_hole, w10); 4628
4629 // TODO(jbramley): Write a variant of PushMultipleTimes which takes a register
4630 // instead of a constant count, and use it to replace this loop.
4631 Label push_argument_holes, push_frame;
4632 __ Bind(&push_argument_holes);
4633 __ Subs(w10, w10, 1);
4634 __ B(mi, &push_frame);
4635 __ Push(the_hole);
4636 __ B(&push_argument_holes);
4629 4637
4630 // Enter a new JavaScript frame, and initialize its slots as they were when 4638 // Enter a new JavaScript frame, and initialize its slots as they were when
4631 // the generator was suspended. 4639 // the generator was suspended.
4632 Label resume_frame; 4640 Label resume_frame;
4641 __ Bind(&push_frame);
4633 __ Bl(&resume_frame); 4642 __ Bl(&resume_frame);
4634 __ B(&done); 4643 __ B(&done);
4635 4644
4636 __ Bind(&resume_frame); 4645 __ Bind(&resume_frame);
4637 __ Push(lr, // Return address. 4646 __ Push(lr, // Return address.
4638 fp, // Caller's frame pointer. 4647 fp, // Caller's frame pointer.
4639 cp, // Callee's context. 4648 cp, // Callee's context.
4640 function); // Callee's JS Function. 4649 function); // Callee's JS Function.
4641 __ Add(fp, __ StackPointer(), kPointerSize * 2); 4650 __ Add(fp, __ StackPointer(), kPointerSize * 2);
4642 4651
(...skipping 16 matching lines...) Expand all
4659 __ Mov(x12, Operand(Smi::FromInt(JSGeneratorObject::kGeneratorExecuting))); 4668 __ Mov(x12, Operand(Smi::FromInt(JSGeneratorObject::kGeneratorExecuting)));
4660 __ Str(x12, FieldMemOperand(generator_object, 4669 __ Str(x12, FieldMemOperand(generator_object,
4661 JSGeneratorObject::kContinuationOffset)); 4670 JSGeneratorObject::kContinuationOffset));
4662 __ Br(x10); 4671 __ Br(x10);
4663 4672
4664 __ Bind(&slow_resume); 4673 __ Bind(&slow_resume);
4665 } 4674 }
4666 4675
4667 // Otherwise, we push holes for the operand stack and call the runtime to fix 4676 // Otherwise, we push holes for the operand stack and call the runtime to fix
4668 // up the stack and the handlers. 4677 // up the stack and the handlers.
4669 __ PushMultipleTimes(the_hole, operand_stack_size); 4678 // TODO(jbramley): Write a variant of PushMultipleTimes which takes a register
4679 // instead of a constant count, and use it to replace this loop.
4680 Label push_operand_holes, call_resume;
4681 __ Bind(&push_operand_holes);
4682 __ Subs(operand_stack_size, operand_stack_size, 1);
4683 __ B(mi, &call_resume);
4684 __ Push(the_hole);
4685 __ B(&push_operand_holes);
4670 4686
4687 __ Bind(&call_resume);
4671 __ Mov(x10, Operand(Smi::FromInt(resume_mode))); 4688 __ Mov(x10, Operand(Smi::FromInt(resume_mode)));
4672 __ Push(generator_object, result_register(), x10); 4689 __ Push(generator_object, result_register(), x10);
4673 __ CallRuntime(Runtime::kResumeJSGeneratorObject, 3); 4690 __ CallRuntime(Runtime::kResumeJSGeneratorObject, 3);
4674 // Not reached: the runtime call returns elsewhere. 4691 // Not reached: the runtime call returns elsewhere.
4675 __ Unreachable(); 4692 __ Unreachable();
4676 4693
4677 // Reach here when generator is closed. 4694 // Reach here when generator is closed.
4678 __ Bind(&closed_state); 4695 __ Bind(&closed_state);
4679 if (resume_mode == JSGeneratorObject::NEXT) { 4696 if (resume_mode == JSGeneratorObject::NEXT) {
4680 // Return completed iterator result when generator is closed. 4697 // Return completed iterator result when generator is closed.
(...skipping 306 matching lines...) Expand 10 before | Expand all | Expand 10 after
4987 return previous_; 5004 return previous_;
4988 } 5005 }
4989 5006
4990 5007
4991 #undef __ 5008 #undef __
4992 5009
4993 5010
4994 } } // namespace v8::internal 5011 } } // namespace v8::internal
4995 5012
4996 #endif // V8_TARGET_ARCH_A64 5013 #endif // V8_TARGET_ARCH_A64
OLDNEW
« no previous file with comments | « src/a64/code-stubs-a64.cc ('k') | src/a64/macro-assembler-a64.h » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698