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 87 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
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 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_ = | |
109 Handle<HandlerTable>::cast(isolate()->factory()->NewFixedArray( | |
110 HandlerTable::LengthForRange(function()->handler_count()), TENURED)); | |
111 | |
112 profiling_counter_ = isolate()->factory()->NewCell( | 108 profiling_counter_ = isolate()->factory()->NewCell( |
113 Handle<Smi>(Smi::FromInt(FLAG_interrupt_budget), isolate())); | 109 Handle<Smi>(Smi::FromInt(FLAG_interrupt_budget), isolate())); |
114 SetFunctionPosition(function()); | 110 SetFunctionPosition(function()); |
115 Comment cmnt(masm_, "[ function compiled by full code generator"); | 111 Comment cmnt(masm_, "[ function compiled by full code generator"); |
116 | 112 |
117 ProfileEntryHookStub::MaybeCallEntryHook(masm_); | 113 ProfileEntryHookStub::MaybeCallEntryHook(masm_); |
118 | 114 |
119 #ifdef DEBUG | 115 #ifdef DEBUG |
120 if (strlen(FLAG_stop_at) > 0 && | 116 if (strlen(FLAG_stop_at) > 0 && |
121 info->function()->name()->IsUtf8EqualTo(CStrVector(FLAG_stop_at))) { | 117 info->function()->name()->IsUtf8EqualTo(CStrVector(FLAG_stop_at))) { |
(...skipping 2078 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
2200 __ LoadRoot(load_name, Heap::kthrow_stringRootIndex); // "throw" | 2196 __ LoadRoot(load_name, Heap::kthrow_stringRootIndex); // "throw" |
2201 __ ldr(r3, MemOperand(sp, 1 * kPointerSize)); // iter | 2197 __ ldr(r3, MemOperand(sp, 1 * kPointerSize)); // iter |
2202 __ Push(load_name, r3, r0); // "throw", iter, except | 2198 __ Push(load_name, r3, r0); // "throw", iter, except |
2203 __ jmp(&l_call); | 2199 __ jmp(&l_call); |
2204 | 2200 |
2205 // try { received = %yield result } | 2201 // try { received = %yield result } |
2206 // Shuffle the received result above a try handler and yield it without | 2202 // Shuffle the received result above a try handler and yield it without |
2207 // re-boxing. | 2203 // re-boxing. |
2208 __ bind(&l_try); | 2204 __ bind(&l_try); |
2209 __ pop(r0); // result | 2205 __ pop(r0); // result |
2210 EnterTryBlock(expr->index(), &l_catch); | 2206 int handler_index = NewHandlerTableEntry(); |
| 2207 EnterTryBlock(handler_index, &l_catch); |
2211 const int try_block_size = TryCatch::kElementCount * kPointerSize; | 2208 const int try_block_size = TryCatch::kElementCount * kPointerSize; |
2212 __ push(r0); // result | 2209 __ push(r0); // result |
2213 __ jmp(&l_suspend); | 2210 __ jmp(&l_suspend); |
2214 __ bind(&l_continuation); | 2211 __ bind(&l_continuation); |
2215 __ jmp(&l_resume); | 2212 __ jmp(&l_resume); |
2216 __ bind(&l_suspend); | 2213 __ bind(&l_suspend); |
2217 const int generator_object_depth = kPointerSize + try_block_size; | 2214 const int generator_object_depth = kPointerSize + try_block_size; |
2218 __ ldr(r0, MemOperand(sp, generator_object_depth)); | 2215 __ ldr(r0, MemOperand(sp, generator_object_depth)); |
2219 __ push(r0); // g | 2216 __ push(r0); // g |
2220 __ Push(Smi::FromInt(expr->index())); // handler-index | 2217 __ Push(Smi::FromInt(handler_index)); // handler-index |
2221 DCHECK(l_continuation.pos() > 0 && Smi::IsValid(l_continuation.pos())); | 2218 DCHECK(l_continuation.pos() > 0 && Smi::IsValid(l_continuation.pos())); |
2222 __ mov(r1, Operand(Smi::FromInt(l_continuation.pos()))); | 2219 __ mov(r1, Operand(Smi::FromInt(l_continuation.pos()))); |
2223 __ str(r1, FieldMemOperand(r0, JSGeneratorObject::kContinuationOffset)); | 2220 __ str(r1, FieldMemOperand(r0, JSGeneratorObject::kContinuationOffset)); |
2224 __ str(cp, FieldMemOperand(r0, JSGeneratorObject::kContextOffset)); | 2221 __ str(cp, FieldMemOperand(r0, JSGeneratorObject::kContextOffset)); |
2225 __ mov(r1, cp); | 2222 __ mov(r1, cp); |
2226 __ RecordWriteField(r0, JSGeneratorObject::kContextOffset, r1, r2, | 2223 __ RecordWriteField(r0, JSGeneratorObject::kContextOffset, r1, r2, |
2227 kLRHasBeenSaved, kDontSaveFPRegs); | 2224 kLRHasBeenSaved, kDontSaveFPRegs); |
2228 __ CallRuntime(Runtime::kSuspendJSGeneratorObject, 2); | 2225 __ CallRuntime(Runtime::kSuspendJSGeneratorObject, 2); |
2229 __ ldr(cp, MemOperand(fp, StandardFrameConstants::kContextOffset)); | 2226 __ ldr(cp, MemOperand(fp, StandardFrameConstants::kContextOffset)); |
2230 __ pop(r0); // result | 2227 __ pop(r0); // result |
2231 EmitReturnSequence(); | 2228 EmitReturnSequence(); |
2232 __ bind(&l_resume); // received in r0 | 2229 __ bind(&l_resume); // received in r0 |
2233 ExitTryBlock(expr->index()); | 2230 ExitTryBlock(handler_index); |
2234 | 2231 |
2235 // receiver = iter; f = 'next'; arg = received; | 2232 // receiver = iter; f = 'next'; arg = received; |
2236 __ bind(&l_next); | 2233 __ bind(&l_next); |
2237 | 2234 |
2238 __ LoadRoot(load_name, Heap::knext_stringRootIndex); // "next" | 2235 __ LoadRoot(load_name, Heap::knext_stringRootIndex); // "next" |
2239 __ ldr(r3, MemOperand(sp, 1 * kPointerSize)); // iter | 2236 __ ldr(r3, MemOperand(sp, 1 * kPointerSize)); // iter |
2240 __ Push(load_name, r3, r0); // "next", iter, received | 2237 __ Push(load_name, r3, r0); // "next", iter, received |
2241 | 2238 |
2242 // result = receiver[f](arg); | 2239 // result = receiver[f](arg); |
2243 __ bind(&l_call); | 2240 __ bind(&l_call); |
(...skipping 3361 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
5605 DCHECK(interrupt_address == | 5602 DCHECK(interrupt_address == |
5606 isolate->builtins()->OsrAfterStackCheck()->entry()); | 5603 isolate->builtins()->OsrAfterStackCheck()->entry()); |
5607 return OSR_AFTER_STACK_CHECK; | 5604 return OSR_AFTER_STACK_CHECK; |
5608 } | 5605 } |
5609 | 5606 |
5610 | 5607 |
5611 } // namespace internal | 5608 } // namespace internal |
5612 } // namespace v8 | 5609 } // namespace v8 |
5613 | 5610 |
5614 #endif // V8_TARGET_ARCH_ARM | 5611 #endif // V8_TARGET_ARCH_ARM |
OLD | NEW |