OLD | NEW |
1 // Copyright 2012 the V8 project authors. All rights reserved. | 1 // Copyright 2012 the V8 project authors. All rights reserved. |
2 // Use of this source code is governed by a BSD-style license that can be | 2 // Use of this source code is governed by a BSD-style license that can be |
3 // found in the LICENSE file. | 3 // found in the LICENSE file. |
4 | 4 |
5 #include "src/v8.h" | 5 #include "src/v8.h" |
6 | 6 |
7 #if V8_TARGET_ARCH_ARM | 7 #if V8_TARGET_ARCH_ARM |
8 | 8 |
9 #include "src/code-factory.h" | 9 #include "src/code-factory.h" |
10 #include "src/code-stubs.h" | 10 #include "src/code-stubs.h" |
(...skipping 78 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
89 | 89 |
90 | 90 |
91 // Generate code for a JS function. On entry to the function the receiver | 91 // Generate code for a JS function. On entry to the function the receiver |
92 // and arguments have been pushed on the stack left to right. The actual | 92 // and arguments have been pushed on the stack left to right. The actual |
93 // argument count matches the formal parameter count expected by the | 93 // argument count matches the formal parameter count expected by the |
94 // function. | 94 // function. |
95 // | 95 // |
96 // The live registers are: | 96 // The live registers are: |
97 // o r1: the JS function object being called (i.e., ourselves) | 97 // o r1: the JS function object being called (i.e., ourselves) |
98 // o cp: our context | 98 // o cp: our context |
99 // o pp: our caller's constant pool pointer (if enabled) | 99 // o pp: our caller's constant pool pointer (if FLAG_enable_ool_constant_pool) |
100 // o fp: our caller's frame pointer | 100 // o fp: our caller's frame pointer |
101 // o sp: stack pointer | 101 // o sp: stack pointer |
102 // o lr: return address | 102 // o lr: return address |
103 // | 103 // |
104 // The function builds a JS frame. Please see JavaScriptFrameConstants in | 104 // The function builds a JS frame. Please see JavaScriptFrameConstants in |
105 // frames-arm.h for its layout. | 105 // frames-arm.h for its layout. |
106 void FullCodeGenerator::Generate() { | 106 void FullCodeGenerator::Generate() { |
107 CompilationInfo* info = info_; | 107 CompilationInfo* info = info_; |
108 handler_table_ = | 108 handler_table_ = |
109 Handle<HandlerTable>::cast(isolate()->factory()->NewFixedArray( | 109 Handle<HandlerTable>::cast(isolate()->factory()->NewFixedArray( |
(...skipping 2202 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
2312 | 2312 |
2313 // Enter a new JavaScript frame, and initialize its slots as they were when | 2313 // Enter a new JavaScript frame, and initialize its slots as they were when |
2314 // the generator was suspended. | 2314 // the generator was suspended. |
2315 Label resume_frame, done; | 2315 Label resume_frame, done; |
2316 __ bind(&push_frame); | 2316 __ bind(&push_frame); |
2317 __ bl(&resume_frame); | 2317 __ bl(&resume_frame); |
2318 __ jmp(&done); | 2318 __ jmp(&done); |
2319 __ bind(&resume_frame); | 2319 __ bind(&resume_frame); |
2320 // lr = return address. | 2320 // lr = return address. |
2321 // fp = caller's frame pointer. | 2321 // fp = caller's frame pointer. |
2322 // pp = caller's constant pool (if FLAG_enable_embedded_constant_pool), | 2322 // pp = caller's constant pool (if FLAG_enable_ool_constant_pool), |
2323 // cp = callee's context, | 2323 // cp = callee's context, |
2324 // r4 = callee's JS function. | 2324 // r4 = callee's JS function. |
2325 __ PushFixedFrame(r4); | 2325 __ PushFixedFrame(r4); |
2326 // Adjust FP to point to saved FP. | 2326 // Adjust FP to point to saved FP. |
2327 __ add(fp, sp, Operand(StandardFrameConstants::kFixedFrameSizeFromFp)); | 2327 __ add(fp, sp, Operand(StandardFrameConstants::kFixedFrameSizeFromFp)); |
2328 | 2328 |
2329 // Load the operand stack size. | 2329 // Load the operand stack size. |
2330 __ ldr(r3, FieldMemOperand(r1, JSGeneratorObject::kOperandStackOffset)); | 2330 __ ldr(r3, FieldMemOperand(r1, JSGeneratorObject::kOperandStackOffset)); |
2331 __ ldr(r3, FieldMemOperand(r3, FixedArray::kLengthOffset)); | 2331 __ ldr(r3, FieldMemOperand(r3, FixedArray::kLengthOffset)); |
2332 __ SmiUntag(r3); | 2332 __ SmiUntag(r3); |
2333 | 2333 |
2334 // If we are sending a value and there is no operand stack, we can jump back | 2334 // If we are sending a value and there is no operand stack, we can jump back |
2335 // in directly. | 2335 // in directly. |
2336 if (resume_mode == JSGeneratorObject::NEXT) { | 2336 if (resume_mode == JSGeneratorObject::NEXT) { |
2337 Label slow_resume; | 2337 Label slow_resume; |
2338 __ cmp(r3, Operand(0)); | 2338 __ cmp(r3, Operand(0)); |
2339 __ b(ne, &slow_resume); | 2339 __ b(ne, &slow_resume); |
2340 __ ldr(r3, FieldMemOperand(r4, JSFunction::kCodeEntryOffset)); | 2340 __ ldr(r3, FieldMemOperand(r4, JSFunction::kCodeEntryOffset)); |
2341 | 2341 |
2342 { ConstantPoolUnavailableScope constant_pool_unavailable(masm_); | 2342 { ConstantPoolUnavailableScope constant_pool_unavailable(masm_); |
2343 if (FLAG_enable_embedded_constant_pool) { | 2343 if (FLAG_enable_ool_constant_pool) { |
2344 // Load the new code object's constant pool pointer. | 2344 // Load the new code object's constant pool pointer. |
2345 __ LoadConstantPoolPointerRegisterFromCodeTargetAddress(r3); | 2345 __ ldr(pp, |
| 2346 MemOperand(r3, Code::kConstantPoolOffset - Code::kHeaderSize)); |
2346 } | 2347 } |
2347 | 2348 |
2348 __ ldr(r2, FieldMemOperand(r1, JSGeneratorObject::kContinuationOffset)); | 2349 __ ldr(r2, FieldMemOperand(r1, JSGeneratorObject::kContinuationOffset)); |
2349 __ SmiUntag(r2); | 2350 __ SmiUntag(r2); |
2350 __ add(r3, r3, r2); | 2351 __ add(r3, r3, r2); |
2351 __ mov(r2, Operand(Smi::FromInt(JSGeneratorObject::kGeneratorExecuting))); | 2352 __ mov(r2, Operand(Smi::FromInt(JSGeneratorObject::kGeneratorExecuting))); |
2352 __ str(r2, FieldMemOperand(r1, JSGeneratorObject::kContinuationOffset)); | 2353 __ str(r2, FieldMemOperand(r1, JSGeneratorObject::kContinuationOffset)); |
2353 __ Jump(r3); | 2354 __ Jump(r3); |
2354 } | 2355 } |
2355 __ bind(&slow_resume); | 2356 __ bind(&slow_resume); |
(...skipping 3076 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
5432 __ mov(VectorStoreICTrampolineDescriptor::SlotRegister(), | 5433 __ mov(VectorStoreICTrampolineDescriptor::SlotRegister(), |
5433 Operand(SmiFromSlot(slot))); | 5434 Operand(SmiFromSlot(slot))); |
5434 } | 5435 } |
5435 | 5436 |
5436 | 5437 |
5437 #undef __ | 5438 #undef __ |
5438 | 5439 |
5439 | 5440 |
5440 static Address GetInterruptImmediateLoadAddress(Address pc) { | 5441 static Address GetInterruptImmediateLoadAddress(Address pc) { |
5441 Address load_address = pc - 2 * Assembler::kInstrSize; | 5442 Address load_address = pc - 2 * Assembler::kInstrSize; |
5442 if (!FLAG_enable_embedded_constant_pool) { | 5443 if (!FLAG_enable_ool_constant_pool) { |
5443 DCHECK(Assembler::IsLdrPcImmediateOffset(Memory::int32_at(load_address))); | 5444 DCHECK(Assembler::IsLdrPcImmediateOffset(Memory::int32_at(load_address))); |
5444 } else if (Assembler::IsLdrPpRegOffset(Memory::int32_at(load_address))) { | 5445 } else if (Assembler::IsLdrPpRegOffset(Memory::int32_at(load_address))) { |
5445 // This is an extended constant pool lookup. | 5446 // This is an extended constant pool lookup. |
5446 if (CpuFeatures::IsSupported(ARMv7)) { | 5447 if (CpuFeatures::IsSupported(ARMv7)) { |
5447 load_address -= 2 * Assembler::kInstrSize; | 5448 load_address -= 2 * Assembler::kInstrSize; |
5448 DCHECK(Assembler::IsMovW(Memory::int32_at(load_address))); | 5449 DCHECK(Assembler::IsMovW(Memory::int32_at(load_address))); |
5449 DCHECK(Assembler::IsMovT( | 5450 DCHECK(Assembler::IsMovT( |
5450 Memory::int32_at(load_address + Assembler::kInstrSize))); | 5451 Memory::int32_at(load_address + Assembler::kInstrSize))); |
5451 } else { | 5452 } else { |
5452 load_address -= 4 * Assembler::kInstrSize; | 5453 load_address -= 4 * Assembler::kInstrSize; |
(...skipping 120 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
5573 DCHECK(interrupt_address == | 5574 DCHECK(interrupt_address == |
5574 isolate->builtins()->OsrAfterStackCheck()->entry()); | 5575 isolate->builtins()->OsrAfterStackCheck()->entry()); |
5575 return OSR_AFTER_STACK_CHECK; | 5576 return OSR_AFTER_STACK_CHECK; |
5576 } | 5577 } |
5577 | 5578 |
5578 | 5579 |
5579 } // namespace internal | 5580 } // namespace internal |
5580 } // namespace v8 | 5581 } // namespace v8 |
5581 | 5582 |
5582 #endif // V8_TARGET_ARCH_ARM | 5583 #endif // V8_TARGET_ARCH_ARM |
OLD | NEW |