OLD | NEW |
1 // Copyright 2014 the V8 project authors. All rights reserved. | 1 // Copyright 2014 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_PPC | 7 #if V8_TARGET_ARCH_PPC |
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 84 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
95 // o cp: our context | 95 // o cp: our context |
96 // o fp: our caller's frame pointer (aka r31) | 96 // o fp: our caller's frame pointer (aka r31) |
97 // o sp: stack pointer | 97 // o sp: stack pointer |
98 // o lr: return address | 98 // o lr: return address |
99 // o ip: our own function entry (required by the prologue) | 99 // o ip: our own function entry (required by the prologue) |
100 // | 100 // |
101 // The function builds a JS frame. Please see JavaScriptFrameConstants in | 101 // The function builds a JS frame. Please see JavaScriptFrameConstants in |
102 // frames-ppc.h for its layout. | 102 // frames-ppc.h for its layout. |
103 void FullCodeGenerator::Generate() { | 103 void FullCodeGenerator::Generate() { |
104 CompilationInfo* info = info_; | 104 CompilationInfo* info = info_; |
105 handler_table_ = | |
106 Handle<HandlerTable>::cast(isolate()->factory()->NewFixedArray( | |
107 HandlerTable::LengthForRange(function()->handler_count()), TENURED)); | |
108 | |
109 profiling_counter_ = isolate()->factory()->NewCell( | 105 profiling_counter_ = isolate()->factory()->NewCell( |
110 Handle<Smi>(Smi::FromInt(FLAG_interrupt_budget), isolate())); | 106 Handle<Smi>(Smi::FromInt(FLAG_interrupt_budget), isolate())); |
111 SetFunctionPosition(function()); | 107 SetFunctionPosition(function()); |
112 Comment cmnt(masm_, "[ function compiled by full code generator"); | 108 Comment cmnt(masm_, "[ function compiled by full code generator"); |
113 | 109 |
114 ProfileEntryHookStub::MaybeCallEntryHook(masm_); | 110 ProfileEntryHookStub::MaybeCallEntryHook(masm_); |
115 | 111 |
116 #ifdef DEBUG | 112 #ifdef DEBUG |
117 if (strlen(FLAG_stop_at) > 0 && | 113 if (strlen(FLAG_stop_at) > 0 && |
118 info->function()->name()->IsUtf8EqualTo(CStrVector(FLAG_stop_at))) { | 114 info->function()->name()->IsUtf8EqualTo(CStrVector(FLAG_stop_at))) { |
(...skipping 2038 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
2157 __ LoadRoot(load_name, Heap::kthrow_stringRootIndex); // "throw" | 2153 __ LoadRoot(load_name, Heap::kthrow_stringRootIndex); // "throw" |
2158 __ LoadP(r6, MemOperand(sp, 1 * kPointerSize)); // iter | 2154 __ LoadP(r6, MemOperand(sp, 1 * kPointerSize)); // iter |
2159 __ Push(load_name, r6, r3); // "throw", iter, except | 2155 __ Push(load_name, r6, r3); // "throw", iter, except |
2160 __ b(&l_call); | 2156 __ b(&l_call); |
2161 | 2157 |
2162 // try { received = %yield result } | 2158 // try { received = %yield result } |
2163 // Shuffle the received result above a try handler and yield it without | 2159 // Shuffle the received result above a try handler and yield it without |
2164 // re-boxing. | 2160 // re-boxing. |
2165 __ bind(&l_try); | 2161 __ bind(&l_try); |
2166 __ pop(r3); // result | 2162 __ pop(r3); // result |
2167 EnterTryBlock(expr->index(), &l_catch); | 2163 int handler_index = NewHandlerTableEntry(); |
| 2164 EnterTryBlock(handler_index, &l_catch); |
2168 const int try_block_size = TryCatch::kElementCount * kPointerSize; | 2165 const int try_block_size = TryCatch::kElementCount * kPointerSize; |
2169 __ push(r3); // result | 2166 __ push(r3); // result |
2170 __ b(&l_suspend); | 2167 __ b(&l_suspend); |
2171 __ bind(&l_continuation); | 2168 __ bind(&l_continuation); |
2172 __ b(&l_resume); | 2169 __ b(&l_resume); |
2173 __ bind(&l_suspend); | 2170 __ bind(&l_suspend); |
2174 const int generator_object_depth = kPointerSize + try_block_size; | 2171 const int generator_object_depth = kPointerSize + try_block_size; |
2175 __ LoadP(r3, MemOperand(sp, generator_object_depth)); | 2172 __ LoadP(r3, MemOperand(sp, generator_object_depth)); |
2176 __ push(r3); // g | 2173 __ push(r3); // g |
2177 __ Push(Smi::FromInt(expr->index())); // handler-index | 2174 __ Push(Smi::FromInt(handler_index)); // handler-index |
2178 DCHECK(l_continuation.pos() > 0 && Smi::IsValid(l_continuation.pos())); | 2175 DCHECK(l_continuation.pos() > 0 && Smi::IsValid(l_continuation.pos())); |
2179 __ LoadSmiLiteral(r4, Smi::FromInt(l_continuation.pos())); | 2176 __ LoadSmiLiteral(r4, Smi::FromInt(l_continuation.pos())); |
2180 __ StoreP(r4, FieldMemOperand(r3, JSGeneratorObject::kContinuationOffset), | 2177 __ StoreP(r4, FieldMemOperand(r3, JSGeneratorObject::kContinuationOffset), |
2181 r0); | 2178 r0); |
2182 __ StoreP(cp, FieldMemOperand(r3, JSGeneratorObject::kContextOffset), r0); | 2179 __ StoreP(cp, FieldMemOperand(r3, JSGeneratorObject::kContextOffset), r0); |
2183 __ mr(r4, cp); | 2180 __ mr(r4, cp); |
2184 __ RecordWriteField(r3, JSGeneratorObject::kContextOffset, r4, r5, | 2181 __ RecordWriteField(r3, JSGeneratorObject::kContextOffset, r4, r5, |
2185 kLRHasBeenSaved, kDontSaveFPRegs); | 2182 kLRHasBeenSaved, kDontSaveFPRegs); |
2186 __ CallRuntime(Runtime::kSuspendJSGeneratorObject, 2); | 2183 __ CallRuntime(Runtime::kSuspendJSGeneratorObject, 2); |
2187 __ LoadP(cp, MemOperand(fp, StandardFrameConstants::kContextOffset)); | 2184 __ LoadP(cp, MemOperand(fp, StandardFrameConstants::kContextOffset)); |
2188 __ pop(r3); // result | 2185 __ pop(r3); // result |
2189 EmitReturnSequence(); | 2186 EmitReturnSequence(); |
2190 __ bind(&l_resume); // received in r3 | 2187 __ bind(&l_resume); // received in r3 |
2191 ExitTryBlock(expr->index()); | 2188 ExitTryBlock(handler_index); |
2192 | 2189 |
2193 // receiver = iter; f = 'next'; arg = received; | 2190 // receiver = iter; f = 'next'; arg = received; |
2194 __ bind(&l_next); | 2191 __ bind(&l_next); |
2195 | 2192 |
2196 __ LoadRoot(load_name, Heap::knext_stringRootIndex); // "next" | 2193 __ LoadRoot(load_name, Heap::knext_stringRootIndex); // "next" |
2197 __ LoadP(r6, MemOperand(sp, 1 * kPointerSize)); // iter | 2194 __ LoadP(r6, MemOperand(sp, 1 * kPointerSize)); // iter |
2198 __ Push(load_name, r6, r3); // "next", iter, received | 2195 __ Push(load_name, r6, r3); // "next", iter, received |
2199 | 2196 |
2200 // result = receiver[f](arg); | 2197 // result = receiver[f](arg); |
2201 __ bind(&l_call); | 2198 __ bind(&l_call); |
(...skipping 3344 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
5546 return ON_STACK_REPLACEMENT; | 5543 return ON_STACK_REPLACEMENT; |
5547 } | 5544 } |
5548 | 5545 |
5549 DCHECK(interrupt_address == | 5546 DCHECK(interrupt_address == |
5550 isolate->builtins()->OsrAfterStackCheck()->entry()); | 5547 isolate->builtins()->OsrAfterStackCheck()->entry()); |
5551 return OSR_AFTER_STACK_CHECK; | 5548 return OSR_AFTER_STACK_CHECK; |
5552 } | 5549 } |
5553 } // namespace internal | 5550 } // namespace internal |
5554 } // namespace v8 | 5551 } // namespace v8 |
5555 #endif // V8_TARGET_ARCH_PPC | 5552 #endif // V8_TARGET_ARCH_PPC |
OLD | NEW |