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

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

Issue 88043002: Out-of-line constant pool on Arm: Stage 3 - Set Constant Pool Pointer on Function Entry (Closed) Base URL: https://v8.googlecode.com/svn/branches/bleeding_edge
Patch Set: Add immed check Created 7 years 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 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 101 matching lines...) Expand 10 before | Expand all | Expand 10 after
112 112
113 113
114 // Generate code for a JS function. On entry to the function the receiver 114 // Generate code for a JS function. On entry to the function the receiver
115 // and arguments have been pushed on the stack left to right. The actual 115 // and arguments have been pushed on the stack left to right. The actual
116 // argument count matches the formal parameter count expected by the 116 // argument count matches the formal parameter count expected by the
117 // function. 117 // function.
118 // 118 //
119 // The live registers are: 119 // The live registers are:
120 // o r1: the JS function object being called (i.e., ourselves) 120 // o r1: the JS function object being called (i.e., ourselves)
121 // o cp: our context 121 // o cp: our context
122 // o pp: our caller's constant pool pointer (if FLAG_enable_ool_constant_pool)
122 // o fp: our caller's frame pointer 123 // o fp: our caller's frame pointer
123 // o sp: stack pointer 124 // o sp: stack pointer
124 // o lr: return address 125 // o lr: return address
125 // 126 //
126 // The function builds a JS frame. Please see JavaScriptFrameConstants in 127 // The function builds a JS frame. Please see JavaScriptFrameConstants in
127 // frames-arm.h for its layout. 128 // frames-arm.h for its layout.
128 void FullCodeGenerator::Generate() { 129 void FullCodeGenerator::Generate() {
129 CompilationInfo* info = info_; 130 CompilationInfo* info = info_;
130 handler_table_ = 131 handler_table_ =
131 isolate()->factory()->NewFixedArray(function()->handler_count(), TENURED); 132 isolate()->factory()->NewFixedArray(function()->handler_count(), TENURED);
(...skipping 23 matching lines...) Expand all
155 } 156 }
156 157
157 // Open a frame scope to indicate that there is a frame on the stack. The 158 // Open a frame scope to indicate that there is a frame on the stack. The
158 // MANUAL indicates that the scope shouldn't actually generate code to set up 159 // MANUAL indicates that the scope shouldn't actually generate code to set up
159 // the frame (that is done below). 160 // the frame (that is done below).
160 FrameScope frame_scope(masm_, StackFrame::MANUAL); 161 FrameScope frame_scope(masm_, StackFrame::MANUAL);
161 162
162 info->set_prologue_offset(masm_->pc_offset()); 163 info->set_prologue_offset(masm_->pc_offset());
163 __ Prologue(BUILD_FUNCTION_FRAME); 164 __ Prologue(BUILD_FUNCTION_FRAME);
164 info->AddNoFrameRange(0, masm_->pc_offset()); 165 info->AddNoFrameRange(0, masm_->pc_offset());
166 __ LoadConstantPoolPointerRegister();
165 167
166 { Comment cmnt(masm_, "[ Allocate locals"); 168 { Comment cmnt(masm_, "[ Allocate locals");
167 int locals_count = info->scope()->num_stack_slots(); 169 int locals_count = info->scope()->num_stack_slots();
168 // Generators allocate locals, if any, in context slots. 170 // Generators allocate locals, if any, in context slots.
169 ASSERT(!info->function()->is_generator() || locals_count == 0); 171 ASSERT(!info->function()->is_generator() || locals_count == 0);
170 if (locals_count > 0) { 172 if (locals_count > 0) {
171 // Emit a loop to initialize stack cells for locals when optimizing for 173 // Emit a loop to initialize stack cells for locals when optimizing for
172 // size. Otherwise, unroll the loop for maximum performance. 174 // size. Otherwise, unroll the loop for maximum performance.
173 __ LoadRoot(r9, Heap::kUndefinedValueRootIndex); 175 __ LoadRoot(r9, Heap::kUndefinedValueRootIndex);
174 if (FLAG_optimize_for_size && locals_count > 4) { 176 if (FLAG_optimize_for_size && locals_count > 4) {
(...skipping 242 matching lines...) Expand 10 before | Expand all | Expand 10 after
417 RelocInfo::CODE_TARGET); 419 RelocInfo::CODE_TARGET);
418 } 420 }
419 __ pop(r0); 421 __ pop(r0);
420 EmitProfilingCounterReset(); 422 EmitProfilingCounterReset();
421 __ bind(&ok); 423 __ bind(&ok);
422 } 424 }
423 425
424 #ifdef DEBUG 426 #ifdef DEBUG
425 // Add a label for checking the size of the code used for returning. 427 // Add a label for checking the size of the code used for returning.
426 Label check_exit_codesize; 428 Label check_exit_codesize;
427 masm_->bind(&check_exit_codesize); 429 __ bind(&check_exit_codesize);
428 #endif 430 #endif
429 // Make sure that the constant pool is not emitted inside of the return 431 // Make sure that the constant pool is not emitted inside of the return
430 // sequence. 432 // sequence.
431 { Assembler::BlockConstPoolScope block_const_pool(masm_); 433 { Assembler::BlockConstPoolScope block_const_pool(masm_);
432 // Here we use masm_-> instead of the __ macro to avoid the code coverage
433 // tool from instrumenting as we rely on the code size here.
434 int32_t sp_delta = (info_->scope()->num_parameters() + 1) * kPointerSize; 434 int32_t sp_delta = (info_->scope()->num_parameters() + 1) * kPointerSize;
435 CodeGenerator::RecordPositions(masm_, function()->end_position() - 1); 435 CodeGenerator::RecordPositions(masm_, function()->end_position() - 1);
436 // TODO(svenpanne) The code below is sometimes 4 words, sometimes 5! 436 // TODO(svenpanne) The code below is sometimes 4 words, sometimes 5!
437 PredictableCodeSizeScope predictable(masm_, -1); 437 PredictableCodeSizeScope predictable(masm_, -1);
438 __ RecordJSReturn(); 438 __ RecordJSReturn();
439 masm_->mov(sp, fp); 439 int no_frame_start = __ LeaveFrame(StackFrame::JAVA_SCRIPT);
440 int no_frame_start = masm_->pc_offset(); 440 __ add(sp, sp, Operand(sp_delta));
441 masm_->ldm(ia_w, sp, fp.bit() | lr.bit()); 441 __ Jump(lr);
442 masm_->add(sp, sp, Operand(sp_delta));
443 masm_->Jump(lr);
444 info_->AddNoFrameRange(no_frame_start, masm_->pc_offset()); 442 info_->AddNoFrameRange(no_frame_start, masm_->pc_offset());
445 } 443 }
446 444
447 #ifdef DEBUG 445 #ifdef DEBUG
448 // Check that the size of the code used for returning is large enough 446 // Check that the size of the code used for returning is large enough
449 // for the debugger's requirements. 447 // for the debugger's requirements.
450 ASSERT(Assembler::kJSReturnSequenceInstructions <= 448 ASSERT(Assembler::kJSReturnSequenceInstructions <=
451 masm_->InstructionsGeneratedSince(&check_exit_codesize)); 449 masm_->InstructionsGeneratedSince(&check_exit_codesize));
452 #endif 450 #endif
453 } 451 }
(...skipping 1708 matching lines...) Expand 10 before | Expand all | Expand 10 after
2162 2160
2163 // Enter a new JavaScript frame, and initialize its slots as they were when 2161 // Enter a new JavaScript frame, and initialize its slots as they were when
2164 // the generator was suspended. 2162 // the generator was suspended.
2165 Label resume_frame; 2163 Label resume_frame;
2166 __ bind(&push_frame); 2164 __ bind(&push_frame);
2167 __ bl(&resume_frame); 2165 __ bl(&resume_frame);
2168 __ jmp(&done); 2166 __ jmp(&done);
2169 __ bind(&resume_frame); 2167 __ bind(&resume_frame);
2170 // lr = return address. 2168 // lr = return address.
2171 // fp = caller's frame pointer. 2169 // fp = caller's frame pointer.
2170 // pp = caller's constant pool (if FLAG_enable_ool_constant_pool),
2172 // cp = callee's context, 2171 // cp = callee's context,
2173 // r4 = callee's JS function. 2172 // r4 = callee's JS function.
2174 __ Push(lr, fp, cp, r4); 2173 __ PushFixedFrame(r4);
2175 // Adjust FP to point to saved FP. 2174 // Adjust FP to point to saved FP.
2176 __ add(fp, sp, Operand(2 * kPointerSize)); 2175 __ add(fp, sp, Operand(StandardFrameConstants::kFixedFrameSizeFromFp));
2177 2176
2178 // Load the operand stack size. 2177 // Load the operand stack size.
2179 __ ldr(r3, FieldMemOperand(r1, JSGeneratorObject::kOperandStackOffset)); 2178 __ ldr(r3, FieldMemOperand(r1, JSGeneratorObject::kOperandStackOffset));
2180 __ ldr(r3, FieldMemOperand(r3, FixedArray::kLengthOffset)); 2179 __ ldr(r3, FieldMemOperand(r3, FixedArray::kLengthOffset));
2181 __ SmiUntag(r3); 2180 __ SmiUntag(r3);
2182 2181
2183 // If we are sending a value and there is no operand stack, we can jump back 2182 // If we are sending a value and there is no operand stack, we can jump back
2184 // in directly. 2183 // in directly.
2185 if (resume_mode == JSGeneratorObject::NEXT) { 2184 if (resume_mode == JSGeneratorObject::NEXT) {
2186 Label slow_resume; 2185 Label slow_resume;
(...skipping 2742 matching lines...) Expand 10 before | Expand all | Expand 10 after
4929 ASSERT(Memory::uint32_at(interrupt_address_pointer) == 4928 ASSERT(Memory::uint32_at(interrupt_address_pointer) ==
4930 reinterpret_cast<uint32_t>( 4929 reinterpret_cast<uint32_t>(
4931 isolate->builtins()->OsrAfterStackCheck()->entry())); 4930 isolate->builtins()->OsrAfterStackCheck()->entry()));
4932 return OSR_AFTER_STACK_CHECK; 4931 return OSR_AFTER_STACK_CHECK;
4933 } 4932 }
4934 4933
4935 4934
4936 } } // namespace v8::internal 4935 } } // namespace v8::internal
4937 4936
4938 #endif // V8_TARGET_ARCH_ARM 4937 #endif // V8_TARGET_ARCH_ARM
OLDNEW

Powered by Google App Engine
This is Rietveld 408576698