OLD | NEW |
1 // Copyright 2011 the V8 project authors. All rights reserved. | 1 // Copyright 2011 the V8 project authors. All rights reserved. |
2 // Redistribution and use in source and binary forms, with or without | 2 // Redistribution and use in source and binary forms, with or without |
3 // modification, are permitted provided that the following conditions are | 3 // modification, are permitted provided that the following conditions are |
4 // met: | 4 // met: |
5 // | 5 // |
6 // * Redistributions of source code must retain the above copyright | 6 // * Redistributions of source code must retain the above copyright |
7 // notice, this list of conditions and the following disclaimer. | 7 // notice, this list of conditions and the following disclaimer. |
8 // * Redistributions in binary form must reproduce the above | 8 // * Redistributions in binary form must reproduce the above |
9 // copyright notice, this list of conditions and the following | 9 // copyright notice, this list of conditions and the following |
10 // disclaimer in the documentation and/or other materials provided | 10 // disclaimer in the documentation and/or other materials provided |
(...skipping 50 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
61 * - r8 : code object pointer. Used to convert between absolute and | 61 * - r8 : code object pointer. Used to convert between absolute and |
62 * code-object-relative addresses. | 62 * code-object-relative addresses. |
63 * | 63 * |
64 * The registers rax, rbx, r9 and r11 are free to use for computations. | 64 * The registers rax, rbx, r9 and r11 are free to use for computations. |
65 * If changed to use r12+, they should be saved as callee-save registers. | 65 * If changed to use r12+, they should be saved as callee-save registers. |
66 * | 66 * |
67 * Each call to a C++ method should retain these registers. | 67 * Each call to a C++ method should retain these registers. |
68 * | 68 * |
69 * The stack will have the following content, in some order, indexable from the | 69 * The stack will have the following content, in some order, indexable from the |
70 * frame pointer (see, e.g., kStackHighEnd): | 70 * frame pointer (see, e.g., kStackHighEnd): |
| 71 * - Isolate* isolate (Address of the current isolate) |
71 * - direct_call (if 1, direct call from JavaScript code, if 0 call | 72 * - direct_call (if 1, direct call from JavaScript code, if 0 call |
72 * through the runtime system) | 73 * through the runtime system) |
73 * - stack_area_base (High end of the memory area to use as | 74 * - stack_area_base (High end of the memory area to use as |
74 * backtracking stack) | 75 * backtracking stack) |
75 * - int* capture_array (int[num_saved_registers_], for output). | 76 * - int* capture_array (int[num_saved_registers_], for output). |
76 * - end of input (Address of end of string) | 77 * - end of input (Address of end of string) |
77 * - start of input (Address of first character in string) | 78 * - start of input (Address of first character in string) |
78 * - start index (character index of start) | 79 * - start index (character index of start) |
79 * - String* input_string (input string) | 80 * - String* input_string (input string) |
80 * - return address | 81 * - return address |
(...skipping 866 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
947 __ bind(&exit_with_exception); | 948 __ bind(&exit_with_exception); |
948 // Exit with Result EXCEPTION(-1) to signal thrown exception. | 949 // Exit with Result EXCEPTION(-1) to signal thrown exception. |
949 __ movq(rax, Immediate(EXCEPTION)); | 950 __ movq(rax, Immediate(EXCEPTION)); |
950 __ jmp(&exit_label_); | 951 __ jmp(&exit_label_); |
951 } | 952 } |
952 | 953 |
953 FixupCodeRelativePositions(); | 954 FixupCodeRelativePositions(); |
954 | 955 |
955 CodeDesc code_desc; | 956 CodeDesc code_desc; |
956 masm_->GetCode(&code_desc); | 957 masm_->GetCode(&code_desc); |
957 Handle<Code> code = Factory::NewCode(code_desc, | 958 Isolate* isolate = ISOLATE; |
958 Code::ComputeFlags(Code::REGEXP), | 959 Handle<Code> code = isolate->factory()->NewCode( |
959 masm_->CodeObject()); | 960 code_desc, Code::ComputeFlags(Code::REGEXP), |
960 PROFILE(RegExpCodeCreateEvent(*code, *source)); | 961 masm_->CodeObject()); |
| 962 PROFILE(isolate, RegExpCodeCreateEvent(*code, *source)); |
961 return Handle<Object>::cast(code); | 963 return Handle<Object>::cast(code); |
962 } | 964 } |
963 | 965 |
964 | 966 |
965 void RegExpMacroAssemblerX64::GoTo(Label* to) { | 967 void RegExpMacroAssemblerX64::GoTo(Label* to) { |
966 BranchOrBacktrack(no_condition, to); | 968 BranchOrBacktrack(no_condition, to); |
967 } | 969 } |
968 | 970 |
969 | 971 |
970 void RegExpMacroAssemblerX64::IfRegisterGE(int reg, | 972 void RegExpMacroAssemblerX64::IfRegisterGE(int reg, |
(...skipping 163 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
1134 // Helper function for reading a value out of a stack frame. | 1136 // Helper function for reading a value out of a stack frame. |
1135 template <typename T> | 1137 template <typename T> |
1136 static T& frame_entry(Address re_frame, int frame_offset) { | 1138 static T& frame_entry(Address re_frame, int frame_offset) { |
1137 return reinterpret_cast<T&>(Memory::int32_at(re_frame + frame_offset)); | 1139 return reinterpret_cast<T&>(Memory::int32_at(re_frame + frame_offset)); |
1138 } | 1140 } |
1139 | 1141 |
1140 | 1142 |
1141 int RegExpMacroAssemblerX64::CheckStackGuardState(Address* return_address, | 1143 int RegExpMacroAssemblerX64::CheckStackGuardState(Address* return_address, |
1142 Code* re_code, | 1144 Code* re_code, |
1143 Address re_frame) { | 1145 Address re_frame) { |
1144 if (StackGuard::IsStackOverflow()) { | 1146 Isolate* isolate = frame_entry<Isolate*>(re_frame, kIsolate); |
1145 Top::StackOverflow(); | 1147 ASSERT(isolate == Isolate::Current()); |
| 1148 if (isolate->stack_guard()->IsStackOverflow()) { |
| 1149 isolate->StackOverflow(); |
1146 return EXCEPTION; | 1150 return EXCEPTION; |
1147 } | 1151 } |
1148 | 1152 |
1149 // If not real stack overflow the stack guard was used to interrupt | 1153 // If not real stack overflow the stack guard was used to interrupt |
1150 // execution for another purpose. | 1154 // execution for another purpose. |
1151 | 1155 |
1152 // If this is a direct call from JavaScript retry the RegExp forcing the call | 1156 // If this is a direct call from JavaScript retry the RegExp forcing the call |
1153 // through the runtime system. Currently the direct call cannot handle a GC. | 1157 // through the runtime system. Currently the direct call cannot handle a GC. |
1154 if (frame_entry<int>(re_frame, kDirectCall) == 1) { | 1158 if (frame_entry<int>(re_frame, kDirectCall) == 1) { |
1155 return RETRY; | 1159 return RETRY; |
(...skipping 217 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
1373 } | 1377 } |
1374 } | 1378 } |
1375 | 1379 |
1376 #undef __ | 1380 #undef __ |
1377 | 1381 |
1378 #endif // V8_INTERPRETED_REGEXP | 1382 #endif // V8_INTERPRETED_REGEXP |
1379 | 1383 |
1380 }} // namespace v8::internal | 1384 }} // namespace v8::internal |
1381 | 1385 |
1382 #endif // V8_TARGET_ARCH_X64 | 1386 #endif // V8_TARGET_ARCH_X64 |
OLD | NEW |