Chromium Code Reviews
chromiumcodereview-hr@appspot.gserviceaccount.com (chromiumcodereview-hr) | Please choose your nickname with Settings | Help | Chromium Project | Gerrit Changes | Sign out
(1769)

Side by Side Diff: src/mips/macro-assembler-mips.cc

Issue 974873002: MIPS: Move stack unwinding logic into the runtime. (Closed) Base URL: https://chromium.googlesource.com/v8/v8.git@master
Patch Set: Fix comments. Created 5 years, 9 months ago
Use n/p to move between diff chunks; N/P to move between comments. Draft comments are only viewable by you.
Jump to:
View unified diff | Download patch
« no previous file with comments | « src/mips/macro-assembler-mips.h ('k') | src/mips64/code-stubs-mips64.cc » ('j') | no next file with comments »
Toggle Intra-line Diffs ('i') | Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
OLDNEW
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 <limits.h> // For LONG_MIN, LONG_MAX. 5 #include <limits.h> // For LONG_MIN, LONG_MAX.
6 6
7 #include "src/v8.h" 7 #include "src/v8.h"
8 8
9 #if V8_TARGET_ARCH_MIPS 9 #if V8_TARGET_ARCH_MIPS
10 10
(...skipping 3252 matching lines...) Expand 10 before | Expand all | Expand 10 after
3263 3263
3264 void MacroAssembler::PopTryHandler() { 3264 void MacroAssembler::PopTryHandler() {
3265 STATIC_ASSERT(StackHandlerConstants::kNextOffset == 0); 3265 STATIC_ASSERT(StackHandlerConstants::kNextOffset == 0);
3266 pop(a1); 3266 pop(a1);
3267 Addu(sp, sp, Operand(StackHandlerConstants::kSize - kPointerSize)); 3267 Addu(sp, sp, Operand(StackHandlerConstants::kSize - kPointerSize));
3268 li(at, Operand(ExternalReference(Isolate::kHandlerAddress, isolate()))); 3268 li(at, Operand(ExternalReference(Isolate::kHandlerAddress, isolate())));
3269 sw(a1, MemOperand(at)); 3269 sw(a1, MemOperand(at));
3270 } 3270 }
3271 3271
3272 3272
3273 void MacroAssembler::JumpToHandlerEntry() {
3274 // Compute the handler entry address and jump to it. The handler table is
3275 // a fixed array of (smi-tagged) code offsets.
3276 // v0 = exception, a1 = code object, a2 = state.
3277 lw(a3, FieldMemOperand(a1, Code::kHandlerTableOffset)); // Handler table.
3278 Addu(a3, a3, Operand(FixedArray::kHeaderSize - kHeapObjectTag));
3279 srl(a2, a2, StackHandler::kKindWidth); // Handler index.
3280 sll(a2, a2, kPointerSizeLog2);
3281 Addu(a2, a3, a2);
3282 lw(a2, MemOperand(a2)); // Smi-tagged offset.
3283 Addu(a1, a1, Operand(Code::kHeaderSize - kHeapObjectTag)); // Code start.
3284 sra(t9, a2, kSmiTagSize);
3285 Addu(t9, t9, a1);
3286 Jump(t9); // Jump.
3287 }
3288
3289
3290 void MacroAssembler::Throw(Register value) {
3291 // Adjust this code if not the case.
3292 STATIC_ASSERT(StackHandlerConstants::kSize == 5 * kPointerSize);
3293 STATIC_ASSERT(StackHandlerConstants::kNextOffset == 0);
3294 STATIC_ASSERT(StackHandlerConstants::kCodeOffset == 1 * kPointerSize);
3295 STATIC_ASSERT(StackHandlerConstants::kStateOffset == 2 * kPointerSize);
3296 STATIC_ASSERT(StackHandlerConstants::kContextOffset == 3 * kPointerSize);
3297 STATIC_ASSERT(StackHandlerConstants::kFPOffset == 4 * kPointerSize);
3298
3299 // The exception is expected in v0.
3300 Move(v0, value);
3301
3302 // Drop the stack pointer to the top of the top handler.
3303 li(a3, Operand(ExternalReference(Isolate::kHandlerAddress,
3304 isolate())));
3305 lw(sp, MemOperand(a3));
3306
3307 // Restore the next handler.
3308 pop(a2);
3309 sw(a2, MemOperand(a3));
3310
3311 // Get the code object (a1) and state (a2). Restore the context and frame
3312 // pointer.
3313 MultiPop(a1.bit() | a2.bit() | cp.bit() | fp.bit());
3314
3315 // If the handler is a JS frame, restore the context to the frame.
3316 // (kind == ENTRY) == (fp == 0) == (cp == 0), so we could test either fp
3317 // or cp.
3318 Label done;
3319 Branch(&done, eq, cp, Operand(zero_reg));
3320 sw(cp, MemOperand(fp, StandardFrameConstants::kContextOffset));
3321 bind(&done);
3322
3323 JumpToHandlerEntry();
3324 }
3325
3326
3327 void MacroAssembler::ThrowUncatchable(Register value) {
3328 // Adjust this code if not the case.
3329 STATIC_ASSERT(StackHandlerConstants::kSize == 5 * kPointerSize);
3330 STATIC_ASSERT(StackHandlerConstants::kNextOffset == 0 * kPointerSize);
3331 STATIC_ASSERT(StackHandlerConstants::kCodeOffset == 1 * kPointerSize);
3332 STATIC_ASSERT(StackHandlerConstants::kStateOffset == 2 * kPointerSize);
3333 STATIC_ASSERT(StackHandlerConstants::kContextOffset == 3 * kPointerSize);
3334 STATIC_ASSERT(StackHandlerConstants::kFPOffset == 4 * kPointerSize);
3335
3336 // The exception is expected in v0.
3337 if (!value.is(v0)) {
3338 mov(v0, value);
3339 }
3340 // Drop the stack pointer to the top of the top stack handler.
3341 li(a3, Operand(ExternalReference(Isolate::kHandlerAddress, isolate())));
3342 lw(sp, MemOperand(a3));
3343
3344 // Unwind the handlers until the ENTRY handler is found.
3345 Label fetch_next, check_kind;
3346 jmp(&check_kind);
3347 bind(&fetch_next);
3348 lw(sp, MemOperand(sp, StackHandlerConstants::kNextOffset));
3349
3350 bind(&check_kind);
3351 STATIC_ASSERT(StackHandler::JS_ENTRY == 0);
3352 lw(a2, MemOperand(sp, StackHandlerConstants::kStateOffset));
3353 And(a2, a2, Operand(StackHandler::KindField::kMask));
3354 Branch(&fetch_next, ne, a2, Operand(zero_reg));
3355
3356 // Set the top handler address to next handler past the top ENTRY handler.
3357 pop(a2);
3358 sw(a2, MemOperand(a3));
3359
3360 // Get the code object (a1) and state (a2). Clear the context and frame
3361 // pointer (0 was saved in the handler).
3362 MultiPop(a1.bit() | a2.bit() | cp.bit() | fp.bit());
3363
3364 JumpToHandlerEntry();
3365 }
3366
3367
3368 void MacroAssembler::Allocate(int object_size, 3273 void MacroAssembler::Allocate(int object_size,
3369 Register result, 3274 Register result,
3370 Register scratch1, 3275 Register scratch1,
3371 Register scratch2, 3276 Register scratch2,
3372 Label* gc_required, 3277 Label* gc_required,
3373 AllocationFlags flags) { 3278 AllocationFlags flags) {
3374 DCHECK(object_size <= Page::kMaxRegularHeapObjectSize); 3279 DCHECK(object_size <= Page::kMaxRegularHeapObjectSize);
3375 if (!FLAG_inline_new) { 3280 if (!FLAG_inline_new) {
3376 if (emit_debug_code()) { 3281 if (emit_debug_code()) {
3377 // Trash the registers to simulate an allocation failure. 3282 // Trash the registers to simulate an allocation failure.
(...skipping 2793 matching lines...) Expand 10 before | Expand all | Expand 10 after
6171 } 6076 }
6172 if (mag.shift > 0) sra(result, result, mag.shift); 6077 if (mag.shift > 0) sra(result, result, mag.shift);
6173 srl(at, dividend, 31); 6078 srl(at, dividend, 31);
6174 Addu(result, result, Operand(at)); 6079 Addu(result, result, Operand(at));
6175 } 6080 }
6176 6081
6177 6082
6178 } } // namespace v8::internal 6083 } } // namespace v8::internal
6179 6084
6180 #endif // V8_TARGET_ARCH_MIPS 6085 #endif // V8_TARGET_ARCH_MIPS
OLDNEW
« no previous file with comments | « src/mips/macro-assembler-mips.h ('k') | src/mips64/code-stubs-mips64.cc » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698