| 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_MIPS64 | 7 #if V8_TARGET_ARCH_MIPS64 |
| 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 2053 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 2183 __ LoadRoot(a2, Heap::kthrow_stringRootIndex); // "throw" | 2179 __ LoadRoot(a2, Heap::kthrow_stringRootIndex); // "throw" |
| 2184 __ ld(a3, MemOperand(sp, 1 * kPointerSize)); // iter | 2180 __ ld(a3, MemOperand(sp, 1 * kPointerSize)); // iter |
| 2185 __ Push(a2, a3, a0); // "throw", iter, except | 2181 __ Push(a2, a3, a0); // "throw", iter, except |
| 2186 __ jmp(&l_call); | 2182 __ jmp(&l_call); |
| 2187 | 2183 |
| 2188 // try { received = %yield result } | 2184 // try { received = %yield result } |
| 2189 // Shuffle the received result above a try handler and yield it without | 2185 // Shuffle the received result above a try handler and yield it without |
| 2190 // re-boxing. | 2186 // re-boxing. |
| 2191 __ bind(&l_try); | 2187 __ bind(&l_try); |
| 2192 __ pop(a0); // result | 2188 __ pop(a0); // result |
| 2193 EnterTryBlock(expr->index(), &l_catch); | 2189 int handler_index = NewHandlerTableEntry(); |
| 2190 EnterTryBlock(handler_index, &l_catch); |
| 2194 const int try_block_size = TryCatch::kElementCount * kPointerSize; | 2191 const int try_block_size = TryCatch::kElementCount * kPointerSize; |
| 2195 __ push(a0); // result | 2192 __ push(a0); // result |
| 2196 __ jmp(&l_suspend); | 2193 __ jmp(&l_suspend); |
| 2197 __ bind(&l_continuation); | 2194 __ bind(&l_continuation); |
| 2198 __ mov(a0, v0); | 2195 __ mov(a0, v0); |
| 2199 __ jmp(&l_resume); | 2196 __ jmp(&l_resume); |
| 2200 __ bind(&l_suspend); | 2197 __ bind(&l_suspend); |
| 2201 const int generator_object_depth = kPointerSize + try_block_size; | 2198 const int generator_object_depth = kPointerSize + try_block_size; |
| 2202 __ ld(a0, MemOperand(sp, generator_object_depth)); | 2199 __ ld(a0, MemOperand(sp, generator_object_depth)); |
| 2203 __ push(a0); // g | 2200 __ push(a0); // g |
| 2204 __ Push(Smi::FromInt(expr->index())); // handler-index | 2201 __ Push(Smi::FromInt(handler_index)); // handler-index |
| 2205 DCHECK(l_continuation.pos() > 0 && Smi::IsValid(l_continuation.pos())); | 2202 DCHECK(l_continuation.pos() > 0 && Smi::IsValid(l_continuation.pos())); |
| 2206 __ li(a1, Operand(Smi::FromInt(l_continuation.pos()))); | 2203 __ li(a1, Operand(Smi::FromInt(l_continuation.pos()))); |
| 2207 __ sd(a1, FieldMemOperand(a0, JSGeneratorObject::kContinuationOffset)); | 2204 __ sd(a1, FieldMemOperand(a0, JSGeneratorObject::kContinuationOffset)); |
| 2208 __ sd(cp, FieldMemOperand(a0, JSGeneratorObject::kContextOffset)); | 2205 __ sd(cp, FieldMemOperand(a0, JSGeneratorObject::kContextOffset)); |
| 2209 __ mov(a1, cp); | 2206 __ mov(a1, cp); |
| 2210 __ RecordWriteField(a0, JSGeneratorObject::kContextOffset, a1, a2, | 2207 __ RecordWriteField(a0, JSGeneratorObject::kContextOffset, a1, a2, |
| 2211 kRAHasBeenSaved, kDontSaveFPRegs); | 2208 kRAHasBeenSaved, kDontSaveFPRegs); |
| 2212 __ CallRuntime(Runtime::kSuspendJSGeneratorObject, 2); | 2209 __ CallRuntime(Runtime::kSuspendJSGeneratorObject, 2); |
| 2213 __ ld(cp, MemOperand(fp, StandardFrameConstants::kContextOffset)); | 2210 __ ld(cp, MemOperand(fp, StandardFrameConstants::kContextOffset)); |
| 2214 __ pop(v0); // result | 2211 __ pop(v0); // result |
| 2215 EmitReturnSequence(); | 2212 EmitReturnSequence(); |
| 2216 __ mov(a0, v0); | 2213 __ mov(a0, v0); |
| 2217 __ bind(&l_resume); // received in a0 | 2214 __ bind(&l_resume); // received in a0 |
| 2218 ExitTryBlock(expr->index()); | 2215 ExitTryBlock(handler_index); |
| 2219 | 2216 |
| 2220 // receiver = iter; f = 'next'; arg = received; | 2217 // receiver = iter; f = 'next'; arg = received; |
| 2221 __ bind(&l_next); | 2218 __ bind(&l_next); |
| 2222 __ LoadRoot(load_name, Heap::knext_stringRootIndex); // "next" | 2219 __ LoadRoot(load_name, Heap::knext_stringRootIndex); // "next" |
| 2223 __ ld(a3, MemOperand(sp, 1 * kPointerSize)); // iter | 2220 __ ld(a3, MemOperand(sp, 1 * kPointerSize)); // iter |
| 2224 __ Push(load_name, a3, a0); // "next", iter, received | 2221 __ Push(load_name, a3, a0); // "next", iter, received |
| 2225 | 2222 |
| 2226 // result = receiver[f](arg); | 2223 // result = receiver[f](arg); |
| 2227 __ bind(&l_call); | 2224 __ bind(&l_call); |
| 2228 __ ld(load_receiver, MemOperand(sp, kPointerSize)); | 2225 __ ld(load_receiver, MemOperand(sp, kPointerSize)); |
| (...skipping 3327 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 5556 reinterpret_cast<uint64_t>( | 5553 reinterpret_cast<uint64_t>( |
| 5557 isolate->builtins()->OsrAfterStackCheck()->entry())); | 5554 isolate->builtins()->OsrAfterStackCheck()->entry())); |
| 5558 return OSR_AFTER_STACK_CHECK; | 5555 return OSR_AFTER_STACK_CHECK; |
| 5559 } | 5556 } |
| 5560 | 5557 |
| 5561 | 5558 |
| 5562 } // namespace internal | 5559 } // namespace internal |
| 5563 } // namespace v8 | 5560 } // namespace v8 |
| 5564 | 5561 |
| 5565 #endif // V8_TARGET_ARCH_MIPS64 | 5562 #endif // V8_TARGET_ARCH_MIPS64 |
| OLD | NEW |