OLD | NEW |
---|---|
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 Loading... | |
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 297 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... | |
429 // Make sure that the constant pool is not emitted inside of the return | 430 // Make sure that the constant pool is not emitted inside of the return |
430 // sequence. | 431 // sequence. |
431 { Assembler::BlockConstPoolScope block_const_pool(masm_); | 432 { Assembler::BlockConstPoolScope block_const_pool(masm_); |
432 // Here we use masm_-> instead of the __ macro to avoid the code coverage | 433 // 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 // tool from instrumenting as we rely on the code size here. |
434 int32_t sp_delta = (info_->scope()->num_parameters() + 1) * kPointerSize; | 435 int32_t sp_delta = (info_->scope()->num_parameters() + 1) * kPointerSize; |
435 CodeGenerator::RecordPositions(masm_, function()->end_position() - 1); | 436 CodeGenerator::RecordPositions(masm_, function()->end_position() - 1); |
436 // TODO(svenpanne) The code below is sometimes 4 words, sometimes 5! | 437 // TODO(svenpanne) The code below is sometimes 4 words, sometimes 5! |
437 PredictableCodeSizeScope predictable(masm_, -1); | 438 PredictableCodeSizeScope predictable(masm_, -1); |
438 __ RecordJSReturn(); | 439 __ RecordJSReturn(); |
439 masm_->mov(sp, fp); | |
440 int no_frame_start = masm_->pc_offset(); | 440 int no_frame_start = masm_->pc_offset(); |
Rodolph Perfetta
2013/11/27 20:09:41
previously no_frame_start didn't include the mov.
rmcilroy
2013/11/28 11:32:26
Yes, I wasn't sure on the implications this would
| |
441 masm_->ldm(ia_w, sp, fp.bit() | lr.bit()); | 441 __ LeaveFrame(StackFrame::JAVA_SCRIPT); |
442 masm_->add(sp, sp, Operand(sp_delta)); | 442 __ add(sp, sp, Operand(sp_delta)); |
443 masm_->Jump(lr); | 443 __ Jump(lr); |
444 info_->AddNoFrameRange(no_frame_start, masm_->pc_offset()); | 444 info_->AddNoFrameRange(no_frame_start, masm_->pc_offset()); |
445 } | 445 } |
446 | 446 |
447 #ifdef DEBUG | 447 #ifdef DEBUG |
448 // Check that the size of the code used for returning is large enough | 448 // Check that the size of the code used for returning is large enough |
449 // for the debugger's requirements. | 449 // for the debugger's requirements. |
450 ASSERT(Assembler::kJSReturnSequenceInstructions <= | 450 ASSERT(Assembler::kJSReturnSequenceInstructions <= |
451 masm_->InstructionsGeneratedSince(&check_exit_codesize)); | 451 masm_->InstructionsGeneratedSince(&check_exit_codesize)); |
452 #endif | 452 #endif |
453 } | 453 } |
(...skipping 1703 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... | |
2157 | 2157 |
2158 // Enter a new JavaScript frame, and initialize its slots as they were when | 2158 // Enter a new JavaScript frame, and initialize its slots as they were when |
2159 // the generator was suspended. | 2159 // the generator was suspended. |
2160 Label resume_frame; | 2160 Label resume_frame; |
2161 __ bind(&push_frame); | 2161 __ bind(&push_frame); |
2162 __ bl(&resume_frame); | 2162 __ bl(&resume_frame); |
2163 __ jmp(&done); | 2163 __ jmp(&done); |
2164 __ bind(&resume_frame); | 2164 __ bind(&resume_frame); |
2165 // lr = return address. | 2165 // lr = return address. |
2166 // fp = caller's frame pointer. | 2166 // fp = caller's frame pointer. |
2167 // pp = caller's constant pool (if FLAG_enable_ool_constant_pool), | |
2167 // cp = callee's context, | 2168 // cp = callee's context, |
2168 // r4 = callee's JS function. | 2169 // r4 = callee's JS function. |
2169 __ Push(lr, fp, cp, r4); | 2170 __ PushFixedFrame(r4); |
2170 // Adjust FP to point to saved FP. | 2171 // Adjust FP to point to saved FP. |
2171 __ add(fp, sp, Operand(2 * kPointerSize)); | 2172 __ add(fp, sp, Operand(StandardFrameConstants::kFixedFrameSizeFromFp)); |
2172 | 2173 |
2173 // Load the operand stack size. | 2174 // Load the operand stack size. |
2174 __ ldr(r3, FieldMemOperand(r1, JSGeneratorObject::kOperandStackOffset)); | 2175 __ ldr(r3, FieldMemOperand(r1, JSGeneratorObject::kOperandStackOffset)); |
2175 __ ldr(r3, FieldMemOperand(r3, FixedArray::kLengthOffset)); | 2176 __ ldr(r3, FieldMemOperand(r3, FixedArray::kLengthOffset)); |
2176 __ SmiUntag(r3); | 2177 __ SmiUntag(r3); |
2177 | 2178 |
2178 // If we are sending a value and there is no operand stack, we can jump back | 2179 // If we are sending a value and there is no operand stack, we can jump back |
2179 // in directly. | 2180 // in directly. |
2180 if (resume_mode == JSGeneratorObject::NEXT) { | 2181 if (resume_mode == JSGeneratorObject::NEXT) { |
2181 Label slow_resume; | 2182 Label slow_resume; |
(...skipping 2742 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... | |
4924 ASSERT(Memory::uint32_at(interrupt_address_pointer) == | 4925 ASSERT(Memory::uint32_at(interrupt_address_pointer) == |
4925 reinterpret_cast<uint32_t>( | 4926 reinterpret_cast<uint32_t>( |
4926 isolate->builtins()->OsrAfterStackCheck()->entry())); | 4927 isolate->builtins()->OsrAfterStackCheck()->entry())); |
4927 return OSR_AFTER_STACK_CHECK; | 4928 return OSR_AFTER_STACK_CHECK; |
4928 } | 4929 } |
4929 | 4930 |
4930 | 4931 |
4931 } } // namespace v8::internal | 4932 } } // namespace v8::internal |
4932 | 4933 |
4933 #endif // V8_TARGET_ARCH_ARM | 4934 #endif // V8_TARGET_ARCH_ARM |
OLD | NEW |