| 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 FLAG_enable_ool_constant_pool) | 99 // o pp: our caller's constant pool pointer (if enabled) |
| 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 2222 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 2332 | 2332 |
| 2333 // Enter a new JavaScript frame, and initialize its slots as they were when | 2333 // Enter a new JavaScript frame, and initialize its slots as they were when |
| 2334 // the generator was suspended. | 2334 // the generator was suspended. |
| 2335 Label resume_frame, done; | 2335 Label resume_frame, done; |
| 2336 __ bind(&push_frame); | 2336 __ bind(&push_frame); |
| 2337 __ bl(&resume_frame); | 2337 __ bl(&resume_frame); |
| 2338 __ jmp(&done); | 2338 __ jmp(&done); |
| 2339 __ bind(&resume_frame); | 2339 __ bind(&resume_frame); |
| 2340 // lr = return address. | 2340 // lr = return address. |
| 2341 // fp = caller's frame pointer. | 2341 // fp = caller's frame pointer. |
| 2342 // pp = caller's constant pool (if FLAG_enable_ool_constant_pool), | 2342 // pp = caller's constant pool (if FLAG_enable_embedded_constant_pool), |
| 2343 // cp = callee's context, | 2343 // cp = callee's context, |
| 2344 // r4 = callee's JS function. | 2344 // r4 = callee's JS function. |
| 2345 __ PushFixedFrame(r4); | 2345 __ PushFixedFrame(r4); |
| 2346 // Adjust FP to point to saved FP. | 2346 // Adjust FP to point to saved FP. |
| 2347 __ add(fp, sp, Operand(StandardFrameConstants::kFixedFrameSizeFromFp)); | 2347 __ add(fp, sp, Operand(StandardFrameConstants::kFixedFrameSizeFromFp)); |
| 2348 | 2348 |
| 2349 // Load the operand stack size. | 2349 // Load the operand stack size. |
| 2350 __ ldr(r3, FieldMemOperand(r1, JSGeneratorObject::kOperandStackOffset)); | 2350 __ ldr(r3, FieldMemOperand(r1, JSGeneratorObject::kOperandStackOffset)); |
| 2351 __ ldr(r3, FieldMemOperand(r3, FixedArray::kLengthOffset)); | 2351 __ ldr(r3, FieldMemOperand(r3, FixedArray::kLengthOffset)); |
| 2352 __ SmiUntag(r3); | 2352 __ SmiUntag(r3); |
| 2353 | 2353 |
| 2354 // If we are sending a value and there is no operand stack, we can jump back | 2354 // If we are sending a value and there is no operand stack, we can jump back |
| 2355 // in directly. | 2355 // in directly. |
| 2356 if (resume_mode == JSGeneratorObject::NEXT) { | 2356 if (resume_mode == JSGeneratorObject::NEXT) { |
| 2357 Label slow_resume; | 2357 Label slow_resume; |
| 2358 __ cmp(r3, Operand(0)); | 2358 __ cmp(r3, Operand(0)); |
| 2359 __ b(ne, &slow_resume); | 2359 __ b(ne, &slow_resume); |
| 2360 __ ldr(r3, FieldMemOperand(r4, JSFunction::kCodeEntryOffset)); | 2360 __ ldr(r3, FieldMemOperand(r4, JSFunction::kCodeEntryOffset)); |
| 2361 | 2361 |
| 2362 { ConstantPoolUnavailableScope constant_pool_unavailable(masm_); | 2362 { ConstantPoolUnavailableScope constant_pool_unavailable(masm_); |
| 2363 if (FLAG_enable_ool_constant_pool) { | 2363 if (FLAG_enable_embedded_constant_pool) { |
| 2364 // Load the new code object's constant pool pointer. | 2364 // Load the new code object's constant pool pointer. |
| 2365 __ ldr(pp, | 2365 __ LoadConstantPoolPointerRegisterFromCodeTargetAddress(r3); |
| 2366 MemOperand(r3, Code::kConstantPoolOffset - Code::kHeaderSize)); | |
| 2367 } | 2366 } |
| 2368 | 2367 |
| 2369 __ ldr(r2, FieldMemOperand(r1, JSGeneratorObject::kContinuationOffset)); | 2368 __ ldr(r2, FieldMemOperand(r1, JSGeneratorObject::kContinuationOffset)); |
| 2370 __ SmiUntag(r2); | 2369 __ SmiUntag(r2); |
| 2371 __ add(r3, r3, r2); | 2370 __ add(r3, r3, r2); |
| 2372 __ mov(r2, Operand(Smi::FromInt(JSGeneratorObject::kGeneratorExecuting))); | 2371 __ mov(r2, Operand(Smi::FromInt(JSGeneratorObject::kGeneratorExecuting))); |
| 2373 __ str(r2, FieldMemOperand(r1, JSGeneratorObject::kContinuationOffset)); | 2372 __ str(r2, FieldMemOperand(r1, JSGeneratorObject::kContinuationOffset)); |
| 2374 __ Jump(r3); | 2373 __ Jump(r3); |
| 2375 } | 2374 } |
| 2376 __ bind(&slow_resume); | 2375 __ bind(&slow_resume); |
| (...skipping 3096 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 5473 __ mov(VectorStoreICTrampolineDescriptor::SlotRegister(), | 5472 __ mov(VectorStoreICTrampolineDescriptor::SlotRegister(), |
| 5474 Operand(SmiFromSlot(slot))); | 5473 Operand(SmiFromSlot(slot))); |
| 5475 } | 5474 } |
| 5476 | 5475 |
| 5477 | 5476 |
| 5478 #undef __ | 5477 #undef __ |
| 5479 | 5478 |
| 5480 | 5479 |
| 5481 static Address GetInterruptImmediateLoadAddress(Address pc) { | 5480 static Address GetInterruptImmediateLoadAddress(Address pc) { |
| 5482 Address load_address = pc - 2 * Assembler::kInstrSize; | 5481 Address load_address = pc - 2 * Assembler::kInstrSize; |
| 5483 if (!FLAG_enable_ool_constant_pool) { | 5482 if (!FLAG_enable_embedded_constant_pool) { |
| 5484 DCHECK(Assembler::IsLdrPcImmediateOffset(Memory::int32_at(load_address))); | 5483 DCHECK(Assembler::IsLdrPcImmediateOffset(Memory::int32_at(load_address))); |
| 5485 } else if (Assembler::IsLdrPpRegOffset(Memory::int32_at(load_address))) { | 5484 } else if (Assembler::IsLdrPpRegOffset(Memory::int32_at(load_address))) { |
| 5486 // This is an extended constant pool lookup. | 5485 // This is an extended constant pool lookup. |
| 5487 if (CpuFeatures::IsSupported(ARMv7)) { | 5486 if (CpuFeatures::IsSupported(ARMv7)) { |
| 5488 load_address -= 2 * Assembler::kInstrSize; | 5487 load_address -= 2 * Assembler::kInstrSize; |
| 5489 DCHECK(Assembler::IsMovW(Memory::int32_at(load_address))); | 5488 DCHECK(Assembler::IsMovW(Memory::int32_at(load_address))); |
| 5490 DCHECK(Assembler::IsMovT( | 5489 DCHECK(Assembler::IsMovT( |
| 5491 Memory::int32_at(load_address + Assembler::kInstrSize))); | 5490 Memory::int32_at(load_address + Assembler::kInstrSize))); |
| 5492 } else { | 5491 } else { |
| 5493 load_address -= 4 * Assembler::kInstrSize; | 5492 load_address -= 4 * Assembler::kInstrSize; |
| (...skipping 120 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 5614 DCHECK(interrupt_address == | 5613 DCHECK(interrupt_address == |
| 5615 isolate->builtins()->OsrAfterStackCheck()->entry()); | 5614 isolate->builtins()->OsrAfterStackCheck()->entry()); |
| 5616 return OSR_AFTER_STACK_CHECK; | 5615 return OSR_AFTER_STACK_CHECK; |
| 5617 } | 5616 } |
| 5618 | 5617 |
| 5619 | 5618 |
| 5620 } // namespace internal | 5619 } // namespace internal |
| 5621 } // namespace v8 | 5620 } // namespace v8 |
| 5622 | 5621 |
| 5623 #endif // V8_TARGET_ARCH_ARM | 5622 #endif // V8_TARGET_ARCH_ARM |
| OLD | NEW |