| 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_MIPS | 7 #if V8_TARGET_ARCH_MIPS |
| 8 | 8 |
| 9 // Note on Mips implementation: | 9 // Note on Mips implementation: |
| 10 // | 10 // |
| (...skipping 95 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 106 // o a1: the JS function object being called (i.e. ourselves) | 106 // o a1: the JS function object being called (i.e. ourselves) |
| 107 // o cp: our context | 107 // o cp: our context |
| 108 // o fp: our caller's frame pointer | 108 // o fp: our caller's frame pointer |
| 109 // o sp: stack pointer | 109 // o sp: stack pointer |
| 110 // o ra: return address | 110 // o ra: return address |
| 111 // | 111 // |
| 112 // The function builds a JS frame. Please see JavaScriptFrameConstants in | 112 // The function builds a JS frame. Please see JavaScriptFrameConstants in |
| 113 // frames-mips.h for its layout. | 113 // frames-mips.h for its layout. |
| 114 void FullCodeGenerator::Generate() { | 114 void FullCodeGenerator::Generate() { |
| 115 CompilationInfo* info = info_; | 115 CompilationInfo* info = info_; |
| 116 handler_table_ = | |
| 117 Handle<HandlerTable>::cast(isolate()->factory()->NewFixedArray( | |
| 118 HandlerTable::LengthForRange(function()->handler_count()), TENURED)); | |
| 119 | |
| 120 profiling_counter_ = isolate()->factory()->NewCell( | 116 profiling_counter_ = isolate()->factory()->NewCell( |
| 121 Handle<Smi>(Smi::FromInt(FLAG_interrupt_budget), isolate())); | 117 Handle<Smi>(Smi::FromInt(FLAG_interrupt_budget), isolate())); |
| 122 SetFunctionPosition(function()); | 118 SetFunctionPosition(function()); |
| 123 Comment cmnt(masm_, "[ function compiled by full code generator"); | 119 Comment cmnt(masm_, "[ function compiled by full code generator"); |
| 124 | 120 |
| 125 ProfileEntryHookStub::MaybeCallEntryHook(masm_); | 121 ProfileEntryHookStub::MaybeCallEntryHook(masm_); |
| 126 | 122 |
| 127 #ifdef DEBUG | 123 #ifdef DEBUG |
| 128 if (strlen(FLAG_stop_at) > 0 && | 124 if (strlen(FLAG_stop_at) > 0 && |
| 129 info->function()->name()->IsUtf8EqualTo(CStrVector(FLAG_stop_at))) { | 125 info->function()->name()->IsUtf8EqualTo(CStrVector(FLAG_stop_at))) { |
| (...skipping 2055 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 2185 __ LoadRoot(load_name, Heap::kthrow_stringRootIndex); // "throw" | 2181 __ LoadRoot(load_name, Heap::kthrow_stringRootIndex); // "throw" |
| 2186 __ lw(a3, MemOperand(sp, 1 * kPointerSize)); // iter | 2182 __ lw(a3, MemOperand(sp, 1 * kPointerSize)); // iter |
| 2187 __ Push(load_name, a3, a0); // "throw", iter, except | 2183 __ Push(load_name, a3, a0); // "throw", iter, except |
| 2188 __ jmp(&l_call); | 2184 __ jmp(&l_call); |
| 2189 | 2185 |
| 2190 // try { received = %yield result } | 2186 // try { received = %yield result } |
| 2191 // Shuffle the received result above a try handler and yield it without | 2187 // Shuffle the received result above a try handler and yield it without |
| 2192 // re-boxing. | 2188 // re-boxing. |
| 2193 __ bind(&l_try); | 2189 __ bind(&l_try); |
| 2194 __ pop(a0); // result | 2190 __ pop(a0); // result |
| 2195 EnterTryBlock(expr->index(), &l_catch); | 2191 int handler_index = NewHandlerTableEntry(); |
| 2192 EnterTryBlock(handler_index, &l_catch); |
| 2196 const int try_block_size = TryCatch::kElementCount * kPointerSize; | 2193 const int try_block_size = TryCatch::kElementCount * kPointerSize; |
| 2197 __ push(a0); // result | 2194 __ push(a0); // result |
| 2198 __ jmp(&l_suspend); | 2195 __ jmp(&l_suspend); |
| 2199 __ bind(&l_continuation); | 2196 __ bind(&l_continuation); |
| 2200 __ mov(a0, v0); | 2197 __ mov(a0, v0); |
| 2201 __ jmp(&l_resume); | 2198 __ jmp(&l_resume); |
| 2202 __ bind(&l_suspend); | 2199 __ bind(&l_suspend); |
| 2203 const int generator_object_depth = kPointerSize + try_block_size; | 2200 const int generator_object_depth = kPointerSize + try_block_size; |
| 2204 __ lw(a0, MemOperand(sp, generator_object_depth)); | 2201 __ lw(a0, MemOperand(sp, generator_object_depth)); |
| 2205 __ push(a0); // g | 2202 __ push(a0); // g |
| 2206 __ Push(Smi::FromInt(expr->index())); // handler-index | 2203 __ Push(Smi::FromInt(handler_index)); // handler-index |
| 2207 DCHECK(l_continuation.pos() > 0 && Smi::IsValid(l_continuation.pos())); | 2204 DCHECK(l_continuation.pos() > 0 && Smi::IsValid(l_continuation.pos())); |
| 2208 __ li(a1, Operand(Smi::FromInt(l_continuation.pos()))); | 2205 __ li(a1, Operand(Smi::FromInt(l_continuation.pos()))); |
| 2209 __ sw(a1, FieldMemOperand(a0, JSGeneratorObject::kContinuationOffset)); | 2206 __ sw(a1, FieldMemOperand(a0, JSGeneratorObject::kContinuationOffset)); |
| 2210 __ sw(cp, FieldMemOperand(a0, JSGeneratorObject::kContextOffset)); | 2207 __ sw(cp, FieldMemOperand(a0, JSGeneratorObject::kContextOffset)); |
| 2211 __ mov(a1, cp); | 2208 __ mov(a1, cp); |
| 2212 __ RecordWriteField(a0, JSGeneratorObject::kContextOffset, a1, a2, | 2209 __ RecordWriteField(a0, JSGeneratorObject::kContextOffset, a1, a2, |
| 2213 kRAHasBeenSaved, kDontSaveFPRegs); | 2210 kRAHasBeenSaved, kDontSaveFPRegs); |
| 2214 __ CallRuntime(Runtime::kSuspendJSGeneratorObject, 2); | 2211 __ CallRuntime(Runtime::kSuspendJSGeneratorObject, 2); |
| 2215 __ lw(cp, MemOperand(fp, StandardFrameConstants::kContextOffset)); | 2212 __ lw(cp, MemOperand(fp, StandardFrameConstants::kContextOffset)); |
| 2216 __ pop(v0); // result | 2213 __ pop(v0); // result |
| 2217 EmitReturnSequence(); | 2214 EmitReturnSequence(); |
| 2218 __ mov(a0, v0); | 2215 __ mov(a0, v0); |
| 2219 __ bind(&l_resume); // received in a0 | 2216 __ bind(&l_resume); // received in a0 |
| 2220 ExitTryBlock(expr->index()); | 2217 ExitTryBlock(handler_index); |
| 2221 | 2218 |
| 2222 // receiver = iter; f = 'next'; arg = received; | 2219 // receiver = iter; f = 'next'; arg = received; |
| 2223 __ bind(&l_next); | 2220 __ bind(&l_next); |
| 2224 | 2221 |
| 2225 __ LoadRoot(load_name, Heap::knext_stringRootIndex); // "next" | 2222 __ LoadRoot(load_name, Heap::knext_stringRootIndex); // "next" |
| 2226 __ lw(a3, MemOperand(sp, 1 * kPointerSize)); // iter | 2223 __ lw(a3, MemOperand(sp, 1 * kPointerSize)); // iter |
| 2227 __ Push(load_name, a3, a0); // "next", iter, received | 2224 __ Push(load_name, a3, a0); // "next", iter, received |
| 2228 | 2225 |
| 2229 // result = receiver[f](arg); | 2226 // result = receiver[f](arg); |
| 2230 __ bind(&l_call); | 2227 __ bind(&l_call); |
| (...skipping 3318 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 5549 reinterpret_cast<uint32_t>( | 5546 reinterpret_cast<uint32_t>( |
| 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 | 5550 |
| 5554 | 5551 |
| 5555 } // namespace internal | 5552 } // namespace internal |
| 5556 } // namespace v8 | 5553 } // namespace v8 |
| 5557 | 5554 |
| 5558 #endif // V8_TARGET_ARCH_MIPS | 5555 #endif // V8_TARGET_ARCH_MIPS |
| OLD | NEW |