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

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

Issue 169533002: 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
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(locals_count, x10); 186 __ PushMultipleTimes(x10, locals_count);
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 4628 __ PushMultipleTimes(the_hole, w10);
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);
4637 4629
4638 // Enter a new JavaScript frame, and initialize its slots as they were when 4630 // Enter a new JavaScript frame, and initialize its slots as they were when
4639 // the generator was suspended. 4631 // the generator was suspended.
4640 Label resume_frame; 4632 Label resume_frame;
4641 __ Bind(&push_frame);
4642 __ Bl(&resume_frame); 4633 __ Bl(&resume_frame);
4643 __ B(&done); 4634 __ B(&done);
4644 4635
4645 __ Bind(&resume_frame); 4636 __ Bind(&resume_frame);
4646 __ Push(lr, // Return address. 4637 __ Push(lr, // Return address.
4647 fp, // Caller's frame pointer. 4638 fp, // Caller's frame pointer.
4648 cp, // Callee's context. 4639 cp, // Callee's context.
4649 function); // Callee's JS Function. 4640 function); // Callee's JS Function.
4650 __ Add(fp, __ StackPointer(), kPointerSize * 2); 4641 __ Add(fp, __ StackPointer(), kPointerSize * 2);
4651 4642
(...skipping 16 matching lines...) Expand all
4668 __ Mov(x12, Operand(Smi::FromInt(JSGeneratorObject::kGeneratorExecuting))); 4659 __ Mov(x12, Operand(Smi::FromInt(JSGeneratorObject::kGeneratorExecuting)));
4669 __ Str(x12, FieldMemOperand(generator_object, 4660 __ Str(x12, FieldMemOperand(generator_object,
4670 JSGeneratorObject::kContinuationOffset)); 4661 JSGeneratorObject::kContinuationOffset));
4671 __ Br(x10); 4662 __ Br(x10);
4672 4663
4673 __ Bind(&slow_resume); 4664 __ Bind(&slow_resume);
4674 } 4665 }
4675 4666
4676 // Otherwise, we push holes for the operand stack and call the runtime to fix 4667 // Otherwise, we push holes for the operand stack and call the runtime to fix
4677 // up the stack and the handlers. 4668 // up the stack and the handlers.
4678 // TODO(jbramley): Write a variant of PushMultipleTimes which takes a register 4669 __ PushMultipleTimes(the_hole, operand_stack_size);
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);
4686 4670
4687 __ Bind(&call_resume);
4688 __ Mov(x10, Operand(Smi::FromInt(resume_mode))); 4671 __ Mov(x10, Operand(Smi::FromInt(resume_mode)));
4689 __ Push(generator_object, result_register(), x10); 4672 __ Push(generator_object, result_register(), x10);
4690 __ CallRuntime(Runtime::kResumeJSGeneratorObject, 3); 4673 __ CallRuntime(Runtime::kResumeJSGeneratorObject, 3);
4691 // Not reached: the runtime call returns elsewhere. 4674 // Not reached: the runtime call returns elsewhere.
4692 __ Unreachable(); 4675 __ Unreachable();
4693 4676
4694 // Reach here when generator is closed. 4677 // Reach here when generator is closed.
4695 __ Bind(&closed_state); 4678 __ Bind(&closed_state);
4696 if (resume_mode == JSGeneratorObject::NEXT) { 4679 if (resume_mode == JSGeneratorObject::NEXT) {
4697 // Return completed iterator result when generator is closed. 4680 // Return completed iterator result when generator is closed.
(...skipping 306 matching lines...) Expand 10 before | Expand all | Expand 10 after
5004 return previous_; 4987 return previous_;
5005 } 4988 }
5006 4989
5007 4990
5008 #undef __ 4991 #undef __
5009 4992
5010 4993
5011 } } // namespace v8::internal 4994 } } // namespace v8::internal
5012 4995
5013 #endif // V8_TARGET_ARCH_A64 4996 #endif // V8_TARGET_ARCH_A64
OLDNEW

Powered by Google App Engine
This is Rietveld 408576698