Chromium Code Reviews| 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 291 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... | |
| 423 | 424 |
| 424 #ifdef DEBUG | 425 #ifdef DEBUG |
| 425 // Add a label for checking the size of the code used for returning. | 426 // Add a label for checking the size of the code used for returning. |
| 426 Label check_exit_codesize; | 427 Label check_exit_codesize; |
| 427 masm_->bind(&check_exit_codesize); | 428 masm_->bind(&check_exit_codesize); |
| 428 #endif | 429 #endif |
| 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. |
|
JF
2013/12/13 17:33:39
This comment seems to say __ shouldn't be used at
rmcilroy
2013/12/16 14:56:21
I missed this comment. From talking with the the
Sven Panne
2013/12/17 07:23:58
I can't find any place where GENERATED_CODE_COVERA
rmcilroy
2013/12/18 13:23:08
Great, thanks Sven. Done.
| |
| 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_->LeaveFrame(StackFrame::JAVA_SCRIPT); |
| 440 int no_frame_start = masm_->pc_offset(); | 441 __ add(sp, sp, Operand(sp_delta)); |
| 441 masm_->ldm(ia_w, sp, fp.bit() | lr.bit()); | 442 __ Jump(lr); |
| 442 masm_->add(sp, sp, Operand(sp_delta)); | |
| 443 masm_->Jump(lr); | |
| 444 info_->AddNoFrameRange(no_frame_start, masm_->pc_offset()); | 443 info_->AddNoFrameRange(no_frame_start, masm_->pc_offset()); |
| 445 } | 444 } |
| 446 | 445 |
| 447 #ifdef DEBUG | 446 #ifdef DEBUG |
| 448 // Check that the size of the code used for returning is large enough | 447 // Check that the size of the code used for returning is large enough |
| 449 // for the debugger's requirements. | 448 // for the debugger's requirements. |
| 450 ASSERT(Assembler::kJSReturnSequenceInstructions <= | 449 ASSERT(Assembler::kJSReturnSequenceInstructions <= |
| 451 masm_->InstructionsGeneratedSince(&check_exit_codesize)); | 450 masm_->InstructionsGeneratedSince(&check_exit_codesize)); |
| 452 #endif | 451 #endif |
| 453 } | 452 } |
| (...skipping 1708 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... | |
| 2162 | 2161 |
| 2163 // Enter a new JavaScript frame, and initialize its slots as they were when | 2162 // Enter a new JavaScript frame, and initialize its slots as they were when |
| 2164 // the generator was suspended. | 2163 // the generator was suspended. |
| 2165 Label resume_frame; | 2164 Label resume_frame; |
| 2166 __ bind(&push_frame); | 2165 __ bind(&push_frame); |
| 2167 __ bl(&resume_frame); | 2166 __ bl(&resume_frame); |
| 2168 __ jmp(&done); | 2167 __ jmp(&done); |
| 2169 __ bind(&resume_frame); | 2168 __ bind(&resume_frame); |
| 2170 // lr = return address. | 2169 // lr = return address. |
| 2171 // fp = caller's frame pointer. | 2170 // fp = caller's frame pointer. |
| 2171 // pp = caller's constant pool (if FLAG_enable_ool_constant_pool), | |
| 2172 // cp = callee's context, | 2172 // cp = callee's context, |
| 2173 // r4 = callee's JS function. | 2173 // r4 = callee's JS function. |
| 2174 __ Push(lr, fp, cp, r4); | 2174 __ PushFixedFrame(r4); |
| 2175 // Adjust FP to point to saved FP. | 2175 // Adjust FP to point to saved FP. |
| 2176 __ add(fp, sp, Operand(2 * kPointerSize)); | 2176 __ add(fp, sp, Operand(StandardFrameConstants::kFixedFrameSizeFromFp)); |
| 2177 | 2177 |
| 2178 // Load the operand stack size. | 2178 // Load the operand stack size. |
| 2179 __ ldr(r3, FieldMemOperand(r1, JSGeneratorObject::kOperandStackOffset)); | 2179 __ ldr(r3, FieldMemOperand(r1, JSGeneratorObject::kOperandStackOffset)); |
| 2180 __ ldr(r3, FieldMemOperand(r3, FixedArray::kLengthOffset)); | 2180 __ ldr(r3, FieldMemOperand(r3, FixedArray::kLengthOffset)); |
| 2181 __ SmiUntag(r3); | 2181 __ SmiUntag(r3); |
| 2182 | 2182 |
| 2183 // If we are sending a value and there is no operand stack, we can jump back | 2183 // If we are sending a value and there is no operand stack, we can jump back |
| 2184 // in directly. | 2184 // in directly. |
| 2185 if (resume_mode == JSGeneratorObject::NEXT) { | 2185 if (resume_mode == JSGeneratorObject::NEXT) { |
| 2186 Label slow_resume; | 2186 Label slow_resume; |
| (...skipping 2742 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... | |
| 4929 ASSERT(Memory::uint32_at(interrupt_address_pointer) == | 4929 ASSERT(Memory::uint32_at(interrupt_address_pointer) == |
| 4930 reinterpret_cast<uint32_t>( | 4930 reinterpret_cast<uint32_t>( |
| 4931 isolate->builtins()->OsrAfterStackCheck()->entry())); | 4931 isolate->builtins()->OsrAfterStackCheck()->entry())); |
| 4932 return OSR_AFTER_STACK_CHECK; | 4932 return OSR_AFTER_STACK_CHECK; |
| 4933 } | 4933 } |
| 4934 | 4934 |
| 4935 | 4935 |
| 4936 } } // namespace v8::internal | 4936 } } // namespace v8::internal |
| 4937 | 4937 |
| 4938 #endif // V8_TARGET_ARCH_ARM | 4938 #endif // V8_TARGET_ARCH_ARM |
| OLD | NEW |