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 // 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 241 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... | |
| 351 } | 351 } |
| 352 } | 352 } |
| 353 | 353 |
| 354 // Always emit a 'return undefined' in case control fell off the end of | 354 // Always emit a 'return undefined' in case control fell off the end of |
| 355 // the body. | 355 // the body. |
| 356 { Comment cmnt(masm_, "[ return <undefined>;"); | 356 { Comment cmnt(masm_, "[ return <undefined>;"); |
| 357 __ LoadRoot(r0, Heap::kUndefinedValueRootIndex); | 357 __ LoadRoot(r0, Heap::kUndefinedValueRootIndex); |
| 358 } | 358 } |
| 359 EmitReturnSequence(); | 359 EmitReturnSequence(); |
| 360 | 360 |
| 361 // Force emit the constant pool, so it doesn't get emitted in the middle | 361 if (FLAG_enable_embedded_constant_pool) { |
| 362 // of the back edge table. | 362 masm()->EmitConstantPool(); |
|
rmcilroy
2015/05/20 14:32:10
Should we be emitting this here if we are also emi
MTBrandyberry
2015/05/20 22:28:21
Currently, the embedded constant pool is emitted i
rmcilroy
2015/05/22 12:21:21
I think this would be better right at the end just
MTBrandyberry
2015/05/26 19:19:05
Acknowledged.
| |
| 363 masm()->CheckConstPool(true, false); | 363 } else { |
| 364 // Force emit the constant pool, so it doesn't get emitted in the middle | |
| 365 // of the back edge table. | |
| 366 masm()->CheckConstPool(true, false); | |
| 367 } | |
| 364 } | 368 } |
| 365 | 369 |
| 366 | 370 |
| 367 void FullCodeGenerator::ClearAccumulator() { | 371 void FullCodeGenerator::ClearAccumulator() { |
| 368 __ mov(r0, Operand(Smi::FromInt(0))); | 372 __ mov(r0, Operand(Smi::FromInt(0))); |
| 369 } | 373 } |
| 370 | 374 |
| 371 | 375 |
| 372 void FullCodeGenerator::EmitProfilingCounterDecrement(int delta) { | 376 void FullCodeGenerator::EmitProfilingCounterDecrement(int delta) { |
| 373 __ mov(r2, Operand(profiling_counter_)); | 377 __ mov(r2, Operand(profiling_counter_)); |
| (...skipping 1903 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... | |
| 2277 | 2281 |
| 2278 // Enter a new JavaScript frame, and initialize its slots as they were when | 2282 // Enter a new JavaScript frame, and initialize its slots as they were when |
| 2279 // the generator was suspended. | 2283 // the generator was suspended. |
| 2280 Label resume_frame, done; | 2284 Label resume_frame, done; |
| 2281 __ bind(&push_frame); | 2285 __ bind(&push_frame); |
| 2282 __ bl(&resume_frame); | 2286 __ bl(&resume_frame); |
| 2283 __ jmp(&done); | 2287 __ jmp(&done); |
| 2284 __ bind(&resume_frame); | 2288 __ bind(&resume_frame); |
| 2285 // lr = return address. | 2289 // lr = return address. |
| 2286 // fp = caller's frame pointer. | 2290 // fp = caller's frame pointer. |
| 2287 // pp = caller's constant pool (if FLAG_enable_ool_constant_pool), | 2291 // pp = caller's constant pool (if FLAG_enable_embedded_constant_pool), |
| 2288 // cp = callee's context, | 2292 // cp = callee's context, |
| 2289 // r4 = callee's JS function. | 2293 // r4 = callee's JS function. |
| 2290 __ PushFixedFrame(r4); | 2294 __ PushFixedFrame(r4); |
| 2291 // Adjust FP to point to saved FP. | 2295 // Adjust FP to point to saved FP. |
| 2292 __ add(fp, sp, Operand(StandardFrameConstants::kFixedFrameSizeFromFp)); | 2296 __ add(fp, sp, Operand(StandardFrameConstants::kFixedFrameSizeFromFp)); |
| 2293 | 2297 |
| 2294 // Load the operand stack size. | 2298 // Load the operand stack size. |
| 2295 __ ldr(r3, FieldMemOperand(r1, JSGeneratorObject::kOperandStackOffset)); | 2299 __ ldr(r3, FieldMemOperand(r1, JSGeneratorObject::kOperandStackOffset)); |
| 2296 __ ldr(r3, FieldMemOperand(r3, FixedArray::kLengthOffset)); | 2300 __ ldr(r3, FieldMemOperand(r3, FixedArray::kLengthOffset)); |
| 2297 __ SmiUntag(r3); | 2301 __ SmiUntag(r3); |
| 2298 | 2302 |
| 2299 // If we are sending a value and there is no operand stack, we can jump back | 2303 // If we are sending a value and there is no operand stack, we can jump back |
| 2300 // in directly. | 2304 // in directly. |
| 2301 if (resume_mode == JSGeneratorObject::NEXT) { | 2305 if (resume_mode == JSGeneratorObject::NEXT) { |
| 2302 Label slow_resume; | 2306 Label slow_resume; |
| 2303 __ cmp(r3, Operand(0)); | 2307 __ cmp(r3, Operand(0)); |
| 2304 __ b(ne, &slow_resume); | 2308 __ b(ne, &slow_resume); |
| 2305 __ ldr(r3, FieldMemOperand(r4, JSFunction::kCodeEntryOffset)); | 2309 __ ldr(r3, FieldMemOperand(r4, JSFunction::kCodeEntryOffset)); |
| 2306 | 2310 |
| 2307 { ConstantPoolUnavailableScope constant_pool_unavailable(masm_); | 2311 { ConstantPoolUnavailableScope constant_pool_unavailable(masm_); |
| 2308 if (FLAG_enable_ool_constant_pool) { | 2312 if (FLAG_enable_embedded_constant_pool) { |
| 2309 // Load the new code object's constant pool pointer. | 2313 // Load the new code object's constant pool pointer. |
| 2310 __ ldr(pp, | 2314 __ LoadTargetConstantPoolPointerRegister(r3); |
| 2311 MemOperand(r3, Code::kConstantPoolOffset - Code::kHeaderSize)); | |
| 2312 } | 2315 } |
| 2313 | 2316 |
| 2314 __ ldr(r2, FieldMemOperand(r1, JSGeneratorObject::kContinuationOffset)); | 2317 __ ldr(r2, FieldMemOperand(r1, JSGeneratorObject::kContinuationOffset)); |
| 2315 __ SmiUntag(r2); | 2318 __ SmiUntag(r2); |
| 2316 __ add(r3, r3, r2); | 2319 __ add(r3, r3, r2); |
| 2317 __ mov(r2, Operand(Smi::FromInt(JSGeneratorObject::kGeneratorExecuting))); | 2320 __ mov(r2, Operand(Smi::FromInt(JSGeneratorObject::kGeneratorExecuting))); |
| 2318 __ str(r2, FieldMemOperand(r1, JSGeneratorObject::kContinuationOffset)); | 2321 __ str(r2, FieldMemOperand(r1, JSGeneratorObject::kContinuationOffset)); |
| 2319 __ Jump(r3); | 2322 __ Jump(r3); |
| 2320 } | 2323 } |
| 2321 __ bind(&slow_resume); | 2324 __ bind(&slow_resume); |
| (...skipping 3046 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... | |
| 5368 __ SmiUntag(r1); | 5371 __ SmiUntag(r1); |
| 5369 __ add(pc, r1, Operand(masm_->CodeObject())); | 5372 __ add(pc, r1, Operand(masm_->CodeObject())); |
| 5370 } | 5373 } |
| 5371 | 5374 |
| 5372 | 5375 |
| 5373 #undef __ | 5376 #undef __ |
| 5374 | 5377 |
| 5375 | 5378 |
| 5376 static Address GetInterruptImmediateLoadAddress(Address pc) { | 5379 static Address GetInterruptImmediateLoadAddress(Address pc) { |
| 5377 Address load_address = pc - 2 * Assembler::kInstrSize; | 5380 Address load_address = pc - 2 * Assembler::kInstrSize; |
| 5378 if (!FLAG_enable_ool_constant_pool) { | 5381 if (!FLAG_enable_embedded_constant_pool) { |
| 5379 DCHECK(Assembler::IsLdrPcImmediateOffset(Memory::int32_at(load_address))); | 5382 DCHECK(Assembler::IsLdrPcImmediateOffset(Memory::int32_at(load_address))); |
| 5380 } else if (Assembler::IsLdrPpRegOffset(Memory::int32_at(load_address))) { | 5383 } else if (Assembler::IsLdrPpRegOffset(Memory::int32_at(load_address))) { |
| 5381 // This is an extended constant pool lookup. | 5384 // This is an extended constant pool lookup. |
| 5382 if (CpuFeatures::IsSupported(ARMv7)) { | 5385 if (CpuFeatures::IsSupported(ARMv7)) { |
| 5383 load_address -= 2 * Assembler::kInstrSize; | 5386 load_address -= 2 * Assembler::kInstrSize; |
| 5384 DCHECK(Assembler::IsMovW(Memory::int32_at(load_address))); | 5387 DCHECK(Assembler::IsMovW(Memory::int32_at(load_address))); |
| 5385 DCHECK(Assembler::IsMovT( | 5388 DCHECK(Assembler::IsMovT( |
| 5386 Memory::int32_at(load_address + Assembler::kInstrSize))); | 5389 Memory::int32_at(load_address + Assembler::kInstrSize))); |
| 5387 } else { | 5390 } else { |
| 5388 load_address -= 4 * Assembler::kInstrSize; | 5391 load_address -= 4 * Assembler::kInstrSize; |
| (...skipping 119 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... | |
| 5508 | 5511 |
| 5509 DCHECK(interrupt_address == | 5512 DCHECK(interrupt_address == |
| 5510 isolate->builtins()->OsrAfterStackCheck()->entry()); | 5513 isolate->builtins()->OsrAfterStackCheck()->entry()); |
| 5511 return OSR_AFTER_STACK_CHECK; | 5514 return OSR_AFTER_STACK_CHECK; |
| 5512 } | 5515 } |
| 5513 | 5516 |
| 5514 | 5517 |
| 5515 } } // namespace v8::internal | 5518 } } // namespace v8::internal |
| 5516 | 5519 |
| 5517 #endif // V8_TARGET_ARCH_ARM | 5520 #endif // V8_TARGET_ARCH_ARM |
| OLD | NEW |