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

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

Issue 1012103002: Delegate throwing in RegExpExecStub to CEntryStub. (Closed) Base URL: https://chromium.googlesource.com/v8/v8.git@master
Patch Set: Ported to all the architectures. 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/runtime/runtime-regexp.cc ('k') | src/x87/code-stubs-x87.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 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_X64 7 #if V8_TARGET_ARCH_X64
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 1026 matching lines...) Expand 10 before | Expand all | Expand 10 after
1037 // Return and remove the on-stack parameters. 1037 // Return and remove the on-stack parameters.
1038 __ bind(&done); 1038 __ bind(&done);
1039 __ ret(3 * kPointerSize); 1039 __ ret(3 * kPointerSize);
1040 1040
1041 // Do the runtime call to allocate the arguments object. 1041 // Do the runtime call to allocate the arguments object.
1042 __ bind(&runtime); 1042 __ bind(&runtime);
1043 __ TailCallRuntime(Runtime::kNewStrictArguments, 3, 1); 1043 __ TailCallRuntime(Runtime::kNewStrictArguments, 3, 1);
1044 } 1044 }
1045 1045
1046 1046
1047 static void ThrowPendingException(MacroAssembler* masm) {
1048 Isolate* isolate = masm->isolate();
1049
1050 ExternalReference pending_handler_context_address(
1051 Isolate::kPendingHandlerContextAddress, isolate);
1052 ExternalReference pending_handler_code_address(
1053 Isolate::kPendingHandlerCodeAddress, isolate);
1054 ExternalReference pending_handler_offset_address(
1055 Isolate::kPendingHandlerOffsetAddress, isolate);
1056 ExternalReference pending_handler_fp_address(
1057 Isolate::kPendingHandlerFPAddress, isolate);
1058 ExternalReference pending_handler_sp_address(
1059 Isolate::kPendingHandlerSPAddress, isolate);
1060
1061 // Ask the runtime for help to determine the handler. This will set rax to
1062 // contain the current pending exception, don't clobber it.
1063 ExternalReference find_handler(Runtime::kFindExceptionHandler, isolate);
1064 {
1065 FrameScope scope(masm, StackFrame::MANUAL);
1066 __ movp(arg_reg_1, Immediate(0)); // argc.
1067 __ movp(arg_reg_2, Immediate(0)); // argv.
1068 __ Move(arg_reg_3, ExternalReference::isolate_address(isolate));
1069 __ PrepareCallCFunction(3);
1070 __ CallCFunction(find_handler, 3);
1071 }
1072
1073 // Retrieve the handler context, SP and FP.
1074 __ movp(rsi, masm->ExternalOperand(pending_handler_context_address));
1075 __ movp(rsp, masm->ExternalOperand(pending_handler_sp_address));
1076 __ movp(rbp, masm->ExternalOperand(pending_handler_fp_address));
1077
1078 // If the handler is a JS frame, restore the context to the frame.
1079 // (kind == ENTRY) == (rbp == 0) == (rsi == 0), so we could test either
1080 // rbp or rsi.
1081 Label skip;
1082 __ testp(rsi, rsi);
1083 __ j(zero, &skip, Label::kNear);
1084 __ movp(Operand(rbp, StandardFrameConstants::kContextOffset), rsi);
1085 __ bind(&skip);
1086
1087 // Compute the handler entry address and jump to it.
1088 __ movp(rdi, masm->ExternalOperand(pending_handler_code_address));
1089 __ movp(rdx, masm->ExternalOperand(pending_handler_offset_address));
1090 __ leap(rdi, FieldOperand(rdi, rdx, times_1, Code::kHeaderSize));
1091 __ jmp(rdi);
1092 }
1093
1094
1095 void RegExpExecStub::Generate(MacroAssembler* masm) { 1047 void RegExpExecStub::Generate(MacroAssembler* masm) {
1096 // Just jump directly to runtime if native RegExp is not selected at compile 1048 // Just jump directly to runtime if native RegExp is not selected at compile
1097 // time or if regexp entry in generated code is turned off runtime switch or 1049 // time or if regexp entry in generated code is turned off runtime switch or
1098 // at compilation. 1050 // at compilation.
1099 #ifdef V8_INTERPRETED_REGEXP 1051 #ifdef V8_INTERPRETED_REGEXP
1100 __ TailCallRuntime(Runtime::kRegExpExec, 4, 1); 1052 __ TailCallRuntime(Runtime::kRegExpExec, 4, 1);
1101 #else // V8_INTERPRETED_REGEXP 1053 #else // V8_INTERPRETED_REGEXP
1102 1054
1103 // Stack frame on entry. 1055 // Stack frame on entry.
1104 // rsp[0] : return address 1056 // rsp[0] : return address
(...skipping 368 matching lines...) Expand 10 before | Expand all | Expand 10 after
1473 ExternalReference pending_exception_address( 1425 ExternalReference pending_exception_address(
1474 Isolate::kPendingExceptionAddress, isolate()); 1426 Isolate::kPendingExceptionAddress, isolate());
1475 Operand pending_exception_operand = 1427 Operand pending_exception_operand =
1476 masm->ExternalOperand(pending_exception_address, rbx); 1428 masm->ExternalOperand(pending_exception_address, rbx);
1477 __ movp(rax, pending_exception_operand); 1429 __ movp(rax, pending_exception_operand);
1478 __ LoadRoot(rdx, Heap::kTheHoleValueRootIndex); 1430 __ LoadRoot(rdx, Heap::kTheHoleValueRootIndex);
1479 __ cmpp(rax, rdx); 1431 __ cmpp(rax, rdx);
1480 __ j(equal, &runtime); 1432 __ j(equal, &runtime);
1481 1433
1482 // For exception, throw the exception again. 1434 // For exception, throw the exception again.
1483 __ EnterExitFrame(false); 1435 __ TailCallRuntime(Runtime::kRegExpExecReThrow, 4, 1);
1484 ThrowPendingException(masm);
1485 1436
1486 // Do the runtime call to execute the regexp. 1437 // Do the runtime call to execute the regexp.
1487 __ bind(&runtime); 1438 __ bind(&runtime);
1488 __ TailCallRuntime(Runtime::kRegExpExec, 4, 1); 1439 __ TailCallRuntime(Runtime::kRegExpExec, 4, 1);
1489 1440
1490 // Deferred code for string handling. 1441 // Deferred code for string handling.
1491 // (7) Not a long external string? If yes, go to (10). 1442 // (7) Not a long external string? If yes, go to (10).
1492 __ bind(&not_seq_nor_cons); 1443 __ bind(&not_seq_nor_cons);
1493 // Compare flags are still set from (3). 1444 // Compare flags are still set from (3).
1494 __ j(greater, &not_long_external, Label::kNear); // Go to (10). 1445 __ j(greater, &not_long_external, Label::kNear); // Go to (10).
(...skipping 990 matching lines...) Expand 10 before | Expand all | Expand 10 after
2485 __ int3(); 2436 __ int3();
2486 __ bind(&okay); 2437 __ bind(&okay);
2487 } 2438 }
2488 2439
2489 // Exit the JavaScript to C++ exit frame. 2440 // Exit the JavaScript to C++ exit frame.
2490 __ LeaveExitFrame(save_doubles()); 2441 __ LeaveExitFrame(save_doubles());
2491 __ ret(0); 2442 __ ret(0);
2492 2443
2493 // Handling of exception. 2444 // Handling of exception.
2494 __ bind(&exception_returned); 2445 __ bind(&exception_returned);
2495 ThrowPendingException(masm); 2446
2447 ExternalReference pending_handler_context_address(
2448 Isolate::kPendingHandlerContextAddress, isolate());
2449 ExternalReference pending_handler_code_address(
2450 Isolate::kPendingHandlerCodeAddress, isolate());
2451 ExternalReference pending_handler_offset_address(
2452 Isolate::kPendingHandlerOffsetAddress, isolate());
2453 ExternalReference pending_handler_fp_address(
2454 Isolate::kPendingHandlerFPAddress, isolate());
2455 ExternalReference pending_handler_sp_address(
2456 Isolate::kPendingHandlerSPAddress, isolate());
2457
2458 // Ask the runtime for help to determine the handler. This will set rax to
2459 // contain the current pending exception, don't clobber it.
2460 ExternalReference find_handler(Runtime::kFindExceptionHandler, isolate());
2461 {
2462 FrameScope scope(masm, StackFrame::MANUAL);
2463 __ movp(arg_reg_1, Immediate(0)); // argc.
2464 __ movp(arg_reg_2, Immediate(0)); // argv.
2465 __ Move(arg_reg_3, ExternalReference::isolate_address(isolate()));
2466 __ PrepareCallCFunction(3);
2467 __ CallCFunction(find_handler, 3);
2468 }
2469
2470 // Retrieve the handler context, SP and FP.
2471 __ movp(rsi, masm->ExternalOperand(pending_handler_context_address));
2472 __ movp(rsp, masm->ExternalOperand(pending_handler_sp_address));
2473 __ movp(rbp, masm->ExternalOperand(pending_handler_fp_address));
2474
2475 // If the handler is a JS frame, restore the context to the frame.
2476 // (kind == ENTRY) == (rbp == 0) == (rsi == 0), so we could test either
2477 // rbp or rsi.
2478 Label skip;
2479 __ testp(rsi, rsi);
2480 __ j(zero, &skip, Label::kNear);
2481 __ movp(Operand(rbp, StandardFrameConstants::kContextOffset), rsi);
2482 __ bind(&skip);
2483
2484 // Compute the handler entry address and jump to it.
2485 __ movp(rdi, masm->ExternalOperand(pending_handler_code_address));
2486 __ movp(rdx, masm->ExternalOperand(pending_handler_offset_address));
2487 __ leap(rdi, FieldOperand(rdi, rdx, times_1, Code::kHeaderSize));
2488 __ jmp(rdi);
2496 } 2489 }
2497 2490
2498 2491
2499 void JSEntryStub::Generate(MacroAssembler* masm) { 2492 void JSEntryStub::Generate(MacroAssembler* masm) {
2500 Label invoke, handler_entry, exit; 2493 Label invoke, handler_entry, exit;
2501 Label not_outermost_js, not_outermost_js_2; 2494 Label not_outermost_js, not_outermost_js_2;
2502 2495
2503 ProfileEntryHookStub::MaybeCallEntryHook(masm); 2496 ProfileEntryHookStub::MaybeCallEntryHook(masm);
2504 2497
2505 { // NOLINT. Scope block confuses linter. 2498 { // NOLINT. Scope block confuses linter.
(...skipping 2855 matching lines...) Expand 10 before | Expand all | Expand 10 after
5361 CallApiFunctionAndReturn(masm, api_function_address, thunk_ref, getter_arg, 5354 CallApiFunctionAndReturn(masm, api_function_address, thunk_ref, getter_arg,
5362 kStackSpace, nullptr, return_value_operand, NULL); 5355 kStackSpace, nullptr, return_value_operand, NULL);
5363 } 5356 }
5364 5357
5365 5358
5366 #undef __ 5359 #undef __
5367 5360
5368 } } // namespace v8::internal 5361 } } // namespace v8::internal
5369 5362
5370 #endif // V8_TARGET_ARCH_X64 5363 #endif // V8_TARGET_ARCH_X64
OLDNEW
« no previous file with comments | « src/runtime/runtime-regexp.cc ('k') | src/x87/code-stubs-x87.cc » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698