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

Side by Side Diff: src/arm64/code-stubs-arm64.cc

Issue 969533004: [turbofan] Implement throwing exceptions into TurboFan code. (Closed) Base URL: https://chromium.googlesource.com/v8/v8.git@master
Patch Set: Fix code lookup. 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/arm/code-stubs-arm.cc ('k') | src/compiler/ast-graph-builder.h » ('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 2013 the V8 project authors. All rights reserved. 1 // Copyright 2013 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_ARM64 7 #if V8_TARGET_ARCH_ARM64
8 8
9 #include "src/bootstrapper.h" 9 #include "src/bootstrapper.h"
10 #include "src/code-stubs.h" 10 #include "src/code-stubs.h"
(...skipping 5248 matching lines...) Expand 10 before | Expand all | Expand 10 after
5259 if (FLAG_log_timer_events) { 5259 if (FLAG_log_timer_events) {
5260 FrameScope frame(masm, StackFrame::MANUAL); 5260 FrameScope frame(masm, StackFrame::MANUAL);
5261 __ PushSafepointRegisters(); 5261 __ PushSafepointRegisters();
5262 __ Mov(x0, ExternalReference::isolate_address(isolate)); 5262 __ Mov(x0, ExternalReference::isolate_address(isolate));
5263 __ CallCFunction(ExternalReference::log_leave_external_function(isolate), 5263 __ CallCFunction(ExternalReference::log_leave_external_function(isolate),
5264 1); 5264 1);
5265 __ PopSafepointRegisters(); 5265 __ PopSafepointRegisters();
5266 } 5266 }
5267 5267
5268 Label promote_scheduled_exception; 5268 Label promote_scheduled_exception;
5269 Label exception_handled;
5270 Label delete_allocated_handles; 5269 Label delete_allocated_handles;
5271 Label leave_exit_frame; 5270 Label leave_exit_frame;
5272 Label return_value_loaded; 5271 Label return_value_loaded;
5273 5272
5274 // Load value from ReturnValue. 5273 // Load value from ReturnValue.
5275 __ Ldr(x0, return_value_operand); 5274 __ Ldr(x0, return_value_operand);
5276 __ Bind(&return_value_loaded); 5275 __ Bind(&return_value_loaded);
5277 // No more valid handles (the result handle was the last one). Restore 5276 // No more valid handles (the result handle was the last one). Restore
5278 // previous handle scope. 5277 // previous handle scope.
5279 __ Str(next_address_reg, MemOperand(handle_scope_base, kNextOffset)); 5278 __ Str(next_address_reg, MemOperand(handle_scope_base, kNextOffset));
5280 if (__ emit_debug_code()) { 5279 if (__ emit_debug_code()) {
5281 __ Ldr(w1, MemOperand(handle_scope_base, kLevelOffset)); 5280 __ Ldr(w1, MemOperand(handle_scope_base, kLevelOffset));
5282 __ Cmp(w1, level_reg); 5281 __ Cmp(w1, level_reg);
5283 __ Check(eq, kUnexpectedLevelAfterReturnFromApiCall); 5282 __ Check(eq, kUnexpectedLevelAfterReturnFromApiCall);
5284 } 5283 }
5285 __ Sub(level_reg, level_reg, 1); 5284 __ Sub(level_reg, level_reg, 1);
5286 __ Str(level_reg, MemOperand(handle_scope_base, kLevelOffset)); 5285 __ Str(level_reg, MemOperand(handle_scope_base, kLevelOffset));
5287 __ Ldr(x1, MemOperand(handle_scope_base, kLimitOffset)); 5286 __ Ldr(x1, MemOperand(handle_scope_base, kLimitOffset));
5288 __ Cmp(limit_reg, x1); 5287 __ Cmp(limit_reg, x1);
5289 __ B(ne, &delete_allocated_handles); 5288 __ B(ne, &delete_allocated_handles);
5290 5289
5290 // Leave the API exit frame.
5291 __ Bind(&leave_exit_frame); 5291 __ Bind(&leave_exit_frame);
5292 // Restore callee-saved registers. 5292 // Restore callee-saved registers.
5293 __ Peek(x19, (spill_offset + 0) * kXRegSize); 5293 __ Peek(x19, (spill_offset + 0) * kXRegSize);
5294 __ Peek(x20, (spill_offset + 1) * kXRegSize); 5294 __ Peek(x20, (spill_offset + 1) * kXRegSize);
5295 __ Peek(x21, (spill_offset + 2) * kXRegSize); 5295 __ Peek(x21, (spill_offset + 2) * kXRegSize);
5296 __ Peek(x22, (spill_offset + 3) * kXRegSize); 5296 __ Peek(x22, (spill_offset + 3) * kXRegSize);
5297 5297
5298 // Check if the function scheduled an exception.
5299 __ Mov(x5, ExternalReference::scheduled_exception_address(isolate));
5300 __ Ldr(x5, MemOperand(x5));
5301 __ JumpIfNotRoot(x5, Heap::kTheHoleValueRootIndex,
5302 &promote_scheduled_exception);
5303 __ Bind(&exception_handled);
5304
5305 bool restore_context = context_restore_operand != NULL; 5298 bool restore_context = context_restore_operand != NULL;
5306 if (restore_context) { 5299 if (restore_context) {
5307 __ Ldr(cp, *context_restore_operand); 5300 __ Ldr(cp, *context_restore_operand);
5308 } 5301 }
5309 5302
5310 if (stack_space_operand != NULL) { 5303 if (stack_space_operand != NULL) {
5311 __ Ldr(w2, *stack_space_operand); 5304 __ Ldr(w2, *stack_space_operand);
5312 } 5305 }
5313 5306
5314 __ LeaveExitFrame(false, x1, !restore_context); 5307 __ LeaveExitFrame(false, x1, !restore_context);
5308
5309 // Check if the function scheduled an exception.
5310 __ Mov(x5, ExternalReference::scheduled_exception_address(isolate));
5311 __ Ldr(x5, MemOperand(x5));
5312 __ JumpIfNotRoot(x5, Heap::kTheHoleValueRootIndex,
5313 &promote_scheduled_exception);
5314
5315 if (stack_space_operand != NULL) { 5315 if (stack_space_operand != NULL) {
5316 __ Drop(x2, 1); 5316 __ Drop(x2, 1);
5317 } else { 5317 } else {
5318 __ Drop(stack_space); 5318 __ Drop(stack_space);
5319 } 5319 }
5320 __ Ret(); 5320 __ Ret();
5321 5321
5322 // Re-throw by promoting a scheduled exception.
5322 __ Bind(&promote_scheduled_exception); 5323 __ Bind(&promote_scheduled_exception);
5323 { 5324 __ TailCallRuntime(Runtime::kPromoteScheduledException, 0, 1);
5324 FrameScope frame(masm, StackFrame::INTERNAL);
5325 __ CallExternalReference(
5326 ExternalReference(Runtime::kPromoteScheduledException, isolate), 0);
5327 }
5328 __ B(&exception_handled);
5329 5325
5330 // HandleScope limit has changed. Delete allocated extensions. 5326 // HandleScope limit has changed. Delete allocated extensions.
5331 __ Bind(&delete_allocated_handles); 5327 __ Bind(&delete_allocated_handles);
5332 __ Str(limit_reg, MemOperand(handle_scope_base, kLimitOffset)); 5328 __ Str(limit_reg, MemOperand(handle_scope_base, kLimitOffset));
5333 // Save the return value in a callee-save register. 5329 // Save the return value in a callee-save register.
5334 Register saved_result = x19; 5330 Register saved_result = x19;
5335 __ Mov(saved_result, x0); 5331 __ Mov(saved_result, x0);
5336 __ Mov(x0, ExternalReference::isolate_address(isolate)); 5332 __ Mov(x0, ExternalReference::isolate_address(isolate));
5337 __ CallCFunction(ExternalReference::delete_handle_scope_extensions(isolate), 5333 __ CallCFunction(ExternalReference::delete_handle_scope_extensions(isolate),
5338 1); 5334 1);
(...skipping 179 matching lines...) Expand 10 before | Expand all | Expand 10 after
5518 kStackUnwindSpace, NULL, spill_offset, 5514 kStackUnwindSpace, NULL, spill_offset,
5519 MemOperand(fp, 6 * kPointerSize), NULL); 5515 MemOperand(fp, 6 * kPointerSize), NULL);
5520 } 5516 }
5521 5517
5522 5518
5523 #undef __ 5519 #undef __
5524 5520
5525 } } // namespace v8::internal 5521 } } // namespace v8::internal
5526 5522
5527 #endif // V8_TARGET_ARCH_ARM64 5523 #endif // V8_TARGET_ARCH_ARM64
OLDNEW
« no previous file with comments | « src/arm/code-stubs-arm.cc ('k') | src/compiler/ast-graph-builder.h » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698