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

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: Sync and Rebase 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/arm/frames-arm.cc ('k') | src/arm/lithium-codegen-arm.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 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 227 matching lines...) Expand 10 before | Expand all | Expand 10 after
402 __ push(r0); 404 __ push(r0);
403 __ Call(isolate()->builtins()->InterruptCheck(), 405 __ Call(isolate()->builtins()->InterruptCheck(),
404 RelocInfo::CODE_TARGET); 406 RelocInfo::CODE_TARGET);
405 __ pop(r0); 407 __ pop(r0);
406 EmitProfilingCounterReset(); 408 EmitProfilingCounterReset();
407 __ bind(&ok); 409 __ bind(&ok);
408 410
409 #ifdef DEBUG 411 #ifdef DEBUG
410 // Add a label for checking the size of the code used for returning. 412 // Add a label for checking the size of the code used for returning.
411 Label check_exit_codesize; 413 Label check_exit_codesize;
412 masm_->bind(&check_exit_codesize); 414 __ bind(&check_exit_codesize);
413 #endif 415 #endif
414 // Make sure that the constant pool is not emitted inside of the return 416 // Make sure that the constant pool is not emitted inside of the return
415 // sequence. 417 // sequence.
416 { Assembler::BlockConstPoolScope block_const_pool(masm_); 418 { Assembler::BlockConstPoolScope block_const_pool(masm_);
417 // Here we use masm_-> instead of the __ macro to avoid the code coverage
418 // tool from instrumenting as we rely on the code size here.
419 int32_t sp_delta = (info_->scope()->num_parameters() + 1) * kPointerSize; 419 int32_t sp_delta = (info_->scope()->num_parameters() + 1) * kPointerSize;
420 CodeGenerator::RecordPositions(masm_, function()->end_position() - 1); 420 CodeGenerator::RecordPositions(masm_, function()->end_position() - 1);
421 // TODO(svenpanne) The code below is sometimes 4 words, sometimes 5! 421 // TODO(svenpanne) The code below is sometimes 4 words, sometimes 5!
422 PredictableCodeSizeScope predictable(masm_, -1); 422 PredictableCodeSizeScope predictable(masm_, -1);
423 __ RecordJSReturn(); 423 __ RecordJSReturn();
424 masm_->mov(sp, fp); 424 int no_frame_start = __ LeaveFrame(StackFrame::JAVA_SCRIPT);
425 int no_frame_start = masm_->pc_offset(); 425 __ add(sp, sp, Operand(sp_delta));
426 masm_->ldm(ia_w, sp, fp.bit() | lr.bit()); 426 __ Jump(lr);
427 masm_->add(sp, sp, Operand(sp_delta));
428 masm_->Jump(lr);
429 info_->AddNoFrameRange(no_frame_start, masm_->pc_offset()); 427 info_->AddNoFrameRange(no_frame_start, masm_->pc_offset());
430 } 428 }
431 429
432 #ifdef DEBUG 430 #ifdef DEBUG
433 // Check that the size of the code used for returning is large enough 431 // Check that the size of the code used for returning is large enough
434 // for the debugger's requirements. 432 // for the debugger's requirements.
435 ASSERT(Assembler::kJSReturnSequenceInstructions <= 433 ASSERT(Assembler::kJSReturnSequenceInstructions <=
436 masm_->InstructionsGeneratedSince(&check_exit_codesize)); 434 masm_->InstructionsGeneratedSince(&check_exit_codesize));
437 #endif 435 #endif
438 } 436 }
(...skipping 1718 matching lines...) Expand 10 before | Expand all | Expand 10 after
2157 2155
2158 // Enter a new JavaScript frame, and initialize its slots as they were when 2156 // Enter a new JavaScript frame, and initialize its slots as they were when
2159 // the generator was suspended. 2157 // the generator was suspended.
2160 Label resume_frame; 2158 Label resume_frame;
2161 __ bind(&push_frame); 2159 __ bind(&push_frame);
2162 __ bl(&resume_frame); 2160 __ bl(&resume_frame);
2163 __ jmp(&done); 2161 __ jmp(&done);
2164 __ bind(&resume_frame); 2162 __ bind(&resume_frame);
2165 // lr = return address. 2163 // lr = return address.
2166 // fp = caller's frame pointer. 2164 // fp = caller's frame pointer.
2165 // pp = caller's constant pool (if FLAG_enable_ool_constant_pool),
2167 // cp = callee's context, 2166 // cp = callee's context,
2168 // r4 = callee's JS function. 2167 // r4 = callee's JS function.
2169 __ Push(lr, fp, cp, r4); 2168 __ PushFixedFrame(r4);
2170 // Adjust FP to point to saved FP. 2169 // Adjust FP to point to saved FP.
2171 __ add(fp, sp, Operand(2 * kPointerSize)); 2170 __ add(fp, sp, Operand(StandardFrameConstants::kFixedFrameSizeFromFp));
2172 2171
2173 // Load the operand stack size. 2172 // Load the operand stack size.
2174 __ ldr(r3, FieldMemOperand(r1, JSGeneratorObject::kOperandStackOffset)); 2173 __ ldr(r3, FieldMemOperand(r1, JSGeneratorObject::kOperandStackOffset));
2175 __ ldr(r3, FieldMemOperand(r3, FixedArray::kLengthOffset)); 2174 __ ldr(r3, FieldMemOperand(r3, FixedArray::kLengthOffset));
2176 __ SmiUntag(r3); 2175 __ SmiUntag(r3);
2177 2176
2178 // If we are sending a value and there is no operand stack, we can jump back 2177 // If we are sending a value and there is no operand stack, we can jump back
2179 // in directly. 2178 // in directly.
2180 if (resume_mode == JSGeneratorObject::NEXT) { 2179 if (resume_mode == JSGeneratorObject::NEXT) {
2181 Label slow_resume; 2180 Label slow_resume;
(...skipping 2739 matching lines...) Expand 10 before | Expand all | Expand 10 after
4921 ASSERT(Memory::uint32_at(interrupt_address_pointer) == 4920 ASSERT(Memory::uint32_at(interrupt_address_pointer) ==
4922 reinterpret_cast<uint32_t>( 4921 reinterpret_cast<uint32_t>(
4923 isolate->builtins()->OsrAfterStackCheck()->entry())); 4922 isolate->builtins()->OsrAfterStackCheck()->entry()));
4924 return OSR_AFTER_STACK_CHECK; 4923 return OSR_AFTER_STACK_CHECK;
4925 } 4924 }
4926 4925
4927 4926
4928 } } // namespace v8::internal 4927 } } // namespace v8::internal
4929 4928
4930 #endif // V8_TARGET_ARCH_ARM 4929 #endif // V8_TARGET_ARCH_ARM
OLDNEW
« no previous file with comments | « src/arm/frames-arm.cc ('k') | src/arm/lithium-codegen-arm.cc » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698